tempest.games 0.1.43 → 0.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,114 +1,114 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var RW=Object.create;var{getPrototypeOf:YW,defineProperty:O1,getOwnPropertyNames:QW}=Object;var zW=Object.prototype.hasOwnProperty;var s1=(H,A,L)=>{L=H!=null?RW(YW(H)):{};let I=A||!H||!H.__esModule?O1(L,"default",{value:H,enumerable:!0}):L;for(let $ of QW(H))if(!zW.call(I,$))O1(I,$,{get:()=>H[$],enumerable:!0});return I};var Q=(H,A)=>()=>(A||H((A={exports:{}}).exports,A),A.exports);var bW=(H,A)=>{for(var L in A)O1(H,L,{get:A[L],enumerable:!0,configurable:!0,set:(I)=>A[L]=()=>I})};var O=import.meta.require;var Bp=Q((zl,ZW)=>{ZW.exports=O("./bcrypt.linux-x64-musl-jkg5vvm1.node")});var cp=Q((bl,hW)=>{hW.exports=O("./bcrypt.linux-x64-gnu-30qvt60g.node")});var xp=Q((Hm,TI)=>{var __filename="/home/runner/work/wayforge/wayforge/node_modules/.pnpm/@node-rs+bcrypt@1.10.7/node_modules/@node-rs/bcrypt/binding.js",{createRequire:rW}=O("module");O=rW(__filename);var{readFileSync:jW}=O("fs"),AL=null,g=[],iD=()=>{let H=!1;if(process.platform==="linux"){if(H=dW(),H===null)H=qW();if(H===null)H=gW()}return H},kW=(H)=>H.includes("libc.musl-")||H.includes("ld-musl-"),dW=()=>{try{return jW("/usr/bin/ldd","utf-8").includes("musl")}catch{return null}},qW=()=>{let H=typeof process.report.getReport==="function"?process.report.getReport():null;if(!H)return null;if(H.header&&H.header.glibcVersionRuntime)return!1;if(Array.isArray(H.sharedObjects)){if(H.sharedObjects.some(kW))return!0}return!1},gW=()=>{try{return O("child_process").execSync("ldd --version",{encoding:"utf8"}).includes("musl")}catch(H){return!1}};function eW(){if(process.platform==="android")if(process.arch==="arm64"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.android-arm64.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-android-arm64");})()}catch(H){g.push(H)}}else if(process.arch==="arm"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.android-arm-eabi.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-android-arm-eabi");})()}catch(H){g.push(H)}}else g.push(new Error(`Unsupported architecture on Android ${process.arch}`));else if(process.platform==="win32")if(process.arch==="x64"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.win32-x64-msvc.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-win32-x64-msvc");})()}catch(H){g.push(H)}}else if(process.arch==="ia32"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.win32-ia32-msvc.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-win32-ia32-msvc");})()}catch(H){g.push(H)}}else if(process.arch==="arm64"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.win32-arm64-msvc.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-win32-arm64-msvc");})()}catch(H){g.push(H)}}else g.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));else if(process.platform==="darwin"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.darwin-universal.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-darwin-universal");})()}catch(H){g.push(H)}if(process.arch==="x64"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.darwin-x64.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-darwin-x64");})()}catch(H){g.push(H)}}else if(process.arch==="arm64"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.darwin-arm64.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-darwin-arm64");})()}catch(H){g.push(H)}}else g.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))}else if(process.platform==="freebsd")if(process.arch==="x64"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.freebsd-x64.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-freebsd-x64");})()}catch(H){g.push(H)}}else if(process.arch==="arm64"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.freebsd-arm64.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-freebsd-arm64");})()}catch(H){g.push(H)}}else g.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));else if(process.platform==="linux")if(process.arch==="x64")if(iD()){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-x64-musl.node");})()}catch(H){g.push(H)}try{return Bp()}catch(H){g.push(H)}}else{try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-x64-gnu.node");})()}catch(H){g.push(H)}try{return cp()}catch(H){g.push(H)}}else if(process.arch==="arm64")if(iD()){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-arm64-musl.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-linux-arm64-musl");})()}catch(H){g.push(H)}}else{try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-arm64-gnu.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-linux-arm64-gnu");})()}catch(H){g.push(H)}}else if(process.arch==="arm")if(iD()){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-arm-musleabihf.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-linux-arm-musleabihf");})()}catch(H){g.push(H)}}else{try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-arm-gnueabihf.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-linux-arm-gnueabihf");})()}catch(H){g.push(H)}}else if(process.arch==="riscv64")if(iD()){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-riscv64-musl.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-linux-riscv64-musl");})()}catch(H){g.push(H)}}else{try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-riscv64-gnu.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-linux-riscv64-gnu");})()}catch(H){g.push(H)}}else if(process.arch==="ppc64"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-ppc64-gnu.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-linux-ppc64-gnu");})()}catch(H){g.push(H)}}else if(process.arch==="s390x"){try{return (()=>{throw new Error("Cannot require module "+"./bcrypt.linux-s390x-gnu.node");})()}catch(H){g.push(H)}try{return (()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-linux-s390x-gnu");})()}catch(H){g.push(H)}}else g.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));else g.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))}AL=eW();if(!AL||process.env.NAPI_RS_FORCE_WASI){try{AL=(()=>{throw new Error("Cannot require module "+"./bcrypt.wasi.cjs");})()}catch(H){if(process.env.NAPI_RS_FORCE_WASI)g.push(H)}if(!AL)try{AL=(()=>{throw new Error("Cannot require module "+"@node-rs/bcrypt-wasm32-wasi");})()}catch(H){if(process.env.NAPI_RS_FORCE_WASI)g.push(H)}}if(!AL){if(g.length>0)throw new Error("Failed to load native binding",{cause:g});throw new Error("Failed to load native binding")}Hm.DEFAULT_COST=AL.DEFAULT_COST;Hm.genSalt=AL.genSalt;Hm.genSaltSync=AL.genSaltSync;Hm.hash=AL.hash;Hm.hashSync=AL.hashSync;Hm.verify=AL.verify;Hm.verifySync=AL.verifySync});var Mx=Q((Dx)=>{Object.defineProperty(Dx,"__esModule",{value:!0});class sI extends Error{}class Ac extends sI{constructor(H){super(`Invalid DateTime: ${H.toMessage()}`)}}class Lc extends sI{constructor(H){super(`Invalid Interval: ${H.toMessage()}`)}}class Ic extends sI{constructor(H){super(`Invalid Duration: ${H.toMessage()}`)}}class t$ extends sI{}class Zu extends sI{constructor(H){super(`Invalid unit ${H}`)}}class _A extends sI{}class tI extends sI{constructor(){super("Zone is an abstract class")}}var s="numeric",lL="short",$L="long",MM={year:s,month:s,day:s},$c={year:s,month:lL,day:s},D5={year:s,month:lL,day:s,weekday:lL},fc={year:s,month:$L,day:s},Ec={year:s,month:$L,day:s,weekday:$L},Dc={hour:s,minute:s},Mc={hour:s,minute:s,second:s},oc={hour:s,minute:s,second:s,timeZoneName:lL},uc={hour:s,minute:s,second:s,timeZoneName:$L},tc={hour:s,minute:s,hourCycle:"h23"},ic={hour:s,minute:s,second:s,hourCycle:"h23"},pc={hour:s,minute:s,second:s,hourCycle:"h23",timeZoneName:lL},nc={hour:s,minute:s,second:s,hourCycle:"h23",timeZoneName:$L},Bc={year:s,month:s,day:s,hour:s,minute:s},cc={year:s,month:s,day:s,hour:s,minute:s,second:s},xc={year:s,month:lL,day:s,hour:s,minute:s},Uc={year:s,month:lL,day:s,hour:s,minute:s,second:s},M5={year:s,month:lL,day:s,weekday:lL,hour:s,minute:s},Cc={year:s,month:$L,day:s,hour:s,minute:s,timeZoneName:lL},Tc={year:s,month:$L,day:s,hour:s,minute:s,second:s,timeZoneName:lL},Gc={year:s,month:$L,day:s,weekday:$L,hour:s,minute:s,timeZoneName:$L},Fc={year:s,month:$L,day:s,weekday:$L,hour:s,minute:s,second:s,timeZoneName:$L};class p${get type(){throw new tI}get name(){throw new tI}get ianaName(){return this.name}get isUniversal(){throw new tI}offsetName(H,A){throw new tI}formatOffset(H,A){throw new tI}offset(H){throw new tI}equals(H){throw new tI}get isValid(){throw new tI}}var mu=null;class vE extends p${static get instance(){if(mu===null)mu=new vE;return mu}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(H,{format:A,locale:L}){return Oc(H,A,L)}formatOffset(H,A){return wE(this.offset(H),A)}offset(H){return-new Date(H).getTimezoneOffset()}equals(H){return H.type==="system"}get isValid(){return!0}}var au=new Map;function o5(H){let A=au.get(H);if(A===void 0)A=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:H,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),au.set(H,A);return A}var u5={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function t5(H,A){let L=H.format(A).replace(/\u200E/g,""),I=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(L),[,$,f,E,D,M,o,u]=I;return[E,$,f,D,M,o,u]}function i5(H,A){let L=H.formatToParts(A),I=[];for(let $=0;$<L.length;$++){let{type:f,value:E}=L[$],D=u5[f];if(f==="era")I[D]=E;else if(!AH(D))I[D]=parseInt(E,10)}return I}var Pu=new Map;class kL extends p${static create(H){let A=Pu.get(H);if(A===void 0)Pu.set(H,A=new kL(H));return A}static resetCache(){Pu.clear(),au.clear()}static isValidSpecifier(H){return this.isValidZone(H)}static isValidZone(H){if(!H)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:H}).format(),!0}catch(A){return!1}}constructor(H){super();this.zoneName=H,this.valid=kL.isValidZone(H)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(H,{format:A,locale:L}){return Oc(H,A,L,this.name)}formatOffset(H,A){return wE(this.offset(H),A)}offset(H){if(!this.valid)return NaN;let A=new Date(H);if(isNaN(A))return NaN;let L=o5(this.name),[I,$,f,E,D,M,o]=L.formatToParts?i5(L,A):t5(L,A);if(E==="BC")I=-Math.abs(I)+1;let t=pM({year:I,month:$,day:f,hour:D===24?0:D,minute:M,second:o,millisecond:0}),i=+A,B=i%1000;return i-=B>=0?B:1000+B,(t-i)/60000}equals(H){return H.type==="iana"&&H.name===this.name}get isValid(){return this.valid}}var PB={};function p5(H,A={}){let L=JSON.stringify([H,A]),I=PB[L];if(!I)I=new Intl.ListFormat(H,A),PB[L]=I;return I}var lu=new Map;function Ou(H,A={}){let L=JSON.stringify([H,A]),I=lu.get(L);if(I===void 0)I=new Intl.DateTimeFormat(H,A),lu.set(L,I);return I}var su=new Map;function n5(H,A={}){let L=JSON.stringify([H,A]),I=su.get(L);if(I===void 0)I=new Intl.NumberFormat(H,A),su.set(L,I);return I}var Nu=new Map;function B5(H,A={}){let{base:L,...I}=A,$=JSON.stringify([H,I]),f=Nu.get($);if(f===void 0)f=new Intl.RelativeTimeFormat(H,A),Nu.set($,f);return f}var SE=null;function c5(){if(SE)return SE;else return SE=new Intl.DateTimeFormat().resolvedOptions().locale,SE}var yu=new Map;function _c(H){let A=yu.get(H);if(A===void 0)A=new Intl.DateTimeFormat(H).resolvedOptions(),yu.set(H,A);return A}var Ru=new Map;function x5(H){let A=Ru.get(H);if(!A){let L=new Intl.Locale(H);if(A="getWeekInfo"in L?L.getWeekInfo():L.weekInfo,!("minimalDays"in A))A={...Xc,...A};Ru.set(H,A)}return A}function U5(H){let A=H.indexOf("-x-");if(A!==-1)H=H.substring(0,A);let L=H.indexOf("-u-");if(L===-1)return[H];else{let I,$;try{I=Ou(H).resolvedOptions(),$=H}catch(D){let M=H.substring(0,L);I=Ou(M).resolvedOptions(),$=M}let{numberingSystem:f,calendar:E}=I;return[$,f,E]}}function C5(H,A,L){if(L||A){if(!H.includes("-u-"))H+="-u";if(L)H+=`-ca-${L}`;if(A)H+=`-nu-${A}`;return H}else return H}function T5(H){let A=[];for(let L=1;L<=12;L++){let I=HH.utc(2009,L,1);A.push(H(I))}return A}function G5(H){let A=[];for(let L=1;L<=7;L++){let I=HH.utc(2016,11,13+L);A.push(H(I))}return A}function IM(H,A,L,I){let $=H.listingMode();if($==="error")return null;else if($==="en")return L(A);else return I(A)}function F5(H){if(H.numberingSystem&&H.numberingSystem!=="latn")return!1;else return H.numberingSystem==="latn"||!H.locale||H.locale.startsWith("en")||_c(H.locale).numberingSystem==="latn"}class Wc{constructor(H,A,L){this.padTo=L.padTo||0,this.floor=L.floor||!1;let{padTo:I,floor:$,...f}=L;if(!A||Object.keys(f).length>0){let E={useGrouping:!1,...L};if(L.padTo>0)E.minimumIntegerDigits=L.padTo;this.inf=n5(H,E)}}format(H){if(this.inf){let A=this.floor?Math.floor(H):H;return this.inf.format(A)}else{let A=this.floor?Math.floor(H):qu(H,3);return fA(A,this.padTo)}}}class mc{constructor(H,A,L){this.opts=L,this.originalZone=void 0;let I=void 0;if(this.opts.timeZone)this.dt=H;else if(H.zone.type==="fixed"){let f=-1*(H.offset/60),E=f>=0?`Etc/GMT+${f}`:`Etc/GMT${f}`;if(H.offset!==0&&kL.create(E).valid)I=E,this.dt=H;else I="UTC",this.dt=H.offset===0?H:H.setZone("UTC").plus({minutes:H.offset}),this.originalZone=H.zone}else if(H.zone.type==="system")this.dt=H;else if(H.zone.type==="iana")this.dt=H,I=H.zone.name;else I="UTC",this.dt=H.setZone("UTC").plus({minutes:H.offset}),this.originalZone=H.zone;let $={...this.opts};$.timeZone=$.timeZone||I,this.dtf=Ou(A,$)}format(){if(this.originalZone)return this.formatToParts().map(({value:H})=>H).join("");return this.dtf.format(this.dt.toJSDate())}formatToParts(){let H=this.dtf.formatToParts(this.dt.toJSDate());if(this.originalZone)return H.map((A)=>{if(A.type==="timeZoneName"){let L=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...A,value:L}}else return A});return H}resolvedOptions(){return this.dtf.resolvedOptions()}}class Pc{constructor(H,A,L){if(this.opts={style:"long",...L},!A&&ac())this.rtf=B5(H,L)}format(H,A){if(this.rtf)return this.rtf.format(H,A);else return z5(A,H,this.opts.numeric,this.opts.style!=="long")}formatToParts(H,A){if(this.rtf)return this.rtf.formatToParts(H,A);else return[]}}var Xc={firstDay:1,minimalDays:4,weekend:[6,7]};class _H{static fromOpts(H){return _H.create(H.locale,H.numberingSystem,H.outputCalendar,H.weekSettings,H.defaultToEN)}static create(H,A,L,I,$=!1){let f=H||ZH.defaultLocale,E=f||($?"en-US":c5()),D=A||ZH.defaultNumberingSystem,M=L||ZH.defaultOutputCalendar,o=Qu(I)||ZH.defaultWeekSettings;return new _H(E,D,M,o,f)}static resetCache(){SE=null,lu.clear(),su.clear(),Nu.clear(),yu.clear(),Ru.clear()}static fromObject({locale:H,numberingSystem:A,outputCalendar:L,weekSettings:I}={}){return _H.create(H,A,L,I)}constructor(H,A,L,I,$){let[f,E,D]=U5(H);this.locale=f,this.numberingSystem=A||E||null,this.outputCalendar=L||D||null,this.weekSettings=I,this.intl=C5(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=$,this.fastNumbersCached=null}get fastNumbers(){if(this.fastNumbersCached==null)this.fastNumbersCached=F5(this);return this.fastNumbersCached}listingMode(){let H=this.isEnglish(),A=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return H&&A?"en":"intl"}clone(H){if(!H||Object.getOwnPropertyNames(H).length===0)return this;else return _H.create(H.locale||this.specifiedLocale,H.numberingSystem||this.numberingSystem,H.outputCalendar||this.outputCalendar,Qu(H.weekSettings)||this.weekSettings,H.defaultToEN||!1)}redefaultToEN(H={}){return this.clone({...H,defaultToEN:!0})}redefaultToSystem(H={}){return this.clone({...H,defaultToEN:!1})}months(H,A=!1){return IM(this,H,yc,()=>{let L=A?{month:H,day:"numeric"}:{month:H},I=A?"format":"standalone";if(!this.monthsCache[I][H])this.monthsCache[I][H]=T5(($)=>this.extract($,L,"month"));return this.monthsCache[I][H]})}weekdays(H,A=!1){return IM(this,H,Qc,()=>{let L=A?{weekday:H,year:"numeric",month:"long",day:"numeric"}:{weekday:H},I=A?"format":"standalone";if(!this.weekdaysCache[I][H])this.weekdaysCache[I][H]=G5(($)=>this.extract($,L,"weekday"));return this.weekdaysCache[I][H]})}meridiems(){return IM(this,void 0,()=>zc,()=>{if(!this.meridiemCache){let H={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[HH.utc(2016,11,13,9),HH.utc(2016,11,13,19)].map((A)=>this.extract(A,H,"dayperiod"))}return this.meridiemCache})}eras(H){return IM(this,H,bc,()=>{let A={era:H};if(!this.eraCache[H])this.eraCache[H]=[HH.utc(-40,1,1),HH.utc(2017,1,1)].map((L)=>this.extract(L,A,"era"));return this.eraCache[H]})}extract(H,A,L){let I=this.dtFormatter(H,A),$=I.formatToParts(),f=$.find((E)=>E.type.toLowerCase()===L);return f?f.value:null}numberFormatter(H={}){return new Wc(this.intl,H.forceSimple||this.fastNumbers,H)}dtFormatter(H,A={}){return new mc(H,this.intl,A)}relFormatter(H={}){return new Pc(this.intl,this.isEnglish(),H)}listFormatter(H={}){return p5(this.intl,H)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||_c(this.intl).locale.startsWith("en-us")}getWeekSettings(){if(this.weekSettings)return this.weekSettings;else if(!lc())return Xc;else return x5(this.locale)}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(H){return this.locale===H.locale&&this.numberingSystem===H.numberingSystem&&this.outputCalendar===H.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}var Xu=null;class vA extends p${static get utcInstance(){if(Xu===null)Xu=new vA(0);return Xu}static instance(H){return H===0?vA.utcInstance:new vA(H)}static parseSpecifier(H){if(H){let A=H.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(A)return new vA(nM(A[1],A[2]))}return null}constructor(H){super();this.fixed=H}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${wE(this.fixed,"narrow")}`}get ianaName(){if(this.fixed===0)return"Etc/UTC";else return`Etc/GMT${wE(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(H,A){return wE(this.fixed,A)}get isUniversal(){return!0}offset(){return this.fixed}equals(H){return H.type==="fixed"&&H.fixed===this.fixed}get isValid(){return!0}}class hu extends p${constructor(H){super();this.zoneName=H}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function lI(H,A){if(AH(H)||H===null)return A;else if(H instanceof p$)return H;else if(S5(H)){let L=H.toLowerCase();if(L==="default")return A;else if(L==="local"||L==="system")return vE.instance;else if(L==="utc"||L==="gmt")return vA.utcInstance;else return vA.parseSpecifier(L)||kL.create(H)}else if(OI(H))return vA.instance(H);else if(typeof H==="object"&&"offset"in H&&typeof H.offset==="function")return H;else return new hu(H)}var ru={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},XB={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},_5=ru.hanidec.replace(/[\[|\]]/g,"").split("");function W5(H){let A=parseInt(H,10);if(isNaN(A)){A="";for(let L=0;L<H.length;L++){let I=H.charCodeAt(L);if(H[L].search(ru.hanidec)!==-1)A+=_5.indexOf(H[L]);else for(let $ in XB){let[f,E]=XB[$];if(I>=f&&I<=E)A+=I-f}}return parseInt(A,10)}else return A}var Yu=new Map;function m5(){Yu.clear()}function vL({numberingSystem:H},A=""){let L=H||"latn",I=Yu.get(L);if(I===void 0)I=new Map,Yu.set(L,I);let $=I.get(A);if($===void 0)$=new RegExp(`${ru[L]}${A}`),I.set(A,$);return $}var SB=()=>Date.now(),JB="system",VB=null,wB=null,KB=null,vB=60,aB,lB=null;class ZH{static get now(){return SB}static set now(H){SB=H}static set defaultZone(H){JB=H}static get defaultZone(){return lI(JB,vE.instance)}static get defaultLocale(){return VB}static set defaultLocale(H){VB=H}static get defaultNumberingSystem(){return wB}static set defaultNumberingSystem(H){wB=H}static get defaultOutputCalendar(){return KB}static set defaultOutputCalendar(H){KB=H}static get defaultWeekSettings(){return lB}static set defaultWeekSettings(H){lB=Qu(H)}static get twoDigitCutoffYear(){return vB}static set twoDigitCutoffYear(H){vB=H%100}static get throwOnInvalid(){return aB}static set throwOnInvalid(H){aB=H}static resetCaches(){_H.resetCache(),kL.resetCache(),HH.resetCache(),m5()}}class CL{constructor(H,A){this.reason=H,this.explanation=A}toMessage(){if(this.explanation)return`${this.reason}: ${this.explanation}`;else return this.reason}}var Sc=[0,31,59,90,120,151,181,212,243,273,304,334],Jc=[0,31,60,91,121,152,182,213,244,274,305,335];function TL(H,A){return new CL("unit out of range",`you specified ${A} (of type ${typeof A}) as a ${H}, which is invalid`)}function ju(H,A,L){let I=new Date(Date.UTC(H,A-1,L));if(H<100&&H>=0)I.setUTCFullYear(I.getUTCFullYear()-1900);let $=I.getUTCDay();return $===0?7:$}function Vc(H,A,L){return L+(aE(H)?Jc:Sc)[A-1]}function wc(H,A){let L=aE(H)?Jc:Sc,I=L.findIndex((f)=>f<A),$=A-L[I];return{month:I+1,day:$}}function ku(H,A){return(H-A+7)%7+1}function oM(H,A=4,L=1){let{year:I,month:$,day:f}=H,E=Vc(I,$,f),D=ku(ju(I,$,f),L),M=Math.floor((E-D+14-A)/7),o;if(M<1)o=I-1,M=KE(o,A,L);else if(M>KE(I,A,L))o=I+1,M=1;else o=I;return{weekYear:o,weekNumber:M,weekday:D,...BM(H)}}function OB(H,A=4,L=1){let{weekYear:I,weekNumber:$,weekday:f}=H,E=ku(ju(I,1,A),L),D=Mf(I),M=$*7+f-E-7+A,o;if(M<1)o=I-1,M+=Mf(o);else if(M>D)o=I+1,M-=Mf(I);else o=I;let{month:u,day:t}=wc(o,M);return{year:o,month:u,day:t,...BM(H)}}function Su(H){let{year:A,month:L,day:I}=H,$=Vc(A,L,I);return{year:A,ordinal:$,...BM(H)}}function sB(H){let{year:A,ordinal:L}=H,{month:I,day:$}=wc(A,L);return{year:A,month:I,day:$,...BM(H)}}function NB(H,A){if(!AH(H.localWeekday)||!AH(H.localWeekNumber)||!AH(H.localWeekYear)){if(!AH(H.weekday)||!AH(H.weekNumber)||!AH(H.weekYear))throw new t$("Cannot mix locale-based week fields with ISO-based week fields");if(!AH(H.localWeekday))H.weekday=H.localWeekday;if(!AH(H.localWeekNumber))H.weekNumber=H.localWeekNumber;if(!AH(H.localWeekYear))H.weekYear=H.localWeekYear;return delete H.localWeekday,delete H.localWeekNumber,delete H.localWeekYear,{minDaysInFirstWeek:A.getMinDaysInFirstWeek(),startOfWeek:A.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function P5(H,A=4,L=1){let I=iM(H.weekYear),$=GL(H.weekNumber,1,KE(H.weekYear,A,L)),f=GL(H.weekday,1,7);if(!I)return TL("weekYear",H.weekYear);else if(!$)return TL("week",H.weekNumber);else if(!f)return TL("weekday",H.weekday);else return!1}function X5(H){let A=iM(H.year),L=GL(H.ordinal,1,Mf(H.year));if(!A)return TL("year",H.year);else if(!L)return TL("ordinal",H.ordinal);else return!1}function Kc(H){let A=iM(H.year),L=GL(H.month,1,12),I=GL(H.day,1,uM(H.year,H.month));if(!A)return TL("year",H.year);else if(!L)return TL("month",H.month);else if(!I)return TL("day",H.day);else return!1}function vc(H){let{hour:A,minute:L,second:I,millisecond:$}=H,f=GL(A,0,23)||A===24&&L===0&&I===0&&$===0,E=GL(L,0,59),D=GL(I,0,59),M=GL($,0,999);if(!f)return TL("hour",A);else if(!E)return TL("minute",L);else if(!D)return TL("second",I);else if(!M)return TL("millisecond",$);else return!1}function AH(H){return typeof H==="undefined"}function OI(H){return typeof H==="number"}function iM(H){return typeof H==="number"&&H%1===0}function S5(H){return typeof H==="string"}function J5(H){return Object.prototype.toString.call(H)==="[object Date]"}function ac(){try{return typeof Intl!=="undefined"&&!!Intl.RelativeTimeFormat}catch(H){return!1}}function lc(){try{return typeof Intl!=="undefined"&&!!Intl.Locale&&(("weekInfo"in Intl.Locale.prototype)||("getWeekInfo"in Intl.Locale.prototype))}catch(H){return!1}}function V5(H){return Array.isArray(H)?H:[H]}function yB(H,A,L){if(H.length===0)return;return H.reduce((I,$)=>{let f=[A($),$];if(!I)return f;else if(L(I[0],f[0])===I[0])return I;else return f},null)[1]}function w5(H,A){return A.reduce((L,I)=>{return L[I]=H[I],L},{})}function uf(H,A){return Object.prototype.hasOwnProperty.call(H,A)}function Qu(H){if(H==null)return null;else if(typeof H!=="object")throw new _A("Week settings must be an object");else{if(!GL(H.firstDay,1,7)||!GL(H.minimalDays,1,7)||!Array.isArray(H.weekend)||H.weekend.some((A)=>!GL(A,1,7)))throw new _A("Invalid week settings");return{firstDay:H.firstDay,minimalDays:H.minimalDays,weekend:Array.from(H.weekend)}}}function GL(H,A,L){return iM(H)&&H>=A&&H<=L}function K5(H,A){return H-A*Math.floor(H/A)}function fA(H,A=2){let L=H<0,I;if(L)I="-"+(""+-H).padStart(A,"0");else I=(""+H).padStart(A,"0");return I}function aI(H){if(AH(H)||H===null||H==="")return;else return parseInt(H,10)}function o$(H){if(AH(H)||H===null||H==="")return;else return parseFloat(H)}function du(H){if(AH(H)||H===null||H==="")return;else{let A=parseFloat("0."+H)*1000;return Math.floor(A)}}function qu(H,A,L=!1){let I=10**A;return(L?Math.trunc:Math.round)(H*I)/I}function aE(H){return H%4===0&&(H%100!==0||H%400===0)}function Mf(H){return aE(H)?366:365}function uM(H,A){let L=K5(A-1,12)+1,I=H+(A-L)/12;if(L===2)return aE(I)?29:28;else return[31,null,31,30,31,30,31,31,30,31,30,31][L-1]}function pM(H){let A=Date.UTC(H.year,H.month-1,H.day,H.hour,H.minute,H.second,H.millisecond);if(H.year<100&&H.year>=0)A=new Date(A),A.setUTCFullYear(H.year,H.month-1,H.day);return+A}function RB(H,A,L){return-ku(ju(H,1,A),L)+A-1}function KE(H,A=4,L=1){let I=RB(H,A,L),$=RB(H+1,A,L);return(Mf(H)-I+$)/7}function zu(H){if(H>99)return H;else return H>ZH.twoDigitCutoffYear?1900+H:2000+H}function Oc(H,A,L,I=null){let $=new Date(H),f={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};if(I)f.timeZone=I;let E={timeZoneName:A,...f},D=new Intl.DateTimeFormat(L,E).formatToParts($).find((M)=>M.type.toLowerCase()==="timezonename");return D?D.value:null}function nM(H,A){let L=parseInt(H,10);if(Number.isNaN(L))L=0;let I=parseInt(A,10)||0,$=L<0||Object.is(L,-0)?-I:I;return L*60+$}function sc(H){let A=Number(H);if(typeof H==="boolean"||H===""||Number.isNaN(A))throw new _A(`Invalid unit value ${H}`);return A}function tM(H,A){let L={};for(let I in H)if(uf(H,I)){let $=H[I];if($===void 0||$===null)continue;L[A(I)]=sc($)}return L}function wE(H,A){let L=Math.trunc(Math.abs(H/60)),I=Math.trunc(Math.abs(H%60)),$=H>=0?"+":"-";switch(A){case"short":return`${$}${fA(L,2)}:${fA(I,2)}`;case"narrow":return`${$}${L}${I>0?`:${I}`:""}`;case"techie":return`${$}${fA(L,2)}${fA(I,2)}`;default:throw new RangeError(`Value format ${A} is out of range for property format`)}}function BM(H){return w5(H,["hour","minute","second","millisecond"])}var v5=["January","February","March","April","May","June","July","August","September","October","November","December"],Nc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],a5=["J","F","M","A","M","J","J","A","S","O","N","D"];function yc(H){switch(H){case"narrow":return[...a5];case"short":return[...Nc];case"long":return[...v5];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var Rc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Yc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],l5=["M","T","W","T","F","S","S"];function Qc(H){switch(H){case"narrow":return[...l5];case"short":return[...Yc];case"long":return[...Rc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var zc=["AM","PM"],O5=["Before Christ","Anno Domini"],s5=["BC","AD"],N5=["B","A"];function bc(H){switch(H){case"narrow":return[...N5];case"short":return[...s5];case"long":return[...O5];default:return null}}function y5(H){return zc[H.hour<12?0:1]}function R5(H,A){return Qc(A)[H.weekday-1]}function Y5(H,A){return yc(A)[H.month-1]}function Q5(H,A){return bc(A)[H.year<0?0:1]}function z5(H,A,L="always",I=!1){let $={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},f=["hours","minutes","seconds"].indexOf(H)===-1;if(L==="auto"&&f){let t=H==="days";switch(A){case 1:return t?"tomorrow":`next ${$[H][0]}`;case-1:return t?"yesterday":`last ${$[H][0]}`;case 0:return t?"today":`this ${$[H][0]}`}}let E=Object.is(A,-0)||A<0,D=Math.abs(A),M=D===1,o=$[H],u=I?M?o[1]:o[2]||o[1]:M?$[H][0]:H;return E?`${D} ${u} ago`:`in ${D} ${u}`}function YB(H,A){let L="";for(let I of H)if(I.literal)L+=I.val;else L+=A(I.val);return L}var b5={D:MM,DD:$c,DDD:fc,DDDD:Ec,t:Dc,tt:Mc,ttt:oc,tttt:uc,T:tc,TT:ic,TTT:pc,TTTT:nc,f:Bc,ff:xc,fff:Cc,ffff:Gc,F:cc,FF:Uc,FFF:Tc,FFFF:Fc};class KA{static create(H,A={}){return new KA(H,A)}static parseFormat(H){let A=null,L="",I=!1,$=[];for(let f=0;f<H.length;f++){let E=H.charAt(f);if(E==="'"){if(L.length>0)$.push({literal:I||/^\s+$/.test(L),val:L});A=null,L="",I=!I}else if(I)L+=E;else if(E===A)L+=E;else{if(L.length>0)$.push({literal:/^\s+$/.test(L),val:L});L=E,A=E}}if(L.length>0)$.push({literal:I||/^\s+$/.test(L),val:L});return $}static macroTokenToFormatOpts(H){return b5[H]}constructor(H,A){this.opts=A,this.loc=H,this.systemLoc=null}formatWithSystemDefault(H,A){if(this.systemLoc===null)this.systemLoc=this.loc.redefaultToSystem();return this.systemLoc.dtFormatter(H,{...this.opts,...A}).format()}dtFormatter(H,A={}){return this.loc.dtFormatter(H,{...this.opts,...A})}formatDateTime(H,A){return this.dtFormatter(H,A).format()}formatDateTimeParts(H,A){return this.dtFormatter(H,A).formatToParts()}formatInterval(H,A){return this.dtFormatter(H.start,A).dtf.formatRange(H.start.toJSDate(),H.end.toJSDate())}resolvedOptions(H,A){return this.dtFormatter(H,A).resolvedOptions()}num(H,A=0){if(this.opts.forceSimple)return fA(H,A);let L={...this.opts};if(A>0)L.padTo=A;return this.loc.numberFormatter(L).format(H)}formatDateTimeFromString(H,A){let L=this.loc.listingMode()==="en",I=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",$=(i,B)=>this.loc.extract(H,i,B),f=(i)=>{if(H.isOffsetFixed&&H.offset===0&&i.allowZ)return"Z";return H.isValid?H.zone.formatOffset(H.ts,i.format):""},E=()=>L?y5(H):$({hour:"numeric",hourCycle:"h12"},"dayperiod"),D=(i,B)=>L?Y5(H,i):$(B?{month:i}:{month:i,day:"numeric"},"month"),M=(i,B)=>L?R5(H,i):$(B?{weekday:i}:{weekday:i,month:"long",day:"numeric"},"weekday"),o=(i)=>{let B=KA.macroTokenToFormatOpts(i);if(B)return this.formatWithSystemDefault(H,B);else return i},u=(i)=>L?Q5(H,i):$({era:i},"era"),t=(i)=>{switch(i){case"S":return this.num(H.millisecond);case"u":case"SSS":return this.num(H.millisecond,3);case"s":return this.num(H.second);case"ss":return this.num(H.second,2);case"uu":return this.num(Math.floor(H.millisecond/10),2);case"uuu":return this.num(Math.floor(H.millisecond/100));case"m":return this.num(H.minute);case"mm":return this.num(H.minute,2);case"h":return this.num(H.hour%12===0?12:H.hour%12);case"hh":return this.num(H.hour%12===0?12:H.hour%12,2);case"H":return this.num(H.hour);case"HH":return this.num(H.hour,2);case"Z":return f({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return f({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return f({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return H.zone.offsetName(H.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return H.zone.offsetName(H.ts,{format:"long",locale:this.loc.locale});case"z":return H.zoneName;case"a":return E();case"d":return I?$({day:"numeric"},"day"):this.num(H.day);case"dd":return I?$({day:"2-digit"},"day"):this.num(H.day,2);case"c":return this.num(H.weekday);case"ccc":return M("short",!0);case"cccc":return M("long",!0);case"ccccc":return M("narrow",!0);case"E":return this.num(H.weekday);case"EEE":return M("short",!1);case"EEEE":return M("long",!1);case"EEEEE":return M("narrow",!1);case"L":return I?$({month:"numeric",day:"numeric"},"month"):this.num(H.month);case"LL":return I?$({month:"2-digit",day:"numeric"},"month"):this.num(H.month,2);case"LLL":return D("short",!0);case"LLLL":return D("long",!0);case"LLLLL":return D("narrow",!0);case"M":return I?$({month:"numeric"},"month"):this.num(H.month);case"MM":return I?$({month:"2-digit"},"month"):this.num(H.month,2);case"MMM":return D("short",!1);case"MMMM":return D("long",!1);case"MMMMM":return D("narrow",!1);case"y":return I?$({year:"numeric"},"year"):this.num(H.year);case"yy":return I?$({year:"2-digit"},"year"):this.num(H.year.toString().slice(-2),2);case"yyyy":return I?$({year:"numeric"},"year"):this.num(H.year,4);case"yyyyyy":return I?$({year:"numeric"},"year"):this.num(H.year,6);case"G":return u("short");case"GG":return u("long");case"GGGGG":return u("narrow");case"kk":return this.num(H.weekYear.toString().slice(-2),2);case"kkkk":return this.num(H.weekYear,4);case"W":return this.num(H.weekNumber);case"WW":return this.num(H.weekNumber,2);case"n":return this.num(H.localWeekNumber);case"nn":return this.num(H.localWeekNumber,2);case"ii":return this.num(H.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(H.localWeekYear,4);case"o":return this.num(H.ordinal);case"ooo":return this.num(H.ordinal,3);case"q":return this.num(H.quarter);case"qq":return this.num(H.quarter,2);case"X":return this.num(Math.floor(H.ts/1000));case"x":return this.num(H.ts);default:return o(i)}};return YB(KA.parseFormat(A),t)}formatDurationFromString(H,A){let L=(D)=>{switch(D[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},I=(D)=>(M)=>{let o=L(M);if(o)return this.num(D.get(o),M.length);else return M},$=KA.parseFormat(A),f=$.reduce((D,{literal:M,val:o})=>M?D:D.concat(o),[]),E=H.shiftTo(...f.map(L).filter((D)=>D));return YB($,I(E))}}var Zc=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function tf(...H){let A=H.reduce((L,I)=>L+I.source,"");return RegExp(`^${A}$`)}function pf(...H){return(A)=>H.reduce(([L,I,$],f)=>{let[E,D,M]=f(A,$);return[{...L,...E},D||I,M]},[{},null,1]).slice(0,2)}function nf(H,...A){if(H==null)return[null,null];for(let[L,I]of A){let $=L.exec(H);if($)return I($)}return[null,null]}function hc(...H){return(A,L)=>{let I={},$;for($=0;$<H.length;$++)I[H[$]]=aI(A[L+$]);return[I,null,L+$]}}var rc=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Z5=`(?:${rc.source}?(?:\\[(${Zc.source})\\])?)?`,gu=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,jc=RegExp(`${gu.source}${Z5}`),eu=RegExp(`(?:T${jc.source})?`),h5=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,r5=/(\d{4})-?W(\d\d)(?:-?(\d))?/,j5=/(\d{4})-?(\d{3})/,k5=hc("weekYear","weekNumber","weekDay"),d5=hc("year","ordinal"),q5=/(\d{4})-(\d\d)-(\d\d)/,kc=RegExp(`${gu.source} ?(?:${rc.source}|(${Zc.source}))?`),g5=RegExp(`(?: ${kc.source})?`);function of(H,A,L){let I=H[A];return AH(I)?L:aI(I)}function e5(H,A){return[{year:of(H,A),month:of(H,A+1,1),day:of(H,A+2,1)},null,A+3]}function Bf(H,A){return[{hours:of(H,A,0),minutes:of(H,A+1,0),seconds:of(H,A+2,0),milliseconds:du(H[A+3])},null,A+4]}function lE(H,A){let L=!H[A]&&!H[A+1],I=nM(H[A+1],H[A+2]),$=L?null:vA.instance(I);return[{},$,A+3]}function OE(H,A){let L=H[A]?kL.create(H[A]):null;return[{},L,A+1]}var HJ=RegExp(`^T?${gu.source}$`),AJ=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function LJ(H){let[A,L,I,$,f,E,D,M,o]=H,u=A[0]==="-",t=M&&M[0]==="-",i=(B,U=!1)=>B!==void 0&&(U||B&&u)?-B:B;return[{years:i(o$(L)),months:i(o$(I)),weeks:i(o$($)),days:i(o$(f)),hours:i(o$(E)),minutes:i(o$(D)),seconds:i(o$(M),M==="-0"),milliseconds:i(du(o),t)}]}var IJ={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ht(H,A,L,I,$,f,E){let D={year:A.length===2?zu(aI(A)):aI(A),month:Nc.indexOf(L)+1,day:aI(I),hour:aI($),minute:aI(f)};if(E)D.second=aI(E);if(H)D.weekday=H.length>3?Rc.indexOf(H)+1:Yc.indexOf(H)+1;return D}var $J=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function fJ(H){let[,A,L,I,$,f,E,D,M,o,u,t]=H,i=Ht(A,$,I,L,f,E,D),B;if(M)B=IJ[M];else if(o)B=0;else B=nM(u,t);return[i,new vA(B)]}function EJ(H){return H.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var DJ=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,MJ=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,oJ=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function QB(H){let[,A,L,I,$,f,E,D]=H;return[Ht(A,$,I,L,f,E,D),vA.utcInstance]}function uJ(H){let[,A,L,I,$,f,E,D]=H;return[Ht(A,D,L,I,$,f,E),vA.utcInstance]}var tJ=tf(h5,eu),iJ=tf(r5,eu),pJ=tf(j5,eu),nJ=tf(jc),dc=pf(e5,Bf,lE,OE),BJ=pf(k5,Bf,lE,OE),cJ=pf(d5,Bf,lE,OE),xJ=pf(Bf,lE,OE);function UJ(H){return nf(H,[tJ,dc],[iJ,BJ],[pJ,cJ],[nJ,xJ])}function CJ(H){return nf(EJ(H),[$J,fJ])}function TJ(H){return nf(H,[DJ,QB],[MJ,QB],[oJ,uJ])}function GJ(H){return nf(H,[AJ,LJ])}var FJ=pf(Bf);function _J(H){return nf(H,[HJ,FJ])}var WJ=tf(q5,g5),mJ=tf(kc),PJ=pf(Bf,lE,OE);function XJ(H){return nf(H,[WJ,dc],[mJ,PJ])}var zB="Invalid Duration",qc={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:604800000},days:{hours:24,minutes:1440,seconds:86400,milliseconds:86400000},hours:{minutes:60,seconds:3600,milliseconds:3600000},minutes:{seconds:60,milliseconds:60000},seconds:{milliseconds:1000}},SJ={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536000,milliseconds:31536000000},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:7862400000},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592000,milliseconds:2592000000},...qc},UL=365.2425,$f=30.436875,JJ={years:{quarters:4,months:12,weeks:UL/7,days:UL,hours:UL*24,minutes:UL*24*60,seconds:UL*24*60*60,milliseconds:UL*24*60*60*1000},quarters:{months:3,weeks:UL/28,days:UL/4,hours:UL*24/4,minutes:UL*24*60/4,seconds:UL*24*60*60/4,milliseconds:UL*24*60*60*1000/4},months:{weeks:$f/7,days:$f,hours:$f*24,minutes:$f*24*60,seconds:$f*24*60*60,milliseconds:$f*24*60*60*1000},...qc},i$=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],VJ=i$.slice(0).reverse();function vI(H,A,L=!1){let I={values:L?A.values:{...H.values,...A.values||{}},loc:H.loc.clone(A.loc),conversionAccuracy:A.conversionAccuracy||H.conversionAccuracy,matrix:A.matrix||H.matrix};return new cH(I)}function gc(H,A){var L;let I=(L=A.milliseconds)!=null?L:0;for(let $ of VJ.slice(1))if(A[$])I+=A[$]*H[$].milliseconds;return I}function bB(H,A){let L=gc(H,A)<0?-1:1;i$.reduceRight((I,$)=>{if(!AH(A[$])){if(I){let f=A[I]*L,E=H[$][I],D=Math.floor(f/E);A[$]+=D*L,A[I]-=D*E*L}return $}else return I},null),i$.reduce((I,$)=>{if(!AH(A[$])){if(I){let f=A[I]%1;A[I]-=f,A[$]+=f*H[I][$]}return $}else return I},null)}function wJ(H){let A={};for(let[L,I]of Object.entries(H))if(I!==0)A[L]=I;return A}class cH{constructor(H){let A=H.conversionAccuracy==="longterm"||!1,L=A?JJ:SJ;if(H.matrix)L=H.matrix;this.values=H.values,this.loc=H.loc||_H.create(),this.conversionAccuracy=A?"longterm":"casual",this.invalid=H.invalid||null,this.matrix=L,this.isLuxonDuration=!0}static fromMillis(H,A){return cH.fromObject({milliseconds:H},A)}static fromObject(H,A={}){if(H==null||typeof H!=="object")throw new _A(`Duration.fromObject: argument expected to be an object, got ${H===null?"null":typeof H}`);return new cH({values:tM(H,cH.normalizeUnit),loc:_H.fromObject(A),conversionAccuracy:A.conversionAccuracy,matrix:A.matrix})}static fromDurationLike(H){if(OI(H))return cH.fromMillis(H);else if(cH.isDuration(H))return H;else if(typeof H==="object")return cH.fromObject(H);else throw new _A(`Unknown duration argument ${H} of type ${typeof H}`)}static fromISO(H,A){let[L]=GJ(H);if(L)return cH.fromObject(L,A);else return cH.invalid("unparsable",`the input "${H}" can't be parsed as ISO 8601`)}static fromISOTime(H,A){let[L]=_J(H);if(L)return cH.fromObject(L,A);else return cH.invalid("unparsable",`the input "${H}" can't be parsed as ISO 8601`)}static invalid(H,A=null){if(!H)throw new _A("need to specify a reason the Duration is invalid");let L=H instanceof CL?H:new CL(H,A);if(ZH.throwOnInvalid)throw new Ic(L);else return new cH({invalid:L})}static normalizeUnit(H){let A={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[H?H.toLowerCase():H];if(!A)throw new Zu(H);return A}static isDuration(H){return H&&H.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(H,A={}){let L={...A,floor:A.round!==!1&&A.floor!==!1};return this.isValid?KA.create(this.loc,L).formatDurationFromString(this,H):zB}toHuman(H={}){if(!this.isValid)return zB;let A=i$.map((L)=>{let I=this.values[L];if(AH(I))return null;return this.loc.numberFormatter({style:"unit",unitDisplay:"long",...H,unit:L.slice(0,-1)}).format(I)}).filter((L)=>L);return this.loc.listFormatter({type:"conjunction",style:H.listStyle||"narrow",...H}).format(A)}toObject(){if(!this.isValid)return{};return{...this.values}}toISO(){if(!this.isValid)return null;let H="P";if(this.years!==0)H+=this.years+"Y";if(this.months!==0||this.quarters!==0)H+=this.months+this.quarters*3+"M";if(this.weeks!==0)H+=this.weeks+"W";if(this.days!==0)H+=this.days+"D";if(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)H+="T";if(this.hours!==0)H+=this.hours+"H";if(this.minutes!==0)H+=this.minutes+"M";if(this.seconds!==0||this.milliseconds!==0)H+=qu(this.seconds+this.milliseconds/1000,3)+"S";if(H==="P")H+="T0S";return H}toISOTime(H={}){if(!this.isValid)return null;let A=this.toMillis();if(A<0||A>=86400000)return null;return H={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...H,includeOffset:!1},HH.fromMillis(A,{zone:"UTC"}).toISOTime(H)}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){if(this.isValid)return`Duration { values: ${JSON.stringify(this.values)} }`;else return`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){if(!this.isValid)return NaN;return gc(this.matrix,this.values)}valueOf(){return this.toMillis()}plus(H){if(!this.isValid)return this;let A=cH.fromDurationLike(H),L={};for(let I of i$)if(uf(A.values,I)||uf(this.values,I))L[I]=A.get(I)+this.get(I);return vI(this,{values:L},!0)}minus(H){if(!this.isValid)return this;let A=cH.fromDurationLike(H);return this.plus(A.negate())}mapUnits(H){if(!this.isValid)return this;let A={};for(let L of Object.keys(this.values))A[L]=sc(H(this.values[L],L));return vI(this,{values:A},!0)}get(H){return this[cH.normalizeUnit(H)]}set(H){if(!this.isValid)return this;let A={...this.values,...tM(H,cH.normalizeUnit)};return vI(this,{values:A})}reconfigure({locale:H,numberingSystem:A,conversionAccuracy:L,matrix:I}={}){let f={loc:this.loc.clone({locale:H,numberingSystem:A}),matrix:I,conversionAccuracy:L};return vI(this,f)}as(H){return this.isValid?this.shiftTo(H).get(H):NaN}normalize(){if(!this.isValid)return this;let H=this.toObject();return bB(this.matrix,H),vI(this,{values:H},!0)}rescale(){if(!this.isValid)return this;let H=wJ(this.normalize().shiftToAll().toObject());return vI(this,{values:H},!0)}shiftTo(...H){if(!this.isValid)return this;if(H.length===0)return this;H=H.map((f)=>cH.normalizeUnit(f));let A={},L={},I=this.toObject(),$;for(let f of i$)if(H.indexOf(f)>=0){$=f;let E=0;for(let M in L)E+=this.matrix[M][f]*L[M],L[M]=0;if(OI(I[f]))E+=I[f];let D=Math.trunc(E);A[f]=D,L[f]=(E*1000-D*1000)/1000}else if(OI(I[f]))L[f]=I[f];for(let f in L)if(L[f]!==0)A[$]+=f===$?L[f]:L[f]/this.matrix[$][f];return bB(this.matrix,A),vI(this,{values:A},!0)}shiftToAll(){if(!this.isValid)return this;return this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds")}negate(){if(!this.isValid)return this;let H={};for(let A of Object.keys(this.values))H[A]=this.values[A]===0?0:-this.values[A];return vI(this,{values:H},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(H){if(!this.isValid||!H.isValid)return!1;if(!this.loc.equals(H.loc))return!1;function A(L,I){if(L===void 0||L===0)return I===void 0||I===0;return L===I}for(let L of i$)if(!A(this.values[L],H.values[L]))return!1;return!0}}var ff="Invalid Interval";function KJ(H,A){if(!H||!H.isValid)return jH.invalid("missing or invalid start");else if(!A||!A.isValid)return jH.invalid("missing or invalid end");else if(A<H)return jH.invalid("end before start",`The end of an interval must be after its start, but you had start=${H.toISO()} and end=${A.toISO()}`);else return null}class jH{constructor(H){this.s=H.start,this.e=H.end,this.invalid=H.invalid||null,this.isLuxonInterval=!0}static invalid(H,A=null){if(!H)throw new _A("need to specify a reason the Interval is invalid");let L=H instanceof CL?H:new CL(H,A);if(ZH.throwOnInvalid)throw new Lc(L);else return new jH({invalid:L})}static fromDateTimes(H,A){let L=XE(H),I=XE(A),$=KJ(L,I);if($==null)return new jH({start:L,end:I});else return $}static after(H,A){let L=cH.fromDurationLike(A),I=XE(H);return jH.fromDateTimes(I,I.plus(L))}static before(H,A){let L=cH.fromDurationLike(A),I=XE(H);return jH.fromDateTimes(I.minus(L),I)}static fromISO(H,A){let[L,I]=(H||"").split("/",2);if(L&&I){let $,f;try{$=HH.fromISO(L,A),f=$.isValid}catch(M){f=!1}let E,D;try{E=HH.fromISO(I,A),D=E.isValid}catch(M){D=!1}if(f&&D)return jH.fromDateTimes($,E);if(f){let M=cH.fromISO(I,A);if(M.isValid)return jH.after($,M)}else if(D){let M=cH.fromISO(L,A);if(M.isValid)return jH.before(E,M)}}return jH.invalid("unparsable",`the input "${H}" can't be parsed as ISO 8601`)}static isInterval(H){return H&&H.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid?this.e?this.e.minus(1):null:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(H="milliseconds"){return this.isValid?this.toDuration(...[H]).get(H):NaN}count(H="milliseconds",A){if(!this.isValid)return NaN;let L=this.start.startOf(H,A),I;if(A!=null&&A.useLocaleWeeks)I=this.end.reconfigure({locale:L.locale});else I=this.end;return I=I.startOf(H,A),Math.floor(I.diff(L,H).get(H))+(I.valueOf()!==this.end.valueOf())}hasSame(H){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,H):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(H){if(!this.isValid)return!1;return this.s>H}isBefore(H){if(!this.isValid)return!1;return this.e<=H}contains(H){if(!this.isValid)return!1;return this.s<=H&&this.e>H}set({start:H,end:A}={}){if(!this.isValid)return this;return jH.fromDateTimes(H||this.s,A||this.e)}splitAt(...H){if(!this.isValid)return[];let A=H.map(XE).filter((f)=>this.contains(f)).sort((f,E)=>f.toMillis()-E.toMillis()),L=[],{s:I}=this,$=0;while(I<this.e){let f=A[$]||this.e,E=+f>+this.e?this.e:f;L.push(jH.fromDateTimes(I,E)),I=E,$+=1}return L}splitBy(H){let A=cH.fromDurationLike(H);if(!this.isValid||!A.isValid||A.as("milliseconds")===0)return[];let{s:L}=this,I=1,$,f=[];while(L<this.e){let E=this.start.plus(A.mapUnits((D)=>D*I));$=+E>+this.e?this.e:E,f.push(jH.fromDateTimes(L,$)),L=$,I+=1}return f}divideEqually(H){if(!this.isValid)return[];return this.splitBy(this.length()/H).slice(0,H)}overlaps(H){return this.e>H.s&&this.s<H.e}abutsStart(H){if(!this.isValid)return!1;return+this.e===+H.s}abutsEnd(H){if(!this.isValid)return!1;return+H.e===+this.s}engulfs(H){if(!this.isValid)return!1;return this.s<=H.s&&this.e>=H.e}equals(H){if(!this.isValid||!H.isValid)return!1;return this.s.equals(H.s)&&this.e.equals(H.e)}intersection(H){if(!this.isValid)return this;let A=this.s>H.s?this.s:H.s,L=this.e<H.e?this.e:H.e;if(A>=L)return null;else return jH.fromDateTimes(A,L)}union(H){if(!this.isValid)return this;let A=this.s<H.s?this.s:H.s,L=this.e>H.e?this.e:H.e;return jH.fromDateTimes(A,L)}static merge(H){let[A,L]=H.sort((I,$)=>I.s-$.s).reduce(([I,$],f)=>{if(!$)return[I,f];else if($.overlaps(f)||$.abutsStart(f))return[I,$.union(f)];else return[I.concat([$]),f]},[[],null]);if(L)A.push(L);return A}static xor(H){let A=null,L=0,I=[],$=H.map((D)=>[{time:D.s,type:"s"},{time:D.e,type:"e"}]),f=Array.prototype.concat(...$),E=f.sort((D,M)=>D.time-M.time);for(let D of E)if(L+=D.type==="s"?1:-1,L===1)A=D.time;else{if(A&&+A!==+D.time)I.push(jH.fromDateTimes(A,D.time));A=null}return jH.merge(I)}difference(...H){return jH.xor([this].concat(H)).map((A)=>this.intersection(A)).filter((A)=>A&&!A.isEmpty())}toString(){if(!this.isValid)return ff;return`[${this.s.toISO()} \u2013 ${this.e.toISO()})`}[Symbol.for("nodejs.util.inspect.custom")](){if(this.isValid)return`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;else return`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(H=MM,A={}){return this.isValid?KA.create(this.s.loc.clone(A),H).formatInterval(this):ff}toISO(H){if(!this.isValid)return ff;return`${this.s.toISO(H)}/${this.e.toISO(H)}`}toISODate(){if(!this.isValid)return ff;return`${this.s.toISODate()}/${this.e.toISODate()}`}toISOTime(H){if(!this.isValid)return ff;return`${this.s.toISOTime(H)}/${this.e.toISOTime(H)}`}toFormat(H,{separator:A=" \u2013 "}={}){if(!this.isValid)return ff;return`${this.s.toFormat(H)}${A}${this.e.toFormat(H)}`}toDuration(H,A){if(!this.isValid)return cH.invalid(this.invalidReason);return this.e.diff(this.s,H,A)}mapEndpoints(H){return jH.fromDateTimes(H(this.s),H(this.e))}}class Df{static hasDST(H=ZH.defaultZone){let A=HH.now().setZone(H).set({month:12});return!H.isUniversal&&A.offset!==A.set({month:6}).offset}static isValidIANAZone(H){return kL.isValidZone(H)}static normalizeZone(H){return lI(H,ZH.defaultZone)}static getStartOfWeek({locale:H=null,locObj:A=null}={}){return(A||_H.create(H)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:H=null,locObj:A=null}={}){return(A||_H.create(H)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:H=null,locObj:A=null}={}){return(A||_H.create(H)).getWeekendDays().slice()}static months(H="long",{locale:A=null,numberingSystem:L=null,locObj:I=null,outputCalendar:$="gregory"}={}){return(I||_H.create(A,L,$)).months(H)}static monthsFormat(H="long",{locale:A=null,numberingSystem:L=null,locObj:I=null,outputCalendar:$="gregory"}={}){return(I||_H.create(A,L,$)).months(H,!0)}static weekdays(H="long",{locale:A=null,numberingSystem:L=null,locObj:I=null}={}){return(I||_H.create(A,L,null)).weekdays(H)}static weekdaysFormat(H="long",{locale:A=null,numberingSystem:L=null,locObj:I=null}={}){return(I||_H.create(A,L,null)).weekdays(H,!0)}static meridiems({locale:H=null}={}){return _H.create(H).meridiems()}static eras(H="short",{locale:A=null}={}){return _H.create(A,null,"gregory").eras(H)}static features(){return{relative:ac(),localeWeek:lc()}}}function ZB(H,A){let L=($)=>$.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),I=L(A)-L(H);return Math.floor(cH.fromMillis(I).as("days"))}function vJ(H,A,L){let I=[["years",(M,o)=>o.year-M.year],["quarters",(M,o)=>o.quarter-M.quarter+(o.year-M.year)*4],["months",(M,o)=>o.month-M.month+(o.year-M.year)*12],["weeks",(M,o)=>{let u=ZB(M,o);return(u-u%7)/7}],["days",ZB]],$={},f=H,E,D;for(let[M,o]of I)if(L.indexOf(M)>=0)if(E=M,$[M]=o(H,A),D=f.plus($),D>A){if($[M]--,H=f.plus($),H>A)D=H,$[M]--,H=f.plus($)}else H=D;return[H,$,D,E]}function aJ(H,A,L,I){let[$,f,E,D]=vJ(H,A,L),M=A-$,o=L.filter((t)=>["hours","minutes","seconds","milliseconds"].indexOf(t)>=0);if(o.length===0){if(E<A)E=$.plus({[D]:1});if(E!==$)f[D]=(f[D]||0)+M/(E-$)}let u=cH.fromObject(f,I);if(o.length>0)return cH.fromMillis(M,I).shiftTo(...o).plus(u);else return u}var lJ="missing Intl.DateTimeFormat.formatToParts support";function FH(H,A=(L)=>L){return{regex:H,deser:([L])=>A(W5(L))}}var OJ=String.fromCharCode(160),ec=`[ ${OJ}]`,Hx=new RegExp(ec,"g");function sJ(H){return H.replace(/\./g,"\\.?").replace(Hx,ec)}function hB(H){return H.replace(/\./g,"").replace(Hx," ").toLowerCase()}function aL(H,A){if(H===null)return null;else return{regex:RegExp(H.map(sJ).join("|")),deser:([L])=>H.findIndex((I)=>hB(L)===hB(I))+A}}function rB(H,A){return{regex:H,deser:([,L,I])=>nM(L,I),groups:A}}function $M(H){return{regex:H,deser:([A])=>A}}function NJ(H){return H.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function yJ(H,A){let L=vL(A),I=vL(A,"{2}"),$=vL(A,"{3}"),f=vL(A,"{4}"),E=vL(A,"{6}"),D=vL(A,"{1,2}"),M=vL(A,"{1,3}"),o=vL(A,"{1,6}"),u=vL(A,"{1,9}"),t=vL(A,"{2,4}"),i=vL(A,"{4,6}"),B=(T)=>({regex:RegExp(NJ(T.val)),deser:([F])=>F,literal:!0}),x=((T)=>{if(H.literal)return B(T);switch(T.val){case"G":return aL(A.eras("short"),0);case"GG":return aL(A.eras("long"),0);case"y":return FH(o);case"yy":return FH(t,zu);case"yyyy":return FH(f);case"yyyyy":return FH(i);case"yyyyyy":return FH(E);case"M":return FH(D);case"MM":return FH(I);case"MMM":return aL(A.months("short",!0),1);case"MMMM":return aL(A.months("long",!0),1);case"L":return FH(D);case"LL":return FH(I);case"LLL":return aL(A.months("short",!1),1);case"LLLL":return aL(A.months("long",!1),1);case"d":return FH(D);case"dd":return FH(I);case"o":return FH(M);case"ooo":return FH($);case"HH":return FH(I);case"H":return FH(D);case"hh":return FH(I);case"h":return FH(D);case"mm":return FH(I);case"m":return FH(D);case"q":return FH(D);case"qq":return FH(I);case"s":return FH(D);case"ss":return FH(I);case"S":return FH(M);case"SSS":return FH($);case"u":return $M(u);case"uu":return $M(D);case"uuu":return FH(L);case"a":return aL(A.meridiems(),0);case"kkkk":return FH(f);case"kk":return FH(t,zu);case"W":return FH(D);case"WW":return FH(I);case"E":case"c":return FH(L);case"EEE":return aL(A.weekdays("short",!1),1);case"EEEE":return aL(A.weekdays("long",!1),1);case"ccc":return aL(A.weekdays("short",!0),1);case"cccc":return aL(A.weekdays("long",!0),1);case"Z":case"ZZ":return rB(new RegExp(`([+-]${D.source})(?::(${I.source}))?`),2);case"ZZZ":return rB(new RegExp(`([+-]${D.source})(${I.source})?`),2);case"z":return $M(/[a-z_+-/]{1,256}?/i);case" ":return $M(/[^\S\n\r]/);default:return B(T)}})(H)||{invalidReason:lJ};return x.token=H,x}var RJ={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function YJ(H,A,L){let{type:I,value:$}=H;if(I==="literal"){let M=/^\s+$/.test($);return{literal:!M,val:M?" ":$}}let f=A[I],E=I;if(I==="hour")if(A.hour12!=null)E=A.hour12?"hour12":"hour24";else if(A.hourCycle!=null)if(A.hourCycle==="h11"||A.hourCycle==="h12")E="hour12";else E="hour24";else E=L.hour12?"hour12":"hour24";let D=RJ[E];if(typeof D==="object")D=D[f];if(D)return{literal:!1,val:D};return}function QJ(H){return[`^${H.map((L)=>L.regex).reduce((L,I)=>`${L}(${I.source})`,"")}$`,H]}function zJ(H,A,L){let I=H.match(A);if(I){let $={},f=1;for(let E in L)if(uf(L,E)){let D=L[E],M=D.groups?D.groups+1:1;if(!D.literal&&D.token)$[D.token.val[0]]=D.deser(I.slice(f,f+M));f+=M}return[I,$]}else return[I,{}]}function bJ(H){let A=(f)=>{switch(f){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},L=null,I;if(!AH(H.z))L=kL.create(H.z);if(!AH(H.Z)){if(!L)L=new vA(H.Z);I=H.Z}if(!AH(H.q))H.M=(H.q-1)*3+1;if(!AH(H.h)){if(H.h<12&&H.a===1)H.h+=12;else if(H.h===12&&H.a===0)H.h=0}if(H.G===0&&H.y)H.y=-H.y;if(!AH(H.u))H.S=du(H.u);return[Object.keys(H).reduce((f,E)=>{let D=A(E);if(D)f[D]=H[E];return f},{}),L,I]}var Ju=null;function ZJ(){if(!Ju)Ju=HH.fromMillis(1555555555555);return Ju}function hJ(H,A){if(H.literal)return H;let L=KA.macroTokenToFormatOpts(H.val),I=Ix(L,A);if(I==null||I.includes(void 0))return H;return I}function Ax(H,A){return Array.prototype.concat(...H.map((L)=>hJ(L,A)))}class At{constructor(H,A){if(this.locale=H,this.format=A,this.tokens=Ax(KA.parseFormat(A),H),this.units=this.tokens.map((L)=>yJ(L,H)),this.disqualifyingUnit=this.units.find((L)=>L.invalidReason),!this.disqualifyingUnit){let[L,I]=QJ(this.units);this.regex=RegExp(L,"i"),this.handlers=I}}explainFromTokens(H){if(!this.isValid)return{input:H,tokens:this.tokens,invalidReason:this.invalidReason};else{let[A,L]=zJ(H,this.regex,this.handlers),[I,$,f]=L?bJ(L):[null,null,void 0];if(uf(L,"a")&&uf(L,"H"))throw new t$("Can't include meridiem when specifying 24-hour format");return{input:H,tokens:this.tokens,regex:this.regex,rawMatches:A,matches:L,result:I,zone:$,specificOffset:f}}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Lx(H,A,L){return new At(H,L).explainFromTokens(A)}function rJ(H,A,L){let{result:I,zone:$,specificOffset:f,invalidReason:E}=Lx(H,A,L);return[I,$,f,E]}function Ix(H,A){if(!H)return null;let I=KA.create(A,H).dtFormatter(ZJ()),$=I.formatToParts(),f=I.resolvedOptions();return $.map((E)=>YJ(E,H,f))}var Vu="Invalid DateTime",jB=8640000000000000;function JE(H){return new CL("unsupported zone",`the zone "${H.name}" is not supported`)}function wu(H){if(H.weekData===null)H.weekData=oM(H.c);return H.weekData}function Ku(H){if(H.localWeekData===null)H.localWeekData=oM(H.c,H.loc.getMinDaysInFirstWeek(),H.loc.getStartOfWeek());return H.localWeekData}function u$(H,A){let L={ts:H.ts,zone:H.zone,c:H.c,o:H.o,loc:H.loc,invalid:H.invalid};return new HH({...L,...A,old:L})}function $x(H,A,L){let I=H-A*60*1000,$=L.offset(I);if(A===$)return[I,A];I-=($-A)*60*1000;let f=L.offset(I);if($===f)return[I,$];return[H-Math.min($,f)*60*1000,Math.max($,f)]}function fM(H,A){H+=A*60*1000;let L=new Date(H);return{year:L.getUTCFullYear(),month:L.getUTCMonth()+1,day:L.getUTCDate(),hour:L.getUTCHours(),minute:L.getUTCMinutes(),second:L.getUTCSeconds(),millisecond:L.getUTCMilliseconds()}}function DM(H,A,L){return $x(pM(H),A,L)}function kB(H,A){let L=H.o,I=H.c.year+Math.trunc(A.years),$=H.c.month+Math.trunc(A.months)+Math.trunc(A.quarters)*3,f={...H.c,year:I,month:$,day:Math.min(H.c.day,uM(I,$))+Math.trunc(A.days)+Math.trunc(A.weeks)*7},E=cH.fromObject({years:A.years-Math.trunc(A.years),quarters:A.quarters-Math.trunc(A.quarters),months:A.months-Math.trunc(A.months),weeks:A.weeks-Math.trunc(A.weeks),days:A.days-Math.trunc(A.days),hours:A.hours,minutes:A.minutes,seconds:A.seconds,milliseconds:A.milliseconds}).as("milliseconds"),D=pM(f),[M,o]=$x(D,L,H.zone);if(E!==0)M+=E,o=H.zone.offset(M);return{ts:M,o}}function Ef(H,A,L,I,$,f){let{setZone:E,zone:D}=L;if(H&&Object.keys(H).length!==0||A){let M=A||D,o=HH.fromObject(H,{...L,zone:M,specificOffset:f});return E?o:o.setZone(D)}else return HH.invalid(new CL("unparsable",`the input "${$}" can't be parsed as ${I}`))}function EM(H,A,L=!0){return H.isValid?KA.create(_H.create("en-US"),{allowZ:L,forceSimple:!0}).formatDateTimeFromString(H,A):null}function vu(H,A){let L=H.c.year>9999||H.c.year<0,I="";if(L&&H.c.year>=0)I+="+";if(I+=fA(H.c.year,L?6:4),A)I+="-",I+=fA(H.c.month),I+="-",I+=fA(H.c.day);else I+=fA(H.c.month),I+=fA(H.c.day);return I}function dB(H,A,L,I,$,f){let E=fA(H.c.hour);if(A){if(E+=":",E+=fA(H.c.minute),H.c.millisecond!==0||H.c.second!==0||!L)E+=":"}else E+=fA(H.c.minute);if(H.c.millisecond!==0||H.c.second!==0||!L){if(E+=fA(H.c.second),H.c.millisecond!==0||!I)E+=".",E+=fA(H.c.millisecond,3)}if($)if(H.isOffsetFixed&&H.offset===0&&!f)E+="Z";else if(H.o<0)E+="-",E+=fA(Math.trunc(-H.o/60)),E+=":",E+=fA(Math.trunc(-H.o%60));else E+="+",E+=fA(Math.trunc(H.o/60)),E+=":",E+=fA(Math.trunc(H.o%60));if(f)E+="["+H.zone.ianaName+"]";return E}var fx={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},jJ={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},kJ={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ex=["year","month","day","hour","minute","second","millisecond"],dJ=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],qJ=["year","ordinal","hour","minute","second","millisecond"];function gJ(H){let A={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[H.toLowerCase()];if(!A)throw new Zu(H);return A}function qB(H){switch(H.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return gJ(H)}}function eJ(H){if(VE===void 0)VE=ZH.now();if(H.type!=="iana")return H.offset(VE);let A=H.name,L=bu.get(A);if(L===void 0)L=H.offset(VE),bu.set(A,L);return L}function gB(H,A){let L=lI(A.zone,ZH.defaultZone);if(!L.isValid)return HH.invalid(JE(L));let I=_H.fromObject(A),$,f;if(!AH(H.year)){for(let M of Ex)if(AH(H[M]))H[M]=fx[M];let E=Kc(H)||vc(H);if(E)return HH.invalid(E);let D=eJ(L);[$,f]=DM(H,D,L)}else $=ZH.now();return new HH({ts:$,zone:L,loc:I,o:f})}function eB(H,A,L){let I=AH(L.round)?!0:L.round,$=(E,D)=>{return E=qu(E,I||L.calendary?0:2,!0),A.loc.clone(L).relFormatter(L).format(E,D)},f=(E)=>{if(L.calendary)if(!A.hasSame(H,E))return A.startOf(E).diff(H.startOf(E),E).get(E);else return 0;else return A.diff(H,E).get(E)};if(L.unit)return $(f(L.unit),L.unit);for(let E of L.units){let D=f(E);if(Math.abs(D)>=1)return $(D,E)}return $(H>A?-0:0,L.units[L.units.length-1])}function Hc(H){let A={},L;if(H.length>0&&typeof H[H.length-1]==="object")A=H[H.length-1],L=Array.from(H).slice(0,H.length-1);else L=Array.from(H);return[A,L]}var VE,bu=new Map;class HH{constructor(H){let A=H.zone||ZH.defaultZone,L=H.invalid||(Number.isNaN(H.ts)?new CL("invalid input"):null)||(!A.isValid?JE(A):null);this.ts=AH(H.ts)?ZH.now():H.ts;let I=null,$=null;if(!L)if(H.old&&H.old.ts===this.ts&&H.old.zone.equals(A))[I,$]=[H.old.c,H.old.o];else{let E=OI(H.o)&&!H.old?H.o:A.offset(this.ts);I=fM(this.ts,E),L=Number.isNaN(I.year)?new CL("invalid input"):null,I=L?null:I,$=L?null:E}this._zone=A,this.loc=H.loc||_H.create(),this.invalid=L,this.weekData=null,this.localWeekData=null,this.c=I,this.o=$,this.isLuxonDateTime=!0}static now(){return new HH({})}static local(){let[H,A]=Hc(arguments),[L,I,$,f,E,D,M]=A;return gB({year:L,month:I,day:$,hour:f,minute:E,second:D,millisecond:M},H)}static utc(){let[H,A]=Hc(arguments),[L,I,$,f,E,D,M]=A;return H.zone=vA.utcInstance,gB({year:L,month:I,day:$,hour:f,minute:E,second:D,millisecond:M},H)}static fromJSDate(H,A={}){let L=J5(H)?H.valueOf():NaN;if(Number.isNaN(L))return HH.invalid("invalid input");let I=lI(A.zone,ZH.defaultZone);if(!I.isValid)return HH.invalid(JE(I));return new HH({ts:L,zone:I,loc:_H.fromObject(A)})}static fromMillis(H,A={}){if(!OI(H))throw new _A(`fromMillis requires a numerical input, but received a ${typeof H} with value ${H}`);else if(H<-jB||H>jB)return HH.invalid("Timestamp out of range");else return new HH({ts:H,zone:lI(A.zone,ZH.defaultZone),loc:_H.fromObject(A)})}static fromSeconds(H,A={}){if(!OI(H))throw new _A("fromSeconds requires a numerical input");else return new HH({ts:H*1000,zone:lI(A.zone,ZH.defaultZone),loc:_H.fromObject(A)})}static fromObject(H,A={}){H=H||{};let L=lI(A.zone,ZH.defaultZone);if(!L.isValid)return HH.invalid(JE(L));let I=_H.fromObject(A),$=tM(H,qB),{minDaysInFirstWeek:f,startOfWeek:E}=NB($,I),D=ZH.now(),M=!AH(A.specificOffset)?A.specificOffset:L.offset(D),o=!AH($.ordinal),u=!AH($.year),t=!AH($.month)||!AH($.day),i=u||t,B=$.weekYear||$.weekNumber;if((i||o)&&B)throw new t$("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(t&&o)throw new t$("Can't mix ordinal dates with month/day");let U=B||$.weekday&&!i,x,T,F=fM(D,M);if(U)x=dJ,T=jJ,F=oM(F,f,E);else if(o)x=qJ,T=kJ,F=Su(F);else x=Ex,T=fx;let m=!1;for(let h of x){let X=$[h];if(!AH(X))m=!0;else if(m)$[h]=T[h];else $[h]=F[h]}let Y=U?P5($,f,E):o?X5($):Kc($),W=Y||vc($);if(W)return HH.invalid(W);let P=U?OB($,f,E):o?sB($):$,[V,J]=DM(P,M,L),a=new HH({ts:V,zone:L,o:J,loc:I});if($.weekday&&i&&H.weekday!==a.weekday)return HH.invalid("mismatched weekday",`you can't specify both a weekday of ${$.weekday} and a date of ${a.toISO()}`);if(!a.isValid)return HH.invalid(a.invalid);return a}static fromISO(H,A={}){let[L,I]=UJ(H);return Ef(L,I,A,"ISO 8601",H)}static fromRFC2822(H,A={}){let[L,I]=CJ(H);return Ef(L,I,A,"RFC 2822",H)}static fromHTTP(H,A={}){let[L,I]=TJ(H);return Ef(L,I,A,"HTTP",A)}static fromFormat(H,A,L={}){if(AH(H)||AH(A))throw new _A("fromFormat requires an input string and a format");let{locale:I=null,numberingSystem:$=null}=L,f=_H.fromOpts({locale:I,numberingSystem:$,defaultToEN:!0}),[E,D,M,o]=rJ(f,H,A);if(o)return HH.invalid(o);else return Ef(E,D,L,`format ${A}`,H,M)}static fromString(H,A,L={}){return HH.fromFormat(H,A,L)}static fromSQL(H,A={}){let[L,I]=XJ(H);return Ef(L,I,A,"SQL",H)}static invalid(H,A=null){if(!H)throw new _A("need to specify a reason the DateTime is invalid");let L=H instanceof CL?H:new CL(H,A);if(ZH.throwOnInvalid)throw new Ac(L);else return new HH({invalid:L})}static isDateTime(H){return H&&H.isLuxonDateTime||!1}static parseFormatForOpts(H,A={}){let L=Ix(H,_H.fromObject(A));return!L?null:L.map((I)=>I?I.val:null).join("")}static expandFormat(H,A={}){return Ax(KA.parseFormat(H),_H.fromObject(A)).map((I)=>I.val).join("")}static resetCache(){VE=void 0,bu.clear()}get(H){return this[H]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?wu(this).weekYear:NaN}get weekNumber(){return this.isValid?wu(this).weekNumber:NaN}get weekday(){return this.isValid?wu(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Ku(this).weekday:NaN}get localWeekNumber(){return this.isValid?Ku(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Ku(this).weekYear:NaN}get ordinal(){return this.isValid?Su(this.c).ordinal:NaN}get monthShort(){return this.isValid?Df.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Df.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Df.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Df.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){if(this.isValid)return this.zone.offsetName(this.ts,{format:"short",locale:this.locale});else return null}get offsetNameLong(){if(this.isValid)return this.zone.offsetName(this.ts,{format:"long",locale:this.locale});else return null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){if(this.isOffsetFixed)return!1;else return this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let H=86400000,A=60000,L=pM(this.c),I=this.zone.offset(L-H),$=this.zone.offset(L+H),f=this.zone.offset(L-I*A),E=this.zone.offset(L-$*A);if(f===E)return[this];let D=L-f*A,M=L-E*A,o=fM(D,f),u=fM(M,E);if(o.hour===u.hour&&o.minute===u.minute&&o.second===u.second&&o.millisecond===u.millisecond)return[u$(this,{ts:D}),u$(this,{ts:M})];return[this]}get isInLeapYear(){return aE(this.year)}get daysInMonth(){return uM(this.year,this.month)}get daysInYear(){return this.isValid?Mf(this.year):NaN}get weeksInWeekYear(){return this.isValid?KE(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?KE(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(H={}){let{locale:A,numberingSystem:L,calendar:I}=KA.create(this.loc.clone(H),H).resolvedOptions(this);return{locale:A,numberingSystem:L,outputCalendar:I}}toUTC(H=0,A={}){return this.setZone(vA.instance(H),A)}toLocal(){return this.setZone(ZH.defaultZone)}setZone(H,{keepLocalTime:A=!1,keepCalendarTime:L=!1}={}){if(H=lI(H,ZH.defaultZone),H.equals(this.zone))return this;else if(!H.isValid)return HH.invalid(JE(H));else{let I=this.ts;if(A||L){let $=H.offset(this.ts),f=this.toObject();[I]=DM(f,$,H)}return u$(this,{ts:I,zone:H})}}reconfigure({locale:H,numberingSystem:A,outputCalendar:L}={}){let I=this.loc.clone({locale:H,numberingSystem:A,outputCalendar:L});return u$(this,{loc:I})}setLocale(H){return this.reconfigure({locale:H})}set(H){if(!this.isValid)return this;let A=tM(H,qB),{minDaysInFirstWeek:L,startOfWeek:I}=NB(A,this.loc),$=!AH(A.weekYear)||!AH(A.weekNumber)||!AH(A.weekday),f=!AH(A.ordinal),E=!AH(A.year),D=!AH(A.month)||!AH(A.day),M=E||D,o=A.weekYear||A.weekNumber;if((M||f)&&o)throw new t$("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(D&&f)throw new t$("Can't mix ordinal dates with month/day");let u;if($)u=OB({...oM(this.c,L,I),...A},L,I);else if(!AH(A.ordinal))u=sB({...Su(this.c),...A});else if(u={...this.toObject(),...A},AH(A.day))u.day=Math.min(uM(u.year,u.month),u.day);let[t,i]=DM(u,this.o,this.zone);return u$(this,{ts:t,o:i})}plus(H){if(!this.isValid)return this;let A=cH.fromDurationLike(H);return u$(this,kB(this,A))}minus(H){if(!this.isValid)return this;let A=cH.fromDurationLike(H).negate();return u$(this,kB(this,A))}startOf(H,{useLocaleWeeks:A=!1}={}){if(!this.isValid)return this;let L={},I=cH.normalizeUnit(H);switch(I){case"years":L.month=1;case"quarters":case"months":L.day=1;case"weeks":case"days":L.hour=0;case"hours":L.minute=0;case"minutes":L.second=0;case"seconds":L.millisecond=0;break}if(I==="weeks")if(A){let $=this.loc.getStartOfWeek(),{weekday:f}=this;if(f<$)L.weekNumber=this.weekNumber-1;L.weekday=$}else L.weekday=1;if(I==="quarters"){let $=Math.ceil(this.month/3);L.month=($-1)*3+1}return this.set(L)}endOf(H,A){return this.isValid?this.plus({[H]:1}).startOf(H,A).minus(1):this}toFormat(H,A={}){return this.isValid?KA.create(this.loc.redefaultToEN(A)).formatDateTimeFromString(this,H):Vu}toLocaleString(H=MM,A={}){return this.isValid?KA.create(this.loc.clone(A),H).formatDateTime(this):Vu}toLocaleParts(H={}){return this.isValid?KA.create(this.loc.clone(H),H).formatDateTimeParts(this):[]}toISO({format:H="extended",suppressSeconds:A=!1,suppressMilliseconds:L=!1,includeOffset:I=!0,extendedZone:$=!1}={}){if(!this.isValid)return null;let f=H==="extended",E=vu(this,f);return E+="T",E+=dB(this,f,A,L,I,$),E}toISODate({format:H="extended"}={}){if(!this.isValid)return null;return vu(this,H==="extended")}toISOWeekDate(){return EM(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:H=!1,suppressSeconds:A=!1,includeOffset:L=!0,includePrefix:I=!1,extendedZone:$=!1,format:f="extended"}={}){if(!this.isValid)return null;return(I?"T":"")+dB(this,f==="extended",A,H,L,$)}toRFC2822(){return EM(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return EM(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){if(!this.isValid)return null;return vu(this,!0)}toSQLTime({includeOffset:H=!0,includeZone:A=!1,includeOffsetSpace:L=!0}={}){let I="HH:mm:ss.SSS";if(A||H){if(L)I+=" ";if(A)I+="z";else if(H)I+="ZZ"}return EM(this,I,!0)}toSQL(H={}){if(!this.isValid)return null;return`${this.toSQLDate()} ${this.toSQLTime(H)}`}toString(){return this.isValid?this.toISO():Vu}[Symbol.for("nodejs.util.inspect.custom")](){if(this.isValid)return`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;else return`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1000:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1000):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(H={}){if(!this.isValid)return{};let A={...this.c};if(H.includeConfig)A.outputCalendar=this.outputCalendar,A.numberingSystem=this.loc.numberingSystem,A.locale=this.loc.locale;return A}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(H,A="milliseconds",L={}){if(!this.isValid||!H.isValid)return cH.invalid("created by diffing an invalid DateTime");let I={locale:this.locale,numberingSystem:this.numberingSystem,...L},$=V5(A).map(cH.normalizeUnit),f=H.valueOf()>this.valueOf(),E=f?this:H,D=f?H:this,M=aJ(E,D,$,I);return f?M.negate():M}diffNow(H="milliseconds",A={}){return this.diff(HH.now(),H,A)}until(H){return this.isValid?jH.fromDateTimes(this,H):this}hasSame(H,A,L){if(!this.isValid)return!1;let I=H.valueOf(),$=this.setZone(H.zone,{keepLocalTime:!0});return $.startOf(A,L)<=I&&I<=$.endOf(A,L)}equals(H){return this.isValid&&H.isValid&&this.valueOf()===H.valueOf()&&this.zone.equals(H.zone)&&this.loc.equals(H.loc)}toRelative(H={}){if(!this.isValid)return null;let A=H.base||HH.fromObject({},{zone:this.zone}),L=H.padding?this<A?-H.padding:H.padding:0,I=["years","months","days","hours","minutes","seconds"],$=H.unit;if(Array.isArray(H.unit))I=H.unit,$=void 0;return eB(A,this.plus(L),{...H,numeric:"always",units:I,unit:$})}toRelativeCalendar(H={}){if(!this.isValid)return null;return eB(H.base||HH.fromObject({},{zone:this.zone}),this,{...H,numeric:"auto",units:["years","months","days"],calendary:!0})}static min(...H){if(!H.every(HH.isDateTime))throw new _A("min requires all arguments be DateTimes");return yB(H,(A)=>A.valueOf(),Math.min)}static max(...H){if(!H.every(HH.isDateTime))throw new _A("max requires all arguments be DateTimes");return yB(H,(A)=>A.valueOf(),Math.max)}static fromFormatExplain(H,A,L={}){let{locale:I=null,numberingSystem:$=null}=L,f=_H.fromOpts({locale:I,numberingSystem:$,defaultToEN:!0});return Lx(f,H,A)}static fromStringExplain(H,A,L={}){return HH.fromFormatExplain(H,A,L)}static buildFormatParser(H,A={}){let{locale:L=null,numberingSystem:I=null}=A,$=_H.fromOpts({locale:L,numberingSystem:I,defaultToEN:!0});return new At($,H)}static fromFormatParser(H,A,L={}){if(AH(H)||AH(A))throw new _A("fromFormatParser requires an input string and a format parser");let{locale:I=null,numberingSystem:$=null}=L,f=_H.fromOpts({locale:I,numberingSystem:$,defaultToEN:!0});if(!f.equals(A.locale))throw new _A(`fromFormatParser called with a locale of ${f}, but the format parser was created for ${A.locale}`);let{result:E,zone:D,specificOffset:M,invalidReason:o}=A.explainFromTokens(H);if(o)return HH.invalid(o);else return Ef(E,D,L,`format ${A.format}`,H,M)}static get DATE_SHORT(){return MM}static get DATE_MED(){return $c}static get DATE_MED_WITH_WEEKDAY(){return D5}static get DATE_FULL(){return fc}static get DATE_HUGE(){return Ec}static get TIME_SIMPLE(){return Dc}static get TIME_WITH_SECONDS(){return Mc}static get TIME_WITH_SHORT_OFFSET(){return oc}static get TIME_WITH_LONG_OFFSET(){return uc}static get TIME_24_SIMPLE(){return tc}static get TIME_24_WITH_SECONDS(){return ic}static get TIME_24_WITH_SHORT_OFFSET(){return pc}static get TIME_24_WITH_LONG_OFFSET(){return nc}static get DATETIME_SHORT(){return Bc}static get DATETIME_SHORT_WITH_SECONDS(){return cc}static get DATETIME_MED(){return xc}static get DATETIME_MED_WITH_SECONDS(){return Uc}static get DATETIME_MED_WITH_WEEKDAY(){return M5}static get DATETIME_FULL(){return Cc}static get DATETIME_FULL_WITH_SECONDS(){return Tc}static get DATETIME_HUGE(){return Gc}static get DATETIME_HUGE_WITH_SECONDS(){return Fc}}function XE(H){if(HH.isDateTime(H))return H;else if(H&&H.valueOf&&OI(H.valueOf()))return HH.fromJSDate(H);else if(H&&typeof H==="object")return HH.fromObject(H);else throw new _A(`Unknown datetime argument: ${H}, of type ${typeof H}`)}var H4="3.6.1";Dx.DateTime=HH;Dx.Duration=cH;Dx.FixedOffsetZone=vA;Dx.IANAZone=kL;Dx.Info=Df;Dx.Interval=jH;Dx.InvalidZone=hu;Dx.Settings=ZH;Dx.SystemZone=vE;Dx.VERSION=H4;Dx.Zone=p$});var px=Q((ox)=>{Object.defineProperty(ox,"__esModule",{value:!0});ox.RE_RANGE=ox.RE_WILDCARDS=ox.PRESETS=ox.TIME_UNITS_LEN=ox.TIME_UNITS=ox.TIME_UNITS_MAP=ox.ALIASES=ox.PARSE_DEFAULTS=ox.CONSTRAINTS=void 0;ox.CONSTRAINTS=Object.freeze({second:[0,59],minute:[0,59],hour:[0,23],dayOfMonth:[1,31],month:[1,12],dayOfWeek:[0,7]});ox.PARSE_DEFAULTS=Object.freeze({second:"0",minute:"*",hour:"*",dayOfMonth:"*",month:"*",dayOfWeek:"*"});ox.ALIASES=Object.freeze({jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12,sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6});ox.TIME_UNITS_MAP=Object.freeze({SECOND:"second",MINUTE:"minute",HOUR:"hour",DAY_OF_MONTH:"dayOfMonth",MONTH:"month",DAY_OF_WEEK:"dayOfWeek"});ox.TIME_UNITS=Object.freeze(Object.values(ox.TIME_UNITS_MAP));ox.TIME_UNITS_LEN=ox.TIME_UNITS.length;ox.PRESETS=Object.freeze({"@yearly":"0 0 0 1 1 *","@monthly":"0 0 0 1 * *","@weekly":"0 0 0 * * 0","@daily":"0 0 0 * * *","@hourly":"0 0 * * * *","@minutely":"0 * * * * *","@secondly":"* * * * * *","@weekdays":"0 0 0 * * 1-5","@weekends":"0 0 0 * * 0,6"});ox.RE_WILDCARDS=/\*/g;ox.RE_RANGE=/^(\d+)(?:-(\d+))?(?:\/(\d+))?$/g});var It=Q((Bx)=>{Object.defineProperty(Bx,"__esModule",{value:!0});Bx.ExclusiveParametersError=Bx.CronError=void 0;class Lt extends Error{}Bx.CronError=Lt;class nx extends Lt{constructor(H,A){super(`You can't specify both ${H} and ${A}`)}}Bx.ExclusiveParametersError=nx});var cM=Q((xx)=>{Object.defineProperty(xx,"__esModule",{value:!0});xx.CronTime=void 0;var fL=Mx(),aA=px(),qA=It();class $t{constructor(H,A,L){if(this.realDate=!1,this.second={},this.minute={},this.hour={},this.dayOfMonth={},this.month={},this.dayOfWeek={},A!=null&&L!=null)throw new qA.ExclusiveParametersError("timeZone","utcOffset");if(A){if(!fL.DateTime.fromObject({},{zone:A}).isValid)throw new qA.CronError("Invalid timezone.");this.timeZone=A}if(L!=null)this.utcOffset=L;if(A==null&&L==null){let I=Intl.DateTimeFormat().resolvedOptions().timeZone;this.timeZone=I}if(H instanceof Date||H instanceof fL.DateTime)this.source=H instanceof Date?fL.DateTime.fromJSDate(H):H,this.realDate=!0;else this.source=H,this._parse(this.source)}static validateCronExpression(H){try{return new $t(H),{valid:!0}}catch(A){return{valid:!1,error:A}}}_getWeekDay(H){return H.weekday===7?0:H.weekday}sendAt(H){let A=this.realDate&&this.source instanceof fL.DateTime?this.source:fL.DateTime.utc();if(this.timeZone)A=A.setZone(this.timeZone);if(this.utcOffset!==void 0){let L=this.utcOffset<0?"-":"+",I=Math.trunc(this.utcOffset/60),$=String(Math.abs(I)).padStart(2,"0"),f=Math.abs(this.utcOffset-I*60),E=String(f).padStart(2,"0"),D=`UTC${L}${$}:${E}`;if(A=A.setZone(D),!A.isValid)throw new qA.CronError("ERROR: You specified an invalid UTC offset.")}if(this.realDate){if(fL.DateTime.local()>A)throw new qA.CronError("WARNING: Date in past. Will never be fired.");return A}if(H===void 0||isNaN(H)||H<0)return this.getNextDateFrom(A);else{let L=[];for(;H>0;H--)A=this.getNextDateFrom(A),L.push(A);return L}}getTimeout(){return Math.max(-1,this.sendAt().toMillis()-fL.DateTime.utc().toMillis())}toString(){return this.toJSON().join(" ")}toJSON(){return aA.TIME_UNITS.map((H)=>{return this._wcOrAll(H)})}getNextDateFrom(H,A){var L,I;if(H instanceof Date)H=fL.DateTime.fromJSDate(H);if(A)H=H.setZone(A);else A=(L=H.zone.zoneName)!==null&&L!==void 0?L:H.zone.fixed;let $=fL.DateTime.fromFormat(`${H.year}-${H.month}-${H.day} ${H.hour}:${H.minute}:${H.second}`,"yyyy-M-d H:m:s",{zone:"UTC"}),f=$.toMillis();if(!this.realDate){if($.millisecond>0)$=$.set({millisecond:0,second:$.second+1})}if(!$.isValid)throw new qA.CronError("ERROR: You specified an invalid date.");let E=fL.DateTime.now().plus({years:8});while(!0){if($>E)throw new qA.CronError(`Something went wrong. No execution date was found in the next 8 years.
3
+ var EG=Object.create;var{getPrototypeOf:OG,defineProperty:L1,getOwnPropertyNames:_G}=Object;var LG=Object.prototype.hasOwnProperty;var C1=(i,o,n)=>{n=i!=null?EG(OG(i)):{};let p=o||!i||!i.__esModule?L1(n,"default",{value:i,enumerable:!0}):n;for(let c of _G(i))if(!LG.call(p,c))L1(p,c,{get:()=>i[c],enumerable:!0});return p};var P=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports);var CG=(i,o)=>{for(var n in o)L1(i,n,{get:o[n],enumerable:!0,configurable:!0,set:(p)=>o[n]=()=>p})};var Hi=import.meta.require;var r6=P((d6)=>{Object.defineProperty(d6,"__esModule",{value:!0});class Dp extends Error{}class q8 extends Dp{constructor(i){super(`Invalid DateTime: ${i.toMessage()}`)}}class k8 extends Dp{constructor(i){super(`Invalid Interval: ${i.toMessage()}`)}}class h8 extends Dp{constructor(i){super(`Invalid Duration: ${i.toMessage()}`)}}class $c extends Dp{}class bF extends Dp{constructor(i){super(`Invalid unit ${i}`)}}class Uo extends Dp{}class Jp extends Dp{constructor(){super("Zone is an abstract class")}}var D="numeric",yn="short",cn="long",x0={year:D,month:D,day:D},g8={year:D,month:yn,day:D},OU={year:D,month:yn,day:D,weekday:yn},s8={year:D,month:cn,day:D},t8={year:D,month:cn,day:D,weekday:cn},d8={hour:D,minute:D},r8={hour:D,minute:D,second:D},e8={hour:D,minute:D,second:D,timeZoneName:yn},i6={hour:D,minute:D,second:D,timeZoneName:cn},o6={hour:D,minute:D,hourCycle:"h23"},n6={hour:D,minute:D,second:D,hourCycle:"h23"},p6={hour:D,minute:D,second:D,hourCycle:"h23",timeZoneName:yn},c6={hour:D,minute:D,second:D,hourCycle:"h23",timeZoneName:cn},x6={year:D,month:D,day:D,hour:D,minute:D},T6={year:D,month:D,day:D,hour:D,minute:D,second:D},m6={year:D,month:yn,day:D,hour:D,minute:D},f6={year:D,month:yn,day:D,hour:D,minute:D,second:D},_U={year:D,month:yn,day:D,weekday:yn,hour:D,minute:D},F6={year:D,month:cn,day:D,hour:D,minute:D,timeZoneName:yn},$6={year:D,month:cn,day:D,hour:D,minute:D,second:D,timeZoneName:yn},J6={year:D,month:cn,day:D,weekday:cn,hour:D,minute:D,timeZoneName:cn},A6={year:D,month:cn,day:D,weekday:cn,hour:D,minute:D,second:D,timeZoneName:cn};class Ac{get type(){throw new Jp}get name(){throw new Jp}get ianaName(){return this.name}get isUniversal(){throw new Jp}offsetName(i,o){throw new Jp}formatOffset(i,o){throw new Jp}offset(i){throw new Jp}equals(i){throw new Jp}get isValid(){throw new Jp}}var KF=null;class OT extends Ac{static get instance(){if(KF===null)KF=new OT;return KF}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(i,{format:o,locale:n}){return u6(i,o,n)}formatOffset(i,o){return ST(this.offset(i),o)}offset(i){return-new Date(i).getTimezoneOffset()}equals(i){return i.type==="system"}get isValid(){return!0}}var SF=new Map;function LU(i){let o=SF.get(i);if(o===void 0)o=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),SF.set(i,o);return o}var CU={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function yU(i,o){let n=i.format(o).replace(/\u200E/g,""),p=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,c,x,T,m,f,F,$]=p;return[T,c,x,m,f,F,$]}function DU(i,o){let n=i.formatToParts(o),p=[];for(let c=0;c<n.length;c++){let{type:x,value:T}=n[c],m=CU[x];if(x==="era")p[m]=T;else if(!e(m))p[m]=parseInt(T,10)}return p}var HF=new Map;class sn extends Ac{static create(i){let o=HF.get(i);if(o===void 0)HF.set(i,o=new sn(i));return o}static resetCache(){HF.clear(),SF.clear()}static isValidSpecifier(i){return this.isValidZone(i)}static isValidZone(i){if(!i)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:i}).format(),!0}catch(o){return!1}}constructor(i){super();this.zoneName=i,this.valid=sn.isValidZone(i)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(i,{format:o,locale:n}){return u6(i,o,n,this.name)}formatOffset(i,o){return ST(this.offset(i),o)}offset(i){if(!this.valid)return NaN;let o=new Date(i);if(isNaN(o))return NaN;let n=LU(this.name),[p,c,x,T,m,f,F]=n.formatToParts?DU(n,o):yU(n,o);if(T==="BC")p=-Math.abs(p)+1;let J=$0({year:p,month:c,day:x,hour:m===24?0:m,minute:f,second:F,millisecond:0}),A=+o,X=A%1000;return A-=X>=0?X:1000+X,(J-A)/60000}equals(i){return i.type==="iana"&&i.name===this.name}get isValid(){return this.valid}}var W8={};function IU(i,o={}){let n=JSON.stringify([i,o]),p=W8[n];if(!p)p=new Intl.ListFormat(i,o),W8[n]=p;return p}var EF=new Map;function OF(i,o={}){let n=JSON.stringify([i,o]),p=EF.get(n);if(p===void 0)p=new Intl.DateTimeFormat(i,o),EF.set(n,p);return p}var _F=new Map;function BU(i,o={}){let n=JSON.stringify([i,o]),p=_F.get(n);if(p===void 0)p=new Intl.NumberFormat(i,o),_F.set(n,p);return p}var LF=new Map;function NU(i,o={}){let{base:n,...p}=o,c=JSON.stringify([i,p]),x=LF.get(c);if(x===void 0)x=new Intl.RelativeTimeFormat(i,o),LF.set(c,x);return x}var uT=null;function bU(){if(uT)return uT;else return uT=new Intl.DateTimeFormat().resolvedOptions().locale,uT}var CF=new Map;function v6(i){let o=CF.get(i);if(o===void 0)o=new Intl.DateTimeFormat(i).resolvedOptions(),CF.set(i,o);return o}var yF=new Map;function jU(i){let o=yF.get(i);if(!o){let n=new Intl.Locale(i);if(o="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,!("minimalDays"in o))o={...R6,...o};yF.set(i,o)}return o}function PU(i){let o=i.indexOf("-x-");if(o!==-1)i=i.substring(0,o);let n=i.indexOf("-u-");if(n===-1)return[i];else{let p,c;try{p=OF(i).resolvedOptions(),c=i}catch(m){let f=i.substring(0,n);p=OF(f).resolvedOptions(),c=f}let{numberingSystem:x,calendar:T}=p;return[c,x,T]}}function aU(i,o,n){if(n||o){if(!i.includes("-u-"))i+="-u";if(n)i+=`-ca-${n}`;if(o)i+=`-nu-${o}`;return i}else return i}function lU(i){let o=[];for(let n=1;n<=12;n++){let p=r.utc(2009,n,1);o.push(i(p))}return o}function qU(i){let o=[];for(let n=1;n<=7;n++){let p=r.utc(2016,11,13+n);o.push(i(p))}return o}function i0(i,o,n,p){let c=i.listingMode();if(c==="error")return null;else if(c==="en")return n(o);else return p(o)}function kU(i){if(i.numberingSystem&&i.numberingSystem!=="latn")return!1;else return i.numberingSystem==="latn"||!i.locale||i.locale.startsWith("en")||v6(i.locale).numberingSystem==="latn"}class w6{constructor(i,o,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:p,floor:c,...x}=n;if(!o||Object.keys(x).length>0){let T={useGrouping:!1,...n};if(n.padTo>0)T.minimumIntegerDigits=n.padTo;this.inf=BU(i,T)}}format(i){if(this.inf){let o=this.floor?Math.floor(i):i;return this.inf.format(o)}else{let o=this.floor?Math.floor(i):kF(i,3);return co(o,this.padTo)}}}class X6{constructor(i,o,n){this.opts=n,this.originalZone=void 0;let p=void 0;if(this.opts.timeZone)this.dt=i;else if(i.zone.type==="fixed"){let x=-1*(i.offset/60),T=x>=0?`Etc/GMT+${x}`:`Etc/GMT${x}`;if(i.offset!==0&&sn.create(T).valid)p=T,this.dt=i;else p="UTC",this.dt=i.offset===0?i:i.setZone("UTC").plus({minutes:i.offset}),this.originalZone=i.zone}else if(i.zone.type==="system")this.dt=i;else if(i.zone.type==="iana")this.dt=i,p=i.zone.name;else p="UTC",this.dt=i.setZone("UTC").plus({minutes:i.offset}),this.originalZone=i.zone;let c={...this.opts};c.timeZone=c.timeZone||p,this.dtf=OF(o,c)}format(){if(this.originalZone)return this.formatToParts().map(({value:i})=>i).join("");return this.dtf.format(this.dt.toJSDate())}formatToParts(){let i=this.dtf.formatToParts(this.dt.toJSDate());if(this.originalZone)return i.map((o)=>{if(o.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...o,value:n}}else return o});return i}resolvedOptions(){return this.dtf.resolvedOptions()}}class W6{constructor(i,o,n){if(this.opts={style:"long",...n},!o&&M6())this.rtf=NU(i,n)}format(i,o){if(this.rtf)return this.rtf.format(i,o);else return vZ(o,i,this.opts.numeric,this.opts.style!=="long")}formatToParts(i,o){if(this.rtf)return this.rtf.formatToParts(i,o);else return[]}}var R6={firstDay:1,minimalDays:4,weekend:[6,7]};class Ui{static fromOpts(i){return Ui.create(i.locale,i.numberingSystem,i.outputCalendar,i.weekSettings,i.defaultToEN)}static create(i,o,n,p,c=!1){let x=i||li.defaultLocale,T=x||(c?"en-US":bU()),m=o||li.defaultNumberingSystem,f=n||li.defaultOutputCalendar,F=IF(p)||li.defaultWeekSettings;return new Ui(T,m,f,F,x)}static resetCache(){uT=null,EF.clear(),_F.clear(),LF.clear(),CF.clear(),yF.clear()}static fromObject({locale:i,numberingSystem:o,outputCalendar:n,weekSettings:p}={}){return Ui.create(i,o,n,p)}constructor(i,o,n,p,c){let[x,T,m]=PU(i);this.locale=x,this.numberingSystem=o||T||null,this.outputCalendar=n||m||null,this.weekSettings=p,this.intl=aU(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=c,this.fastNumbersCached=null}get fastNumbers(){if(this.fastNumbersCached==null)this.fastNumbersCached=kU(this);return this.fastNumbersCached}listingMode(){let i=this.isEnglish(),o=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return i&&o?"en":"intl"}clone(i){if(!i||Object.getOwnPropertyNames(i).length===0)return this;else return Ui.create(i.locale||this.specifiedLocale,i.numberingSystem||this.numberingSystem,i.outputCalendar||this.outputCalendar,IF(i.weekSettings)||this.weekSettings,i.defaultToEN||!1)}redefaultToEN(i={}){return this.clone({...i,defaultToEN:!0})}redefaultToSystem(i={}){return this.clone({...i,defaultToEN:!1})}months(i,o=!1){return i0(this,i,S6,()=>{let n=o?{month:i,day:"numeric"}:{month:i},p=o?"format":"standalone";if(!this.monthsCache[p][i])this.monthsCache[p][i]=lU((c)=>this.extract(c,n,"month"));return this.monthsCache[p][i]})}weekdays(i,o=!1){return i0(this,i,_6,()=>{let n=o?{weekday:i,year:"numeric",month:"long",day:"numeric"}:{weekday:i},p=o?"format":"standalone";if(!this.weekdaysCache[p][i])this.weekdaysCache[p][i]=qU((c)=>this.extract(c,n,"weekday"));return this.weekdaysCache[p][i]})}meridiems(){return i0(this,void 0,()=>L6,()=>{if(!this.meridiemCache){let i={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[r.utc(2016,11,13,9),r.utc(2016,11,13,19)].map((o)=>this.extract(o,i,"dayperiod"))}return this.meridiemCache})}eras(i){return i0(this,i,C6,()=>{let o={era:i};if(!this.eraCache[i])this.eraCache[i]=[r.utc(-40,1,1),r.utc(2017,1,1)].map((n)=>this.extract(n,o,"era"));return this.eraCache[i]})}extract(i,o,n){let p=this.dtFormatter(i,o),c=p.formatToParts(),x=c.find((T)=>T.type.toLowerCase()===n);return x?x.value:null}numberFormatter(i={}){return new w6(this.intl,i.forceSimple||this.fastNumbers,i)}dtFormatter(i,o={}){return new X6(i,this.intl,o)}relFormatter(i={}){return new W6(this.intl,this.isEnglish(),i)}listFormatter(i={}){return IU(this.intl,i)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||v6(this.intl).locale.startsWith("en-us")}getWeekSettings(){if(this.weekSettings)return this.weekSettings;else if(!z6())return R6;else return jU(this.locale)}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(i){return this.locale===i.locale&&this.numberingSystem===i.numberingSystem&&this.outputCalendar===i.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}var UF=null;class _o extends Ac{static get utcInstance(){if(UF===null)UF=new _o(0);return UF}static instance(i){return i===0?_o.utcInstance:new _o(i)}static parseSpecifier(i){if(i){let o=i.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(o)return new _o(J0(o[1],o[2]))}return null}constructor(i){super();this.fixed=i}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ST(this.fixed,"narrow")}`}get ianaName(){if(this.fixed===0)return"Etc/UTC";else return`Etc/GMT${ST(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(i,o){return ST(this.fixed,o)}get isUniversal(){return!0}offset(){return this.fixed}equals(i){return i.type==="fixed"&&i.fixed===this.fixed}get isValid(){return!0}}class jF extends Ac{constructor(i){super();this.zoneName=i}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Cp(i,o){if(e(i)||i===null)return o;else if(i instanceof Ac)return i;else if(rU(i)){let n=i.toLowerCase();if(n==="default")return o;else if(n==="local"||n==="system")return OT.instance;else if(n==="utc"||n==="gmt")return _o.utcInstance;else return _o.parseSpecifier(n)||sn.create(i)}else if(yp(i))return _o.instance(i);else if(typeof i==="object"&&"offset"in i&&typeof i.offset==="function")return i;else return new jF(i)}var PF={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},R8={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},hU=PF.hanidec.replace(/[\[|\]]/g,"").split("");function gU(i){let o=parseInt(i,10);if(isNaN(o)){o="";for(let n=0;n<i.length;n++){let p=i.charCodeAt(n);if(i[n].search(PF.hanidec)!==-1)o+=hU.indexOf(i[n]);else for(let c in R8){let[x,T]=R8[c];if(p>=x&&p<=T)o+=p-x}}return parseInt(o,10)}else return o}var DF=new Map;function sU(){DF.clear()}function Ln({numberingSystem:i},o=""){let n=i||"latn",p=DF.get(n);if(p===void 0)p=new Map,DF.set(n,p);let c=p.get(o);if(c===void 0)c=new RegExp(`${PF[n]}${o}`),p.set(o,c);return c}var Y8=()=>Date.now(),G8="system",K8=null,H8=null,U8=null,Z8=60,M8,z8=null;class li{static get now(){return Y8}static set now(i){Y8=i}static set defaultZone(i){G8=i}static get defaultZone(){return Cp(G8,OT.instance)}static get defaultLocale(){return K8}static set defaultLocale(i){K8=i}static get defaultNumberingSystem(){return H8}static set defaultNumberingSystem(i){H8=i}static get defaultOutputCalendar(){return U8}static set defaultOutputCalendar(i){U8=i}static get defaultWeekSettings(){return z8}static set defaultWeekSettings(i){z8=IF(i)}static get twoDigitCutoffYear(){return Z8}static set twoDigitCutoffYear(i){Z8=i%100}static get throwOnInvalid(){return M8}static set throwOnInvalid(i){M8=i}static resetCaches(){Ui.resetCache(),sn.resetCache(),r.resetCache(),sU()}}class Gn{constructor(i,o){this.reason=i,this.explanation=o}toMessage(){if(this.explanation)return`${this.reason}: ${this.explanation}`;else return this.reason}}var Y6=[0,31,59,90,120,151,181,212,243,273,304,334],G6=[0,31,60,91,121,152,182,213,244,274,305,335];function Kn(i,o){return new Gn("unit out of range",`you specified ${o} (of type ${typeof o}) as a ${i}, which is invalid`)}function aF(i,o,n){let p=new Date(Date.UTC(i,o-1,n));if(i<100&&i>=0)p.setUTCFullYear(p.getUTCFullYear()-1900);let c=p.getUTCDay();return c===0?7:c}function K6(i,o,n){return n+(_T(i)?G6:Y6)[o-1]}function H6(i,o){let n=_T(i)?G6:Y6,p=n.findIndex((x)=>x<o),c=o-n[p];return{month:p+1,day:c}}function lF(i,o){return(i-o+7)%7+1}function T0(i,o=4,n=1){let{year:p,month:c,day:x}=i,T=K6(p,c,x),m=lF(aF(p,c,x),n),f=Math.floor((T-m+14-o)/7),F;if(f<1)F=p-1,f=ET(F,o,n);else if(f>ET(p,o,n))F=p+1,f=1;else F=p;return{weekYear:F,weekNumber:f,weekday:m,...A0(i)}}function u8(i,o=4,n=1){let{weekYear:p,weekNumber:c,weekday:x}=i,T=lF(aF(p,1,o),n),m=mx(p),f=c*7+x-T-7+o,F;if(f<1)F=p-1,f+=mx(F);else if(f>m)F=p+1,f-=mx(p);else F=p;let{month:$,day:J}=H6(F,f);return{year:F,month:$,day:J,...A0(i)}}function ZF(i){let{year:o,month:n,day:p}=i,c=K6(o,n,p);return{year:o,ordinal:c,...A0(i)}}function Q8(i){let{year:o,ordinal:n}=i,{month:p,day:c}=H6(o,n);return{year:o,month:p,day:c,...A0(i)}}function V8(i,o){if(!e(i.localWeekday)||!e(i.localWeekNumber)||!e(i.localWeekYear)){if(!e(i.weekday)||!e(i.weekNumber)||!e(i.weekYear))throw new $c("Cannot mix locale-based week fields with ISO-based week fields");if(!e(i.localWeekday))i.weekday=i.localWeekday;if(!e(i.localWeekNumber))i.weekNumber=i.localWeekNumber;if(!e(i.localWeekYear))i.weekYear=i.localWeekYear;return delete i.localWeekday,delete i.localWeekNumber,delete i.localWeekYear,{minDaysInFirstWeek:o.getMinDaysInFirstWeek(),startOfWeek:o.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function tU(i,o=4,n=1){let p=F0(i.weekYear),c=Hn(i.weekNumber,1,ET(i.weekYear,o,n)),x=Hn(i.weekday,1,7);if(!p)return Kn("weekYear",i.weekYear);else if(!c)return Kn("week",i.weekNumber);else if(!x)return Kn("weekday",i.weekday);else return!1}function dU(i){let o=F0(i.year),n=Hn(i.ordinal,1,mx(i.year));if(!o)return Kn("year",i.year);else if(!n)return Kn("ordinal",i.ordinal);else return!1}function U6(i){let o=F0(i.year),n=Hn(i.month,1,12),p=Hn(i.day,1,m0(i.year,i.month));if(!o)return Kn("year",i.year);else if(!n)return Kn("month",i.month);else if(!p)return Kn("day",i.day);else return!1}function Z6(i){let{hour:o,minute:n,second:p,millisecond:c}=i,x=Hn(o,0,23)||o===24&&n===0&&p===0&&c===0,T=Hn(n,0,59),m=Hn(p,0,59),f=Hn(c,0,999);if(!x)return Kn("hour",o);else if(!T)return Kn("minute",n);else if(!m)return Kn("second",p);else if(!f)return Kn("millisecond",c);else return!1}function e(i){return typeof i==="undefined"}function yp(i){return typeof i==="number"}function F0(i){return typeof i==="number"&&i%1===0}function rU(i){return typeof i==="string"}function eU(i){return Object.prototype.toString.call(i)==="[object Date]"}function M6(){try{return typeof Intl!=="undefined"&&!!Intl.RelativeTimeFormat}catch(i){return!1}}function z6(){try{return typeof Intl!=="undefined"&&!!Intl.Locale&&(("weekInfo"in Intl.Locale.prototype)||("getWeekInfo"in Intl.Locale.prototype))}catch(i){return!1}}function iZ(i){return Array.isArray(i)?i:[i]}function S8(i,o,n){if(i.length===0)return;return i.reduce((p,c)=>{let x=[o(c),c];if(!p)return x;else if(n(p[0],x[0])===p[0])return p;else return x},null)[1]}function oZ(i,o){return o.reduce((n,p)=>{return n[p]=i[p],n},{})}function Fx(i,o){return Object.prototype.hasOwnProperty.call(i,o)}function IF(i){if(i==null)return null;else if(typeof i!=="object")throw new Uo("Week settings must be an object");else{if(!Hn(i.firstDay,1,7)||!Hn(i.minimalDays,1,7)||!Array.isArray(i.weekend)||i.weekend.some((o)=>!Hn(o,1,7)))throw new Uo("Invalid week settings");return{firstDay:i.firstDay,minimalDays:i.minimalDays,weekend:Array.from(i.weekend)}}}function Hn(i,o,n){return F0(i)&&i>=o&&i<=n}function nZ(i,o){return i-o*Math.floor(i/o)}function co(i,o=2){let n=i<0,p;if(n)p="-"+(""+-i).padStart(o,"0");else p=(""+i).padStart(o,"0");return p}function Lp(i){if(e(i)||i===null||i==="")return;else return parseInt(i,10)}function fc(i){if(e(i)||i===null||i==="")return;else return parseFloat(i)}function qF(i){if(e(i)||i===null||i==="")return;else{let o=parseFloat("0."+i)*1000;return Math.floor(o)}}function kF(i,o,n=!1){let p=10**o;return(n?Math.trunc:Math.round)(i*p)/p}function _T(i){return i%4===0&&(i%100!==0||i%400===0)}function mx(i){return _T(i)?366:365}function m0(i,o){let n=nZ(o-1,12)+1,p=i+(o-n)/12;if(n===2)return _T(p)?29:28;else return[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function $0(i){let o=Date.UTC(i.year,i.month-1,i.day,i.hour,i.minute,i.second,i.millisecond);if(i.year<100&&i.year>=0)o=new Date(o),o.setUTCFullYear(i.year,i.month-1,i.day);return+o}function E8(i,o,n){return-lF(aF(i,1,o),n)+o-1}function ET(i,o=4,n=1){let p=E8(i,o,n),c=E8(i+1,o,n);return(mx(i)-p+c)/7}function BF(i){if(i>99)return i;else return i>li.twoDigitCutoffYear?1900+i:2000+i}function u6(i,o,n,p=null){let c=new Date(i),x={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};if(p)x.timeZone=p;let T={timeZoneName:o,...x},m=new Intl.DateTimeFormat(n,T).formatToParts(c).find((f)=>f.type.toLowerCase()==="timezonename");return m?m.value:null}function J0(i,o){let n=parseInt(i,10);if(Number.isNaN(n))n=0;let p=parseInt(o,10)||0,c=n<0||Object.is(n,-0)?-p:p;return n*60+c}function Q6(i){let o=Number(i);if(typeof i==="boolean"||i===""||Number.isNaN(o))throw new Uo(`Invalid unit value ${i}`);return o}function f0(i,o){let n={};for(let p in i)if(Fx(i,p)){let c=i[p];if(c===void 0||c===null)continue;n[o(p)]=Q6(c)}return n}function ST(i,o){let n=Math.trunc(Math.abs(i/60)),p=Math.trunc(Math.abs(i%60)),c=i>=0?"+":"-";switch(o){case"short":return`${c}${co(n,2)}:${co(p,2)}`;case"narrow":return`${c}${n}${p>0?`:${p}`:""}`;case"techie":return`${c}${co(n,2)}${co(p,2)}`;default:throw new RangeError(`Value format ${o} is out of range for property format`)}}function A0(i){return oZ(i,["hour","minute","second","millisecond"])}var pZ=["January","February","March","April","May","June","July","August","September","October","November","December"],V6=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],cZ=["J","F","M","A","M","J","J","A","S","O","N","D"];function S6(i){switch(i){case"narrow":return[...cZ];case"short":return[...V6];case"long":return[...pZ];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var E6=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],O6=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],xZ=["M","T","W","T","F","S","S"];function _6(i){switch(i){case"narrow":return[...xZ];case"short":return[...O6];case"long":return[...E6];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var L6=["AM","PM"],TZ=["Before Christ","Anno Domini"],mZ=["BC","AD"],fZ=["B","A"];function C6(i){switch(i){case"narrow":return[...fZ];case"short":return[...mZ];case"long":return[...TZ];default:return null}}function FZ(i){return L6[i.hour<12?0:1]}function $Z(i,o){return _6(o)[i.weekday-1]}function JZ(i,o){return S6(o)[i.month-1]}function AZ(i,o){return C6(o)[i.year<0?0:1]}function vZ(i,o,n="always",p=!1){let c={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},x=["hours","minutes","seconds"].indexOf(i)===-1;if(n==="auto"&&x){let J=i==="days";switch(o){case 1:return J?"tomorrow":`next ${c[i][0]}`;case-1:return J?"yesterday":`last ${c[i][0]}`;case 0:return J?"today":`this ${c[i][0]}`}}let T=Object.is(o,-0)||o<0,m=Math.abs(o),f=m===1,F=c[i],$=p?f?F[1]:F[2]||F[1]:f?c[i][0]:i;return T?`${m} ${$} ago`:`in ${m} ${$}`}function O8(i,o){let n="";for(let p of i)if(p.literal)n+=p.val;else n+=o(p.val);return n}var wZ={D:x0,DD:g8,DDD:s8,DDDD:t8,t:d8,tt:r8,ttt:e8,tttt:i6,T:o6,TT:n6,TTT:p6,TTTT:c6,f:x6,ff:m6,fff:F6,ffff:J6,F:T6,FF:f6,FFF:$6,FFFF:A6};class Oo{static create(i,o={}){return new Oo(i,o)}static parseFormat(i){let o=null,n="",p=!1,c=[];for(let x=0;x<i.length;x++){let T=i.charAt(x);if(T==="'"){if(n.length>0)c.push({literal:p||/^\s+$/.test(n),val:n});o=null,n="",p=!p}else if(p)n+=T;else if(T===o)n+=T;else{if(n.length>0)c.push({literal:/^\s+$/.test(n),val:n});n=T,o=T}}if(n.length>0)c.push({literal:p||/^\s+$/.test(n),val:n});return c}static macroTokenToFormatOpts(i){return wZ[i]}constructor(i,o){this.opts=o,this.loc=i,this.systemLoc=null}formatWithSystemDefault(i,o){if(this.systemLoc===null)this.systemLoc=this.loc.redefaultToSystem();return this.systemLoc.dtFormatter(i,{...this.opts,...o}).format()}dtFormatter(i,o={}){return this.loc.dtFormatter(i,{...this.opts,...o})}formatDateTime(i,o){return this.dtFormatter(i,o).format()}formatDateTimeParts(i,o){return this.dtFormatter(i,o).formatToParts()}formatInterval(i,o){return this.dtFormatter(i.start,o).dtf.formatRange(i.start.toJSDate(),i.end.toJSDate())}resolvedOptions(i,o){return this.dtFormatter(i,o).resolvedOptions()}num(i,o=0){if(this.opts.forceSimple)return co(i,o);let n={...this.opts};if(o>0)n.padTo=o;return this.loc.numberFormatter(n).format(i)}formatDateTimeFromString(i,o){let n=this.loc.listingMode()==="en",p=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",c=(A,X)=>this.loc.extract(i,A,X),x=(A)=>{if(i.isOffsetFixed&&i.offset===0&&A.allowZ)return"Z";return i.isValid?i.zone.formatOffset(i.ts,A.format):""},T=()=>n?FZ(i):c({hour:"numeric",hourCycle:"h12"},"dayperiod"),m=(A,X)=>n?JZ(i,A):c(X?{month:A}:{month:A,day:"numeric"},"month"),f=(A,X)=>n?$Z(i,A):c(X?{weekday:A}:{weekday:A,month:"long",day:"numeric"},"weekday"),F=(A)=>{let X=Oo.macroTokenToFormatOpts(A);if(X)return this.formatWithSystemDefault(i,X);else return A},$=(A)=>n?AZ(i,A):c({era:A},"era"),J=(A)=>{switch(A){case"S":return this.num(i.millisecond);case"u":case"SSS":return this.num(i.millisecond,3);case"s":return this.num(i.second);case"ss":return this.num(i.second,2);case"uu":return this.num(Math.floor(i.millisecond/10),2);case"uuu":return this.num(Math.floor(i.millisecond/100));case"m":return this.num(i.minute);case"mm":return this.num(i.minute,2);case"h":return this.num(i.hour%12===0?12:i.hour%12);case"hh":return this.num(i.hour%12===0?12:i.hour%12,2);case"H":return this.num(i.hour);case"HH":return this.num(i.hour,2);case"Z":return x({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return x({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return x({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return i.zone.offsetName(i.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return i.zone.offsetName(i.ts,{format:"long",locale:this.loc.locale});case"z":return i.zoneName;case"a":return T();case"d":return p?c({day:"numeric"},"day"):this.num(i.day);case"dd":return p?c({day:"2-digit"},"day"):this.num(i.day,2);case"c":return this.num(i.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return this.num(i.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return p?c({month:"numeric",day:"numeric"},"month"):this.num(i.month);case"LL":return p?c({month:"2-digit",day:"numeric"},"month"):this.num(i.month,2);case"LLL":return m("short",!0);case"LLLL":return m("long",!0);case"LLLLL":return m("narrow",!0);case"M":return p?c({month:"numeric"},"month"):this.num(i.month);case"MM":return p?c({month:"2-digit"},"month"):this.num(i.month,2);case"MMM":return m("short",!1);case"MMMM":return m("long",!1);case"MMMMM":return m("narrow",!1);case"y":return p?c({year:"numeric"},"year"):this.num(i.year);case"yy":return p?c({year:"2-digit"},"year"):this.num(i.year.toString().slice(-2),2);case"yyyy":return p?c({year:"numeric"},"year"):this.num(i.year,4);case"yyyyyy":return p?c({year:"numeric"},"year"):this.num(i.year,6);case"G":return $("short");case"GG":return $("long");case"GGGGG":return $("narrow");case"kk":return this.num(i.weekYear.toString().slice(-2),2);case"kkkk":return this.num(i.weekYear,4);case"W":return this.num(i.weekNumber);case"WW":return this.num(i.weekNumber,2);case"n":return this.num(i.localWeekNumber);case"nn":return this.num(i.localWeekNumber,2);case"ii":return this.num(i.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(i.localWeekYear,4);case"o":return this.num(i.ordinal);case"ooo":return this.num(i.ordinal,3);case"q":return this.num(i.quarter);case"qq":return this.num(i.quarter,2);case"X":return this.num(Math.floor(i.ts/1000));case"x":return this.num(i.ts);default:return F(A)}};return O8(Oo.parseFormat(o),J)}formatDurationFromString(i,o){let n=(m)=>{switch(m[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},p=(m)=>(f)=>{let F=n(f);if(F)return this.num(m.get(F),f.length);else return f},c=Oo.parseFormat(o),x=c.reduce((m,{literal:f,val:F})=>f?m:m.concat(F),[]),T=i.shiftTo(...x.map(n).filter((m)=>m));return O8(c,p(T))}}var y6=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function $x(...i){let o=i.reduce((n,p)=>n+p.source,"");return RegExp(`^${o}$`)}function Jx(...i){return(o)=>i.reduce(([n,p,c],x)=>{let[T,m,f]=x(o,c);return[{...n,...T},m||p,f]},[{},null,1]).slice(0,2)}function Ax(i,...o){if(i==null)return[null,null];for(let[n,p]of o){let c=n.exec(i);if(c)return p(c)}return[null,null]}function D6(...i){return(o,n)=>{let p={},c;for(c=0;c<i.length;c++)p[i[c]]=Lp(o[n+c]);return[p,null,n+c]}}var I6=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,XZ=`(?:${I6.source}?(?:\\[(${y6.source})\\])?)?`,hF=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,B6=RegExp(`${hF.source}${XZ}`),gF=RegExp(`(?:T${B6.source})?`),WZ=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,RZ=/(\d{4})-?W(\d\d)(?:-?(\d))?/,YZ=/(\d{4})-?(\d{3})/,GZ=D6("weekYear","weekNumber","weekDay"),KZ=D6("year","ordinal"),HZ=/(\d{4})-(\d\d)-(\d\d)/,N6=RegExp(`${hF.source} ?(?:${I6.source}|(${y6.source}))?`),UZ=RegExp(`(?: ${N6.source})?`);function fx(i,o,n){let p=i[o];return e(p)?n:Lp(p)}function ZZ(i,o){return[{year:fx(i,o),month:fx(i,o+1,1),day:fx(i,o+2,1)},null,o+3]}function vx(i,o){return[{hours:fx(i,o,0),minutes:fx(i,o+1,0),seconds:fx(i,o+2,0),milliseconds:qF(i[o+3])},null,o+4]}function LT(i,o){let n=!i[o]&&!i[o+1],p=J0(i[o+1],i[o+2]),c=n?null:_o.instance(p);return[{},c,o+3]}function CT(i,o){let n=i[o]?sn.create(i[o]):null;return[{},n,o+1]}var MZ=RegExp(`^T?${hF.source}$`),zZ=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function uZ(i){let[o,n,p,c,x,T,m,f,F]=i,$=o[0]==="-",J=f&&f[0]==="-",A=(X,Y=!1)=>X!==void 0&&(Y||X&&$)?-X:X;return[{years:A(fc(n)),months:A(fc(p)),weeks:A(fc(c)),days:A(fc(x)),hours:A(fc(T)),minutes:A(fc(m)),seconds:A(fc(f),f==="-0"),milliseconds:A(qF(F),J)}]}var QZ={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function sF(i,o,n,p,c,x,T){let m={year:o.length===2?BF(Lp(o)):Lp(o),month:V6.indexOf(n)+1,day:Lp(p),hour:Lp(c),minute:Lp(x)};if(T)m.second=Lp(T);if(i)m.weekday=i.length>3?E6.indexOf(i)+1:O6.indexOf(i)+1;return m}var VZ=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function SZ(i){let[,o,n,p,c,x,T,m,f,F,$,J]=i,A=sF(o,c,p,n,x,T,m),X;if(f)X=QZ[f];else if(F)X=0;else X=J0($,J);return[A,new _o(X)]}function EZ(i){return i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var OZ=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,_Z=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,LZ=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function _8(i){let[,o,n,p,c,x,T,m]=i;return[sF(o,c,p,n,x,T,m),_o.utcInstance]}function CZ(i){let[,o,n,p,c,x,T,m]=i;return[sF(o,m,n,p,c,x,T),_o.utcInstance]}var yZ=$x(WZ,gF),DZ=$x(RZ,gF),IZ=$x(YZ,gF),BZ=$x(B6),b6=Jx(ZZ,vx,LT,CT),NZ=Jx(GZ,vx,LT,CT),bZ=Jx(KZ,vx,LT,CT),jZ=Jx(vx,LT,CT);function PZ(i){return Ax(i,[yZ,b6],[DZ,NZ],[IZ,bZ],[BZ,jZ])}function aZ(i){return Ax(EZ(i),[VZ,SZ])}function lZ(i){return Ax(i,[OZ,_8],[_Z,_8],[LZ,CZ])}function qZ(i){return Ax(i,[zZ,uZ])}var kZ=Jx(vx);function hZ(i){return Ax(i,[MZ,kZ])}var gZ=$x(HZ,UZ),sZ=$x(N6),tZ=Jx(vx,LT,CT);function dZ(i){return Ax(i,[gZ,b6],[sZ,tZ])}var L8="Invalid Duration",j6={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:604800000},days:{hours:24,minutes:1440,seconds:86400,milliseconds:86400000},hours:{minutes:60,seconds:3600,milliseconds:3600000},minutes:{seconds:60,milliseconds:60000},seconds:{milliseconds:1000}},rZ={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536000,milliseconds:31536000000},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:7862400000},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592000,milliseconds:2592000000},...j6},Yn=365.2425,px=30.436875,eZ={years:{quarters:4,months:12,weeks:Yn/7,days:Yn,hours:Yn*24,minutes:Yn*24*60,seconds:Yn*24*60*60,milliseconds:Yn*24*60*60*1000},quarters:{months:3,weeks:Yn/28,days:Yn/4,hours:Yn*24/4,minutes:Yn*24*60/4,seconds:Yn*24*60*60/4,milliseconds:Yn*24*60*60*1000/4},months:{weeks:px/7,days:px,hours:px*24,minutes:px*24*60,seconds:px*24*60*60,milliseconds:px*24*60*60*1000},...j6},Jc=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],iM=Jc.slice(0).reverse();function _p(i,o,n=!1){let p={values:n?o.values:{...i.values,...o.values||{}},loc:i.loc.clone(o.loc),conversionAccuracy:o.conversionAccuracy||i.conversionAccuracy,matrix:o.matrix||i.matrix};return new wi(p)}function P6(i,o){var n;let p=(n=o.milliseconds)!=null?n:0;for(let c of iM.slice(1))if(o[c])p+=o[c]*i[c].milliseconds;return p}function C8(i,o){let n=P6(i,o)<0?-1:1;Jc.reduceRight((p,c)=>{if(!e(o[c])){if(p){let x=o[p]*n,T=i[c][p],m=Math.floor(x/T);o[c]+=m*n,o[p]-=m*T*n}return c}else return p},null),Jc.reduce((p,c)=>{if(!e(o[c])){if(p){let x=o[p]%1;o[p]-=x,o[c]+=x*i[p][c]}return c}else return p},null)}function oM(i){let o={};for(let[n,p]of Object.entries(i))if(p!==0)o[n]=p;return o}class wi{constructor(i){let o=i.conversionAccuracy==="longterm"||!1,n=o?eZ:rZ;if(i.matrix)n=i.matrix;this.values=i.values,this.loc=i.loc||Ui.create(),this.conversionAccuracy=o?"longterm":"casual",this.invalid=i.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(i,o){return wi.fromObject({milliseconds:i},o)}static fromObject(i,o={}){if(i==null||typeof i!=="object")throw new Uo(`Duration.fromObject: argument expected to be an object, got ${i===null?"null":typeof i}`);return new wi({values:f0(i,wi.normalizeUnit),loc:Ui.fromObject(o),conversionAccuracy:o.conversionAccuracy,matrix:o.matrix})}static fromDurationLike(i){if(yp(i))return wi.fromMillis(i);else if(wi.isDuration(i))return i;else if(typeof i==="object")return wi.fromObject(i);else throw new Uo(`Unknown duration argument ${i} of type ${typeof i}`)}static fromISO(i,o){let[n]=qZ(i);if(n)return wi.fromObject(n,o);else return wi.invalid("unparsable",`the input "${i}" can't be parsed as ISO 8601`)}static fromISOTime(i,o){let[n]=hZ(i);if(n)return wi.fromObject(n,o);else return wi.invalid("unparsable",`the input "${i}" can't be parsed as ISO 8601`)}static invalid(i,o=null){if(!i)throw new Uo("need to specify a reason the Duration is invalid");let n=i instanceof Gn?i:new Gn(i,o);if(li.throwOnInvalid)throw new h8(n);else return new wi({invalid:n})}static normalizeUnit(i){let o={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[i?i.toLowerCase():i];if(!o)throw new bF(i);return o}static isDuration(i){return i&&i.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(i,o={}){let n={...o,floor:o.round!==!1&&o.floor!==!1};return this.isValid?Oo.create(this.loc,n).formatDurationFromString(this,i):L8}toHuman(i={}){if(!this.isValid)return L8;let o=Jc.map((n)=>{let p=this.values[n];if(e(p))return null;return this.loc.numberFormatter({style:"unit",unitDisplay:"long",...i,unit:n.slice(0,-1)}).format(p)}).filter((n)=>n);return this.loc.listFormatter({type:"conjunction",style:i.listStyle||"narrow",...i}).format(o)}toObject(){if(!this.isValid)return{};return{...this.values}}toISO(){if(!this.isValid)return null;let i="P";if(this.years!==0)i+=this.years+"Y";if(this.months!==0||this.quarters!==0)i+=this.months+this.quarters*3+"M";if(this.weeks!==0)i+=this.weeks+"W";if(this.days!==0)i+=this.days+"D";if(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)i+="T";if(this.hours!==0)i+=this.hours+"H";if(this.minutes!==0)i+=this.minutes+"M";if(this.seconds!==0||this.milliseconds!==0)i+=kF(this.seconds+this.milliseconds/1000,3)+"S";if(i==="P")i+="T0S";return i}toISOTime(i={}){if(!this.isValid)return null;let o=this.toMillis();if(o<0||o>=86400000)return null;return i={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...i,includeOffset:!1},r.fromMillis(o,{zone:"UTC"}).toISOTime(i)}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){if(this.isValid)return`Duration { values: ${JSON.stringify(this.values)} }`;else return`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){if(!this.isValid)return NaN;return P6(this.matrix,this.values)}valueOf(){return this.toMillis()}plus(i){if(!this.isValid)return this;let o=wi.fromDurationLike(i),n={};for(let p of Jc)if(Fx(o.values,p)||Fx(this.values,p))n[p]=o.get(p)+this.get(p);return _p(this,{values:n},!0)}minus(i){if(!this.isValid)return this;let o=wi.fromDurationLike(i);return this.plus(o.negate())}mapUnits(i){if(!this.isValid)return this;let o={};for(let n of Object.keys(this.values))o[n]=Q6(i(this.values[n],n));return _p(this,{values:o},!0)}get(i){return this[wi.normalizeUnit(i)]}set(i){if(!this.isValid)return this;let o={...this.values,...f0(i,wi.normalizeUnit)};return _p(this,{values:o})}reconfigure({locale:i,numberingSystem:o,conversionAccuracy:n,matrix:p}={}){let x={loc:this.loc.clone({locale:i,numberingSystem:o}),matrix:p,conversionAccuracy:n};return _p(this,x)}as(i){return this.isValid?this.shiftTo(i).get(i):NaN}normalize(){if(!this.isValid)return this;let i=this.toObject();return C8(this.matrix,i),_p(this,{values:i},!0)}rescale(){if(!this.isValid)return this;let i=oM(this.normalize().shiftToAll().toObject());return _p(this,{values:i},!0)}shiftTo(...i){if(!this.isValid)return this;if(i.length===0)return this;i=i.map((x)=>wi.normalizeUnit(x));let o={},n={},p=this.toObject(),c;for(let x of Jc)if(i.indexOf(x)>=0){c=x;let T=0;for(let f in n)T+=this.matrix[f][x]*n[f],n[f]=0;if(yp(p[x]))T+=p[x];let m=Math.trunc(T);o[x]=m,n[x]=(T*1000-m*1000)/1000}else if(yp(p[x]))n[x]=p[x];for(let x in n)if(n[x]!==0)o[c]+=x===c?n[x]:n[x]/this.matrix[c][x];return C8(this.matrix,o),_p(this,{values:o},!0)}shiftToAll(){if(!this.isValid)return this;return this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds")}negate(){if(!this.isValid)return this;let i={};for(let o of Object.keys(this.values))i[o]=this.values[o]===0?0:-this.values[o];return _p(this,{values:i},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(i){if(!this.isValid||!i.isValid)return!1;if(!this.loc.equals(i.loc))return!1;function o(n,p){if(n===void 0||n===0)return p===void 0||p===0;return n===p}for(let n of Jc)if(!o(this.values[n],i.values[n]))return!1;return!0}}var cx="Invalid Interval";function nM(i,o){if(!i||!i.isValid)return hi.invalid("missing or invalid start");else if(!o||!o.isValid)return hi.invalid("missing or invalid end");else if(o<i)return hi.invalid("end before start",`The end of an interval must be after its start, but you had start=${i.toISO()} and end=${o.toISO()}`);else return null}class hi{constructor(i){this.s=i.start,this.e=i.end,this.invalid=i.invalid||null,this.isLuxonInterval=!0}static invalid(i,o=null){if(!i)throw new Uo("need to specify a reason the Interval is invalid");let n=i instanceof Gn?i:new Gn(i,o);if(li.throwOnInvalid)throw new k8(n);else return new hi({invalid:n})}static fromDateTimes(i,o){let n=zT(i),p=zT(o),c=nM(n,p);if(c==null)return new hi({start:n,end:p});else return c}static after(i,o){let n=wi.fromDurationLike(o),p=zT(i);return hi.fromDateTimes(p,p.plus(n))}static before(i,o){let n=wi.fromDurationLike(o),p=zT(i);return hi.fromDateTimes(p.minus(n),p)}static fromISO(i,o){let[n,p]=(i||"").split("/",2);if(n&&p){let c,x;try{c=r.fromISO(n,o),x=c.isValid}catch(f){x=!1}let T,m;try{T=r.fromISO(p,o),m=T.isValid}catch(f){m=!1}if(x&&m)return hi.fromDateTimes(c,T);if(x){let f=wi.fromISO(p,o);if(f.isValid)return hi.after(c,f)}else if(m){let f=wi.fromISO(n,o);if(f.isValid)return hi.before(T,f)}}return hi.invalid("unparsable",`the input "${i}" can't be parsed as ISO 8601`)}static isInterval(i){return i&&i.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid?this.e?this.e.minus(1):null:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(i="milliseconds"){return this.isValid?this.toDuration(...[i]).get(i):NaN}count(i="milliseconds",o){if(!this.isValid)return NaN;let n=this.start.startOf(i,o),p;if(o!=null&&o.useLocaleWeeks)p=this.end.reconfigure({locale:n.locale});else p=this.end;return p=p.startOf(i,o),Math.floor(p.diff(n,i).get(i))+(p.valueOf()!==this.end.valueOf())}hasSame(i){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,i):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(i){if(!this.isValid)return!1;return this.s>i}isBefore(i){if(!this.isValid)return!1;return this.e<=i}contains(i){if(!this.isValid)return!1;return this.s<=i&&this.e>i}set({start:i,end:o}={}){if(!this.isValid)return this;return hi.fromDateTimes(i||this.s,o||this.e)}splitAt(...i){if(!this.isValid)return[];let o=i.map(zT).filter((x)=>this.contains(x)).sort((x,T)=>x.toMillis()-T.toMillis()),n=[],{s:p}=this,c=0;while(p<this.e){let x=o[c]||this.e,T=+x>+this.e?this.e:x;n.push(hi.fromDateTimes(p,T)),p=T,c+=1}return n}splitBy(i){let o=wi.fromDurationLike(i);if(!this.isValid||!o.isValid||o.as("milliseconds")===0)return[];let{s:n}=this,p=1,c,x=[];while(n<this.e){let T=this.start.plus(o.mapUnits((m)=>m*p));c=+T>+this.e?this.e:T,x.push(hi.fromDateTimes(n,c)),n=c,p+=1}return x}divideEqually(i){if(!this.isValid)return[];return this.splitBy(this.length()/i).slice(0,i)}overlaps(i){return this.e>i.s&&this.s<i.e}abutsStart(i){if(!this.isValid)return!1;return+this.e===+i.s}abutsEnd(i){if(!this.isValid)return!1;return+i.e===+this.s}engulfs(i){if(!this.isValid)return!1;return this.s<=i.s&&this.e>=i.e}equals(i){if(!this.isValid||!i.isValid)return!1;return this.s.equals(i.s)&&this.e.equals(i.e)}intersection(i){if(!this.isValid)return this;let o=this.s>i.s?this.s:i.s,n=this.e<i.e?this.e:i.e;if(o>=n)return null;else return hi.fromDateTimes(o,n)}union(i){if(!this.isValid)return this;let o=this.s<i.s?this.s:i.s,n=this.e>i.e?this.e:i.e;return hi.fromDateTimes(o,n)}static merge(i){let[o,n]=i.sort((p,c)=>p.s-c.s).reduce(([p,c],x)=>{if(!c)return[p,x];else if(c.overlaps(x)||c.abutsStart(x))return[p,c.union(x)];else return[p.concat([c]),x]},[[],null]);if(n)o.push(n);return o}static xor(i){let o=null,n=0,p=[],c=i.map((m)=>[{time:m.s,type:"s"},{time:m.e,type:"e"}]),x=Array.prototype.concat(...c),T=x.sort((m,f)=>m.time-f.time);for(let m of T)if(n+=m.type==="s"?1:-1,n===1)o=m.time;else{if(o&&+o!==+m.time)p.push(hi.fromDateTimes(o,m.time));o=null}return hi.merge(p)}difference(...i){return hi.xor([this].concat(i)).map((o)=>this.intersection(o)).filter((o)=>o&&!o.isEmpty())}toString(){if(!this.isValid)return cx;return`[${this.s.toISO()} \u2013 ${this.e.toISO()})`}[Symbol.for("nodejs.util.inspect.custom")](){if(this.isValid)return`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;else return`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(i=x0,o={}){return this.isValid?Oo.create(this.s.loc.clone(o),i).formatInterval(this):cx}toISO(i){if(!this.isValid)return cx;return`${this.s.toISO(i)}/${this.e.toISO(i)}`}toISODate(){if(!this.isValid)return cx;return`${this.s.toISODate()}/${this.e.toISODate()}`}toISOTime(i){if(!this.isValid)return cx;return`${this.s.toISOTime(i)}/${this.e.toISOTime(i)}`}toFormat(i,{separator:o=" \u2013 "}={}){if(!this.isValid)return cx;return`${this.s.toFormat(i)}${o}${this.e.toFormat(i)}`}toDuration(i,o){if(!this.isValid)return wi.invalid(this.invalidReason);return this.e.diff(this.s,i,o)}mapEndpoints(i){return hi.fromDateTimes(i(this.s),i(this.e))}}class Tx{static hasDST(i=li.defaultZone){let o=r.now().setZone(i).set({month:12});return!i.isUniversal&&o.offset!==o.set({month:6}).offset}static isValidIANAZone(i){return sn.isValidZone(i)}static normalizeZone(i){return Cp(i,li.defaultZone)}static getStartOfWeek({locale:i=null,locObj:o=null}={}){return(o||Ui.create(i)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:i=null,locObj:o=null}={}){return(o||Ui.create(i)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:i=null,locObj:o=null}={}){return(o||Ui.create(i)).getWeekendDays().slice()}static months(i="long",{locale:o=null,numberingSystem:n=null,locObj:p=null,outputCalendar:c="gregory"}={}){return(p||Ui.create(o,n,c)).months(i)}static monthsFormat(i="long",{locale:o=null,numberingSystem:n=null,locObj:p=null,outputCalendar:c="gregory"}={}){return(p||Ui.create(o,n,c)).months(i,!0)}static weekdays(i="long",{locale:o=null,numberingSystem:n=null,locObj:p=null}={}){return(p||Ui.create(o,n,null)).weekdays(i)}static weekdaysFormat(i="long",{locale:o=null,numberingSystem:n=null,locObj:p=null}={}){return(p||Ui.create(o,n,null)).weekdays(i,!0)}static meridiems({locale:i=null}={}){return Ui.create(i).meridiems()}static eras(i="short",{locale:o=null}={}){return Ui.create(o,null,"gregory").eras(i)}static features(){return{relative:M6(),localeWeek:z6()}}}function y8(i,o){let n=(c)=>c.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),p=n(o)-n(i);return Math.floor(wi.fromMillis(p).as("days"))}function pM(i,o,n){let p=[["years",(f,F)=>F.year-f.year],["quarters",(f,F)=>F.quarter-f.quarter+(F.year-f.year)*4],["months",(f,F)=>F.month-f.month+(F.year-f.year)*12],["weeks",(f,F)=>{let $=y8(f,F);return($-$%7)/7}],["days",y8]],c={},x=i,T,m;for(let[f,F]of p)if(n.indexOf(f)>=0)if(T=f,c[f]=F(i,o),m=x.plus(c),m>o){if(c[f]--,i=x.plus(c),i>o)m=i,c[f]--,i=x.plus(c)}else i=m;return[i,c,m,T]}function cM(i,o,n,p){let[c,x,T,m]=pM(i,o,n),f=o-c,F=n.filter((J)=>["hours","minutes","seconds","milliseconds"].indexOf(J)>=0);if(F.length===0){if(T<o)T=c.plus({[m]:1});if(T!==c)x[m]=(x[m]||0)+f/(T-c)}let $=wi.fromObject(x,p);if(F.length>0)return wi.fromMillis(f,p).shiftTo(...F).plus($);else return $}var xM="missing Intl.DateTimeFormat.formatToParts support";function Ki(i,o=(n)=>n){return{regex:i,deser:([n])=>o(gU(n))}}var TM=String.fromCharCode(160),a6=`[ ${TM}]`,l6=new RegExp(a6,"g");function mM(i){return i.replace(/\./g,"\\.?").replace(l6,a6)}function D8(i){return i.replace(/\./g,"").replace(l6," ").toLowerCase()}function Cn(i,o){if(i===null)return null;else return{regex:RegExp(i.map(mM).join("|")),deser:([n])=>i.findIndex((p)=>D8(n)===D8(p))+o}}function I8(i,o){return{regex:i,deser:([,n,p])=>J0(n,p),groups:o}}function o0(i){return{regex:i,deser:([o])=>o}}function fM(i){return i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function FM(i,o){let n=Ln(o),p=Ln(o,"{2}"),c=Ln(o,"{3}"),x=Ln(o,"{4}"),T=Ln(o,"{6}"),m=Ln(o,"{1,2}"),f=Ln(o,"{1,3}"),F=Ln(o,"{1,6}"),$=Ln(o,"{1,9}"),J=Ln(o,"{2,4}"),A=Ln(o,"{4,6}"),X=(K)=>({regex:RegExp(fM(K.val)),deser:([U])=>U,literal:!0}),R=((K)=>{if(i.literal)return X(K);switch(K.val){case"G":return Cn(o.eras("short"),0);case"GG":return Cn(o.eras("long"),0);case"y":return Ki(F);case"yy":return Ki(J,BF);case"yyyy":return Ki(x);case"yyyyy":return Ki(A);case"yyyyyy":return Ki(T);case"M":return Ki(m);case"MM":return Ki(p);case"MMM":return Cn(o.months("short",!0),1);case"MMMM":return Cn(o.months("long",!0),1);case"L":return Ki(m);case"LL":return Ki(p);case"LLL":return Cn(o.months("short",!1),1);case"LLLL":return Cn(o.months("long",!1),1);case"d":return Ki(m);case"dd":return Ki(p);case"o":return Ki(f);case"ooo":return Ki(c);case"HH":return Ki(p);case"H":return Ki(m);case"hh":return Ki(p);case"h":return Ki(m);case"mm":return Ki(p);case"m":return Ki(m);case"q":return Ki(m);case"qq":return Ki(p);case"s":return Ki(m);case"ss":return Ki(p);case"S":return Ki(f);case"SSS":return Ki(c);case"u":return o0($);case"uu":return o0(m);case"uuu":return Ki(n);case"a":return Cn(o.meridiems(),0);case"kkkk":return Ki(x);case"kk":return Ki(J,BF);case"W":return Ki(m);case"WW":return Ki(p);case"E":case"c":return Ki(n);case"EEE":return Cn(o.weekdays("short",!1),1);case"EEEE":return Cn(o.weekdays("long",!1),1);case"ccc":return Cn(o.weekdays("short",!0),1);case"cccc":return Cn(o.weekdays("long",!0),1);case"Z":case"ZZ":return I8(new RegExp(`([+-]${m.source})(?::(${p.source}))?`),2);case"ZZZ":return I8(new RegExp(`([+-]${m.source})(${p.source})?`),2);case"z":return o0(/[a-z_+-/]{1,256}?/i);case" ":return o0(/[^\S\n\r]/);default:return X(K)}})(i)||{invalidReason:xM};return R.token=i,R}var $M={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function JM(i,o,n){let{type:p,value:c}=i;if(p==="literal"){let f=/^\s+$/.test(c);return{literal:!f,val:f?" ":c}}let x=o[p],T=p;if(p==="hour")if(o.hour12!=null)T=o.hour12?"hour12":"hour24";else if(o.hourCycle!=null)if(o.hourCycle==="h11"||o.hourCycle==="h12")T="hour12";else T="hour24";else T=n.hour12?"hour12":"hour24";let m=$M[T];if(typeof m==="object")m=m[x];if(m)return{literal:!1,val:m};return}function AM(i){return[`^${i.map((n)=>n.regex).reduce((n,p)=>`${n}(${p.source})`,"")}$`,i]}function vM(i,o,n){let p=i.match(o);if(p){let c={},x=1;for(let T in n)if(Fx(n,T)){let m=n[T],f=m.groups?m.groups+1:1;if(!m.literal&&m.token)c[m.token.val[0]]=m.deser(p.slice(x,x+f));x+=f}return[p,c]}else return[p,{}]}function wM(i){let o=(x)=>{switch(x){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},n=null,p;if(!e(i.z))n=sn.create(i.z);if(!e(i.Z)){if(!n)n=new _o(i.Z);p=i.Z}if(!e(i.q))i.M=(i.q-1)*3+1;if(!e(i.h)){if(i.h<12&&i.a===1)i.h+=12;else if(i.h===12&&i.a===0)i.h=0}if(i.G===0&&i.y)i.y=-i.y;if(!e(i.u))i.S=qF(i.u);return[Object.keys(i).reduce((x,T)=>{let m=o(T);if(m)x[m]=i[T];return x},{}),n,p]}var MF=null;function XM(){if(!MF)MF=r.fromMillis(1555555555555);return MF}function WM(i,o){if(i.literal)return i;let n=Oo.macroTokenToFormatOpts(i.val),p=h6(n,o);if(p==null||p.includes(void 0))return i;return p}function q6(i,o){return Array.prototype.concat(...i.map((n)=>WM(n,o)))}class tF{constructor(i,o){if(this.locale=i,this.format=o,this.tokens=q6(Oo.parseFormat(o),i),this.units=this.tokens.map((n)=>FM(n,i)),this.disqualifyingUnit=this.units.find((n)=>n.invalidReason),!this.disqualifyingUnit){let[n,p]=AM(this.units);this.regex=RegExp(n,"i"),this.handlers=p}}explainFromTokens(i){if(!this.isValid)return{input:i,tokens:this.tokens,invalidReason:this.invalidReason};else{let[o,n]=vM(i,this.regex,this.handlers),[p,c,x]=n?wM(n):[null,null,void 0];if(Fx(n,"a")&&Fx(n,"H"))throw new $c("Can't include meridiem when specifying 24-hour format");return{input:i,tokens:this.tokens,regex:this.regex,rawMatches:o,matches:n,result:p,zone:c,specificOffset:x}}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function k6(i,o,n){return new tF(i,n).explainFromTokens(o)}function RM(i,o,n){let{result:p,zone:c,specificOffset:x,invalidReason:T}=k6(i,o,n);return[p,c,x,T]}function h6(i,o){if(!i)return null;let p=Oo.create(o,i).dtFormatter(XM()),c=p.formatToParts(),x=p.resolvedOptions();return c.map((T)=>JM(T,i,x))}var zF="Invalid DateTime",B8=8640000000000000;function QT(i){return new Gn("unsupported zone",`the zone "${i.name}" is not supported`)}function uF(i){if(i.weekData===null)i.weekData=T0(i.c);return i.weekData}function QF(i){if(i.localWeekData===null)i.localWeekData=T0(i.c,i.loc.getMinDaysInFirstWeek(),i.loc.getStartOfWeek());return i.localWeekData}function Fc(i,o){let n={ts:i.ts,zone:i.zone,c:i.c,o:i.o,loc:i.loc,invalid:i.invalid};return new r({...n,...o,old:n})}function g6(i,o,n){let p=i-o*60*1000,c=n.offset(p);if(o===c)return[p,o];p-=(c-o)*60*1000;let x=n.offset(p);if(c===x)return[p,c];return[i-Math.min(c,x)*60*1000,Math.max(c,x)]}function n0(i,o){i+=o*60*1000;let n=new Date(i);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function c0(i,o,n){return g6($0(i),o,n)}function N8(i,o){let n=i.o,p=i.c.year+Math.trunc(o.years),c=i.c.month+Math.trunc(o.months)+Math.trunc(o.quarters)*3,x={...i.c,year:p,month:c,day:Math.min(i.c.day,m0(p,c))+Math.trunc(o.days)+Math.trunc(o.weeks)*7},T=wi.fromObject({years:o.years-Math.trunc(o.years),quarters:o.quarters-Math.trunc(o.quarters),months:o.months-Math.trunc(o.months),weeks:o.weeks-Math.trunc(o.weeks),days:o.days-Math.trunc(o.days),hours:o.hours,minutes:o.minutes,seconds:o.seconds,milliseconds:o.milliseconds}).as("milliseconds"),m=$0(x),[f,F]=g6(m,n,i.zone);if(T!==0)f+=T,F=i.zone.offset(f);return{ts:f,o:F}}function xx(i,o,n,p,c,x){let{setZone:T,zone:m}=n;if(i&&Object.keys(i).length!==0||o){let f=o||m,F=r.fromObject(i,{...n,zone:f,specificOffset:x});return T?F:F.setZone(m)}else return r.invalid(new Gn("unparsable",`the input "${c}" can't be parsed as ${p}`))}function p0(i,o,n=!0){return i.isValid?Oo.create(Ui.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(i,o):null}function VF(i,o){let n=i.c.year>9999||i.c.year<0,p="";if(n&&i.c.year>=0)p+="+";if(p+=co(i.c.year,n?6:4),o)p+="-",p+=co(i.c.month),p+="-",p+=co(i.c.day);else p+=co(i.c.month),p+=co(i.c.day);return p}function b8(i,o,n,p,c,x){let T=co(i.c.hour);if(o){if(T+=":",T+=co(i.c.minute),i.c.millisecond!==0||i.c.second!==0||!n)T+=":"}else T+=co(i.c.minute);if(i.c.millisecond!==0||i.c.second!==0||!n){if(T+=co(i.c.second),i.c.millisecond!==0||!p)T+=".",T+=co(i.c.millisecond,3)}if(c)if(i.isOffsetFixed&&i.offset===0&&!x)T+="Z";else if(i.o<0)T+="-",T+=co(Math.trunc(-i.o/60)),T+=":",T+=co(Math.trunc(-i.o%60));else T+="+",T+=co(Math.trunc(i.o/60)),T+=":",T+=co(Math.trunc(i.o%60));if(x)T+="["+i.zone.ianaName+"]";return T}var s6={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},YM={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},GM={ordinal:1,hour:0,minute:0,second:0,millisecond:0},t6=["year","month","day","hour","minute","second","millisecond"],KM=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],HM=["year","ordinal","hour","minute","second","millisecond"];function UM(i){let o={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[i.toLowerCase()];if(!o)throw new bF(i);return o}function j8(i){switch(i.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return UM(i)}}function ZM(i){if(VT===void 0)VT=li.now();if(i.type!=="iana")return i.offset(VT);let o=i.name,n=NF.get(o);if(n===void 0)n=i.offset(VT),NF.set(o,n);return n}function P8(i,o){let n=Cp(o.zone,li.defaultZone);if(!n.isValid)return r.invalid(QT(n));let p=Ui.fromObject(o),c,x;if(!e(i.year)){for(let f of t6)if(e(i[f]))i[f]=s6[f];let T=U6(i)||Z6(i);if(T)return r.invalid(T);let m=ZM(n);[c,x]=c0(i,m,n)}else c=li.now();return new r({ts:c,zone:n,loc:p,o:x})}function a8(i,o,n){let p=e(n.round)?!0:n.round,c=(T,m)=>{return T=kF(T,p||n.calendary?0:2,!0),o.loc.clone(n).relFormatter(n).format(T,m)},x=(T)=>{if(n.calendary)if(!o.hasSame(i,T))return o.startOf(T).diff(i.startOf(T),T).get(T);else return 0;else return o.diff(i,T).get(T)};if(n.unit)return c(x(n.unit),n.unit);for(let T of n.units){let m=x(T);if(Math.abs(m)>=1)return c(m,T)}return c(i>o?-0:0,n.units[n.units.length-1])}function l8(i){let o={},n;if(i.length>0&&typeof i[i.length-1]==="object")o=i[i.length-1],n=Array.from(i).slice(0,i.length-1);else n=Array.from(i);return[o,n]}var VT,NF=new Map;class r{constructor(i){let o=i.zone||li.defaultZone,n=i.invalid||(Number.isNaN(i.ts)?new Gn("invalid input"):null)||(!o.isValid?QT(o):null);this.ts=e(i.ts)?li.now():i.ts;let p=null,c=null;if(!n)if(i.old&&i.old.ts===this.ts&&i.old.zone.equals(o))[p,c]=[i.old.c,i.old.o];else{let T=yp(i.o)&&!i.old?i.o:o.offset(this.ts);p=n0(this.ts,T),n=Number.isNaN(p.year)?new Gn("invalid input"):null,p=n?null:p,c=n?null:T}this._zone=o,this.loc=i.loc||Ui.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=p,this.o=c,this.isLuxonDateTime=!0}static now(){return new r({})}static local(){let[i,o]=l8(arguments),[n,p,c,x,T,m,f]=o;return P8({year:n,month:p,day:c,hour:x,minute:T,second:m,millisecond:f},i)}static utc(){let[i,o]=l8(arguments),[n,p,c,x,T,m,f]=o;return i.zone=_o.utcInstance,P8({year:n,month:p,day:c,hour:x,minute:T,second:m,millisecond:f},i)}static fromJSDate(i,o={}){let n=eU(i)?i.valueOf():NaN;if(Number.isNaN(n))return r.invalid("invalid input");let p=Cp(o.zone,li.defaultZone);if(!p.isValid)return r.invalid(QT(p));return new r({ts:n,zone:p,loc:Ui.fromObject(o)})}static fromMillis(i,o={}){if(!yp(i))throw new Uo(`fromMillis requires a numerical input, but received a ${typeof i} with value ${i}`);else if(i<-B8||i>B8)return r.invalid("Timestamp out of range");else return new r({ts:i,zone:Cp(o.zone,li.defaultZone),loc:Ui.fromObject(o)})}static fromSeconds(i,o={}){if(!yp(i))throw new Uo("fromSeconds requires a numerical input");else return new r({ts:i*1000,zone:Cp(o.zone,li.defaultZone),loc:Ui.fromObject(o)})}static fromObject(i,o={}){i=i||{};let n=Cp(o.zone,li.defaultZone);if(!n.isValid)return r.invalid(QT(n));let p=Ui.fromObject(o),c=f0(i,j8),{minDaysInFirstWeek:x,startOfWeek:T}=V8(c,p),m=li.now(),f=!e(o.specificOffset)?o.specificOffset:n.offset(m),F=!e(c.ordinal),$=!e(c.year),J=!e(c.month)||!e(c.day),A=$||J,X=c.weekYear||c.weekNumber;if((A||F)&&X)throw new $c("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(J&&F)throw new $c("Can't mix ordinal dates with month/day");let Y=X||c.weekday&&!A,R,K,U=n0(m,f);if(Y)R=KM,K=YM,U=T0(U,x,T);else if(F)R=HM,K=GM,U=ZF(U);else R=t6,K=s6;let z=!1;for(let q of R){let Q=c[q];if(!e(Q))z=!0;else if(z)c[q]=K[q];else c[q]=U[q]}let b=Y?tU(c,x,T):F?dU(c):U6(c),M=b||Z6(c);if(M)return r.invalid(M);let u=Y?u8(c,x,T):F?Q8(c):c,[E,S]=c0(u,f,n),C=new r({ts:E,zone:n,o:S,loc:p});if(c.weekday&&A&&i.weekday!==C.weekday)return r.invalid("mismatched weekday",`you can't specify both a weekday of ${c.weekday} and a date of ${C.toISO()}`);if(!C.isValid)return r.invalid(C.invalid);return C}static fromISO(i,o={}){let[n,p]=PZ(i);return xx(n,p,o,"ISO 8601",i)}static fromRFC2822(i,o={}){let[n,p]=aZ(i);return xx(n,p,o,"RFC 2822",i)}static fromHTTP(i,o={}){let[n,p]=lZ(i);return xx(n,p,o,"HTTP",o)}static fromFormat(i,o,n={}){if(e(i)||e(o))throw new Uo("fromFormat requires an input string and a format");let{locale:p=null,numberingSystem:c=null}=n,x=Ui.fromOpts({locale:p,numberingSystem:c,defaultToEN:!0}),[T,m,f,F]=RM(x,i,o);if(F)return r.invalid(F);else return xx(T,m,n,`format ${o}`,i,f)}static fromString(i,o,n={}){return r.fromFormat(i,o,n)}static fromSQL(i,o={}){let[n,p]=dZ(i);return xx(n,p,o,"SQL",i)}static invalid(i,o=null){if(!i)throw new Uo("need to specify a reason the DateTime is invalid");let n=i instanceof Gn?i:new Gn(i,o);if(li.throwOnInvalid)throw new q8(n);else return new r({invalid:n})}static isDateTime(i){return i&&i.isLuxonDateTime||!1}static parseFormatForOpts(i,o={}){let n=h6(i,Ui.fromObject(o));return!n?null:n.map((p)=>p?p.val:null).join("")}static expandFormat(i,o={}){return q6(Oo.parseFormat(i),Ui.fromObject(o)).map((p)=>p.val).join("")}static resetCache(){VT=void 0,NF.clear()}get(i){return this[i]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?uF(this).weekYear:NaN}get weekNumber(){return this.isValid?uF(this).weekNumber:NaN}get weekday(){return this.isValid?uF(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?QF(this).weekday:NaN}get localWeekNumber(){return this.isValid?QF(this).weekNumber:NaN}get localWeekYear(){return this.isValid?QF(this).weekYear:NaN}get ordinal(){return this.isValid?ZF(this.c).ordinal:NaN}get monthShort(){return this.isValid?Tx.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Tx.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Tx.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Tx.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){if(this.isValid)return this.zone.offsetName(this.ts,{format:"short",locale:this.locale});else return null}get offsetNameLong(){if(this.isValid)return this.zone.offsetName(this.ts,{format:"long",locale:this.locale});else return null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){if(this.isOffsetFixed)return!1;else return this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let i=86400000,o=60000,n=$0(this.c),p=this.zone.offset(n-i),c=this.zone.offset(n+i),x=this.zone.offset(n-p*o),T=this.zone.offset(n-c*o);if(x===T)return[this];let m=n-x*o,f=n-T*o,F=n0(m,x),$=n0(f,T);if(F.hour===$.hour&&F.minute===$.minute&&F.second===$.second&&F.millisecond===$.millisecond)return[Fc(this,{ts:m}),Fc(this,{ts:f})];return[this]}get isInLeapYear(){return _T(this.year)}get daysInMonth(){return m0(this.year,this.month)}get daysInYear(){return this.isValid?mx(this.year):NaN}get weeksInWeekYear(){return this.isValid?ET(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?ET(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(i={}){let{locale:o,numberingSystem:n,calendar:p}=Oo.create(this.loc.clone(i),i).resolvedOptions(this);return{locale:o,numberingSystem:n,outputCalendar:p}}toUTC(i=0,o={}){return this.setZone(_o.instance(i),o)}toLocal(){return this.setZone(li.defaultZone)}setZone(i,{keepLocalTime:o=!1,keepCalendarTime:n=!1}={}){if(i=Cp(i,li.defaultZone),i.equals(this.zone))return this;else if(!i.isValid)return r.invalid(QT(i));else{let p=this.ts;if(o||n){let c=i.offset(this.ts),x=this.toObject();[p]=c0(x,c,i)}return Fc(this,{ts:p,zone:i})}}reconfigure({locale:i,numberingSystem:o,outputCalendar:n}={}){let p=this.loc.clone({locale:i,numberingSystem:o,outputCalendar:n});return Fc(this,{loc:p})}setLocale(i){return this.reconfigure({locale:i})}set(i){if(!this.isValid)return this;let o=f0(i,j8),{minDaysInFirstWeek:n,startOfWeek:p}=V8(o,this.loc),c=!e(o.weekYear)||!e(o.weekNumber)||!e(o.weekday),x=!e(o.ordinal),T=!e(o.year),m=!e(o.month)||!e(o.day),f=T||m,F=o.weekYear||o.weekNumber;if((f||x)&&F)throw new $c("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(m&&x)throw new $c("Can't mix ordinal dates with month/day");let $;if(c)$=u8({...T0(this.c,n,p),...o},n,p);else if(!e(o.ordinal))$=Q8({...ZF(this.c),...o});else if($={...this.toObject(),...o},e(o.day))$.day=Math.min(m0($.year,$.month),$.day);let[J,A]=c0($,this.o,this.zone);return Fc(this,{ts:J,o:A})}plus(i){if(!this.isValid)return this;let o=wi.fromDurationLike(i);return Fc(this,N8(this,o))}minus(i){if(!this.isValid)return this;let o=wi.fromDurationLike(i).negate();return Fc(this,N8(this,o))}startOf(i,{useLocaleWeeks:o=!1}={}){if(!this.isValid)return this;let n={},p=wi.normalizeUnit(i);switch(p){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(p==="weeks")if(o){let c=this.loc.getStartOfWeek(),{weekday:x}=this;if(x<c)n.weekNumber=this.weekNumber-1;n.weekday=c}else n.weekday=1;if(p==="quarters"){let c=Math.ceil(this.month/3);n.month=(c-1)*3+1}return this.set(n)}endOf(i,o){return this.isValid?this.plus({[i]:1}).startOf(i,o).minus(1):this}toFormat(i,o={}){return this.isValid?Oo.create(this.loc.redefaultToEN(o)).formatDateTimeFromString(this,i):zF}toLocaleString(i=x0,o={}){return this.isValid?Oo.create(this.loc.clone(o),i).formatDateTime(this):zF}toLocaleParts(i={}){return this.isValid?Oo.create(this.loc.clone(i),i).formatDateTimeParts(this):[]}toISO({format:i="extended",suppressSeconds:o=!1,suppressMilliseconds:n=!1,includeOffset:p=!0,extendedZone:c=!1}={}){if(!this.isValid)return null;let x=i==="extended",T=VF(this,x);return T+="T",T+=b8(this,x,o,n,p,c),T}toISODate({format:i="extended"}={}){if(!this.isValid)return null;return VF(this,i==="extended")}toISOWeekDate(){return p0(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:i=!1,suppressSeconds:o=!1,includeOffset:n=!0,includePrefix:p=!1,extendedZone:c=!1,format:x="extended"}={}){if(!this.isValid)return null;return(p?"T":"")+b8(this,x==="extended",o,i,n,c)}toRFC2822(){return p0(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return p0(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){if(!this.isValid)return null;return VF(this,!0)}toSQLTime({includeOffset:i=!0,includeZone:o=!1,includeOffsetSpace:n=!0}={}){let p="HH:mm:ss.SSS";if(o||i){if(n)p+=" ";if(o)p+="z";else if(i)p+="ZZ"}return p0(this,p,!0)}toSQL(i={}){if(!this.isValid)return null;return`${this.toSQLDate()} ${this.toSQLTime(i)}`}toString(){return this.isValid?this.toISO():zF}[Symbol.for("nodejs.util.inspect.custom")](){if(this.isValid)return`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;else return`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1000:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1000):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(i={}){if(!this.isValid)return{};let o={...this.c};if(i.includeConfig)o.outputCalendar=this.outputCalendar,o.numberingSystem=this.loc.numberingSystem,o.locale=this.loc.locale;return o}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(i,o="milliseconds",n={}){if(!this.isValid||!i.isValid)return wi.invalid("created by diffing an invalid DateTime");let p={locale:this.locale,numberingSystem:this.numberingSystem,...n},c=iZ(o).map(wi.normalizeUnit),x=i.valueOf()>this.valueOf(),T=x?this:i,m=x?i:this,f=cM(T,m,c,p);return x?f.negate():f}diffNow(i="milliseconds",o={}){return this.diff(r.now(),i,o)}until(i){return this.isValid?hi.fromDateTimes(this,i):this}hasSame(i,o,n){if(!this.isValid)return!1;let p=i.valueOf(),c=this.setZone(i.zone,{keepLocalTime:!0});return c.startOf(o,n)<=p&&p<=c.endOf(o,n)}equals(i){return this.isValid&&i.isValid&&this.valueOf()===i.valueOf()&&this.zone.equals(i.zone)&&this.loc.equals(i.loc)}toRelative(i={}){if(!this.isValid)return null;let o=i.base||r.fromObject({},{zone:this.zone}),n=i.padding?this<o?-i.padding:i.padding:0,p=["years","months","days","hours","minutes","seconds"],c=i.unit;if(Array.isArray(i.unit))p=i.unit,c=void 0;return a8(o,this.plus(n),{...i,numeric:"always",units:p,unit:c})}toRelativeCalendar(i={}){if(!this.isValid)return null;return a8(i.base||r.fromObject({},{zone:this.zone}),this,{...i,numeric:"auto",units:["years","months","days"],calendary:!0})}static min(...i){if(!i.every(r.isDateTime))throw new Uo("min requires all arguments be DateTimes");return S8(i,(o)=>o.valueOf(),Math.min)}static max(...i){if(!i.every(r.isDateTime))throw new Uo("max requires all arguments be DateTimes");return S8(i,(o)=>o.valueOf(),Math.max)}static fromFormatExplain(i,o,n={}){let{locale:p=null,numberingSystem:c=null}=n,x=Ui.fromOpts({locale:p,numberingSystem:c,defaultToEN:!0});return k6(x,i,o)}static fromStringExplain(i,o,n={}){return r.fromFormatExplain(i,o,n)}static buildFormatParser(i,o={}){let{locale:n=null,numberingSystem:p=null}=o,c=Ui.fromOpts({locale:n,numberingSystem:p,defaultToEN:!0});return new tF(c,i)}static fromFormatParser(i,o,n={}){if(e(i)||e(o))throw new Uo("fromFormatParser requires an input string and a format parser");let{locale:p=null,numberingSystem:c=null}=n,x=Ui.fromOpts({locale:p,numberingSystem:c,defaultToEN:!0});if(!x.equals(o.locale))throw new Uo(`fromFormatParser called with a locale of ${x}, but the format parser was created for ${o.locale}`);let{result:T,zone:m,specificOffset:f,invalidReason:F}=o.explainFromTokens(i);if(F)return r.invalid(F);else return xx(T,m,n,`format ${o.format}`,i,f)}static get DATE_SHORT(){return x0}static get DATE_MED(){return g8}static get DATE_MED_WITH_WEEKDAY(){return OU}static get DATE_FULL(){return s8}static get DATE_HUGE(){return t8}static get TIME_SIMPLE(){return d8}static get TIME_WITH_SECONDS(){return r8}static get TIME_WITH_SHORT_OFFSET(){return e8}static get TIME_WITH_LONG_OFFSET(){return i6}static get TIME_24_SIMPLE(){return o6}static get TIME_24_WITH_SECONDS(){return n6}static get TIME_24_WITH_SHORT_OFFSET(){return p6}static get TIME_24_WITH_LONG_OFFSET(){return c6}static get DATETIME_SHORT(){return x6}static get DATETIME_SHORT_WITH_SECONDS(){return T6}static get DATETIME_MED(){return m6}static get DATETIME_MED_WITH_SECONDS(){return f6}static get DATETIME_MED_WITH_WEEKDAY(){return _U}static get DATETIME_FULL(){return F6}static get DATETIME_FULL_WITH_SECONDS(){return $6}static get DATETIME_HUGE(){return J6}static get DATETIME_HUGE_WITH_SECONDS(){return A6}}function zT(i){if(r.isDateTime(i))return i;else if(i&&i.valueOf&&yp(i.valueOf()))return r.fromJSDate(i);else if(i&&typeof i==="object")return r.fromObject(i);else throw new Uo(`Unknown datetime argument: ${i}, of type ${typeof i}`)}var MM="3.6.1";d6.DateTime=r;d6.Duration=wi;d6.FixedOffsetZone=_o;d6.IANAZone=sn;d6.Info=Tx;d6.Interval=hi;d6.InvalidZone=jF;d6.Settings=li;d6.SystemZone=OT;d6.VERSION=MM;d6.Zone=Ac});var p3=P((e6)=>{Object.defineProperty(e6,"__esModule",{value:!0});e6.RE_RANGE=e6.RE_WILDCARDS=e6.PRESETS=e6.TIME_UNITS_LEN=e6.TIME_UNITS=e6.TIME_UNITS_MAP=e6.ALIASES=e6.PARSE_DEFAULTS=e6.CONSTRAINTS=void 0;e6.CONSTRAINTS=Object.freeze({second:[0,59],minute:[0,59],hour:[0,23],dayOfMonth:[1,31],month:[1,12],dayOfWeek:[0,7]});e6.PARSE_DEFAULTS=Object.freeze({second:"0",minute:"*",hour:"*",dayOfMonth:"*",month:"*",dayOfWeek:"*"});e6.ALIASES=Object.freeze({jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12,sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6});e6.TIME_UNITS_MAP=Object.freeze({SECOND:"second",MINUTE:"minute",HOUR:"hour",DAY_OF_MONTH:"dayOfMonth",MONTH:"month",DAY_OF_WEEK:"dayOfWeek"});e6.TIME_UNITS=Object.freeze(Object.values(e6.TIME_UNITS_MAP));e6.TIME_UNITS_LEN=e6.TIME_UNITS.length;e6.PRESETS=Object.freeze({"@yearly":"0 0 0 1 1 *","@monthly":"0 0 0 1 * *","@weekly":"0 0 0 * * 0","@daily":"0 0 0 * * *","@hourly":"0 0 * * * *","@minutely":"0 * * * * *","@secondly":"* * * * * *","@weekdays":"0 0 0 * * 1-5","@weekends":"0 0 0 * * 0,6"});e6.RE_WILDCARDS=/\*/g;e6.RE_RANGE=/^(\d+)(?:-(\d+))?(?:\/(\d+))?$/g});var rF=P((x3)=>{Object.defineProperty(x3,"__esModule",{value:!0});x3.ExclusiveParametersError=x3.CronError=void 0;class dF extends Error{}x3.CronError=dF;class c3 extends dF{constructor(i,o){super(`You can't specify both ${i} and ${o}`)}}x3.ExclusiveParametersError=c3});var v0=P((m3)=>{Object.defineProperty(m3,"__esModule",{value:!0});m3.CronTime=void 0;var xn=r6(),Lo=p3(),to=rF();class eF{constructor(i,o,n){if(this.realDate=!1,this.second={},this.minute={},this.hour={},this.dayOfMonth={},this.month={},this.dayOfWeek={},o!=null&&n!=null)throw new to.ExclusiveParametersError("timeZone","utcOffset");if(o){if(!xn.DateTime.fromObject({},{zone:o}).isValid)throw new to.CronError("Invalid timezone.");this.timeZone=o}if(n!=null)this.utcOffset=n;if(o==null&&n==null){let p=Intl.DateTimeFormat().resolvedOptions().timeZone;this.timeZone=p}if(i instanceof Date||i instanceof xn.DateTime)this.source=i instanceof Date?xn.DateTime.fromJSDate(i):i,this.realDate=!0;else this.source=i,this._parse(this.source)}static validateCronExpression(i){try{return new eF(i),{valid:!0}}catch(o){return{valid:!1,error:o}}}_getWeekDay(i){return i.weekday===7?0:i.weekday}sendAt(i){let o=this.realDate&&this.source instanceof xn.DateTime?this.source:xn.DateTime.utc();if(this.timeZone)o=o.setZone(this.timeZone);if(this.utcOffset!==void 0){let n=this.utcOffset<0?"-":"+",p=Math.trunc(this.utcOffset/60),c=String(Math.abs(p)).padStart(2,"0"),x=Math.abs(this.utcOffset-p*60),T=String(x).padStart(2,"0"),m=`UTC${n}${c}:${T}`;if(o=o.setZone(m),!o.isValid)throw new to.CronError("ERROR: You specified an invalid UTC offset.")}if(this.realDate){if(xn.DateTime.local()>o)throw new to.CronError("WARNING: Date in past. Will never be fired.");return o}if(i===void 0||isNaN(i)||i<0)return this.getNextDateFrom(o);else{let n=[];for(;i>0;i--)o=this.getNextDateFrom(o),n.push(o);return n}}getTimeout(){return Math.max(-1,this.sendAt().toMillis()-xn.DateTime.utc().toMillis())}toString(){return this.toJSON().join(" ")}toJSON(){return Lo.TIME_UNITS.map((i)=>{return this._wcOrAll(i)})}getNextDateFrom(i,o){var n,p;if(i instanceof Date)i=xn.DateTime.fromJSDate(i);if(o)i=i.setZone(o);else o=(n=i.zone.zoneName)!==null&&n!==void 0?n:i.zone.fixed;let c=xn.DateTime.fromFormat(`${i.year}-${i.month}-${i.day} ${i.hour}:${i.minute}:${i.second}`,"yyyy-M-d H:m:s",{zone:"UTC"}),x=c.toMillis();if(!this.realDate){if(c.millisecond>0)c=c.set({millisecond:0,second:c.second+1})}if(!c.isValid)throw new to.CronError("ERROR: You specified an invalid date.");let T=xn.DateTime.now().plus({years:8});while(!0){if(c>T)throw new to.CronError(`Something went wrong. No execution date was found in the next 8 years.
4
4
  Please provide the following string if you would like to help debug:
5
- Time Zone: ${(I=A===null||A===void 0?void 0:A.toString())!==null&&I!==void 0?I:'""'} - Cron String: ${this.source.toString()} - UTC offset: ${$.offset} - current Date: ${fL.DateTime.local().toString()}`);if(!($.month in this.month)&&Object.keys(this.month).length!==12){$=$.plus({month:1}),$=$.set({day:1,hour:0,minute:0,second:0});continue}if(!($.day in this.dayOfMonth)&&Object.keys(this.dayOfMonth).length!==31&&!((this._getWeekDay($)in this.dayOfWeek)&&Object.keys(this.dayOfWeek).length!==7)||!(this._getWeekDay($)in this.dayOfWeek)&&Object.keys(this.dayOfWeek).length!==7&&!(($.day in this.dayOfMonth)&&Object.keys(this.dayOfMonth).length!==31)){$=$.plus({days:1}),$=$.set({hour:0,minute:0,second:0});continue}if(!($.hour in this.hour)&&Object.keys(this.hour).length!==24){$=$.plus({hour:1}),$=$.set({minute:0,second:0});continue}if(!($.minute in this.minute)&&Object.keys(this.minute).length!==60){$=$.plus({minute:1}),$=$.set({second:0});continue}if($.toMillis()===f||!($.second in this.second)&&Object.keys(this.second).length!==60){$=$.plus({second:1});continue}break}let{hour:D,minute:M}=$;$=fL.DateTime.fromFormat(`${$.year}-${$.month}-${$.day} ${$.hour}:${$.minute}:${$.second}`,"yyyy-M-d H:m:s",{zone:A});let o=fL.DateTime.fromFormat(`${$.year}-1-1 0:0:0`,"yyyy-M-d H:m:s",{zone:A});if((D!==$.hour||M!==$.minute)&&o.offset!==$.offset){while($.minus({minute:1}).offset!==o.offset)$=$.minus({minute:1});return $}let u=$.minus({hour:1}),t=$.minus({hour:2});if((u.hour===$.hour||t.hour===u.hour)&&u>H)$=u;let i=$.minus({minute:30});if((i.minute===$.minute||u.minute===i.minute)&&i>H)$=i;return $}_wcOrAll(H){if(this._hasAll(H))return"*";let A=[];for(let L in this[H])A.push(L);return A.join(",")}_hasAll(H){let A=aA.CONSTRAINTS[H],L=A[0],I=H===aA.TIME_UNITS_MAP.DAY_OF_WEEK?A[1]-1:A[1];for(let $=L,f=I;$<f;$++)if(!($ in this[H]))return!1;return!0}_parse(H){var A;if(H=H.toLowerCase(),Object.keys(aA.PRESETS).includes(H))H=aA.PRESETS[H];H=H.replace(/[a-z]{1,3}/gi,($)=>{if(Object.keys(aA.ALIASES).includes($))return aA.ALIASES[$].toString();throw new qA.CronError(`Unknown alias: ${$}`)});let L=H.trim().split(/\s+/);if(L.length<aA.TIME_UNITS_LEN-1)throw new qA.CronError("Too few fields");if(L.length>aA.TIME_UNITS_LEN)throw new qA.CronError("Too many fields");let I=L.length;for(let $ of aA.TIME_UNITS){let f=aA.TIME_UNITS.indexOf($),E=(A=L[f-(aA.TIME_UNITS_LEN-I)])!==null&&A!==void 0?A:aA.PARSE_DEFAULTS[$];this._parseField(E,$)}}_parseField(H,A){let L=this[A],I,$=aA.CONSTRAINTS[A],f=$[0],E=$[1];H.split(",").forEach((o)=>{let u=o.indexOf("*");if(u!==-1&&u!==0)throw new qA.CronError(`Field (${o}) has an invalid wildcard expression`)}),H=H.replace(aA.RE_WILDCARDS,`${f}-${E}`);let M=H.split(",");for(let o of M){let u=[...o.matchAll(aA.RE_RANGE)][0];if((u===null||u===void 0?void 0:u[1])!==void 0){let[,t,i,B]=u,U=parseInt(t,10),x=i!==void 0?parseInt(i,10):void 0,T=B!==void 0,F=parseInt(B!==null&&B!==void 0?B:"1",10);if(F===0)throw new qA.CronError(`Field (${A}) has a step of zero`);if(x!==void 0&&U>x)throw new qA.CronError(`Field (${A}) has an invalid range`);if(U<f||x!==void 0&&x>E||x===void 0&&U>E)throw new qA.CronError(`Field value (${H}) is out of range`);if(U=Math.min(Math.max(f,~~Math.abs(U)),E),x!==void 0)x=Math.min(E,~~Math.abs(x));else x=T?E:U;I=U;do L[I]=!0,I+=F;while(I<=x);if(A==="dayOfWeek"){if(!L[0]&&!!L[7])L[0]=L[7];delete L[7]}}else throw new qA.CronError(`Field (${A}) cannot be parsed`)}}}xx.CronTime=$t});var Tx=Q((cf)=>{var xM=cf&&cf.__awaiter||function(H,A,L,I){function $(f){return f instanceof L?f:new L(function(E){E(f)})}return new(L||(L=Promise))(function(f,E){function D(u){try{o(I.next(u))}catch(t){E(t)}}function M(u){try{o(I.throw(u))}catch(t){E(t)}}function o(u){u.done?f(u.value):$(u.value).then(D,M)}o((I=I.apply(H,A||[])).next())})};Object.defineProperty(cf,"__esModule",{value:!0});cf.CronJob=void 0;var Cx=O("child_process"),ft=It(),UM=cM();class sE{get isActive(){return this._isActive}get isCallbackRunning(){return this._isCallbackRunning}constructor(H,A,L,I,$,f,E,D,M,o,u){if(this.unrefTimeout=!1,this.lastExecution=null,this.runOnce=!1,this.waitForCompletion=!1,this._isActive=!1,this._isCallbackRunning=!1,this._callbacks=[],this.context=f!==null&&f!==void 0?f:this,this.waitForCompletion=Boolean(o),this.errorHandler=u,$!=null&&D!=null)throw new ft.ExclusiveParametersError("timeZone","utcOffset");if($!=null)this.cronTime=new UM.CronTime(H,$,null);else if(D!=null)this.cronTime=new UM.CronTime(H,null,D);else this.cronTime=new UM.CronTime(H,$,D);if(M!=null)this.unrefTimeout=M;if(L!=null)this.onComplete=this._fnWrap(L);if(this.cronTime.realDate)this.runOnce=!0;if(this.addCallback(this._fnWrap(A)),E)this.lastExecution=new Date,this.fireOnTick();if(I)this.start()}static from(H){if(H.timeZone!=null&&H.utcOffset!=null)throw new ft.ExclusiveParametersError("timeZone","utcOffset");if(H.timeZone!=null)return new sE(H.cronTime,H.onTick,H.onComplete,H.start,H.timeZone,H.context,H.runOnInit,H.utcOffset,H.unrefTimeout,H.waitForCompletion,H.errorHandler);else if(H.utcOffset!=null)return new sE(H.cronTime,H.onTick,H.onComplete,H.start,null,H.context,H.runOnInit,H.utcOffset,H.unrefTimeout,H.waitForCompletion,H.errorHandler);else return new sE(H.cronTime,H.onTick,H.onComplete,H.start,H.timeZone,H.context,H.runOnInit,H.utcOffset,H.unrefTimeout,H.waitForCompletion,H.errorHandler)}_fnWrap(H){var A,L;switch(typeof H){case"function":return H;case"string":{let[I,...$]=H.split(" ");return Cx.spawn.bind(void 0,I!==null&&I!==void 0?I:H,$,{})}case"object":return Cx.spawn.bind(void 0,H.command,(A=H.args)!==null&&A!==void 0?A:[],(L=H.options)!==null&&L!==void 0?L:{})}}addCallback(H){if(typeof H==="function")this._callbacks.push(H)}setTime(H){if(!(H instanceof UM.CronTime))throw new ft.CronError("time must be an instance of CronTime.");let A=this._isActive;if(this.stop(),this.cronTime=H,H.realDate)this.runOnce=!0;if(A)this.start()}nextDate(){return this.cronTime.sendAt()}fireOnTick(){return xM(this,void 0,void 0,function*(){if(this.waitForCompletion&&this._isCallbackRunning)return;this._isCallbackRunning=!0;try{for(let H of this._callbacks){let A=H.call(this.context,this.onComplete);if(this.waitForCompletion)yield A}}catch(H){if(this.errorHandler!=null)this.errorHandler(H);else console.error("[Cron] error in callback",H)}finally{this._isCallbackRunning=!1}})}nextDates(H){return this.cronTime.sendAt(H!==null&&H!==void 0?H:0)}start(){if(this._isActive)return;let H=2147483647,A=this.cronTime.getTimeout(),L=0,I,$=(E)=>{if(I=Date.now(),this._timeout=setTimeout(f,E),this.unrefTimeout&&typeof this._timeout.unref==="function")this._timeout.unref()},f=()=>{let E=I+A-Date.now();if(E>0){let D=this.cronTime.getTimeout();if(D>E)D=E;L+=D}if(L){if(L>H)L-=H,A=H;else A=L,L=0;$(A)}else{if(this.lastExecution=new Date,this._isActive=!1,!this.runOnce)this.start();this.fireOnTick()}};if(A>=0){if(this._isActive=!0,A>H)L=A-H,A=H;$(A)}else this.stop()}lastDate(){return this.lastExecution}_executeOnComplete(){return xM(this,void 0,void 0,function*(){if(typeof this.onComplete!=="function")return;try{yield this.onComplete.call(this.context)}catch(H){console.error("[Cron] error in onComplete callback:",H)}})}_waitForJobCompletion(){return xM(this,void 0,void 0,function*(){while(this._isCallbackRunning)yield new Promise((H)=>setTimeout(H,100))})}stop(){if(this._timeout)clearTimeout(this._timeout);if(this._isActive=!1,!this.waitForCompletion){this._executeOnComplete();return}Promise.resolve().then(()=>xM(this,void 0,void 0,function*(){yield this._waitForJobCompletion(),yield this._executeOnComplete()}))}}cf.CronJob=sE});var Dt=Q((CM)=>{Object.defineProperty(CM,"__esModule",{value:!0});CM.validateCronExpression=CM.timeout=CM.sendAt=CM.CronTime=CM.CronJob=void 0;var Et=cM(),C4=Tx();Object.defineProperty(CM,"CronJob",{enumerable:!0,get:function(){return C4.CronJob}});var T4=cM();Object.defineProperty(CM,"CronTime",{enumerable:!0,get:function(){return T4.CronTime}});var G4=(H)=>new Et.CronTime(H).sendAt();CM.sendAt=G4;var F4=(H)=>new Et.CronTime(H).getTimeout();CM.timeout=F4;CM.validateCronExpression=Et.CronTime.validateCronExpression});var BC=Q((pIH,Pt)=>{Pt.exports=nC;Pt.exports.preferredCharsets=nC;var v4=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function a4(H){var A=H.split(",");for(var L=0,I=0;L<A.length;L++){var $=l4(A[L].trim(),L);if($)A[I++]=$}return A.length=I,A}function l4(H,A){var L=v4.exec(H);if(!L)return null;var I=L[1],$=1;if(L[2]){var f=L[2].split(";");for(var E=0;E<f.length;E++){var D=f[E].trim().split("=");if(D[0]==="q"){$=parseFloat(D[1]);break}}}return{charset:I,q:$,i:A}}function O4(H,A,L){var I={o:-1,q:0,s:0};for(var $=0;$<A.length;$++){var f=s4(H,A[$],L);if(f&&(I.s-f.s||I.q-f.q||I.o-f.o)<0)I=f}return I}function s4(H,A,L){var I=0;if(A.charset.toLowerCase()===H.toLowerCase())I|=1;else if(A.charset!=="*")return null;return{i:L,o:A.i,q:A.q,s:I}}function nC(H,A){var L=a4(H===void 0?"*":H||"");if(!A)return L.filter(pC).sort(iC).map(N4);var I=A.map(function $(f,E){return O4(f,L,E)});return I.filter(pC).sort(iC).map(function $(f){return A[I.indexOf(f)]})}function iC(H,A){return A.q-H.q||A.s-H.s||H.o-A.o||H.i-A.i||0}function N4(H){return H.charset}function pC(H){return H.q>0}});var TC=Q((nIH,Xt)=>{Xt.exports=CC;Xt.exports.preferredEncodings=CC;var y4=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function R4(H){var A=H.split(","),L=!1,I=1;for(var $=0,f=0;$<A.length;$++){var E=Y4(A[$].trim(),$);if(E)A[f++]=E,L=L||UC("identity",E),I=Math.min(I,E.q||1)}if(!L)A[f++]={encoding:"identity",q:I,i:$};return A.length=f,A}function Y4(H,A){var L=y4.exec(H);if(!L)return null;var I=L[1],$=1;if(L[2]){var f=L[2].split(";");for(var E=0;E<f.length;E++){var D=f[E].trim().split("=");if(D[0]==="q"){$=parseFloat(D[1]);break}}}return{encoding:I,q:$,i:A}}function Q4(H,A,L){var I={o:-1,q:0,s:0};for(var $=0;$<A.length;$++){var f=UC(H,A[$],L);if(f&&(I.s-f.s||I.q-f.q||I.o-f.o)<0)I=f}return I}function UC(H,A,L){var I=0;if(A.encoding.toLowerCase()===H.toLowerCase())I|=1;else if(A.encoding!=="*")return null;return{i:L,o:A.i,q:A.q,s:I}}function CC(H,A){var L=R4(H||"");if(!A)return L.filter(xC).sort(cC).map(z4);var I=A.map(function $(f,E){return Q4(f,L,E)});return I.filter(xC).sort(cC).map(function $(f){return A[I.indexOf(f)]})}function cC(H,A){return A.q-H.q||A.s-H.s||H.o-A.o||H.i-A.i||0}function z4(H){return H.encoding}function xC(H){return H.q>0}});var mC=Q((BIH,St)=>{St.exports=WC;St.exports.preferredLanguages=WC;var b4=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function Z4(H){var A=H.split(",");for(var L=0,I=0;L<A.length;L++){var $=_C(A[L].trim(),L);if($)A[I++]=$}return A.length=I,A}function _C(H,A){var L=b4.exec(H);if(!L)return null;var I=L[1],$=L[2],f=I;if($)f+="-"+$;var E=1;if(L[3]){var D=L[3].split(";");for(var M=0;M<D.length;M++){var o=D[M].split("=");if(o[0]==="q")E=parseFloat(o[1])}}return{prefix:I,suffix:$,q:E,i:A,full:f}}function h4(H,A,L){var I={o:-1,q:0,s:0};for(var $=0;$<A.length;$++){var f=r4(H,A[$],L);if(f&&(I.s-f.s||I.q-f.q||I.o-f.o)<0)I=f}return I}function r4(H,A,L){var I=_C(H);if(!I)return null;var $=0;if(A.full.toLowerCase()===I.full.toLowerCase())$|=4;else if(A.prefix.toLowerCase()===I.full.toLowerCase())$|=2;else if(A.full.toLowerCase()===I.prefix.toLowerCase())$|=1;else if(A.full!=="*")return null;return{i:L,o:A.i,q:A.q,s:$}}function WC(H,A){var L=Z4(H===void 0?"*":H||"");if(!A)return L.filter(FC).sort(GC).map(j4);var I=A.map(function $(f,E){return h4(f,L,E)});return I.filter(FC).sort(GC).map(function $(f){return A[I.indexOf(f)]})}function GC(H,A){return A.q-H.q||A.s-H.s||H.o-A.o||H.i-A.i||0}function j4(H){return H.full}function FC(H){return H.q>0}});var wC=Q((cIH,Jt)=>{Jt.exports=JC;Jt.exports.preferredMediaTypes=JC;var k4=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function d4(H){var A=AV(H);for(var L=0,I=0;L<A.length;L++){var $=SC(A[L].trim(),L);if($)A[I++]=$}return A.length=I,A}function SC(H,A){var L=k4.exec(H);if(!L)return null;var I=Object.create(null),$=1,f=L[2],E=L[1];if(L[3]){var D=LV(L[3]).map(HV);for(var M=0;M<D.length;M++){var o=D[M],u=o[0].toLowerCase(),t=o[1],i=t&&t[0]==='"'&&t[t.length-1]==='"'?t.substr(1,t.length-2):t;if(u==="q"){$=parseFloat(i);break}I[u]=i}}return{type:E,subtype:f,params:I,q:$,i:A}}function q4(H,A,L){var I={o:-1,q:0,s:0};for(var $=0;$<A.length;$++){var f=g4(H,A[$],L);if(f&&(I.s-f.s||I.q-f.q||I.o-f.o)<0)I=f}return I}function g4(H,A,L){var I=SC(H),$=0;if(!I)return null;if(A.type.toLowerCase()==I.type.toLowerCase())$|=4;else if(A.type!="*")return null;if(A.subtype.toLowerCase()==I.subtype.toLowerCase())$|=2;else if(A.subtype!="*")return null;var f=Object.keys(A.params);if(f.length>0)if(f.every(function(E){return A.params[E]=="*"||(A.params[E]||"").toLowerCase()==(I.params[E]||"").toLowerCase()}))$|=1;else return null;return{i:L,o:A.i,q:A.q,s:$}}function JC(H,A){var L=d4(H===void 0?"*/*":H||"");if(!A)return L.filter(XC).sort(PC).map(e4);var I=A.map(function $(f,E){return q4(f,L,E)});return I.filter(XC).sort(PC).map(function $(f){return A[I.indexOf(f)]})}function PC(H,A){return A.q-H.q||A.s-H.s||H.o-A.o||H.i-A.i||0}function e4(H){return H.type+"/"+H.subtype}function XC(H){return H.q>0}function VC(H){var A=0,L=0;while((L=H.indexOf('"',L))!==-1)A++,L++;return A}function HV(H){var A=H.indexOf("="),L,I;if(A===-1)L=H;else L=H.substr(0,A),I=H.substr(A+1);return[L,I]}function AV(H){var A=H.split(",");for(var L=1,I=0;L<A.length;L++)if(VC(A[I])%2==0)A[++I]=A[L];else A[I]+=","+A[L];return A.length=I+1,A}function LV(H){var A=H.split(";");for(var L=1,I=0;L<A.length;L++)if(VC(A[I])%2==0)A[++I]=A[L];else A[I]+=";"+A[L];A.length=I+1;for(var L=0;L<A.length;L++)A[L]=A[L].trim();return A}});var KC=Q((xIH,Vt)=>{/*!
5
+ Time Zone: ${(p=o===null||o===void 0?void 0:o.toString())!==null&&p!==void 0?p:'""'} - Cron String: ${this.source.toString()} - UTC offset: ${c.offset} - current Date: ${xn.DateTime.local().toString()}`);if(!(c.month in this.month)&&Object.keys(this.month).length!==12){c=c.plus({month:1}),c=c.set({day:1,hour:0,minute:0,second:0});continue}if(!(c.day in this.dayOfMonth)&&Object.keys(this.dayOfMonth).length!==31&&!((this._getWeekDay(c)in this.dayOfWeek)&&Object.keys(this.dayOfWeek).length!==7)||!(this._getWeekDay(c)in this.dayOfWeek)&&Object.keys(this.dayOfWeek).length!==7&&!((c.day in this.dayOfMonth)&&Object.keys(this.dayOfMonth).length!==31)){c=c.plus({days:1}),c=c.set({hour:0,minute:0,second:0});continue}if(!(c.hour in this.hour)&&Object.keys(this.hour).length!==24){c=c.plus({hour:1}),c=c.set({minute:0,second:0});continue}if(!(c.minute in this.minute)&&Object.keys(this.minute).length!==60){c=c.plus({minute:1}),c=c.set({second:0});continue}if(c.toMillis()===x||!(c.second in this.second)&&Object.keys(this.second).length!==60){c=c.plus({second:1});continue}break}let{hour:m,minute:f}=c;c=xn.DateTime.fromFormat(`${c.year}-${c.month}-${c.day} ${c.hour}:${c.minute}:${c.second}`,"yyyy-M-d H:m:s",{zone:o});let F=xn.DateTime.fromFormat(`${c.year}-1-1 0:0:0`,"yyyy-M-d H:m:s",{zone:o});if((m!==c.hour||f!==c.minute)&&F.offset!==c.offset){while(c.minus({minute:1}).offset!==F.offset)c=c.minus({minute:1});return c}let $=c.minus({hour:1}),J=c.minus({hour:2});if(($.hour===c.hour||J.hour===$.hour)&&$>i)c=$;let A=c.minus({minute:30});if((A.minute===c.minute||$.minute===A.minute)&&A>i)c=A;return c}_wcOrAll(i){if(this._hasAll(i))return"*";let o=[];for(let n in this[i])o.push(n);return o.join(",")}_hasAll(i){let o=Lo.CONSTRAINTS[i],n=o[0],p=i===Lo.TIME_UNITS_MAP.DAY_OF_WEEK?o[1]-1:o[1];for(let c=n,x=p;c<x;c++)if(!(c in this[i]))return!1;return!0}_parse(i){var o;if(i=i.toLowerCase(),Object.keys(Lo.PRESETS).includes(i))i=Lo.PRESETS[i];i=i.replace(/[a-z]{1,3}/gi,(c)=>{if(Object.keys(Lo.ALIASES).includes(c))return Lo.ALIASES[c].toString();throw new to.CronError(`Unknown alias: ${c}`)});let n=i.trim().split(/\s+/);if(n.length<Lo.TIME_UNITS_LEN-1)throw new to.CronError("Too few fields");if(n.length>Lo.TIME_UNITS_LEN)throw new to.CronError("Too many fields");let p=n.length;for(let c of Lo.TIME_UNITS){let x=Lo.TIME_UNITS.indexOf(c),T=(o=n[x-(Lo.TIME_UNITS_LEN-p)])!==null&&o!==void 0?o:Lo.PARSE_DEFAULTS[c];this._parseField(T,c)}}_parseField(i,o){let n=this[o],p,c=Lo.CONSTRAINTS[o],x=c[0],T=c[1];i.split(",").forEach((F)=>{let $=F.indexOf("*");if($!==-1&&$!==0)throw new to.CronError(`Field (${F}) has an invalid wildcard expression`)}),i=i.replace(Lo.RE_WILDCARDS,`${x}-${T}`);let f=i.split(",");for(let F of f){let $=[...F.matchAll(Lo.RE_RANGE)][0];if(($===null||$===void 0?void 0:$[1])!==void 0){let[,J,A,X]=$,Y=parseInt(J,10),R=A!==void 0?parseInt(A,10):void 0,K=X!==void 0,U=parseInt(X!==null&&X!==void 0?X:"1",10);if(U===0)throw new to.CronError(`Field (${o}) has a step of zero`);if(R!==void 0&&Y>R)throw new to.CronError(`Field (${o}) has an invalid range`);if(Y<x||R!==void 0&&R>T||R===void 0&&Y>T)throw new to.CronError(`Field value (${i}) is out of range`);if(Y=Math.min(Math.max(x,~~Math.abs(Y)),T),R!==void 0)R=Math.min(T,~~Math.abs(R));else R=K?T:Y;p=Y;do n[p]=!0,p+=U;while(p<=R);if(o==="dayOfWeek"){if(!n[0]&&!!n[7])n[0]=n[7];delete n[7]}}else throw new to.CronError(`Field (${o}) cannot be parsed`)}}}m3.CronTime=eF});var $3=P((wx)=>{var w0=wx&&wx.__awaiter||function(i,o,n,p){function c(x){return x instanceof n?x:new n(function(T){T(x)})}return new(n||(n=Promise))(function(x,T){function m($){try{F(p.next($))}catch(J){T(J)}}function f($){try{F(p.throw($))}catch(J){T(J)}}function F($){$.done?x($.value):c($.value).then(m,f)}F((p=p.apply(i,o||[])).next())})};Object.defineProperty(wx,"__esModule",{value:!0});wx.CronJob=void 0;var F3=Hi("child_process"),i$=rF(),X0=v0();class yT{get isActive(){return this._isActive}get isCallbackRunning(){return this._isCallbackRunning}constructor(i,o,n,p,c,x,T,m,f,F,$){if(this.unrefTimeout=!1,this.lastExecution=null,this.runOnce=!1,this.waitForCompletion=!1,this._isActive=!1,this._isCallbackRunning=!1,this._callbacks=[],this.context=x!==null&&x!==void 0?x:this,this.waitForCompletion=Boolean(F),this.errorHandler=$,c!=null&&m!=null)throw new i$.ExclusiveParametersError("timeZone","utcOffset");if(c!=null)this.cronTime=new X0.CronTime(i,c,null);else if(m!=null)this.cronTime=new X0.CronTime(i,null,m);else this.cronTime=new X0.CronTime(i,c,m);if(f!=null)this.unrefTimeout=f;if(n!=null)this.onComplete=this._fnWrap(n);if(this.cronTime.realDate)this.runOnce=!0;if(this.addCallback(this._fnWrap(o)),T)this.lastExecution=new Date,this.fireOnTick();if(p)this.start()}static from(i){if(i.timeZone!=null&&i.utcOffset!=null)throw new i$.ExclusiveParametersError("timeZone","utcOffset");if(i.timeZone!=null)return new yT(i.cronTime,i.onTick,i.onComplete,i.start,i.timeZone,i.context,i.runOnInit,i.utcOffset,i.unrefTimeout,i.waitForCompletion,i.errorHandler);else if(i.utcOffset!=null)return new yT(i.cronTime,i.onTick,i.onComplete,i.start,null,i.context,i.runOnInit,i.utcOffset,i.unrefTimeout,i.waitForCompletion,i.errorHandler);else return new yT(i.cronTime,i.onTick,i.onComplete,i.start,i.timeZone,i.context,i.runOnInit,i.utcOffset,i.unrefTimeout,i.waitForCompletion,i.errorHandler)}_fnWrap(i){var o,n;switch(typeof i){case"function":return i;case"string":{let[p,...c]=i.split(" ");return F3.spawn.bind(void 0,p!==null&&p!==void 0?p:i,c,{})}case"object":return F3.spawn.bind(void 0,i.command,(o=i.args)!==null&&o!==void 0?o:[],(n=i.options)!==null&&n!==void 0?n:{})}}addCallback(i){if(typeof i==="function")this._callbacks.push(i)}setTime(i){if(!(i instanceof X0.CronTime))throw new i$.CronError("time must be an instance of CronTime.");let o=this._isActive;if(this.stop(),this.cronTime=i,i.realDate)this.runOnce=!0;if(o)this.start()}nextDate(){return this.cronTime.sendAt()}fireOnTick(){return w0(this,void 0,void 0,function*(){if(this.waitForCompletion&&this._isCallbackRunning)return;this._isCallbackRunning=!0;try{for(let i of this._callbacks){let o=i.call(this.context,this.onComplete);if(this.waitForCompletion)yield o}}catch(i){if(this.errorHandler!=null)this.errorHandler(i);else console.error("[Cron] error in callback",i)}finally{this._isCallbackRunning=!1}})}nextDates(i){return this.cronTime.sendAt(i!==null&&i!==void 0?i:0)}start(){if(this._isActive)return;let i=2147483647,o=this.cronTime.getTimeout(),n=0,p,c=(T)=>{if(p=Date.now(),this._timeout=setTimeout(x,T),this.unrefTimeout&&typeof this._timeout.unref==="function")this._timeout.unref()},x=()=>{let T=p+o-Date.now();if(T>0){let m=this.cronTime.getTimeout();if(m>T)m=T;n+=m}if(n){if(n>i)n-=i,o=i;else o=n,n=0;c(o)}else{if(this.lastExecution=new Date,this._isActive=!1,!this.runOnce)this.start();this.fireOnTick()}};if(o>=0){if(this._isActive=!0,o>i)n=o-i,o=i;c(o)}else this.stop()}lastDate(){return this.lastExecution}_executeOnComplete(){return w0(this,void 0,void 0,function*(){if(typeof this.onComplete!=="function")return;try{yield this.onComplete.call(this.context)}catch(i){console.error("[Cron] error in onComplete callback:",i)}})}_waitForJobCompletion(){return w0(this,void 0,void 0,function*(){while(this._isCallbackRunning)yield new Promise((i)=>setTimeout(i,100))})}stop(){if(this._timeout)clearTimeout(this._timeout);if(this._isActive=!1,!this.waitForCompletion){this._executeOnComplete();return}return Promise.resolve().then(()=>w0(this,void 0,void 0,function*(){yield this._waitForJobCompletion(),yield this._executeOnComplete()}))}}wx.CronJob=yT});var n$=P((W0)=>{Object.defineProperty(W0,"__esModule",{value:!0});W0.validateCronExpression=W0.timeout=W0.sendAt=W0.CronTime=W0.CronJob=void 0;var o$=v0(),aM=$3();Object.defineProperty(W0,"CronJob",{enumerable:!0,get:function(){return aM.CronJob}});var lM=v0();Object.defineProperty(W0,"CronTime",{enumerable:!0,get:function(){return lM.CronTime}});var qM=(i)=>new o$.CronTime(i).sendAt();W0.sendAt=qM;var kM=(i)=>new o$.CronTime(i).getTimeout();W0.timeout=kM;W0.validateCronExpression=o$.CronTime.validateCronExpression});var xW=P((Sni,H$)=>{H$.exports=cW;H$.exports.preferredCharsets=cW;var pz=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function cz(i){var o=i.split(",");for(var n=0,p=0;n<o.length;n++){var c=xz(o[n].trim(),n);if(c)o[p++]=c}return o.length=p,o}function xz(i,o){var n=pz.exec(i);if(!n)return null;var p=n[1],c=1;if(n[2]){var x=n[2].split(";");for(var T=0;T<x.length;T++){var m=x[T].trim().split("=");if(m[0]==="q"){c=parseFloat(m[1]);break}}}return{charset:p,q:c,i:o}}function Tz(i,o,n){var p={o:-1,q:0,s:0};for(var c=0;c<o.length;c++){var x=mz(i,o[c],n);if(x&&(p.s-x.s||p.q-x.q||p.o-x.o)<0)p=x}return p}function mz(i,o,n){var p=0;if(o.charset.toLowerCase()===i.toLowerCase())p|=1;else if(o.charset!=="*")return null;return{i:n,o:o.i,q:o.q,s:p}}function cW(i,o){var n=cz(i===void 0?"*":i||"");if(!o)return n.filter(pW).sort(nW).map(fz);var p=o.map(function c(x,T){return Tz(x,n,T)});return p.filter(pW).sort(nW).map(function c(x){return o[p.indexOf(x)]})}function nW(i,o){return o.q-i.q||o.s-i.s||i.o-o.o||i.i-o.i||0}function fz(i){return i.charset}function pW(i){return i.q>0}});var $W=P((Eni,U$)=>{U$.exports=FW;U$.exports.preferredEncodings=FW;var Fz=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function $z(i){var o=i.split(","),n=!1,p=1;for(var c=0,x=0;c<o.length;c++){var T=Jz(o[c].trim(),c);if(T)o[x++]=T,n=n||fW("identity",T),p=Math.min(p,T.q||1)}if(!n)o[x++]={encoding:"identity",q:p,i:c};return o.length=x,o}function Jz(i,o){var n=Fz.exec(i);if(!n)return null;var p=n[1],c=1;if(n[2]){var x=n[2].split(";");for(var T=0;T<x.length;T++){var m=x[T].trim().split("=");if(m[0]==="q"){c=parseFloat(m[1]);break}}}return{encoding:p,q:c,i:o}}function Az(i,o,n){var p={o:-1,q:0,s:0};for(var c=0;c<o.length;c++){var x=fW(i,o[c],n);if(x&&(p.s-x.s||p.q-x.q||p.o-x.o)<0)p=x}return p}function fW(i,o,n){var p=0;if(o.encoding.toLowerCase()===i.toLowerCase())p|=1;else if(o.encoding!=="*")return null;return{i:n,o:o.i,q:o.q,s:p}}function FW(i,o){var n=$z(i||"");if(!o)return n.filter(mW).sort(TW).map(vz);var p=o.map(function c(x,T){return Az(x,n,T)});return p.filter(mW).sort(TW).map(function c(x){return o[p.indexOf(x)]})}function TW(i,o){return o.q-i.q||o.s-i.s||i.o-o.o||i.i-o.i||0}function vz(i){return i.encoding}function mW(i){return i.q>0}});var XW=P((Oni,Z$)=>{Z$.exports=wW;Z$.exports.preferredLanguages=wW;var wz=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function Xz(i){var o=i.split(",");for(var n=0,p=0;n<o.length;n++){var c=vW(o[n].trim(),n);if(c)o[p++]=c}return o.length=p,o}function vW(i,o){var n=wz.exec(i);if(!n)return null;var p=n[1],c=n[2],x=p;if(c)x+="-"+c;var T=1;if(n[3]){var m=n[3].split(";");for(var f=0;f<m.length;f++){var F=m[f].split("=");if(F[0]==="q")T=parseFloat(F[1])}}return{prefix:p,suffix:c,q:T,i:o,full:x}}function Wz(i,o,n){var p={o:-1,q:0,s:0};for(var c=0;c<o.length;c++){var x=Rz(i,o[c],n);if(x&&(p.s-x.s||p.q-x.q||p.o-x.o)<0)p=x}return p}function Rz(i,o,n){var p=vW(i);if(!p)return null;var c=0;if(o.full.toLowerCase()===p.full.toLowerCase())c|=4;else if(o.prefix.toLowerCase()===p.full.toLowerCase())c|=2;else if(o.full.toLowerCase()===p.prefix.toLowerCase())c|=1;else if(o.full!=="*")return null;return{i:n,o:o.i,q:o.q,s:c}}function wW(i,o){var n=Xz(i===void 0?"*":i||"");if(!o)return n.filter(AW).sort(JW).map(Yz);var p=o.map(function c(x,T){return Wz(x,n,T)});return p.filter(AW).sort(JW).map(function c(x){return o[p.indexOf(x)]})}function JW(i,o){return o.q-i.q||o.s-i.s||i.o-o.o||i.i-o.i||0}function Yz(i){return i.full}function AW(i){return i.q>0}});var HW=P((_ni,M$)=>{M$.exports=GW;M$.exports.preferredMediaTypes=GW;var Gz=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function Kz(i){var o=zz(i);for(var n=0,p=0;n<o.length;n++){var c=YW(o[n].trim(),n);if(c)o[p++]=c}return o.length=p,o}function YW(i,o){var n=Gz.exec(i);if(!n)return null;var p=Object.create(null),c=1,x=n[2],T=n[1];if(n[3]){var m=uz(n[3]).map(Mz);for(var f=0;f<m.length;f++){var F=m[f],$=F[0].toLowerCase(),J=F[1],A=J&&J[0]==='"'&&J[J.length-1]==='"'?J.substr(1,J.length-2):J;if($==="q"){c=parseFloat(A);break}p[$]=A}}return{type:T,subtype:x,params:p,q:c,i:o}}function Hz(i,o,n){var p={o:-1,q:0,s:0};for(var c=0;c<o.length;c++){var x=Uz(i,o[c],n);if(x&&(p.s-x.s||p.q-x.q||p.o-x.o)<0)p=x}return p}function Uz(i,o,n){var p=YW(i),c=0;if(!p)return null;if(o.type.toLowerCase()==p.type.toLowerCase())c|=4;else if(o.type!="*")return null;if(o.subtype.toLowerCase()==p.subtype.toLowerCase())c|=2;else if(o.subtype!="*")return null;var x=Object.keys(o.params);if(x.length>0)if(x.every(function(T){return o.params[T]=="*"||(o.params[T]||"").toLowerCase()==(p.params[T]||"").toLowerCase()}))c|=1;else return null;return{i:n,o:o.i,q:o.q,s:c}}function GW(i,o){var n=Kz(i===void 0?"*/*":i||"");if(!o)return n.filter(RW).sort(WW).map(Zz);var p=o.map(function c(x,T){return Hz(x,n,T)});return p.filter(RW).sort(WW).map(function c(x){return o[p.indexOf(x)]})}function WW(i,o){return o.q-i.q||o.s-i.s||i.o-o.o||i.i-o.i||0}function Zz(i){return i.type+"/"+i.subtype}function RW(i){return i.q>0}function KW(i){var o=0,n=0;while((n=i.indexOf('"',n))!==-1)o++,n++;return o}function Mz(i){var o=i.indexOf("="),n,p;if(o===-1)n=i;else n=i.substr(0,o),p=i.substr(o+1);return[n,p]}function zz(i){var o=i.split(",");for(var n=1,p=0;n<o.length;n++)if(KW(o[p])%2==0)o[++p]=o[n];else o[p]+=","+o[n];return o.length=p+1,o}function uz(i){var o=i.split(";");for(var n=1,p=0;n<o.length;n++)if(KW(o[p])%2==0)o[++p]=o[n];else o[p]+=";"+o[n];o.length=p+1;for(var n=0;n<o.length;n++)o[n]=o[n].trim();return o}});var UW=P((Lni,z$)=>{/*!
6
6
  * negotiator
7
7
  * Copyright(c) 2012 Federico Romero
8
8
  * Copyright(c) 2012-2014 Isaac Z. Schlueter
9
9
  * Copyright(c) 2015 Douglas Christopher Wilson
10
10
  * MIT Licensed
11
- */var IV=BC(),$V=TC(),fV=mC(),EV=wC();Vt.exports=SH;Vt.exports.Negotiator=SH;function SH(H){if(!(this instanceof SH))return new SH(H);this.request=H}SH.prototype.charset=function H(A){var L=this.charsets(A);return L&&L[0]};SH.prototype.charsets=function H(A){return IV(this.request.headers["accept-charset"],A)};SH.prototype.encoding=function H(A){var L=this.encodings(A);return L&&L[0]};SH.prototype.encodings=function H(A){return $V(this.request.headers["accept-encoding"],A)};SH.prototype.language=function H(A){var L=this.languages(A);return L&&L[0]};SH.prototype.languages=function H(A){return fV(this.request.headers["accept-language"],A)};SH.prototype.mediaType=function H(A){var L=this.mediaTypes(A);return L&&L[0]};SH.prototype.mediaTypes=function H(A){return EV(this.request.headers.accept,A)};SH.prototype.preferredCharset=SH.prototype.charset;SH.prototype.preferredCharsets=SH.prototype.charsets;SH.prototype.preferredEncoding=SH.prototype.encoding;SH.prototype.preferredEncodings=SH.prototype.encodings;SH.prototype.preferredLanguage=SH.prototype.language;SH.prototype.preferredLanguages=SH.prototype.languages;SH.prototype.preferredMediaType=SH.prototype.mediaType;SH.prototype.preferredMediaTypes=SH.prototype.mediaTypes});var vC=Q((UIH,DV)=>{DV.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}});var lC=Q((CIH,aC)=>{/*!
11
+ */var Qz=xW(),Vz=$W(),Sz=XW(),Ez=HW();z$.exports=Qi;z$.exports.Negotiator=Qi;function Qi(i){if(!(this instanceof Qi))return new Qi(i);this.request=i}Qi.prototype.charset=function i(o){var n=this.charsets(o);return n&&n[0]};Qi.prototype.charsets=function i(o){return Qz(this.request.headers["accept-charset"],o)};Qi.prototype.encoding=function i(o){var n=this.encodings(o);return n&&n[0]};Qi.prototype.encodings=function i(o){return Vz(this.request.headers["accept-encoding"],o)};Qi.prototype.language=function i(o){var n=this.languages(o);return n&&n[0]};Qi.prototype.languages=function i(o){return Sz(this.request.headers["accept-language"],o)};Qi.prototype.mediaType=function i(o){var n=this.mediaTypes(o);return n&&n[0]};Qi.prototype.mediaTypes=function i(o){return Ez(this.request.headers.accept,o)};Qi.prototype.preferredCharset=Qi.prototype.charset;Qi.prototype.preferredCharsets=Qi.prototype.charsets;Qi.prototype.preferredEncoding=Qi.prototype.encoding;Qi.prototype.preferredEncodings=Qi.prototype.encodings;Qi.prototype.preferredLanguage=Qi.prototype.language;Qi.prototype.preferredLanguages=Qi.prototype.languages;Qi.prototype.preferredMediaType=Qi.prototype.mediaType;Qi.prototype.preferredMediaTypes=Qi.prototype.mediaTypes});var ZW=P((Cni,Oz)=>{Oz.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}});var zW=P((yni,MW)=>{/*!
12
12
  * mime-db
13
13
  * Copyright(c) 2014 Jonathan Ong
14
14
  * Copyright(c) 2015-2022 Douglas Christopher Wilson
15
15
  * MIT Licensed
16
- */aC.exports=vC()});var RC=Q((nV)=>{/*!
16
+ */MW.exports=ZW()});var EW=P((Bz)=>{/*!
17
17
  * mime-types
18
18
  * Copyright(c) 2014 Jonathan Ong
19
19
  * Copyright(c) 2015 Douglas Christopher Wilson
20
20
  * MIT Licensed
21
- */var RM=lC(),MV=O("path").extname,OC=/^\s*([^;\s]*)(?:;|\s|$)/,oV=/^text\//i;nV.charset=sC;nV.charsets={lookup:sC};nV.contentType=uV;nV.extension=tV;nV.extensions=Object.create(null);nV.lookup=iV;nV.types=Object.create(null);pV(nV.extensions,nV.types);function sC(H){if(!H||typeof H!=="string")return!1;var A=OC.exec(H),L=A&&RM[A[1].toLowerCase()];if(L&&L.charset)return L.charset;if(A&&oV.test(A[1]))return"UTF-8";return!1}function uV(H){if(!H||typeof H!=="string")return!1;var A=H.indexOf("/")===-1?nV.lookup(H):H;if(!A)return!1;if(A.indexOf("charset")===-1){var L=nV.charset(A);if(L)A+="; charset="+L.toLowerCase()}return A}function tV(H){if(!H||typeof H!=="string")return!1;var A=OC.exec(H),L=A&&nV.extensions[A[1].toLowerCase()];if(!L||!L.length)return!1;return L[0]}function iV(H){if(!H||typeof H!=="string")return!1;var A=MV("x."+H).toLowerCase().substr(1);if(!A)return!1;return nV.types[A]||!1}function pV(H,A){var L=["nginx","apache",void 0,"iana"];Object.keys(RM).forEach(function I($){var f=RM[$],E=f.extensions;if(!E||!E.length)return;H[$]=E;for(var D=0;D<E.length;D++){var M=E[D];if(A[M]){var o=L.indexOf(RM[A[M]].source),u=L.indexOf(f.source);if(A[M]!=="application/octet-stream"&&(o>u||o===u&&A[M].substr(0,12)==="application/"))continue}A[M]=$}})}});var YM=Q((GIH,YC)=>{/*!
21
+ */var I0=zW(),_z=Hi("path").extname,uW=/^\s*([^;\s]*)(?:;|\s|$)/,Lz=/^text\//i;Bz.charset=QW;Bz.charsets={lookup:QW};Bz.contentType=Cz;Bz.extension=yz;Bz.extensions=Object.create(null);Bz.lookup=Dz;Bz.types=Object.create(null);Iz(Bz.extensions,Bz.types);function QW(i){if(!i||typeof i!=="string")return!1;var o=uW.exec(i),n=o&&I0[o[1].toLowerCase()];if(n&&n.charset)return n.charset;if(o&&Lz.test(o[1]))return"UTF-8";return!1}function Cz(i){if(!i||typeof i!=="string")return!1;var o=i.indexOf("/")===-1?Bz.lookup(i):i;if(!o)return!1;if(o.indexOf("charset")===-1){var n=Bz.charset(o);if(n)o+="; charset="+n.toLowerCase()}return o}function yz(i){if(!i||typeof i!=="string")return!1;var o=uW.exec(i),n=o&&Bz.extensions[o[1].toLowerCase()];if(!n||!n.length)return!1;return n[0]}function Dz(i){if(!i||typeof i!=="string")return!1;var o=_z("x."+i).toLowerCase().substr(1);if(!o)return!1;return Bz.types[o]||!1}function Iz(i,o){var n=["nginx","apache",void 0,"iana"];Object.keys(I0).forEach(function p(c){var x=I0[c],T=x.extensions;if(!T||!T.length)return;i[c]=T;for(var m=0;m<T.length;m++){var f=T[m];if(o[f]){var F=n.indexOf(I0[o[f]].source),$=n.indexOf(x.source);if(o[f]!=="application/octet-stream"&&(F>$||F===$&&o[f].substr(0,12)==="application/"))continue}o[f]=c}})}});var B0=P((Ini,OW)=>{/*!
22
22
  * accepts
23
23
  * Copyright(c) 2014 Jonathan Ong
24
24
  * Copyright(c) 2015 Douglas Christopher Wilson
25
25
  * MIT Licensed
26
- */var UV=KC(),CV=RC();YC.exports=ML;function ML(H){if(!(this instanceof ML))return new ML(H);this.headers=H.headers,this.negotiator=new UV(H)}ML.prototype.type=ML.prototype.types=function(H){var A=H;if(A&&!Array.isArray(A)){A=new Array(arguments.length);for(var L=0;L<A.length;L++)A[L]=arguments[L]}if(!A||A.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return A[0];var I=A.map(TV),$=this.negotiator.mediaTypes(I.filter(GV)),f=$[0];return f?A[I.indexOf(f)]:!1};ML.prototype.encoding=ML.prototype.encodings=function(H){var A=H;if(A&&!Array.isArray(A)){A=new Array(arguments.length);for(var L=0;L<A.length;L++)A[L]=arguments[L]}if(!A||A.length===0)return this.negotiator.encodings();return this.negotiator.encodings(A)[0]||!1};ML.prototype.charset=ML.prototype.charsets=function(H){var A=H;if(A&&!Array.isArray(A)){A=new Array(arguments.length);for(var L=0;L<A.length;L++)A[L]=arguments[L]}if(!A||A.length===0)return this.negotiator.charsets();return this.negotiator.charsets(A)[0]||!1};ML.prototype.lang=ML.prototype.langs=ML.prototype.language=ML.prototype.languages=function(H){var A=H;if(A&&!Array.isArray(A)){A=new Array(arguments.length);for(var L=0;L<A.length;L++)A[L]=arguments[L]}if(!A||A.length===0)return this.negotiator.languages();return this.negotiator.languages(A)[0]||!1};function TV(H){return H.indexOf("/")===-1?CV.lookup(H):H}function GV(H){return typeof H==="string"}});var at=Q((QC,zC)=>{/*!
26
+ */var Pz=UW(),az=EW();OW.exports=fn;function fn(i){if(!(this instanceof fn))return new fn(i);this.headers=i.headers,this.negotiator=new Pz(i)}fn.prototype.type=fn.prototype.types=function(i){var o=i;if(o&&!Array.isArray(o)){o=new Array(arguments.length);for(var n=0;n<o.length;n++)o[n]=arguments[n]}if(!o||o.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return o[0];var p=o.map(lz),c=this.negotiator.mediaTypes(p.filter(qz)),x=c[0];return x?o[p.indexOf(x)]:!1};fn.prototype.encoding=fn.prototype.encodings=function(i){var o=i;if(o&&!Array.isArray(o)){o=new Array(arguments.length);for(var n=0;n<o.length;n++)o[n]=arguments[n]}if(!o||o.length===0)return this.negotiator.encodings();return this.negotiator.encodings(o)[0]||!1};fn.prototype.charset=fn.prototype.charsets=function(i){var o=i;if(o&&!Array.isArray(o)){o=new Array(arguments.length);for(var n=0;n<o.length;n++)o[n]=arguments[n]}if(!o||o.length===0)return this.negotiator.charsets();return this.negotiator.charsets(o)[0]||!1};fn.prototype.lang=fn.prototype.langs=fn.prototype.language=fn.prototype.languages=function(i){var o=i;if(o&&!Array.isArray(o)){o=new Array(arguments.length);for(var n=0;n<o.length;n++)o[n]=arguments[n]}if(!o||o.length===0)return this.negotiator.languages();return this.negotiator.languages(o)[0]||!1};function lz(i){return i.indexOf("/")===-1?az.lookup(i):i}function qz(i){return typeof i==="string"}});var S$=P((_W,LW)=>{/*!
27
27
  * base64id v0.1.0
28
- */var rE=O("crypto"),vt=function(){};vt.prototype.getRandomBytes=function(H){var A=4096,L=this;if(H=H||12,H>A)return rE.randomBytes(H);var I=parseInt(A/H),$=parseInt(I*0.85);if(!$)return rE.randomBytes(H);if(this.bytesBufferIndex==null)this.bytesBufferIndex=-1;if(this.bytesBufferIndex==I)this.bytesBuffer=null,this.bytesBufferIndex=-1;if(this.bytesBufferIndex==-1||this.bytesBufferIndex>$){if(!this.isGeneratingBytes)this.isGeneratingBytes=!0,rE.randomBytes(A,function(E,D){L.bytesBuffer=D,L.bytesBufferIndex=0,L.isGeneratingBytes=!1});if(this.bytesBufferIndex==-1)return rE.randomBytes(H)}var f=this.bytesBuffer.slice(H*this.bytesBufferIndex,H*(this.bytesBufferIndex+1));return this.bytesBufferIndex++,f};vt.prototype.generateId=function(){var H=Buffer.alloc(15);if(!H.writeInt32BE)return Math.abs(Math.random()*Math.random()*Date.now()|0).toString()+Math.abs(Math.random()*Math.random()*Date.now()|0).toString();if(this.sequenceNumber=this.sequenceNumber+1|0,H.writeInt32BE(this.sequenceNumber,11),rE.randomBytes)this.getRandomBytes(12).copy(H);else[0,4,8].forEach(function(A){H.writeInt32BE(Math.random()*Math.pow(2,32)|0,A)});return H.toString("base64").replace(/\//g,"_").replace(/\+/g,"-")};QC=zC.exports=new vt});var QM=Q((ZC)=>{Object.defineProperty(ZC,"__esModule",{value:!0});ZC.ERROR_PACKET=ZC.PACKET_TYPES_REVERSE=ZC.PACKET_TYPES=void 0;var gL=Object.create(null);ZC.PACKET_TYPES=gL;gL.open="0";gL.close="1";gL.ping="2";gL.pong="3";gL.message="4";gL.upgrade="5";gL.noop="6";var bC=Object.create(null);ZC.PACKET_TYPES_REVERSE=bC;Object.keys(gL).forEach((H)=>{bC[gL[H]]=H});var FV={type:"error",data:"parser error"};ZC.ERROR_PACKET=FV});var kC=Q((jC)=>{Object.defineProperty(jC,"__esModule",{value:!0});jC.encodePacket=void 0;jC.encodePacketToBinary=XV;var mV=QM(),PV=({type:H,data:A},L,I)=>{if(A instanceof ArrayBuffer||ArrayBuffer.isView(A))return I(L?A:"b"+rC(A,!0).toString("base64"));return I(mV.PACKET_TYPES[H]+(A||""))};jC.encodePacket=PV;var rC=(H,A)=>{if(Buffer.isBuffer(H)||H instanceof Uint8Array&&!A)return H;else if(H instanceof ArrayBuffer)return Buffer.from(H);else return Buffer.from(H.buffer,H.byteOffset,H.byteLength)},lt;function XV(H,A){if(H.data instanceof ArrayBuffer||ArrayBuffer.isView(H.data))return A(rC(H.data,!1));jC.encodePacket(H,!0,(L)=>{if(!lt)lt=new TextEncoder;A(lt.encode(L))})}});var eC=Q((qC)=>{Object.defineProperty(qC,"__esModule",{value:!0});qC.decodePacket=void 0;var zM=QM(),JV=(H,A)=>{if(typeof H!=="string")return{type:"message",data:dC(H,A)};let L=H.charAt(0);if(L==="b"){let I=Buffer.from(H.substring(1),"base64");return{type:"message",data:dC(I,A)}}if(!zM.PACKET_TYPES_REVERSE[L])return zM.ERROR_PACKET;return H.length>1?{type:zM.PACKET_TYPES_REVERSE[L],data:H.substring(1)}:{type:zM.PACKET_TYPES_REVERSE[L]}};qC.decodePacket=JV;var dC=(H,A)=>{switch(A){case"arraybuffer":if(H instanceof ArrayBuffer)return H;else if(Buffer.isBuffer(H))return H.buffer.slice(H.byteOffset,H.byteOffset+H.byteLength);else return H.buffer;case"nodebuffer":default:if(Buffer.isBuffer(H))return H;else return Buffer.from(H)}}});var jE=Q((hM)=>{Object.defineProperty(hM,"__esModule",{value:!0});hM.decodePayload=hM.decodePacket=hM.encodePayload=hM.encodePacket=hM.protocol=void 0;hM.createPacketEncoderStream=KV;hM.createPacketDecoderStream=vV;var Nt=kC();Object.defineProperty(hM,"encodePacket",{enumerable:!0,get:function(){return Nt.encodePacket}});var yt=eC();Object.defineProperty(hM,"decodePacket",{enumerable:!0,get:function(){return yt.decodePacket}});var HT=QM(),AT=String.fromCharCode(30),VV=(H,A)=>{let L=H.length,I=new Array(L),$=0;H.forEach((f,E)=>{Nt.encodePacket(f,!1,(D)=>{if(I[E]=D,++$===L)A(I.join(AT))})})};hM.encodePayload=VV;var wV=(H,A)=>{let L=H.split(AT),I=[];for(let $=0;$<L.length;$++){let f=yt.decodePacket(L[$],A);if(I.push(f),f.type==="error")break}return I};hM.decodePayload=wV;function KV(){return new TransformStream({transform(H,A){Nt.encodePacketToBinary(H,(L)=>{let I=L.length,$;if(I<126)$=new Uint8Array(1),new DataView($.buffer).setUint8(0,I);else if(I<65536){$=new Uint8Array(3);let f=new DataView($.buffer);f.setUint8(0,126),f.setUint16(1,I)}else{$=new Uint8Array(9);let f=new DataView($.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(I))}if(H.data&&typeof H.data!=="string")$[0]|=128;A.enqueue($),A.enqueue(L)})}})}var st;function bM(H){return H.reduce((A,L)=>A+L.length,0)}function ZM(H,A){if(H[0].length===A)return H.shift();let L=new Uint8Array(A),I=0;for(let $=0;$<A;$++)if(L[$]=H[0][I++],I===H[0].length)H.shift(),I=0;if(H.length&&I<H[0].length)H[0]=H[0].slice(I);return L}function vV(H,A){if(!st)st=new TextDecoder;let L=[],I=0,$=-1,f=!1;return new TransformStream({transform(E,D){L.push(E);while(!0){if(I===0){if(bM(L)<1)break;let M=ZM(L,1);if(f=(M[0]&128)===128,$=M[0]&127,$<126)I=3;else if($===126)I=1;else I=2}else if(I===1){if(bM(L)<2)break;let M=ZM(L,2);$=new DataView(M.buffer,M.byteOffset,M.length).getUint16(0),I=3}else if(I===2){if(bM(L)<8)break;let M=ZM(L,8),o=new DataView(M.buffer,M.byteOffset,M.length),u=o.getUint32(0);if(u>Math.pow(2,21)-1){D.enqueue(HT.ERROR_PACKET);break}$=u*Math.pow(2,32)+o.getUint32(4),I=3}else{if(bM(L)<$)break;let M=ZM(L,$);D.enqueue(yt.decodePacket(f?M:st.decode(M),A)),I=0}if($===0||$>H){D.enqueue(HT.ERROR_PACKET);break}}}})}hM.protocol=4});var ET=Q((SIH,fT)=>{/*! https://mths.be/utf8js v2.1.2 by @mathias */var QI=String.fromCharCode;function IT(H){var A=[],L=0,I=H.length,$,f;while(L<I)if($=H.charCodeAt(L++),$>=55296&&$<=56319&&L<I)if(f=H.charCodeAt(L++),(f&64512)==56320)A.push((($&1023)<<10)+(f&1023)+65536);else A.push($),L--;else A.push($);return A}function NV(H){var A=H.length,L=-1,I,$="";while(++L<A){if(I=H[L],I>65535)I-=65536,$+=QI(I>>>10&1023|55296),I=56320|I&1023;$+=QI(I)}return $}function $T(H,A){if(H>=55296&&H<=57343){if(A)throw Error("Lone surrogate U+"+H.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Rt(H,A){return QI(H>>A&63|128)}function yV(H,A){if((H&4294967168)==0)return QI(H);var L="";if((H&4294965248)==0)L=QI(H>>6&31|192);else if((H&4294901760)==0){if(!$T(H,A))H=65533;L=QI(H>>12&15|224),L+=Rt(H,6)}else if((H&4292870144)==0)L=QI(H>>18&7|240),L+=Rt(H,12),L+=Rt(H,6);return L+=QI(H&63|128),L}function RV(H,A){A=A||{};var L=A.strict!==!1,I=IT(H),$=I.length,f=-1,E,D="";while(++f<$)E=I[f],D+=yV(E,L);return D}function Uf(){if(zI>=jM)throw Error("Invalid byte index");var H=rM[zI]&255;if(zI++,(H&192)==128)return H&63;throw Error("Invalid continuation byte")}function YV(H){var A,L,I,$,f;if(zI>jM)throw Error("Invalid byte index");if(zI==jM)return!1;if(A=rM[zI]&255,zI++,(A&128)==0)return A;if((A&224)==192)if(L=Uf(),f=(A&31)<<6|L,f>=128)return f;else throw Error("Invalid continuation byte");if((A&240)==224)if(L=Uf(),I=Uf(),f=(A&15)<<12|L<<6|I,f>=2048)return $T(f,H)?f:65533;else throw Error("Invalid continuation byte");if((A&248)==240){if(L=Uf(),I=Uf(),$=Uf(),f=(A&7)<<18|L<<12|I<<6|$,f>=65536&&f<=1114111)return f}throw Error("Invalid UTF-8 detected")}var rM,jM,zI;function QV(H,A){A=A||{};var L=A.strict!==!1;rM=IT(H),jM=rM.length,zI=0;var I=[],$;while(($=YV(L))!==!1)I.push($);return NV(I)}fT.exports={version:"2.1.2",encode:RV,decode:QV}});var BT=Q((nT)=>{Object.defineProperty(nT,"__esModule",{value:!0});nT.packets=nT.protocol=void 0;nT.encodePacket=Yt;nT.encodeBase64Packet=oT;nT.decodePacket=Qt;nT.decodeBase64Packet=uT;nT.encodePayload=hV;nT.decodePayload=jV;nT.encodePayloadAsBinary=iT;nT.decodePayloadAsBinary=pT;var MT=ET();nT.protocol=3;var zV=(H)=>{for(let A of H)if(A.data instanceof ArrayBuffer||ArrayBuffer.isView(A.data))return!0;return!1};nT.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6};var Cf=Object.keys(nT.packets),NL={type:"error",data:"parser error"},bV=Buffer.concat([]);function Yt(H,A,L,I){if(typeof A==="function")I=A,A=null;if(typeof L==="function")I=L,L=null;if(Buffer.isBuffer(H.data))return DT(H,A,I);else if(H.data&&(H.data.buffer||H.data)instanceof ArrayBuffer)return DT({type:H.type,data:zt(H.data)},A,I);var $=nT.packets[H.type];if(H.data!==void 0)$+=L?MT.encode(String(H.data),{strict:!1}):String(H.data);return I(""+$)}function DT(H,A,L){if(!A)return oT(H,L);var I=H.data,$=Buffer.allocUnsafe(1);return $[0]=nT.packets[H.type],L(Buffer.concat([$,I]))}function oT(H,A){var L=Buffer.isBuffer(H.data)?H.data:zt(H.data),I="b"+nT.packets[H.type];return I+=L.toString("base64"),A(I)}function Qt(H,A,L){if(H===void 0)return NL;var I;if(typeof H==="string"){if(I=H.charAt(0),I==="b")return uT(H.slice(1),A);if(L){if(H=ZV(H),H===!1)return NL}if(Number(I)!=I||!Cf[I])return NL;if(H.length>1)return{type:Cf[I],data:H.slice(1)};else return{type:Cf[I]}}if(A==="arraybuffer"){var $=new Uint8Array(H);return I=$[0],{type:Cf[I],data:$.buffer.slice(1)}}if(H instanceof ArrayBuffer)H=zt(H);return I=H[0],{type:Cf[I],data:H.slice(1)}}function ZV(H){try{H=MT.decode(H,{strict:!1})}catch(A){return!1}return H}function uT(H,A){var L=Cf[H.charAt(0)],I=Buffer.from(H.slice(1),"base64");if(A==="arraybuffer"){var $=new Uint8Array(I.length);for(var f=0;f<$.length;f++)$[f]=I[f];I=$.buffer}return{type:L,data:I}}function hV(H,A,L){if(typeof A==="function")L=A,A=null;if(A&&zV(H))return iT(H,L);if(!H.length)return L("0:");function I($,f){Yt($,A,!1,function(E){f(null,rV(E))})}tT(H,I,function($,f){return L(f.join(""))})}function rV(H){return H.length+":"+H}function tT(H,A,L){let I=new Array(H.length),$=0;for(let f=0;f<H.length;f++)A(H[f],(E,D)=>{if(I[f]=D,++$===H.length)L(null,I)})}function jV(H,A,L){if(typeof H!=="string")return pT(H,A,L);if(typeof A==="function")L=A,A=null;if(H==="")return L(NL,0,1);var I="",$,f,E;for(var D=0,M=H.length;D<M;D++){var o=H.charAt(D);if(o!==":"){I+=o;continue}if(I===""||I!=($=Number(I)))return L(NL,0,1);if(f=H.slice(D+1,D+1+$),I!=f.length)return L(NL,0,1);if(f.length){if(E=Qt(f,A,!1),NL.type===E.type&&NL.data===E.data)return L(NL,0,1);var u=L(E,D+$,M);if(u===!1)return}D+=$,I=""}if(I!=="")return L(NL,0,1)}function kV(H){var A="";for(var L=0,I=H.length;L<I;L++)A+=String.fromCharCode(H[L]);return A}function dV(H){var A=Buffer.allocUnsafe(H.length);for(var L=0,I=H.length;L<I;L++)A.writeUInt8(H.charCodeAt(L),L);return A}function zt(H){var A=H.byteLength||H.length,L=H.byteOffset||0;return Buffer.from(H.buffer||H,L,A)}function iT(H,A){if(!H.length)return A(bV);tT(H,qV,function(L,I){return A(Buffer.concat(I))})}function qV(H,A){function L(I){var $=""+I.length,f;if(typeof I==="string"){f=Buffer.allocUnsafe($.length+2),f[0]=0;for(var E=0;E<$.length;E++)f[E+1]=parseInt($[E],10);return f[f.length-1]=255,A(null,Buffer.concat([f,dV(I)]))}f=Buffer.allocUnsafe($.length+2),f[0]=1;for(var E=0;E<$.length;E++)f[E+1]=parseInt($[E],10);f[f.length-1]=255,A(null,Buffer.concat([f,I]))}Yt(H,!0,!0,L)}function pT(H,A,L){if(typeof A==="function")L=A,A=null;var I=H,$=[],f;while(I.length>0){var E="",D=I[0]===0;for(f=1;;f++){if(I[f]===255)break;if(E.length>310)return L(NL,0,1);E+=""+I[f]}I=I.slice(E.length+1);var M=parseInt(E,10),o=I.slice(1,M+1);if(D)o=kV(o);$.push(o),I=I.slice(M+1)}var u=$.length;for(f=0;f<u;f++){var t=$[f];L(Qt(t,A,!0),f,u)}}});var xT=Q((VIH,cT)=>{var Gf=1000,Ff=Gf*60,_f=Ff*60,c$=_f*24,Dw=c$*7,Mw=c$*365.25;cT.exports=function(H,A){A=A||{};var L=typeof H;if(L==="string"&&H.length>0)return ow(H);else if(L==="number"&&isFinite(H))return A.long?tw(H):uw(H);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(H))};function ow(H){if(H=String(H),H.length>100)return;var A=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(H);if(!A)return;var L=parseFloat(A[1]),I=(A[2]||"ms").toLowerCase();switch(I){case"years":case"year":case"yrs":case"yr":case"y":return L*Mw;case"weeks":case"week":case"w":return L*Dw;case"days":case"day":case"d":return L*c$;case"hours":case"hour":case"hrs":case"hr":case"h":return L*_f;case"minutes":case"minute":case"mins":case"min":case"m":return L*Ff;case"seconds":case"second":case"secs":case"sec":case"s":return L*Gf;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return L;default:return}}function uw(H){var A=Math.abs(H);if(A>=c$)return Math.round(H/c$)+"d";if(A>=_f)return Math.round(H/_f)+"h";if(A>=Ff)return Math.round(H/Ff)+"m";if(A>=Gf)return Math.round(H/Gf)+"s";return H+"ms"}function tw(H){var A=Math.abs(H);if(A>=c$)return kM(H,A,c$,"day");if(A>=_f)return kM(H,A,_f,"hour");if(A>=Ff)return kM(H,A,Ff,"minute");if(A>=Gf)return kM(H,A,Gf,"second");return H+" ms"}function kM(H,A,L,I){var $=A>=L*1.5;return Math.round(H/L)+" "+I+($?"s":"")}});var bt=Q((wIH,UT)=>{function iw(H){L.debug=L,L.default=L,L.coerce=M,L.disable=f,L.enable=$,L.enabled=E,L.humanize=xT(),L.destroy=o,Object.keys(H).forEach((u)=>{L[u]=H[u]}),L.names=[],L.skips=[],L.formatters={};function A(u){let t=0;for(let i=0;i<u.length;i++)t=(t<<5)-t+u.charCodeAt(i),t|=0;return L.colors[Math.abs(t)%L.colors.length]}L.selectColor=A;function L(u){let t,i=null,B,U;function x(...T){if(!x.enabled)return;let F=x,m=Number(new Date),Y=m-(t||m);if(F.diff=Y,F.prev=t,F.curr=m,t=m,T[0]=L.coerce(T[0]),typeof T[0]!=="string")T.unshift("%O");let W=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(V,J)=>{if(V==="%%")return"%";W++;let a=L.formatters[J];if(typeof a==="function"){let h=T[W];V=a.call(F,h),T.splice(W,1),W--}return V}),L.formatArgs.call(F,T),(F.log||L.log).apply(F,T)}if(x.namespace=u,x.useColors=L.useColors(),x.color=L.selectColor(u),x.extend=I,x.destroy=L.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(i!==null)return i;if(B!==L.namespaces)B=L.namespaces,U=L.enabled(u);return U},set:(T)=>{i=T}}),typeof L.init==="function")L.init(x);return x}function I(u,t){let i=L(this.namespace+(typeof t==="undefined"?":":t)+u);return i.log=this.log,i}function $(u){L.save(u),L.namespaces=u,L.names=[],L.skips=[];let t,i=(typeof u==="string"?u:"").split(/[\s,]+/),B=i.length;for(t=0;t<B;t++){if(!i[t])continue;if(u=i[t].replace(/\*/g,".*?"),u[0]==="-")L.skips.push(new RegExp("^"+u.slice(1)+"$"));else L.names.push(new RegExp("^"+u+"$"))}}function f(){let u=[...L.names.map(D),...L.skips.map(D).map((t)=>"-"+t)].join(",");return L.enable(""),u}function E(u){if(u[u.length-1]==="*")return!0;let t,i;for(t=0,i=L.skips.length;t<i;t++)if(L.skips[t].test(u))return!1;for(t=0,i=L.names.length;t<i;t++)if(L.names[t].test(u))return!0;return!1}function D(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function M(u){if(u instanceof Error)return u.stack||u.message;return u}function o(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return L.enable(L.load()),L}UT.exports=iw});var TT=Q((CT,qM)=>{CT.formatArgs=nw;CT.save=Bw;CT.load=cw;CT.useColors=pw;CT.storage=xw();CT.destroy=(()=>{let H=!1;return()=>{if(!H)H=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();CT.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function pw(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let H;return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&(H=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(H[1],10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function nw(H){if(H[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+H[0]+(this.useColors?"%c ":" ")+"+"+qM.exports.humanize(this.diff),!this.useColors)return;let A="color: "+this.color;H.splice(1,0,A,"color: inherit");let L=0,I=0;H[0].replace(/%[a-zA-Z%]/g,($)=>{if($==="%%")return;if(L++,$==="%c")I=L}),H.splice(I,0,A)}CT.log=console.debug||console.log||(()=>{});function Bw(H){try{if(H)CT.storage.setItem("debug",H);else CT.storage.removeItem("debug")}catch(A){}}function cw(){let H;try{H=CT.storage.getItem("debug")}catch(A){}if(!H&&typeof process!=="undefined"&&"env"in process)H=process.env.DEBUG;return H}function xw(){try{return localStorage}catch(H){}}qM.exports=bt()(CT);var{formatters:Uw}=qM.exports;Uw.j=function(H){try{return JSON.stringify(H)}catch(A){return"[UnexpectedJSONParseError]: "+A.message}}});var FT=Q((vIH,GT)=>{GT.exports=(H,A=process.argv)=>{let L=H.startsWith("-")?"":H.length===1?"-":"--",I=A.indexOf(L+H),$=A.indexOf("--");return I!==-1&&($===-1||I<$)}});var mT=Q((aIH,WT)=>{var Pw=O("os"),_T=O("tty"),_L=FT(),{env:CA}=process,gM;if(_L("no-color")||_L("no-colors")||_L("color=false")||_L("color=never"))gM=0;else if(_L("color")||_L("colors")||_L("color=true")||_L("color=always"))gM=1;function Xw(){if("FORCE_COLOR"in CA){if(CA.FORCE_COLOR==="true")return 1;if(CA.FORCE_COLOR==="false")return 0;return CA.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(CA.FORCE_COLOR,10),3)}}function Sw(H){if(H===0)return!1;return{level:H,hasBasic:!0,has256:H>=2,has16m:H>=3}}function Jw(H,{streamIsTTY:A,sniffFlags:L=!0}={}){let I=Xw();if(I!==void 0)gM=I;let $=L?gM:I;if($===0)return 0;if(L){if(_L("color=16m")||_L("color=full")||_L("color=truecolor"))return 3;if(_L("color=256"))return 2}if(H&&!A&&$===void 0)return 0;let f=$||0;if(CA.TERM==="dumb")return f;if(process.platform==="win32"){let E=Pw.release().split(".");if(Number(E[0])>=10&&Number(E[2])>=10586)return Number(E[2])>=14931?3:2;return 1}if("CI"in CA){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((E)=>(E in CA))||CA.CI_NAME==="codeship")return 1;return f}if("TEAMCITY_VERSION"in CA)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(CA.TEAMCITY_VERSION)?1:0;if(CA.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in CA){let E=Number.parseInt((CA.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(CA.TERM_PROGRAM){case"iTerm.app":return E>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(CA.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(CA.TERM))return 1;if("COLORTERM"in CA)return 1;return f}function Zt(H,A={}){let L=Jw(H,{streamIsTTY:H&&H.isTTY,...A});return Sw(L)}WT.exports={supportsColor:Zt,stdout:Zt({isTTY:_T.isatty(1)}),stderr:Zt({isTTY:_T.isatty(2)})}});var JT=Q((XT,H1)=>{var Vw=O("tty"),eM=O("util");XT.init=sw;XT.log=aw;XT.formatArgs=Kw;XT.save=lw;XT.load=Ow;XT.useColors=ww;XT.destroy=eM.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");XT.colors=[6,2,3,4,5,1];try{let H=mT();if(H&&(H.stderr||H).level>=2)XT.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(H){}XT.inspectOpts=Object.keys(process.env).filter((H)=>{return/^debug_/i.test(H)}).reduce((H,A)=>{let L=A.substring(6).toLowerCase().replace(/_([a-z])/g,($,f)=>{return f.toUpperCase()}),I=process.env[A];if(/^(yes|on|true|enabled)$/i.test(I))I=!0;else if(/^(no|off|false|disabled)$/i.test(I))I=!1;else if(I==="null")I=null;else I=Number(I);return H[L]=I,H},{});function ww(){return"colors"in XT.inspectOpts?Boolean(XT.inspectOpts.colors):Vw.isatty(process.stderr.fd)}function Kw(H){let{namespace:A,useColors:L}=this;if(L){let I=this.color,$="\x1B[3"+(I<8?I:"8;5;"+I),f=` ${$};1m${A} \x1B[0m`;H[0]=f+H[0].split(`
28
+ */var qT=Hi("crypto"),V$=function(){};V$.prototype.getRandomBytes=function(i){var o=4096,n=this;if(i=i||12,i>o)return qT.randomBytes(i);var p=parseInt(o/i),c=parseInt(p*0.85);if(!c)return qT.randomBytes(i);if(this.bytesBufferIndex==null)this.bytesBufferIndex=-1;if(this.bytesBufferIndex==p)this.bytesBuffer=null,this.bytesBufferIndex=-1;if(this.bytesBufferIndex==-1||this.bytesBufferIndex>c){if(!this.isGeneratingBytes)this.isGeneratingBytes=!0,qT.randomBytes(o,function(T,m){n.bytesBuffer=m,n.bytesBufferIndex=0,n.isGeneratingBytes=!1});if(this.bytesBufferIndex==-1)return qT.randomBytes(i)}var x=this.bytesBuffer.slice(i*this.bytesBufferIndex,i*(this.bytesBufferIndex+1));return this.bytesBufferIndex++,x};V$.prototype.generateId=function(){var i=Buffer.alloc(15);if(!i.writeInt32BE)return Math.abs(Math.random()*Math.random()*Date.now()|0).toString()+Math.abs(Math.random()*Math.random()*Date.now()|0).toString();if(this.sequenceNumber=this.sequenceNumber+1|0,i.writeInt32BE(this.sequenceNumber,11),qT.randomBytes)this.getRandomBytes(12).copy(i);else[0,4,8].forEach(function(o){i.writeInt32BE(Math.random()*Math.pow(2,32)|0,o)});return i.toString("base64").replace(/\//g,"_").replace(/\+/g,"-")};_W=LW.exports=new V$});var N0=P((yW)=>{Object.defineProperty(yW,"__esModule",{value:!0});yW.ERROR_PACKET=yW.PACKET_TYPES_REVERSE=yW.PACKET_TYPES=void 0;var rn=Object.create(null);yW.PACKET_TYPES=rn;rn.open="0";rn.close="1";rn.ping="2";rn.pong="3";rn.message="4";rn.upgrade="5";rn.noop="6";var CW=Object.create(null);yW.PACKET_TYPES_REVERSE=CW;Object.keys(rn).forEach((i)=>{CW[rn[i]]=i});var kz={type:"error",data:"parser error"};yW.ERROR_PACKET=kz});var NW=P((BW)=>{Object.defineProperty(BW,"__esModule",{value:!0});BW.encodePacket=void 0;BW.encodePacketToBinary=dz;var sz=N0(),tz=({type:i,data:o},n,p)=>{if(o instanceof ArrayBuffer||ArrayBuffer.isView(o))return p(n?o:"b"+IW(o,!0).toString("base64"));return p(sz.PACKET_TYPES[i]+(o||""))};BW.encodePacket=tz;var IW=(i,o)=>{if(Buffer.isBuffer(i)||i instanceof Uint8Array&&!o)return i;else if(i instanceof ArrayBuffer)return Buffer.from(i);else return Buffer.from(i.buffer,i.byteOffset,i.byteLength)},E$;function dz(i,o){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return o(IW(i.data,!1));BW.encodePacket(i,!0,(n)=>{if(!E$)E$=new TextEncoder;o(E$.encode(n))})}});var aW=P((jW)=>{Object.defineProperty(jW,"__esModule",{value:!0});jW.decodePacket=void 0;var b0=N0(),ez=(i,o)=>{if(typeof i!=="string")return{type:"message",data:bW(i,o)};let n=i.charAt(0);if(n==="b"){let p=Buffer.from(i.substring(1),"base64");return{type:"message",data:bW(p,o)}}if(!b0.PACKET_TYPES_REVERSE[n])return b0.ERROR_PACKET;return i.length>1?{type:b0.PACKET_TYPES_REVERSE[n],data:i.substring(1)}:{type:b0.PACKET_TYPES_REVERSE[n]}};jW.decodePacket=ez;var bW=(i,o)=>{switch(o){case"arraybuffer":if(i instanceof ArrayBuffer)return i;else if(Buffer.isBuffer(i))return i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);else return i.buffer;case"nodebuffer":default:if(Buffer.isBuffer(i))return i;else return Buffer.from(i)}}});var kT=P((a0)=>{Object.defineProperty(a0,"__esModule",{value:!0});a0.decodePayload=a0.decodePacket=a0.encodePayload=a0.encodePacket=a0.protocol=void 0;a0.createPacketEncoderStream=nu;a0.createPacketDecoderStream=pu;var L$=NW();Object.defineProperty(a0,"encodePacket",{enumerable:!0,get:function(){return L$.encodePacket}});var C$=aW();Object.defineProperty(a0,"decodePacket",{enumerable:!0,get:function(){return C$.decodePacket}});var lW=N0(),qW=String.fromCharCode(30),iu=(i,o)=>{let n=i.length,p=new Array(n),c=0;i.forEach((x,T)=>{L$.encodePacket(x,!1,(m)=>{if(p[T]=m,++c===n)o(p.join(qW))})})};a0.encodePayload=iu;var ou=(i,o)=>{let n=i.split(qW),p=[];for(let c=0;c<n.length;c++){let x=C$.decodePacket(n[c],o);if(p.push(x),x.type==="error")break}return p};a0.decodePayload=ou;function nu(){return new TransformStream({transform(i,o){L$.encodePacketToBinary(i,(n)=>{let p=n.length,c;if(p<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,p);else if(p<65536){c=new Uint8Array(3);let x=new DataView(c.buffer);x.setUint8(0,126),x.setUint16(1,p)}else{c=new Uint8Array(9);let x=new DataView(c.buffer);x.setUint8(0,127),x.setBigUint64(1,BigInt(p))}if(i.data&&typeof i.data!=="string")c[0]|=128;o.enqueue(c),o.enqueue(n)})}})}var _$;function j0(i){return i.reduce((o,n)=>o+n.length,0)}function P0(i,o){if(i[0].length===o)return i.shift();let n=new Uint8Array(o),p=0;for(let c=0;c<o;c++)if(n[c]=i[0][p++],p===i[0].length)i.shift(),p=0;if(i.length&&p<i[0].length)i[0]=i[0].slice(p);return n}function pu(i,o){if(!_$)_$=new TextDecoder;let n=[],p=0,c=-1,x=!1;return new TransformStream({transform(T,m){n.push(T);while(!0){if(p===0){if(j0(n)<1)break;let f=P0(n,1);if(x=(f[0]&128)===128,c=f[0]&127,c<126)p=3;else if(c===126)p=1;else p=2}else if(p===1){if(j0(n)<2)break;let f=P0(n,2);c=new DataView(f.buffer,f.byteOffset,f.length).getUint16(0),p=3}else if(p===2){if(j0(n)<8)break;let f=P0(n,8),F=new DataView(f.buffer,f.byteOffset,f.length),$=F.getUint32(0);if($>Math.pow(2,21)-1){m.enqueue(lW.ERROR_PACKET);break}c=$*Math.pow(2,32)+F.getUint32(4),p=3}else{if(j0(n)<c)break;let f=P0(n,c);m.enqueue(C$.decodePacket(x?f:_$.decode(f),o)),p=0}if(c===0||c>i){m.enqueue(lW.ERROR_PACKET);break}}}})}a0.protocol=4});var tW=P((lni,sW)=>{/*! https://mths.be/utf8js v2.1.2 by @mathias */var jp=String.fromCharCode;function hW(i){var o=[],n=0,p=i.length,c,x;while(n<p)if(c=i.charCodeAt(n++),c>=55296&&c<=56319&&n<p)if(x=i.charCodeAt(n++),(x&64512)==56320)o.push(((c&1023)<<10)+(x&1023)+65536);else o.push(c),n--;else o.push(c);return o}function fu(i){var o=i.length,n=-1,p,c="";while(++n<o){if(p=i[n],p>65535)p-=65536,c+=jp(p>>>10&1023|55296),p=56320|p&1023;c+=jp(p)}return c}function gW(i,o){if(i>=55296&&i<=57343){if(o)throw Error("Lone surrogate U+"+i.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function y$(i,o){return jp(i>>o&63|128)}function Fu(i,o){if((i&4294967168)==0)return jp(i);var n="";if((i&4294965248)==0)n=jp(i>>6&31|192);else if((i&4294901760)==0){if(!gW(i,o))i=65533;n=jp(i>>12&15|224),n+=y$(i,6)}else if((i&4292870144)==0)n=jp(i>>18&7|240),n+=y$(i,12),n+=y$(i,6);return n+=jp(i&63|128),n}function $u(i,o){o=o||{};var n=o.strict!==!1,p=hW(i),c=p.length,x=-1,T,m="";while(++x<c)T=p[x],m+=Fu(T,n);return m}function Wx(){if(Pp>=q0)throw Error("Invalid byte index");var i=l0[Pp]&255;if(Pp++,(i&192)==128)return i&63;throw Error("Invalid continuation byte")}function Ju(i){var o,n,p,c,x;if(Pp>q0)throw Error("Invalid byte index");if(Pp==q0)return!1;if(o=l0[Pp]&255,Pp++,(o&128)==0)return o;if((o&224)==192)if(n=Wx(),x=(o&31)<<6|n,x>=128)return x;else throw Error("Invalid continuation byte");if((o&240)==224)if(n=Wx(),p=Wx(),x=(o&15)<<12|n<<6|p,x>=2048)return gW(x,i)?x:65533;else throw Error("Invalid continuation byte");if((o&248)==240){if(n=Wx(),p=Wx(),c=Wx(),x=(o&7)<<18|n<<12|p<<6|c,x>=65536&&x<=1114111)return x}throw Error("Invalid UTF-8 detected")}var l0,q0,Pp;function Au(i,o){o=o||{};var n=o.strict!==!1;l0=hW(i),q0=l0.length,Pp=0;var p=[],c;while((c=Ju(n))!==!1)p.push(c);return fu(p)}sW.exports={version:"2.1.2",encode:$u,decode:Au}});var x5=P((c5)=>{Object.defineProperty(c5,"__esModule",{value:!0});c5.packets=c5.protocol=void 0;c5.encodePacket=D$;c5.encodeBase64Packet=eW;c5.decodePacket=I$;c5.decodeBase64Packet=i5;c5.encodePayload=Wu;c5.decodePayload=Yu;c5.encodePayloadAsBinary=n5;c5.decodePayloadAsBinary=p5;var rW=tW();c5.protocol=3;var vu=(i)=>{for(let o of i)if(o.data instanceof ArrayBuffer||ArrayBuffer.isView(o.data))return!0;return!1};c5.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6};var Rx=Object.keys(c5.packets),Bn={type:"error",data:"parser error"},wu=Buffer.concat([]);function D$(i,o,n,p){if(typeof o==="function")p=o,o=null;if(typeof n==="function")p=n,n=null;if(Buffer.isBuffer(i.data))return dW(i,o,p);else if(i.data&&(i.data.buffer||i.data)instanceof ArrayBuffer)return dW({type:i.type,data:B$(i.data)},o,p);var c=c5.packets[i.type];if(i.data!==void 0)c+=n?rW.encode(String(i.data),{strict:!1}):String(i.data);return p(""+c)}function dW(i,o,n){if(!o)return eW(i,n);var p=i.data,c=Buffer.allocUnsafe(1);return c[0]=c5.packets[i.type],n(Buffer.concat([c,p]))}function eW(i,o){var n=Buffer.isBuffer(i.data)?i.data:B$(i.data),p="b"+c5.packets[i.type];return p+=n.toString("base64"),o(p)}function I$(i,o,n){if(i===void 0)return Bn;var p;if(typeof i==="string"){if(p=i.charAt(0),p==="b")return i5(i.slice(1),o);if(n){if(i=Xu(i),i===!1)return Bn}if(Number(p)!=p||!Rx[p])return Bn;if(i.length>1)return{type:Rx[p],data:i.slice(1)};else return{type:Rx[p]}}if(o==="arraybuffer"){var c=new Uint8Array(i);return p=c[0],{type:Rx[p],data:c.buffer.slice(1)}}if(i instanceof ArrayBuffer)i=B$(i);return p=i[0],{type:Rx[p],data:i.slice(1)}}function Xu(i){try{i=rW.decode(i,{strict:!1})}catch(o){return!1}return i}function i5(i,o){var n=Rx[i.charAt(0)],p=Buffer.from(i.slice(1),"base64");if(o==="arraybuffer"){var c=new Uint8Array(p.length);for(var x=0;x<c.length;x++)c[x]=p[x];p=c.buffer}return{type:n,data:p}}function Wu(i,o,n){if(typeof o==="function")n=o,o=null;if(o&&vu(i))return n5(i,n);if(!i.length)return n("0:");function p(c,x){D$(c,o,!1,function(T){x(null,Ru(T))})}o5(i,p,function(c,x){return n(x.join(""))})}function Ru(i){return i.length+":"+i}function o5(i,o,n){let p=new Array(i.length),c=0;for(let x=0;x<i.length;x++)o(i[x],(T,m)=>{if(p[x]=m,++c===i.length)n(null,p)})}function Yu(i,o,n){if(typeof i!=="string")return p5(i,o,n);if(typeof o==="function")n=o,o=null;if(i==="")return n(Bn,0,1);var p="",c,x,T;for(var m=0,f=i.length;m<f;m++){var F=i.charAt(m);if(F!==":"){p+=F;continue}if(p===""||p!=(c=Number(p)))return n(Bn,0,1);if(x=i.slice(m+1,m+1+c),p!=x.length)return n(Bn,0,1);if(x.length){if(T=I$(x,o,!1),Bn.type===T.type&&Bn.data===T.data)return n(Bn,0,1);var $=n(T,m+c,f);if($===!1)return}m+=c,p=""}if(p!=="")return n(Bn,0,1)}function Gu(i){var o="";for(var n=0,p=i.length;n<p;n++)o+=String.fromCharCode(i[n]);return o}function Ku(i){var o=Buffer.allocUnsafe(i.length);for(var n=0,p=i.length;n<p;n++)o.writeUInt8(i.charCodeAt(n),n);return o}function B$(i){var o=i.byteLength||i.length,n=i.byteOffset||0;return Buffer.from(i.buffer||i,n,o)}function n5(i,o){if(!i.length)return o(wu);o5(i,Hu,function(n,p){return o(Buffer.concat(p))})}function Hu(i,o){function n(p){var c=""+p.length,x;if(typeof p==="string"){x=Buffer.allocUnsafe(c.length+2),x[0]=0;for(var T=0;T<c.length;T++)x[T+1]=parseInt(c[T],10);return x[x.length-1]=255,o(null,Buffer.concat([x,Ku(p)]))}x=Buffer.allocUnsafe(c.length+2),x[0]=1;for(var T=0;T<c.length;T++)x[T+1]=parseInt(c[T],10);x[x.length-1]=255,o(null,Buffer.concat([x,p]))}D$(i,!0,!0,n)}function p5(i,o,n){if(typeof o==="function")n=o,o=null;var p=i,c=[],x;while(p.length>0){var T="",m=p[0]===0;for(x=1;;x++){if(p[x]===255)break;if(T.length>310)return n(Bn,0,1);T+=""+p[x]}p=p.slice(T.length+1);var f=parseInt(T,10),F=p.slice(1,f+1);if(m)F=Gu(F);c.push(F),p=p.slice(f+1)}var $=c.length;for(x=0;x<$;x++){var J=c[x];n(I$(J,o,!0),x,$)}}});var m5=P((kni,T5)=>{var Gx=1000,Kx=Gx*60,Hx=Kx*60,Xc=Hx*24,Ou=Xc*7,_u=Xc*365.25;T5.exports=function(i,o){o=o||{};var n=typeof i;if(n==="string"&&i.length>0)return Lu(i);else if(n==="number"&&isFinite(i))return o.long?yu(i):Cu(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Lu(i){if(i=String(i),i.length>100)return;var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!o)return;var n=parseFloat(o[1]),p=(o[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return n*_u;case"weeks":case"week":case"w":return n*Ou;case"days":case"day":case"d":return n*Xc;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Hx;case"minutes":case"minute":case"mins":case"min":case"m":return n*Kx;case"seconds":case"second":case"secs":case"sec":case"s":return n*Gx;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}function Cu(i){var o=Math.abs(i);if(o>=Xc)return Math.round(i/Xc)+"d";if(o>=Hx)return Math.round(i/Hx)+"h";if(o>=Kx)return Math.round(i/Kx)+"m";if(o>=Gx)return Math.round(i/Gx)+"s";return i+"ms"}function yu(i){var o=Math.abs(i);if(o>=Xc)return k0(i,o,Xc,"day");if(o>=Hx)return k0(i,o,Hx,"hour");if(o>=Kx)return k0(i,o,Kx,"minute");if(o>=Gx)return k0(i,o,Gx,"second");return i+" ms"}function k0(i,o,n,p){var c=o>=n*1.5;return Math.round(i/n)+" "+p+(c?"s":"")}});var N$=P((hni,f5)=>{function Du(i){n.debug=n,n.default=n,n.coerce=f,n.disable=x,n.enable=c,n.enabled=T,n.humanize=m5(),n.destroy=F,Object.keys(i).forEach(($)=>{n[$]=i[$]}),n.names=[],n.skips=[],n.formatters={};function o($){let J=0;for(let A=0;A<$.length;A++)J=(J<<5)-J+$.charCodeAt(A),J|=0;return n.colors[Math.abs(J)%n.colors.length]}n.selectColor=o;function n($){let J,A=null,X,Y;function R(...K){if(!R.enabled)return;let U=R,z=Number(new Date),b=z-(J||z);if(U.diff=b,U.prev=J,U.curr=z,J=z,K[0]=n.coerce(K[0]),typeof K[0]!=="string")K.unshift("%O");let M=0;K[0]=K[0].replace(/%([a-zA-Z%])/g,(E,S)=>{if(E==="%%")return"%";M++;let C=n.formatters[S];if(typeof C==="function"){let q=K[M];E=C.call(U,q),K.splice(M,1),M--}return E}),n.formatArgs.call(U,K),(U.log||n.log).apply(U,K)}if(R.namespace=$,R.useColors=n.useColors(),R.color=n.selectColor($),R.extend=p,R.destroy=n.destroy,Object.defineProperty(R,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(A!==null)return A;if(X!==n.namespaces)X=n.namespaces,Y=n.enabled($);return Y},set:(K)=>{A=K}}),typeof n.init==="function")n.init(R);return R}function p($,J){let A=n(this.namespace+(typeof J==="undefined"?":":J)+$);return A.log=this.log,A}function c($){n.save($),n.namespaces=$,n.names=[],n.skips=[];let J,A=(typeof $==="string"?$:"").split(/[\s,]+/),X=A.length;for(J=0;J<X;J++){if(!A[J])continue;if($=A[J].replace(/\*/g,".*?"),$[0]==="-")n.skips.push(new RegExp("^"+$.slice(1)+"$"));else n.names.push(new RegExp("^"+$+"$"))}}function x(){let $=[...n.names.map(m),...n.skips.map(m).map((J)=>"-"+J)].join(",");return n.enable(""),$}function T($){if($[$.length-1]==="*")return!0;let J,A;for(J=0,A=n.skips.length;J<A;J++)if(n.skips[J].test($))return!1;for(J=0,A=n.names.length;J<A;J++)if(n.names[J].test($))return!0;return!1}function m($){return $.toString().substring(2,$.toString().length-2).replace(/\.\*\?$/,"*")}function f($){if($ instanceof Error)return $.stack||$.message;return $}function F(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}f5.exports=Du});var $5=P((F5,g0)=>{F5.formatArgs=Bu;F5.save=Nu;F5.load=bu;F5.useColors=Iu;F5.storage=ju();F5.destroy=(()=>{let i=!1;return()=>{if(!i)i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();F5.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Iu(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Bu(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+g0.exports.humanize(this.diff),!this.useColors)return;let o="color: "+this.color;i.splice(1,0,o,"color: inherit");let n=0,p=0;i[0].replace(/%[a-zA-Z%]/g,(c)=>{if(c==="%%")return;if(n++,c==="%c")p=n}),i.splice(p,0,o)}F5.log=console.debug||console.log||(()=>{});function Nu(i){try{if(i)F5.storage.setItem("debug",i);else F5.storage.removeItem("debug")}catch(o){}}function bu(){let i;try{i=F5.storage.getItem("debug")}catch(o){}if(!i&&typeof process!=="undefined"&&"env"in process)i=process.env.DEBUG;return i}function ju(){try{return localStorage}catch(i){}}g0.exports=N$()(F5);var{formatters:Pu}=g0.exports;Pu.j=function(i){try{return JSON.stringify(i)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}});var A5=P((sni,J5)=>{J5.exports=(i,o=process.argv)=>{let n=i.startsWith("-")?"":i.length===1?"-":"--",p=o.indexOf(n+i),c=o.indexOf("--");return p!==-1&&(c===-1||p<c)}});var X5=P((tni,w5)=>{var tu=Hi("os"),v5=Hi("tty"),Zn=A5(),{env:Yo}=process,s0;if(Zn("no-color")||Zn("no-colors")||Zn("color=false")||Zn("color=never"))s0=0;else if(Zn("color")||Zn("colors")||Zn("color=true")||Zn("color=always"))s0=1;function du(){if("FORCE_COLOR"in Yo){if(Yo.FORCE_COLOR==="true")return 1;if(Yo.FORCE_COLOR==="false")return 0;return Yo.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Yo.FORCE_COLOR,10),3)}}function ru(i){if(i===0)return!1;return{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function eu(i,{streamIsTTY:o,sniffFlags:n=!0}={}){let p=du();if(p!==void 0)s0=p;let c=n?s0:p;if(c===0)return 0;if(n){if(Zn("color=16m")||Zn("color=full")||Zn("color=truecolor"))return 3;if(Zn("color=256"))return 2}if(i&&!o&&c===void 0)return 0;let x=c||0;if(Yo.TERM==="dumb")return x;if(process.platform==="win32"){let T=tu.release().split(".");if(Number(T[0])>=10&&Number(T[2])>=10586)return Number(T[2])>=14931?3:2;return 1}if("CI"in Yo){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((T)=>(T in Yo))||Yo.CI_NAME==="codeship")return 1;return x}if("TEAMCITY_VERSION"in Yo)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Yo.TEAMCITY_VERSION)?1:0;if(Yo.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Yo){let T=Number.parseInt((Yo.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Yo.TERM_PROGRAM){case"iTerm.app":return T>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(Yo.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Yo.TERM))return 1;if("COLORTERM"in Yo)return 1;return x}function b$(i,o={}){let n=eu(i,{streamIsTTY:i&&i.isTTY,...o});return ru(n)}w5.exports={supportsColor:b$,stdout:b$({isTTY:v5.isatty(1)}),stderr:b$({isTTY:v5.isatty(2)})}});var G5=P((R5,d0)=>{var iQ=Hi("tty"),t0=Hi("util");R5.init=mQ;R5.log=cQ;R5.formatArgs=nQ;R5.save=xQ;R5.load=TQ;R5.useColors=oQ;R5.destroy=t0.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");R5.colors=[6,2,3,4,5,1];try{let i=X5();if(i&&(i.stderr||i).level>=2)R5.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(i){}R5.inspectOpts=Object.keys(process.env).filter((i)=>{return/^debug_/i.test(i)}).reduce((i,o)=>{let n=o.substring(6).toLowerCase().replace(/_([a-z])/g,(c,x)=>{return x.toUpperCase()}),p=process.env[o];if(/^(yes|on|true|enabled)$/i.test(p))p=!0;else if(/^(no|off|false|disabled)$/i.test(p))p=!1;else if(p==="null")p=null;else p=Number(p);return i[n]=p,i},{});function oQ(){return"colors"in R5.inspectOpts?Boolean(R5.inspectOpts.colors):iQ.isatty(process.stderr.fd)}function nQ(i){let{namespace:o,useColors:n}=this;if(n){let p=this.color,c="\x1B[3"+(p<8?p:"8;5;"+p),x=` ${c};1m${o} \x1B[0m`;i[0]=x+i[0].split(`
29
29
  `).join(`
30
- `+f),H.push($+"m+"+H1.exports.humanize(this.diff)+"\x1B[0m")}else H[0]=vw()+A+" "+H[0]}function vw(){if(XT.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function aw(...H){return process.stderr.write(eM.formatWithOptions(XT.inspectOpts,...H)+`
31
- `)}function lw(H){if(H)process.env.DEBUG=H;else delete process.env.DEBUG}function Ow(){return process.env.DEBUG}function sw(H){H.inspectOpts={};let A=Object.keys(XT.inspectOpts);for(let L=0;L<A.length;L++)H.inspectOpts[A[L]]=XT.inspectOpts[A[L]]}H1.exports=bt()(XT);var{formatters:PT}=H1.exports;PT.o=function(H){return this.inspectOpts.colors=this.useColors,eM.inspect(H,this.inspectOpts).split(`
32
- `).map((A)=>A.trim()).join(" ")};PT.O=function(H){return this.inspectOpts.colors=this.useColors,eM.inspect(H,this.inspectOpts)}});var TA=Q((OIH,ht)=>{if(typeof process==="undefined"||process.type==="renderer"||!1||process.__nwjs)ht.exports=TT();else ht.exports=JT()});var U$=Q((KT)=>{Object.defineProperty(KT,"__esModule",{value:!0});KT.Transport=void 0;var Zw=O("events"),hw=jE(),rw=BT(),jw=TA(),VT=jw.default("engine:transport");function kw(){}class wT extends Zw.EventEmitter{get readyState(){return this._readyState}set readyState(H){VT("readyState updated from %s to %s (%s)",this._readyState,H,this.name),this._readyState=H}constructor(H){super();this.writable=!1,this._readyState="open",this.discarded=!1,this.protocol=H._query.EIO==="4"?4:3,this.parser=this.protocol===4?hw:rw,this.supportsBinary=!(H._query&&H._query.b64)}discard(){this.discarded=!0}onRequest(H){}close(H){if(this.readyState==="closed"||this.readyState==="closing")return;this.readyState="closing",this.doClose(H||kw)}onError(H,A){if(this.listeners("error").length){let L=new Error(H);L.type="TransportError",L.description=A,this.emit("error",L)}else VT("ignored transport error %s (%s)",H,A)}onPacket(H){this.emit("packet",H)}onData(H){this.onPacket(this.parser.decodePacket(H))}onClose(){this.readyState="closed",this.emit("close")}}KT.Transport=wT});var rt=Q((OT)=>{Object.defineProperty(OT,"__esModule",{value:!0});OT.Polling=void 0;var dw=U$(),aT=O("zlib"),qw=YM(),gw=TA(),oL=gw.default("engine:polling"),ew={gzip:aT.createGzip,deflate:aT.createDeflate};class lT extends dw.Transport{constructor(H){super(H);this.closeTimeout=30000}get name(){return"polling"}onRequest(H){let A=H.res;if(H.res=null,H.method==="GET")this.onPollRequest(H,A);else if(H.method==="POST")this.onDataRequest(H,A);else A.writeHead(500),A.end()}onPollRequest(H,A){if(this.req){oL("request overlap"),this.onError("overlap from client"),A.writeHead(400),A.end();return}oL("setting request"),this.req=H,this.res=A;let L=()=>{this.onError("poll connection closed prematurely")},I=()=>{H.removeListener("close",L),this.req=this.res=null};if(H.cleanup=I,H.on("close",L),this.writable=!0,this.emit("ready"),this.writable&&this.shouldClose)oL("triggering empty send to append close packet"),this.send([{type:"noop"}])}onDataRequest(H,A){if(this.dataReq){this.onError("data request overlap from client"),A.writeHead(400),A.end();return}let L=H.headers["content-type"]==="application/octet-stream";if(L&&this.protocol===4)return this.onError("invalid content");this.dataReq=H,this.dataRes=A;let I=L?Buffer.concat([]):"",$=()=>{H.removeListener("data",E),H.removeListener("end",D),H.removeListener("close",f),this.dataReq=this.dataRes=I=null},f=()=>{$(),this.onError("data request connection closed prematurely")},E=(M)=>{let o;if(L)I=Buffer.concat([I,M]),o=I.length;else I+=M,o=Buffer.byteLength(I);if(o>this.maxHttpBufferSize)A.writeHead(413).end(),$()},D=()=>{this.onData(I);let M={"Content-Type":"text/html","Content-Length":"2"};A.writeHead(200,this.headers(H,M)),A.end("ok"),$()};if(H.on("close",f),!L)H.setEncoding("utf8");H.on("data",E),H.on("end",D)}onData(H){oL('received "%s"',H);let A=(L)=>{if(L.type==="close")return oL("got xhr close packet"),this.onClose(),!1;this.onPacket(L)};if(this.protocol===3)this.parser.decodePayload(H,A);else this.parser.decodePayload(H).forEach(A)}onClose(){if(this.writable)this.send([{type:"noop"}]);super.onClose()}send(H){if(this.writable=!1,this.shouldClose)oL("appending close packet to payload"),H.push({type:"close"}),this.shouldClose(),this.shouldClose=null;let A=(L)=>{let I=H.some(($)=>{return $.options&&$.options.compress});this.write(L,{compress:I})};if(this.protocol===3)this.parser.encodePayload(H,this.supportsBinary,A);else this.parser.encodePayload(H,A)}write(H,A){oL('writing "%s"',H),this.doWrite(H,A,()=>{this.req.cleanup(),this.emit("drain")})}doWrite(H,A,L){let I=typeof H==="string",f={"Content-Type":I?"text/plain; charset=UTF-8":"application/octet-stream"},E=(o)=>{f["Content-Length"]=typeof o==="string"?Buffer.byteLength(o):o.length,this.res.writeHead(200,this.headers(this.req,f)),this.res.end(o),L()};if(!this.httpCompression||!A.compress){E(H);return}if((I?Buffer.byteLength(H):H.length)<this.httpCompression.threshold){E(H);return}let M=qw(this.req).encodings(["gzip","deflate"]);if(!M){E(H);return}this.compress(H,M,(o,u)=>{if(o){this.res.writeHead(500),this.res.end(),L(o);return}f["Content-Encoding"]=M,E(u)})}compress(H,A,L){oL("compressing");let I=[],$=0;ew[A](this.httpCompression).on("error",L).on("data",function(f){I.push(f),$+=f.length}).on("end",function(){L(null,Buffer.concat(I,$))}).end(H)}doClose(H){oL("closing");let A;if(this.dataReq)oL("aborting ongoing data request"),this.dataReq.destroy();let L=()=>{clearTimeout(A),H(),this.onClose()};if(this.writable)oL("transport writable - closing right away"),this.send([{type:"close"}]),L();else if(this.discarded)oL("transport discarded - closing right away"),L();else oL("transport not writable - buffering orderly close"),this.shouldClose=L,A=setTimeout(L,this.closeTimeout)}headers(H,A={}){let L=H.headers["user-agent"];if(L&&(~L.indexOf(";MSIE")||~L.indexOf("Trident/")))A["X-XSS-Protection"]="0";return A["cache-control"]="no-store",this.emit("headers",A,H),A}}OT.Polling=lT});var YT=Q((yT)=>{Object.defineProperty(yT,"__esModule",{value:!0});yT.JSONP=void 0;var HK=rt(),AK=O("querystring"),LK=/\\\\n/g,IK=/(\\)?\\n/g;class NT extends HK.Polling{constructor(H){super(H);this.head="___eio["+(H._query.j||"").replace(/[^0-9]/g,"")+"](",this.foot=");"}onData(H){if(H=AK.parse(H).d,typeof H==="string")H=H.replace(IK,function(A,L){return L?A:`
33
- `}),super.onData(H.replace(LK,"\\n"))}doWrite(H,A,L){let I=JSON.stringify(H).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");H=this.head+I+this.foot,super.doWrite(H,A,L)}}yT.JSONP=NT});var hT=Q((bT)=>{Object.defineProperty(bT,"__esModule",{value:!0});bT.WebSocket=void 0;var $K=U$(),fK=TA(),QT=fK.default("engine:ws");class zT extends $K.Transport{constructor(H){super(H);this._doSend=(A)=>{this.socket.send(A,this._onSent)},this._doSendLast=(A)=>{this.socket.send(A,this._onSentLast)},this._onSent=(A)=>{if(A)this.onError("write error",A.stack)},this._onSentLast=(A)=>{if(A)this.onError("write error",A.stack);else this.emit("drain"),this.writable=!0,this.emit("ready")},this.socket=H.websocket,this.socket.on("message",(A,L)=>{let I=L?A:A.toString();QT('received "%s"',I),super.onData(I)}),this.socket.once("close",this.onClose.bind(this)),this.socket.on("error",this.onError.bind(this)),this.writable=!0,this.perMessageDeflate=null}get name(){return"websocket"}get handlesUpgrades(){return!0}send(H){this.writable=!1;for(let A=0;A<H.length;A++){let L=H[A],I=A+1===H.length;if(this._canSendPreEncodedFrame(L))this.socket._sender.sendFrame(L.options.wsPreEncodedFrame,I?this._onSentLast:this._onSent);else this.parser.encodePacket(L,this.supportsBinary,I?this._doSendLast:this._doSend)}}_canSendPreEncodedFrame(H){var A,L,I;return!this.perMessageDeflate&&typeof((L=(A=this.socket)===null||A===void 0?void 0:A._sender)===null||L===void 0?void 0:L.sendFrame)==="function"&&((I=H.options)===null||I===void 0?void 0:I.wsPreEncodedFrame)!==void 0}doClose(H){QT("closing"),this.socket.close(),H&&H()}}bT.WebSocket=zT});var jt=Q((jT)=>{Object.defineProperty(jT,"__esModule",{value:!0});jT.WebTransport=void 0;var EK=U$(),DK=TA(),MK=jE(),Wf=DK.default("engine:webtransport");class rT extends EK.Transport{constructor(H,A,L){super({_query:{EIO:"4"}});this.session=H;let I=MK.createPacketEncoderStream();I.readable.pipeTo(A.writable).catch(()=>{Wf("the stream was closed")}),this.writer=I.writable.getWriter(),(async()=>{try{while(!0){let{value:$,done:f}=await L.read();if(f){Wf("session is closed");break}Wf("received chunk: %o",$),this.onPacket($)}}catch($){Wf("error while reading: %s",$.message)}})(),H.closed.then(()=>this.onClose()),this.writable=!0}get name(){return"webtransport"}async send(H){this.writable=!1;try{for(let A=0;A<H.length;A++){let L=H[A];await this.writer.write(L)}}catch(A){Wf("error while writing: %s",A.message)}this.emit("drain"),this.writable=!0,this.emit("ready")}doClose(H){Wf("closing WebTransport session"),this.session.close(),H&&H()}}jT.WebTransport=rT});var kt=Q((qT)=>{Object.defineProperty(qT,"__esModule",{value:!0});var oK=rt(),uK=YT(),tK=hT(),iK=jt();qT.default={polling:dT,websocket:tK.WebSocket,webtransport:iK.WebTransport};function dT(H){if(typeof H._query.j==="string")return new uK.JSONP(H);else return new oK.Polling(H)}dT.upgradesTo=["websocket","webtransport"]});var dt=Q((eT)=>{Object.defineProperty(eT,"__esModule",{value:!0});eT.Socket=void 0;var nK=O("events"),BK=TA(),nI=O("timers"),HA=BK.default("engine:socket");class gT extends nK.EventEmitter{get readyState(){return this._readyState}set readyState(H){HA("readyState updated from %s to %s",this._readyState,H),this._readyState=H}constructor(H,A,L,I,$){super();if(this._readyState="opening",this.upgrading=!1,this.upgraded=!1,this.writeBuffer=[],this.packetsFn=[],this.sentCallbackFn=[],this.cleanupFn=[],this.id=H,this.server=A,this.request=I,this.protocol=$,I)if(I.websocket&&I.websocket._socket)this.remoteAddress=I.websocket._socket.remoteAddress;else this.remoteAddress=I.connection.remoteAddress;this.pingTimeoutTimer=null,this.pingIntervalTimer=null,this.setTransport(L),this.onOpen()}onOpen(){if(this.readyState="open",this.transport.sid=this.id,this.sendPacket("open",JSON.stringify({sid:this.id,upgrades:this.getAvailableUpgrades(),pingInterval:this.server.opts.pingInterval,pingTimeout:this.server.opts.pingTimeout,maxPayload:this.server.opts.maxHttpBufferSize})),this.server.opts.initialPacket)this.sendPacket("message",this.server.opts.initialPacket);if(this.emit("open"),this.protocol===3)this.resetPingTimeout();else this.schedulePing()}onPacket(H){if(this.readyState!=="open")return HA("packet received with closed socket");switch(HA(`received packet ${H.type}`),this.emit("packet",H),H.type){case"ping":if(this.transport.protocol!==3){this.onError(new Error("invalid heartbeat direction"));return}HA("got ping"),this.pingTimeoutTimer.refresh(),this.sendPacket("pong"),this.emit("heartbeat");break;case"pong":if(this.transport.protocol===3){this.onError(new Error("invalid heartbeat direction"));return}HA("got pong"),nI.clearTimeout(this.pingTimeoutTimer),this.pingIntervalTimer.refresh(),this.emit("heartbeat");break;case"error":this.onClose("parse error");break;case"message":this.emit("data",H.data),this.emit("message",H.data);break}}onError(H){HA("transport error"),this.onClose("transport error",H)}schedulePing(){this.pingIntervalTimer=nI.setTimeout(()=>{HA("writing ping packet - expecting pong within %sms",this.server.opts.pingTimeout),this.sendPacket("ping"),this.resetPingTimeout()},this.server.opts.pingInterval)}resetPingTimeout(){nI.clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=nI.setTimeout(()=>{if(this.readyState==="closed")return;this.onClose("ping timeout")},this.protocol===3?this.server.opts.pingInterval+this.server.opts.pingTimeout:this.server.opts.pingTimeout)}setTransport(H){let A=this.onError.bind(this),L=()=>this.flush(),I=this.onPacket.bind(this),$=this.onDrain.bind(this),f=this.onClose.bind(this,"transport close");this.transport=H,this.transport.once("error",A),this.transport.on("ready",L),this.transport.on("packet",I),this.transport.on("drain",$),this.transport.once("close",f),this.cleanupFn.push(function(){H.removeListener("error",A),H.removeListener("ready",L),H.removeListener("packet",I),H.removeListener("drain",$),H.removeListener("close",f)})}onDrain(){if(this.sentCallbackFn.length>0){HA("executing batch send callback");let H=this.sentCallbackFn.shift();if(H)for(let A=0;A<H.length;A++)H[A](this.transport)}}_maybeUpgrade(H){HA('might upgrade socket transport from "%s" to "%s"',this.transport.name,H.name),this.upgrading=!0;let A=nI.setTimeout(()=>{if(HA("client did not complete upgrade - closing transport"),f(),H.readyState==="open")H.close()},this.server.opts.upgradeTimeout),L,I=(o)=>{if(o.type==="ping"&&o.data==="probe")HA("got probe ping packet, sending pong"),H.send([{type:"pong",data:"probe"}]),this.emit("upgrading",H),clearInterval(L),L=setInterval($,100);else if(o.type==="upgrade"&&this.readyState!=="closed"){if(HA("got upgrade packet - upgrading"),f(),this.transport.discard(),this.upgraded=!0,this.clearTransport(),this.setTransport(H),this.emit("upgrade",H),this.flush(),this.readyState==="closing")H.close(()=>{this.onClose("forced close")})}else f(),H.close()},$=()=>{if(this.transport.name==="polling"&&this.transport.writable)HA("writing a noop packet to polling for fast upgrade"),this.transport.send([{type:"noop"}])},f=()=>{this.upgrading=!1,clearInterval(L),nI.clearTimeout(A),H.removeListener("packet",I),H.removeListener("close",D),H.removeListener("error",E),this.removeListener("close",M)},E=(o)=>{HA("client did not complete upgrade - %s",o),f(),H.close(),H=null},D=()=>{E("transport closed")},M=()=>{E("socket closed")};H.on("packet",I),H.once("close",D),H.once("error",E),this.once("close",M)}clearTransport(){let H,A=this.cleanupFn.length;for(let L=0;L<A;L++)H=this.cleanupFn.shift(),H();this.transport.on("error",function(){HA("error triggered by discarded transport")}),this.transport.close(),nI.clearTimeout(this.pingTimeoutTimer)}onClose(H,A){if(this.readyState!=="closed")this.readyState="closed",nI.clearTimeout(this.pingIntervalTimer),nI.clearTimeout(this.pingTimeoutTimer),process.nextTick(()=>{this.writeBuffer=[]}),this.packetsFn=[],this.sentCallbackFn=[],this.clearTransport(),this.emit("close",H,A)}send(H,A,L){return this.sendPacket("message",H,A,L),this}write(H,A,L){return this.sendPacket("message",H,A,L),this}sendPacket(H,A,L={},I){if(typeof L==="function")I=L,L={};if(this.readyState!=="closing"&&this.readyState!=="closed"){HA('sending packet "%s" (%s)',H,A),L.compress=L.compress!==!1;let $={type:H,options:L};if(A)$.data=A;if(this.emit("packetCreate",$),this.writeBuffer.push($),typeof I==="function")this.packetsFn.push(I);this.flush()}}flush(){if(this.readyState!=="closed"&&this.transport.writable&&this.writeBuffer.length){HA("flushing buffer to transport"),this.emit("flush",this.writeBuffer),this.server.emit("flush",this,this.writeBuffer);let H=this.writeBuffer;if(this.writeBuffer=[],this.packetsFn.length)this.sentCallbackFn.push(this.packetsFn),this.packetsFn=[];else this.sentCallbackFn.push(null);this.transport.send(H),this.emit("drain"),this.server.emit("drain",this)}}getAvailableUpgrades(){let H=[],A=this.server.upgrades(this.transport.name);for(let L=0;L<A.length;++L){let I=A[L];if(this.server.opts.transports.indexOf(I)!==-1)H.push(I)}return H}close(H){if(H&&(this.readyState==="open"||this.readyState==="closing"))return this.closeTransport(H);if(this.readyState!=="open")return;if(this.readyState="closing",this.writeBuffer.length){HA("there are %d remaining packets in the buffer, waiting for the 'drain' event",this.writeBuffer.length),this.once("drain",()=>{HA("all packets have been sent, closing the transport"),this.closeTransport(H)});return}HA("the buffer is empty, closing the transport right away"),this.closeTransport(H)}closeTransport(H){if(HA("closing the transport (discard? %s)",!!H),H)this.transport.discard();this.transport.close(this.onClose.bind(this,"forced close"))}}eT.Socket=gT});var IG=Q((XK)=>{/*!
30
+ `+x),i.push(c+"m+"+d0.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=pQ()+o+" "+i[0]}function pQ(){if(R5.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function cQ(...i){return process.stderr.write(t0.formatWithOptions(R5.inspectOpts,...i)+`
31
+ `)}function xQ(i){if(i)process.env.DEBUG=i;else delete process.env.DEBUG}function TQ(){return process.env.DEBUG}function mQ(i){i.inspectOpts={};let o=Object.keys(R5.inspectOpts);for(let n=0;n<o.length;n++)i.inspectOpts[o[n]]=R5.inspectOpts[o[n]]}d0.exports=N$()(R5);var{formatters:W5}=d0.exports;W5.o=function(i){return this.inspectOpts.colors=this.useColors,t0.inspect(i,this.inspectOpts).split(`
32
+ `).map((o)=>o.trim()).join(" ")};W5.O=function(i){return this.inspectOpts.colors=this.useColors,t0.inspect(i,this.inspectOpts)}});var Go=P((rni,j$)=>{if(typeof process==="undefined"||process.type==="renderer"||!1||process.__nwjs)j$.exports=$5();else j$.exports=G5()});var Rc=P((U5)=>{Object.defineProperty(U5,"__esModule",{value:!0});U5.Transport=void 0;var XQ=Hi("events"),WQ=kT(),RQ=x5(),YQ=Go(),K5=YQ.default("engine:transport");function GQ(){}class H5 extends XQ.EventEmitter{get readyState(){return this._readyState}set readyState(i){K5("readyState updated from %s to %s (%s)",this._readyState,i,this.name),this._readyState=i}constructor(i){super();this.writable=!1,this._readyState="open",this.discarded=!1,this.protocol=i._query.EIO==="4"?4:3,this.parser=this.protocol===4?WQ:RQ,this.supportsBinary=!(i._query&&i._query.b64)}discard(){this.discarded=!0}onRequest(i){}close(i){if(this.readyState==="closed"||this.readyState==="closing")return;this.readyState="closing",this.doClose(i||GQ)}onError(i,o){if(this.listeners("error").length){let n=new Error(i);n.type="TransportError",n.description=o,this.emit("error",n)}else K5("ignored transport error %s (%s)",i,o)}onPacket(i){this.emit("packet",i)}onData(i){this.onPacket(this.parser.decodePacket(i))}onClose(){this.readyState="closed",this.emit("close")}}U5.Transport=H5});var P$=P((u5)=>{Object.defineProperty(u5,"__esModule",{value:!0});u5.Polling=void 0;var KQ=Rc(),M5=Hi("zlib"),HQ=B0(),UQ=Go(),Fn=UQ.default("engine:polling"),ZQ={gzip:M5.createGzip,deflate:M5.createDeflate};class z5 extends KQ.Transport{constructor(i){super(i);this.closeTimeout=30000}get name(){return"polling"}onRequest(i){let o=i.res;if(i.res=null,i.method==="GET")this.onPollRequest(i,o);else if(i.method==="POST")this.onDataRequest(i,o);else o.writeHead(500),o.end()}onPollRequest(i,o){if(this.req){Fn("request overlap"),this.onError("overlap from client"),o.writeHead(400),o.end();return}Fn("setting request"),this.req=i,this.res=o;let n=()=>{this.onError("poll connection closed prematurely")},p=()=>{i.removeListener("close",n),this.req=this.res=null};if(i.cleanup=p,i.on("close",n),this.writable=!0,this.emit("ready"),this.writable&&this.shouldClose)Fn("triggering empty send to append close packet"),this.send([{type:"noop"}])}onDataRequest(i,o){if(this.dataReq){this.onError("data request overlap from client"),o.writeHead(400),o.end();return}let n=i.headers["content-type"]==="application/octet-stream";if(n&&this.protocol===4)return this.onError("invalid content");this.dataReq=i,this.dataRes=o;let p=n?Buffer.concat([]):"",c=()=>{i.removeListener("data",T),i.removeListener("end",m),i.removeListener("close",x),this.dataReq=this.dataRes=p=null},x=()=>{c(),this.onError("data request connection closed prematurely")},T=(f)=>{let F;if(n)p=Buffer.concat([p,f]),F=p.length;else p+=f,F=Buffer.byteLength(p);if(F>this.maxHttpBufferSize)o.writeHead(413).end(),c()},m=()=>{this.onData(p);let f={"Content-Type":"text/html","Content-Length":"2"};o.writeHead(200,this.headers(i,f)),o.end("ok"),c()};if(i.on("close",x),!n)i.setEncoding("utf8");i.on("data",T),i.on("end",m)}onData(i){Fn('received "%s"',i);let o=(n)=>{if(n.type==="close")return Fn("got xhr close packet"),this.onClose(),!1;this.onPacket(n)};if(this.protocol===3)this.parser.decodePayload(i,o);else this.parser.decodePayload(i).forEach(o)}onClose(){if(this.writable)this.send([{type:"noop"}]);super.onClose()}send(i){if(this.writable=!1,this.shouldClose)Fn("appending close packet to payload"),i.push({type:"close"}),this.shouldClose(),this.shouldClose=null;let o=(n)=>{let p=i.some((c)=>{return c.options&&c.options.compress});this.write(n,{compress:p})};if(this.protocol===3)this.parser.encodePayload(i,this.supportsBinary,o);else this.parser.encodePayload(i,o)}write(i,o){Fn('writing "%s"',i),this.doWrite(i,o,()=>{this.req.cleanup(),this.emit("drain")})}doWrite(i,o,n){let p=typeof i==="string",x={"Content-Type":p?"text/plain; charset=UTF-8":"application/octet-stream"},T=(F)=>{x["Content-Length"]=typeof F==="string"?Buffer.byteLength(F):F.length,this.res.writeHead(200,this.headers(this.req,x)),this.res.end(F),n()};if(!this.httpCompression||!o.compress){T(i);return}if((p?Buffer.byteLength(i):i.length)<this.httpCompression.threshold){T(i);return}let f=HQ(this.req).encodings(["gzip","deflate"]);if(!f){T(i);return}this.compress(i,f,(F,$)=>{if(F){this.res.writeHead(500),this.res.end(),n(F);return}x["Content-Encoding"]=f,T($)})}compress(i,o,n){Fn("compressing");let p=[],c=0;ZQ[o](this.httpCompression).on("error",n).on("data",function(x){p.push(x),c+=x.length}).on("end",function(){n(null,Buffer.concat(p,c))}).end(i)}doClose(i){Fn("closing");let o;if(this.dataReq)Fn("aborting ongoing data request"),this.dataReq.destroy();let n=()=>{clearTimeout(o),i(),this.onClose()};if(this.writable)Fn("transport writable - closing right away"),this.send([{type:"close"}]),n();else if(this.discarded)Fn("transport discarded - closing right away"),n();else Fn("transport not writable - buffering orderly close"),this.shouldClose=n,o=setTimeout(n,this.closeTimeout)}headers(i,o={}){let n=i.headers["user-agent"];if(n&&(~n.indexOf(";MSIE")||~n.indexOf("Trident/")))o["X-XSS-Protection"]="0";return o["cache-control"]="no-store",this.emit("headers",o,i),o}}u5.Polling=z5});var O5=P((S5)=>{Object.defineProperty(S5,"__esModule",{value:!0});S5.JSONP=void 0;var MQ=P$(),zQ=Hi("querystring"),uQ=/\\\\n/g,QQ=/(\\)?\\n/g;class V5 extends MQ.Polling{constructor(i){super(i);this.head="___eio["+(i._query.j||"").replace(/[^0-9]/g,"")+"](",this.foot=");"}onData(i){if(i=zQ.parse(i).d,typeof i==="string")i=i.replace(QQ,function(o,n){return n?o:`
33
+ `}),super.onData(i.replace(uQ,"\\n"))}doWrite(i,o,n){let p=JSON.stringify(i).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=this.head+p+this.foot,super.doWrite(i,o,n)}}S5.JSONP=V5});var D5=P((C5)=>{Object.defineProperty(C5,"__esModule",{value:!0});C5.WebSocket=void 0;var VQ=Rc(),SQ=Go(),_5=SQ.default("engine:ws");class L5 extends VQ.Transport{constructor(i){super(i);this._doSend=(o)=>{this.socket.send(o,this._onSent)},this._doSendLast=(o)=>{this.socket.send(o,this._onSentLast)},this._onSent=(o)=>{if(o)this.onError("write error",o.stack)},this._onSentLast=(o)=>{if(o)this.onError("write error",o.stack);else this.emit("drain"),this.writable=!0,this.emit("ready")},this.socket=i.websocket,this.socket.on("message",(o,n)=>{let p=n?o:o.toString();_5('received "%s"',p),super.onData(p)}),this.socket.once("close",this.onClose.bind(this)),this.socket.on("error",this.onError.bind(this)),this.writable=!0,this.perMessageDeflate=null}get name(){return"websocket"}get handlesUpgrades(){return!0}send(i){this.writable=!1;for(let o=0;o<i.length;o++){let n=i[o],p=o+1===i.length;if(this._canSendPreEncodedFrame(n))this.socket._sender.sendFrame(n.options.wsPreEncodedFrame,p?this._onSentLast:this._onSent);else this.parser.encodePacket(n,this.supportsBinary,p?this._doSendLast:this._doSend)}}_canSendPreEncodedFrame(i){var o,n,p;return!this.perMessageDeflate&&typeof((n=(o=this.socket)===null||o===void 0?void 0:o._sender)===null||n===void 0?void 0:n.sendFrame)==="function"&&((p=i.options)===null||p===void 0?void 0:p.wsPreEncodedFrame)!==void 0}doClose(i){_5("closing"),this.socket.close(),i&&i()}}C5.WebSocket=L5});var a$=P((B5)=>{Object.defineProperty(B5,"__esModule",{value:!0});B5.WebTransport=void 0;var EQ=Rc(),OQ=Go(),_Q=kT(),Ux=OQ.default("engine:webtransport");class I5 extends EQ.Transport{constructor(i,o,n){super({_query:{EIO:"4"}});this.session=i;let p=_Q.createPacketEncoderStream();p.readable.pipeTo(o.writable).catch(()=>{Ux("the stream was closed")}),this.writer=p.writable.getWriter(),(async()=>{try{while(!0){let{value:c,done:x}=await n.read();if(x){Ux("session is closed");break}Ux("received chunk: %o",c),this.onPacket(c)}}catch(c){Ux("error while reading: %s",c.message)}})(),i.closed.then(()=>this.onClose()),this.writable=!0}get name(){return"webtransport"}async send(i){this.writable=!1;try{for(let o=0;o<i.length;o++){let n=i[o];await this.writer.write(n)}}catch(o){Ux("error while writing: %s",o.message)}this.emit("drain"),this.writable=!0,this.emit("ready")}doClose(i){Ux("closing WebTransport session"),this.session.close(),i&&i()}}B5.WebTransport=I5});var l$=P((j5)=>{Object.defineProperty(j5,"__esModule",{value:!0});var LQ=P$(),CQ=O5(),yQ=D5(),DQ=a$();j5.default={polling:b5,websocket:yQ.WebSocket,webtransport:DQ.WebTransport};function b5(i){if(typeof i._query.j==="string")return new CQ.JSONP(i);else return new LQ.Polling(i)}b5.upgradesTo=["websocket","webtransport"]});var q$=P((a5)=>{Object.defineProperty(a5,"__esModule",{value:!0});a5.Socket=void 0;var BQ=Hi("events"),NQ=Go(),wp=Hi("timers"),ei=NQ.default("engine:socket");class P5 extends BQ.EventEmitter{get readyState(){return this._readyState}set readyState(i){ei("readyState updated from %s to %s",this._readyState,i),this._readyState=i}constructor(i,o,n,p,c){super();if(this._readyState="opening",this.upgrading=!1,this.upgraded=!1,this.writeBuffer=[],this.packetsFn=[],this.sentCallbackFn=[],this.cleanupFn=[],this.id=i,this.server=o,this.request=p,this.protocol=c,p)if(p.websocket&&p.websocket._socket)this.remoteAddress=p.websocket._socket.remoteAddress;else this.remoteAddress=p.connection.remoteAddress;this.pingTimeoutTimer=null,this.pingIntervalTimer=null,this.setTransport(n),this.onOpen()}onOpen(){if(this.readyState="open",this.transport.sid=this.id,this.sendPacket("open",JSON.stringify({sid:this.id,upgrades:this.getAvailableUpgrades(),pingInterval:this.server.opts.pingInterval,pingTimeout:this.server.opts.pingTimeout,maxPayload:this.server.opts.maxHttpBufferSize})),this.server.opts.initialPacket)this.sendPacket("message",this.server.opts.initialPacket);if(this.emit("open"),this.protocol===3)this.resetPingTimeout();else this.schedulePing()}onPacket(i){if(this.readyState!=="open")return ei("packet received with closed socket");switch(ei(`received packet ${i.type}`),this.emit("packet",i),i.type){case"ping":if(this.transport.protocol!==3){this.onError(new Error("invalid heartbeat direction"));return}ei("got ping"),this.pingTimeoutTimer.refresh(),this.sendPacket("pong"),this.emit("heartbeat");break;case"pong":if(this.transport.protocol===3){this.onError(new Error("invalid heartbeat direction"));return}ei("got pong"),wp.clearTimeout(this.pingTimeoutTimer),this.pingIntervalTimer.refresh(),this.emit("heartbeat");break;case"error":this.onClose("parse error");break;case"message":this.emit("data",i.data),this.emit("message",i.data);break}}onError(i){ei("transport error"),this.onClose("transport error",i)}schedulePing(){this.pingIntervalTimer=wp.setTimeout(()=>{ei("writing ping packet - expecting pong within %sms",this.server.opts.pingTimeout),this.sendPacket("ping"),this.resetPingTimeout()},this.server.opts.pingInterval)}resetPingTimeout(){wp.clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=wp.setTimeout(()=>{if(this.readyState==="closed")return;this.onClose("ping timeout")},this.protocol===3?this.server.opts.pingInterval+this.server.opts.pingTimeout:this.server.opts.pingTimeout)}setTransport(i){let o=this.onError.bind(this),n=()=>this.flush(),p=this.onPacket.bind(this),c=this.onDrain.bind(this),x=this.onClose.bind(this,"transport close");this.transport=i,this.transport.once("error",o),this.transport.on("ready",n),this.transport.on("packet",p),this.transport.on("drain",c),this.transport.once("close",x),this.cleanupFn.push(function(){i.removeListener("error",o),i.removeListener("ready",n),i.removeListener("packet",p),i.removeListener("drain",c),i.removeListener("close",x)})}onDrain(){if(this.sentCallbackFn.length>0){ei("executing batch send callback");let i=this.sentCallbackFn.shift();if(i)for(let o=0;o<i.length;o++)i[o](this.transport)}}_maybeUpgrade(i){ei('might upgrade socket transport from "%s" to "%s"',this.transport.name,i.name),this.upgrading=!0;let o=wp.setTimeout(()=>{if(ei("client did not complete upgrade - closing transport"),x(),i.readyState==="open")i.close()},this.server.opts.upgradeTimeout),n,p=(F)=>{if(F.type==="ping"&&F.data==="probe")ei("got probe ping packet, sending pong"),i.send([{type:"pong",data:"probe"}]),this.emit("upgrading",i),clearInterval(n),n=setInterval(c,100);else if(F.type==="upgrade"&&this.readyState!=="closed"){if(ei("got upgrade packet - upgrading"),x(),this.transport.discard(),this.upgraded=!0,this.clearTransport(),this.setTransport(i),this.emit("upgrade",i),this.flush(),this.readyState==="closing")i.close(()=>{this.onClose("forced close")})}else x(),i.close()},c=()=>{if(this.transport.name==="polling"&&this.transport.writable)ei("writing a noop packet to polling for fast upgrade"),this.transport.send([{type:"noop"}])},x=()=>{this.upgrading=!1,clearInterval(n),wp.clearTimeout(o),i.removeListener("packet",p),i.removeListener("close",m),i.removeListener("error",T),this.removeListener("close",f)},T=(F)=>{ei("client did not complete upgrade - %s",F),x(),i.close(),i=null},m=()=>{T("transport closed")},f=()=>{T("socket closed")};i.on("packet",p),i.once("close",m),i.once("error",T),this.once("close",f)}clearTransport(){let i,o=this.cleanupFn.length;for(let n=0;n<o;n++)i=this.cleanupFn.shift(),i();this.transport.on("error",function(){ei("error triggered by discarded transport")}),this.transport.close(),wp.clearTimeout(this.pingTimeoutTimer)}onClose(i,o){if(this.readyState!=="closed")this.readyState="closed",wp.clearTimeout(this.pingIntervalTimer),wp.clearTimeout(this.pingTimeoutTimer),process.nextTick(()=>{this.writeBuffer=[]}),this.packetsFn=[],this.sentCallbackFn=[],this.clearTransport(),this.emit("close",i,o)}send(i,o,n){return this.sendPacket("message",i,o,n),this}write(i,o,n){return this.sendPacket("message",i,o,n),this}sendPacket(i,o,n={},p){if(typeof n==="function")p=n,n={};if(this.readyState!=="closing"&&this.readyState!=="closed"){ei('sending packet "%s" (%s)',i,o),n.compress=n.compress!==!1;let c={type:i,options:n};if(o)c.data=o;if(this.emit("packetCreate",c),this.writeBuffer.push(c),typeof p==="function")this.packetsFn.push(p);this.flush()}}flush(){if(this.readyState!=="closed"&&this.transport.writable&&this.writeBuffer.length){ei("flushing buffer to transport"),this.emit("flush",this.writeBuffer),this.server.emit("flush",this,this.writeBuffer);let i=this.writeBuffer;if(this.writeBuffer=[],this.packetsFn.length)this.sentCallbackFn.push(this.packetsFn),this.packetsFn=[];else this.sentCallbackFn.push(null);this.transport.send(i),this.emit("drain"),this.server.emit("drain",this)}}getAvailableUpgrades(){let i=[],o=this.server.upgrades(this.transport.name);for(let n=0;n<o.length;++n){let p=o[n];if(this.server.opts.transports.indexOf(p)!==-1)i.push(p)}return i}close(i){if(i&&(this.readyState==="open"||this.readyState==="closing"))return this.closeTransport(i);if(this.readyState!=="open")return;if(this.readyState="closing",this.writeBuffer.length){ei("there are %d remaining packets in the buffer, waiting for the 'drain' event",this.writeBuffer.length),this.once("drain",()=>{ei("all packets have been sent, closing the transport"),this.closeTransport(i)});return}ei("the buffer is empty, closing the transport right away"),this.closeTransport(i)}closeTransport(i){if(ei("closing the transport (discard? %s)",!!i),i)this.transport.discard();this.transport.close(this.onClose.bind(this,"forced close"))}}a5.Socket=P5});var h5=P((dQ)=>{/*!
34
34
  * cookie
35
35
  * Copyright(c) 2012-2014 Roman Shtylman
36
36
  * Copyright(c) 2015 Douglas Christopher Wilson
37
37
  * MIT Licensed
38
- */XK.parse=FK;XK.serialize=_K;var cK=Object.prototype.toString,xK=Object.prototype.hasOwnProperty,UK=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,CK=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,TK=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,GK=/^[\u0020-\u003A\u003D-\u007E]*$/;function FK(H,A){if(typeof H!=="string")throw new TypeError("argument str must be a string");var L={},I=H.length;if(I<2)return L;var $=A&&A.decode||WK,f=0,E=0,D=0;do{if(E=H.indexOf("=",f),E===-1)break;if(D=H.indexOf(";",f),D===-1)D=I;else if(E>D){f=H.lastIndexOf(";",E-1)+1;continue}var M=AG(H,f,E),o=LG(H,E,M),u=H.slice(M,o);if(!xK.call(L,u)){var t=AG(H,E+1,D),i=LG(H,D,t);if(H.charCodeAt(t)===34&&H.charCodeAt(i-1)===34)t++,i--;var B=H.slice(t,i);L[u]=PK(B,$)}f=D+1}while(f<I);return L}function AG(H,A,L){do{var I=H.charCodeAt(A);if(I!==32&&I!==9)return A}while(++A<L);return L}function LG(H,A,L){while(A>L){var I=H.charCodeAt(--A);if(I!==32&&I!==9)return A+1}return L}function _K(H,A,L){var I=L&&L.encode||encodeURIComponent;if(typeof I!=="function")throw new TypeError("option encode is invalid");if(!UK.test(H))throw new TypeError("argument name is invalid");var $=I(A);if(!CK.test($))throw new TypeError("argument val is invalid");var f=H+"="+$;if(!L)return f;if(L.maxAge!=null){var E=Math.floor(L.maxAge);if(!isFinite(E))throw new TypeError("option maxAge is invalid");f+="; Max-Age="+E}if(L.domain){if(!TK.test(L.domain))throw new TypeError("option domain is invalid");f+="; Domain="+L.domain}if(L.path){if(!GK.test(L.path))throw new TypeError("option path is invalid");f+="; Path="+L.path}if(L.expires){var D=L.expires;if(!mK(D)||isNaN(D.valueOf()))throw new TypeError("option expires is invalid");f+="; Expires="+D.toUTCString()}if(L.httpOnly)f+="; HttpOnly";if(L.secure)f+="; Secure";if(L.partitioned)f+="; Partitioned";if(L.priority){var M=typeof L.priority==="string"?L.priority.toLowerCase():L.priority;switch(M){case"low":f+="; Priority=Low";break;case"medium":f+="; Priority=Medium";break;case"high":f+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(L.sameSite){var o=typeof L.sameSite==="string"?L.sameSite.toLowerCase():L.sameSite;switch(o){case!0:f+="; SameSite=Strict";break;case"lax":f+="; SameSite=Lax";break;case"strict":f+="; SameSite=Strict";break;case"none":f+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return f}function WK(H){return H.indexOf("%")!==-1?decodeURIComponent(H):H}function mK(H){return cK.call(H)==="[object Date]"}function PK(H,A){try{return A(H)}catch(L){return H}}});var EG=Q((ZIH,fG)=>{var $G=Object.getOwnPropertySymbols,VK=Object.prototype.hasOwnProperty,wK=Object.prototype.propertyIsEnumerable;function KK(H){if(H===null||H===void 0)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(H)}function vK(){try{if(!Object.assign)return!1;var H=new String("abc");if(H[5]="de",Object.getOwnPropertyNames(H)[0]==="5")return!1;var A={};for(var L=0;L<10;L++)A["_"+String.fromCharCode(L)]=L;var I=Object.getOwnPropertyNames(A).map(function(f){return A[f]});if(I.join("")!=="0123456789")return!1;var $={};if("abcdefghijklmnopqrst".split("").forEach(function(f){$[f]=f}),Object.keys(Object.assign({},$)).join("")!=="abcdefghijklmnopqrst")return!1;return!0}catch(f){return!1}}fG.exports=vK()?Object.assign:function(H,A){var L,I=KK(H),$;for(var f=1;f<arguments.length;f++){L=Object(arguments[f]);for(var E in L)if(VK.call(L,E))I[E]=L[E];if($G){$=$G(L);for(var D=0;D<$.length;D++)if(wK.call(L,$[D]))I[$[D]]=L[$[D]]}}return I}});var oG=Q((hIH,qt)=>{/*!
38
+ */dQ.parse=kQ;dQ.serialize=hQ;var bQ=Object.prototype.toString,jQ=Object.prototype.hasOwnProperty,PQ=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,aQ=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,lQ=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,qQ=/^[\u0020-\u003A\u003D-\u007E]*$/;function kQ(i,o){if(typeof i!=="string")throw new TypeError("argument str must be a string");var n={},p=i.length;if(p<2)return n;var c=o&&o.decode||gQ,x=0,T=0,m=0;do{if(T=i.indexOf("=",x),T===-1)break;if(m=i.indexOf(";",x),m===-1)m=p;else if(T>m){x=i.lastIndexOf(";",T-1)+1;continue}var f=q5(i,x,T),F=k5(i,T,f),$=i.slice(f,F);if(!jQ.call(n,$)){var J=q5(i,T+1,m),A=k5(i,m,J);if(i.charCodeAt(J)===34&&i.charCodeAt(A-1)===34)J++,A--;var X=i.slice(J,A);n[$]=tQ(X,c)}x=m+1}while(x<p);return n}function q5(i,o,n){do{var p=i.charCodeAt(o);if(p!==32&&p!==9)return o}while(++o<n);return n}function k5(i,o,n){while(o>n){var p=i.charCodeAt(--o);if(p!==32&&p!==9)return o+1}return n}function hQ(i,o,n){var p=n&&n.encode||encodeURIComponent;if(typeof p!=="function")throw new TypeError("option encode is invalid");if(!PQ.test(i))throw new TypeError("argument name is invalid");var c=p(o);if(!aQ.test(c))throw new TypeError("argument val is invalid");var x=i+"="+c;if(!n)return x;if(n.maxAge!=null){var T=Math.floor(n.maxAge);if(!isFinite(T))throw new TypeError("option maxAge is invalid");x+="; Max-Age="+T}if(n.domain){if(!lQ.test(n.domain))throw new TypeError("option domain is invalid");x+="; Domain="+n.domain}if(n.path){if(!qQ.test(n.path))throw new TypeError("option path is invalid");x+="; Path="+n.path}if(n.expires){var m=n.expires;if(!sQ(m)||isNaN(m.valueOf()))throw new TypeError("option expires is invalid");x+="; Expires="+m.toUTCString()}if(n.httpOnly)x+="; HttpOnly";if(n.secure)x+="; Secure";if(n.partitioned)x+="; Partitioned";if(n.priority){var f=typeof n.priority==="string"?n.priority.toLowerCase():n.priority;switch(f){case"low":x+="; Priority=Low";break;case"medium":x+="; Priority=Medium";break;case"high":x+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(n.sameSite){var F=typeof n.sameSite==="string"?n.sameSite.toLowerCase():n.sameSite;switch(F){case!0:x+="; SameSite=Strict";break;case"lax":x+="; SameSite=Lax";break;case"strict":x+="; SameSite=Strict";break;case"none":x+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return x}function gQ(i){return i.indexOf("%")!==-1?decodeURIComponent(i):i}function sQ(i){return bQ.call(i)==="[object Date]"}function tQ(i,o){try{return o(i)}catch(n){return i}}});var t5=P((mpi,s5)=>{var g5=Object.getOwnPropertySymbols,iV=Object.prototype.hasOwnProperty,oV=Object.prototype.propertyIsEnumerable;function nV(i){if(i===null||i===void 0)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function pV(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;var o={};for(var n=0;n<10;n++)o["_"+String.fromCharCode(n)]=n;var p=Object.getOwnPropertyNames(o).map(function(x){return o[x]});if(p.join("")!=="0123456789")return!1;var c={};if("abcdefghijklmnopqrst".split("").forEach(function(x){c[x]=x}),Object.keys(Object.assign({},c)).join("")!=="abcdefghijklmnopqrst")return!1;return!0}catch(x){return!1}}s5.exports=pV()?Object.assign:function(i,o){var n,p=nV(i),c;for(var x=1;x<arguments.length;x++){n=Object(arguments[x]);for(var T in n)if(iV.call(n,T))p[T]=n[T];if(g5){c=g5(n);for(var m=0;m<c.length;m++)if(oV.call(n,c[m]))p[c[m]]=n[c[m]]}}return p}});var e5=P((fpi,k$)=>{/*!
39
39
  * vary
40
40
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
41
41
  * MIT Licensed
42
- */qt.exports=lK;qt.exports.append=MG;var aK=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function MG(H,A){if(typeof H!=="string")throw new TypeError("header argument is required");if(!A)throw new TypeError("field argument is required");var L=!Array.isArray(A)?DG(String(A)):A;for(var I=0;I<L.length;I++)if(!aK.test(L[I]))throw new TypeError("field argument contains an invalid header name");if(H==="*")return H;var $=H,f=DG(H.toLowerCase());if(L.indexOf("*")!==-1||f.indexOf("*")!==-1)return"*";for(var E=0;E<L.length;E++){var D=L[E].toLowerCase();if(f.indexOf(D)===-1)f.push(D),$=$?$+", "+L[E]:L[E]}return $}function DG(H){var A=0,L=[],I=0;for(var $=0,f=H.length;$<f;$++)switch(H.charCodeAt($)){case 32:if(I===A)I=A=$+1;break;case 44:L.push(H.substring(I,A)),I=A=$+1;break;default:A=$+1;break}return L.push(H.substring(I,A)),L}function lK(H,A){if(!H||!H.getHeader||!H.setHeader)throw new TypeError("res argument is required");var L=H.getHeader("Vary")||"",I=Array.isArray(L)?L.join(", "):String(L);if(L=MG(I,A))H.setHeader("Vary",L)}});var gt=Q((rIH,uG)=>{(function(){var H=EG(),A=oG(),L={origin:"*",methods:"GET,HEAD,PUT,PATCH,POST,DELETE",preflightContinue:!1,optionsSuccessStatus:204};function I(U){return typeof U==="string"||U instanceof String}function $(U,x){if(Array.isArray(x)){for(var T=0;T<x.length;++T)if($(U,x[T]))return!0;return!1}else if(I(x))return U===x;else if(x instanceof RegExp)return x.test(U);else return!!x}function f(U,x){var T=x.headers.origin,F=[],m;if(!U.origin||U.origin==="*")F.push([{key:"Access-Control-Allow-Origin",value:"*"}]);else if(I(U.origin))F.push([{key:"Access-Control-Allow-Origin",value:U.origin}]),F.push([{key:"Vary",value:"Origin"}]);else m=$(T,U.origin),F.push([{key:"Access-Control-Allow-Origin",value:m?T:!1}]),F.push([{key:"Vary",value:"Origin"}]);return F}function E(U){var x=U.methods;if(x.join)x=U.methods.join(",");return{key:"Access-Control-Allow-Methods",value:x}}function D(U){if(U.credentials===!0)return{key:"Access-Control-Allow-Credentials",value:"true"};return null}function M(U,x){var T=U.allowedHeaders||U.headers,F=[];if(!T)T=x.headers["access-control-request-headers"],F.push([{key:"Vary",value:"Access-Control-Request-Headers"}]);else if(T.join)T=T.join(",");if(T&&T.length)F.push([{key:"Access-Control-Allow-Headers",value:T}]);return F}function o(U){var x=U.exposedHeaders;if(!x)return null;else if(x.join)x=x.join(",");if(x&&x.length)return{key:"Access-Control-Expose-Headers",value:x};return null}function u(U){var x=(typeof U.maxAge==="number"||U.maxAge)&&U.maxAge.toString();if(x&&x.length)return{key:"Access-Control-Max-Age",value:x};return null}function t(U,x){for(var T=0,F=U.length;T<F;T++){var m=U[T];if(m){if(Array.isArray(m))t(m,x);else if(m.key==="Vary"&&m.value)A(x,m.value);else if(m.value)x.setHeader(m.key,m.value)}}}function i(U,x,T,F){var m=[],Y=x.method&&x.method.toUpperCase&&x.method.toUpperCase();if(Y==="OPTIONS")if(m.push(f(U,x)),m.push(D(U,x)),m.push(E(U,x)),m.push(M(U,x)),m.push(u(U,x)),m.push(o(U,x)),t(m,T),U.preflightContinue)F();else T.statusCode=U.optionsSuccessStatus,T.setHeader("Content-Length","0"),T.end();else m.push(f(U,x)),m.push(D(U,x)),m.push(o(U,x)),t(m,T),F()}function B(U){var x=null;if(typeof U==="function")x=U;else x=function(T,F){F(null,U)};return function T(F,m,Y){x(F,function(W,P){if(W)Y(W);else{var V=H({},L,P),J=null;if(V.origin&&typeof V.origin==="function")J=V.origin;else if(V.origin)J=function(a,h){h(null,V.origin)};if(J)J(F.headers.origin,function(a,h){if(a||!h)Y(a);else V.origin=h,i(V,F,m,Y)});else Y()}})}}uG.exports=B})()});var et=Q((xG)=>{Object.defineProperty(xG,"__esModule",{value:!0});xG.Server=xG.BaseServer=void 0;var OK=O("querystring"),sK=O("url"),tG=at(),A1=kt(),NK=O("events"),iG=dt(),yK=TA(),RK=IG(),YK=O("ws"),pG=jt(),QK=jE(),EH=yK.default("engine"),mf=Symbol("responseHeaders");function zK(H){try{let A=JSON.parse(H);if(typeof A.sid==="string")return A.sid}catch(A){}}class dE extends NK.EventEmitter{constructor(H={}){super();if(this.middlewares=[],this.clients={},this.clientsCount=0,this.opts=Object.assign({wsEngine:YK.Server,pingTimeout:20000,pingInterval:25000,upgradeTimeout:1e4,maxHttpBufferSize:1e6,transports:["polling","websocket"],allowUpgrades:!0,httpCompression:{threshold:1024},cors:!1,allowEIO3:!1},H),H.cookie)this.opts.cookie=Object.assign({name:"io",path:"/",httpOnly:H.cookie.path!==!1,sameSite:"lax"},H.cookie);if(this.opts.cors)this.use(gt()(this.opts.cors));if(H.perMessageDeflate)this.opts.perMessageDeflate=Object.assign({threshold:1024},H.perMessageDeflate);this.init()}_computePath(H){let A=(H.path||"/engine.io").replace(/\/$/,"");if(H.addTrailingSlash!==!1)A+="/";return A}upgrades(H){if(!this.opts.allowUpgrades)return[];return A1.default[H].upgradesTo||[]}verify(H,A,L){let I=H._query.transport;if(!~this.opts.transports.indexOf(I)||I==="webtransport")return EH('unknown transport "%s"',I),L(JH.errors.UNKNOWN_TRANSPORT,{transport:I});if(bK(H.headers.origin)){let E=H.headers.origin;return H.headers.origin=null,EH("origin header invalid"),L(JH.errors.BAD_REQUEST,{name:"INVALID_ORIGIN",origin:E})}let f=H._query.sid;if(f){if(!this.clients.hasOwnProperty(f))return EH('unknown sid "%s"',f),L(JH.errors.UNKNOWN_SID,{sid:f});let E=this.clients[f].transport.name;if(!A&&E!==I)return EH("bad request: unexpected transport without upgrade"),L(JH.errors.BAD_REQUEST,{name:"TRANSPORT_MISMATCH",transport:I,previousTransport:E})}else{if(H.method!=="GET")return L(JH.errors.BAD_HANDSHAKE_METHOD,{method:H.method});if(I==="websocket"&&!A)return EH("invalid transport upgrade"),L(JH.errors.BAD_REQUEST,{name:"TRANSPORT_HANDSHAKE_ERROR"});if(!this.opts.allowRequest)return L();return this.opts.allowRequest(H,(E,D)=>{if(!D)return L(JH.errors.FORBIDDEN,{message:E});L()})}L()}use(H){this.middlewares.push(H)}_applyMiddlewares(H,A,L){if(this.middlewares.length===0)return EH("no middleware to apply, skipping"),L();let I=($)=>{EH("applying middleware n\xB0%d",$+1),this.middlewares[$](H,A,(f)=>{if(f)return L(f);if($+1<this.middlewares.length)I($+1);else L()})};I(0)}close(){EH("closing all open clients");for(let H in this.clients)if(this.clients.hasOwnProperty(H))this.clients[H].close(!0);return this.cleanup(),this}generateId(H){return tG.generateId()}async handshake(H,A,L){let I=A._query.EIO==="4"?4:3;if(I===3&&!this.opts.allowEIO3){EH("unsupported protocol version"),this.emit("connection_error",{req:A,code:JH.errors.UNSUPPORTED_PROTOCOL_VERSION,message:JH.errorMessages[JH.errors.UNSUPPORTED_PROTOCOL_VERSION],context:{protocol:I}}),L(JH.errors.UNSUPPORTED_PROTOCOL_VERSION);return}let $;try{$=await this.generateId(A)}catch(D){EH("error while generating an id"),this.emit("connection_error",{req:A,code:JH.errors.BAD_REQUEST,message:JH.errorMessages[JH.errors.BAD_REQUEST],context:{name:"ID_GENERATION_ERROR",error:D}}),L(JH.errors.BAD_REQUEST);return}EH('handshaking client "%s"',$);try{var f=this.createTransport(H,A);if(H==="polling")f.maxHttpBufferSize=this.opts.maxHttpBufferSize,f.httpCompression=this.opts.httpCompression;else if(H==="websocket")f.perMessageDeflate=this.opts.perMessageDeflate}catch(D){EH('error handshaking to transport "%s"',H),this.emit("connection_error",{req:A,code:JH.errors.BAD_REQUEST,message:JH.errorMessages[JH.errors.BAD_REQUEST],context:{name:"TRANSPORT_HANDSHAKE_ERROR",error:D}}),L(JH.errors.BAD_REQUEST);return}let E=new iG.Socket($,this,f,A,I);return f.on("headers",(D,M)=>{if(!M._query.sid){if(this.opts.cookie)D["Set-Cookie"]=[RK.serialize(this.opts.cookie.name,$,this.opts.cookie)];this.emit("initial_headers",D,M)}this.emit("headers",D,M)}),f.onRequest(A),this.clients[$]=E,this.clientsCount++,E.once("close",()=>{delete this.clients[$],this.clientsCount--}),this.emit("connection",E),f}async onWebTransportSession(H){let A=setTimeout(()=>{EH("the client failed to establish a bidirectional stream in the given period"),H.close()},this.opts.upgradeTimeout),I=await H.incomingBidirectionalStreams.getReader().read();if(I.done){EH("session is closed");return}let $=I.value,f=QK.createPacketDecoderStream(this.opts.maxHttpBufferSize,"nodebuffer"),E=$.readable.pipeThrough(f).getReader(),{value:D,done:M}=await E.read();if(M){EH("stream is closed");return}if(clearTimeout(A),D.type!=="open")return EH("invalid WebTransport handshake"),H.close();if(D.data===void 0){let t=new pG.WebTransport(H,$,E),i=tG.generateId();EH('handshaking client "%s" (WebTransport)',i);let B=new iG.Socket(i,this,t,null,4);this.clients[i]=B,this.clientsCount++,B.once("close",()=>{delete this.clients[i],this.clientsCount--}),this.emit("connection",B);return}let o=zK(D.data);if(!o)return EH("invalid WebTransport handshake"),H.close();let u=this.clients[o];if(!u)EH("upgrade attempt for closed client"),H.close();else if(u.upgrading)EH("transport has already been trying to upgrade"),H.close();else if(u.upgraded)EH("transport had already been upgraded"),H.close();else{EH("upgrading existing transport");let t=new pG.WebTransport(H,$,E);u._maybeUpgrade(t)}}}xG.BaseServer=dE;dE.errors={UNKNOWN_TRANSPORT:0,UNKNOWN_SID:1,BAD_HANDSHAKE_METHOD:2,BAD_REQUEST:3,FORBIDDEN:4,UNSUPPORTED_PROTOCOL_VERSION:5};dE.errorMessages={0:"Transport unknown",1:"Session ID unknown",2:"Bad handshake method",3:"Bad request",4:"Forbidden",5:"Unsupported protocol version"};class cG{constructor(H,A){this.req=H,this.socket=A,H[mf]={}}setHeader(H,A){this.req[mf][H]=A}getHeader(H){return this.req[mf][H]}removeHeader(H){delete this.req[mf][H]}write(){}writeHead(){}end(){this.socket.destroy()}}class JH extends dE{init(){if(!~this.opts.transports.indexOf("websocket"))return;if(this.ws)this.ws.close();if(this.ws=new this.opts.wsEngine({noServer:!0,clientTracking:!1,perMessageDeflate:this.opts.perMessageDeflate,maxPayload:this.opts.maxHttpBufferSize}),typeof this.ws.on==="function")this.ws.on("headers",(H,A)=>{let L=A[mf]||{};if(delete A[mf],!A._query.sid)this.emit("initial_headers",L,A);this.emit("headers",L,A),EH("writing headers: %j",L),Object.keys(L).forEach(($)=>{H.push(`${$}: ${L[$]}`)})})}cleanup(){if(this.ws)EH("closing webSocketServer"),this.ws.close()}prepare(H){if(!H._query)H._query=~H.url.indexOf("?")?OK.parse(sK.parse(H.url).query):{}}createTransport(H,A){return new A1.default[H](A)}handleRequest(H,A){EH('handling "%s" http request "%s"',H.method,H.url),this.prepare(H),H.res=A;let L=(I,$)=>{if(I!==void 0){this.emit("connection_error",{req:H,code:I,message:JH.errorMessages[I],context:$}),nG(A,I,$);return}if(H._query.sid)EH("setting new request for existing client"),this.clients[H._query.sid].transport.onRequest(H);else{let f=(E,D)=>nG(A,E,D);this.handshake(H._query.transport,H,f)}};this._applyMiddlewares(H,A,(I)=>{if(I)L(JH.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(H,!1,L)})}handleUpgrade(H,A,L){this.prepare(H);let I=new cG(H,A),$=(f,E)=>{if(f!==void 0){this.emit("connection_error",{req:H,code:f,message:JH.errorMessages[f],context:E}),BG(A,f,E);return}let D=Buffer.from(L);L=null,I.writeHead(),this.ws.handleUpgrade(H,A,D,(M)=>{this.onWebSocket(H,A,M)})};this._applyMiddlewares(H,I,(f)=>{if(f)$(JH.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(H,!0,$)})}onWebSocket(H,A,L){if(L.on("error",$),A1.default[H._query.transport]!==void 0&&!A1.default[H._query.transport].prototype.handlesUpgrades){EH("transport doesnt handle upgraded requests"),L.close();return}let I=H._query.sid;if(H.websocket=L,I){let f=this.clients[I];if(!f)EH("upgrade attempt for closed client"),L.close();else if(f.upgrading)EH("transport has already been trying to upgrade"),L.close();else if(f.upgraded)EH("transport had already been upgraded"),L.close();else{EH("upgrading existing transport"),L.removeListener("error",$);let E=this.createTransport(H._query.transport,H);E.perMessageDeflate=this.opts.perMessageDeflate,f._maybeUpgrade(E)}}else{let f=(E,D)=>BG(A,E,D);this.handshake(H._query.transport,H,f)}function $(){EH("websocket error before upgrade")}}attach(H,A={}){let L=this._computePath(A),I=A.destroyUpgradeTimeout||1000;function $(E){return L===E.url.slice(0,L.length)}let f=H.listeners("request").slice(0);if(H.removeAllListeners("request"),H.on("close",this.close.bind(this)),H.on("listening",this.init.bind(this)),H.on("request",(E,D)=>{if($(E))EH('intercepting request for path "%s"',L),this.handleRequest(E,D);else{let M=0,o=f.length;for(;M<o;M++)f[M].call(H,E,D)}}),~this.opts.transports.indexOf("websocket"))H.on("upgrade",(E,D,M)=>{if($(E))this.handleUpgrade(E,D,M);else if(A.destroyUpgrade!==!1)setTimeout(function(){if(D.writable&&D.bytesWritten<=0)return D.on("error",(o)=>{EH("error while destroying upgrade: %s",o.message)}),D.end()},I)})}}xG.Server=JH;function nG(H,A,L){let I=A===JH.errors.FORBIDDEN?403:400,$=L&&L.message?L.message:JH.errorMessages[A];H.writeHead(I,{"Content-Type":"application/json"}),H.end(JSON.stringify({code:A,message:$}))}function BG(H,A,L={}){if(H.on("error",()=>{EH("ignoring error from closed connection")}),H.writable){let I=L.message||JH.errorMessages[A],$=Buffer.byteLength(I);H.write(`HTTP/1.1 400 Bad Request\r
42
+ */k$.exports=xV;k$.exports.append=r5;var cV=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function r5(i,o){if(typeof i!=="string")throw new TypeError("header argument is required");if(!o)throw new TypeError("field argument is required");var n=!Array.isArray(o)?d5(String(o)):o;for(var p=0;p<n.length;p++)if(!cV.test(n[p]))throw new TypeError("field argument contains an invalid header name");if(i==="*")return i;var c=i,x=d5(i.toLowerCase());if(n.indexOf("*")!==-1||x.indexOf("*")!==-1)return"*";for(var T=0;T<n.length;T++){var m=n[T].toLowerCase();if(x.indexOf(m)===-1)x.push(m),c=c?c+", "+n[T]:n[T]}return c}function d5(i){var o=0,n=[],p=0;for(var c=0,x=i.length;c<x;c++)switch(i.charCodeAt(c)){case 32:if(p===o)p=o=c+1;break;case 44:n.push(i.substring(p,o)),p=o=c+1;break;default:o=c+1;break}return n.push(i.substring(p,o)),n}function xV(i,o){if(!i||!i.getHeader||!i.setHeader)throw new TypeError("res argument is required");var n=i.getHeader("Vary")||"",p=Array.isArray(n)?n.join(", "):String(n);if(n=r5(p,o))i.setHeader("Vary",n)}});var h$=P((Fpi,i9)=>{(function(){var i=t5(),o=e5(),n={origin:"*",methods:"GET,HEAD,PUT,PATCH,POST,DELETE",preflightContinue:!1,optionsSuccessStatus:204};function p(Y){return typeof Y==="string"||Y instanceof String}function c(Y,R){if(Array.isArray(R)){for(var K=0;K<R.length;++K)if(c(Y,R[K]))return!0;return!1}else if(p(R))return Y===R;else if(R instanceof RegExp)return R.test(Y);else return!!R}function x(Y,R){var K=R.headers.origin,U=[],z;if(!Y.origin||Y.origin==="*")U.push([{key:"Access-Control-Allow-Origin",value:"*"}]);else if(p(Y.origin))U.push([{key:"Access-Control-Allow-Origin",value:Y.origin}]),U.push([{key:"Vary",value:"Origin"}]);else z=c(K,Y.origin),U.push([{key:"Access-Control-Allow-Origin",value:z?K:!1}]),U.push([{key:"Vary",value:"Origin"}]);return U}function T(Y){var R=Y.methods;if(R.join)R=Y.methods.join(",");return{key:"Access-Control-Allow-Methods",value:R}}function m(Y){if(Y.credentials===!0)return{key:"Access-Control-Allow-Credentials",value:"true"};return null}function f(Y,R){var K=Y.allowedHeaders||Y.headers,U=[];if(!K)K=R.headers["access-control-request-headers"],U.push([{key:"Vary",value:"Access-Control-Request-Headers"}]);else if(K.join)K=K.join(",");if(K&&K.length)U.push([{key:"Access-Control-Allow-Headers",value:K}]);return U}function F(Y){var R=Y.exposedHeaders;if(!R)return null;else if(R.join)R=R.join(",");if(R&&R.length)return{key:"Access-Control-Expose-Headers",value:R};return null}function $(Y){var R=(typeof Y.maxAge==="number"||Y.maxAge)&&Y.maxAge.toString();if(R&&R.length)return{key:"Access-Control-Max-Age",value:R};return null}function J(Y,R){for(var K=0,U=Y.length;K<U;K++){var z=Y[K];if(z){if(Array.isArray(z))J(z,R);else if(z.key==="Vary"&&z.value)o(R,z.value);else if(z.value)R.setHeader(z.key,z.value)}}}function A(Y,R,K,U){var z=[],b=R.method&&R.method.toUpperCase&&R.method.toUpperCase();if(b==="OPTIONS")if(z.push(x(Y,R)),z.push(m(Y,R)),z.push(T(Y,R)),z.push(f(Y,R)),z.push($(Y,R)),z.push(F(Y,R)),J(z,K),Y.preflightContinue)U();else K.statusCode=Y.optionsSuccessStatus,K.setHeader("Content-Length","0"),K.end();else z.push(x(Y,R)),z.push(m(Y,R)),z.push(F(Y,R)),J(z,K),U()}function X(Y){var R=null;if(typeof Y==="function")R=Y;else R=function(K,U){U(null,Y)};return function K(U,z,b){R(U,function(M,u){if(M)b(M);else{var E=i({},n,u),S=null;if(E.origin&&typeof E.origin==="function")S=E.origin;else if(E.origin)S=function(C,q){q(null,E.origin)};if(S)S(U.headers.origin,function(C,q){if(C||!q)b(C);else E.origin=q,A(E,U,z,b)});else b()}})}}i9.exports=X})()});var g$=P((m9)=>{Object.defineProperty(m9,"__esModule",{value:!0});m9.Server=m9.BaseServer=void 0;var TV=Hi("querystring"),mV=Hi("url"),o9=S$(),r0=l$(),fV=Hi("events"),n9=q$(),FV=Go(),$V=h5(),JV=Hi("ws"),p9=a$(),AV=kT(),ci=FV.default("engine"),Zx=Symbol("responseHeaders");function vV(i){try{let o=JSON.parse(i);if(typeof o.sid==="string")return o.sid}catch(o){}}class gT extends fV.EventEmitter{constructor(i={}){super();if(this.middlewares=[],this.clients={},this.clientsCount=0,this.opts=Object.assign({wsEngine:JV.Server,pingTimeout:20000,pingInterval:25000,upgradeTimeout:1e4,maxHttpBufferSize:1e6,transports:["polling","websocket"],allowUpgrades:!0,httpCompression:{threshold:1024},cors:!1,allowEIO3:!1},i),i.cookie)this.opts.cookie=Object.assign({name:"io",path:"/",httpOnly:i.cookie.path!==!1,sameSite:"lax"},i.cookie);if(this.opts.cors)this.use(h$()(this.opts.cors));if(i.perMessageDeflate)this.opts.perMessageDeflate=Object.assign({threshold:1024},i.perMessageDeflate);this.init()}_computePath(i){let o=(i.path||"/engine.io").replace(/\/$/,"");if(i.addTrailingSlash!==!1)o+="/";return o}upgrades(i){if(!this.opts.allowUpgrades)return[];return r0.default[i].upgradesTo||[]}verify(i,o,n){let p=i._query.transport;if(!~this.opts.transports.indexOf(p)||p==="webtransport")return ci('unknown transport "%s"',p),n(Vi.errors.UNKNOWN_TRANSPORT,{transport:p});if(wV(i.headers.origin)){let T=i.headers.origin;return i.headers.origin=null,ci("origin header invalid"),n(Vi.errors.BAD_REQUEST,{name:"INVALID_ORIGIN",origin:T})}let x=i._query.sid;if(x){if(!this.clients.hasOwnProperty(x))return ci('unknown sid "%s"',x),n(Vi.errors.UNKNOWN_SID,{sid:x});let T=this.clients[x].transport.name;if(!o&&T!==p)return ci("bad request: unexpected transport without upgrade"),n(Vi.errors.BAD_REQUEST,{name:"TRANSPORT_MISMATCH",transport:p,previousTransport:T})}else{if(i.method!=="GET")return n(Vi.errors.BAD_HANDSHAKE_METHOD,{method:i.method});if(p==="websocket"&&!o)return ci("invalid transport upgrade"),n(Vi.errors.BAD_REQUEST,{name:"TRANSPORT_HANDSHAKE_ERROR"});if(!this.opts.allowRequest)return n();return this.opts.allowRequest(i,(T,m)=>{if(!m)return n(Vi.errors.FORBIDDEN,{message:T});n()})}n()}use(i){this.middlewares.push(i)}_applyMiddlewares(i,o,n){if(this.middlewares.length===0)return ci("no middleware to apply, skipping"),n();let p=(c)=>{ci("applying middleware n\xB0%d",c+1),this.middlewares[c](i,o,(x)=>{if(x)return n(x);if(c+1<this.middlewares.length)p(c+1);else n()})};p(0)}close(){ci("closing all open clients");for(let i in this.clients)if(this.clients.hasOwnProperty(i))this.clients[i].close(!0);return this.cleanup(),this}generateId(i){return o9.generateId()}async handshake(i,o,n){let p=o._query.EIO==="4"?4:3;if(p===3&&!this.opts.allowEIO3){ci("unsupported protocol version"),this.emit("connection_error",{req:o,code:Vi.errors.UNSUPPORTED_PROTOCOL_VERSION,message:Vi.errorMessages[Vi.errors.UNSUPPORTED_PROTOCOL_VERSION],context:{protocol:p}}),n(Vi.errors.UNSUPPORTED_PROTOCOL_VERSION);return}let c;try{c=await this.generateId(o)}catch(m){ci("error while generating an id"),this.emit("connection_error",{req:o,code:Vi.errors.BAD_REQUEST,message:Vi.errorMessages[Vi.errors.BAD_REQUEST],context:{name:"ID_GENERATION_ERROR",error:m}}),n(Vi.errors.BAD_REQUEST);return}ci('handshaking client "%s"',c);try{var x=this.createTransport(i,o);if(i==="polling")x.maxHttpBufferSize=this.opts.maxHttpBufferSize,x.httpCompression=this.opts.httpCompression;else if(i==="websocket")x.perMessageDeflate=this.opts.perMessageDeflate}catch(m){ci('error handshaking to transport "%s"',i),this.emit("connection_error",{req:o,code:Vi.errors.BAD_REQUEST,message:Vi.errorMessages[Vi.errors.BAD_REQUEST],context:{name:"TRANSPORT_HANDSHAKE_ERROR",error:m}}),n(Vi.errors.BAD_REQUEST);return}let T=new n9.Socket(c,this,x,o,p);return x.on("headers",(m,f)=>{if(!f._query.sid){if(this.opts.cookie)m["Set-Cookie"]=[$V.serialize(this.opts.cookie.name,c,this.opts.cookie)];this.emit("initial_headers",m,f)}this.emit("headers",m,f)}),x.onRequest(o),this.clients[c]=T,this.clientsCount++,T.once("close",()=>{delete this.clients[c],this.clientsCount--}),this.emit("connection",T),x}async onWebTransportSession(i){let o=setTimeout(()=>{ci("the client failed to establish a bidirectional stream in the given period"),i.close()},this.opts.upgradeTimeout),p=await i.incomingBidirectionalStreams.getReader().read();if(p.done){ci("session is closed");return}let c=p.value,x=AV.createPacketDecoderStream(this.opts.maxHttpBufferSize,"nodebuffer"),T=c.readable.pipeThrough(x).getReader(),{value:m,done:f}=await T.read();if(f){ci("stream is closed");return}if(clearTimeout(o),m.type!=="open")return ci("invalid WebTransport handshake"),i.close();if(m.data===void 0){let J=new p9.WebTransport(i,c,T),A=o9.generateId();ci('handshaking client "%s" (WebTransport)',A);let X=new n9.Socket(A,this,J,null,4);this.clients[A]=X,this.clientsCount++,X.once("close",()=>{delete this.clients[A],this.clientsCount--}),this.emit("connection",X);return}let F=vV(m.data);if(!F)return ci("invalid WebTransport handshake"),i.close();let $=this.clients[F];if(!$)ci("upgrade attempt for closed client"),i.close();else if($.upgrading)ci("transport has already been trying to upgrade"),i.close();else if($.upgraded)ci("transport had already been upgraded"),i.close();else{ci("upgrading existing transport");let J=new p9.WebTransport(i,c,T);$._maybeUpgrade(J)}}}m9.BaseServer=gT;gT.errors={UNKNOWN_TRANSPORT:0,UNKNOWN_SID:1,BAD_HANDSHAKE_METHOD:2,BAD_REQUEST:3,FORBIDDEN:4,UNSUPPORTED_PROTOCOL_VERSION:5};gT.errorMessages={0:"Transport unknown",1:"Session ID unknown",2:"Bad handshake method",3:"Bad request",4:"Forbidden",5:"Unsupported protocol version"};class T9{constructor(i,o){this.req=i,this.socket=o,i[Zx]={}}setHeader(i,o){this.req[Zx][i]=o}getHeader(i){return this.req[Zx][i]}removeHeader(i){delete this.req[Zx][i]}write(){}writeHead(){}end(){this.socket.destroy()}}class Vi extends gT{init(){if(!~this.opts.transports.indexOf("websocket"))return;if(this.ws)this.ws.close();if(this.ws=new this.opts.wsEngine({noServer:!0,clientTracking:!1,perMessageDeflate:this.opts.perMessageDeflate,maxPayload:this.opts.maxHttpBufferSize}),typeof this.ws.on==="function")this.ws.on("headers",(i,o)=>{let n=o[Zx]||{};if(delete o[Zx],!o._query.sid)this.emit("initial_headers",n,o);this.emit("headers",n,o),ci("writing headers: %j",n),Object.keys(n).forEach((c)=>{i.push(`${c}: ${n[c]}`)})})}cleanup(){if(this.ws)ci("closing webSocketServer"),this.ws.close()}prepare(i){if(!i._query)i._query=~i.url.indexOf("?")?TV.parse(mV.parse(i.url).query):{}}createTransport(i,o){return new r0.default[i](o)}handleRequest(i,o){ci('handling "%s" http request "%s"',i.method,i.url),this.prepare(i),i.res=o;let n=(p,c)=>{if(p!==void 0){this.emit("connection_error",{req:i,code:p,message:Vi.errorMessages[p],context:c}),c9(o,p,c);return}if(i._query.sid)ci("setting new request for existing client"),this.clients[i._query.sid].transport.onRequest(i);else{let x=(T,m)=>c9(o,T,m);this.handshake(i._query.transport,i,x)}};this._applyMiddlewares(i,o,(p)=>{if(p)n(Vi.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(i,!1,n)})}handleUpgrade(i,o,n){this.prepare(i);let p=new T9(i,o),c=(x,T)=>{if(x!==void 0){this.emit("connection_error",{req:i,code:x,message:Vi.errorMessages[x],context:T}),x9(o,x,T);return}let m=Buffer.from(n);n=null,p.writeHead(),this.ws.handleUpgrade(i,o,m,(f)=>{this.onWebSocket(i,o,f)})};this._applyMiddlewares(i,p,(x)=>{if(x)c(Vi.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(i,!0,c)})}onWebSocket(i,o,n){if(n.on("error",c),r0.default[i._query.transport]!==void 0&&!r0.default[i._query.transport].prototype.handlesUpgrades){ci("transport doesnt handle upgraded requests"),n.close();return}let p=i._query.sid;if(i.websocket=n,p){let x=this.clients[p];if(!x)ci("upgrade attempt for closed client"),n.close();else if(x.upgrading)ci("transport has already been trying to upgrade"),n.close();else if(x.upgraded)ci("transport had already been upgraded"),n.close();else{ci("upgrading existing transport"),n.removeListener("error",c);let T=this.createTransport(i._query.transport,i);T.perMessageDeflate=this.opts.perMessageDeflate,x._maybeUpgrade(T)}}else{let x=(T,m)=>x9(o,T,m);this.handshake(i._query.transport,i,x)}function c(){ci("websocket error before upgrade")}}attach(i,o={}){let n=this._computePath(o),p=o.destroyUpgradeTimeout||1000;function c(T){return n===T.url.slice(0,n.length)}let x=i.listeners("request").slice(0);if(i.removeAllListeners("request"),i.on("close",this.close.bind(this)),i.on("listening",this.init.bind(this)),i.on("request",(T,m)=>{if(c(T))ci('intercepting request for path "%s"',n),this.handleRequest(T,m);else{let f=0,F=x.length;for(;f<F;f++)x[f].call(i,T,m)}}),~this.opts.transports.indexOf("websocket"))i.on("upgrade",(T,m,f)=>{if(c(T))this.handleUpgrade(T,m,f);else if(o.destroyUpgrade!==!1)setTimeout(function(){if(m.writable&&m.bytesWritten<=0)return m.on("error",(F)=>{ci("error while destroying upgrade: %s",F.message)}),m.end()},p)})}}m9.Server=Vi;function c9(i,o,n){let p=o===Vi.errors.FORBIDDEN?403:400,c=n&&n.message?n.message:Vi.errorMessages[o];i.writeHead(p,{"Content-Type":"application/json"}),i.end(JSON.stringify({code:o,message:c}))}function x9(i,o,n={}){if(i.on("error",()=>{ci("ignoring error from closed connection")}),i.writable){let p=n.message||Vi.errorMessages[o],c=Buffer.byteLength(p);i.write(`HTTP/1.1 400 Bad Request\r
43
43
  Connection: close\r
44
44
  Content-type: text/html\r
45
- Content-Length: `+$+`\r
45
+ Content-Length: `+c+`\r
46
46
  \r
47
- `+I)}H.destroy()}var kE=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];function bK(H){if(H+="",H.length<1)return!1;if(!kE[H.charCodeAt(0)])return EH('invalid header, index 0, char "%s"',H.charCodeAt(0)),!0;if(H.length<2)return!1;if(!kE[H.charCodeAt(1)])return EH('invalid header, index 1, char "%s"',H.charCodeAt(1)),!0;if(H.length<3)return!1;if(!kE[H.charCodeAt(2)])return EH('invalid header, index 2, char "%s"',H.charCodeAt(2)),!0;if(H.length<4)return!1;if(!kE[H.charCodeAt(3)])return EH('invalid header, index 3, char "%s"',H.charCodeAt(3)),!0;for(let A=4;A<H.length;++A)if(!kE[H.charCodeAt(A)])return EH('invalid header, index "%i", char "%s"',A,H.charCodeAt(A)),!0;return!1}});var _G=Q((GG)=>{Object.defineProperty(GG,"__esModule",{value:!0});GG.Polling=void 0;var hK=U$(),CG=O("zlib"),rK=YM(),jK=TA(),WL=jK.default("engine:polling"),kK={gzip:CG.createGzip,deflate:CG.createDeflate};class TG extends hK.Transport{constructor(H){super(H);this.closeTimeout=30000}get name(){return"polling"}onRequest(H){let A=H.res;if(H.res=null,H.getMethod()==="get")this.onPollRequest(H,A);else if(H.getMethod()==="post")this.onDataRequest(H,A);else A.writeStatus("500 Internal Server Error"),A.end()}onPollRequest(H,A){if(this.req){WL("request overlap"),this.onError("overlap from client"),A.writeStatus("500 Internal Server Error"),A.end();return}WL("setting request"),this.req=H,this.res=A;let L=()=>{this.writable=!1,this.onError("poll connection closed prematurely")},I=()=>{this.req=this.res=null};if(H.cleanup=I,A.onAborted(L),this.writable=!0,this.emit("ready"),this.writable&&this.shouldClose)WL("triggering empty send to append close packet"),this.send([{type:"noop"}])}onDataRequest(H,A){if(this.dataReq){this.onError("data request overlap from client"),A.writeStatus("500 Internal Server Error"),A.end();return}let L=Number(H.headers["content-length"]);if(!L){this.onError("content-length header required"),A.writeStatus("411 Length Required").end();return}if(L>this.maxHttpBufferSize){this.onError("payload too large"),A.writeStatus("413 Payload Too Large").end();return}if(H.headers["content-type"]==="application/octet-stream"&&this.protocol===4)return this.onError("invalid content");this.dataReq=H,this.dataRes=A;let $,f=0,E={"Content-Type":"text/html"};this.headers(H,E);for(let M in E)A.writeHeader(M,String(E[M]));let D=(M)=>{this.onData(M.toString()),this.onDataRequestCleanup(),A.cork(()=>{A.end("ok")})};A.onAborted(()=>{this.onDataRequestCleanup(),this.onError("data request connection closed prematurely")}),A.onData((M,o)=>{let u=f+M.byteLength;if(u>L){this.onError("content-length mismatch"),A.close();return}if(!$){if(o){D(Buffer.from(M));return}$=Buffer.allocUnsafe(L)}if(Buffer.from(M).copy($,f),o){if(u!=L){this.onError("content-length mismatch"),A.writeStatus("400 Content-Length Mismatch").end(),this.onDataRequestCleanup();return}D($);return}f=u})}onDataRequestCleanup(){this.dataReq=this.dataRes=null}onData(H){WL('received "%s"',H);let A=(L)=>{if(L.type==="close")return WL("got xhr close packet"),this.onClose(),!1;this.onPacket(L)};if(this.protocol===3)this.parser.decodePayload(H,A);else this.parser.decodePayload(H).forEach(A)}onClose(){if(this.writable)this.send([{type:"noop"}]);super.onClose()}send(H){if(this.writable=!1,this.shouldClose)WL("appending close packet to payload"),H.push({type:"close"}),this.shouldClose(),this.shouldClose=null;let A=(L)=>{let I=H.some(($)=>{return $.options&&$.options.compress});this.write(L,{compress:I})};if(this.protocol===3)this.parser.encodePayload(H,this.supportsBinary,A);else this.parser.encodePayload(H,A)}write(H,A){WL('writing "%s"',H),this.doWrite(H,A,()=>{this.req.cleanup(),this.emit("drain")})}doWrite(H,A,L){let I=typeof H==="string",f={"Content-Type":I?"text/plain; charset=UTF-8":"application/octet-stream"},E=(o)=>{this.headers(this.req,f),this.res.cork(()=>{Object.keys(f).forEach((u)=>{this.res.writeHeader(u,String(f[u]))}),this.res.end(o)}),L()};if(!this.httpCompression||!A.compress){E(H);return}if((I?Buffer.byteLength(H):H.length)<this.httpCompression.threshold){E(H);return}let M=rK(this.req).encodings(["gzip","deflate"]);if(!M){E(H);return}this.compress(H,M,(o,u)=>{if(o){this.res.writeStatus("500 Internal Server Error"),this.res.end(),L(o);return}f["Content-Encoding"]=M,E(u)})}compress(H,A,L){WL("compressing");let I=[],$=0;kK[A](this.httpCompression).on("error",L).on("data",function(f){I.push(f),$+=f.length}).on("end",function(){L(null,Buffer.concat(I,$))}).end(H)}doClose(H){WL("closing");let A,L=()=>{clearTimeout(A),H(),this.onClose()};if(this.writable)WL("transport writable - closing right away"),this.send([{type:"close"}]),L();else if(this.discarded)WL("transport discarded - closing right away"),L();else WL("transport not writable - buffering orderly close"),this.shouldClose=L,A=setTimeout(L,this.closeTimeout)}headers(H,A){A=A||{};let L=H.headers["user-agent"];if(L&&(~L.indexOf(";MSIE")||~L.indexOf("Trident/")))A["X-XSS-Protection"]="0";return A["cache-control"]="no-store",this.emit("headers",A,H),A}}GG.Polling=TG});var SG=Q((PG)=>{Object.defineProperty(PG,"__esModule",{value:!0});PG.WebSocket=void 0;var dK=U$(),qK=TA(),WG=qK.default("engine:ws");class mG extends dK.Transport{constructor(H){super(H);this.writable=!1,this.perMessageDeflate=null}get name(){return"websocket"}get handlesUpgrades(){return!0}send(H){this.writable=!1;for(let A=0;A<H.length;A++){let L=H[A],I=A+1===H.length,$=(f)=>{let E=typeof f!=="string",D=this.perMessageDeflate&&Buffer.byteLength(f)>this.perMessageDeflate.threshold;if(WG('writing "%s"',f),this.socket.send(f,E,D),I)this.emit("drain"),this.writable=!0,this.emit("ready")};if(L.options&&typeof L.options.wsPreEncoded==="string")$(L.options.wsPreEncoded);else this.parser.encodePacket(L,this.supportsBinary,$)}}doClose(H){WG("closing"),H&&H(),this.socket.end()}}PG.WebSocket=mG});var VG=Q((JG)=>{Object.defineProperty(JG,"__esModule",{value:!0});var gK=_G(),eK=SG();JG.default={polling:gK.Polling,websocket:eK.WebSocket}});var lG=Q((vG)=>{Object.defineProperty(vG,"__esModule",{value:!0});vG.uServer=void 0;var Av=TA(),C$=et(),Lv=VG(),bI=Av.default("engine:uws");class wG extends C$.BaseServer{init(){}cleanup(){}prepare(H,A){H.method=H.getMethod().toUpperCase(),H.url=H.getUrl();let L=new URLSearchParams(H.getQuery());H._query=Object.fromEntries(L.entries()),H.headers={},H.forEach((I,$)=>{H.headers[I]=$}),H.connection={remoteAddress:Buffer.from(A.getRemoteAddressAsText()).toString()},A.onAborted(()=>{bI("response has been aborted")})}createTransport(H,A){return new Lv.default[H](A)}attach(H,A={}){let L=this._computePath(A);H.any(L,this.handleRequest.bind(this)).ws(L,{compression:A.compression,idleTimeout:A.idleTimeout,maxBackpressure:A.maxBackpressure,maxPayloadLength:this.opts.maxHttpBufferSize,upgrade:this.handleUpgrade.bind(this),open:(I)=>{let $=I.getUserData().transport;$.socket=I,$.writable=!0,$.emit("ready")},message:(I,$,f)=>{I.getUserData().transport.onData(f?$:Buffer.from($).toString())},close:(I,$,f)=>{I.getUserData().transport.onClose($,f)}})}_applyMiddlewares(H,A,L){if(this.middlewares.length===0)return L();H.res=new KG(A),super._applyMiddlewares(H,H.res,(I)=>{H.res.writeHead(),L(I)})}handleRequest(H,A){bI('handling "%s" http request "%s"',A.getMethod(),A.getUrl()),this.prepare(A,H),A.res=H;let L=(I,$)=>{if(I!==void 0){this.emit("connection_error",{req:A,code:I,message:C$.Server.errorMessages[I],context:$}),this.abortRequest(A.res,I,$);return}if(A._query.sid)bI("setting new request for existing client"),this.clients[A._query.sid].transport.onRequest(A);else{let f=(E,D)=>this.abortRequest(H,E,D);this.handshake(A._query.transport,A,f)}};this._applyMiddlewares(A,H,(I)=>{if(I)L(C$.Server.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(A,!1,L)})}handleUpgrade(H,A,L){bI("on upgrade"),this.prepare(A,H),A.res=H;let I=async($,f)=>{if($!==void 0){this.emit("connection_error",{req:A,code:$,message:C$.Server.errorMessages[$],context:f}),this.abortRequest(H,$,f);return}let E=A._query.sid,D;if(E){let M=this.clients[E];if(!M)return bI("upgrade attempt for closed client"),H.close();else if(M.upgrading)return bI("transport has already been trying to upgrade"),H.close();else if(M.upgraded)return bI("transport had already been upgraded"),H.close();else bI("upgrading existing transport"),D=this.createTransport(A._query.transport,A),M._maybeUpgrade(D)}else if(D=await this.handshake(A._query.transport,A,(M,o)=>this.abortRequest(H,M,o)),!D)return;A.res.writeStatus("101 Switching Protocols"),H.upgrade({transport:D},A.getHeader("sec-websocket-key"),A.getHeader("sec-websocket-protocol"),A.getHeader("sec-websocket-extensions"),L)};this._applyMiddlewares(A,H,($)=>{if($)I(C$.Server.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(A,!0,I)})}abortRequest(H,A,L){let I=A===C$.Server.errors.FORBIDDEN?"403 Forbidden":"400 Bad Request",$=L&&L.message?L.message:C$.Server.errorMessages[A];H.writeStatus(I),H.writeHeader("Content-Type","application/json"),H.end(JSON.stringify({code:A,message:$}))}}vG.uServer=wG;class KG{constructor(H){this.res=H,this.statusWritten=!1,this.headers=[],this.isAborted=!1}set statusCode(H){if(!H)return;this.writeStatus(H===200?"200 OK":"204 No Content")}writeHead(H){this.statusCode=H}setHeader(H,A){if(Array.isArray(A))A.forEach((L)=>{this.writeHeader(H,L)});else this.writeHeader(H,A)}removeHeader(){}getHeader(){}writeStatus(H){if(this.isAborted)return;return this.res.writeStatus(H),this.statusWritten=!0,this.writeBufferedHeaders(),this}writeHeader(H,A){if(this.isAborted)return;if(H==="Content-Length")return;if(this.statusWritten)this.res.writeHeader(H,A);else this.headers.push([H,A])}writeBufferedHeaders(){this.headers.forEach(([H,A])=>{this.res.writeHeader(H,A)})}end(H){if(this.isAborted)return;this.res.cork(()=>{if(!this.statusWritten)this.writeBufferedHeaders();this.res.end(H)})}onData(H){if(this.isAborted)return;this.res.onData(H)}onAborted(H){if(this.isAborted)return;this.res.onAborted(()=>{this.isAborted=!0,H()})}cork(H){if(this.isAborted)return;this.res.cork(H)}}});var RG=Q((Pf)=>{Object.defineProperty(Pf,"__esModule",{value:!0});Pf.protocol=Pf.Transport=Pf.Socket=Pf.uServer=Pf.parser=Pf.transports=Pf.Server=void 0;Pf.listen=Mv;Pf.attach=NG;var Iv=O("http"),OG=et();Object.defineProperty(Pf,"Server",{enumerable:!0,get:function(){return OG.Server}});var $v=kt();Pf.transports=$v.default;var sG=jE();Pf.parser=sG;var fv=lG();Object.defineProperty(Pf,"uServer",{enumerable:!0,get:function(){return fv.uServer}});var Ev=dt();Object.defineProperty(Pf,"Socket",{enumerable:!0,get:function(){return Ev.Socket}});var Dv=U$();Object.defineProperty(Pf,"Transport",{enumerable:!0,get:function(){return Dv.Transport}});Pf.protocol=sG.protocol;function Mv(H,A,L){if(typeof A==="function")L=A,A={};let I=Iv.createServer(function(f,E){E.writeHead(501),E.end("Not Implemented")}),$=NG(I,A);return $.httpServer=I,I.listen(H,L),$}function NG(H,A){let L=new OG.Server(A);return L.attach(H,A),L}});var YG=Q((nv)=>{nv.Emitter=zA;function zA(H){if(H)return pv(H)}function pv(H){for(var A in zA.prototype)H[A]=zA.prototype[A];return H}zA.prototype.on=zA.prototype.addEventListener=function(H,A){return this._callbacks=this._callbacks||{},(this._callbacks["$"+H]=this._callbacks["$"+H]||[]).push(A),this};zA.prototype.once=function(H,A){function L(){this.off(H,L),A.apply(this,arguments)}return L.fn=A,this.on(H,L),this};zA.prototype.off=zA.prototype.removeListener=zA.prototype.removeAllListeners=zA.prototype.removeEventListener=function(H,A){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var L=this._callbacks["$"+H];if(!L)return this;if(arguments.length==1)return delete this._callbacks["$"+H],this;var I;for(var $=0;$<L.length;$++)if(I=L[$],I===A||I.fn===A){L.splice($,1);break}if(L.length===0)delete this._callbacks["$"+H];return this};zA.prototype.emit=function(H){this._callbacks=this._callbacks||{};var A=new Array(arguments.length-1),L=this._callbacks["$"+H];for(var I=1;I<arguments.length;I++)A[I-1]=arguments[I];if(L){L=L.slice(0);for(var I=0,$=L.length;I<$;++I)L[I].apply(this,A)}return this};zA.prototype.emitReserved=zA.prototype.emit;zA.prototype.listeners=function(H){return this._callbacks=this._callbacks||{},this._callbacks["$"+H]||[]};zA.prototype.hasListeners=function(H){return!!this.listeners(H).length}});var Hi=Q((bG)=>{Object.defineProperty(bG,"__esModule",{value:!0});bG.hasBinary=bG.isBinary=void 0;var cv=typeof ArrayBuffer==="function",xv=(H)=>{return typeof ArrayBuffer.isView==="function"?ArrayBuffer.isView(H):H.buffer instanceof ArrayBuffer},QG=Object.prototype.toString,Uv=typeof Blob==="function"||typeof Blob!=="undefined"&&QG.call(Blob)==="[object BlobConstructor]",Cv=typeof File==="function"||typeof File!=="undefined"&&QG.call(File)==="[object FileConstructor]";function zG(H){return cv&&(H instanceof ArrayBuffer||xv(H))||Uv&&H instanceof Blob||Cv&&H instanceof File}bG.isBinary=zG;function L1(H,A){if(!H||typeof H!=="object")return!1;if(Array.isArray(H)){for(let L=0,I=H.length;L<I;L++)if(L1(H[L]))return!0;return!1}if(zG(H))return!0;if(H.toJSON&&typeof H.toJSON==="function"&&arguments.length===1)return L1(H.toJSON(),!0);for(let L in H)if(Object.prototype.hasOwnProperty.call(H,L)&&L1(H[L]))return!0;return!1}bG.hasBinary=L1});var jG=Q((hG)=>{Object.defineProperty(hG,"__esModule",{value:!0});hG.reconstructPacket=hG.deconstructPacket=void 0;var Gv=Hi();function Fv(H){let A=[],L=H.data,I=H;return I.data=Ai(L,A),I.attachments=A.length,{packet:I,buffers:A}}hG.deconstructPacket=Fv;function Ai(H,A){if(!H)return H;if(Gv.isBinary(H)){let L={_placeholder:!0,num:A.length};return A.push(H),L}else if(Array.isArray(H)){let L=new Array(H.length);for(let I=0;I<H.length;I++)L[I]=Ai(H[I],A);return L}else if(typeof H==="object"&&!(H instanceof Date)){let L={};for(let I in H)if(Object.prototype.hasOwnProperty.call(H,I))L[I]=Ai(H[I],A);return L}return H}function _v(H,A){return H.data=Li(H.data,A),delete H.attachments,H}hG.reconstructPacket=_v;function Li(H,A){if(!H)return H;if(H&&H._placeholder===!0)if(typeof H.num==="number"&&H.num>=0&&H.num<A.length)return A[H.num];else throw new Error("illegal attachments");else if(Array.isArray(H))for(let L=0;L<H.length;L++)H[L]=Li(H[L],A);else if(typeof H==="object"){for(let L in H)if(Object.prototype.hasOwnProperty.call(H,L))H[L]=Li(H[L],A)}return H}});var qE=Q((AF)=>{Object.defineProperty(AF,"__esModule",{value:!0});AF.Decoder=AF.Encoder=AF.PacketType=AF.protocol=void 0;var mv=YG(),qG=jG(),gG=Hi(),Pv=TA(),Ii=Pv.default("socket.io-parser"),Xv=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];AF.protocol=5;var dH;(function(H){H[H.CONNECT=0]="CONNECT",H[H.DISCONNECT=1]="DISCONNECT",H[H.EVENT=2]="EVENT",H[H.ACK=3]="ACK",H[H.CONNECT_ERROR=4]="CONNECT_ERROR",H[H.BINARY_EVENT=5]="BINARY_EVENT",H[H.BINARY_ACK=6]="BINARY_ACK"})(dH=AF.PacketType||(AF.PacketType={}));class eG{constructor(H){this.replacer=H}encode(H){if(Ii("encoding packet %j",H),H.type===dH.EVENT||H.type===dH.ACK){if(gG.hasBinary(H))return this.encodeAsBinary({type:H.type===dH.EVENT?dH.BINARY_EVENT:dH.BINARY_ACK,nsp:H.nsp,data:H.data,id:H.id})}return[this.encodeAsString(H)]}encodeAsString(H){let A=""+H.type;if(H.type===dH.BINARY_EVENT||H.type===dH.BINARY_ACK)A+=H.attachments+"-";if(H.nsp&&H.nsp!=="/")A+=H.nsp+",";if(H.id!=null)A+=H.id;if(H.data!=null)A+=JSON.stringify(H.data,this.replacer);return Ii("encoded %j as %s",H,A),A}encodeAsBinary(H){let A=qG.deconstructPacket(H),L=this.encodeAsString(A.packet),I=A.buffers;return I.unshift(L),I}}AF.Encoder=eG;function kG(H){return Object.prototype.toString.call(H)==="[object Object]"}class $i extends mv.Emitter{constructor(H){super();this.reviver=H}add(H){let A;if(typeof H==="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");A=this.decodeString(H);let L=A.type===dH.BINARY_EVENT;if(L||A.type===dH.BINARY_ACK){if(A.type=L?dH.EVENT:dH.ACK,this.reconstructor=new HF(A),A.attachments===0)super.emitReserved("decoded",A)}else super.emitReserved("decoded",A)}else if(gG.isBinary(H)||H.base64){if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");else if(A=this.reconstructor.takeBinaryData(H),A)this.reconstructor=null,super.emitReserved("decoded",A)}else throw new Error("Unknown type: "+H)}decodeString(H){let A=0,L={type:Number(H.charAt(0))};if(dH[L.type]===void 0)throw new Error("unknown packet type "+L.type);if(L.type===dH.BINARY_EVENT||L.type===dH.BINARY_ACK){let $=A+1;while(H.charAt(++A)!=="-"&&A!=H.length);let f=H.substring($,A);if(f!=Number(f)||H.charAt(A)!=="-")throw new Error("Illegal attachments");L.attachments=Number(f)}if(H.charAt(A+1)==="/"){let $=A+1;while(++A){if(H.charAt(A)===",")break;if(A===H.length)break}L.nsp=H.substring($,A)}else L.nsp="/";let I=H.charAt(A+1);if(I!==""&&Number(I)==I){let $=A+1;while(++A){let f=H.charAt(A);if(f==null||Number(f)!=f){--A;break}if(A===H.length)break}L.id=Number(H.substring($,A+1))}if(H.charAt(++A)){let $=this.tryParse(H.substr(A));if($i.isPayloadValid(L.type,$))L.data=$;else throw new Error("invalid payload")}return Ii("decoded %s as %j",H,L),L}tryParse(H){try{return JSON.parse(H,this.reviver)}catch(A){return!1}}static isPayloadValid(H,A){switch(H){case dH.CONNECT:return kG(A);case dH.DISCONNECT:return A===void 0;case dH.CONNECT_ERROR:return typeof A==="string"||kG(A);case dH.EVENT:case dH.BINARY_EVENT:return Array.isArray(A)&&(typeof A[0]==="number"||typeof A[0]==="string"&&Xv.indexOf(A[0])===-1);case dH.ACK:case dH.BINARY_ACK:return Array.isArray(A)}}destroy(){if(this.reconstructor)this.reconstructor.finishedReconstruction(),this.reconstructor=null}}AF.Decoder=$i;class HF{constructor(H){this.packet=H,this.buffers=[],this.reconPack=H}takeBinaryData(H){if(this.buffers.push(H),this.buffers.length===this.reconPack.attachments){let A=qG.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),A}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}});var EF=Q(($F)=>{Object.defineProperty($F,"__esModule",{value:!0});$F.Client=void 0;var I1=qE(),Vv=TA(),wv=O("url"),yL=Vv("socket.io:client");class IF{constructor(H,A){this.sockets=new Map,this.nsps=new Map,this.server=H,this.conn=A,this.encoder=H.encoder,this.decoder=new H._parser.Decoder,this.id=A.id,this.setup()}get request(){return this.conn.request}setup(){this.onclose=this.onclose.bind(this),this.ondata=this.ondata.bind(this),this.onerror=this.onerror.bind(this),this.ondecoded=this.ondecoded.bind(this),this.decoder.on("decoded",this.ondecoded),this.conn.on("data",this.ondata),this.conn.on("error",this.onerror),this.conn.on("close",this.onclose),this.connectTimeout=setTimeout(()=>{if(this.nsps.size===0)yL("no namespace joined yet, close the client"),this.close();else yL("the client has already joined a namespace, nothing to do")},this.server._connectTimeout)}connect(H,A={}){if(this.server._nsps.has(H))return yL("connecting to namespace %s",H),this.doConnect(H,A);this.server._checkNamespace(H,A,(L)=>{if(L)this.doConnect(H,A);else yL("creation of namespace %s was denied",H),this._packet({type:I1.PacketType.CONNECT_ERROR,nsp:H,data:{message:"Invalid namespace"}})})}doConnect(H,A){let L=this.server.of(H);L._add(this,A,(I)=>{if(this.sockets.set(I.id,I),this.nsps.set(L.name,I),this.connectTimeout)clearTimeout(this.connectTimeout),this.connectTimeout=void 0})}_disconnect(){for(let H of this.sockets.values())H.disconnect();this.sockets.clear(),this.close()}_remove(H){if(this.sockets.has(H.id)){let A=this.sockets.get(H.id).nsp.name;this.sockets.delete(H.id),this.nsps.delete(A)}else yL("ignoring remove for %s",H.id)}close(){if(this.conn.readyState==="open")yL("forcing transport close"),this.conn.close(),this.onclose("forced server close")}_packet(H,A={}){if(this.conn.readyState!=="open"){yL("ignoring packet write %j",H);return}let L=A.preEncoded?H:this.encoder.encode(H);this.writeToEngine(L,A)}writeToEngine(H,A){if(A.volatile&&!this.conn.transport.writable){yL("volatile packet is discarded since the transport is not currently writable");return}let L=Array.isArray(H)?H:[H];for(let I of L)this.conn.write(I,A)}ondata(H){try{this.decoder.add(H)}catch(A){yL("invalid packet format"),this.onerror(A)}}ondecoded(H){let A,L;if(this.conn.protocol===3){let $=wv.parse(H.nsp,!0);A=$.pathname,L=$.query}else A=H.nsp,L=H.data;let I=this.nsps.get(A);if(!I&&H.type===I1.PacketType.CONNECT)this.connect(A,L);else if(I&&H.type!==I1.PacketType.CONNECT&&H.type!==I1.PacketType.CONNECT_ERROR)process.nextTick(function(){I._onpacket(H)});else yL("invalid state (packet type: %s)",H.type),this.close()}onerror(H){for(let A of this.sockets.values())A._onerror(H);this.conn.close()}onclose(H,A){yL("client close with reason %s",H),this.destroy();for(let L of this.sockets.values())L._onclose(H,A);this.sockets.clear(),this.decoder.destroy()}destroy(){if(this.conn.removeListener("data",this.ondata),this.conn.removeListener("error",this.onerror),this.conn.removeListener("close",this.onclose),this.decoder.removeListener("decoded",this.ondecoded),this.connectTimeout)clearTimeout(this.connectTimeout),this.connectTimeout=void 0}}$F.Client=IF});var $1=Q((MF)=>{Object.defineProperty(MF,"__esModule",{value:!0});MF.StrictEventEmitter=void 0;var Kv=O("events");class DF extends Kv.EventEmitter{on(H,A){return super.on(H,A)}once(H,A){return super.once(H,A)}emit(H,...A){return super.emit(H,...A)}emitReserved(H,...A){return super.emit(H,...A)}emitUntyped(H,...A){return super.emit(H,...A)}listeners(H){return super.listeners(H)}}MF.StrictEventEmitter=DF});var fi=Q((uF)=>{Object.defineProperty(uF,"__esModule",{value:!0});uF.RESERVED_EVENTS=void 0;uF.RESERVED_EVENTS=new Set(["connect","connect_error","disconnect","disconnecting","newListener","removeListener"])});var Di=Q((iF)=>{Object.defineProperty(iF,"__esModule",{value:!0});iF.RemoteSocket=iF.BroadcastOperator=void 0;var vv=fi(),av=qE();class BI{constructor(H,A=new Set,L=new Set,I={}){this.adapter=H,this.rooms=A,this.exceptRooms=L,this.flags=I}to(H){let A=new Set(this.rooms);if(Array.isArray(H))H.forEach((L)=>A.add(L));else A.add(H);return new BI(this.adapter,A,this.exceptRooms,this.flags)}in(H){return this.to(H)}except(H){let A=new Set(this.exceptRooms);if(Array.isArray(H))H.forEach((L)=>A.add(L));else A.add(H);return new BI(this.adapter,this.rooms,A,this.flags)}compress(H){let A=Object.assign({},this.flags,{compress:H});return new BI(this.adapter,this.rooms,this.exceptRooms,A)}get volatile(){let H=Object.assign({},this.flags,{volatile:!0});return new BI(this.adapter,this.rooms,this.exceptRooms,H)}get local(){let H=Object.assign({},this.flags,{local:!0});return new BI(this.adapter,this.rooms,this.exceptRooms,H)}timeout(H){let A=Object.assign({},this.flags,{timeout:H});return new BI(this.adapter,this.rooms,this.exceptRooms,A)}emit(H,...A){if(vv.RESERVED_EVENTS.has(H))throw new Error(`"${String(H)}" is a reserved event name`);let L=[H,...A],I={type:av.PacketType.EVENT,data:L};if(typeof L[L.length-1]!=="function")return this.adapter.broadcast(I,{rooms:this.rooms,except:this.exceptRooms,flags:this.flags}),!0;let f=L.pop(),E=!1,D=[],M=setTimeout(()=>{E=!0,f.apply(this,[new Error("operation has timed out"),this.flags.expectSingleResponse?null:D])},this.flags.timeout),o=-1,u=0,t=0,i=()=>{if(!E&&o===u&&D.length===t)clearTimeout(M),f.apply(this,[null,this.flags.expectSingleResponse?D[0]:D])};return this.adapter.broadcastWithAck(I,{rooms:this.rooms,except:this.exceptRooms,flags:this.flags},(B)=>{t+=B,u++,i()},(B)=>{D.push(B),i()}),this.adapter.serverCount().then((B)=>{o=B,i()}),!0}emitWithAck(H,...A){return new Promise((L,I)=>{A.push(($,f)=>{if($)return $.responses=f,I($);else return L(f)}),this.emit(H,...A)})}allSockets(){if(!this.adapter)throw new Error("No adapter for this namespace, are you trying to get the list of clients of a dynamic namespace?");return this.adapter.sockets(this.rooms)}fetchSockets(){return this.adapter.fetchSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags}).then((H)=>{return H.map((A)=>{if(A.server)return A;else return new Ei(this.adapter,A)})})}socketsJoin(H){this.adapter.addSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},Array.isArray(H)?H:[H])}socketsLeave(H){this.adapter.delSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},Array.isArray(H)?H:[H])}disconnectSockets(H=!1){this.adapter.disconnectSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},H)}}iF.BroadcastOperator=BI;class Ei{constructor(H,A){this.id=A.id,this.handshake=A.handshake,this.rooms=new Set(A.rooms),this.data=A.data,this.operator=new BI(H,new Set([this.id]),new Set,{expectSingleResponse:!0})}timeout(H){return this.operator.timeout(H)}emit(H,...A){return this.operator.emit(H,...A)}join(H){return this.operator.socketsJoin(H)}leave(H){return this.operator.socketsLeave(H)}disconnect(H=!1){return this.operator.disconnectSockets(H),this}}iF.RemoteSocket=Ei});var Mi=Q((Xf)=>{var cF=Xf&&Xf.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(Xf,"__esModule",{value:!0});Xf.Socket=void 0;var mL=qE(),Ov=cF(TA()),sv=$1(),nF=cF(at()),Nv=Di(),yv=fi(),OA=Ov.default("socket.io:socket"),Rv=new Set(["transport error","transport close","forced close","ping timeout","server shutting down","forced server close"]);function BF(){}class xF extends sv.StrictEventEmitter{constructor(H,A,L,I){super();if(this.nsp=H,this.client=A,this.recovered=!1,this.data={},this.connected=!1,this.acks=new Map,this.fns=[],this.flags={},this.server=H.server,this.adapter=this.nsp.adapter,I)this.id=I.sid,this.pid=I.pid,I.rooms.forEach(($)=>this.join($)),this.data=I.data,I.missedPackets.forEach(($)=>{this.packet({type:mL.PacketType.EVENT,data:$})}),this.recovered=!0;else{if(A.conn.protocol===3)this.id=H.name!=="/"?H.name+"#"+A.id:A.id;else this.id=nF.default.generateId();if(this.server._opts.connectionStateRecovery)this.pid=nF.default.generateId()}this.handshake=this.buildHandshake(L),this.on("error",BF)}buildHandshake(H){var A,L,I,$;return{headers:((A=this.request)===null||A===void 0?void 0:A.headers)||{},time:new Date+"",address:this.conn.remoteAddress,xdomain:!!((L=this.request)===null||L===void 0?void 0:L.headers.origin),secure:!this.request||!!this.request.connection.encrypted,issued:+new Date,url:(I=this.request)===null||I===void 0?void 0:I.url,query:(($=this.request)===null||$===void 0?void 0:$._query)||{},auth:H}}emit(H,...A){if(yv.RESERVED_EVENTS.has(H))throw new Error(`"${String(H)}" is a reserved event name`);let L=[H,...A],I={type:mL.PacketType.EVENT,data:L};if(typeof L[L.length-1]==="function"){let f=this.nsp._ids++;OA("emitting packet with ack id %d",f),this.registerAckCallback(f,L.pop()),I.id=f}let $=Object.assign({},this.flags);if(this.flags={},this.nsp.server.opts.connectionStateRecovery)this.adapter.broadcast(I,{rooms:new Set([this.id]),except:new Set,flags:$});else this.notifyOutgoingListeners(I),this.packet(I,$);return!0}emitWithAck(H,...A){let L=this.flags.timeout!==void 0;return new Promise((I,$)=>{A.push((f,E)=>{if(L)return f?$(f):I(E);else return I(f)}),this.emit(H,...A)})}registerAckCallback(H,A){let L=this.flags.timeout;if(L===void 0){this.acks.set(H,A);return}let I=setTimeout(()=>{OA("event with ack id %d has timed out after %d ms",H,L),this.acks.delete(H),A.call(this,new Error("operation has timed out"))},L);this.acks.set(H,(...$)=>{clearTimeout(I),A.apply(this,[null,...$])})}to(H){return this.newBroadcastOperator().to(H)}in(H){return this.newBroadcastOperator().in(H)}except(H){return this.newBroadcastOperator().except(H)}send(...H){return this.emit("message",...H),this}write(...H){return this.emit("message",...H),this}packet(H,A={}){H.nsp=this.nsp.name,A.compress=A.compress!==!1,this.client._packet(H,A)}join(H){return OA("join room %s",H),this.adapter.addAll(this.id,new Set(Array.isArray(H)?H:[H]))}leave(H){return OA("leave room %s",H),this.adapter.del(this.id,H)}leaveAll(){this.adapter.delAll(this.id)}_onconnect(){if(OA("socket connected - writing packet"),this.connected=!0,this.join(this.id),this.conn.protocol===3)this.packet({type:mL.PacketType.CONNECT});else this.packet({type:mL.PacketType.CONNECT,data:{sid:this.id,pid:this.pid}})}_onpacket(H){switch(OA("got packet %j",H),H.type){case mL.PacketType.EVENT:this.onevent(H);break;case mL.PacketType.BINARY_EVENT:this.onevent(H);break;case mL.PacketType.ACK:this.onack(H);break;case mL.PacketType.BINARY_ACK:this.onack(H);break;case mL.PacketType.DISCONNECT:this.ondisconnect();break}}onevent(H){let A=H.data||[];if(OA("emitting event %j",A),H.id!=null)OA("attaching ack callback to event"),A.push(this.ack(H.id));if(this._anyListeners&&this._anyListeners.length){let L=this._anyListeners.slice();for(let I of L)I.apply(this,A)}this.dispatch(A)}ack(H){let A=this,L=!1;return function(){if(L)return;let I=Array.prototype.slice.call(arguments);OA("sending ack %j",I),A.packet({id:H,type:mL.PacketType.ACK,data:I}),L=!0}}onack(H){let A=this.acks.get(H.id);if(typeof A=="function")OA("calling ack %s with %j",H.id,H.data),A.apply(this,H.data),this.acks.delete(H.id);else OA("bad ack %s",H.id)}ondisconnect(){OA("got disconnect packet"),this._onclose("client namespace disconnect")}_onerror(H){this.emitReserved("error",H)}_onclose(H,A){if(!this.connected)return this;if(OA("closing socket - reason %s",H),this.emitReserved("disconnecting",H,A),this.server._opts.connectionStateRecovery&&Rv.has(H))OA("connection state recovery is enabled for sid %s",this.id),this.adapter.persistSession({sid:this.id,pid:this.pid,rooms:[...this.rooms],data:this.data});this._cleanup(),this.client._remove(this),this.connected=!1,this.emitReserved("disconnect",H,A);return}_cleanup(){this.leaveAll(),this.nsp._remove(this),this.join=BF}_error(H){this.packet({type:mL.PacketType.CONNECT_ERROR,data:H})}disconnect(H=!1){if(!this.connected)return this;if(H)this.client._disconnect();else this.packet({type:mL.PacketType.DISCONNECT}),this._onclose("server namespace disconnect");return this}compress(H){return this.flags.compress=H,this}get volatile(){return this.flags.volatile=!0,this}get broadcast(){return this.newBroadcastOperator()}get local(){return this.newBroadcastOperator().local}timeout(H){return this.flags.timeout=H,this}dispatch(H){OA("dispatching an event %j",H),this.run(H,(A)=>{process.nextTick(()=>{if(A)return this._onerror(A);if(this.connected)super.emitUntyped.apply(this,H);else OA("ignore packet received after disconnection")})})}use(H){return this.fns.push(H),this}run(H,A){if(!this.fns.length)return A();let L=this.fns.slice(0);function I($){L[$](H,(f)=>{if(f)return A(f);if(!L[$+1])return A();I($+1)})}I(0)}get disconnected(){return!this.connected}get request(){return this.client.request}get conn(){return this.client.conn}get rooms(){return this.adapter.socketRooms(this.id)||new Set}onAny(H){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(H),this}prependAny(H){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(H),this}offAny(H){if(!this._anyListeners)return this;if(H){let A=this._anyListeners;for(let L=0;L<A.length;L++)if(H===A[L])return A.splice(L,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(H){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(H),this}prependAnyOutgoing(H){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(H),this}offAnyOutgoing(H){if(!this._anyOutgoingListeners)return this;if(H){let A=this._anyOutgoingListeners;for(let L=0;L<A.length;L++)if(H===A[L])return A.splice(L,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(H){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let A=this._anyOutgoingListeners.slice();for(let L of A)L.apply(this,H.data)}}newBroadcastOperator(){let H=Object.assign({},this.flags);return this.flags={},new Nv.BroadcastOperator(this.adapter,new Set,new Set([this.id]),H)}}Xf.Socket=xF});var oi=Q((cI)=>{var Yv=cI&&cI.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(cI,"__esModule",{value:!0});cI.Namespace=cI.RESERVED_EVENTS=void 0;var UF=Mi(),Qv=$1(),zv=Yv(TA()),uL=Di(),gE=zv.default("socket.io:namespace");cI.RESERVED_EVENTS=new Set(["connect","connection","new_namespace"]);class CF extends Qv.StrictEventEmitter{constructor(H,A){super();this.sockets=new Map,this._preConnectSockets=new Map,this._fns=[],this._ids=0,this.server=H,this.name=A,this._initAdapter()}_initAdapter(){this.adapter=new(this.server.adapter())(this)}use(H){return this._fns.push(H),this}run(H,A){if(!this._fns.length)return A();let L=this._fns.slice(0);function I($){L[$](H,(f)=>{if(f)return A(f);if(!L[$+1])return A();I($+1)})}I(0)}to(H){return new uL.BroadcastOperator(this.adapter).to(H)}in(H){return new uL.BroadcastOperator(this.adapter).in(H)}except(H){return new uL.BroadcastOperator(this.adapter).except(H)}async _add(H,A,L){var I;gE("adding socket to nsp %s",this.name);let $=await this._createSocket(H,A);if(this._preConnectSockets.set($.id,$),((I=this.server.opts.connectionStateRecovery)===null||I===void 0?void 0:I.skipMiddlewares)&&$.recovered&&H.conn.readyState==="open")return this._doConnect($,L);this.run($,(f)=>{process.nextTick(()=>{if(H.conn.readyState!=="open"){gE("next called after client was closed - ignoring socket"),$._cleanup();return}if(f)if(gE("middleware error, sending CONNECT_ERROR packet to the client"),$._cleanup(),H.conn.protocol===3)return $._error(f.data||f.message);else return $._error({message:f.message,data:f.data});this._doConnect($,L)})})}async _createSocket(H,A){let{pid:L,offset:I}=A;if(this.server.opts.connectionStateRecovery&&typeof L==="string"&&typeof I==="string"){let $;try{$=await this.adapter.restoreSession(L,I)}catch(f){gE("error while restoring session: %s",f)}if($)return gE("connection state recovered for sid %s",$.sid),new UF.Socket(this,H,A,$)}return new UF.Socket(this,H,A)}_doConnect(H,A){if(this._preConnectSockets.delete(H.id),this.sockets.set(H.id,H),H._onconnect(),A)A(H);this.emitReserved("connect",H),this.emitReserved("connection",H)}_remove(H){this.sockets.delete(H.id)||this._preConnectSockets.delete(H.id)}emit(H,...A){return new uL.BroadcastOperator(this.adapter).emit(H,...A)}send(...H){return this.emit("message",...H),this}write(...H){return this.emit("message",...H),this}serverSideEmit(H,...A){if(cI.RESERVED_EVENTS.has(H))throw new Error(`"${String(H)}" is a reserved event name`);return A.unshift(H),this.adapter.serverSideEmit(A),!0}serverSideEmitWithAck(H,...A){return new Promise((L,I)=>{A.push(($,f)=>{if($)return $.responses=f,I($);else return L(f)}),this.serverSideEmit(H,...A)})}_onServerSideEmit(H){super.emitUntyped.apply(this,H)}allSockets(){return new uL.BroadcastOperator(this.adapter).allSockets()}compress(H){return new uL.BroadcastOperator(this.adapter).compress(H)}get volatile(){return new uL.BroadcastOperator(this.adapter).volatile}get local(){return new uL.BroadcastOperator(this.adapter).local}timeout(H){return new uL.BroadcastOperator(this.adapter).timeout(H)}fetchSockets(){return new uL.BroadcastOperator(this.adapter).fetchSockets()}socketsJoin(H){return new uL.BroadcastOperator(this.adapter).socketsJoin(H)}socketsLeave(H){return new uL.BroadcastOperator(this.adapter).socketsLeave(H)}disconnectSockets(H=!1){return new uL.BroadcastOperator(this.adapter).disconnectSockets(H)}}cI.Namespace=CF});var PF=Q((WF)=>{Object.defineProperty(WF,"__esModule",{value:!0});WF.yeast=WF.decode=WF.encode=void 0;var FF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),f1=64,_F={},TF=0,ZI=0,GF;function ui(H){let A="";do A=FF[H%f1]+A,H=Math.floor(H/f1);while(H>0);return A}WF.encode=ui;function bv(H){let A=0;for(ZI=0;ZI<H.length;ZI++)A=A*f1+_F[H.charAt(ZI)];return A}WF.decode=bv;function Zv(){let H=ui(+new Date);if(H!==GF)return TF=0,GF=H;return H+"."+ui(TF++)}WF.yeast=Zv;for(;ZI<f1;ZI++)_F[FF[ZI]]=ZI});var pi=Q((SF)=>{var ti;Object.defineProperty(SF,"__esModule",{value:!0});SF.SessionAwareAdapter=SF.Adapter=void 0;var jv=O("events"),kv=PF(),E1=O("ws"),dv=typeof((ti=E1===null||E1===void 0?void 0:E1.Sender)===null||ti===void 0?void 0:ti.frame)==="function";class ii extends jv.EventEmitter{constructor(H){super();this.nsp=H,this.rooms=new Map,this.sids=new Map,this.encoder=H.server.encoder}init(){}close(){}serverCount(){return Promise.resolve(1)}addAll(H,A){if(!this.sids.has(H))this.sids.set(H,new Set);for(let L of A){if(this.sids.get(H).add(L),!this.rooms.has(L))this.rooms.set(L,new Set),this.emit("create-room",L);if(!this.rooms.get(L).has(H))this.rooms.get(L).add(H),this.emit("join-room",L,H)}}del(H,A){if(this.sids.has(H))this.sids.get(H).delete(A);this._del(A,H)}_del(H,A){let L=this.rooms.get(H);if(L!=null){if(L.delete(A))this.emit("leave-room",H,A);if(L.size===0&&this.rooms.delete(H))this.emit("delete-room",H)}}delAll(H){if(!this.sids.has(H))return;for(let A of this.sids.get(H))this._del(A,H);this.sids.delete(H)}broadcast(H,A){let L=A.flags||{},I={preEncoded:!0,volatile:L.volatile,compress:L.compress};H.nsp=this.nsp.name;let $=this._encode(H,I);this.apply(A,(f)=>{if(typeof f.notifyOutgoingListeners==="function")f.notifyOutgoingListeners(H);f.client.writeToEngine($,I)})}broadcastWithAck(H,A,L,I){let $=A.flags||{},f={preEncoded:!0,volatile:$.volatile,compress:$.compress};H.nsp=this.nsp.name,H.id=this.nsp._ids++;let E=this._encode(H,f),D=0;this.apply(A,(M)=>{if(D++,M.acks.set(H.id,I),typeof M.notifyOutgoingListeners==="function")M.notifyOutgoingListeners(H);M.client.writeToEngine(E,f)}),L(D)}_encode(H,A){let L=this.encoder.encode(H);if(dv&&L.length===1&&typeof L[0]==="string"){let I=Buffer.from("4"+L[0]);A.wsPreEncodedFrame=E1.Sender.frame(I,{readOnly:!1,mask:!1,rsv1:!1,opcode:1,fin:!0})}return L}sockets(H){let A=new Set;return this.apply({rooms:H},(L)=>{A.add(L.id)}),Promise.resolve(A)}socketRooms(H){return this.sids.get(H)}fetchSockets(H){let A=[];return this.apply(H,(L)=>{A.push(L)}),Promise.resolve(A)}addSockets(H,A){this.apply(H,(L)=>{L.join(A)})}delSockets(H,A){this.apply(H,(L)=>{A.forEach((I)=>L.leave(I))})}disconnectSockets(H,A){this.apply(H,(L)=>{L.disconnect(A)})}apply(H,A){let L=H.rooms,I=this.computeExceptSids(H.except);if(L.size){let $=new Set;for(let f of L){if(!this.rooms.has(f))continue;for(let E of this.rooms.get(f)){if($.has(E)||I.has(E))continue;let D=this.nsp.sockets.get(E);if(D)A(D),$.add(E)}}}else for(let[$]of this.sids){if(I.has($))continue;let f=this.nsp.sockets.get($);if(f)A(f)}}computeExceptSids(H){let A=new Set;if(H&&H.size>0){for(let L of H)if(this.rooms.has(L))this.rooms.get(L).forEach((I)=>A.add(I))}return A}serverSideEmit(H){console.warn("this adapter does not support the serverSideEmit() functionality")}persistSession(H){}restoreSession(H,A){return null}}SF.Adapter=ii;class XF extends ii{constructor(H){super(H);this.nsp=H,this.sessions=new Map,this.packets=[],this.maxDisconnectionDuration=H.server.opts.connectionStateRecovery.maxDisconnectionDuration,setInterval(()=>{let L=Date.now()-this.maxDisconnectionDuration;this.sessions.forEach((I,$)=>{if(I.disconnectedAt<L)this.sessions.delete($)});for(let I=this.packets.length-1;I>=0;I--)if(this.packets[I].emittedAt<L){this.packets.splice(0,I+1);break}},60000).unref()}persistSession(H){H.disconnectedAt=Date.now(),this.sessions.set(H.pid,H)}restoreSession(H,A){let L=this.sessions.get(H);if(!L)return null;if(L.disconnectedAt+this.maxDisconnectionDuration<Date.now())return this.sessions.delete(H),null;let $=this.packets.findIndex((E)=>E.id===A);if($===-1)return null;let f=[];for(let E=$+1;E<this.packets.length;E++){let D=this.packets[E];if(qv(L.rooms,D.opts))f.push(D.data)}return Promise.resolve(Object.assign(Object.assign({},L),{missedPackets:f}))}broadcast(H,A){var L;let I=H.type===2,$=H.id===void 0,f=((L=A.flags)===null||L===void 0?void 0:L.volatile)===void 0;if(I&&$&&f){let E=kv.yeast();H.data.push(E),this.packets.push({id:E,opts:A,data:H.data,emittedAt:Date.now()})}super.broadcast(H,A)}}SF.SessionAwareAdapter=XF;function qv(H,A){let L=A.rooms.size===0||H.some(($)=>A.rooms.has($)),I=H.every(($)=>!A.except.has($));return L&&I}});var wF=Q((RL)=>{var ev=RL&&RL.__rest||function(H,A){var L={};for(var I in H)if(Object.prototype.hasOwnProperty.call(H,I)&&A.indexOf(I)<0)L[I]=H[I];if(H!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var $=0,I=Object.getOwnPropertySymbols(H);$<I.length;$++)if(A.indexOf(I[$])<0&&Object.prototype.propertyIsEnumerable.call(H,I[$]))L[I[$]]=H[I[$]]}return L};Object.defineProperty(RL,"__esModule",{value:!0});RL.ClusterAdapterWithHeartbeat=RL.ClusterAdapter=RL.MessageType=void 0;var Ha=pi(),Aa=TA(),La=O("crypto"),AA=Aa.debug("socket.io-adapter"),Ia="emitter",D1=5000;function Jf(){return La.randomBytes(8).toString("hex")}var LH;(function(H){H[H.INITIAL_HEARTBEAT=1]="INITIAL_HEARTBEAT",H[H.HEARTBEAT=2]="HEARTBEAT",H[H.BROADCAST=3]="BROADCAST",H[H.SOCKETS_JOIN=4]="SOCKETS_JOIN",H[H.SOCKETS_LEAVE=5]="SOCKETS_LEAVE",H[H.DISCONNECT_SOCKETS=6]="DISCONNECT_SOCKETS",H[H.FETCH_SOCKETS=7]="FETCH_SOCKETS",H[H.FETCH_SOCKETS_RESPONSE=8]="FETCH_SOCKETS_RESPONSE",H[H.SERVER_SIDE_EMIT=9]="SERVER_SIDE_EMIT",H[H.SERVER_SIDE_EMIT_RESPONSE=10]="SERVER_SIDE_EMIT_RESPONSE",H[H.BROADCAST_CLIENT_COUNT=11]="BROADCAST_CLIENT_COUNT",H[H.BROADCAST_ACK=12]="BROADCAST_ACK",H[H.ADAPTER_CLOSE=13]="ADAPTER_CLOSE"})(LH=RL.MessageType||(RL.MessageType={}));function T$(H){return{rooms:[...H.rooms],except:[...H.except],flags:H.flags}}function Sf(H){return{rooms:new Set(H.rooms),except:new Set(H.except),flags:H.flags}}class ni extends Ha.Adapter{constructor(H){super(H);this.requests=new Map,this.ackRequests=new Map,this.uid=Jf()}onMessage(H,A){if(H.uid===this.uid)return AA("[%s] ignore message from self",this.uid);switch(AA("[%s] new event of type %d from %s",this.uid,H.type,H.uid),H.type){case LH.BROADCAST:{if(H.data.requestId!==void 0)super.broadcastWithAck(H.data.packet,Sf(H.data.opts),(I)=>{AA("[%s] waiting for %d client acknowledgements",this.uid,I),this.publishResponse(H.uid,{type:LH.BROADCAST_CLIENT_COUNT,data:{requestId:H.data.requestId,clientCount:I}})},(I)=>{AA("[%s] received acknowledgement with value %j",this.uid,I),this.publishResponse(H.uid,{type:LH.BROADCAST_ACK,data:{requestId:H.data.requestId,packet:I}})});else{let I=H.data.packet,$=Sf(H.data.opts);this.addOffsetIfNecessary(I,$,A),super.broadcast(I,$)}break}case LH.SOCKETS_JOIN:super.addSockets(Sf(H.data.opts),H.data.rooms);break;case LH.SOCKETS_LEAVE:super.delSockets(Sf(H.data.opts),H.data.rooms);break;case LH.DISCONNECT_SOCKETS:super.disconnectSockets(Sf(H.data.opts),H.data.close);break;case LH.FETCH_SOCKETS:{AA("[%s] calling fetchSockets with opts %j",this.uid,H.data.opts),super.fetchSockets(Sf(H.data.opts)).then((L)=>{this.publishResponse(H.uid,{type:LH.FETCH_SOCKETS_RESPONSE,data:{requestId:H.data.requestId,sockets:L.map((I)=>{let $=I.handshake,{sessionStore:f}=$,E=ev($,["sessionStore"]);return{id:I.id,handshake:E,rooms:[...I.rooms],data:I.data}})}})});break}case LH.SERVER_SIDE_EMIT:{let L=H.data.packet;if(H.data.requestId===void 0){this.nsp._onServerSideEmit(L);return}let $=!1,f=(E)=>{if($)return;$=!0,AA("[%s] calling acknowledgement with %j",this.uid,E),this.publishResponse(H.uid,{type:LH.SERVER_SIDE_EMIT_RESPONSE,data:{requestId:H.data.requestId,packet:E}})};this.nsp._onServerSideEmit([...L,f]);break}case LH.BROADCAST_CLIENT_COUNT:case LH.BROADCAST_ACK:case LH.FETCH_SOCKETS_RESPONSE:case LH.SERVER_SIDE_EMIT_RESPONSE:this.onResponse(H);break;default:AA("[%s] unknown message type: %s",this.uid,H.type)}}onResponse(H){var A,L;let I=H.data.requestId;switch(AA("[%s] received response %s to request %s",this.uid,H.type,I),H.type){case LH.BROADCAST_CLIENT_COUNT:{(A=this.ackRequests.get(I))===null||A===void 0||A.clientCountCallback(H.data.clientCount);break}case LH.BROADCAST_ACK:{(L=this.ackRequests.get(I))===null||L===void 0||L.ack(H.data.packet);break}case LH.FETCH_SOCKETS_RESPONSE:{let $=this.requests.get(I);if(!$)return;if($.current++,H.data.sockets.forEach((f)=>$.responses.push(f)),$.current===$.expected)clearTimeout($.timeout),$.resolve($.responses),this.requests.delete(I);break}case LH.SERVER_SIDE_EMIT_RESPONSE:{let $=this.requests.get(I);if(!$)return;if($.current++,$.responses.push(H.data.packet),$.current===$.expected)clearTimeout($.timeout),$.resolve(null,$.responses),this.requests.delete(I);break}default:AA("[%s] unknown response type: %s",this.uid,H.type)}}async broadcast(H,A){var L;if(!((L=A.flags)===null||L===void 0?void 0:L.local))try{let $=await this.publishAndReturnOffset({type:LH.BROADCAST,data:{packet:H,opts:T$(A)}});this.addOffsetIfNecessary(H,A,$)}catch($){return AA("[%s] error while broadcasting message: %s",this.uid,$.message)}super.broadcast(H,A)}addOffsetIfNecessary(H,A,L){var I;if(!this.nsp.server.opts.connectionStateRecovery)return;let $=H.type===2,f=H.id===void 0,E=((I=A.flags)===null||I===void 0?void 0:I.volatile)===void 0;if($&&f&&E)H.data.push(L)}broadcastWithAck(H,A,L,I){var $;if(!(($=A===null||A===void 0?void 0:A.flags)===null||$===void 0?void 0:$.local)){let E=Jf();this.ackRequests.set(E,{clientCountCallback:L,ack:I}),this.publish({type:LH.BROADCAST,data:{packet:H,requestId:E,opts:T$(A)}}),setTimeout(()=>{this.ackRequests.delete(E)},A.flags.timeout)}super.broadcastWithAck(H,A,L,I)}async addSockets(H,A){var L;if(!((L=H.flags)===null||L===void 0?void 0:L.local))try{await this.publishAndReturnOffset({type:LH.SOCKETS_JOIN,data:{opts:T$(H),rooms:A}})}catch($){AA("[%s] error while publishing message: %s",this.uid,$.message)}super.addSockets(H,A)}async delSockets(H,A){var L;if(!((L=H.flags)===null||L===void 0?void 0:L.local))try{await this.publishAndReturnOffset({type:LH.SOCKETS_LEAVE,data:{opts:T$(H),rooms:A}})}catch($){AA("[%s] error while publishing message: %s",this.uid,$.message)}super.delSockets(H,A)}async disconnectSockets(H,A){var L;if(!((L=H.flags)===null||L===void 0?void 0:L.local))try{await this.publishAndReturnOffset({type:LH.DISCONNECT_SOCKETS,data:{opts:T$(H),close:A}})}catch($){AA("[%s] error while publishing message: %s",this.uid,$.message)}super.disconnectSockets(H,A)}async fetchSockets(H){var A;let[L,I]=await Promise.all([super.fetchSockets(H),this.serverCount()]),$=I-1;if(((A=H.flags)===null||A===void 0?void 0:A.local)||$<=0)return L;let f=Jf();return new Promise((E,D)=>{let M=setTimeout(()=>{let u=this.requests.get(f);if(u)D(new Error(`timeout reached: only ${u.current} responses received out of ${u.expected}`)),this.requests.delete(f)},H.flags.timeout||D1),o={type:LH.FETCH_SOCKETS,resolve:E,timeout:M,current:0,expected:$,responses:L};this.requests.set(f,o),this.publish({type:LH.FETCH_SOCKETS,data:{opts:T$(H),requestId:f}})})}async serverSideEmit(H){if(typeof H[H.length-1]!=="function")return this.publish({type:LH.SERVER_SIDE_EMIT,data:{packet:H}});let L=H.pop(),I=await this.serverCount()-1;if(AA('[%s] waiting for %d responses to "serverSideEmit" request',this.uid,I),I<=0)return L(null,[]);let $=Jf(),f=setTimeout(()=>{let D=this.requests.get($);if(D)L(new Error(`timeout reached: only ${D.current} responses received out of ${D.expected}`),D.responses),this.requests.delete($)},D1),E={type:LH.SERVER_SIDE_EMIT,resolve:L,timeout:f,current:0,expected:I,responses:[]};this.requests.set($,E),this.publish({type:LH.SERVER_SIDE_EMIT,data:{requestId:$,packet:H}})}publish(H){this.publishAndReturnOffset(H).catch((A)=>{AA("[%s] error while publishing message: %s",this.uid,A)})}publishAndReturnOffset(H){return H.uid=this.uid,H.nsp=this.nsp.name,this.doPublish(H)}publishResponse(H,A){A.uid=this.uid,A.nsp=this.nsp.name,this.doPublishResponse(H,A).catch((L)=>{AA("[%s] error while publishing response: %s",this.uid,L)})}}RL.ClusterAdapter=ni;class VF extends ni{constructor(H,A){super(H);this.nodesMap=new Map,this.customRequests=new Map,this._opts=Object.assign({heartbeatInterval:5000,heartbeatTimeout:1e4},A),this.cleanupTimer=setInterval(()=>{let L=Date.now();this.nodesMap.forEach((I,$)=>{if(L-I>this._opts.heartbeatTimeout)AA("[%s] node %s seems down",this.uid,$),this.removeNode($)})},1000)}init(){this.publish({type:LH.INITIAL_HEARTBEAT})}scheduleHeartbeat(){if(this.heartbeatTimer)this.heartbeatTimer.refresh();else this.heartbeatTimer=setTimeout(()=>{this.publish({type:LH.HEARTBEAT})},this._opts.heartbeatInterval)}close(){if(this.publish({type:LH.ADAPTER_CLOSE}),clearTimeout(this.heartbeatTimer),this.cleanupTimer)clearInterval(this.cleanupTimer)}onMessage(H,A){if(H.uid===this.uid)return AA("[%s] ignore message from self",this.uid);if(H.uid&&H.uid!==Ia)this.nodesMap.set(H.uid,Date.now());switch(AA("[%s] new event of type %d from %s",this.uid,H.type,H.uid),H.type){case LH.INITIAL_HEARTBEAT:this.publish({type:LH.HEARTBEAT});break;case LH.HEARTBEAT:break;case LH.ADAPTER_CLOSE:this.removeNode(H.uid);break;default:super.onMessage(H,A)}}serverCount(){return Promise.resolve(1+this.nodesMap.size)}publish(H){return this.scheduleHeartbeat(),super.publish(H)}async serverSideEmit(H){if(typeof H[H.length-1]!=="function")return this.publish({type:LH.SERVER_SIDE_EMIT,data:{packet:H}});let L=H.pop(),I=this.nodesMap.size;if(AA('[%s] waiting for %d responses to "serverSideEmit" request',this.uid,I),I<=0)return L(null,[]);let $=Jf(),f=setTimeout(()=>{let D=this.customRequests.get($);if(D)L(new Error(`timeout reached: missing ${D.missingUids.size} responses`),D.responses),this.customRequests.delete($)},D1),E={type:LH.SERVER_SIDE_EMIT,resolve:L,timeout:f,missingUids:new Set([...this.nodesMap.keys()]),responses:[]};this.customRequests.set($,E),this.publish({type:LH.SERVER_SIDE_EMIT,data:{requestId:$,packet:H}})}async fetchSockets(H){var A;let[L,I]=await Promise.all([super.fetchSockets({rooms:H.rooms,except:H.except,flags:{local:!0}}),this.serverCount()]),$=I-1;if(((A=H.flags)===null||A===void 0?void 0:A.local)||$<=0)return L;let f=Jf();return new Promise((E,D)=>{let M=setTimeout(()=>{let u=this.customRequests.get(f);if(u)D(new Error(`timeout reached: missing ${u.missingUids.size} responses`)),this.customRequests.delete(f)},H.flags.timeout||D1),o={type:LH.FETCH_SOCKETS,resolve:E,timeout:M,missingUids:new Set([...this.nodesMap.keys()]),responses:L};this.customRequests.set(f,o),this.publish({type:LH.FETCH_SOCKETS,data:{opts:T$(H),requestId:f}})})}onResponse(H){let A=H.data.requestId;switch(AA("[%s] received response %s to request %s",this.uid,H.type,A),H.type){case LH.FETCH_SOCKETS_RESPONSE:{let L=this.customRequests.get(A);if(!L)return;if(H.data.sockets.forEach((I)=>L.responses.push(I)),L.missingUids.delete(H.uid),L.missingUids.size===0)clearTimeout(L.timeout),L.resolve(L.responses),this.customRequests.delete(A);break}case LH.SERVER_SIDE_EMIT_RESPONSE:{let L=this.customRequests.get(A);if(!L)return;if(L.responses.push(H.data.packet),L.missingUids.delete(H.uid),L.missingUids.size===0)clearTimeout(L.timeout),L.resolve(null,L.responses),this.customRequests.delete(A);break}default:super.onResponse(H)}}removeNode(H){this.customRequests.forEach((A,L)=>{if(A.missingUids.delete(H),A.missingUids.size===0){if(clearTimeout(A.timeout),A.type===LH.FETCH_SOCKETS)A.resolve(A.responses);else if(A.type===LH.SERVER_SIDE_EMIT)A.resolve(null,A.responses);this.customRequests.delete(L)}}),this.nodesMap.delete(H)}}RL.ClusterAdapterWithHeartbeat=VF});var M1=Q((G$)=>{Object.defineProperty(G$,"__esModule",{value:!0});G$.MessageType=G$.ClusterAdapterWithHeartbeat=G$.ClusterAdapter=G$.SessionAwareAdapter=G$.Adapter=void 0;var KF=pi();Object.defineProperty(G$,"Adapter",{enumerable:!0,get:function(){return KF.Adapter}});Object.defineProperty(G$,"SessionAwareAdapter",{enumerable:!0,get:function(){return KF.SessionAwareAdapter}});var Bi=wF();Object.defineProperty(G$,"ClusterAdapter",{enumerable:!0,get:function(){return Bi.ClusterAdapter}});Object.defineProperty(G$,"ClusterAdapterWithHeartbeat",{enumerable:!0,get:function(){return Bi.ClusterAdapterWithHeartbeat}});Object.defineProperty(G$,"MessageType",{enumerable:!0,get:function(){return Bi.MessageType}})});var OF=Q((Vf)=>{var fa=Vf&&Vf.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(Vf,"__esModule",{value:!0});Vf.ParentNamespace=void 0;var vF=oi(),Ea=M1(),Da=fa(TA()),aF=Da.default("socket.io:parent-namespace");class o1 extends vF.Namespace{constructor(H){super(H,"/_"+o1.count++);this.children=new Set}_initAdapter(){this.adapter=new lF(this)}emit(H,...A){return this.children.forEach((L)=>{L.emit(H,...A)}),!0}createChild(H){aF("creating child namespace %s",H);let A=new vF.Namespace(this.server,H);if(this._fns.forEach((L)=>A.use(L)),this.listeners("connect").forEach((L)=>A.on("connect",L)),this.listeners("connection").forEach((L)=>A.on("connection",L)),this.children.add(A),this.server._opts.cleanupEmptyChildNamespaces){let L=A._remove;A._remove=(I)=>{if(L.call(A,I),A.sockets.size===0)aF("closing child namespace %s",H),A.adapter.close(),this.server._nsps.delete(A.name),this.children.delete(A)}}return this.server._nsps.set(H,A),this.server.sockets.emitReserved("new_namespace",A),A}fetchSockets(){throw new Error("fetchSockets() is not supported on parent namespaces")}}Vf.ParentNamespace=o1;o1.count=0;class lF extends Ea.Adapter{broadcast(H,A){this.nsp.children.forEach((L)=>{L.adapter.broadcast(H,A)})}}});var QF=Q((_$)=>{var Ma=_$&&_$.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(_$,"__esModule",{value:!0});_$.patchAdapter=ua;_$.restoreAdapter=ta;_$.serveFile=pa;var F$=M1(),sF=O("fs"),oa=Ma(TA()),u1=oa.default("socket.io:adapter-uws"),ci="\x1F",{addAll:yF,del:RF,broadcast:YF}=F$.Adapter.prototype;function ua(H){F$.Adapter.prototype.addAll=function(A,L){let I=!this.sids.has(A);yF.call(this,A,L);let $=this.nsp.sockets.get(A)||this.nsp._preConnectSockets.get(A);if(!$)return;if($.conn.transport.name==="websocket"){NF(this.nsp.name,$,I,L);return}if(I)$.conn.on("upgrade",()=>{let f=this.sids.get(A);if(f)NF(this.nsp.name,$,I,f)})},F$.Adapter.prototype.del=function(A,L){RF.call(this,A,L);let I=this.nsp.sockets.get(A)||this.nsp._preConnectSockets.get(A);if(I&&I.conn.transport.name==="websocket"){let $=I.conn.id,f=I.conn.transport.socket,E=`${this.nsp.name}${ci}${L}`;u1("unsubscribe connection %s from topic %s",$,E),f.unsubscribe(E)}},F$.Adapter.prototype.broadcast=function(A,L){if(!(L.rooms.size<=1&&L.except.size===0)){YF.call(this,A,L);return}let $=L.flags||{},f={preEncoded:!0,volatile:$.volatile,compress:$.compress};A.nsp=this.nsp.name;let E=this.encoder.encode(A),D=L.rooms.size===0?this.nsp.name:`${this.nsp.name}${ci}${L.rooms.keys().next().value}`;u1("fast publish to %s",D),E.forEach((M)=>{let o=typeof M!=="string";H.publish(D,o?M:"4"+M,o)}),this.apply(L,(M)=>{if(M.conn.transport.name!=="websocket")M.client.writeToEngine(E,f)})}}function NF(H,A,L,I){let $=A.conn.id,f=A.conn.transport.socket;if(L)u1("subscribe connection %s to topic %s",$,H),f.subscribe(H);I.forEach((E)=>{let D=`${H}${ci}${E}`;u1("subscribe connection %s to topic %s",$,D),f.subscribe(D)})}function ta(){F$.Adapter.prototype.addAll=yF,F$.Adapter.prototype.del=RF,F$.Adapter.prototype.broadcast=YF}var ia=(H)=>{let{buffer:A,byteOffset:L,byteLength:I}=H;return A.slice(L,L+I)};function pa(H,A){let{size:L}=sF.statSync(A),I=sF.createReadStream(A),$=()=>!I.destroyed&&I.destroy(),f=(D)=>{throw $(),D},E=(D)=>{let M=ia(D);H.cork(()=>{let o=H.getWriteOffset(),[u,t]=H.tryEnd(M,L);if(!t&&!u)I.pause(),H.onWritable((i)=>{let[B,U]=H.tryEnd(M.slice(i-o),L);if(!U&&B)I.resume();return B})})};H.onAborted($),I.on("data",E).on("error",f).on("end",$)}});var zF=Q((W$H,na)=>{na.exports={name:"socket.io",version:"4.8.1",description:"node.js realtime framework server",keywords:["realtime","framework","websocket","tcp","events","socket","io"],files:["dist/","client-dist/","wrapper.mjs","!**/*.tsbuildinfo"],directories:{doc:"docs/",example:"example/",lib:"lib/",test:"test/"},type:"commonjs",main:"./dist/index.js",exports:{types:"./dist/index.d.ts",import:"./wrapper.mjs",require:"./dist/index.js"},types:"./dist/index.d.ts",license:"MIT",homepage:"https://github.com/socketio/socket.io/tree/main/packages/socket.io#readme",repository:{type:"git",url:"git+https://github.com/socketio/socket.io.git"},bugs:{url:"https://github.com/socketio/socket.io/issues"},scripts:{compile:"rimraf ./dist && tsc",test:"npm run format:check && npm run compile && npm run test:types && npm run test:unit","test:types":"tsd","test:unit":"nyc mocha --require ts-node/register --reporter spec --slow 200 --bail --timeout 10000 test/index.ts","format:check":'prettier --check "lib/**/*.ts" "test/**/*.ts"',"format:fix":'prettier --write "lib/**/*.ts" "test/**/*.ts"',prepack:"npm run compile"},dependencies:{accepts:"~1.3.4",base64id:"~2.0.0",cors:"~2.8.5",debug:"~4.3.2","engine.io":"~6.6.0","socket.io-adapter":"~2.5.2","socket.io-parser":"~4.2.4"},contributors:[{name:"Guillermo Rauch",email:"rauchg@gmail.com"},{name:"Arnout Kazemier",email:"info@3rd-eden.com"},{name:"Vladimir Dronnikov",email:"dronnikov@gmail.com"},{name:"Einar Otto Stangvik",email:"einaros@gmail.com"}],engines:{node:">=10.2.0"},tsd:{directory:"test"}}});var gF=Q((sA,eE)=>{var __dirname="/home/runner/work/wayforge/wayforge/node_modules/.pnpm/socket.io@4.8.1/node_modules/socket.io/dist",Ba=sA&&sA.__createBinding||(Object.create?function(H,A,L,I){if(I===void 0)I=L;var $=Object.getOwnPropertyDescriptor(A,L);if(!$||("get"in $?!A.__esModule:$.writable||$.configurable))$={enumerable:!0,get:function(){return A[L]}};Object.defineProperty(H,I,$)}:function(H,A,L,I){if(I===void 0)I=L;H[I]=A[L]}),ca=sA&&sA.__setModuleDefault||(Object.create?function(H,A){Object.defineProperty(H,"default",{enumerable:!0,value:A})}:function(H,A){H.default=A}),xa=sA&&sA.__importStar||function(H){if(H&&H.__esModule)return H;var A={};if(H!=null){for(var L in H)if(L!=="default"&&Object.prototype.hasOwnProperty.call(H,L))Ba(A,H,L)}return ca(A,H),A},dF=sA&&sA.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(sA,"__esModule",{value:!0});sA.Namespace=sA.Socket=sA.Server=void 0;var Ua=O("http"),Ca=O("fs"),xi=O("zlib"),Ta=YM(),t1=O("stream"),bF=O("path"),ZF=RG(),Ga=EF(),hF=O("events"),Ci=oi();Object.defineProperty(sA,"Namespace",{enumerable:!0,get:function(){return Ci.Namespace}});var Fa=OF(),rF=M1(),_a=xa(qE()),Wa=dF(TA()),qF=Mi();Object.defineProperty(sA,"Socket",{enumerable:!0,get:function(){return qF.Socket}});var ma=$1(),Ui=QF(),Pa=dF(gt()),HL=Wa.default("socket.io:server"),jF=zF().version,kF=/\.map/;class wf extends ma.StrictEventEmitter{constructor(H,A={}){super();if(this._nsps=new Map,this.parentNsps=new Map,this.parentNamespacesFromRegExp=new Map,typeof H==="object"&&H instanceof Object&&!H.listen)A=H,H=void 0;if(this.path(A.path||"/socket.io"),this.connectTimeout(A.connectTimeout||45000),this.serveClient(A.serveClient!==!1),this._parser=A.parser||_a,this.encoder=new this._parser.Encoder,this.opts=A,A.connectionStateRecovery)A.connectionStateRecovery=Object.assign({maxDisconnectionDuration:120000,skipMiddlewares:!0},A.connectionStateRecovery),this.adapter(A.adapter||rF.SessionAwareAdapter);else this.adapter(A.adapter||rF.Adapter);if(A.cleanupEmptyChildNamespaces=!!A.cleanupEmptyChildNamespaces,this.sockets=this.of("/"),H||typeof H=="number")this.attach(H);if(this.opts.cors)this._corsMiddleware=Pa.default(this.opts.cors)}get _opts(){return this.opts}serveClient(H){if(!arguments.length)return this._serveClient;return this._serveClient=H,this}_checkNamespace(H,A,L){if(this.parentNsps.size===0)return L(!1);let I=this.parentNsps.keys(),$=()=>{let f=I.next();if(f.done)return L(!1);f.value(H,A,(E,D)=>{if(E||!D)return $();if(this._nsps.has(H))return HL("dynamic namespace %s already exists",H),L(this._nsps.get(H));let M=this.parentNsps.get(f.value).createChild(H);HL("dynamic namespace %s was created",H),L(M)})};$()}path(H){if(!arguments.length)return this._path;this._path=H.replace(/\/$/,"");let A=this._path.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");return this.clientPathRegex=new RegExp("^"+A+"/socket\\.io(\\.msgpack|\\.esm)?(\\.min)?\\.js(\\.map)?(?:\\?|$)"),this}connectTimeout(H){if(H===void 0)return this._connectTimeout;return this._connectTimeout=H,this}adapter(H){if(!arguments.length)return this._adapter;this._adapter=H;for(let A of this._nsps.values())A._initAdapter();return this}listen(H,A={}){return this.attach(H,A)}attach(H,A={}){if(typeof H=="function")throw new Error("You are trying to attach socket.io to an express request handler function. Please pass a http.Server instance.");if(Number(H)==H)H=Number(H);if(typeof H=="number"){HL("creating http server and binding to %d",H);let L=H;H=Ua.createServer((I,$)=>{$.writeHead(404),$.end()}),H.listen(L)}return Object.assign(A,this.opts),A.path=A.path||this._path,this.initEngine(H,A),this}attachApp(H,A={}){Object.assign(A,this.opts),A.path=A.path||this._path,HL("creating uWebSockets.js-based engine with opts %j",A);let L=new ZF.uServer(A);if(L.attach(H,A),this.bind(L),this._serveClient)H.get(`${this._path}/*`,(I,$)=>{if(!this.clientPathRegex.test($.getUrl())){$.setYield(!0);return}let f=$.getUrl().replace(this._path,"").replace(/\?.*$/,"").replace(/^\//,""),E=kF.test(f),D=E?"map":"source",M='"'+jF+'"',o="W/"+M,u=$.getHeader("if-none-match");if(u){if(M===u||o===u){HL("serve client %s 304",D),I.writeStatus("304 Not Modified"),I.end();return}}HL("serve client %s",D),I.writeHeader("cache-control","public, max-age=0"),I.writeHeader("content-type","application/"+(E?"json":"javascript")+"; charset=utf-8"),I.writeHeader("etag",M);let t=bF.join(__dirname,"../client-dist/",f);Ui.serveFile(I,t)});Ui.patchAdapter(H)}initEngine(H,A){if(HL("creating engine.io instance with opts %j",A),this.eio=ZF.attach(H,A),this._serveClient)this.attachServe(H);this.httpServer=H,this.bind(this.eio)}attachServe(H){HL("attaching client serving req handler");let A=H.listeners("request").slice(0);H.removeAllListeners("request"),H.on("request",(L,I)=>{if(this.clientPathRegex.test(L.url))if(this._corsMiddleware)this._corsMiddleware(L,I,()=>{this.serve(L,I)});else this.serve(L,I);else for(let $=0;$<A.length;$++)A[$].call(H,L,I)})}serve(H,A){let L=H.url.replace(this._path,"").replace(/\?.*$/,""),I=kF.test(L),$=I?"map":"source",f='"'+jF+'"',E="W/"+f,D=H.headers["if-none-match"];if(D){if(f===D||E===D){HL("serve client %s 304",$),A.writeHead(304),A.end();return}}HL("serve client %s",$),A.setHeader("Cache-Control","public, max-age=0"),A.setHeader("Content-Type","application/"+(I?"json":"javascript")+"; charset=utf-8"),A.setHeader("ETag",f),wf.sendFile(L,H,A)}static sendFile(H,A,L){let I=Ca.createReadStream(bF.join(__dirname,"../client-dist/",H)),$=Ta(A).encodings(["br","gzip","deflate"]),f=(E)=>{if(E)L.end()};switch($){case"br":L.writeHead(200,{"content-encoding":"br"}),t1.pipeline(I,xi.createBrotliCompress(),L,f);break;case"gzip":L.writeHead(200,{"content-encoding":"gzip"}),t1.pipeline(I,xi.createGzip(),L,f);break;case"deflate":L.writeHead(200,{"content-encoding":"deflate"}),t1.pipeline(I,xi.createDeflate(),L,f);break;default:L.writeHead(200),t1.pipeline(I,L,f)}}bind(H){return this.engine=H,this.engine.on("connection",this.onconnection.bind(this)),this}onconnection(H){HL("incoming connection with id %s",H.id);let A=new Ga.Client(this,H);if(H.protocol===3)A.connect("/");return this}of(H,A){if(typeof H==="function"||H instanceof RegExp){let I=new Fa.ParentNamespace(this);if(HL("initializing parent namespace %s",I.name),typeof H==="function")this.parentNsps.set(H,I);else this.parentNsps.set(($,f,E)=>E(null,H.test($)),I),this.parentNamespacesFromRegExp.set(H,I);if(A)I.on("connect",A);return I}if(String(H)[0]!=="/")H="/"+H;let L=this._nsps.get(H);if(!L){for(let[I,$]of this.parentNamespacesFromRegExp)if(I.test(H))return HL("attaching namespace %s to parent namespace %s",H,I),$.createChild(H);if(HL("initializing namespace %s",H),L=new Ci.Namespace(this,H),this._nsps.set(H,L),H!=="/")this.sockets.emitReserved("new_namespace",L)}if(A)L.on("connect",A);return L}async close(H){if(await Promise.allSettled([...this._nsps.values()].map(async(A)=>{A.sockets.forEach((L)=>{L._onclose("server shutting down")}),await A.adapter.close()})),this.engine.close(),Ui.restoreAdapter(),this.httpServer)this.httpServer.close(H);else H&&H()}use(H){return this.sockets.use(H),this}to(H){return this.sockets.to(H)}in(H){return this.sockets.in(H)}except(H){return this.sockets.except(H)}send(...H){return this.sockets.emit("message",...H),this}write(...H){return this.sockets.emit("message",...H),this}serverSideEmit(H,...A){return this.sockets.serverSideEmit(H,...A)}serverSideEmitWithAck(H,...A){return this.sockets.serverSideEmitWithAck(H,...A)}allSockets(){return this.sockets.allSockets()}compress(H){return this.sockets.compress(H)}get volatile(){return this.sockets.volatile}get local(){return this.sockets.local}timeout(H){return this.sockets.timeout(H)}fetchSockets(){return this.sockets.fetchSockets()}socketsJoin(H){return this.sockets.socketsJoin(H)}socketsLeave(H){return this.sockets.socketsLeave(H)}disconnectSockets(H=!1){return this.sockets.disconnectSockets(H)}}sA.Server=wf;var Xa=Object.keys(hF.EventEmitter.prototype).filter(function(H){return typeof hF.EventEmitter.prototype[H]==="function"});Xa.forEach(function(H){wf.prototype[H]=function(){return this.sockets[H].apply(this.sockets,arguments)}});eE.exports=(H,A)=>new wf(H,A);eE.exports.Server=wf;eE.exports.Namespace=Ci.Namespace;eE.exports.Socket=qF.Socket});import{createServer as Nl}from"http";import{createServer as yl}from"https";var{DEFAULT_COST:hl,genSaltSync:rl,genSalt:jl,hashSync:kl,hash:Mm,verifySync:dl,verify:om}=xp();var N1=Mm;var y1=om;var GI=(H)=>Array.isArray(H)?H:[H],Cp=(H,A)=>{let L=[[],[]];for(let I of H)if(A(I))L[0].push(I);else L[1].push(I);return L},pD=Array,AI=(H,A)=>H.includes(A),Tp=(H,A=0)=>[...new Array(H)].map((L,I)=>I+A),nH=(H,A,L)=>{if(H===void 0)return A===void 0?[]:Array.isArray(A)?A:[A];if(L?.prepend)if(Array.isArray(A))H.unshift(...A);else H.unshift(A);else if(Array.isArray(A))H.push(...A);else H.push(A);return H},LI=(H,A)=>{if(A===void 0||A===null)return H??[];if(H===void 0||H===null)return GI(A);return H.concat(A)},Gp=(...H)=>H.reduce(LI,[]),bL=(H,A,L)=>{if(H===void 0)return Array.isArray(A)?A:[A];let I=L?.isEqual??(($,f)=>$===f);return GI(A).forEach(($)=>{if(!H.some((f)=>I(f,$)))H.push($)}),H},Fp=(H,A)=>H.reduce((L,I)=>{let $=I[A];return L[$]=nH(L[$],I),L},{}),II=(H,A,L)=>H.length===A.length&&H.every(L?.isEqual?(I,$)=>L.isEqual(I,A[$]):(I,$)=>I===A[$]);var hA=(H,A)=>uA(H)===A,uA=(H)=>{let A=typeof H;return A==="object"?H===null?"null":"object":A==="function"?"object":A},rA={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},_p={...rA,function:"a function"};class Wp extends Error{}var xH=(H)=>$I(H,Wp),$I=(H,A=Error)=>{throw new A(H)};class Qf extends Error{name="ParseError"}var G=(H)=>$I(H,Qf),JL=(H)=>` ${H}`;var fH=(H,A)=>{let L={},I=Array.isArray(H),$=!1;return Object.entries(H).forEach((f,E)=>{let D=I?A(E,f[1]):A(...f,E);$||=typeof D[0]==="number",(Array.isArray(D[0])||D.length===0?D:[D]).forEach(([o,u])=>{if(typeof o==="object")L[o.group]=nH(L[o.group],u);else L[o]=u})}),$?Object.values(L):L};var R1=Object.entries;var gH=(H,A)=>(H in A),K$=(H,A)=>(A in H);class Y1{constructor(H){Object.assign(this,H)}}var mp=class{};class zf extends mp{}var tm=(H,A)=>{let L={},I={},$;for($ in H)if($ in A)L[$]=H[$];else I[$]=H[$];return[L,I]};var Pp=(H,A)=>tm(H,A)[1],ZL=(H)=>Object.keys(H).length===0,bf=(H)=>[...Object.entries(H),...Object.getOwnPropertySymbols(H).map((A)=>[A,H[A]])],Xp=(H,A)=>Object.defineProperties(H,Object.getOwnPropertyDescriptors(A)),Sp=(H)=>{let A=Object.keys(H).sort(),L={};for(let I=0;I<A.length;I++)L[A[I]]=H[A[I]];return L};var LL=JL("represents an uninitialized value"),Jp=(H)=>Object.values(H).filter((A)=>{if(typeof A==="number")return!0;return typeof H[A]!=="number"});var Q1={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},z1=globalThis.File??Blob,b1={ArrayBuffer,Blob,File:z1,FormData,Headers,Request,Response,URL},im={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},jI={...Q1,...b1,...im,String,Number,Boolean},Zf=(H)=>{let A=Object.getPrototypeOf(H);while(A?.constructor&&(!gH(A.constructor.name,jI)||!(H instanceof jI[A.constructor.name])))A=Object.getPrototypeOf(A);let L=A?.constructor?.name;if(L===void 0||L==="Object")return;return L},hf=(H)=>typeof H==="object"&&H!==null?Zf(H)??"object":uA(H);var KH=Array.isArray,pm={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},nm={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},Bm={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},Vp={...pm,...nm,...Bm},rf=(H)=>{let A=Object(H).name??null;return A&&gH(A,jI)&&jI[A]===H?A:null};var Z1=(H,A)=>{let L=H.prototype;while(L!==null){if(L===A.prototype)return!0;L=Object.getPrototypeOf(L)}return!1};var wp=(H)=>Kp(H,new Map),Kp=(H,A)=>{if(typeof H!=="object"||H===null)return H;if(A?.has(H))return A.get(H);let L=rf(H.constructor);if(L==="Date")return new Date(H.getTime());if(L&&L!=="Array")return H;let I=Array.isArray(H)?H.slice():Object.create(Object.getPrototypeOf(H)),$=Object.getOwnPropertyDescriptors(H);if(A){A.set(H,I);for(let f in $){let E=$[f];if("get"in E||"set"in E)continue;E.value=Kp(E.value,A)}}return Object.defineProperties(I,$),I};var cm=(H)=>{let A=LL;return()=>A===LL?A=H():A},FI=(H)=>typeof H==="function"&&H.length===0;var vp=class extends Function{constructor(...H){let A=H.slice(0,-1),L=H.at(-1);try{super(...A,L)}catch(I){return xH(`Encountered an unexpected error while compiling your definition:
48
- Message: ${I}
49
- Source: (${H.slice(0,-1)}) => {
50
- ${H.at(-1)}
51
- }`)}}};class VL{constructor(H,...[A]){return Object.assign(Object.setPrototypeOf(H.bind(A?.bind??this),this.constructor.prototype),A?.attach)}}var ap=cm(()=>{try{return new Function("return false")()}catch{return!0}});var cO=JL("brand");var lp=JL("arkInferred");var CO=JL("args");class JA{constructor(){}}var xm=()=>{try{return((new Error().stack?.split(`
52
- `)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},Um=globalThis.process?.env??{},Op={fileName:xm,env:Um};var sp=(H)=>H[0].toUpperCase()+H.slice(1);var h1=(H)=>new RegExp(Cm(H),typeof H==="string"?"":H.flags);var Cm=(H)=>{return`^(?:${typeof H==="string"?H:H.source})$`};var fI={negativeLookahead:(H)=>`(?!${H})`,nonCapturingGroup:(H)=>`(?:${H})`},jf="\\",_I={" ":1,"\n":1,"\t":1};var Tm=/^-0\.?0*$/.source,yp=/[1-9]\d*/.source,Gm=/\.\d+/.source,Fm=/\.\d*[1-9]/.source,Rp=(H)=>h1(fI.negativeLookahead(Tm)+fI.nonCapturingGroup("-?"+fI.nonCapturingGroup(fI.nonCapturingGroup("0|"+yp)+fI.nonCapturingGroup(H.decimalPattern)+"?")+(H.allowDecimalOnly?"|"+H.decimalPattern:"")+"?")),Np=Rp({decimalPattern:Fm,allowDecimalOnly:!1}),_m=Np.test.bind(Np),nD=Rp({decimalPattern:Gm,allowDecimalOnly:!0}),PO=nD.test.bind(nD),Wm=/^-?\d*\.?\d*$/,mm=(H)=>H.length!==0&&Wm.test(H),kf=h1(fI.negativeLookahead("^-0$")+"-?"+fI.nonCapturingGroup(fI.nonCapturingGroup("0|"+yp))),Pm=kf.test.bind(kf),r1=/^-?\d+$/,Xm=r1.test.bind(r1),Yp={number:"a number",bigint:"a bigint",integer:"an integer"},Qp=(H,A)=>`'${H}' was parsed as ${Yp[A]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,Sm=(H,A)=>A==="number"?_m(H):Pm(H),Jm=(H,A)=>A==="number"?Number(H):Number.parseInt(H),Vm=(H,A)=>A==="number"?mm(H):Xm(H),zp=(H,A)=>j1(H,"number",A),bp=(H,A)=>j1(H,"number",{...A,strict:!0}),Zp=(H,A)=>j1(H,"integer",A),j1=(H,A,L)=>{let I=Jm(H,A);if(!Number.isNaN(I)){if(Vm(H,A)){if(L?.strict)return Sm(H,A)?I:G(Qp(H,A));return I}}return L?.errorOnFail?G(L?.errorOnFail===!0?`Failed to parse ${Yp[A]} from '${H}'`:L?.errorOnFail):void 0},hp=(H)=>{if(H[H.length-1]!=="n")return;let A=H.slice(0,-1),L;try{L=BigInt(A)}catch{return}if(kf.test(A))return L;if(r1.test(A))return G(Qp(H,"bigint"))};var wm="0.45.9",Km={version:wm,filename:Op.fileName(),FileConstructor:z1},kI=Km,rp=new WeakMap,k1=Object.create(null),df=(H)=>{let A=rp.get(H);if(A)return A;let L=vm(H);if(k1[L])L=`${L}${k1[L]++}`;else k1[L]=1;return kI[L]=H,rp.set(H,L),L},v$=(H)=>/^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(H),vm=(H)=>{switch(typeof H){case"object":{if(H===null)break;let A=Zf(H)??"object";return A[0].toLowerCase()+A.slice(1)}case"function":return v$(H.name)?H.name:"fn";case"symbol":return H.description&&v$(H.description)?H.description:"symbol"}return xH(`Unexpected attempt to register serializable value of type ${uA(H)}`)};var BD=(H)=>typeof H==="string"?JSON.stringify(H):typeof H==="bigint"?`${H}n`:`${H}`;var jp=(H,A={})=>qf(H,{onUndefined:"$ark.undefined",onBigInt:(L)=>`$ark.bigint-${L}`,...A},[]);var IH=(H,A)=>{switch(uA(H)){case"object":let L=H,I=L.constructor.name;return I==="Object"||I==="Array"?JSON.stringify(qf(L,cD,[]),null,A):L instanceof Date?dI(L):typeof L.expression==="string"?L.expression:I;case"symbol":return cD.onSymbol(H);default:return BD(H)}},cD={onCycle:()=>"(cycle)",onSymbol:(H)=>`Symbol(${df(H)})`,onFunction:(H)=>`Function(${df(H)})`},qf=(H,A,L)=>{switch(uA(H)){case"object":{let I=H;if("toJSON"in I&&typeof I.toJSON==="function")return I.toJSON();if(typeof I==="function")return cD.onFunction(I);if(L.includes(I))return"(cycle)";let $=[...L,I];if(Array.isArray(I))return I.map((E)=>qf(E,A,$));if(I instanceof Date)return I.toDateString();let f={};for(let E in I)f[E]=qf(I[E],A,$);for(let E of Object.getOwnPropertySymbols(I))f[A.onSymbol?.(E)??E.toString()]=qf(I[E],A,$);return f}case"symbol":return cD.onSymbol(H);case"bigint":return A.onBigInt?.(H)??`${H}n`;case"undefined":return A.onUndefined??"undefined";case"string":return H.replaceAll("\\","\\\\");default:return H}},dI=(H)=>{let A=H.getFullYear(),L=H.getMonth(),I=H.getDate(),$=H.getHours(),f=H.getMinutes(),E=H.getSeconds(),D=H.getMilliseconds();if(L===0&&I===1&&$===0&&f===0&&E===0&&D===0)return`${A}`;let M=`${am[L]} ${I}, ${A}`;if($===0&&f===0&&E===0&&D===0)return M;let o=H.toLocaleTimeString(),u=o.endsWith(" AM")||o.endsWith(" PM")?o.slice(-3):"";if(u)o=o.slice(0,-u.length);if(D)o+=`.${Om(D,3)}`;else if(lm.test(o))o=o.slice(0,-3);return`${o+u}, ${M}`},am=["January","February","March","April","May","June","July","August","September","October","November","December"],lm=/:\d\d:00$/,Om=(H,A)=>String(H).padStart(A,"0");var kp=(H,A,...[L])=>{let I=L?.stringifySymbol??IH,$=H;switch(typeof A){case"string":$=v$(A)?H===""?A:`${H}.${A}`:`${H}[${JSON.stringify(A)}]`;break;case"number":$=`${H}[${A}]`;break;case"symbol":$=`${H}[${I(A)}]`;break;default:if(L?.stringifyNonKey)$=`${H}[${L.stringifyNonKey(A)}]`;else G(`${IH(A)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return $},EI=(H,...A)=>H.reduce((L,I)=>kp(L,I,...A),"");class gf extends pD{cache={};constructor(...H){super();this.push(...H)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let H=0;H<this.length;H++)this.cache.json.push(typeof this[H]==="symbol"?IH(this[H]):this[H]);return this.cache.json}stringify(){if(this.cache.stringify)return this.cache.stringify;return this.cache.stringify=EI(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let H="",A=[H];return this.forEach((L)=>{H=kp(H,L),A.push(H)}),this.cache.stringifyAncestors=A}}class d1{chars;i;def;constructor(H){this.def=H,this.chars=[...H],this.i=0}shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}get nextLookahead(){return this.chars[this.i+1]??""}get length(){return this.chars.length}shiftUntil(H){let A="";while(this.lookahead){if(H(this,A))if(A[A.length-1]===jf)A=A.slice(0,-1);else break;A+=this.shift()}return A}shiftUntilLookahead(H){return typeof H==="string"?this.shiftUntil((A)=>A.lookahead===H):this.shiftUntil((A)=>(A.lookahead in H))}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in _I))}jumpToIndex(H){this.i=H<0?this.length+H:H}jumpForward(H){this.i+=H}get location(){return this.i}get unscanned(){return this.chars.slice(this.i,this.length).join("")}get scanned(){return this.chars.slice(0,this.i).join("")}sliceChars(H,A){return this.chars.slice(H,A).join("")}lookaheadIs(H){return this.lookahead===H}lookaheadIsIn(H){return this.lookahead in H}}var dO=JL("implementedTraits");var q1="$ark",sm=2;while(q1 in globalThis)q1=`$ark${sm++}`;var dp=q1;globalThis[dp]=kI;var S=kI,Nm=(H)=>`${dp}.${H}`,rH=(H)=>Nm(df(H));class xD extends zf{argNames;body="";constructor(...H){super();this.argNames=H;for(let A of H){if(A in this)throw new Error(`Arg name '${A}' would overwrite an existing property on FunctionBody`);this[A]=A}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop(H,A=!1){return g1(H,A)}index(H,A=!1){return qp(`${H}`,A)}line(H){return this.body+=`${" ".repeat(this.indentation)}${H}
53
- `,this}const(H,A){return this.line(`const ${H} = ${A}`),this}let(H,A){return this.line(`let ${H} = ${A}`)}set(H,A){return this.line(`${H} = ${A}`)}if(H,A){return this.block(`if (${H})`,A)}elseIf(H,A){return this.block(`else if (${H})`,A)}else(H){return this.block("else",H)}for(H,A,L=0){return this.block(`for (let i = ${L}; ${H}; i++)`,A)}forIn(H,A){return this.block(`for (const k in ${H})`,A)}block(H,A,L=""){return this.line(`${H} {`),this.indent(),A(this),this.dedent(),this.line(`}${L}`)}return(H=""){return this.line(`return ${H}`)}write(H="anonymous",A=0){return`${H}(${this.argNames.join(", ")}) { ${A?this.body.split(`
54
- `).map((L)=>" ".repeat(A)+`${L}`).join(`
55
- `):this.body} }`}compile(){return new vp(...this.argNames,this.body)}}var DI=(H)=>hA(H,"object")||typeof H==="symbol"?rH(H):BD(H),g1=(H,A=!1)=>{if(typeof H==="string"&&v$(H))return`${A?"?":""}.${H}`;return qp(ym(H),A)},ym=(H)=>typeof H==="symbol"?rH(H):JSON.stringify(H),qp=(H,A=!1)=>`${A?"?.":""}[${H}]`;class ef extends xD{traversalKind;optimistic;constructor(H){super("data","ctx");this.traversalKind=H.kind,this.optimistic=H.optimistic===!0}invoke(H,A){let L=A?.arg??this.data,I=typeof H==="string"?!0:this.requiresContextFor(H),$=typeof H==="string"?H:H.id;if(I)return`${this.referenceToId($,A)}(${L}, ${this.ctx})`;return`${this.referenceToId($,A)}(${L})`}referenceToId(H,A){let L=A?.kind??this.traversalKind,I=`this.${H}${L}`;return A?.bind?`${I}.bind(${A?.bind})`:I}requiresContextFor(H){return this.traversalKind==="Apply"||H.allowsRequiresContext}initializeErrorCount(){return this.const("errorCount","ctx.currentErrorCount")}returnIfFail(){return this.if("ctx.currentErrorCount > errorCount",()=>this.return())}returnIfFailFast(){return this.if("ctx.failFast && ctx.currentErrorCount > errorCount",()=>this.return())}traverseKey(H,A,L){let I=this.requiresContextFor(L);if(I)this.line(`${this.ctx}.path.push(${H})`);if(this.check(L,{arg:A}),I)this.line(`${this.ctx}.path.pop()`);return this}check(H,A){return this.traversalKind==="Allows"?this.if(`!${this.invoke(H,A)}`,()=>this.return(!1)):this.line(this.invoke(H,A))}}var UD=(H)=>fH(H,(A,L)=>[A,KH(L)?[...L]:L]),RA=JL("arkKind"),b=(H,A)=>H?.[RA]===A,NH=(H)=>b(H,"root")||b(H,"constraint");var gp=["unit","proto","domain"],a$=["required","optional","index","sequence"],e1=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],CD=[...e1,...a$,"structure","predicate"],l$=["alias","union","morph","unit","intersection","proto","domain"],Rm=[...l$,...CD],TD=fH(CD,(H,A)=>[A,1]),ep=fH([...a$,"undeclared"],(H,A)=>[A,1]),Hn=fH(Rm,(H,A)=>[A,H]),O$=(H)=>typeof H==="string"&&(H in Hn);var s$=(H)=>Hn[H],GD=(H)=>l$.slice(s$(H)+1),v2=[...GD("union"),"alias"],a2=[...GD("morph"),"alias"],iL=(H)=>{if(typeof H==="string"||typeof H==="boolean"||H===null)return H;if(typeof H==="number"){if(Number.isNaN(H))return"NaN";if(H===Number.POSITIVE_INFINITY)return"Infinity";if(H===Number.NEGATIVE_INFINITY)return"-Infinity";return H}return DI(H)},WI=(H)=>{let A="{ ";for(let[L,I]of Object.entries(H))A+=`${L}: ${DI(I)}, `;return A+" }"},$H=(H)=>{let A=H;if(A.hasAssociatedError)A.defaults.expected??=(L)=>("description"in L)?L.description:A.defaults.description(L),A.defaults.actual??=(L)=>IH(L),A.defaults.problem??=(L)=>`must be ${L.expected}${L.actual?` (was ${L.actual})`:""}`,A.defaults.message??=(L)=>{if(L.path.length===0)return L.problem;let I=`${L.propString} ${L.problem}`;if(I[0]==="[")return`value at ${I}`;return I};return A};S.config??={};var HE=(H,A)=>{if(!A)return H;let L={...H},I;for(I in A){let $={...H.keywords};if(I==="keywords"){for(let f in A[I]){let E=A.keywords[f];if(E===void 0)continue;$[f]=typeof E==="string"?{description:E}:E}L.keywords=$}else L[I]=O$(I)?{...H[I],...A[I]}:A[I]}return L};class mI extends zf{[RA]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:H,relativePath:A,...L},I){super();this.input=L,this.ctx=I,Xp(this,L);let $=I.data;if(L.code==="union")L.errors=L.errors.flatMap((E)=>{let D=E.hasCode("union")?E.errors:[E];if(!H&&!A)return D;return D.map((M)=>M.transform((o)=>({...o,path:Gp(H,o.path,A)})))});this.nodeConfig=I.config[this.code];let f=[...L.path??I.path];if(A)f.push(...A);if(H)f.unshift(...H);this.path=new gf(...f),this.data="data"in L?L.data:$}transform(H){return new mI(H({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(H){return this.code===H}get propString(){return EI(this.path)}get expected(){if(this.input.expected)return this.input.expected;let H=this.meta?.expected??this.nodeConfig.expected;return typeof H==="function"?H(this.input):H}get actual(){if(this.input.actual)return this.input.actual;let H=this.meta?.actual??this.nodeConfig.actual;return typeof H==="function"?H(this.data):H}get problem(){if(this.input.problem)return this.input.problem;let H=this.meta?.problem??this.nodeConfig.problem;return typeof H==="function"?H(this):H}get message(){if(this.input.message)return this.input.message;let H=this.meta?.message??this.nodeConfig.message;return typeof H==="function"?H(this):H}get flat(){return this.hasCode("intersection")?[...this.errors]:[this]}toJSON(){return{data:this.data,path:this.path,...this.input,expected:this.expected,actual:this.actual,problem:this.problem,message:this.message}}toString(){return this.message}throw(){throw this}}class jA extends pD{[RA]="errors";ctx;constructor(H){super();this.ctx=H}byPath=Object.create(null);get flatByPath(){return fH(this.byPath,(H,A)=>[H,A.flat])}get flatProblemsByPath(){return fH(this.byPath,(H,A)=>[H,A.flat.map((L)=>L.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new Ho(this)}add(H){if(this.includes(H))return;this._add(H)}transform(H){let A=new jA(this.ctx);return this.forEach((L)=>A.add(H(L))),A}merge(H){H.forEach((A)=>{if(this.includes(A))return;this._add(new mI({...A,path:[...this.ctx.path,...A.path]},this.ctx))})}affectsPath(H){if(this.length===0)return!1;return H.stringifyAncestors().some((A)=>(A in this.byPath))||H.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map((H)=>H.toJSON())]}toString(){return this.join(`
56
- `)}_add(H){let A=this.byPath[H.propString];if(A){if(A.hasCode("union")&&A.errors.length===0)return;let L=H.hasCode("union")&&H.errors.length===0?H:new mI({code:"intersection",errors:A.hasCode("intersection")?[...A.errors,H]:[A,H]},this.ctx),I=this.indexOf(A);this.mutable[I===-1?this.length:I]=L,this.byPath[H.propString]=L,this.addAncestorPaths(H)}else this.byPath[H.propString]=H,this.addAncestorPaths(H),this.mutable.push(H);this.count++}addAncestorPaths(H){H.path.stringifyAncestors().forEach((A)=>{this.byAncestorPath[A]=nH(this.byAncestorPath[A],H)})}}class Ho extends Error{name="TraversalError";constructor(H){if(H.length===1)super(H.summary);else super(`
57
- `+H.map((A)=>` \u2022 ${Ym(A)}`).join(`
58
- `));Object.defineProperty(this,"arkErrors",{value:H,enumerable:!1})}}var Ym=(H)=>H.toString().split(`
47
+ `+p)}i.destroy()}var hT=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];function wV(i){if(i+="",i.length<1)return!1;if(!hT[i.charCodeAt(0)])return ci('invalid header, index 0, char "%s"',i.charCodeAt(0)),!0;if(i.length<2)return!1;if(!hT[i.charCodeAt(1)])return ci('invalid header, index 1, char "%s"',i.charCodeAt(1)),!0;if(i.length<3)return!1;if(!hT[i.charCodeAt(2)])return ci('invalid header, index 2, char "%s"',i.charCodeAt(2)),!0;if(i.length<4)return!1;if(!hT[i.charCodeAt(3)])return ci('invalid header, index 3, char "%s"',i.charCodeAt(3)),!0;for(let o=4;o<i.length;++o)if(!hT[i.charCodeAt(o)])return ci('invalid header, index "%i", char "%s"',o,i.charCodeAt(o)),!0;return!1}});var v9=P((J9)=>{Object.defineProperty(J9,"__esModule",{value:!0});J9.Polling=void 0;var WV=Rc(),F9=Hi("zlib"),RV=B0(),YV=Go(),Mn=YV.default("engine:polling"),GV={gzip:F9.createGzip,deflate:F9.createDeflate};class $9 extends WV.Transport{constructor(i){super(i);this.closeTimeout=30000}get name(){return"polling"}onRequest(i){let o=i.res;if(i.res=null,i.getMethod()==="get")this.onPollRequest(i,o);else if(i.getMethod()==="post")this.onDataRequest(i,o);else o.writeStatus("500 Internal Server Error"),o.end()}onPollRequest(i,o){if(this.req){Mn("request overlap"),this.onError("overlap from client"),o.writeStatus("500 Internal Server Error"),o.end();return}Mn("setting request"),this.req=i,this.res=o;let n=()=>{this.writable=!1,this.onError("poll connection closed prematurely")},p=()=>{this.req=this.res=null};if(i.cleanup=p,o.onAborted(n),this.writable=!0,this.emit("ready"),this.writable&&this.shouldClose)Mn("triggering empty send to append close packet"),this.send([{type:"noop"}])}onDataRequest(i,o){if(this.dataReq){this.onError("data request overlap from client"),o.writeStatus("500 Internal Server Error"),o.end();return}let n=Number(i.headers["content-length"]);if(!n){this.onError("content-length header required"),o.writeStatus("411 Length Required").end();return}if(n>this.maxHttpBufferSize){this.onError("payload too large"),o.writeStatus("413 Payload Too Large").end();return}if(i.headers["content-type"]==="application/octet-stream"&&this.protocol===4)return this.onError("invalid content");this.dataReq=i,this.dataRes=o;let c,x=0,T={"Content-Type":"text/html"};this.headers(i,T);for(let f in T)o.writeHeader(f,String(T[f]));let m=(f)=>{this.onData(f.toString()),this.onDataRequestCleanup(),o.cork(()=>{o.end("ok")})};o.onAborted(()=>{this.onDataRequestCleanup(),this.onError("data request connection closed prematurely")}),o.onData((f,F)=>{let $=x+f.byteLength;if($>n){this.onError("content-length mismatch"),o.close();return}if(!c){if(F){m(Buffer.from(f));return}c=Buffer.allocUnsafe(n)}if(Buffer.from(f).copy(c,x),F){if($!=n){this.onError("content-length mismatch"),o.writeStatus("400 Content-Length Mismatch").end(),this.onDataRequestCleanup();return}m(c);return}x=$})}onDataRequestCleanup(){this.dataReq=this.dataRes=null}onData(i){Mn('received "%s"',i);let o=(n)=>{if(n.type==="close")return Mn("got xhr close packet"),this.onClose(),!1;this.onPacket(n)};if(this.protocol===3)this.parser.decodePayload(i,o);else this.parser.decodePayload(i).forEach(o)}onClose(){if(this.writable)this.send([{type:"noop"}]);super.onClose()}send(i){if(this.writable=!1,this.shouldClose)Mn("appending close packet to payload"),i.push({type:"close"}),this.shouldClose(),this.shouldClose=null;let o=(n)=>{let p=i.some((c)=>{return c.options&&c.options.compress});this.write(n,{compress:p})};if(this.protocol===3)this.parser.encodePayload(i,this.supportsBinary,o);else this.parser.encodePayload(i,o)}write(i,o){Mn('writing "%s"',i),this.doWrite(i,o,()=>{this.req.cleanup(),this.emit("drain")})}doWrite(i,o,n){let p=typeof i==="string",x={"Content-Type":p?"text/plain; charset=UTF-8":"application/octet-stream"},T=(F)=>{this.headers(this.req,x),this.res.cork(()=>{Object.keys(x).forEach(($)=>{this.res.writeHeader($,String(x[$]))}),this.res.end(F)}),n()};if(!this.httpCompression||!o.compress){T(i);return}if((p?Buffer.byteLength(i):i.length)<this.httpCompression.threshold){T(i);return}let f=RV(this.req).encodings(["gzip","deflate"]);if(!f){T(i);return}this.compress(i,f,(F,$)=>{if(F){this.res.writeStatus("500 Internal Server Error"),this.res.end(),n(F);return}x["Content-Encoding"]=f,T($)})}compress(i,o,n){Mn("compressing");let p=[],c=0;GV[o](this.httpCompression).on("error",n).on("data",function(x){p.push(x),c+=x.length}).on("end",function(){n(null,Buffer.concat(p,c))}).end(i)}doClose(i){Mn("closing");let o,n=()=>{clearTimeout(o),i(),this.onClose()};if(this.writable)Mn("transport writable - closing right away"),this.send([{type:"close"}]),n();else if(this.discarded)Mn("transport discarded - closing right away"),n();else Mn("transport not writable - buffering orderly close"),this.shouldClose=n,o=setTimeout(n,this.closeTimeout)}headers(i,o){o=o||{};let n=i.headers["user-agent"];if(n&&(~n.indexOf(";MSIE")||~n.indexOf("Trident/")))o["X-XSS-Protection"]="0";return o["cache-control"]="no-store",this.emit("headers",o,i),o}}J9.Polling=$9});var Y9=P((W9)=>{Object.defineProperty(W9,"__esModule",{value:!0});W9.WebSocket=void 0;var KV=Rc(),HV=Go(),w9=HV.default("engine:ws");class X9 extends KV.Transport{constructor(i){super(i);this.writable=!1,this.perMessageDeflate=null}get name(){return"websocket"}get handlesUpgrades(){return!0}send(i){this.writable=!1;for(let o=0;o<i.length;o++){let n=i[o],p=o+1===i.length,c=(x)=>{let T=typeof x!=="string",m=this.perMessageDeflate&&Buffer.byteLength(x)>this.perMessageDeflate.threshold;if(w9('writing "%s"',x),this.socket.send(x,T,m),p)this.emit("drain"),this.writable=!0,this.emit("ready")};if(n.options&&typeof n.options.wsPreEncoded==="string")c(n.options.wsPreEncoded);else this.parser.encodePacket(n,this.supportsBinary,c)}}doClose(i){w9("closing"),i&&i(),this.socket.end()}}W9.WebSocket=X9});var K9=P((G9)=>{Object.defineProperty(G9,"__esModule",{value:!0});var UV=v9(),ZV=Y9();G9.default={polling:UV.Polling,websocket:ZV.WebSocket}});var z9=P((Z9)=>{Object.defineProperty(Z9,"__esModule",{value:!0});Z9.uServer=void 0;var zV=Go(),Yc=g$(),uV=K9(),ap=zV.default("engine:uws");class H9 extends Yc.BaseServer{init(){}cleanup(){}prepare(i,o){i.method=i.getMethod().toUpperCase(),i.url=i.getUrl();let n=new URLSearchParams(i.getQuery());i._query=Object.fromEntries(n.entries()),i.headers={},i.forEach((p,c)=>{i.headers[p]=c}),i.connection={remoteAddress:Buffer.from(o.getRemoteAddressAsText()).toString()},o.onAborted(()=>{ap("response has been aborted")})}createTransport(i,o){return new uV.default[i](o)}attach(i,o={}){let n=this._computePath(o);i.any(n,this.handleRequest.bind(this)).ws(n,{compression:o.compression,idleTimeout:o.idleTimeout,maxBackpressure:o.maxBackpressure,maxPayloadLength:this.opts.maxHttpBufferSize,upgrade:this.handleUpgrade.bind(this),open:(p)=>{let c=p.getUserData().transport;c.socket=p,c.writable=!0,c.emit("ready")},message:(p,c,x)=>{p.getUserData().transport.onData(x?c:Buffer.from(c).toString())},close:(p,c,x)=>{p.getUserData().transport.onClose(c,x)}})}_applyMiddlewares(i,o,n){if(this.middlewares.length===0)return n();i.res=new U9(o),super._applyMiddlewares(i,i.res,(p)=>{i.res.writeHead(),n(p)})}handleRequest(i,o){ap('handling "%s" http request "%s"',o.getMethod(),o.getUrl()),this.prepare(o,i),o.res=i;let n=(p,c)=>{if(p!==void 0){this.emit("connection_error",{req:o,code:p,message:Yc.Server.errorMessages[p],context:c}),this.abortRequest(o.res,p,c);return}if(o._query.sid)ap("setting new request for existing client"),this.clients[o._query.sid].transport.onRequest(o);else{let x=(T,m)=>this.abortRequest(i,T,m);this.handshake(o._query.transport,o,x)}};this._applyMiddlewares(o,i,(p)=>{if(p)n(Yc.Server.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(o,!1,n)})}handleUpgrade(i,o,n){ap("on upgrade"),this.prepare(o,i),o.res=i;let p=async(c,x)=>{if(c!==void 0){this.emit("connection_error",{req:o,code:c,message:Yc.Server.errorMessages[c],context:x}),this.abortRequest(i,c,x);return}let T=o._query.sid,m;if(T){let f=this.clients[T];if(!f)return ap("upgrade attempt for closed client"),i.close();else if(f.upgrading)return ap("transport has already been trying to upgrade"),i.close();else if(f.upgraded)return ap("transport had already been upgraded"),i.close();else ap("upgrading existing transport"),m=this.createTransport(o._query.transport,o),f._maybeUpgrade(m)}else if(m=await this.handshake(o._query.transport,o,(f,F)=>this.abortRequest(i,f,F)),!m)return;o.res.writeStatus("101 Switching Protocols"),i.upgrade({transport:m},o.getHeader("sec-websocket-key"),o.getHeader("sec-websocket-protocol"),o.getHeader("sec-websocket-extensions"),n)};this._applyMiddlewares(o,i,(c)=>{if(c)p(Yc.Server.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(o,!0,p)})}abortRequest(i,o,n){let p=o===Yc.Server.errors.FORBIDDEN?"403 Forbidden":"400 Bad Request",c=n&&n.message?n.message:Yc.Server.errorMessages[o];i.writeStatus(p),i.writeHeader("Content-Type","application/json"),i.end(JSON.stringify({code:o,message:c}))}}Z9.uServer=H9;class U9{constructor(i){this.res=i,this.statusWritten=!1,this.headers=[],this.isAborted=!1}set statusCode(i){if(!i)return;this.writeStatus(i===200?"200 OK":"204 No Content")}writeHead(i){this.statusCode=i}setHeader(i,o){if(Array.isArray(o))o.forEach((n)=>{this.writeHeader(i,n)});else this.writeHeader(i,o)}removeHeader(){}getHeader(){}writeStatus(i){if(this.isAborted)return;return this.res.writeStatus(i),this.statusWritten=!0,this.writeBufferedHeaders(),this}writeHeader(i,o){if(this.isAborted)return;if(i==="Content-Length")return;if(this.statusWritten)this.res.writeHeader(i,o);else this.headers.push([i,o])}writeBufferedHeaders(){this.headers.forEach(([i,o])=>{this.res.writeHeader(i,o)})}end(i){if(this.isAborted)return;this.res.cork(()=>{if(!this.statusWritten)this.writeBufferedHeaders();this.res.end(i)})}onData(i){if(this.isAborted)return;this.res.onData(i)}onAborted(i){if(this.isAborted)return;this.res.onAborted(()=>{this.isAborted=!0,i()})}cork(i){if(this.isAborted)return;this.res.cork(i)}}});var E9=P((Mx)=>{Object.defineProperty(Mx,"__esModule",{value:!0});Mx.protocol=Mx.Transport=Mx.Socket=Mx.uServer=Mx.parser=Mx.transports=Mx.Server=void 0;Mx.listen=_V;Mx.attach=V9;var QV=Hi("http"),u9=g$();Object.defineProperty(Mx,"Server",{enumerable:!0,get:function(){return u9.Server}});var VV=l$();Mx.transports=VV.default;var Q9=kT();Mx.parser=Q9;var SV=z9();Object.defineProperty(Mx,"uServer",{enumerable:!0,get:function(){return SV.uServer}});var EV=q$();Object.defineProperty(Mx,"Socket",{enumerable:!0,get:function(){return EV.Socket}});var OV=Rc();Object.defineProperty(Mx,"Transport",{enumerable:!0,get:function(){return OV.Transport}});Mx.protocol=Q9.protocol;function _V(i,o,n){if(typeof o==="function")n=o,o={};let p=QV.createServer(function(x,T){T.writeHead(501),T.end("Not Implemented")}),c=V9(p,o);return c.httpServer=p,p.listen(i,n),c}function V9(i,o){let n=new u9.Server(o);return n.attach(i,o),n}});var O9=P((BV)=>{BV.Emitter=Po;function Po(i){if(i)return IV(i)}function IV(i){for(var o in Po.prototype)i[o]=Po.prototype[o];return i}Po.prototype.on=Po.prototype.addEventListener=function(i,o){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(o),this};Po.prototype.once=function(i,o){function n(){this.off(i,n),o.apply(this,arguments)}return n.fn=o,this.on(i,n),this};Po.prototype.off=Po.prototype.removeListener=Po.prototype.removeAllListeners=Po.prototype.removeEventListener=function(i,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+i];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;var p;for(var c=0;c<n.length;c++)if(p=n[c],p===o||p.fn===o){n.splice(c,1);break}if(n.length===0)delete this._callbacks["$"+i];return this};Po.prototype.emit=function(i){this._callbacks=this._callbacks||{};var o=new Array(arguments.length-1),n=this._callbacks["$"+i];for(var p=1;p<arguments.length;p++)o[p-1]=arguments[p];if(n){n=n.slice(0);for(var p=0,c=n.length;p<c;++p)n[p].apply(this,o)}return this};Po.prototype.emitReserved=Po.prototype.emit;Po.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};Po.prototype.hasListeners=function(i){return!!this.listeners(i).length}});var s$=P((C9)=>{Object.defineProperty(C9,"__esModule",{value:!0});C9.hasBinary=C9.isBinary=void 0;var bV=typeof ArrayBuffer==="function",jV=(i)=>{return typeof ArrayBuffer.isView==="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer},_9=Object.prototype.toString,PV=typeof Blob==="function"||typeof Blob!=="undefined"&&_9.call(Blob)==="[object BlobConstructor]",aV=typeof File==="function"||typeof File!=="undefined"&&_9.call(File)==="[object FileConstructor]";function L9(i){return bV&&(i instanceof ArrayBuffer||jV(i))||PV&&i instanceof Blob||aV&&i instanceof File}C9.isBinary=L9;function e0(i,o){if(!i||typeof i!=="object")return!1;if(Array.isArray(i)){for(let n=0,p=i.length;n<p;n++)if(e0(i[n]))return!0;return!1}if(L9(i))return!0;if(i.toJSON&&typeof i.toJSON==="function"&&arguments.length===1)return e0(i.toJSON(),!0);for(let n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&e0(i[n]))return!0;return!1}C9.hasBinary=e0});var B9=P((D9)=>{Object.defineProperty(D9,"__esModule",{value:!0});D9.reconstructPacket=D9.deconstructPacket=void 0;var qV=s$();function kV(i){let o=[],n=i.data,p=i;return p.data=t$(n,o),p.attachments=o.length,{packet:p,buffers:o}}D9.deconstructPacket=kV;function t$(i,o){if(!i)return i;if(qV.isBinary(i)){let n={_placeholder:!0,num:o.length};return o.push(i),n}else if(Array.isArray(i)){let n=new Array(i.length);for(let p=0;p<i.length;p++)n[p]=t$(i[p],o);return n}else if(typeof i==="object"&&!(i instanceof Date)){let n={};for(let p in i)if(Object.prototype.hasOwnProperty.call(i,p))n[p]=t$(i[p],o);return n}return i}function hV(i,o){return i.data=d$(i.data,o),delete i.attachments,i}D9.reconstructPacket=hV;function d$(i,o){if(!i)return i;if(i&&i._placeholder===!0)if(typeof i.num==="number"&&i.num>=0&&i.num<o.length)return o[i.num];else throw new Error("illegal attachments");else if(Array.isArray(i))for(let n=0;n<i.length;n++)i[n]=d$(i[n],o);else if(typeof i==="object"){for(let n in i)if(Object.prototype.hasOwnProperty.call(i,n))i[n]=d$(i[n],o)}return i}});var sT=P((q9)=>{Object.defineProperty(q9,"__esModule",{value:!0});q9.Decoder=q9.Encoder=q9.PacketType=q9.protocol=void 0;var sV=O9(),j9=B9(),P9=s$(),tV=Go(),r$=tV.default("socket.io-parser"),dV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];q9.protocol=5;var si;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(si=q9.PacketType||(q9.PacketType={}));class a9{constructor(i){this.replacer=i}encode(i){if(r$("encoding packet %j",i),i.type===si.EVENT||i.type===si.ACK){if(P9.hasBinary(i))return this.encodeAsBinary({type:i.type===si.EVENT?si.BINARY_EVENT:si.BINARY_ACK,nsp:i.nsp,data:i.data,id:i.id})}return[this.encodeAsString(i)]}encodeAsString(i){let o=""+i.type;if(i.type===si.BINARY_EVENT||i.type===si.BINARY_ACK)o+=i.attachments+"-";if(i.nsp&&i.nsp!=="/")o+=i.nsp+",";if(i.id!=null)o+=i.id;if(i.data!=null)o+=JSON.stringify(i.data,this.replacer);return r$("encoded %j as %s",i,o),o}encodeAsBinary(i){let o=j9.deconstructPacket(i),n=this.encodeAsString(o.packet),p=o.buffers;return p.unshift(n),p}}q9.Encoder=a9;function N9(i){return Object.prototype.toString.call(i)==="[object Object]"}class e$ extends sV.Emitter{constructor(i){super();this.reviver=i}add(i){let o;if(typeof i==="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");o=this.decodeString(i);let n=o.type===si.BINARY_EVENT;if(n||o.type===si.BINARY_ACK){if(o.type=n?si.EVENT:si.ACK,this.reconstructor=new l9(o),o.attachments===0)super.emitReserved("decoded",o)}else super.emitReserved("decoded",o)}else if(P9.isBinary(i)||i.base64){if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");else if(o=this.reconstructor.takeBinaryData(i),o)this.reconstructor=null,super.emitReserved("decoded",o)}else throw new Error("Unknown type: "+i)}decodeString(i){let o=0,n={type:Number(i.charAt(0))};if(si[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===si.BINARY_EVENT||n.type===si.BINARY_ACK){let c=o+1;while(i.charAt(++o)!=="-"&&o!=i.length);let x=i.substring(c,o);if(x!=Number(x)||i.charAt(o)!=="-")throw new Error("Illegal attachments");n.attachments=Number(x)}if(i.charAt(o+1)==="/"){let c=o+1;while(++o){if(i.charAt(o)===",")break;if(o===i.length)break}n.nsp=i.substring(c,o)}else n.nsp="/";let p=i.charAt(o+1);if(p!==""&&Number(p)==p){let c=o+1;while(++o){let x=i.charAt(o);if(x==null||Number(x)!=x){--o;break}if(o===i.length)break}n.id=Number(i.substring(c,o+1))}if(i.charAt(++o)){let c=this.tryParse(i.substr(o));if(e$.isPayloadValid(n.type,c))n.data=c;else throw new Error("invalid payload")}return r$("decoded %s as %j",i,n),n}tryParse(i){try{return JSON.parse(i,this.reviver)}catch(o){return!1}}static isPayloadValid(i,o){switch(i){case si.CONNECT:return N9(o);case si.DISCONNECT:return o===void 0;case si.CONNECT_ERROR:return typeof o==="string"||N9(o);case si.EVENT:case si.BINARY_EVENT:return Array.isArray(o)&&(typeof o[0]==="number"||typeof o[0]==="string"&&dV.indexOf(o[0])===-1);case si.ACK:case si.BINARY_ACK:return Array.isArray(o)}}destroy(){if(this.reconstructor)this.reconstructor.finishedReconstruction(),this.reconstructor=null}}q9.Decoder=e$;class l9{constructor(i){this.packet=i,this.buffers=[],this.reconPack=i}takeBinaryData(i){if(this.buffers.push(i),this.buffers.length===this.reconPack.attachments){let o=j9.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),o}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}});var t9=P((g9)=>{Object.defineProperty(g9,"__esModule",{value:!0});g9.Client=void 0;var i1=sT(),iS=Go(),oS=Hi("url"),Nn=iS("socket.io:client");class h9{constructor(i,o){this.sockets=new Map,this.nsps=new Map,this.server=i,this.conn=o,this.encoder=i.encoder,this.decoder=new i._parser.Decoder,this.id=o.id,this.setup()}get request(){return this.conn.request}setup(){this.onclose=this.onclose.bind(this),this.ondata=this.ondata.bind(this),this.onerror=this.onerror.bind(this),this.ondecoded=this.ondecoded.bind(this),this.decoder.on("decoded",this.ondecoded),this.conn.on("data",this.ondata),this.conn.on("error",this.onerror),this.conn.on("close",this.onclose),this.connectTimeout=setTimeout(()=>{if(this.nsps.size===0)Nn("no namespace joined yet, close the client"),this.close();else Nn("the client has already joined a namespace, nothing to do")},this.server._connectTimeout)}connect(i,o={}){if(this.server._nsps.has(i))return Nn("connecting to namespace %s",i),this.doConnect(i,o);this.server._checkNamespace(i,o,(n)=>{if(n)this.doConnect(i,o);else Nn("creation of namespace %s was denied",i),this._packet({type:i1.PacketType.CONNECT_ERROR,nsp:i,data:{message:"Invalid namespace"}})})}doConnect(i,o){let n=this.server.of(i);n._add(this,o,(p)=>{if(this.sockets.set(p.id,p),this.nsps.set(n.name,p),this.connectTimeout)clearTimeout(this.connectTimeout),this.connectTimeout=void 0})}_disconnect(){for(let i of this.sockets.values())i.disconnect();this.sockets.clear(),this.close()}_remove(i){if(this.sockets.has(i.id)){let o=this.sockets.get(i.id).nsp.name;this.sockets.delete(i.id),this.nsps.delete(o)}else Nn("ignoring remove for %s",i.id)}close(){if(this.conn.readyState==="open")Nn("forcing transport close"),this.conn.close(),this.onclose("forced server close")}_packet(i,o={}){if(this.conn.readyState!=="open"){Nn("ignoring packet write %j",i);return}let n=o.preEncoded?i:this.encoder.encode(i);this.writeToEngine(n,o)}writeToEngine(i,o){if(o.volatile&&!this.conn.transport.writable){Nn("volatile packet is discarded since the transport is not currently writable");return}let n=Array.isArray(i)?i:[i];for(let p of n)this.conn.write(p,o)}ondata(i){try{this.decoder.add(i)}catch(o){Nn("invalid packet format"),this.onerror(o)}}ondecoded(i){let o,n;if(this.conn.protocol===3){let c=oS.parse(i.nsp,!0);o=c.pathname,n=c.query}else o=i.nsp,n=i.data;let p=this.nsps.get(o);if(!p&&i.type===i1.PacketType.CONNECT)this.connect(o,n);else if(p&&i.type!==i1.PacketType.CONNECT&&i.type!==i1.PacketType.CONNECT_ERROR)process.nextTick(function(){p._onpacket(i)});else Nn("invalid state (packet type: %s)",i.type),this.close()}onerror(i){for(let o of this.sockets.values())o._onerror(i);this.conn.close()}onclose(i,o){Nn("client close with reason %s",i),this.destroy();for(let n of this.sockets.values())n._onclose(i,o);this.sockets.clear(),this.decoder.destroy()}destroy(){if(this.conn.removeListener("data",this.ondata),this.conn.removeListener("error",this.onerror),this.conn.removeListener("close",this.onclose),this.decoder.removeListener("decoded",this.ondecoded),this.connectTimeout)clearTimeout(this.connectTimeout),this.connectTimeout=void 0}}g9.Client=h9});var o1=P((r9)=>{Object.defineProperty(r9,"__esModule",{value:!0});r9.StrictEventEmitter=void 0;var nS=Hi("events");class d9 extends nS.EventEmitter{on(i,o){return super.on(i,o)}once(i,o){return super.once(i,o)}emit(i,...o){return super.emit(i,...o)}emitReserved(i,...o){return super.emit(i,...o)}emitUntyped(i,...o){return super.emit(i,...o)}listeners(i){return super.listeners(i)}}r9.StrictEventEmitter=d9});var iJ=P((iR)=>{Object.defineProperty(iR,"__esModule",{value:!0});iR.RESERVED_EVENTS=void 0;iR.RESERVED_EVENTS=new Set(["connect","connect_error","disconnect","disconnecting","newListener","removeListener"])});var nJ=P((nR)=>{Object.defineProperty(nR,"__esModule",{value:!0});nR.RemoteSocket=nR.BroadcastOperator=void 0;var pS=iJ(),cS=sT();class Xp{constructor(i,o=new Set,n=new Set,p={}){this.adapter=i,this.rooms=o,this.exceptRooms=n,this.flags=p}to(i){let o=new Set(this.rooms);if(Array.isArray(i))i.forEach((n)=>o.add(n));else o.add(i);return new Xp(this.adapter,o,this.exceptRooms,this.flags)}in(i){return this.to(i)}except(i){let o=new Set(this.exceptRooms);if(Array.isArray(i))i.forEach((n)=>o.add(n));else o.add(i);return new Xp(this.adapter,this.rooms,o,this.flags)}compress(i){let o=Object.assign({},this.flags,{compress:i});return new Xp(this.adapter,this.rooms,this.exceptRooms,o)}get volatile(){let i=Object.assign({},this.flags,{volatile:!0});return new Xp(this.adapter,this.rooms,this.exceptRooms,i)}get local(){let i=Object.assign({},this.flags,{local:!0});return new Xp(this.adapter,this.rooms,this.exceptRooms,i)}timeout(i){let o=Object.assign({},this.flags,{timeout:i});return new Xp(this.adapter,this.rooms,this.exceptRooms,o)}emit(i,...o){if(pS.RESERVED_EVENTS.has(i))throw new Error(`"${String(i)}" is a reserved event name`);let n=[i,...o],p={type:cS.PacketType.EVENT,data:n};if(typeof n[n.length-1]!=="function")return this.adapter.broadcast(p,{rooms:this.rooms,except:this.exceptRooms,flags:this.flags}),!0;let x=n.pop(),T=!1,m=[],f=setTimeout(()=>{T=!0,x.apply(this,[new Error("operation has timed out"),this.flags.expectSingleResponse?null:m])},this.flags.timeout),F=-1,$=0,J=0,A=()=>{if(!T&&F===$&&m.length===J)clearTimeout(f),x.apply(this,[null,this.flags.expectSingleResponse?m[0]:m])};return this.adapter.broadcastWithAck(p,{rooms:this.rooms,except:this.exceptRooms,flags:this.flags},(X)=>{J+=X,$++,A()},(X)=>{m.push(X),A()}),this.adapter.serverCount().then((X)=>{F=X,A()}),!0}emitWithAck(i,...o){return new Promise((n,p)=>{o.push((c,x)=>{if(c)return c.responses=x,p(c);else return n(x)}),this.emit(i,...o)})}allSockets(){if(!this.adapter)throw new Error("No adapter for this namespace, are you trying to get the list of clients of a dynamic namespace?");return this.adapter.sockets(this.rooms)}fetchSockets(){return this.adapter.fetchSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags}).then((i)=>{return i.map((o)=>{if(o.server)return o;else return new oJ(this.adapter,o)})})}socketsJoin(i){this.adapter.addSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},Array.isArray(i)?i:[i])}socketsLeave(i){this.adapter.delSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},Array.isArray(i)?i:[i])}disconnectSockets(i=!1){this.adapter.disconnectSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},i)}}nR.BroadcastOperator=Xp;class oJ{constructor(i,o){this.id=o.id,this.handshake=o.handshake,this.rooms=new Set(o.rooms),this.data=o.data,this.operator=new Xp(i,new Set([this.id]),new Set,{expectSingleResponse:!0})}timeout(i){return this.operator.timeout(i)}emit(i,...o){return this.operator.emit(i,...o)}join(i){return this.operator.socketsJoin(i)}leave(i){return this.operator.socketsLeave(i)}disconnect(i=!1){return this.operator.disconnectSockets(i),this}}nR.RemoteSocket=oJ});var pJ=P((zx)=>{var TR=zx&&zx.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(zx,"__esModule",{value:!0});zx.Socket=void 0;var zn=sT(),TS=TR(Go()),mS=o1(),cR=TR(S$()),fS=nJ(),FS=iJ(),yo=TS.default("socket.io:socket"),$S=new Set(["transport error","transport close","forced close","ping timeout","server shutting down","forced server close"]);function xR(){}class mR extends mS.StrictEventEmitter{constructor(i,o,n,p){super();if(this.nsp=i,this.client=o,this.recovered=!1,this.data={},this.connected=!1,this.acks=new Map,this.fns=[],this.flags={},this.server=i.server,this.adapter=this.nsp.adapter,p)this.id=p.sid,this.pid=p.pid,p.rooms.forEach((c)=>this.join(c)),this.data=p.data,p.missedPackets.forEach((c)=>{this.packet({type:zn.PacketType.EVENT,data:c})}),this.recovered=!0;else{if(o.conn.protocol===3)this.id=i.name!=="/"?i.name+"#"+o.id:o.id;else this.id=cR.default.generateId();if(this.server._opts.connectionStateRecovery)this.pid=cR.default.generateId()}this.handshake=this.buildHandshake(n),this.on("error",xR)}buildHandshake(i){var o,n,p,c;return{headers:((o=this.request)===null||o===void 0?void 0:o.headers)||{},time:new Date+"",address:this.conn.remoteAddress,xdomain:!!((n=this.request)===null||n===void 0?void 0:n.headers.origin),secure:!this.request||!!this.request.connection.encrypted,issued:+new Date,url:(p=this.request)===null||p===void 0?void 0:p.url,query:((c=this.request)===null||c===void 0?void 0:c._query)||{},auth:i}}emit(i,...o){if(FS.RESERVED_EVENTS.has(i))throw new Error(`"${String(i)}" is a reserved event name`);let n=[i,...o],p={type:zn.PacketType.EVENT,data:n};if(typeof n[n.length-1]==="function"){let x=this.nsp._ids++;yo("emitting packet with ack id %d",x),this.registerAckCallback(x,n.pop()),p.id=x}let c=Object.assign({},this.flags);if(this.flags={},this.nsp.server.opts.connectionStateRecovery)this.adapter.broadcast(p,{rooms:new Set([this.id]),except:new Set,flags:c});else this.notifyOutgoingListeners(p),this.packet(p,c);return!0}emitWithAck(i,...o){let n=this.flags.timeout!==void 0;return new Promise((p,c)=>{o.push((x,T)=>{if(n)return x?c(x):p(T);else return p(x)}),this.emit(i,...o)})}registerAckCallback(i,o){let n=this.flags.timeout;if(n===void 0){this.acks.set(i,o);return}let p=setTimeout(()=>{yo("event with ack id %d has timed out after %d ms",i,n),this.acks.delete(i),o.call(this,new Error("operation has timed out"))},n);this.acks.set(i,(...c)=>{clearTimeout(p),o.apply(this,[null,...c])})}to(i){return this.newBroadcastOperator().to(i)}in(i){return this.newBroadcastOperator().in(i)}except(i){return this.newBroadcastOperator().except(i)}send(...i){return this.emit("message",...i),this}write(...i){return this.emit("message",...i),this}packet(i,o={}){i.nsp=this.nsp.name,o.compress=o.compress!==!1,this.client._packet(i,o)}join(i){return yo("join room %s",i),this.adapter.addAll(this.id,new Set(Array.isArray(i)?i:[i]))}leave(i){return yo("leave room %s",i),this.adapter.del(this.id,i)}leaveAll(){this.adapter.delAll(this.id)}_onconnect(){if(yo("socket connected - writing packet"),this.connected=!0,this.join(this.id),this.conn.protocol===3)this.packet({type:zn.PacketType.CONNECT});else this.packet({type:zn.PacketType.CONNECT,data:{sid:this.id,pid:this.pid}})}_onpacket(i){switch(yo("got packet %j",i),i.type){case zn.PacketType.EVENT:this.onevent(i);break;case zn.PacketType.BINARY_EVENT:this.onevent(i);break;case zn.PacketType.ACK:this.onack(i);break;case zn.PacketType.BINARY_ACK:this.onack(i);break;case zn.PacketType.DISCONNECT:this.ondisconnect();break}}onevent(i){let o=i.data||[];if(yo("emitting event %j",o),i.id!=null)yo("attaching ack callback to event"),o.push(this.ack(i.id));if(this._anyListeners&&this._anyListeners.length){let n=this._anyListeners.slice();for(let p of n)p.apply(this,o)}this.dispatch(o)}ack(i){let o=this,n=!1;return function(){if(n)return;let p=Array.prototype.slice.call(arguments);yo("sending ack %j",p),o.packet({id:i,type:zn.PacketType.ACK,data:p}),n=!0}}onack(i){let o=this.acks.get(i.id);if(typeof o=="function")yo("calling ack %s with %j",i.id,i.data),o.apply(this,i.data),this.acks.delete(i.id);else yo("bad ack %s",i.id)}ondisconnect(){yo("got disconnect packet"),this._onclose("client namespace disconnect")}_onerror(i){this.emitReserved("error",i)}_onclose(i,o){if(!this.connected)return this;if(yo("closing socket - reason %s",i),this.emitReserved("disconnecting",i,o),this.server._opts.connectionStateRecovery&&$S.has(i))yo("connection state recovery is enabled for sid %s",this.id),this.adapter.persistSession({sid:this.id,pid:this.pid,rooms:[...this.rooms],data:this.data});this._cleanup(),this.client._remove(this),this.connected=!1,this.emitReserved("disconnect",i,o);return}_cleanup(){this.leaveAll(),this.nsp._remove(this),this.join=xR}_error(i){this.packet({type:zn.PacketType.CONNECT_ERROR,data:i})}disconnect(i=!1){if(!this.connected)return this;if(i)this.client._disconnect();else this.packet({type:zn.PacketType.DISCONNECT}),this._onclose("server namespace disconnect");return this}compress(i){return this.flags.compress=i,this}get volatile(){return this.flags.volatile=!0,this}get broadcast(){return this.newBroadcastOperator()}get local(){return this.newBroadcastOperator().local}timeout(i){return this.flags.timeout=i,this}dispatch(i){yo("dispatching an event %j",i),this.run(i,(o)=>{process.nextTick(()=>{if(o)return this._onerror(o);if(this.connected)super.emitUntyped.apply(this,i);else yo("ignore packet received after disconnection")})})}use(i){return this.fns.push(i),this}run(i,o){if(!this.fns.length)return o();let n=this.fns.slice(0);function p(c){n[c](i,(x)=>{if(x)return o(x);if(!n[c+1])return o();p(c+1)})}p(0)}get disconnected(){return!this.connected}get request(){return this.client.request}get conn(){return this.client.conn}get rooms(){return this.adapter.socketRooms(this.id)||new Set}onAny(i){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(i),this}prependAny(i){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(i),this}offAny(i){if(!this._anyListeners)return this;if(i){let o=this._anyListeners;for(let n=0;n<o.length;n++)if(i===o[n])return o.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(i){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(i),this}prependAnyOutgoing(i){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(i),this}offAnyOutgoing(i){if(!this._anyOutgoingListeners)return this;if(i){let o=this._anyOutgoingListeners;for(let n=0;n<o.length;n++)if(i===o[n])return o.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(i){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let o=this._anyOutgoingListeners.slice();for(let n of o)n.apply(this,i.data)}}newBroadcastOperator(){let i=Object.assign({},this.flags);return this.flags={},new fS.BroadcastOperator(this.adapter,new Set,new Set([this.id]),i)}}zx.Socket=mR});var cJ=P((Wp)=>{var JS=Wp&&Wp.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Wp,"__esModule",{value:!0});Wp.Namespace=Wp.RESERVED_EVENTS=void 0;var fR=pJ(),AS=o1(),vS=JS(Go()),$n=nJ(),tT=vS.default("socket.io:namespace");Wp.RESERVED_EVENTS=new Set(["connect","connection","new_namespace"]);class FR extends AS.StrictEventEmitter{constructor(i,o){super();this.sockets=new Map,this._preConnectSockets=new Map,this._fns=[],this._ids=0,this.server=i,this.name=o,this._initAdapter()}_initAdapter(){this.adapter=new(this.server.adapter())(this)}use(i){return this._fns.push(i),this}run(i,o){if(!this._fns.length)return o();let n=this._fns.slice(0);function p(c){n[c](i,(x)=>{if(x)return o(x);if(!n[c+1])return o();p(c+1)})}p(0)}to(i){return new $n.BroadcastOperator(this.adapter).to(i)}in(i){return new $n.BroadcastOperator(this.adapter).in(i)}except(i){return new $n.BroadcastOperator(this.adapter).except(i)}async _add(i,o,n){var p;tT("adding socket to nsp %s",this.name);let c=await this._createSocket(i,o);if(this._preConnectSockets.set(c.id,c),((p=this.server.opts.connectionStateRecovery)===null||p===void 0?void 0:p.skipMiddlewares)&&c.recovered&&i.conn.readyState==="open")return this._doConnect(c,n);this.run(c,(x)=>{process.nextTick(()=>{if(i.conn.readyState!=="open"){tT("next called after client was closed - ignoring socket"),c._cleanup();return}if(x)if(tT("middleware error, sending CONNECT_ERROR packet to the client"),c._cleanup(),i.conn.protocol===3)return c._error(x.data||x.message);else return c._error({message:x.message,data:x.data});this._doConnect(c,n)})})}async _createSocket(i,o){let{pid:n,offset:p}=o;if(this.server.opts.connectionStateRecovery&&typeof n==="string"&&typeof p==="string"){let c;try{c=await this.adapter.restoreSession(n,p)}catch(x){tT("error while restoring session: %s",x)}if(c)return tT("connection state recovered for sid %s",c.sid),new fR.Socket(this,i,o,c)}return new fR.Socket(this,i,o)}_doConnect(i,o){if(this._preConnectSockets.delete(i.id),this.sockets.set(i.id,i),i._onconnect(),o)o(i);this.emitReserved("connect",i),this.emitReserved("connection",i)}_remove(i){this.sockets.delete(i.id)||this._preConnectSockets.delete(i.id)}emit(i,...o){return new $n.BroadcastOperator(this.adapter).emit(i,...o)}send(...i){return this.emit("message",...i),this}write(...i){return this.emit("message",...i),this}serverSideEmit(i,...o){if(Wp.RESERVED_EVENTS.has(i))throw new Error(`"${String(i)}" is a reserved event name`);return o.unshift(i),this.adapter.serverSideEmit(o),!0}serverSideEmitWithAck(i,...o){return new Promise((n,p)=>{o.push((c,x)=>{if(c)return c.responses=x,p(c);else return n(x)}),this.serverSideEmit(i,...o)})}_onServerSideEmit(i){super.emitUntyped.apply(this,i)}allSockets(){return new $n.BroadcastOperator(this.adapter).allSockets()}compress(i){return new $n.BroadcastOperator(this.adapter).compress(i)}get volatile(){return new $n.BroadcastOperator(this.adapter).volatile}get local(){return new $n.BroadcastOperator(this.adapter).local}timeout(i){return new $n.BroadcastOperator(this.adapter).timeout(i)}fetchSockets(){return new $n.BroadcastOperator(this.adapter).fetchSockets()}socketsJoin(i){return new $n.BroadcastOperator(this.adapter).socketsJoin(i)}socketsLeave(i){return new $n.BroadcastOperator(this.adapter).socketsLeave(i)}disconnectSockets(i=!1){return new $n.BroadcastOperator(this.adapter).disconnectSockets(i)}}Wp.Namespace=FR});var WR=P((wR)=>{Object.defineProperty(wR,"__esModule",{value:!0});wR.yeast=wR.decode=wR.encode=void 0;var AR="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),n1=64,vR={},$R=0,lp=0,JR;function xJ(i){let o="";do o=AR[i%n1]+o,i=Math.floor(i/n1);while(i>0);return o}wR.encode=xJ;function wS(i){let o=0;for(lp=0;lp<i.length;lp++)o=o*n1+vR[i.charAt(lp)];return o}wR.decode=wS;function XS(){let i=xJ(+new Date);if(i!==JR)return $R=0,JR=i;return i+"."+xJ($R++)}wR.yeast=XS;for(;lp<n1;lp++)vR[AR[lp]]=lp});var fJ=P((YR)=>{var TJ;Object.defineProperty(YR,"__esModule",{value:!0});YR.SessionAwareAdapter=YR.Adapter=void 0;var YS=Hi("events"),GS=WR(),p1=Hi("ws"),KS=typeof((TJ=p1===null||p1===void 0?void 0:p1.Sender)===null||TJ===void 0?void 0:TJ.frame)==="function";class mJ extends YS.EventEmitter{constructor(i){super();this.nsp=i,this.rooms=new Map,this.sids=new Map,this.encoder=i.server.encoder}init(){}close(){}serverCount(){return Promise.resolve(1)}addAll(i,o){if(!this.sids.has(i))this.sids.set(i,new Set);for(let n of o){if(this.sids.get(i).add(n),!this.rooms.has(n))this.rooms.set(n,new Set),this.emit("create-room",n);if(!this.rooms.get(n).has(i))this.rooms.get(n).add(i),this.emit("join-room",n,i)}}del(i,o){if(this.sids.has(i))this.sids.get(i).delete(o);this._del(o,i)}_del(i,o){let n=this.rooms.get(i);if(n!=null){if(n.delete(o))this.emit("leave-room",i,o);if(n.size===0&&this.rooms.delete(i))this.emit("delete-room",i)}}delAll(i){if(!this.sids.has(i))return;for(let o of this.sids.get(i))this._del(o,i);this.sids.delete(i)}broadcast(i,o){let n=o.flags||{},p={preEncoded:!0,volatile:n.volatile,compress:n.compress};i.nsp=this.nsp.name;let c=this._encode(i,p);this.apply(o,(x)=>{if(typeof x.notifyOutgoingListeners==="function")x.notifyOutgoingListeners(i);x.client.writeToEngine(c,p)})}broadcastWithAck(i,o,n,p){let c=o.flags||{},x={preEncoded:!0,volatile:c.volatile,compress:c.compress};i.nsp=this.nsp.name,i.id=this.nsp._ids++;let T=this._encode(i,x),m=0;this.apply(o,(f)=>{if(m++,f.acks.set(i.id,p),typeof f.notifyOutgoingListeners==="function")f.notifyOutgoingListeners(i);f.client.writeToEngine(T,x)}),n(m)}_encode(i,o){let n=this.encoder.encode(i);if(KS&&n.length===1&&typeof n[0]==="string"){let p=Buffer.from("4"+n[0]);o.wsPreEncodedFrame=p1.Sender.frame(p,{readOnly:!1,mask:!1,rsv1:!1,opcode:1,fin:!0})}return n}sockets(i){let o=new Set;return this.apply({rooms:i},(n)=>{o.add(n.id)}),Promise.resolve(o)}socketRooms(i){return this.sids.get(i)}fetchSockets(i){let o=[];return this.apply(i,(n)=>{o.push(n)}),Promise.resolve(o)}addSockets(i,o){this.apply(i,(n)=>{n.join(o)})}delSockets(i,o){this.apply(i,(n)=>{o.forEach((p)=>n.leave(p))})}disconnectSockets(i,o){this.apply(i,(n)=>{n.disconnect(o)})}apply(i,o){let n=i.rooms,p=this.computeExceptSids(i.except);if(n.size){let c=new Set;for(let x of n){if(!this.rooms.has(x))continue;for(let T of this.rooms.get(x)){if(c.has(T)||p.has(T))continue;let m=this.nsp.sockets.get(T);if(m)o(m),c.add(T)}}}else for(let[c]of this.sids){if(p.has(c))continue;let x=this.nsp.sockets.get(c);if(x)o(x)}}computeExceptSids(i){let o=new Set;if(i&&i.size>0){for(let n of i)if(this.rooms.has(n))this.rooms.get(n).forEach((p)=>o.add(p))}return o}serverSideEmit(i){console.warn("this adapter does not support the serverSideEmit() functionality")}persistSession(i){}restoreSession(i,o){return null}}YR.Adapter=mJ;class RR extends mJ{constructor(i){super(i);this.nsp=i,this.sessions=new Map,this.packets=[],this.maxDisconnectionDuration=i.server.opts.connectionStateRecovery.maxDisconnectionDuration,setInterval(()=>{let n=Date.now()-this.maxDisconnectionDuration;this.sessions.forEach((p,c)=>{if(p.disconnectedAt<n)this.sessions.delete(c)});for(let p=this.packets.length-1;p>=0;p--)if(this.packets[p].emittedAt<n){this.packets.splice(0,p+1);break}},60000).unref()}persistSession(i){i.disconnectedAt=Date.now(),this.sessions.set(i.pid,i)}restoreSession(i,o){let n=this.sessions.get(i);if(!n)return null;if(n.disconnectedAt+this.maxDisconnectionDuration<Date.now())return this.sessions.delete(i),null;let c=this.packets.findIndex((T)=>T.id===o);if(c===-1)return null;let x=[];for(let T=c+1;T<this.packets.length;T++){let m=this.packets[T];if(HS(n.rooms,m.opts))x.push(m.data)}return Promise.resolve(Object.assign(Object.assign({},n),{missedPackets:x}))}broadcast(i,o){var n;let p=i.type===2,c=i.id===void 0,x=((n=o.flags)===null||n===void 0?void 0:n.volatile)===void 0;if(p&&c&&x){let T=GS.yeast();i.data.push(T),this.packets.push({id:T,opts:o,data:i.data,emittedAt:Date.now()})}super.broadcast(i,o)}}YR.SessionAwareAdapter=RR;function HS(i,o){let n=o.rooms.size===0||i.some((c)=>o.rooms.has(c)),p=i.every((c)=>!o.except.has(c));return n&&p}});var HR=P((bn)=>{var ZS=bn&&bn.__rest||function(i,o){var n={};for(var p in i)if(Object.prototype.hasOwnProperty.call(i,p)&&o.indexOf(p)<0)n[p]=i[p];if(i!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var c=0,p=Object.getOwnPropertySymbols(i);c<p.length;c++)if(o.indexOf(p[c])<0&&Object.prototype.propertyIsEnumerable.call(i,p[c]))n[p[c]]=i[p[c]]}return n};Object.defineProperty(bn,"__esModule",{value:!0});bn.ClusterAdapterWithHeartbeat=bn.ClusterAdapter=bn.MessageType=void 0;var MS=fJ(),zS=Go(),uS=Hi("crypto"),io=zS.debug("socket.io-adapter"),QS="emitter",c1=5000;function Qx(){return uS.randomBytes(8).toString("hex")}var ii;(function(i){i[i.INITIAL_HEARTBEAT=1]="INITIAL_HEARTBEAT",i[i.HEARTBEAT=2]="HEARTBEAT",i[i.BROADCAST=3]="BROADCAST",i[i.SOCKETS_JOIN=4]="SOCKETS_JOIN",i[i.SOCKETS_LEAVE=5]="SOCKETS_LEAVE",i[i.DISCONNECT_SOCKETS=6]="DISCONNECT_SOCKETS",i[i.FETCH_SOCKETS=7]="FETCH_SOCKETS",i[i.FETCH_SOCKETS_RESPONSE=8]="FETCH_SOCKETS_RESPONSE",i[i.SERVER_SIDE_EMIT=9]="SERVER_SIDE_EMIT",i[i.SERVER_SIDE_EMIT_RESPONSE=10]="SERVER_SIDE_EMIT_RESPONSE",i[i.BROADCAST_CLIENT_COUNT=11]="BROADCAST_CLIENT_COUNT",i[i.BROADCAST_ACK=12]="BROADCAST_ACK",i[i.ADAPTER_CLOSE=13]="ADAPTER_CLOSE"})(ii=bn.MessageType||(bn.MessageType={}));function Gc(i){return{rooms:[...i.rooms],except:[...i.except],flags:i.flags}}function ux(i){return{rooms:new Set(i.rooms),except:new Set(i.except),flags:i.flags}}class FJ extends MS.Adapter{constructor(i){super(i);this.requests=new Map,this.ackRequests=new Map,this.uid=Qx()}onMessage(i,o){if(i.uid===this.uid)return io("[%s] ignore message from self",this.uid);switch(io("[%s] new event of type %d from %s",this.uid,i.type,i.uid),i.type){case ii.BROADCAST:{if(i.data.requestId!==void 0)super.broadcastWithAck(i.data.packet,ux(i.data.opts),(p)=>{io("[%s] waiting for %d client acknowledgements",this.uid,p),this.publishResponse(i.uid,{type:ii.BROADCAST_CLIENT_COUNT,data:{requestId:i.data.requestId,clientCount:p}})},(p)=>{io("[%s] received acknowledgement with value %j",this.uid,p),this.publishResponse(i.uid,{type:ii.BROADCAST_ACK,data:{requestId:i.data.requestId,packet:p}})});else{let p=i.data.packet,c=ux(i.data.opts);this.addOffsetIfNecessary(p,c,o),super.broadcast(p,c)}break}case ii.SOCKETS_JOIN:super.addSockets(ux(i.data.opts),i.data.rooms);break;case ii.SOCKETS_LEAVE:super.delSockets(ux(i.data.opts),i.data.rooms);break;case ii.DISCONNECT_SOCKETS:super.disconnectSockets(ux(i.data.opts),i.data.close);break;case ii.FETCH_SOCKETS:{io("[%s] calling fetchSockets with opts %j",this.uid,i.data.opts),super.fetchSockets(ux(i.data.opts)).then((n)=>{this.publishResponse(i.uid,{type:ii.FETCH_SOCKETS_RESPONSE,data:{requestId:i.data.requestId,sockets:n.map((p)=>{let c=p.handshake,{sessionStore:x}=c,T=ZS(c,["sessionStore"]);return{id:p.id,handshake:T,rooms:[...p.rooms],data:p.data}})}})});break}case ii.SERVER_SIDE_EMIT:{let n=i.data.packet;if(i.data.requestId===void 0){this.nsp._onServerSideEmit(n);return}let c=!1,x=(T)=>{if(c)return;c=!0,io("[%s] calling acknowledgement with %j",this.uid,T),this.publishResponse(i.uid,{type:ii.SERVER_SIDE_EMIT_RESPONSE,data:{requestId:i.data.requestId,packet:T}})};this.nsp._onServerSideEmit([...n,x]);break}case ii.BROADCAST_CLIENT_COUNT:case ii.BROADCAST_ACK:case ii.FETCH_SOCKETS_RESPONSE:case ii.SERVER_SIDE_EMIT_RESPONSE:this.onResponse(i);break;default:io("[%s] unknown message type: %s",this.uid,i.type)}}onResponse(i){var o,n;let p=i.data.requestId;switch(io("[%s] received response %s to request %s",this.uid,i.type,p),i.type){case ii.BROADCAST_CLIENT_COUNT:{(o=this.ackRequests.get(p))===null||o===void 0||o.clientCountCallback(i.data.clientCount);break}case ii.BROADCAST_ACK:{(n=this.ackRequests.get(p))===null||n===void 0||n.ack(i.data.packet);break}case ii.FETCH_SOCKETS_RESPONSE:{let c=this.requests.get(p);if(!c)return;if(c.current++,i.data.sockets.forEach((x)=>c.responses.push(x)),c.current===c.expected)clearTimeout(c.timeout),c.resolve(c.responses),this.requests.delete(p);break}case ii.SERVER_SIDE_EMIT_RESPONSE:{let c=this.requests.get(p);if(!c)return;if(c.current++,c.responses.push(i.data.packet),c.current===c.expected)clearTimeout(c.timeout),c.resolve(null,c.responses),this.requests.delete(p);break}default:io("[%s] unknown response type: %s",this.uid,i.type)}}async broadcast(i,o){var n;if(!((n=o.flags)===null||n===void 0?void 0:n.local))try{let c=await this.publishAndReturnOffset({type:ii.BROADCAST,data:{packet:i,opts:Gc(o)}});this.addOffsetIfNecessary(i,o,c)}catch(c){return io("[%s] error while broadcasting message: %s",this.uid,c.message)}super.broadcast(i,o)}addOffsetIfNecessary(i,o,n){var p;if(!this.nsp.server.opts.connectionStateRecovery)return;let c=i.type===2,x=i.id===void 0,T=((p=o.flags)===null||p===void 0?void 0:p.volatile)===void 0;if(c&&x&&T)i.data.push(n)}broadcastWithAck(i,o,n,p){var c;if(!((c=o===null||o===void 0?void 0:o.flags)===null||c===void 0?void 0:c.local)){let T=Qx();this.ackRequests.set(T,{clientCountCallback:n,ack:p}),this.publish({type:ii.BROADCAST,data:{packet:i,requestId:T,opts:Gc(o)}}),setTimeout(()=>{this.ackRequests.delete(T)},o.flags.timeout)}super.broadcastWithAck(i,o,n,p)}async addSockets(i,o){var n;if(!((n=i.flags)===null||n===void 0?void 0:n.local))try{await this.publishAndReturnOffset({type:ii.SOCKETS_JOIN,data:{opts:Gc(i),rooms:o}})}catch(c){io("[%s] error while publishing message: %s",this.uid,c.message)}super.addSockets(i,o)}async delSockets(i,o){var n;if(!((n=i.flags)===null||n===void 0?void 0:n.local))try{await this.publishAndReturnOffset({type:ii.SOCKETS_LEAVE,data:{opts:Gc(i),rooms:o}})}catch(c){io("[%s] error while publishing message: %s",this.uid,c.message)}super.delSockets(i,o)}async disconnectSockets(i,o){var n;if(!((n=i.flags)===null||n===void 0?void 0:n.local))try{await this.publishAndReturnOffset({type:ii.DISCONNECT_SOCKETS,data:{opts:Gc(i),close:o}})}catch(c){io("[%s] error while publishing message: %s",this.uid,c.message)}super.disconnectSockets(i,o)}async fetchSockets(i){var o;let[n,p]=await Promise.all([super.fetchSockets(i),this.serverCount()]),c=p-1;if(((o=i.flags)===null||o===void 0?void 0:o.local)||c<=0)return n;let x=Qx();return new Promise((T,m)=>{let f=setTimeout(()=>{let $=this.requests.get(x);if($)m(new Error(`timeout reached: only ${$.current} responses received out of ${$.expected}`)),this.requests.delete(x)},i.flags.timeout||c1),F={type:ii.FETCH_SOCKETS,resolve:T,timeout:f,current:0,expected:c,responses:n};this.requests.set(x,F),this.publish({type:ii.FETCH_SOCKETS,data:{opts:Gc(i),requestId:x}})})}async serverSideEmit(i){if(typeof i[i.length-1]!=="function")return this.publish({type:ii.SERVER_SIDE_EMIT,data:{packet:i}});let n=i.pop(),p=await this.serverCount()-1;if(io('[%s] waiting for %d responses to "serverSideEmit" request',this.uid,p),p<=0)return n(null,[]);let c=Qx(),x=setTimeout(()=>{let m=this.requests.get(c);if(m)n(new Error(`timeout reached: only ${m.current} responses received out of ${m.expected}`),m.responses),this.requests.delete(c)},c1),T={type:ii.SERVER_SIDE_EMIT,resolve:n,timeout:x,current:0,expected:p,responses:[]};this.requests.set(c,T),this.publish({type:ii.SERVER_SIDE_EMIT,data:{requestId:c,packet:i}})}publish(i){this.publishAndReturnOffset(i).catch((o)=>{io("[%s] error while publishing message: %s",this.uid,o)})}publishAndReturnOffset(i){return i.uid=this.uid,i.nsp=this.nsp.name,this.doPublish(i)}publishResponse(i,o){o.uid=this.uid,o.nsp=this.nsp.name,this.doPublishResponse(i,o).catch((n)=>{io("[%s] error while publishing response: %s",this.uid,n)})}}bn.ClusterAdapter=FJ;class KR extends FJ{constructor(i,o){super(i);this.nodesMap=new Map,this.customRequests=new Map,this._opts=Object.assign({heartbeatInterval:5000,heartbeatTimeout:1e4},o),this.cleanupTimer=setInterval(()=>{let n=Date.now();this.nodesMap.forEach((p,c)=>{if(n-p>this._opts.heartbeatTimeout)io("[%s] node %s seems down",this.uid,c),this.removeNode(c)})},1000)}init(){this.publish({type:ii.INITIAL_HEARTBEAT})}scheduleHeartbeat(){if(this.heartbeatTimer)this.heartbeatTimer.refresh();else this.heartbeatTimer=setTimeout(()=>{this.publish({type:ii.HEARTBEAT})},this._opts.heartbeatInterval)}close(){if(this.publish({type:ii.ADAPTER_CLOSE}),clearTimeout(this.heartbeatTimer),this.cleanupTimer)clearInterval(this.cleanupTimer)}onMessage(i,o){if(i.uid===this.uid)return io("[%s] ignore message from self",this.uid);if(i.uid&&i.uid!==QS)this.nodesMap.set(i.uid,Date.now());switch(io("[%s] new event of type %d from %s",this.uid,i.type,i.uid),i.type){case ii.INITIAL_HEARTBEAT:this.publish({type:ii.HEARTBEAT});break;case ii.HEARTBEAT:break;case ii.ADAPTER_CLOSE:this.removeNode(i.uid);break;default:super.onMessage(i,o)}}serverCount(){return Promise.resolve(1+this.nodesMap.size)}publish(i){return this.scheduleHeartbeat(),super.publish(i)}async serverSideEmit(i){if(typeof i[i.length-1]!=="function")return this.publish({type:ii.SERVER_SIDE_EMIT,data:{packet:i}});let n=i.pop(),p=this.nodesMap.size;if(io('[%s] waiting for %d responses to "serverSideEmit" request',this.uid,p),p<=0)return n(null,[]);let c=Qx(),x=setTimeout(()=>{let m=this.customRequests.get(c);if(m)n(new Error(`timeout reached: missing ${m.missingUids.size} responses`),m.responses),this.customRequests.delete(c)},c1),T={type:ii.SERVER_SIDE_EMIT,resolve:n,timeout:x,missingUids:new Set([...this.nodesMap.keys()]),responses:[]};this.customRequests.set(c,T),this.publish({type:ii.SERVER_SIDE_EMIT,data:{requestId:c,packet:i}})}async fetchSockets(i){var o;let[n,p]=await Promise.all([super.fetchSockets({rooms:i.rooms,except:i.except,flags:{local:!0}}),this.serverCount()]),c=p-1;if(((o=i.flags)===null||o===void 0?void 0:o.local)||c<=0)return n;let x=Qx();return new Promise((T,m)=>{let f=setTimeout(()=>{let $=this.customRequests.get(x);if($)m(new Error(`timeout reached: missing ${$.missingUids.size} responses`)),this.customRequests.delete(x)},i.flags.timeout||c1),F={type:ii.FETCH_SOCKETS,resolve:T,timeout:f,missingUids:new Set([...this.nodesMap.keys()]),responses:n};this.customRequests.set(x,F),this.publish({type:ii.FETCH_SOCKETS,data:{opts:Gc(i),requestId:x}})})}onResponse(i){let o=i.data.requestId;switch(io("[%s] received response %s to request %s",this.uid,i.type,o),i.type){case ii.FETCH_SOCKETS_RESPONSE:{let n=this.customRequests.get(o);if(!n)return;if(i.data.sockets.forEach((p)=>n.responses.push(p)),n.missingUids.delete(i.uid),n.missingUids.size===0)clearTimeout(n.timeout),n.resolve(n.responses),this.customRequests.delete(o);break}case ii.SERVER_SIDE_EMIT_RESPONSE:{let n=this.customRequests.get(o);if(!n)return;if(n.responses.push(i.data.packet),n.missingUids.delete(i.uid),n.missingUids.size===0)clearTimeout(n.timeout),n.resolve(null,n.responses),this.customRequests.delete(o);break}default:super.onResponse(i)}}removeNode(i){this.customRequests.forEach((o,n)=>{if(o.missingUids.delete(i),o.missingUids.size===0){if(clearTimeout(o.timeout),o.type===ii.FETCH_SOCKETS)o.resolve(o.responses);else if(o.type===ii.SERVER_SIDE_EMIT)o.resolve(null,o.responses);this.customRequests.delete(n)}}),this.nodesMap.delete(i)}}bn.ClusterAdapterWithHeartbeat=KR});var x1=P((Kc)=>{Object.defineProperty(Kc,"__esModule",{value:!0});Kc.MessageType=Kc.ClusterAdapterWithHeartbeat=Kc.ClusterAdapter=Kc.SessionAwareAdapter=Kc.Adapter=void 0;var UR=fJ();Object.defineProperty(Kc,"Adapter",{enumerable:!0,get:function(){return UR.Adapter}});Object.defineProperty(Kc,"SessionAwareAdapter",{enumerable:!0,get:function(){return UR.SessionAwareAdapter}});var $J=HR();Object.defineProperty(Kc,"ClusterAdapter",{enumerable:!0,get:function(){return $J.ClusterAdapter}});Object.defineProperty(Kc,"ClusterAdapterWithHeartbeat",{enumerable:!0,get:function(){return $J.ClusterAdapterWithHeartbeat}});Object.defineProperty(Kc,"MessageType",{enumerable:!0,get:function(){return $J.MessageType}})});var uR=P((Vx)=>{var SS=Vx&&Vx.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Vx,"__esModule",{value:!0});Vx.ParentNamespace=void 0;var ZR=cJ(),ES=x1(),OS=SS(Go()),MR=OS.default("socket.io:parent-namespace");class T1 extends ZR.Namespace{constructor(i){super(i,"/_"+T1.count++);this.children=new Set}_initAdapter(){this.adapter=new zR(this)}emit(i,...o){return this.children.forEach((n)=>{n.emit(i,...o)}),!0}createChild(i){MR("creating child namespace %s",i);let o=new ZR.Namespace(this.server,i);if(this._fns.forEach((n)=>o.use(n)),this.listeners("connect").forEach((n)=>o.on("connect",n)),this.listeners("connection").forEach((n)=>o.on("connection",n)),this.children.add(o),this.server._opts.cleanupEmptyChildNamespaces){let n=o._remove;o._remove=(p)=>{if(n.call(o,p),o.sockets.size===0)MR("closing child namespace %s",i),o.adapter.close(),this.server._nsps.delete(o.name),this.children.delete(o)}}return this.server._nsps.set(i,o),this.server.sockets.emitReserved("new_namespace",o),o}fetchSockets(){throw new Error("fetchSockets() is not supported on parent namespaces")}}Vx.ParentNamespace=T1;T1.count=0;class zR extends ES.Adapter{broadcast(i,o){this.nsp.children.forEach((n)=>{n.adapter.broadcast(i,o)})}}});var _R=P((Uc)=>{var _S=Uc&&Uc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Uc,"__esModule",{value:!0});Uc.patchAdapter=CS;Uc.restoreAdapter=yS;Uc.serveFile=IS;var Hc=x1(),QR=Hi("fs"),LS=_S(Go()),m1=LS.default("socket.io:adapter-uws"),JJ="\x1F",{addAll:SR,del:ER,broadcast:OR}=Hc.Adapter.prototype;function CS(i){Hc.Adapter.prototype.addAll=function(o,n){let p=!this.sids.has(o);SR.call(this,o,n);let c=this.nsp.sockets.get(o)||this.nsp._preConnectSockets.get(o);if(!c)return;if(c.conn.transport.name==="websocket"){VR(this.nsp.name,c,p,n);return}if(p)c.conn.on("upgrade",()=>{let x=this.sids.get(o);if(x)VR(this.nsp.name,c,p,x)})},Hc.Adapter.prototype.del=function(o,n){ER.call(this,o,n);let p=this.nsp.sockets.get(o)||this.nsp._preConnectSockets.get(o);if(p&&p.conn.transport.name==="websocket"){let c=p.conn.id,x=p.conn.transport.socket,T=`${this.nsp.name}${JJ}${n}`;m1("unsubscribe connection %s from topic %s",c,T),x.unsubscribe(T)}},Hc.Adapter.prototype.broadcast=function(o,n){if(!(n.rooms.size<=1&&n.except.size===0)){OR.call(this,o,n);return}let c=n.flags||{},x={preEncoded:!0,volatile:c.volatile,compress:c.compress};o.nsp=this.nsp.name;let T=this.encoder.encode(o),m=n.rooms.size===0?this.nsp.name:`${this.nsp.name}${JJ}${n.rooms.keys().next().value}`;m1("fast publish to %s",m),T.forEach((f)=>{let F=typeof f!=="string";i.publish(m,F?f:"4"+f,F)}),this.apply(n,(f)=>{if(f.conn.transport.name!=="websocket")f.client.writeToEngine(T,x)})}}function VR(i,o,n,p){let c=o.conn.id,x=o.conn.transport.socket;if(n)m1("subscribe connection %s to topic %s",c,i),x.subscribe(i);p.forEach((T)=>{let m=`${i}${JJ}${T}`;m1("subscribe connection %s to topic %s",c,m),x.subscribe(m)})}function yS(){Hc.Adapter.prototype.addAll=SR,Hc.Adapter.prototype.del=ER,Hc.Adapter.prototype.broadcast=OR}var DS=(i)=>{let{buffer:o,byteOffset:n,byteLength:p}=i;return o.slice(n,n+p)};function IS(i,o){let{size:n}=QR.statSync(o),p=QR.createReadStream(o),c=()=>!p.destroyed&&p.destroy(),x=(m)=>{throw c(),m},T=(m)=>{let f=DS(m);i.cork(()=>{let F=i.getWriteOffset(),[$,J]=i.tryEnd(f,n);if(!J&&!$)p.pause(),i.onWritable((A)=>{let[X,Y]=i.tryEnd(f.slice(A-F),n);if(!Y&&X)p.resume();return X})})};i.onAborted(c),p.on("data",T).on("error",x).on("end",c)}});var LR=P((bpi,BS)=>{BS.exports={name:"socket.io",version:"4.8.1",description:"node.js realtime framework server",keywords:["realtime","framework","websocket","tcp","events","socket","io"],files:["dist/","client-dist/","wrapper.mjs","!**/*.tsbuildinfo"],directories:{doc:"docs/",example:"example/",lib:"lib/",test:"test/"},type:"commonjs",main:"./dist/index.js",exports:{types:"./dist/index.d.ts",import:"./wrapper.mjs",require:"./dist/index.js"},types:"./dist/index.d.ts",license:"MIT",homepage:"https://github.com/socketio/socket.io/tree/main/packages/socket.io#readme",repository:{type:"git",url:"git+https://github.com/socketio/socket.io.git"},bugs:{url:"https://github.com/socketio/socket.io/issues"},scripts:{compile:"rimraf ./dist && tsc",test:"npm run format:check && npm run compile && npm run test:types && npm run test:unit","test:types":"tsd","test:unit":"nyc mocha --require ts-node/register --reporter spec --slow 200 --bail --timeout 10000 test/index.ts","format:check":'prettier --check "lib/**/*.ts" "test/**/*.ts"',"format:fix":'prettier --write "lib/**/*.ts" "test/**/*.ts"',prepack:"npm run compile"},dependencies:{accepts:"~1.3.4",base64id:"~2.0.0",cors:"~2.8.5",debug:"~4.3.2","engine.io":"~6.6.0","socket.io-adapter":"~2.5.2","socket.io-parser":"~4.2.4"},contributors:[{name:"Guillermo Rauch",email:"rauchg@gmail.com"},{name:"Arnout Kazemier",email:"info@3rd-eden.com"},{name:"Vladimir Dronnikov",email:"dronnikov@gmail.com"},{name:"Einar Otto Stangvik",email:"einaros@gmail.com"}],engines:{node:">=10.2.0"},tsd:{directory:"test"}}});var PR=P((Do,dT)=>{var __dirname="/home/runner/work/wayforge/wayforge/node_modules/.pnpm/socket.io@4.8.1/node_modules/socket.io/dist",NS=Do&&Do.__createBinding||(Object.create?function(i,o,n,p){if(p===void 0)p=n;var c=Object.getOwnPropertyDescriptor(o,n);if(!c||("get"in c?!o.__esModule:c.writable||c.configurable))c={enumerable:!0,get:function(){return o[n]}};Object.defineProperty(i,p,c)}:function(i,o,n,p){if(p===void 0)p=n;i[p]=o[n]}),bS=Do&&Do.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),jS=Do&&Do.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null){for(var n in i)if(n!=="default"&&Object.prototype.hasOwnProperty.call(i,n))NS(o,i,n)}return bS(o,i),o},bR=Do&&Do.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Do,"__esModule",{value:!0});Do.Namespace=Do.Socket=Do.Server=void 0;var PS=Hi("http"),aS=Hi("fs"),AJ=Hi("zlib"),lS=B0(),f1=Hi("stream"),CR=Hi("path"),yR=E9(),qS=t9(),DR=Hi("events"),wJ=cJ();Object.defineProperty(Do,"Namespace",{enumerable:!0,get:function(){return wJ.Namespace}});var kS=uR(),IR=x1(),hS=jS(sT()),gS=bR(Go()),jR=pJ();Object.defineProperty(Do,"Socket",{enumerable:!0,get:function(){return jR.Socket}});var sS=o1(),vJ=_R(),tS=bR(h$()),on=gS.default("socket.io:server"),BR=LR().version,NR=/\.map/;class Sx extends sS.StrictEventEmitter{constructor(i,o={}){super();if(this._nsps=new Map,this.parentNsps=new Map,this.parentNamespacesFromRegExp=new Map,typeof i==="object"&&i instanceof Object&&!i.listen)o=i,i=void 0;if(this.path(o.path||"/socket.io"),this.connectTimeout(o.connectTimeout||45000),this.serveClient(o.serveClient!==!1),this._parser=o.parser||hS,this.encoder=new this._parser.Encoder,this.opts=o,o.connectionStateRecovery)o.connectionStateRecovery=Object.assign({maxDisconnectionDuration:120000,skipMiddlewares:!0},o.connectionStateRecovery),this.adapter(o.adapter||IR.SessionAwareAdapter);else this.adapter(o.adapter||IR.Adapter);if(o.cleanupEmptyChildNamespaces=!!o.cleanupEmptyChildNamespaces,this.sockets=this.of("/"),i||typeof i=="number")this.attach(i);if(this.opts.cors)this._corsMiddleware=tS.default(this.opts.cors)}get _opts(){return this.opts}serveClient(i){if(!arguments.length)return this._serveClient;return this._serveClient=i,this}_checkNamespace(i,o,n){if(this.parentNsps.size===0)return n(!1);let p=this.parentNsps.keys(),c=()=>{let x=p.next();if(x.done)return n(!1);x.value(i,o,(T,m)=>{if(T||!m)return c();if(this._nsps.has(i))return on("dynamic namespace %s already exists",i),n(this._nsps.get(i));let f=this.parentNsps.get(x.value).createChild(i);on("dynamic namespace %s was created",i),n(f)})};c()}path(i){if(!arguments.length)return this._path;this._path=i.replace(/\/$/,"");let o=this._path.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");return this.clientPathRegex=new RegExp("^"+o+"/socket\\.io(\\.msgpack|\\.esm)?(\\.min)?\\.js(\\.map)?(?:\\?|$)"),this}connectTimeout(i){if(i===void 0)return this._connectTimeout;return this._connectTimeout=i,this}adapter(i){if(!arguments.length)return this._adapter;this._adapter=i;for(let o of this._nsps.values())o._initAdapter();return this}listen(i,o={}){return this.attach(i,o)}attach(i,o={}){if(typeof i=="function")throw new Error("You are trying to attach socket.io to an express request handler function. Please pass a http.Server instance.");if(Number(i)==i)i=Number(i);if(typeof i=="number"){on("creating http server and binding to %d",i);let n=i;i=PS.createServer((p,c)=>{c.writeHead(404),c.end()}),i.listen(n)}return Object.assign(o,this.opts),o.path=o.path||this._path,this.initEngine(i,o),this}attachApp(i,o={}){Object.assign(o,this.opts),o.path=o.path||this._path,on("creating uWebSockets.js-based engine with opts %j",o);let n=new yR.uServer(o);if(n.attach(i,o),this.bind(n),this._serveClient)i.get(`${this._path}/*`,(p,c)=>{if(!this.clientPathRegex.test(c.getUrl())){c.setYield(!0);return}let x=c.getUrl().replace(this._path,"").replace(/\?.*$/,"").replace(/^\//,""),T=NR.test(x),m=T?"map":"source",f='"'+BR+'"',F="W/"+f,$=c.getHeader("if-none-match");if($){if(f===$||F===$){on("serve client %s 304",m),p.writeStatus("304 Not Modified"),p.end();return}}on("serve client %s",m),p.writeHeader("cache-control","public, max-age=0"),p.writeHeader("content-type","application/"+(T?"json":"javascript")+"; charset=utf-8"),p.writeHeader("etag",f);let J=CR.join(__dirname,"../client-dist/",x);vJ.serveFile(p,J)});vJ.patchAdapter(i)}initEngine(i,o){if(on("creating engine.io instance with opts %j",o),this.eio=yR.attach(i,o),this._serveClient)this.attachServe(i);this.httpServer=i,this.bind(this.eio)}attachServe(i){on("attaching client serving req handler");let o=i.listeners("request").slice(0);i.removeAllListeners("request"),i.on("request",(n,p)=>{if(this.clientPathRegex.test(n.url))if(this._corsMiddleware)this._corsMiddleware(n,p,()=>{this.serve(n,p)});else this.serve(n,p);else for(let c=0;c<o.length;c++)o[c].call(i,n,p)})}serve(i,o){let n=i.url.replace(this._path,"").replace(/\?.*$/,""),p=NR.test(n),c=p?"map":"source",x='"'+BR+'"',T="W/"+x,m=i.headers["if-none-match"];if(m){if(x===m||T===m){on("serve client %s 304",c),o.writeHead(304),o.end();return}}on("serve client %s",c),o.setHeader("Cache-Control","public, max-age=0"),o.setHeader("Content-Type","application/"+(p?"json":"javascript")+"; charset=utf-8"),o.setHeader("ETag",x),Sx.sendFile(n,i,o)}static sendFile(i,o,n){let p=aS.createReadStream(CR.join(__dirname,"../client-dist/",i)),c=lS(o).encodings(["br","gzip","deflate"]),x=(T)=>{if(T)n.end()};switch(c){case"br":n.writeHead(200,{"content-encoding":"br"}),f1.pipeline(p,AJ.createBrotliCompress(),n,x);break;case"gzip":n.writeHead(200,{"content-encoding":"gzip"}),f1.pipeline(p,AJ.createGzip(),n,x);break;case"deflate":n.writeHead(200,{"content-encoding":"deflate"}),f1.pipeline(p,AJ.createDeflate(),n,x);break;default:n.writeHead(200),f1.pipeline(p,n,x)}}bind(i){return this.engine=i,this.engine.on("connection",this.onconnection.bind(this)),this}onconnection(i){on("incoming connection with id %s",i.id);let o=new qS.Client(this,i);if(i.protocol===3)o.connect("/");return this}of(i,o){if(typeof i==="function"||i instanceof RegExp){let p=new kS.ParentNamespace(this);if(on("initializing parent namespace %s",p.name),typeof i==="function")this.parentNsps.set(i,p);else this.parentNsps.set((c,x,T)=>T(null,i.test(c)),p),this.parentNamespacesFromRegExp.set(i,p);if(o)p.on("connect",o);return p}if(String(i)[0]!=="/")i="/"+i;let n=this._nsps.get(i);if(!n){for(let[p,c]of this.parentNamespacesFromRegExp)if(p.test(i))return on("attaching namespace %s to parent namespace %s",i,p),c.createChild(i);if(on("initializing namespace %s",i),n=new wJ.Namespace(this,i),this._nsps.set(i,n),i!=="/")this.sockets.emitReserved("new_namespace",n)}if(o)n.on("connect",o);return n}async close(i){if(await Promise.allSettled([...this._nsps.values()].map(async(o)=>{o.sockets.forEach((n)=>{n._onclose("server shutting down")}),await o.adapter.close()})),this.engine.close(),vJ.restoreAdapter(),this.httpServer)this.httpServer.close(i);else i&&i()}use(i){return this.sockets.use(i),this}to(i){return this.sockets.to(i)}in(i){return this.sockets.in(i)}except(i){return this.sockets.except(i)}send(...i){return this.sockets.emit("message",...i),this}write(...i){return this.sockets.emit("message",...i),this}serverSideEmit(i,...o){return this.sockets.serverSideEmit(i,...o)}serverSideEmitWithAck(i,...o){return this.sockets.serverSideEmitWithAck(i,...o)}allSockets(){return this.sockets.allSockets()}compress(i){return this.sockets.compress(i)}get volatile(){return this.sockets.volatile}get local(){return this.sockets.local}timeout(i){return this.sockets.timeout(i)}fetchSockets(){return this.sockets.fetchSockets()}socketsJoin(i){return this.sockets.socketsJoin(i)}socketsLeave(i){return this.sockets.socketsLeave(i)}disconnectSockets(i=!1){return this.sockets.disconnectSockets(i)}}Do.Server=Sx;var dS=Object.keys(DR.EventEmitter.prototype).filter(function(i){return typeof DR.EventEmitter.prototype[i]==="function"});dS.forEach(function(i){Sx.prototype[i]=function(){return this.sockets[i].apply(this.sockets,arguments)}});dT.exports=(i,o)=>new Sx(i,o);dT.exports.Server=Sx;dT.exports.Namespace=wJ.Namespace;dT.exports.Socket=jR.Socket});import{createServer as fO}from"http";import{createServer as FO}from"https";var Kp=(i)=>Array.isArray(i)?i:[i],$A=(i,o)=>{let n=[[],[]];for(let p of i)if(o(p))n[0].push(p);else n[1].push(p);return n},$m=Array,op=(i,o)=>i.includes(o),JA=(i,o=0)=>[...new Array(i)].map((n,p)=>p+o),Ai=(i,o,n)=>{if(i===void 0)return o===void 0?[]:Array.isArray(o)?o:[o];if(n?.prepend)if(Array.isArray(o))i.unshift(...o);else i.unshift(o);else if(Array.isArray(o))i.push(...o);else i.push(o);return i},np=(i,o)=>{if(o===void 0||o===null)return i??[];if(i===void 0||i===null)return Kp(o);return i.concat(o)},AA=(...i)=>i.reduce(np,[]),ln=(i,o,n)=>{if(i===void 0)return Array.isArray(o)?o:[o];let p=n?.isEqual??((c,x)=>c===x);return Kp(o).forEach((c)=>{if(!i.some((x)=>p(x,c)))i.push(c)}),i},vA=(i,o)=>i.reduce((n,p)=>{let c=p[o];return n[c]=Ai(n[c],p),n},{}),pp=(i,o,n)=>i.length===o.length&&i.every(n?.isEqual?(p,c)=>n.isEqual(p,o[c]):(p,c)=>p===o[c]);var qo=(i,o)=>Fo(i)===o,Fo=(i)=>{let o=typeof i;return o==="object"?i===null?"null":"object":o==="function"?"object":o},ko={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},wA={...ko,function:"a function"};class XA extends Error{}var Xi=(i)=>cp(i,XA),cp=(i,o=Error)=>{throw new o(i)};class bx extends Error{name="ParseError"}var H=(i)=>cp(i,bx),Sn=(i)=>` ${i}`;var pi=(i,o)=>{let n={},p=Array.isArray(i),c=!1;return Object.entries(i).forEach((x,T)=>{let m=p?o(T,x[1]):o(...x,T);c||=typeof m[0]==="number",(Array.isArray(m[0])||m.length===0?m:[m]).forEach(([F,$])=>{if(typeof F==="object")n[F.group]=Ai(n[F.group],$);else n[F]=$})}),c?Object.values(n):n};var y1=Object.entries;var di=(i,o)=>(i in o),Oc=(i,o)=>(o in i);class D1{constructor(i){Object.assign(this,i)}}var WA=class{};class jx extends WA{}var yG=(i,o)=>{let n={},p={},c;for(c in i)if(c in o)n[c]=i[c];else p[c]=i[c];return[n,p]};var RA=(i,o)=>yG(i,o)[1],qn=(i)=>Object.keys(i).length===0,Px=(i)=>[...Object.entries(i),...Object.getOwnPropertySymbols(i).map((o)=>[o,i[o]])],YA=(i,o)=>Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)),GA=(i)=>{let o=Object.keys(i).sort(),n={};for(let p=0;p<o.length;p++)n[o[p]]=i[o[p]];return n};var nn=Sn("represents an uninitialized value"),KA=(i)=>Object.values(i).filter((o)=>{if(typeof o==="number")return!0;return typeof i[o]!=="number"});var I1={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},B1=globalThis.File??Blob,N1={ArrayBuffer,Blob,File:B1,FormData,Headers,Request,Response,URL},DG={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},hp={...I1,...N1,...DG,String,Number,Boolean},ax=(i)=>{let o=Object.getPrototypeOf(i);while(o?.constructor&&(!di(o.constructor.name,hp)||!(i instanceof hp[o.constructor.name])))o=Object.getPrototypeOf(o);let n=o?.constructor?.name;if(n===void 0||n==="Object")return;return n},lx=(i)=>typeof i==="object"&&i!==null?ax(i)??"object":Fo(i);var Oi=Array.isArray,IG={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},BG={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},NG={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},HA={...IG,...BG,...NG},qx=(i)=>{let o=Object(i).name??null;return o&&di(o,hp)&&hp[o]===i?o:null};var b1=(i,o)=>{let n=i.prototype;while(n!==null){if(n===o.prototype)return!0;n=Object.getPrototypeOf(n)}return!1};var UA=(i)=>ZA(i,new Map),ZA=(i,o)=>{if(typeof i!=="object"||i===null)return i;if(o?.has(i))return o.get(i);let n=qx(i.constructor);if(n==="Date")return new Date(i.getTime());if(n&&n!=="Array")return i;let p=Array.isArray(i)?i.slice():Object.create(Object.getPrototypeOf(i)),c=Object.getOwnPropertyDescriptors(i);if(o){o.set(i,p);for(let x in c){let T=c[x];if("get"in T||"set"in T)continue;T.value=ZA(T.value,o)}}return Object.defineProperties(p,c),p};var bG=(i)=>{let o=nn;return()=>o===nn?o=i():o},Hp=(i)=>typeof i==="function"&&i.length===0;var MA=class extends Function{constructor(...i){let o=i.slice(0,-1),n=i.at(-1);try{super(...o,n)}catch(p){return Xi(`Encountered an unexpected error while compiling your definition:
48
+ Message: ${p}
49
+ Source: (${i.slice(0,-1)}) => {
50
+ ${i.at(-1)}
51
+ }`)}}};class En{constructor(i,...[o]){return Object.assign(Object.setPrototypeOf(i.bind(o?.bind??this),this.constructor.prototype),o?.attach)}}var zA=bG(()=>{try{return new Function("return false")()}catch{return!0}});var _O=Sn("brand");var uA=Sn("arkInferred");var yO=Sn("args");class Vo{constructor(){}}var jG=()=>{try{return((new Error().stack?.split(`
52
+ `)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},PG=globalThis.process?.env??{},QA={fileName:jG,env:PG};var VA=(i)=>i[0].toUpperCase()+i.slice(1);var j1=(i)=>new RegExp(aG(i),typeof i==="string"?"":i.flags);var aG=(i)=>{return`^(?:${typeof i==="string"?i:i.source})$`};var xp={negativeLookahead:(i)=>`(?!${i})`,nonCapturingGroup:(i)=>`(?:${i})`},kx="\\",Up={" ":1,"\n":1,"\t":1};var lG=/^-0\.?0*$/.source,EA=/[1-9]\d*/.source,qG=/\.\d+/.source,kG=/\.\d*[1-9]/.source,OA=(i)=>j1(xp.negativeLookahead(lG)+xp.nonCapturingGroup("-?"+xp.nonCapturingGroup(xp.nonCapturingGroup("0|"+EA)+xp.nonCapturingGroup(i.decimalPattern)+"?")+(i.allowDecimalOnly?"|"+i.decimalPattern:"")+"?")),SA=OA({decimalPattern:kG,allowDecimalOnly:!1}),hG=SA.test.bind(SA),Jm=OA({decimalPattern:qG,allowDecimalOnly:!0}),PO=Jm.test.bind(Jm),gG=/^-?\d*\.?\d*$/,sG=(i)=>i.length!==0&&gG.test(i),hx=j1(xp.negativeLookahead("^-0$")+"-?"+xp.nonCapturingGroup(xp.nonCapturingGroup("0|"+EA))),tG=hx.test.bind(hx),P1=/^-?\d+$/,dG=P1.test.bind(P1),_A={number:"a number",bigint:"a bigint",integer:"an integer"},LA=(i,o)=>`'${i}' was parsed as ${_A[o]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,rG=(i,o)=>o==="number"?hG(i):tG(i),eG=(i,o)=>o==="number"?Number(i):Number.parseInt(i),i2=(i,o)=>o==="number"?sG(i):dG(i),CA=(i,o)=>a1(i,"number",o),yA=(i,o)=>a1(i,"number",{...o,strict:!0}),DA=(i,o)=>a1(i,"integer",o),a1=(i,o,n)=>{let p=eG(i,o);if(!Number.isNaN(p)){if(i2(i,o)){if(n?.strict)return rG(i,o)?p:H(LA(i,o));return p}}return n?.errorOnFail?H(n?.errorOnFail===!0?`Failed to parse ${_A[o]} from '${i}'`:n?.errorOnFail):void 0},IA=(i)=>{if(i[i.length-1]!=="n")return;let o=i.slice(0,-1),n;try{n=BigInt(o)}catch{return}if(hx.test(o))return n;if(P1.test(o))return H(LA(i,"bigint"))};var o2="0.45.9",n2={version:o2,filename:QA.fileName(),FileConstructor:B1},gp=n2,BA=new WeakMap,l1=Object.create(null),gx=(i)=>{let o=BA.get(i);if(o)return o;let n=p2(i);if(l1[n])n=`${n}${l1[n]++}`;else l1[n]=1;return gp[n]=i,BA.set(i,n),n},_c=(i)=>/^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(i),p2=(i)=>{switch(typeof i){case"object":{if(i===null)break;let o=ax(i)??"object";return o[0].toLowerCase()+o.slice(1)}case"function":return _c(i.name)?i.name:"fn";case"symbol":return i.description&&_c(i.description)?i.description:"symbol"}return Xi(`Unexpected attempt to register serializable value of type ${Fo(i)}`)};var Am=(i)=>typeof i==="string"?JSON.stringify(i):typeof i==="bigint"?`${i}n`:`${i}`;var NA=(i,o={})=>sx(i,{onUndefined:"$ark.undefined",onBigInt:(n)=>`$ark.bigint-${n}`,...o},[]);var oi=(i,o)=>{switch(Fo(i)){case"object":let n=i,p=n.constructor.name;return p==="Object"||p==="Array"?JSON.stringify(sx(n,vm,[]),null,o):n instanceof Date?sp(n):typeof n.expression==="string"?n.expression:p;case"symbol":return vm.onSymbol(i);default:return Am(i)}},vm={onCycle:()=>"(cycle)",onSymbol:(i)=>`Symbol(${gx(i)})`,onFunction:(i)=>`Function(${gx(i)})`},sx=(i,o,n)=>{switch(Fo(i)){case"object":{let p=i;if("toJSON"in p&&typeof p.toJSON==="function")return p.toJSON();if(typeof p==="function")return vm.onFunction(p);if(n.includes(p))return"(cycle)";let c=[...n,p];if(Array.isArray(p))return p.map((T)=>sx(T,o,c));if(p instanceof Date)return p.toDateString();let x={};for(let T in p)x[T]=sx(p[T],o,c);for(let T of Object.getOwnPropertySymbols(p))x[o.onSymbol?.(T)??T.toString()]=sx(p[T],o,c);return x}case"symbol":return vm.onSymbol(i);case"bigint":return o.onBigInt?.(i)??`${i}n`;case"undefined":return o.onUndefined??"undefined";case"string":return i.replaceAll("\\","\\\\");default:return i}},sp=(i)=>{let o=i.getFullYear(),n=i.getMonth(),p=i.getDate(),c=i.getHours(),x=i.getMinutes(),T=i.getSeconds(),m=i.getMilliseconds();if(n===0&&p===1&&c===0&&x===0&&T===0&&m===0)return`${o}`;let f=`${c2[n]} ${p}, ${o}`;if(c===0&&x===0&&T===0&&m===0)return f;let F=i.toLocaleTimeString(),$=F.endsWith(" AM")||F.endsWith(" PM")?F.slice(-3):"";if($)F=F.slice(0,-$.length);if(m)F+=`.${T2(m,3)}`;else if(x2.test(F))F=F.slice(0,-3);return`${F+$}, ${f}`},c2=["January","February","March","April","May","June","July","August","September","October","November","December"],x2=/:\d\d:00$/,T2=(i,o)=>String(i).padStart(o,"0");var bA=(i,o,...[n])=>{let p=n?.stringifySymbol??oi,c=i;switch(typeof o){case"string":c=_c(o)?i===""?o:`${i}.${o}`:`${i}[${JSON.stringify(o)}]`;break;case"number":c=`${i}[${o}]`;break;case"symbol":c=`${i}[${p(o)}]`;break;default:if(n?.stringifyNonKey)c=`${i}[${n.stringifyNonKey(o)}]`;else H(`${oi(o)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return c},Tp=(i,...o)=>i.reduce((n,p)=>bA(n,p,...o),"");class tx extends $m{cache={};constructor(...i){super();this.push(...i)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let i=0;i<this.length;i++)this.cache.json.push(typeof this[i]==="symbol"?oi(this[i]):this[i]);return this.cache.json}stringify(){if(this.cache.stringify)return this.cache.stringify;return this.cache.stringify=Tp(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let i="",o=[i];return this.forEach((n)=>{i=bA(i,n),o.push(i)}),this.cache.stringifyAncestors=o}}class q1{chars;i;def;constructor(i){this.def=i,this.chars=[...i],this.i=0}shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}get nextLookahead(){return this.chars[this.i+1]??""}get length(){return this.chars.length}shiftUntil(i){let o="";while(this.lookahead){if(i(this,o))if(o[o.length-1]===kx)o=o.slice(0,-1);else break;o+=this.shift()}return o}shiftUntilLookahead(i){return typeof i==="string"?this.shiftUntil((o)=>o.lookahead===i):this.shiftUntil((o)=>(o.lookahead in i))}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in Up))}jumpToIndex(i){this.i=i<0?this.length+i:i}jumpForward(i){this.i+=i}get location(){return this.i}get unscanned(){return this.chars.slice(this.i,this.length).join("")}get scanned(){return this.chars.slice(0,this.i).join("")}sliceChars(i,o){return this.chars.slice(i,o).join("")}lookaheadIs(i){return this.lookahead===i}lookaheadIsIn(i){return this.lookahead in i}}var A_=Sn("implementedTraits");var k1="$ark",m2=2;while(k1 in globalThis)k1=`$ark${m2++}`;var jA=k1;globalThis[jA]=gp;var V=gp,f2=(i)=>`${jA}.${i}`,ki=(i)=>f2(gx(i));class wm extends jx{argNames;body="";constructor(...i){super();this.argNames=i;for(let o of i){if(o in this)throw new Error(`Arg name '${o}' would overwrite an existing property on FunctionBody`);this[o]=o}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop(i,o=!1){return h1(i,o)}index(i,o=!1){return PA(`${i}`,o)}line(i){return this.body+=`${" ".repeat(this.indentation)}${i}
53
+ `,this}const(i,o){return this.line(`const ${i} = ${o}`),this}let(i,o){return this.line(`let ${i} = ${o}`)}set(i,o){return this.line(`${i} = ${o}`)}if(i,o){return this.block(`if (${i})`,o)}elseIf(i,o){return this.block(`else if (${i})`,o)}else(i){return this.block("else",i)}for(i,o,n=0){return this.block(`for (let i = ${n}; ${i}; i++)`,o)}forIn(i,o){return this.block(`for (const k in ${i})`,o)}block(i,o,n=""){return this.line(`${i} {`),this.indent(),o(this),this.dedent(),this.line(`}${n}`)}return(i=""){return this.line(`return ${i}`)}write(i="anonymous",o=0){return`${i}(${this.argNames.join(", ")}) { ${o?this.body.split(`
54
+ `).map((n)=>" ".repeat(o)+`${n}`).join(`
55
+ `):this.body} }`}compile(){return new MA(...this.argNames,this.body)}}var mp=(i)=>qo(i,"object")||typeof i==="symbol"?ki(i):Am(i),h1=(i,o=!1)=>{if(typeof i==="string"&&_c(i))return`${o?"?":""}.${i}`;return PA(F2(i),o)},F2=(i)=>typeof i==="symbol"?ki(i):JSON.stringify(i),PA=(i,o=!1)=>`${o?"?.":""}[${i}]`;class dx extends wm{traversalKind;optimistic;constructor(i){super("data","ctx");this.traversalKind=i.kind,this.optimistic=i.optimistic===!0}invoke(i,o){let n=o?.arg??this.data,p=typeof i==="string"?!0:this.requiresContextFor(i),c=typeof i==="string"?i:i.id;if(p)return`${this.referenceToId(c,o)}(${n}, ${this.ctx})`;return`${this.referenceToId(c,o)}(${n})`}referenceToId(i,o){let n=o?.kind??this.traversalKind,p=`this.${i}${n}`;return o?.bind?`${p}.bind(${o?.bind})`:p}requiresContextFor(i){return this.traversalKind==="Apply"||i.allowsRequiresContext}initializeErrorCount(){return this.const("errorCount","ctx.currentErrorCount")}returnIfFail(){return this.if("ctx.currentErrorCount > errorCount",()=>this.return())}returnIfFailFast(){return this.if("ctx.failFast && ctx.currentErrorCount > errorCount",()=>this.return())}traverseKey(i,o,n){let p=this.requiresContextFor(n);if(p)this.line(`${this.ctx}.path.push(${i})`);if(this.check(n,{arg:o}),p)this.line(`${this.ctx}.path.pop()`);return this}check(i,o){return this.traversalKind==="Allows"?this.if(`!${this.invoke(i,o)}`,()=>this.return(!1)):this.line(this.invoke(i,o))}}var Xm=(i)=>pi(i,(o,n)=>[o,Oi(n)?[...n]:n]),No=Sn("arkKind"),a=(i,o)=>i?.[No]===o,Ii=(i)=>a(i,"root")||a(i,"constraint");var aA=["unit","proto","domain"],Lc=["required","optional","index","sequence"],g1=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],Wm=[...g1,...Lc,"structure","predicate"],Cc=["alias","union","morph","unit","intersection","proto","domain"],$2=[...Cc,...Wm],Rm=pi(Wm,(i,o)=>[o,1]),lA=pi([...Lc,"undeclared"],(i,o)=>[o,1]),qA=pi($2,(i,o)=>[o,i]),yc=(i)=>typeof i==="string"&&(i in qA);var Dc=(i)=>qA[i],Ym=(i)=>Cc.slice(Dc(i)+1),s_=[...Ym("union"),"alias"],t_=[...Ym("morph"),"alias"],An=(i)=>{if(typeof i==="string"||typeof i==="boolean"||i===null)return i;if(typeof i==="number"){if(Number.isNaN(i))return"NaN";if(i===Number.POSITIVE_INFINITY)return"Infinity";if(i===Number.NEGATIVE_INFINITY)return"-Infinity";return i}return mp(i)},Zp=(i)=>{let o="{ ";for(let[n,p]of Object.entries(i))o+=`${n}: ${mp(p)}, `;return o+" }"},ni=(i)=>{let o=i;if(o.hasAssociatedError)o.defaults.expected??=(n)=>("description"in n)?n.description:o.defaults.description(n),o.defaults.actual??=(n)=>oi(n),o.defaults.problem??=(n)=>`must be ${n.expected}${n.actual?` (was ${n.actual})`:""}`,o.defaults.message??=(n)=>{if(n.path.length===0)return n.problem;let p=`${n.propString} ${n.problem}`;if(p[0]==="[")return`value at ${p}`;return p};return o};V.config??={};var rx=(i,o)=>{if(!o)return i;let n={...i},p;for(p in o){let c={...i.keywords};if(p==="keywords"){for(let x in o[p]){let T=o.keywords[x];if(T===void 0)continue;c[x]=typeof T==="string"?{description:T}:T}n.keywords=c}else n[p]=yc(p)?{...i[p],...o[p]}:o[p]}return n};class Mp extends jx{[No]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:i,relativePath:o,...n},p){super();this.input=n,this.ctx=p,YA(this,n);let c=p.data;if(n.code==="union")n.errors=n.errors.flatMap((T)=>{let m=T.hasCode("union")?T.errors:[T];if(!i&&!o)return m;return m.map((f)=>f.transform((F)=>({...F,path:AA(i,F.path,o)})))});this.nodeConfig=p.config[this.code];let x=[...n.path??p.path];if(o)x.push(...o);if(i)x.unshift(...i);this.path=new tx(...x),this.data="data"in n?n.data:c}transform(i){return new Mp(i({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(i){return this.code===i}get propString(){return Tp(this.path)}get expected(){if(this.input.expected)return this.input.expected;let i=this.meta?.expected??this.nodeConfig.expected;return typeof i==="function"?i(this.input):i}get actual(){if(this.input.actual)return this.input.actual;let i=this.meta?.actual??this.nodeConfig.actual;return typeof i==="function"?i(this.data):i}get problem(){if(this.input.problem)return this.input.problem;let i=this.meta?.problem??this.nodeConfig.problem;return typeof i==="function"?i(this):i}get message(){if(this.input.message)return this.input.message;let i=this.meta?.message??this.nodeConfig.message;return typeof i==="function"?i(this):i}get flat(){return this.hasCode("intersection")?[...this.errors]:[this]}toJSON(){return{data:this.data,path:this.path,...this.input,expected:this.expected,actual:this.actual,problem:this.problem,message:this.message}}toString(){return this.message}throw(){throw this}}class ho extends $m{[No]="errors";ctx;constructor(i){super();this.ctx=i}byPath=Object.create(null);get flatByPath(){return pi(this.byPath,(i,o)=>[i,o.flat])}get flatProblemsByPath(){return pi(this.byPath,(i,o)=>[i,o.flat.map((n)=>n.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new s1(this)}add(i){if(this.includes(i))return;this._add(i)}transform(i){let o=new ho(this.ctx);return this.forEach((n)=>o.add(i(n))),o}merge(i){i.forEach((o)=>{if(this.includes(o))return;this._add(new Mp({...o,path:[...this.ctx.path,...o.path]},this.ctx))})}affectsPath(i){if(this.length===0)return!1;return i.stringifyAncestors().some((o)=>(o in this.byPath))||i.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map((i)=>i.toJSON())]}toString(){return this.join(`
56
+ `)}_add(i){let o=this.byPath[i.propString];if(o){if(o.hasCode("union")&&o.errors.length===0)return;let n=i.hasCode("union")&&i.errors.length===0?i:new Mp({code:"intersection",errors:o.hasCode("intersection")?[...o.errors,i]:[o,i]},this.ctx),p=this.indexOf(o);this.mutable[p===-1?this.length:p]=n,this.byPath[i.propString]=n,this.addAncestorPaths(i)}else this.byPath[i.propString]=i,this.addAncestorPaths(i),this.mutable.push(i);this.count++}addAncestorPaths(i){i.path.stringifyAncestors().forEach((o)=>{this.byAncestorPath[o]=Ai(this.byAncestorPath[o],i)})}}class s1 extends Error{name="TraversalError";constructor(i){if(i.length===1)super(i.summary);else super(`
57
+ `+i.map((o)=>` \u2022 ${J2(o)}`).join(`
58
+ `));Object.defineProperty(this,"arkErrors",{value:i,enumerable:!1})}}var J2=(i)=>i.toString().split(`
59
59
  `).join(`
60
- `);class wL{path=[];errors=new jA(this);root;config;queuedMorphs=[];branches=[];seen={};constructor(H,A){this.root=H,this.config=A}get data(){let H=this.root;for(let A of this.path)H=H?.[A];return H}get propString(){return EI(this.path)}reject(H){return this.error(H),!1}mustBe(H){return this.error(H),!1}error(H){let A=typeof H==="object"?H.code?H:{...H,code:"predicate"}:{code:"predicate",expected:H};return this.errorFromContext(A)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs(H){let A={path:new gf(...this.path),morphs:H};if(this.currentBranch)this.currentBranch.queuedMorphs.push(A);else this.queuedMorphs.push(A)}finalize(H){if(this.queuedMorphs.length){if(typeof this.root==="object"&&this.root!==null&&this.config.clone)this.root=this.config.clone(this.root);this.applyQueuedMorphs()}if(this.hasError())return H?H(this.errors):this.errors;return this.root}get currentErrorCount(){return this.currentBranch?this.currentBranch.error?1:0:this.errors.count}get failFast(){return this.branches.length!==0}pushBranch(){this.branches.push({error:void 0,queuedMorphs:[]})}popBranch(){return this.branches.pop()}get external(){return this}errorFromNodeContext(H){return this.errorFromContext(H)}errorFromContext(H){let A=new mI(H,this);if(this.currentBranch)this.currentBranch.error=A;else this.errors.add(A);return A}applyQueuedMorphs(){while(this.queuedMorphs.length){let H=this.queuedMorphs;this.queuedMorphs=[];for(let{path:A,morphs:L}of H){if(this.errors.affectsPath(A))continue;this.applyMorphsAtPath(A,L)}}}applyMorphsAtPath(H,A){let L=H.at(-1),I;if(L!==void 0){I=this.root;for(let $=0;$<H.length-1;$++)I=I[H[$]]}this.path=[...H];for(let $ of A){let f=NH($),E=$(I===void 0?this.root:I[L],this);if(E instanceof mI){this.errors.add(E);break}if(E instanceof jA){if(!f)this.errors.merge(E);break}if(I===void 0)this.root=E;else I[L]=E;this.applyQueuedMorphs()}}}var kA=(H,A,L)=>{if(!L)return A();L.path.push(H);let I=A();return L.path.pop(),I};class LE extends VL{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(H,A){super((I,$,f=this.onFail)=>{if($)return this.traverseApply(I,$),$.hasError()?$.errors:$.data;return this.rootApply(I,f)},{attach:H});this.attachments=H,this.$=A,this.onFail=this.meta.onFail??this.$.resolvedConfig.onFail,this.includesTransform=this.hasKind("morph")||this.hasKind("structure")&&this.structuralMorph!==void 0,this.includesContextualPredicate=this.hasKind("predicate")&&this.inner.predicate.length!==1,this.isCyclic=this.kind==="alias",this.referencesById={[this.id]:this},this.shallowReferences=this.hasKind("structure")?[this,...this.children]:this.children.reduce((I,$)=>Zm(I,$.shallowReferences),[this]);let L=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let I=0;I<this.children.length;I++){if(this.includesTransform||=this.children[I].includesTransform,this.includesContextualPredicate||=this.children[I].includesContextualPredicate,this.isCyclic||=this.children[I].isCyclic,!L){let $=this.children[I].flatRefs;for(let f=0;f<$.length;f++){let E=$[f];if(!this.flatRefs.some((D)=>Ln(D,E))){this.flatRefs.push(E);for(let D of E.node.branches)if(D.hasKind("morph")||D.hasKind("intersection")&&D.structure?.structuralMorph!==void 0)this.flatMorphs.push({path:E.path,propString:E.propString,node:D})}}}Object.assign(this.referencesById,this.children[I].referencesById)}this.flatRefs.sort((I,$)=>I.path.length>$.path.length?1:I.path.length<$.path.length?-1:I.propString>$.propString?1:I.propString<$.propString?-1:I.node.expression<$.node.expression?-1:1),this.allowsRequiresContext=this.includesContextualPredicate||this.isCyclic,this.rootApplyStrategy=!this.allowsRequiresContext&&this.flatMorphs.length===0?this.shallowMorphs.length===0?"allows":this.shallowMorphs.every((I)=>I.length===1||I.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some((I)=>I.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?(I)=>this.traverseAllows(I,new wL(I,this.$.resolvedConfig)):(I)=>this.traverseAllows(I)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(A,L)=>{if(this.allows(A))return A;let I=new wL(A,this.$.resolvedConfig);return this.traverseApply(A,I),I.finalize(L)};case"contextual":return(A,L)=>{let I=new wL(A,this.$.resolvedConfig);return this.traverseApply(A,I),I.finalize(L)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];let H=this.$.resolvedConfig.clone;return(A,L)=>{if(this.allows(A))return this.contextFreeMorph(H&&(typeof A==="object"&&A!==null||typeof A==="function")?H(A):A);let I=new wL(A,this.$.resolvedConfig);return this.traverseApply(A,I),I.finalize(L)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,xH(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=bm(this.metaJson);cacheGetter(H,A){return Object.defineProperty(this,H,{value:A}),A}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=s$(this.kind);precompilation;assert=(H,A)=>this(H,A,(L)=>L.throw());traverse(H,A){return this(H,A,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo(H){if(!this.includesTransform)return this;let A={};for(let[L,I]of this.innerEntries){let $=this.impl.keys[L];if($.reduceIo)$.reduceIo(H,A,I);else if($.child){let f=I;A[L]=KH(f)?f.map((E)=>E[H]):f[H]}else A[L]=I}return this.$.node(this.kind,A)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(H){let A=NH(H)?H:this.$.parseDefinition(H);return this.innerHash===A.innerHash}ifEquals(H){return this.equals(H)?this:void 0}hasKind(H){return this.kind===H}assertHasKind(H){if(this.kind!==H)$I(`${this.kind} node was not of asserted kind ${H}`);return this}hasKindIn(...H){return H.includes(this.kind)}assertHasKindIn(...H){if(!AI(H,this.kind))$I(`${this.kind} node was not one of asserted kinds ${H}`);return this}isBasis(){return AI(gp,this.kind)}isConstraint(){return AI(CD,this.kind)}isStructural(){return AI(a$,this.kind)}isRefinement(){return AI(e1,this.kind)}isRoot(){return AI(l$,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit(H){return this.hasKind("unit")&&this.allows(H)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select(H){let A=AE.normalize(H);return this._select(A)}_select(H){let A=AE.applyBoundary[H.boundary??"references"](this);if(H.kind)A=A.filter((L)=>L.kind===H.kind);if(H.where)A=A.filter(H.where);return AE.applyMethod[H.method??"filter"](A,this,H)}transform(H,A){return this._transform(H,this._createTransformContext(A))}_createTransformContext(H){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:H?.prereduced??!1},undeclaredKeyHandling:void 0,...H}}_transform(H,A){let L=A.bindScope??this.$;if(A.seen[this.id])return this.$.lazilyResolve(A.seen[this.id]);if(A.shouldTransform?.(this,A)===!1)return this;let I;if(A.seen[this.id]=()=>I,this.hasKind("structure")&&this.undeclared!==A.undeclaredKeyHandling)A={...A,undeclaredKeyHandling:this.undeclared};let $=fH(this.inner,(o,u)=>{if(!this.impl.keys[o].child)return[o,u];let t=u;if(!KH(t)){let B=t._transform(H,A);return B?[o,B]:[]}if(t.length===0)return[o,u];let i=t.flatMap((B)=>{return B._transform(H,A)??[]});return i.length?[o,i]:[]});delete A.seen[this.id];let f=Object.assign($,{meta:this.meta}),E=A.selected&&!A.selected.includes(this)?f:H(this.kind,f,A);if(E===null)return null;if(NH(E))return I=E;let D=Object.keys(E);if((D.length===0||D.length===1&&D[0]==="meta")&&!ZL(this.inner))return null;if((this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in E))return A.undeclaredKeyHandling?{...E,value:S.intrinsic.unknown}:null;if(this.kind==="morph")E.in??=S.intrinsic.unknown;return I=L.node(this.kind,E,A.parseOptions)}configureReferences(H,A="references"){let L=AE.normalize(A),I=typeof H==="string"?(D,M)=>({...M,meta:{...M.meta,description:H}}):typeof H==="function"?(D,M)=>({...M,meta:H(M.meta)}):(D,M)=>({...M,meta:{...M.meta,...H}});if(L.boundary==="self")return this.$.node(this.kind,I(this.kind,{...this.inner,meta:this.meta}));let $=this._select(L),f=$&&GI($),E=L.boundary==="child"?(D,M)=>M.root.children.includes(D):L.boundary==="shallow"?(D)=>D.kind!=="structure":()=>!0;return this.$.finalize(this.transform(I,{shouldTransform:E,selected:f}))}}var AE={applyBoundary:{self:(H)=>[H],child:(H)=>[...H.children],shallow:(H)=>[...H.shallowReferences],references:(H)=>[...H.references]},applyMethod:{filter:(H)=>H,assertFilter:(H,A,L)=>{if(H.length===0)$I(An(A,L));return H},find:(H)=>H[0],assertFind:(H,A,L)=>{if(H.length===0)$I(An(A,L));return H[0]}},normalize:(H)=>typeof H==="function"?{boundary:"references",method:"filter",where:H}:typeof H==="string"?gH(H,AE.applyBoundary)?{method:"filter",boundary:H}:{boundary:"references",method:"filter",kind:H}:{boundary:"references",method:"filter",...H}},An=(H,A)=>`${H} had no references matching ${IH(A)}.`,Qm=(H)=>EI(H,{stringifyNonKey:(A)=>A.expression}),zm=/"(\$ark\.[^"]+)"/g,bm=(H)=>JSON.stringify(H).replaceAll(zm,"$1"),KL=(H,A)=>({path:H,node:A,propString:Qm(H)}),Ln=(H,A)=>H.propString===A.propString&&H.node.equals(A.node),Ao=(H,A)=>bL(H,A,{isEqual:Ln}),Zm=(H,A)=>bL(H,A,{isEqual:(L,I)=>L.equals(I)});class v extends Array{static init(H,A,L,I){return new v({kind:H,l:A,r:L,path:I?.path??[],optional:I?.optional??!1})}add(H,A,L,I){return this.push({kind:H,l:A,r:L,path:I?.path??[],optional:I?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:H,l:A,r:L}=this[0],I=EI(H);return Io(`Intersection${I&&` at ${I}`} of ${In(A,L)}`)}return`The following intersections result in unsatisfiable types:
61
- \u2022 ${this.map(({path:H,l:A,r:L})=>`${H}: ${In(A,L)}`).join(`
62
- \u2022 `)}`}throw(){return G(this.describeReasons())}invert(){let H=this.map((A)=>({...A,l:A.r,r:A.l}));if(!(H instanceof v))return new v(...H);return H}withPrefixKey(H,A){return this.map((L)=>({...L,path:[H,...L.path],optional:L.optional||A==="optional"}))}toNeverIfDisjoint(){return S.intrinsic.never}}var In=(H,A)=>`${Lo(H)} and ${Lo(A)}`,Lo=(H)=>NH(H)?H.expression:KH(H)?H.map(Lo).join(" | ")||"never":String(H),Io=(H)=>`${H} results in an unsatisfiable type`;var N$={},dA=(H,A,L)=>yH(H,A,{$:L,invert:!1,pipe:!1}),IE=(H,A,L)=>yH(H,A,{$:L,invert:!1,pipe:!0}),yH=(H,A,L)=>{let I=L.pipe?"|>":"&",$=`${H.hash}${I}${A.hash}`;if(N$[$]!==void 0)return N$[$];if(!L.pipe){let D=`${A.hash}${I}${H.hash}`;if(N$[D]!==void 0){let M=N$[D],o=M instanceof v?M.invert():M;return N$[$]=o,o}}let f=!L.pipe||!H.includesTransform&&!A.includesTransform;if(f&&H.equals(A))return H;let E=f?$o(H,A,L):H.hasKindIn(...l$)?hm(H,A,L):$o(H,A,L);if(NH(E)){if(H.equals(E))E=H;else if(A.equals(E))E=A}return N$[$]=E,E},$o=(H,A,L)=>{let I=H.precedence<A.precedence?H.kind:A.kind,$=H.impl.intersections[A.kind]??A.impl.intersections[H.kind];if($===void 0)return null;else if(I===H.kind)return $(H,A,L);else{let f=$(A,H,{...L,invert:!L.invert});if(f instanceof v)f=f.invert();return f}},hm=(H,A,L)=>H.includesTransform||A.includesTransform?L.invert?$n(A,H,L):$n(H,A,L):$o(H,A,L),$n=(H,A,L)=>H.distribute((I)=>rm(I,A,L),(I)=>{let $=I.filter(NH);if($.length===0)return v.init("union",H.branches,A.branches);if($.length<H.branches.length||!H.branches.every((D,M)=>D.in.equals($[M].in)))return L.$.parseSchema($);let f;if($.length===1){let D=$[0];if(!f)return D;return L.$.node("morph",{...D.inner,in:D.in.configure(f,"self")})}let E={branches:$};if(f)E.meta=f;return L.$.parseSchema(E)}),rm=(H,A,L)=>{if(H.hasKind("morph")){let $=[...H.morphs];if(H.lastMorphIfNode){let f=yH(H.lastMorphIfNode,A,L);if(f instanceof v)return f;$[$.length-1]=f}else $.push(A);return L.$.node("morph",{morphs:$,in:H.inner.in})}if(A.hasKind("morph")){let $=yH(H,A.in,L);if($ instanceof v)return $;return L.$.node("morph",{morphs:[A],in:$})}return L.$.node("morph",{morphs:[A],in:H})};class pL extends LE{constructor(H,A){super(H,A);Object.defineProperty(this,RA,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(H){return dA(this,H,this.$)}}class MI extends pL{traverseApply=(H,A)=>{if(!this.traverseAllows(H,A))A.errorFromNodeContext(this.errorContext)};compile(H){if(H.traversalKind==="Allows")H.return(this.compiledCondition);else H.if(this.compiledNegation,()=>H.line(`${H.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return WI(this.errorContext)}}var VA=(H)=>(A,L)=>{if(KH(A)){if(A.length===0)return;let $=A.map((f)=>L.$.node(H,f));if(H==="predicate")return $;return $.sort((f,E)=>f.hash<E.hash?-1:1)}let I=L.$.node(H,A);return I.hasOpenIntersection()?[I]:I},y$=(H)=>{let A=H.r.shift();if(!A){let I=H.l.length===0&&H.kind==="structure"?S.intrinsic.unknown.internal:H.ctx.$.node(H.kind,Object.assign(H.baseInner,jm(H.l)),{prereduced:!0});for(let $ of H.roots){if(I instanceof v)return I;I=yH($,I,H.ctx)}return I}let L=!1;for(let I=0;I<H.l.length;I++){let $=yH(H.l[I],A,H.ctx);if($===null)continue;if($ instanceof v)return $;if(!L){if($.isRoot())return H.roots.push($),H.l.splice(I),y$(H);H.l[I]=$,L=!0}else if(!H.l.includes($))return xH(`Unexpectedly encountered multiple distinct intersection results for refinement ${$}`)}if(!L)H.l.push(A);if(H.kind==="intersection")A.impliedSiblings?.forEach((I)=>bL(H.r,I));return y$(H)},R$=(H)=>{return Object.entries(H).flatMap(([L,I])=>(L in TD)?I:[]).sort((L,I)=>L.precedence<I.precedence?-1:L.precedence>I.precedence?1:L.kind==="predicate"&&I.kind==="predicate"?0:L.hash<I.hash?-1:1)},jm=(H)=>{let A={};for(let L of H)if(L.hasOpenIntersection())A[L.kind]=nH(A[L.kind],L);else{if(A[L.kind])return xH(`Unexpected intersection of closed refinements of kind ${L.kind}`);A[L.kind]=L}return A},fn=(...H)=>G(En(...H)),En=(H,A,L)=>{let I=L.hasKind("morph")?"a morph":L.isUnknown()?"unknown":L.exclude(A).defaultShortDescription;return`${sp(H)} operand must be ${A.description} (was ${I})`};var Dn=(H,A,L)=>new PI(H,A,L,L,null);class FD extends VL{}class PI extends VL{[RA]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(H,A,L,I,$){super((...f)=>{let E=fH(this.names,(D,M)=>{let o=this.arg$.parse(f[D]);if(!o.extends(this.constraints[D]))G(km(M,this.constraints[D].expression,o.expression));return[M,o]});if(this.defIsLazy()){let D=this.bodyDef(E);return this.$.parse(D)}return this.$.parse(A,{args:E})});this.paramDefs=H,this.bodyDef=A,this.$=L,this.arg$=I,this.hkt=$,this.description=$?new $().description??`a generic type for ${$.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof FD}cacheGetter(H,A){return Object.defineProperty(this,H,{value:A}),A}get json(){return this.cacheGetter("json",{params:this.params.map((H)=>H[1].isUnknown()?H[0]:[H[0],H[1].json]),body:jp(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map((H)=>typeof H==="string"?[H,S.intrinsic.unknown]:[H[0],this.$.parse(H[1])]))}get names(){return this.cacheGetter("names",this.params.map((H)=>H[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map((H)=>H[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}var km=(H,A,L)=>`${H} must be assignable to ${A} (was ${L})`;var Mn={morph:"it represents a transformation, while JSON Schema only allows validation. Consider creating a Schema from one of its endpoints using `.in` or `.out`.",cyclic:"cyclic types are not yet convertible to JSON Schema. If this feature is important to you, please add your feedback at https://github.com/arktypeio/arktype/issues/1087"},on=(H,A)=>{let L=`${H} is not convertible to JSON Schema`;if(A){let I=gH(A,Mn)?Mn[A]:A;L+=` because ${I}`}return L},UH={writeUnjsonifiableMessage:on,UnjsonifiableError:class H extends Error{},throwUnjsonifiableError:(...H)=>$I(on(...H)),throwInternalOperandError:(H,A)=>xH(`Unexpected JSON Schema input for ${H}: ${IH(A)}`)};var dm=$H({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:(H)=>typeof H==="function"?{predicate:H}:H,defaults:{description:(H)=>`valid according to ${H.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class un extends pL{serializedPredicate=rH(this.predicate);compiledCondition=`${this.serializedPredicate}(data, ctx)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=null;expression=this.serializedPredicate;traverseAllows=this.predicate;errorContext={code:"predicate",description:this.description,meta:this.meta};compiledErrorContext=WI(this.errorContext);traverseApply=(H,A)=>{if(!this.predicate(H,A.external)&&!A.hasError())A.errorFromNodeContext(this.errorContext)};compile(H){if(H.traversalKind==="Allows"){H.return(this.compiledCondition);return}H.if(`${this.compiledNegation} && !ctx.hasError()`,()=>H.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema(){return UH.throwUnjsonifiableError(`Predicate ${this.expression}`)}}var fo={implementation:dm,Node:un};var qm=$H({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:(H)=>Number.isInteger(H)?H:G(gm(H))}},normalize:(H)=>typeof H==="number"?{rule:H}:H,hasAssociatedError:!0,defaults:{description:(H)=>H.rule===1?"an integer":H.rule===2?"even":`a multiple of ${H.rule}`},intersections:{divisor:(H,A,L)=>L.$.node("divisor",{rule:Math.abs(H.rule*A.rule/em(H.rule,A.rule))})},obviatesBasisDescription:!0});class tn extends MI{traverseAllows=(H)=>H%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=S.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(H){if(H.type="integer",this.rule===1)return H;return H.multipleOf=this.rule,H}}var Eo={implementation:qm,Node:tn};var gm=(H)=>`divisor must be an integer (was ${H})`,em=(H,A)=>{let L,I=H,$=A;while($!==0)L=$,$=I%$,I=L;return I};class IL extends MI{boundOperandKind=IP[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=$P(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${HP[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?fP(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator["0"]==="<"?"upper":"lower";isStricterThan(H){return(this.limitKind==="upper"?this.numericLimit<H.numericLimit:this.numericLimit>H.numericLimit)||this.numericLimit===H.numericLimit&&this.exclusive===!0&&!H.exclusive}overlapsRange(H){if(this.isStricterThan(H))return!1;if(this.numericLimit===H.numericLimit&&(this.exclusive||H.exclusive))return!1;return!0}overlapIsUnit(H){return this.numericLimit===H.numericLimit&&!this.exclusive&&!H.exclusive}}var HP={"<":">=","<=":">",">":"<=",">=":"<"},AP={min:"max",minLength:"maxLength",after:"before"},_D={parse:(H)=>H||void 0},WD=(H)=>(A)=>{if(typeof A==="number")return{rule:A};let{exclusive:L,...I}=A;return L?{...I,rule:H==="minLength"?I.rule+1:I.rule-1}:I},mD=(H)=>(A)=>{if(typeof A==="number"||typeof A==="string"||A instanceof Date)return{rule:A};let{exclusive:L,...I}=A;if(!L)return I;let $=typeof I.rule==="number"?I.rule:typeof I.rule==="string"?new Date(I.rule).valueOf():I.rule.valueOf();return L?{...I,rule:H==="after"?$+1:$-1}:I},PD=(H)=>typeof H==="string"||typeof H==="number"?new Date(H):H,LP=(H,A)=>`${H} bound must be a positive integer (was ${A})`,Y$=(H)=>(A)=>{if(!Number.isInteger(A)||A<0)G(LP(H,A));return A},IP={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},$P=(H,A)=>`${gH(H,AP)?">":"<"}${A?"":"="}`,fP=(H)=>typeof H==="string"?H:new Date(H).toLocaleString(),pn=(H)=>`Bounded expression ${H} must be exactly one of number, string, Array, or Date`;var EP=$H({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:PD,serialize:(H)=>H.toISOString()}},normalize:mD("after"),defaults:{description:(H)=>`${H.collapsibleLimitString} or later`,actual:dI},intersections:{after:(H,A)=>H.isStricterThan(A)?H:A}});class nn extends IL{impliedBasis=S.intrinsic.Date.internal;collapsibleLimitString=dI(this.rule);traverseAllows=(H)=>H>=this.rule;reduceJsonSchema(){return UH.throwUnjsonifiableError("Date instance")}}var Do={implementation:EP,Node:nn};var DP=$H({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:PD,serialize:(H)=>H.toISOString()}},normalize:mD("before"),defaults:{description:(H)=>`${H.collapsibleLimitString} or earlier`,actual:dI},intersections:{before:(H,A)=>H.isStricterThan(A)?H:A,after:(H,A,L)=>H.overlapsRange(A)?H.overlapIsUnit(A)?L.$.node("unit",{unit:H.rule}):null:v.init("range",H,A)}});class Bn extends IL{collapsibleLimitString=dI(this.rule);traverseAllows=(H)=>H<=this.rule;impliedBasis=S.intrinsic.Date.internal;reduceJsonSchema(){return UH.throwUnjsonifiableError("Date instance")}}var Mo={implementation:DP,Node:Bn};var MP=$H({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:Y$("exactLength")}},normalize:(H)=>typeof H==="number"?{rule:H}:H,hasAssociatedError:!0,defaults:{description:(H)=>`exactly length ${H.rule}`,actual:(H)=>`${H.length}`},intersections:{exactLength:(H,A,L)=>v.init("unit",L.$.node("unit",{unit:H.rule}),L.$.node("unit",{unit:A.rule}),{path:["length"]}),minLength:(H,A)=>H.rule>=A.rule?H:v.init("range",H,A),maxLength:(H,A)=>H.rule<=A.rule?H:v.init("range",H,A)}});class cn extends MI{traverseAllows=(H)=>H.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=S.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema(H){switch(H.type){case"string":return H.minLength=this.rule,H.maxLength=this.rule,H;case"array":return H.minItems=this.rule,H.maxItems=this.rule,H;default:return UH.throwInternalOperandError("exactLength",H)}}}var oo={implementation:MP,Node:cn};var oP=$H({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:_D},normalize:(H)=>typeof H==="number"?{rule:H}:H,defaults:{description:(H)=>{if(H.rule===0)return H.exclusive?"negative":"non-positive";return`${H.exclusive?"less than":"at most"} ${H.rule}`}},intersections:{max:(H,A)=>H.isStricterThan(A)?H:A,min:(H,A,L)=>H.overlapsRange(A)?H.overlapIsUnit(A)?L.$.node("unit",{unit:H.rule}):null:v.init("range",H,A)},obviatesBasisDescription:!0});class xn extends IL{impliedBasis=S.intrinsic.number.internal;traverseAllows=this.exclusive?(H)=>H<this.rule:(H)=>H<=this.rule;reduceJsonSchema(H){if(this.exclusive)H.exclusiveMaximum=this.rule;else H.maximum=this.rule;return H}}var uo={implementation:oP,Node:xn};var uP=$H({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Y$("maxLength")}},reduce:(H,A)=>H.rule===0?A.node("exactLength",H):void 0,normalize:WD("maxLength"),defaults:{description:(H)=>`at most length ${H.rule}`,actual:(H)=>`${H.length}`},intersections:{maxLength:(H,A)=>H.isStricterThan(A)?H:A,minLength:(H,A,L)=>H.overlapsRange(A)?H.overlapIsUnit(A)?L.$.node("exactLength",{rule:H.rule}):null:v.init("range",H,A)}});class Un extends IL{impliedBasis=S.intrinsic.lengthBoundable.internal;traverseAllows=(H)=>H.length<=this.rule;reduceJsonSchema(H){switch(H.type){case"string":return H.maxLength=this.rule,H;case"array":return H.maxItems=this.rule,H;default:return UH.throwInternalOperandError("maxLength",H)}}}var to={implementation:uP,Node:Un};var tP=$H({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:_D},normalize:(H)=>typeof H==="number"?{rule:H}:H,defaults:{description:(H)=>{if(H.rule===0)return H.exclusive?"positive":"non-negative";return`${H.exclusive?"more than":"at least"} ${H.rule}`}},intersections:{min:(H,A)=>H.isStricterThan(A)?H:A},obviatesBasisDescription:!0});class Cn extends IL{impliedBasis=S.intrinsic.number.internal;traverseAllows=this.exclusive?(H)=>H>this.rule:(H)=>H>=this.rule;reduceJsonSchema(H){if(this.exclusive)H.exclusiveMinimum=this.rule;else H.minimum=this.rule;return H}}var io={implementation:tP,Node:Cn};var iP=$H({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Y$("minLength")}},reduce:(H)=>H.rule===0?S.intrinsic.unknown:void 0,normalize:WD("minLength"),defaults:{description:(H)=>H.rule===1?"non-empty":`at least length ${H.rule}`,actual:(H)=>H.length===0?"":`${H.length}`},intersections:{minLength:(H,A)=>H.isStricterThan(A)?H:A}});class Tn extends IL{impliedBasis=S.intrinsic.lengthBoundable.internal;traverseAllows=(H)=>H.length>=this.rule;reduceJsonSchema(H){switch(H.type){case"string":return H.minLength=this.rule,H;case"array":return H.minItems=this.rule,H;default:return UH.throwInternalOperandError("minLength",H)}}}var po={implementation:iP,Node:Tn};var Gn={min:io.implementation,max:uo.implementation,minLength:po.implementation,maxLength:to.implementation,exactLength:oo.implementation,after:Do.implementation,before:Mo.implementation},Fn={min:io.Node,max:uo.Node,minLength:po.Node,maxLength:to.Node,exactLength:oo.Node,after:Do.Node,before:Mo.Node};var pP=$H({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:(H)=>typeof H==="string"?{rule:H}:H instanceof RegExp?H.flags?{rule:H.source,flags:H.flags}:{rule:H.source}:H,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:(H)=>`matched by ${H.rule}`},intersections:{pattern:()=>null}});class _n extends MI{instance=new RegExp(this.rule,this.flags);expression=`${this.instance}`;traverseAllows=this.instance.test.bind(this.instance);compiledCondition=`${this.expression}.test(data)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=S.intrinsic.string.internal;reduceJsonSchema(H){if(H.pattern)return UH.throwUnjsonifiableError(`Intersection of patterns ${H.pattern} & ${this.rule}`);return H.pattern=this.rule,H}}var no={implementation:pP,Node:_n};var $E=(H,A)=>{let L=nP(H);if(A&&!A.includes(L))return G(`Root of kind ${L} should be one of ${A}`);return L},nP=(H)=>{if(b(H,"root"))return H.kind;if(typeof H==="string")return H[0]==="$"?"alias":(H in rA)?"domain":"proto";if(typeof H==="function")return"proto";if(typeof H!=="object"||H===null)return G(Wn(H));if("morphs"in H)return"morph";if("branches"in H||KH(H))return"union";if("unit"in H)return"unit";if("reference"in H)return"alias";let A=Object.keys(H);if(A.length===0||A.some((L)=>(L in TD)))return"intersection";if("proto"in H)return"proto";if("domain"in H)return"domain";return G(Wn(H))},Wn=(H)=>`${IH(H)} is not a valid type schema`,mn={},BP=(H)=>KH(H)?H.map((A)=>A.collapsibleJson):H.collapsibleJson,YA={};S.nodesByRegisteredId=YA;var Bo=(H)=>{return mn[H]??=0,`${H}${++mn[H]}`},co=(H)=>{let A=Q$[H.kind],L=A.applyConfig?.(H.def,H.$.resolvedConfig)??H.def,I={},{meta:$,...f}=L,E=$===void 0?{}:typeof $==="string"?{description:$}:$,D=R1(f).sort(([o],[u])=>O$(o)?O$(u)?s$(o)-s$(u):1:O$(u)?-1:o<u?-1:1).filter(([o,u])=>{if(o.startsWith("meta.")){let t=o.slice(5);return E[t]=u,!1}return!0});for(let o of D){let u=o[0],t=A.keys[u];if(!t)return G(`Key ${u} is not valid on ${H.kind} schema`);let i=t.parse?t.parse(o[1],H):o[1];if(i!==LL&&(i!==void 0||t.preserveUndefined))I[u]=i}if(A.reduce&&!H.prereduced){let o=A.reduce(I,H.$);if(o){if(o instanceof v)return o.throw();return cP(o,E)}}return xo({id:H.id,kind:H.kind,inner:I,meta:E,$:H.$})},xo=({id:H,kind:A,inner:L,meta:I,$,ignoreCache:f})=>{let E=Q$[A],D=R1(L),M=[],o={};if(D.forEach(([F,m])=>{let Y=E.keys[F],W=Y.serialize??(Y.child?BP:iL);if(o[F]=W(m),Y.child===!0){let P=m;if(KH(P))M.push(...P);else M.push(P)}else if(typeof Y.child==="function")M.push(...Y.child(m))}),E.finalizeInnerJson)o=E.finalizeInnerJson(o);let u={...o},t={};if(!ZL(I))t=fH(I,(F,m)=>[F,F==="examples"?m:iL(m)]),u.meta=XD(t,"description",!0);o=XD(o,E.collapsibleKey,!1);let i=JSON.stringify({kind:A,...o});u=XD(u,E.collapsibleKey,!1);let B=XD(u,E.collapsibleKey,!0),U=JSON.stringify({kind:A,...u});if($.nodesByHash[U]&&!f)return $.nodesByHash[U];let x={id:H,kind:A,impl:E,inner:L,innerEntries:D,innerJson:o,innerHash:i,meta:I,metaJson:t,json:u,hash:U,collapsibleJson:B,children:M};if(A!=="intersection"){for(let F in L)if(F!=="in"&&F!=="out")x[F]=L[F]}let T=new Xn[A](x,$);return $.nodesByHash[U]=T},Pn=(H,A)=>{if(H.id===A)return H;if(NH(YA[A]))xH(`Unexpected attempt to overwrite node id ${A}`);return xo({id:A,kind:H.kind,inner:H.inner,meta:H.meta,$:H.$,ignoreCache:!0})},cP=(H,A,L)=>{if(L&&NH(YA[L]))xH(`Unexpected attempt to overwrite node id ${L}`);return xo({id:L??Bo(A.alias??H.kind),kind:H.kind,inner:H.inner,meta:A,$:H.$})},XD=(H,A,L)=>{let I=Object.keys(H);if(I.length===1&&I[0]===A){let $=H[A];if(L)return $;if(hA($,"object")&&(Object.keys($).length===1||Array.isArray($)))return $}return H};var fE=(H,A,L)=>{if(H.key!==A.key)return null;let I=H.key,$=yH(H.value,A.value,L),f=H.required||A.required?"required":"optional";if($ instanceof v)if(f==="optional")$=S.intrinsic.never.internal;else return $.withPrefixKey(H.key,H.required&&A.required?"required":"optional");if(f==="required")return L.$.node("required",{key:I,value:$});let E=H.hasDefault()?A.hasDefault()?H.default===A.default?H.default:G(Uo(H.default,A.default)):H.default:A.hasDefault()?A.default:LL;return L.$.node("optional",{key:I,value:$,default:E})};class EE extends pL{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=S.intrinsic.object.internal;serializedKey=DI(this.key);compiledKey=typeof this.key==="string"?this.key:this.serializedKey;flatRefs=nH(this.value.flatRefs.map((H)=>KL([this.key,...H.path],H.node)),KL([this.key],this.value));_transform(H,A){A.path.push(this.key);let L=super._transform(H,A);return A.path.pop(),L}hasDefault(){return"default"in this.inner}traverseAllows=(H,A)=>{if(this.key in H)return kA(this.key,()=>this.value.traverseAllows(H[this.key],A),A);return this.optional};traverseApply=(H,A)=>{if(this.key in H)kA(this.key,()=>this.value.traverseApply(H[this.key],A),A);else if(this.hasKind("required"))A.errorFromNodeContext(this.errorContext)};compile(H){if(H.if(`${this.serializedKey} in data`,()=>H.traverseKey(this.serializedKey,`data${H.prop(this.key)}`,this.value)),this.hasKind("required"))H.else(()=>{if(H.traversalKind==="Apply")return H.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`);else return H.return(!1)});if(H.traversalKind==="Allows")H.return(!0)}}var Uo=(H,A)=>`Invalid intersection of default values ${IH(H)} & ${IH(A)}`;var xP=$H({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(H,A)=>A.$.parseSchema(H)},default:{preserveUndefined:!0}},normalize:(H)=>H,reduce:(H,A)=>{if(A.resolvedConfig.exactOptionalPropertyTypes===!1){if(!H.value.allows(void 0))return A.node("optional",{...H,value:H.value.or(j.undefined)},{prereduced:!0})}},defaults:{description:(H)=>`${H.compiledKey}?: ${H.value.description}`},intersections:{optional:fE}});class Sn extends EE{constructor(...H){super(...H);if("default"in this.inner)ME(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;let{default:H,...A}=this.inner;return this.cacheGetter("outProp",this.$.node("required",A,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${IH(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=CP(this);defaultValueMorphRef=this.defaultValueMorph&&rH(this.defaultValueMorph)}var DE={implementation:xP,Node:Sn},UP={},CP=(H)=>{if(!H.hasDefault())return;let A=`{${H.compiledKey}: ${H.value.id} = ${iL(H.default)}}`;return UP[A]??=Co(H.key,H.value,H.default)},Co=(H,A,L)=>{if(typeof L==="function")return A.includesTransform?($,f)=>{return kA(H,()=>A($[H]=L(),f),f),$}:($)=>{return $[H]=L(),$};let I=A.includesTransform?A.assert(L):L;return hA(I,"object")?($,f)=>{return kA(H,()=>A($[H]=L,f),f),$}:($)=>{return $[H]=I,$}},ME=(H,A,L)=>{let I=FI(A);if(hA(A,"object")&&!I)G(TP(L));let $=H.in(I?A():A);if($ instanceof jA){if(L===null)G(`Default ${$.summary}`);let f=$.transform((E)=>E.transform((D)=>({...D,prefixPath:[L]})));G(`Default for ${f.summary}`)}return A},TP=(H)=>{return`Non-primitive default ${H===null?"":typeof H==="number"?`for value at [${H}] `:`for ${DI(H)} `}must be specified as a function like () => ({my: 'object'})`};class nL extends LE{constructor(H,A){super(H,A);Object.defineProperty(this,RA,{value:"root",enumerable:!1})}get internal(){return this}get "~standard"(){return{vendor:"arktype",version:1,validate:(H)=>{let A=this(H);if(A instanceof jA)return A;return{value:A}}}}as(){return this}brand(H){if(H==="")return G(GP);return this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute(H,A){let L=this.branches.map(H);return A?.(L)??L}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(H={}){let A={dialect:"https://json-schema.org/draft/2020-12/schema",...H},L=this.toJsonSchemaRecurse(A);if(typeof A.dialect==="string")L.$schema=A.dialect;return L}toJsonSchemaRecurse(H){let A=this.innerToJsonSchema(H);return Object.assign(A,this.metaJson)}intersect(H){let A=this.$.parseDefinition(H),L=this.rawIntersect(A);if(L instanceof v)return L;return this.$.finalize(L)}rawIntersect(H){return dA(this,H,this.$)}toNeverIfDisjoint(){return this}and(H){let A=this.intersect(H);return A instanceof v?A.throw():A}rawAnd(H){let A=this.rawIntersect(H);return A instanceof v?A.throw():A}or(H){let A=this.$.parseDefinition(H);return this.$.finalize(this.rawOr(A))}rawOr(H){let A=[...this.branches,...H.branches];return this.$.node("union",A)}map(H){return this.$.schema(this.applyStructuralOperation("map",[H]))}pick(...H){return this.$.schema(this.applyStructuralOperation("pick",H))}omit(...H){return this.$.schema(this.applyStructuralOperation("omit",H))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;let H=this.applyStructuralOperation("keyof",[]).reduce((A,L)=>A.intersect(L).toNeverIfDisjoint(),S.intrinsic.unknown.internal);if(H.branches.length===0)G(Io(`keyof ${this.expression}`));return this._keyof=this.$.finalize(H)}get props(){if(this.branches.length!==1)return G(FP(this.expression));return[...this.applyStructuralOperation("props",[])[0]]}merge(H){let A=this.$.parseDefinition(H);return this.$.schema(A.distribute((L)=>this.applyStructuralOperation("merge",[Jn(L)??G(Vn("merge",L.expression))])))}applyStructuralOperation(H,A){return this.distribute((L)=>{if(L.equals(S.intrinsic.object)&&H!=="merge")return L;let I=Jn(L);if(!I)G(Vn(H,L.expression));if(H==="keyof")return I.keyof();if(H==="get")return I.get(...A);if(H==="props")return I.props;let $=H==="required"?"require":H==="partial"?"optionalize":H;return this.$.node("intersection",{...L.inner,structure:I[$](...A)})})}get(...H){if(H[0]===void 0)return this;return this.$.schema(this.applyStructuralOperation("get",H))}extract(H){let A=this.$.parseDefinition(H);return this.$.schema(this.branches.filter((L)=>L.extends(A)))}exclude(H){let A=this.$.parseDefinition(H);return this.$.schema(this.branches.filter((L)=>!L.extends(A)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps(H){return!(this.intersect(H)instanceof v)}extends(H){let A=this.intersect(H);return!(A instanceof v)&&this.equals(A)}ifExtends(H){return this.extends(H)?this:void 0}subsumes(H){return this.$.parseDefinition(H).extends(this)}configure(H,A="shallow"){return this.configureReferences(H,A)}describe(H,A="shallow"){return this.configure({description:H},A)}optional(){return[this,"?"]}default(H){return ME(this,H,null),[this,"=",H]}from(H){return this.assert(H)}_pipe(...H){let A=H.reduce((L,I)=>L.rawPipeOnce(I),this);return this.$.finalize(A)}tryPipe(...H){let A=H.reduce((L,I)=>L.rawPipeOnce(b(I,"root")?I:($,f)=>{try{return I($,f)}catch(E){return f.error({code:"predicate",predicate:I,actual:`aborted due to error:
63
- ${E}
64
- `})}}),this);return this.$.finalize(A)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to(H){return this.$.finalize(this.toNode(this.$.parseDefinition(H)))}toNode(H){let A=IE(this,H,this.$);if(A instanceof v)return A.throw();return A}rawPipeOnce(H){if(b(H,"root"))return this.toNode(H);return this.distribute((A)=>A.hasKind("morph")?this.$.node("morph",{in:A.inner.in,morphs:[...A.morphs,H]}):this.$.node("morph",{in:A,morphs:[H]}),this.$.parseSchema)}narrow(H){return this.constrainOut("predicate",H)}constrain(H,A){return this._constrain("root",H,A)}constrainIn(H,A){return this._constrain("in",H,A)}constrainOut(H,A){return this._constrain("out",H,A)}_constrain(H,A,L){let I=this.$.node(A,L);if(I.isRoot())return I.isUnknown()?this:xH(`Unexpected constraint node ${I}`);let $=H==="root"?this:this[H];if($.hasKind("morph")||I.impliedBasis&&!$.extends(I.impliedBasis))return fn(A,I.impliedBasis,this);let f=this.$.node("intersection",{[I.kind]:I}),E=H==="out"?IE(this,f,this.$):dA(this,f,this.$);if(E instanceof v)E.throw();return this.$.finalize(E)}onUndeclaredKey(H){let A=typeof H==="string"?H:H.rule,L=typeof H==="string"?!1:H.deep;return this.$.finalize(this.transform((I,$)=>I==="structure"?A==="ignore"?Pp($,{undeclared:1}):{...$,undeclared:A}:$,L?void 0:{shouldTransform:(I)=>!AI(a$,I.kind)}))}hasEqualMorphs(H){if(!this.includesTransform&&!H.includesTransform)return!0;if(!II(this.shallowMorphs,H.shallowMorphs))return!1;if(!II(this.flatMorphs,H.flatMorphs,{isEqual:(A,L)=>A.propString===L.propString&&(A.node.hasKind("morph")&&L.node.hasKind("morph")?A.node.hasEqualMorphs(L.node):A.node.hasKind("intersection")&&L.node.hasKind("intersection")?A.node.structure?.structuralMorphRef===L.node.structure?.structuralMorphRef:!1)}))return!1;return!0}onDeepUndeclaredKey(H){return this.onUndeclaredKey({rule:H,deep:!0})}filter(H){return this.constrainIn("predicate",H)}divisibleBy(H){return this.constrain("divisor",H)}matching(H){return this.constrain("pattern",H)}atLeast(H){return this.constrain("min",H)}atMost(H){return this.constrain("max",H)}moreThan(H){return this.constrain("min",z$(H))}lessThan(H){return this.constrain("max",z$(H))}atLeastLength(H){return this.constrain("minLength",H)}atMostLength(H){return this.constrain("maxLength",H)}moreThanLength(H){return this.constrain("minLength",z$(H))}lessThanLength(H){return this.constrain("maxLength",z$(H))}exactlyLength(H){return this.constrain("exactLength",H)}atOrAfter(H){return this.constrain("after",H)}atOrBefore(H){return this.constrain("before",H)}laterThan(H){return this.constrain("after",z$(H))}earlierThan(H){return this.constrain("before",z$(H))}}var GP="Expected a non-empty brand name after #",z$=(H)=>typeof H==="object"&&!(H instanceof Date)?{...H,exclusive:!0}:{rule:H,exclusive:!0},oE=(H,A)=>b(A,"root")?b(H,"root")?H.extends(A):A.allows(H):b(H,"root")?H.hasUnit(A):A===H,Jn=(H)=>{if(H.hasKind("morph"))return null;if(H.hasKind("intersection"))return H.inner.structure??(H.basis?.domain==="object"?H.$.bindReference(S.intrinsic.emptyStructure):null);if(H.isBasis()&&H.domain==="object")return H.$.bindReference(S.intrinsic.emptyStructure);return null},FP=(H)=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
65
- ${H}`,Vn=(H,A)=>`${H} operand must be an object (was ${A})`;var hL=(H,A)=>fH(GD(H),(L,I)=>[I,A]);var _P=(H)=>typeof H==="string"?{reference:H}:H,wn=(H)=>H instanceof v?S.intrinsic.never.internal:H,WP=$H({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:(H)=>H.startsWith("$")?H:`$ark.${H}`},resolve:{}},normalize:_P,defaults:{description:(H)=>H.reference},intersections:{alias:(H,A,L)=>L.$.lazilyResolve(()=>wn(yH(H.resolution,A.resolution,L)),`${H.reference}${L.pipe?"=>":"&"}${A.reference}`),...hL("alias",(H,A,L)=>{if(A.isUnknown())return H;if(A.isNever())return A;if(A.isBasis()&&!A.overlaps(S.intrinsic.object))return v.init("assignability",S.intrinsic.object,A);return L.$.lazilyResolve(()=>wn(yH(H.resolution,A,L)),`${H.reference}${L.pipe?"=>":"&"}${A.id}`)})}});class Kn extends nL{expression=this.reference;structure=void 0;get resolution(){let H=this._resolve();return YA[this.id]=H}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));let H=this.reference,A=YA[H],L=[];while(b(A,"context")){if(L.includes(A.id))return G(mP(A.id,L));L.push(A.id),A=YA[A.id]}if(!b(A,"root"))return xH(`Unexpected resolution for reference ${this.reference}
66
- Seen: [${L.join("->")}]
67
- Resolution: ${IH(A)}`);return A}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;let H=this.reference.slice(1),A=this.$.resolutions[H];if(typeof A==="string")return A;if(b(A,"root"))return A.id;return xH(`Unexpected resolution for reference ${this.reference}: ${IH(A)}`)}get defaultShortDescription(){return rA.object}innerToJsonSchema(H){return UH.throwUnjsonifiableError(this.expression,"cyclic")}traverseAllows=(H,A)=>{let L=A.seen[this.reference];if(L?.includes(H))return!0;return A.seen[this.reference]=nH(L,H),this.resolution.traverseAllows(H,A)};traverseApply=(H,A)=>{let L=A.seen[this.reference];if(L?.includes(H))return;A.seen[this.reference]=nH(L,H),this.resolution.traverseApply(H,A)};compile(H){let A=this.resolutionId;H.if(`ctx.seen.${A} && ctx.seen.${A}.includes(data)`,()=>H.return(!0)),H.if(`!ctx.seen.${A}`,()=>H.line(`ctx.seen.${A} = []`)),H.line(`ctx.seen.${A}.push(data)`),H.return(H.invoke(A))}}var mP=(H,A)=>`Alias '${H}' has a shallow resolution cycle: ${[...A,H].join("->")}`,uE={implementation:WP,Node:Kn};class qI extends nL{traverseApply=(H,A)=>{if(!this.traverseAllows(H,A))A.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return WI(this.errorContext)}compile(H){if(H.traversalKind==="Allows")H.return(this.compiledCondition);else H.if(this.compiledNegation,()=>H.line(`${H.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}var PP=$H({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:(H)=>typeof H==="string"?{domain:H}:K$(H,"numberAllowsNaN")&&H.domain!=="number"?G(SD.writeBadAllowNanMessage(H.domain)):H,applyConfig:(H,A)=>H.numberAllowsNaN===void 0&&H.domain==="number"&&A.numberAllowsNaN?{...H,numberAllowsNaN:!0}:H,defaults:{description:(H)=>rA[H.domain],actual:(H)=>Number.isNaN(H)?"NaN":rA[uA(H)]},intersections:{domain:(H,A)=>H.domain==="number"&&A.domain==="number"?H.numberAllowsNaN?A:H:v.init("domain",H,A)}});class vn extends qI{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?(H)=>typeof H==="number"&&!Number.isNaN(H):(H)=>uA(H)===this.domain;compiledCondition=this.domain==="object"?'((typeof data === "object" && data !== null) || typeof data === "function")':`typeof data === "${this.domain}"${this.requiresNaNCheck?" && !Number.isNaN(data)":""}`;compiledNegation=this.domain==="object"?'((typeof data !== "object" || data === null) && typeof data !== "function")':`typeof data !== "${this.domain}"${this.requiresNaNCheck?" || Number.isNaN(data)":""}`;expression=this.numberAllowsNaN?"number | NaN":this.domain;get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return rA[this.domain]}innerToJsonSchema(H){if(this.domain==="bigint"||this.domain==="symbol")return UH.throwUnjsonifiableError(this.domain);return{type:this.domain}}}var SD={implementation:PP,Node:vn,writeBadAllowNanMessage:(H)=>`numberAllowsNaN may only be specified with domain "number" (was ${H})`};var XP=$H({kind:"intersection",hasAssociatedError:!0,normalize:(H)=>{if(NH(H))return H;let{structure:A,...L}=H,I=!!A,$=A??{},f=fH(L,(E,D)=>{if(gH(E,ep)){if(I)G(`Flattened structure key ${E} cannot be specified alongside a root 'structure' key.`);return $[E]=D,[]}return[E,D]});if(b($,"constraint")||!ZL($))f.structure=$;return f},finalizeInnerJson:({structure:H,...A})=>hA(H,"object")?{...H,...A}:A,keys:{domain:{child:!0,parse:(H,A)=>A.$.node("domain",H)},proto:{child:!0,parse:(H,A)=>A.$.node("proto",H)},structure:{child:!0,parse:(H,A)=>A.$.node("structure",H),serialize:(H)=>{if(!H.sequence?.minLength)return H.collapsibleJson;let{sequence:A,...L}=H.collapsibleJson,{minVariadicLength:I,...$}=A,f=$.variadic&&Object.keys($).length===1?$.variadic:$;return{...L,sequence:f}}},divisor:{child:!0,parse:VA("divisor")},max:{child:!0,parse:VA("max")},min:{child:!0,parse:VA("min")},maxLength:{child:!0,parse:VA("maxLength")},minLength:{child:!0,parse:VA("minLength")},exactLength:{child:!0,parse:VA("exactLength")},before:{child:!0,parse:VA("before")},after:{child:!0,parse:VA("after")},pattern:{child:!0,parse:VA("pattern")},predicate:{child:!0,parse:VA("predicate")}},reduce:(H,A)=>an({},H,{$:A,invert:!1,pipe:!1}),defaults:{description:(H)=>{if(H.children.length===0)return"unknown";if(H.structure)return H.structure.description;let A=[];if(H.basis&&!H.refinements.some((L)=>L.impl.obviatesBasisDescription))A.push(H.basis.description);if(H.refinements.length){let L=H.refinements.toSorted((I,$)=>I.kind==="min"&&$.kind==="max"?-1:0).map((I)=>I.description);A.push(...L)}if(H.inner.predicate)A.push(...H.inner.predicate.map((L)=>L.description));return A.join(" and ")},expected:(H)=>` \u25E6 ${H.errors.map((A)=>A.expected).join(`
68
- \u25E6 `)}`,problem:(H)=>`(${H.actual}) must be...
69
- ${H.expected}`},intersections:{intersection:(H,A,L)=>an(H.inner,A.inner,L),...hL("intersection",(H,A,L)=>{if(H.children.length===0)return A;let{domain:I,proto:$,...f}=H.inner,E=$??I,D=E?yH(E,A,L):A;return D instanceof v?D:H?.basis?.equals(D)?H:H.$.node("intersection",{...f,[D.kind]:D},{prereduced:!0})})}});class ln extends nL{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter((H)=>H.isRefinement());structure=this.inner.structure;expression=SP(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??"present"}innerToJsonSchema(H){return this.children.reduce((A,L)=>L.isBasis()?L.toJsonSchemaRecurse(H):L.reduceJsonSchema(A,H),{})}traverseAllows=(H,A)=>this.children.every((L)=>L.traverseAllows(H,A));traverseApply=(H,A)=>{let L=A.currentErrorCount;if(this.basis){if(this.basis.traverseApply(H,A),A.currentErrorCount>L)return}if(this.refinements.length){for(let I=0;I<this.refinements.length-1;I++)if(this.refinements[I].traverseApply(H,A),A.failFast&&A.currentErrorCount>L)return;if(this.refinements.at(-1).traverseApply(H,A),A.currentErrorCount>L)return}if(this.structure){if(this.structure.traverseApply(H,A),A.currentErrorCount>L)return}if(this.inner.predicate){for(let I=0;I<this.inner.predicate.length-1;I++)if(this.inner.predicate[I].traverseApply(H,A),A.failFast&&A.currentErrorCount>L)return;this.inner.predicate.at(-1).traverseApply(H,A)}};compile(H){if(H.traversalKind==="Allows"){this.children.forEach((A)=>H.check(A)),H.return(!0);return}if(H.initializeErrorCount(),this.basis){if(H.check(this.basis),this.children.length>1)H.returnIfFail()}if(this.refinements.length){for(let A=0;A<this.refinements.length-1;A++)H.check(this.refinements[A]),H.returnIfFailFast();if(H.check(this.refinements.at(-1)),this.structure||this.inner.predicate)H.returnIfFail()}if(this.structure){if(H.check(this.structure),this.inner.predicate)H.returnIfFail()}if(this.inner.predicate){for(let A=0;A<this.inner.predicate.length-1;A++)H.check(this.inner.predicate[A]),H.returnIfFail();H.check(this.inner.predicate.at(-1))}}}var To={implementation:XP,Node:ln},SP=(H)=>{let A=H.structure?.expression||`${H.basis&&!H.refinements.some((L)=>L.impl.obviatesBasisExpression)?H.basis.nestableExpression+" ":""}${H.refinements.map((L)=>L.expression).join(" & ")}`||"unknown";if(A==="Array == 0")A="[]";return A},an=(H,A,L)=>{let I={},$=H.proto??H.domain,f=A.proto??A.domain,E=$?f?yH($,f,L):$:f;if(E instanceof v)return E;if(E)I[E.kind]=E;return y$({kind:"intersection",baseInner:I,l:R$(H),r:R$(A),roots:[],ctx:L})};var JP=$H({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(H,A)=>A.$.parseSchema(H)},morphs:{parse:GI,serialize:(H)=>H.map((A)=>b(A,"root")?A.json:rH(A))},declaredIn:{child:!1,serialize:(H)=>H.json},declaredOut:{child:!1,serialize:(H)=>H.json}},normalize:(H)=>H,defaults:{description:(H)=>`a morph from ${H.in.description} to ${H.out?.description??"unknown"}`},intersections:{morph:(H,A,L)=>{if(!H.hasEqualMorphs(A))return G(VP(H.expression,A.expression));let I=yH(H.in,A.in,L);if(I instanceof v)return I;let $={morphs:H.morphs};if(H.declaredIn||A.declaredIn){let f=yH(H.in,A.in,L);if(f instanceof v)return f.throw();else $.declaredIn=f}if(H.declaredOut||A.declaredOut){let f=yH(H.out,A.out,L);if(f instanceof v)return f.throw();else $.declaredOut=f}return I.distribute((f)=>L.$.node("morph",{...$,in:f}),L.$.parseSchema)},...hL("morph",(H,A,L)=>{let I=H.inner.in?yH(H.inner.in,A,L):A;return I instanceof v?I:I.equals(H.inner.in)?H:L.$.node("morph",{...H.inner,in:I})})}});class On extends nL{serializedMorphs=this.morphs.map(rH);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=b(this.lastMorph,"root")?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.out:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get in(){return this.declaredIn??this.inner.in?.in??S.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??S.intrinsic.unknown.internal}declareIn(H){return this.$.node("morph",{...this.inner,declaredIn:H})}declareOut(H){return this.$.node("morph",{...this.inner,declaredOut:H})}expression=`(In: ${this.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`;get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema(H){return UH.throwUnjsonifiableError(this.expression,"morph")}compile(H){if(H.traversalKind==="Allows"){if(!this.introspectableIn)return;H.return(H.invoke(this.introspectableIn));return}if(this.introspectableIn)H.line(H.invoke(this.introspectableIn));H.line(`ctx.queueMorphs(${this.compiledMorphs})`)}traverseAllows=(H,A)=>!this.introspectableIn||this.introspectableIn.traverseAllows(H,A);traverseApply=(H,A)=>{if(this.introspectableIn)this.introspectableIn.traverseApply(H,A);A.queueMorphs(this.morphs)};hasEqualMorphs(H){return II(this.morphs,H.morphs,{isEqual:(A,L)=>A===L||b(A,"root")&&b(L,"root")&&A.equals(L)})}}var Go={implementation:JP,Node:On},VP=(H,A)=>`The intersection of distinct morphs at a single path is indeterminate:
70
- Left: ${H}
71
- Right: ${A}`;var wP=$H({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:(H)=>rf(H)??iL(H)},dateAllowsInvalid:{}},normalize:(H)=>{let A=typeof H==="string"?{proto:jI[H]}:typeof H==="function"?NH(H)?H:{proto:H}:typeof H.proto==="string"?{...H,proto:jI[H.proto]}:H;if(typeof A.proto!=="function")G(tE.writeInvalidSchemaMessage(A.proto));if(K$(A,"dateAllowsInvalid")&&A.proto!==Date)G(tE.writeBadInvalidDateMessage(A.proto));return A},applyConfig:(H,A)=>{if(H.dateAllowsInvalid===void 0&&H.proto===Date&&A.dateAllowsInvalid)return{...H,dateAllowsInvalid:!0};return H},defaults:{description:(H)=>H.builtinName?Vp[H.builtinName]:`an instance of ${H.proto.name}`,actual:(H)=>H instanceof Date&&H.toString()==="Invalid Date"?"an invalid Date":hf(H)},intersections:{proto:(H,A)=>H.proto===Date&&A.proto===Date?H.dateAllowsInvalid?A:H:Z1(H.proto,A.proto)?H:Z1(A.proto,H.proto)?A:v.init("proto",H,A),domain:(H,A)=>A.domain==="object"?H:v.init("domain",S.intrinsic.object.internal,A)}});class sn extends qI{builtinName=rf(this.proto);serializedConstructor=this.json.proto;requiresInvalidDateCheck=this.proto===Date&&!this.dateAllowsInvalid;traverseAllows=this.requiresInvalidDateCheck?(H)=>H instanceof Date&&H.toString()!=="Invalid Date":(H)=>H instanceof this.proto;compiledCondition=`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`;compiledNegation=`!(${this.compiledCondition})`;innerToJsonSchema(H){switch(this.builtinName){case"Array":return{type:"array"};default:return UH.throwUnjsonifiableError(this.description)}}expression=this.dateAllowsInvalid?"Date | InvalidDate":this.proto.name;get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}domain="object";get defaultShortDescription(){return this.description}}var tE={implementation:wP,Node:sn,writeBadInvalidDateMessage:(H)=>`dateAllowsInvalid may only be specified with constructor Date (was ${H.name})`,writeInvalidSchemaMessage:(H)=>`instanceOf operand must be a function (was ${uA(H)})`};var KP=$H({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(H,A)=>{let L=[];if(H.forEach((I)=>{(b(I,"root")?I.branches:A.$.parseSchema(I).branches).forEach((f)=>{if(f.hasKind("morph")){let E=L.findIndex((D)=>D.hasKind("morph")&&D.hasEqualMorphs(f));if(E===-1)L.push(f);else{let D=L[E];L[E]=A.$.node("morph",{...D.inner,in:D.in.rawOr(f.in)})}}else L.push(f)})}),!A.def.ordered)L.sort((I,$)=>I.hash<$.hash?-1:1);return L}}},normalize:(H)=>KH(H)?{branches:H}:H,reduce:(H,A)=>{let L=QP(H);if(L.length===1)return L[0];if(L.length===H.branches.length)return;return A.node("union",{...H,branches:L},{prereduced:!0})},defaults:{description:(H)=>H.distribute((A)=>A.description,b$),expected:(H)=>{let A=Fp(H.errors,"propString"),L=Object.entries(A).map(([I,$])=>{let f=[];$.forEach((M)=>bL(f,M.expected));let E=b$(f),D=$.every((M)=>M.actual===$[0].actual)?$[0].actual:IH($[0].data);return`${I&&`${I} `}must be ${E}${D&&` (was ${D})`}`});return b$(L)},problem:(H)=>H.expected,message:(H)=>H.problem},intersections:{union:(H,A,L)=>{if(H.isNever!==A.isNever)return v.init("presence",H,A);let I;if(H.ordered){if(A.ordered)G(bP(H.expression,A.expression));if(I=Fo(A.branches,H.branches,L),I instanceof v)I.invert()}else I=Fo(H.branches,A.branches,L);if(I instanceof v)return I;return L.$.parseSchema(H.ordered||A.ordered?{branches:I,ordered:!0}:{branches:I})},...hL("union",(H,A,L)=>{let I=Fo(H.branches,[A],L);if(I instanceof v)return I;if(I.length===1)return I[0];return L.$.parseSchema(H.ordered?{branches:I,ordered:!0}:{branches:I})})}});class Rn extends nL{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){let H=[],A=-1;return this.branches.forEach((L)=>{if(L.hasKind("unit")&&L.domain==="boolean"){if(A===-1)A=H.length,H.push(L);else H[A]=S.intrinsic.boolean;return}H.push(L)}),H}unitBranches=this.branches.filter((H)=>H.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?yP(this.discriminant):null;expression=this.distribute((H)=>H.nestableExpression,YP);createBranchedOptimisticRootApply(){return(H,A)=>{let L=this.traverseOptimistic(H);if(L!==LL)return L;let I=new wL(H,this.$.resolvedConfig);return this.traverseApply(H,I),I.finalize(A)}}get shallowMorphs(){return this.branches.reduce((H,A)=>bL(H,A.shallowMorphs),[])}get defaultShortDescription(){return this.distribute((H)=>H.defaultShortDescription,b$)}innerToJsonSchema(H){if(this.branchGroups.length===1&&this.branchGroups[0].equals(S.intrinsic.boolean))return{type:"boolean"};let A=this.branchGroups.map((L)=>L.toJsonSchemaRecurse(H));if(A.every((L)=>Object.keys(L).length===1&&K$(L,"const")))return{enum:A.map((L)=>L.const)};return{anyOf:A}}traverseAllows=(H,A)=>this.branches.some((L)=>L.traverseAllows(H,A));traverseApply=(H,A)=>{let L=[];for(let I=0;I<this.branches.length;I++){if(A.pushBranch(),this.branches[I].traverseApply(H,A),!A.hasError()){if(this.branches[I].includesTransform)return A.queuedMorphs.push(...A.popBranch().queuedMorphs);return A.popBranch()}L.push(A.popBranch().error)}A.errorFromNodeContext({code:"union",errors:L,meta:this.meta})};traverseOptimistic=(H)=>{for(let A=0;A<this.branches.length;A++){let L=this.branches[A];if(L.traverseAllows(H)){if(L.contextFreeMorph)return L.contextFreeMorph(H);return H}}return LL};compile(H){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable(H);let A=this.discriminant.optionallyChainedPropString;if(this.discriminant.kind==="domain")A=`typeof ${A} === "object" ? ${A} === null ? "null" : "object" : typeof ${A} === "function" ? "object" : typeof ${A}`;let L=this.discriminant.cases,I=Object.keys(L),{optimistic:$}=H;if(H.optimistic=!1,H.block(`switch(${A})`,()=>{for(let o in L){let u=L[o],t=o==="default"?o:`case ${o}`;H.line(`${t}: return ${u===!0?$?H.data:u:$?`${H.invoke(u)} ? ${u.contextFreeMorph?`${rH(u.contextFreeMorph)}(${H.data})`:H.data} : "${LL}"`:H.invoke(u)}`)}return H}),H.traversalKind==="Allows"){H.return($?`"${LL}"`:!1);return}let f=b$(this.discriminant.kind==="domain"?I.map((o)=>{let u=o.slice(1,-1);return u==="function"?rA.object:rA[u]}):I),E=this.discriminant.path.map((o)=>typeof o==="symbol"?rH(o):JSON.stringify(o)),D=JSON.stringify(f),M=this.discriminant.kind==="domain"?`${sP}[${A}]`:`${NP}(${A})`;H.line(`ctx.errorFromNodeContext({
60
+ `);class On{path=[];errors=new ho(this);root;config;queuedMorphs=[];branches=[];seen={};constructor(i,o){this.root=i,this.config=o}get data(){let i=this.root;for(let o of this.path)i=i?.[o];return i}get propString(){return Tp(this.path)}reject(i){return this.error(i),!1}mustBe(i){return this.error(i),!1}error(i){let o=typeof i==="object"?i.code?i:{...i,code:"predicate"}:{code:"predicate",expected:i};return this.errorFromContext(o)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs(i){let o={path:new tx(...this.path),morphs:i};if(this.currentBranch)this.currentBranch.queuedMorphs.push(o);else this.queuedMorphs.push(o)}finalize(i){if(this.queuedMorphs.length){if(typeof this.root==="object"&&this.root!==null&&this.config.clone)this.root=this.config.clone(this.root);this.applyQueuedMorphs()}if(this.hasError())return i?i(this.errors):this.errors;return this.root}get currentErrorCount(){return this.currentBranch?this.currentBranch.error?1:0:this.errors.count}get failFast(){return this.branches.length!==0}pushBranch(){this.branches.push({error:void 0,queuedMorphs:[]})}popBranch(){return this.branches.pop()}get external(){return this}errorFromNodeContext(i){return this.errorFromContext(i)}errorFromContext(i){let o=new Mp(i,this);if(this.currentBranch)this.currentBranch.error=o;else this.errors.add(o);return o}applyQueuedMorphs(){while(this.queuedMorphs.length){let i=this.queuedMorphs;this.queuedMorphs=[];for(let{path:o,morphs:n}of i){if(this.errors.affectsPath(o))continue;this.applyMorphsAtPath(o,n)}}}applyMorphsAtPath(i,o){let n=i.at(-1),p;if(n!==void 0){p=this.root;for(let c=0;c<i.length-1;c++)p=p[i[c]]}this.path=[...i];for(let c of o){let x=Ii(c),T=c(p===void 0?this.root:p[n],this);if(T instanceof Mp){this.errors.add(T);break}if(T instanceof ho){if(!x)this.errors.merge(T);break}if(p===void 0)this.root=T;else p[n]=T;this.applyQueuedMorphs()}}}var go=(i,o,n)=>{if(!n)return o();n.path.push(i);let p=o();return n.path.pop(),p};class iT extends En{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(i,o){super((p,c,x=this.onFail)=>{if(c)return this.traverseApply(p,c),c.hasError()?c.errors:c.data;return this.rootApply(p,x)},{attach:i});this.attachments=i,this.$=o,this.onFail=this.meta.onFail??this.$.resolvedConfig.onFail,this.includesTransform=this.hasKind("morph")||this.hasKind("structure")&&this.structuralMorph!==void 0,this.includesContextualPredicate=this.hasKind("predicate")&&this.inner.predicate.length!==1,this.isCyclic=this.kind==="alias",this.referencesById={[this.id]:this},this.shallowReferences=this.hasKind("structure")?[this,...this.children]:this.children.reduce((p,c)=>X2(p,c.shallowReferences),[this]);let n=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let p=0;p<this.children.length;p++){if(this.includesTransform||=this.children[p].includesTransform,this.includesContextualPredicate||=this.children[p].includesContextualPredicate,this.isCyclic||=this.children[p].isCyclic,!n){let c=this.children[p].flatRefs;for(let x=0;x<c.length;x++){let T=c[x];if(!this.flatRefs.some((m)=>hA(m,T))){this.flatRefs.push(T);for(let m of T.node.branches)if(m.hasKind("morph")||m.hasKind("intersection")&&m.structure?.structuralMorph!==void 0)this.flatMorphs.push({path:T.path,propString:T.propString,node:m})}}}Object.assign(this.referencesById,this.children[p].referencesById)}this.flatRefs.sort((p,c)=>p.path.length>c.path.length?1:p.path.length<c.path.length?-1:p.propString>c.propString?1:p.propString<c.propString?-1:p.node.expression<c.node.expression?-1:1),this.allowsRequiresContext=this.includesContextualPredicate||this.isCyclic,this.rootApplyStrategy=!this.allowsRequiresContext&&this.flatMorphs.length===0?this.shallowMorphs.length===0?"allows":this.shallowMorphs.every((p)=>p.length===1||p.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some((p)=>p.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?(p)=>this.traverseAllows(p,new On(p,this.$.resolvedConfig)):(p)=>this.traverseAllows(p)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(o,n)=>{if(this.allows(o))return o;let p=new On(o,this.$.resolvedConfig);return this.traverseApply(o,p),p.finalize(n)};case"contextual":return(o,n)=>{let p=new On(o,this.$.resolvedConfig);return this.traverseApply(o,p),p.finalize(n)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];let i=this.$.resolvedConfig.clone;return(o,n)=>{if(this.allows(o))return this.contextFreeMorph(i&&(typeof o==="object"&&o!==null||typeof o==="function")?i(o):o);let p=new On(o,this.$.resolvedConfig);return this.traverseApply(o,p),p.finalize(n)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,Xi(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=w2(this.metaJson);cacheGetter(i,o){return Object.defineProperty(this,i,{value:o}),o}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=Dc(this.kind);precompilation;assert=(i,o)=>this(i,o,(n)=>n.throw());traverse(i,o){return this(i,o,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo(i){if(!this.includesTransform)return this;let o={};for(let[n,p]of this.innerEntries){let c=this.impl.keys[n];if(c.reduceIo)c.reduceIo(i,o,p);else if(c.child){let x=p;o[n]=Oi(x)?x.map((T)=>T[i]):x[i]}else o[n]=p}return this.$.node(this.kind,o)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(i){let o=Ii(i)?i:this.$.parseDefinition(i);return this.innerHash===o.innerHash}ifEquals(i){return this.equals(i)?this:void 0}hasKind(i){return this.kind===i}assertHasKind(i){if(this.kind!==i)cp(`${this.kind} node was not of asserted kind ${i}`);return this}hasKindIn(...i){return i.includes(this.kind)}assertHasKindIn(...i){if(!op(i,this.kind))cp(`${this.kind} node was not one of asserted kinds ${i}`);return this}isBasis(){return op(aA,this.kind)}isConstraint(){return op(Wm,this.kind)}isStructural(){return op(Lc,this.kind)}isRefinement(){return op(g1,this.kind)}isRoot(){return op(Cc,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit(i){return this.hasKind("unit")&&this.allows(i)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select(i){let o=ex.normalize(i);return this._select(o)}_select(i){let o=ex.applyBoundary[i.boundary??"references"](this);if(i.kind)o=o.filter((n)=>n.kind===i.kind);if(i.where)o=o.filter(i.where);return ex.applyMethod[i.method??"filter"](o,this,i)}transform(i,o){return this._transform(i,this._createTransformContext(o))}_createTransformContext(i){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:i?.prereduced??!1},undeclaredKeyHandling:void 0,...i}}_transform(i,o){let n=o.bindScope??this.$;if(o.seen[this.id])return this.$.lazilyResolve(o.seen[this.id]);if(o.shouldTransform?.(this,o)===!1)return this;let p;if(o.seen[this.id]=()=>p,this.hasKind("structure")&&this.undeclared!==o.undeclaredKeyHandling)o={...o,undeclaredKeyHandling:this.undeclared};let c=pi(this.inner,(F,$)=>{if(!this.impl.keys[F].child)return[F,$];let J=$;if(!Oi(J)){let X=J._transform(i,o);return X?[F,X]:[]}if(J.length===0)return[F,$];let A=J.flatMap((X)=>{return X._transform(i,o)??[]});return A.length?[F,A]:[]});delete o.seen[this.id];let x=Object.assign(c,{meta:this.meta}),T=o.selected&&!o.selected.includes(this)?x:i(this.kind,x,o);if(T===null)return null;if(Ii(T))return p=T;let m=Object.keys(T);if((m.length===0||m.length===1&&m[0]==="meta")&&!qn(this.inner))return null;if((this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in T))return o.undeclaredKeyHandling?{...T,value:V.intrinsic.unknown}:null;if(this.kind==="morph")T.in??=V.intrinsic.unknown;return p=n.node(this.kind,T,o.parseOptions)}configureReferences(i,o="references"){let n=ex.normalize(o),p=typeof i==="string"?(m,f)=>({...f,meta:{...f.meta,description:i}}):typeof i==="function"?(m,f)=>({...f,meta:i(f.meta)}):(m,f)=>({...f,meta:{...f.meta,...i}});if(n.boundary==="self")return this.$.node(this.kind,p(this.kind,{...this.inner,meta:this.meta}));let c=this._select(n),x=c&&Kp(c),T=n.boundary==="child"?(m,f)=>f.root.children.includes(m):n.boundary==="shallow"?(m)=>m.kind!=="structure":()=>!0;return this.$.finalize(this.transform(p,{shouldTransform:T,selected:x}))}}var ex={applyBoundary:{self:(i)=>[i],child:(i)=>[...i.children],shallow:(i)=>[...i.shallowReferences],references:(i)=>[...i.references]},applyMethod:{filter:(i)=>i,assertFilter:(i,o,n)=>{if(i.length===0)cp(kA(o,n));return i},find:(i)=>i[0],assertFind:(i,o,n)=>{if(i.length===0)cp(kA(o,n));return i[0]}},normalize:(i)=>typeof i==="function"?{boundary:"references",method:"filter",where:i}:typeof i==="string"?di(i,ex.applyBoundary)?{method:"filter",boundary:i}:{boundary:"references",method:"filter",kind:i}:{boundary:"references",method:"filter",...i}},kA=(i,o)=>`${i} had no references matching ${oi(o)}.`,A2=(i)=>Tp(i,{stringifyNonKey:(o)=>o.expression}),v2=/"(\$ark\.[^"]+)"/g,w2=(i)=>JSON.stringify(i).replaceAll(v2,"$1"),_n=(i,o)=>({path:i,node:o,propString:A2(i)}),hA=(i,o)=>i.propString===o.propString&&i.node.equals(o.node),t1=(i,o)=>ln(i,o,{isEqual:hA}),X2=(i,o)=>ln(i,o,{isEqual:(n,p)=>n.equals(p)});class L extends Array{static init(i,o,n,p){return new L({kind:i,l:o,r:n,path:p?.path??[],optional:p?.optional??!1})}add(i,o,n,p){return this.push({kind:i,l:o,r:n,path:p?.path??[],optional:p?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:i,l:o,r:n}=this[0],p=Tp(i);return r1(`Intersection${p&&` at ${p}`} of ${gA(o,n)}`)}return`The following intersections result in unsatisfiable types:
61
+ \u2022 ${this.map(({path:i,l:o,r:n})=>`${i}: ${gA(o,n)}`).join(`
62
+ \u2022 `)}`}throw(){return H(this.describeReasons())}invert(){let i=this.map((o)=>({...o,l:o.r,r:o.l}));if(!(i instanceof L))return new L(...i);return i}withPrefixKey(i,o){return this.map((n)=>({...n,path:[i,...n.path],optional:n.optional||o==="optional"}))}toNeverIfDisjoint(){return V.intrinsic.never}}var gA=(i,o)=>`${d1(i)} and ${d1(o)}`,d1=(i)=>Ii(i)?i.expression:Oi(i)?i.map(d1).join(" | ")||"never":String(i),r1=(i)=>`${i} results in an unsatisfiable type`;var Ic={},so=(i,o,n)=>Bi(i,o,{$:n,invert:!1,pipe:!1}),oT=(i,o,n)=>Bi(i,o,{$:n,invert:!1,pipe:!0}),Bi=(i,o,n)=>{let p=n.pipe?"|>":"&",c=`${i.hash}${p}${o.hash}`;if(Ic[c]!==void 0)return Ic[c];if(!n.pipe){let m=`${o.hash}${p}${i.hash}`;if(Ic[m]!==void 0){let f=Ic[m],F=f instanceof L?f.invert():f;return Ic[c]=F,F}}let x=!n.pipe||!i.includesTransform&&!o.includesTransform;if(x&&i.equals(o))return i;let T=x?e1(i,o,n):i.hasKindIn(...Cc)?W2(i,o,n):e1(i,o,n);if(Ii(T)){if(i.equals(T))T=i;else if(o.equals(T))T=o}return Ic[c]=T,T},e1=(i,o,n)=>{let p=i.precedence<o.precedence?i.kind:o.kind,c=i.impl.intersections[o.kind]??o.impl.intersections[i.kind];if(c===void 0)return null;else if(p===i.kind)return c(i,o,n);else{let x=c(o,i,{...n,invert:!n.invert});if(x instanceof L)x=x.invert();return x}},W2=(i,o,n)=>i.includesTransform||o.includesTransform?n.invert?sA(o,i,n):sA(i,o,n):e1(i,o,n),sA=(i,o,n)=>i.distribute((p)=>R2(p,o,n),(p)=>{let c=p.filter(Ii);if(c.length===0)return L.init("union",i.branches,o.branches);if(c.length<i.branches.length||!i.branches.every((m,f)=>m.in.equals(c[f].in)))return n.$.parseSchema(c);let x;if(c.length===1){let m=c[0];if(!x)return m;return n.$.node("morph",{...m.inner,in:m.in.configure(x,"self")})}let T={branches:c};if(x)T.meta=x;return n.$.parseSchema(T)}),R2=(i,o,n)=>{if(i.hasKind("morph")){let c=[...i.morphs];if(i.lastMorphIfNode){let x=Bi(i.lastMorphIfNode,o,n);if(x instanceof L)return x;c[c.length-1]=x}else c.push(o);return n.$.node("morph",{morphs:c,in:i.inner.in})}if(o.hasKind("morph")){let c=Bi(i,o.in,n);if(c instanceof L)return c;return n.$.node("morph",{morphs:[o],in:c})}return n.$.node("morph",{morphs:[o],in:i})};class vn extends iT{constructor(i,o){super(i,o);Object.defineProperty(this,No,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(i){return so(this,i,this.$)}}class fp extends vn{traverseApply=(i,o)=>{if(!this.traverseAllows(i,o))o.errorFromNodeContext(this.errorContext)};compile(i){if(i.traversalKind==="Allows")i.return(this.compiledCondition);else i.if(this.compiledNegation,()=>i.line(`${i.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return Zp(this.errorContext)}}var So=(i)=>(o,n)=>{if(Oi(o)){if(o.length===0)return;let c=o.map((x)=>n.$.node(i,x));if(i==="predicate")return c;return c.sort((x,T)=>x.hash<T.hash?-1:1)}let p=n.$.node(i,o);return p.hasOpenIntersection()?[p]:p},Bc=(i)=>{let o=i.r.shift();if(!o){let p=i.l.length===0&&i.kind==="structure"?V.intrinsic.unknown.internal:i.ctx.$.node(i.kind,Object.assign(i.baseInner,Y2(i.l)),{prereduced:!0});for(let c of i.roots){if(p instanceof L)return p;p=Bi(c,p,i.ctx)}return p}let n=!1;for(let p=0;p<i.l.length;p++){let c=Bi(i.l[p],o,i.ctx);if(c===null)continue;if(c instanceof L)return c;if(!n){if(c.isRoot())return i.roots.push(c),i.l.splice(p),Bc(i);i.l[p]=c,n=!0}else if(!i.l.includes(c))return Xi(`Unexpectedly encountered multiple distinct intersection results for refinement ${c}`)}if(!n)i.l.push(o);if(i.kind==="intersection")o.impliedSiblings?.forEach((p)=>ln(i.r,p));return Bc(i)},Nc=(i)=>{return Object.entries(i).flatMap(([n,p])=>(n in Rm)?p:[]).sort((n,p)=>n.precedence<p.precedence?-1:n.precedence>p.precedence?1:n.kind==="predicate"&&p.kind==="predicate"?0:n.hash<p.hash?-1:1)},Y2=(i)=>{let o={};for(let n of i)if(n.hasOpenIntersection())o[n.kind]=Ai(o[n.kind],n);else{if(o[n.kind])return Xi(`Unexpected intersection of closed refinements of kind ${n.kind}`);o[n.kind]=n}return o},tA=(...i)=>H(dA(...i)),dA=(i,o,n)=>{let p=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(o).defaultShortDescription;return`${VA(i)} operand must be ${o.description} (was ${p})`};var rA=(i,o,n)=>new zp(i,o,n,n,null);class Gm extends En{}class zp extends En{[No]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(i,o,n,p,c){super((...x)=>{let T=pi(this.names,(m,f)=>{let F=this.arg$.parse(x[m]);if(!F.extends(this.constraints[m]))H(G2(f,this.constraints[m].expression,F.expression));return[f,F]});if(this.defIsLazy()){let m=this.bodyDef(T);return this.$.parse(m)}return this.$.parse(o,{args:T})});this.paramDefs=i,this.bodyDef=o,this.$=n,this.arg$=p,this.hkt=c,this.description=c?new c().description??`a generic type for ${c.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof Gm}cacheGetter(i,o){return Object.defineProperty(this,i,{value:o}),o}get json(){return this.cacheGetter("json",{params:this.params.map((i)=>i[1].isUnknown()?i[0]:[i[0],i[1].json]),body:NA(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map((i)=>typeof i==="string"?[i,V.intrinsic.unknown]:[i[0],this.$.parse(i[1])]))}get names(){return this.cacheGetter("names",this.params.map((i)=>i[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map((i)=>i[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}var G2=(i,o,n)=>`${i} must be assignable to ${o} (was ${n})`;var eA={morph:"it represents a transformation, while JSON Schema only allows validation. Consider creating a Schema from one of its endpoints using `.in` or `.out`.",cyclic:"cyclic types are not yet convertible to JSON Schema. If this feature is important to you, please add your feedback at https://github.com/arktypeio/arktype/issues/1087"},iv=(i,o)=>{let n=`${i} is not convertible to JSON Schema`;if(o){let p=di(o,eA)?eA[o]:o;n+=` because ${p}`}return n},Wi={writeUnjsonifiableMessage:iv,UnjsonifiableError:class i extends Error{},throwUnjsonifiableError:(...i)=>cp(iv(...i)),throwInternalOperandError:(i,o)=>Xi(`Unexpected JSON Schema input for ${i}: ${oi(o)}`)};var K2=ni({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:(i)=>typeof i==="function"?{predicate:i}:i,defaults:{description:(i)=>`valid according to ${i.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class ov extends vn{serializedPredicate=ki(this.predicate);compiledCondition=`${this.serializedPredicate}(data, ctx)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=null;expression=this.serializedPredicate;traverseAllows=this.predicate;errorContext={code:"predicate",description:this.description,meta:this.meta};compiledErrorContext=Zp(this.errorContext);traverseApply=(i,o)=>{if(!this.predicate(i,o.external)&&!o.hasError())o.errorFromNodeContext(this.errorContext)};compile(i){if(i.traversalKind==="Allows"){i.return(this.compiledCondition);return}i.if(`${this.compiledNegation} && !ctx.hasError()`,()=>i.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema(){return Wi.throwUnjsonifiableError(`Predicate ${this.expression}`)}}var of={implementation:K2,Node:ov};var H2=ni({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:(i)=>Number.isInteger(i)?i:H(U2(i))}},normalize:(i)=>typeof i==="number"?{rule:i}:i,hasAssociatedError:!0,defaults:{description:(i)=>i.rule===1?"an integer":i.rule===2?"even":`a multiple of ${i.rule}`},intersections:{divisor:(i,o,n)=>n.$.node("divisor",{rule:Math.abs(i.rule*o.rule/Z2(i.rule,o.rule))})},obviatesBasisDescription:!0});class nv extends fp{traverseAllows=(i)=>i%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=V.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(i){if(i.type="integer",this.rule===1)return i;return i.multipleOf=this.rule,i}}var nf={implementation:H2,Node:nv};var U2=(i)=>`divisor must be an integer (was ${i})`,Z2=(i,o)=>{let n,p=i,c=o;while(c!==0)n=c,c=p%c,p=n;return p};class pn extends fp{boundOperandKind=Q2[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=V2(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${M2[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?S2(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator["0"]==="<"?"upper":"lower";isStricterThan(i){return(this.limitKind==="upper"?this.numericLimit<i.numericLimit:this.numericLimit>i.numericLimit)||this.numericLimit===i.numericLimit&&this.exclusive===!0&&!i.exclusive}overlapsRange(i){if(this.isStricterThan(i))return!1;if(this.numericLimit===i.numericLimit&&(this.exclusive||i.exclusive))return!1;return!0}overlapIsUnit(i){return this.numericLimit===i.numericLimit&&!this.exclusive&&!i.exclusive}}var M2={"<":">=","<=":">",">":"<=",">=":"<"},z2={min:"max",minLength:"maxLength",after:"before"},Km={parse:(i)=>i||void 0},Hm=(i)=>(o)=>{if(typeof o==="number")return{rule:o};let{exclusive:n,...p}=o;return n?{...p,rule:i==="minLength"?p.rule+1:p.rule-1}:p},Um=(i)=>(o)=>{if(typeof o==="number"||typeof o==="string"||o instanceof Date)return{rule:o};let{exclusive:n,...p}=o;if(!n)return p;let c=typeof p.rule==="number"?p.rule:typeof p.rule==="string"?new Date(p.rule).valueOf():p.rule.valueOf();return n?{...p,rule:i==="after"?c+1:c-1}:p},Zm=(i)=>typeof i==="string"||typeof i==="number"?new Date(i):i,u2=(i,o)=>`${i} bound must be a positive integer (was ${o})`,bc=(i)=>(o)=>{if(!Number.isInteger(o)||o<0)H(u2(i,o));return o},Q2={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},V2=(i,o)=>`${di(i,z2)?">":"<"}${o?"":"="}`,S2=(i)=>typeof i==="string"?i:new Date(i).toLocaleString(),pv=(i)=>`Bounded expression ${i} must be exactly one of number, string, Array, or Date`;var E2=ni({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Zm,serialize:(i)=>i.toISOString()}},normalize:Um("after"),defaults:{description:(i)=>`${i.collapsibleLimitString} or later`,actual:sp},intersections:{after:(i,o)=>i.isStricterThan(o)?i:o}});class cv extends pn{impliedBasis=V.intrinsic.Date.internal;collapsibleLimitString=sp(this.rule);traverseAllows=(i)=>i>=this.rule;reduceJsonSchema(){return Wi.throwUnjsonifiableError("Date instance")}}var pf={implementation:E2,Node:cv};var O2=ni({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Zm,serialize:(i)=>i.toISOString()}},normalize:Um("before"),defaults:{description:(i)=>`${i.collapsibleLimitString} or earlier`,actual:sp},intersections:{before:(i,o)=>i.isStricterThan(o)?i:o,after:(i,o,n)=>i.overlapsRange(o)?i.overlapIsUnit(o)?n.$.node("unit",{unit:i.rule}):null:L.init("range",i,o)}});class xv extends pn{collapsibleLimitString=sp(this.rule);traverseAllows=(i)=>i<=this.rule;impliedBasis=V.intrinsic.Date.internal;reduceJsonSchema(){return Wi.throwUnjsonifiableError("Date instance")}}var cf={implementation:O2,Node:xv};var _2=ni({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:bc("exactLength")}},normalize:(i)=>typeof i==="number"?{rule:i}:i,hasAssociatedError:!0,defaults:{description:(i)=>`exactly length ${i.rule}`,actual:(i)=>`${i.length}`},intersections:{exactLength:(i,o,n)=>L.init("unit",n.$.node("unit",{unit:i.rule}),n.$.node("unit",{unit:o.rule}),{path:["length"]}),minLength:(i,o)=>i.rule>=o.rule?i:L.init("range",i,o),maxLength:(i,o)=>i.rule<=o.rule?i:L.init("range",i,o)}});class Tv extends fp{traverseAllows=(i)=>i.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=V.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema(i){switch(i.type){case"string":return i.minLength=this.rule,i.maxLength=this.rule,i;case"array":return i.minItems=this.rule,i.maxItems=this.rule,i;default:return Wi.throwInternalOperandError("exactLength",i)}}}var xf={implementation:_2,Node:Tv};var L2=ni({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:Km},normalize:(i)=>typeof i==="number"?{rule:i}:i,defaults:{description:(i)=>{if(i.rule===0)return i.exclusive?"negative":"non-positive";return`${i.exclusive?"less than":"at most"} ${i.rule}`}},intersections:{max:(i,o)=>i.isStricterThan(o)?i:o,min:(i,o,n)=>i.overlapsRange(o)?i.overlapIsUnit(o)?n.$.node("unit",{unit:i.rule}):null:L.init("range",i,o)},obviatesBasisDescription:!0});class mv extends pn{impliedBasis=V.intrinsic.number.internal;traverseAllows=this.exclusive?(i)=>i<this.rule:(i)=>i<=this.rule;reduceJsonSchema(i){if(this.exclusive)i.exclusiveMaximum=this.rule;else i.maximum=this.rule;return i}}var Tf={implementation:L2,Node:mv};var C2=ni({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:bc("maxLength")}},reduce:(i,o)=>i.rule===0?o.node("exactLength",i):void 0,normalize:Hm("maxLength"),defaults:{description:(i)=>`at most length ${i.rule}`,actual:(i)=>`${i.length}`},intersections:{maxLength:(i,o)=>i.isStricterThan(o)?i:o,minLength:(i,o,n)=>i.overlapsRange(o)?i.overlapIsUnit(o)?n.$.node("exactLength",{rule:i.rule}):null:L.init("range",i,o)}});class fv extends pn{impliedBasis=V.intrinsic.lengthBoundable.internal;traverseAllows=(i)=>i.length<=this.rule;reduceJsonSchema(i){switch(i.type){case"string":return i.maxLength=this.rule,i;case"array":return i.maxItems=this.rule,i;default:return Wi.throwInternalOperandError("maxLength",i)}}}var mf={implementation:C2,Node:fv};var y2=ni({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:Km},normalize:(i)=>typeof i==="number"?{rule:i}:i,defaults:{description:(i)=>{if(i.rule===0)return i.exclusive?"positive":"non-negative";return`${i.exclusive?"more than":"at least"} ${i.rule}`}},intersections:{min:(i,o)=>i.isStricterThan(o)?i:o},obviatesBasisDescription:!0});class Fv extends pn{impliedBasis=V.intrinsic.number.internal;traverseAllows=this.exclusive?(i)=>i>this.rule:(i)=>i>=this.rule;reduceJsonSchema(i){if(this.exclusive)i.exclusiveMinimum=this.rule;else i.minimum=this.rule;return i}}var ff={implementation:y2,Node:Fv};var D2=ni({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:bc("minLength")}},reduce:(i)=>i.rule===0?V.intrinsic.unknown:void 0,normalize:Hm("minLength"),defaults:{description:(i)=>i.rule===1?"non-empty":`at least length ${i.rule}`,actual:(i)=>i.length===0?"":`${i.length}`},intersections:{minLength:(i,o)=>i.isStricterThan(o)?i:o}});class $v extends pn{impliedBasis=V.intrinsic.lengthBoundable.internal;traverseAllows=(i)=>i.length>=this.rule;reduceJsonSchema(i){switch(i.type){case"string":return i.minLength=this.rule,i;case"array":return i.minItems=this.rule,i;default:return Wi.throwInternalOperandError("minLength",i)}}}var Ff={implementation:D2,Node:$v};var Jv={min:ff.implementation,max:Tf.implementation,minLength:Ff.implementation,maxLength:mf.implementation,exactLength:xf.implementation,after:pf.implementation,before:cf.implementation},Av={min:ff.Node,max:Tf.Node,minLength:Ff.Node,maxLength:mf.Node,exactLength:xf.Node,after:pf.Node,before:cf.Node};var I2=ni({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:(i)=>typeof i==="string"?{rule:i}:i instanceof RegExp?i.flags?{rule:i.source,flags:i.flags}:{rule:i.source}:i,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:(i)=>`matched by ${i.rule}`},intersections:{pattern:()=>null}});class vv extends fp{instance=new RegExp(this.rule,this.flags);expression=`${this.instance}`;traverseAllows=this.instance.test.bind(this.instance);compiledCondition=`${this.expression}.test(data)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=V.intrinsic.string.internal;reduceJsonSchema(i){if(i.pattern)return Wi.throwUnjsonifiableError(`Intersection of patterns ${i.pattern} & ${this.rule}`);return i.pattern=this.rule,i}}var $f={implementation:I2,Node:vv};var nT=(i,o)=>{let n=B2(i);if(o&&!o.includes(n))return H(`Root of kind ${n} should be one of ${o}`);return n},B2=(i)=>{if(a(i,"root"))return i.kind;if(typeof i==="string")return i[0]==="$"?"alias":(i in ko)?"domain":"proto";if(typeof i==="function")return"proto";if(typeof i!=="object"||i===null)return H(wv(i));if("morphs"in i)return"morph";if("branches"in i||Oi(i))return"union";if("unit"in i)return"unit";if("reference"in i)return"alias";let o=Object.keys(i);if(o.length===0||o.some((n)=>(n in Rm)))return"intersection";if("proto"in i)return"proto";if("domain"in i)return"domain";return H(wv(i))},wv=(i)=>`${oi(i)} is not a valid type schema`,Xv={},N2=(i)=>Oi(i)?i.map((o)=>o.collapsibleJson):i.collapsibleJson,bo={};V.nodesByRegisteredId=bo;var Jf=(i)=>{return Xv[i]??=0,`${i}${++Xv[i]}`},Af=(i)=>{let o=jc[i.kind],n=o.applyConfig?.(i.def,i.$.resolvedConfig)??i.def,p={},{meta:c,...x}=n,T=c===void 0?{}:typeof c==="string"?{description:c}:c,m=y1(x).sort(([F],[$])=>yc(F)?yc($)?Dc(F)-Dc($):1:yc($)?-1:F<$?-1:1).filter(([F,$])=>{if(F.startsWith("meta.")){let J=F.slice(5);return T[J]=$,!1}return!0});for(let F of m){let $=F[0],J=o.keys[$];if(!J)return H(`Key ${$} is not valid on ${i.kind} schema`);let A=J.parse?J.parse(F[1],i):F[1];if(A!==nn&&(A!==void 0||J.preserveUndefined))p[$]=A}if(o.reduce&&!i.prereduced){let F=o.reduce(p,i.$);if(F){if(F instanceof L)return F.throw();return b2(F,T)}}return vf({id:i.id,kind:i.kind,inner:p,meta:T,$:i.$})},vf=({id:i,kind:o,inner:n,meta:p,$:c,ignoreCache:x})=>{let T=jc[o],m=y1(n),f=[],F={};if(m.forEach(([U,z])=>{let b=T.keys[U],M=b.serialize??(b.child?N2:An);if(F[U]=M(z),b.child===!0){let u=z;if(Oi(u))f.push(...u);else f.push(u)}else if(typeof b.child==="function")f.push(...b.child(z))}),T.finalizeInnerJson)F=T.finalizeInnerJson(F);let $={...F},J={};if(!qn(p))J=pi(p,(U,z)=>[U,U==="examples"?z:An(z)]),$.meta=Mm(J,"description",!0);F=Mm(F,T.collapsibleKey,!1);let A=JSON.stringify({kind:o,...F});$=Mm($,T.collapsibleKey,!1);let X=Mm($,T.collapsibleKey,!0),Y=JSON.stringify({kind:o,...$});if(c.nodesByHash[Y]&&!x)return c.nodesByHash[Y];let R={id:i,kind:o,impl:T,inner:n,innerEntries:m,innerJson:F,innerHash:A,meta:p,metaJson:J,json:$,hash:Y,collapsibleJson:X,children:f};if(o!=="intersection"){for(let U in n)if(U!=="in"&&U!=="out")R[U]=n[U]}let K=new Rv[o](R,c);return c.nodesByHash[Y]=K},Wv=(i,o)=>{if(i.id===o)return i;if(Ii(bo[o]))Xi(`Unexpected attempt to overwrite node id ${o}`);return vf({id:o,kind:i.kind,inner:i.inner,meta:i.meta,$:i.$,ignoreCache:!0})},b2=(i,o,n)=>{if(n&&Ii(bo[n]))Xi(`Unexpected attempt to overwrite node id ${n}`);return vf({id:n??Jf(o.alias??i.kind),kind:i.kind,inner:i.inner,meta:o,$:i.$})},Mm=(i,o,n)=>{let p=Object.keys(i);if(p.length===1&&p[0]===o){let c=i[o];if(n)return c;if(qo(c,"object")&&(Object.keys(c).length===1||Array.isArray(c)))return c}return i};var pT=(i,o,n)=>{if(i.key!==o.key)return null;let p=i.key,c=Bi(i.value,o.value,n),x=i.required||o.required?"required":"optional";if(c instanceof L)if(x==="optional")c=V.intrinsic.never.internal;else return c.withPrefixKey(i.key,i.required&&o.required?"required":"optional");if(x==="required")return n.$.node("required",{key:p,value:c});let T=i.hasDefault()?o.hasDefault()?i.default===o.default?i.default:H(wf(i.default,o.default)):i.default:o.hasDefault()?o.default:nn;return n.$.node("optional",{key:p,value:c,default:T})};class cT extends vn{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=V.intrinsic.object.internal;serializedKey=mp(this.key);compiledKey=typeof this.key==="string"?this.key:this.serializedKey;flatRefs=Ai(this.value.flatRefs.map((i)=>_n([this.key,...i.path],i.node)),_n([this.key],this.value));_transform(i,o){o.path.push(this.key);let n=super._transform(i,o);return o.path.pop(),n}hasDefault(){return"default"in this.inner}traverseAllows=(i,o)=>{if(this.key in i)return go(this.key,()=>this.value.traverseAllows(i[this.key],o),o);return this.optional};traverseApply=(i,o)=>{if(this.key in i)go(this.key,()=>this.value.traverseApply(i[this.key],o),o);else if(this.hasKind("required"))o.errorFromNodeContext(this.errorContext)};compile(i){if(i.if(`${this.serializedKey} in data`,()=>i.traverseKey(this.serializedKey,`data${i.prop(this.key)}`,this.value)),this.hasKind("required"))i.else(()=>{if(i.traversalKind==="Apply")return i.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`);else return i.return(!1)});if(i.traversalKind==="Allows")i.return(!0)}}var wf=(i,o)=>`Invalid intersection of default values ${oi(i)} & ${oi(o)}`;var j2=ni({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(i,o)=>o.$.parseSchema(i)},default:{preserveUndefined:!0}},normalize:(i)=>i,reduce:(i,o)=>{if(o.resolvedConfig.exactOptionalPropertyTypes===!1){if(!i.value.allows(void 0))return o.node("optional",{...i,value:i.value.or(h.undefined)},{prereduced:!0})}},defaults:{description:(i)=>`${i.compiledKey}?: ${i.value.description}`},intersections:{optional:pT}});class Yv extends cT{constructor(...i){super(...i);if("default"in this.inner)TT(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;let{default:i,...o}=this.inner;return this.cacheGetter("outProp",this.$.node("required",o,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${oi(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=a2(this);defaultValueMorphRef=this.defaultValueMorph&&ki(this.defaultValueMorph)}var xT={implementation:j2,Node:Yv},P2={},a2=(i)=>{if(!i.hasDefault())return;let o=`{${i.compiledKey}: ${i.value.id} = ${An(i.default)}}`;return P2[o]??=Xf(i.key,i.value,i.default)},Xf=(i,o,n)=>{if(typeof n==="function")return o.includesTransform?(c,x)=>{return go(i,()=>o(c[i]=n(),x),x),c}:(c)=>{return c[i]=n(),c};let p=o.includesTransform?o.assert(n):n;return qo(p,"object")?(c,x)=>{return go(i,()=>o(c[i]=n,x),x),c}:(c)=>{return c[i]=p,c}},TT=(i,o,n)=>{let p=Hp(o);if(qo(o,"object")&&!p)H(l2(n));let c=i.in(p?o():o);if(c instanceof ho){if(n===null)H(`Default ${c.summary}`);let x=c.transform((T)=>T.transform((m)=>({...m,prefixPath:[n]})));H(`Default for ${x.summary}`)}return o},l2=(i)=>{return`Non-primitive default ${i===null?"":typeof i==="number"?`for value at [${i}] `:`for ${mp(i)} `}must be specified as a function like () => ({my: 'object'})`};class wn extends iT{constructor(i,o){super(i,o);Object.defineProperty(this,No,{value:"root",enumerable:!1})}get internal(){return this}get "~standard"(){return{vendor:"arktype",version:1,validate:(i)=>{let o=this(i);if(o instanceof ho)return o;return{value:o}}}}as(){return this}brand(i){if(i==="")return H(q2);return this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute(i,o){let n=this.branches.map(i);return o?.(n)??n}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(i={}){let o={dialect:"https://json-schema.org/draft/2020-12/schema",...i},n=this.toJsonSchemaRecurse(o);if(typeof o.dialect==="string")n.$schema=o.dialect;return n}toJsonSchemaRecurse(i){let o=this.innerToJsonSchema(i);return Object.assign(o,this.metaJson)}intersect(i){let o=this.$.parseDefinition(i),n=this.rawIntersect(o);if(n instanceof L)return n;return this.$.finalize(n)}rawIntersect(i){return so(this,i,this.$)}toNeverIfDisjoint(){return this}and(i){let o=this.intersect(i);return o instanceof L?o.throw():o}rawAnd(i){let o=this.rawIntersect(i);return o instanceof L?o.throw():o}or(i){let o=this.$.parseDefinition(i);return this.$.finalize(this.rawOr(o))}rawOr(i){let o=[...this.branches,...i.branches];return this.$.node("union",o)}map(i){return this.$.schema(this.applyStructuralOperation("map",[i]))}pick(...i){return this.$.schema(this.applyStructuralOperation("pick",i))}omit(...i){return this.$.schema(this.applyStructuralOperation("omit",i))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;let i=this.applyStructuralOperation("keyof",[]).reduce((o,n)=>o.intersect(n).toNeverIfDisjoint(),V.intrinsic.unknown.internal);if(i.branches.length===0)H(r1(`keyof ${this.expression}`));return this._keyof=this.$.finalize(i)}get props(){if(this.branches.length!==1)return H(k2(this.expression));return[...this.applyStructuralOperation("props",[])[0]]}merge(i){let o=this.$.parseDefinition(i);return this.$.schema(o.distribute((n)=>this.applyStructuralOperation("merge",[Gv(n)??H(Kv("merge",n.expression))])))}applyStructuralOperation(i,o){return this.distribute((n)=>{if(n.equals(V.intrinsic.object)&&i!=="merge")return n;let p=Gv(n);if(!p)H(Kv(i,n.expression));if(i==="keyof")return p.keyof();if(i==="get")return p.get(...o);if(i==="props")return p.props;let c=i==="required"?"require":i==="partial"?"optionalize":i;return this.$.node("intersection",{...n.inner,structure:p[c](...o)})})}get(...i){if(i[0]===void 0)return this;return this.$.schema(this.applyStructuralOperation("get",i))}extract(i){let o=this.$.parseDefinition(i);return this.$.schema(this.branches.filter((n)=>n.extends(o)))}exclude(i){let o=this.$.parseDefinition(i);return this.$.schema(this.branches.filter((n)=>!n.extends(o)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps(i){return!(this.intersect(i)instanceof L)}extends(i){let o=this.intersect(i);return!(o instanceof L)&&this.equals(o)}ifExtends(i){return this.extends(i)?this:void 0}subsumes(i){return this.$.parseDefinition(i).extends(this)}configure(i,o="shallow"){return this.configureReferences(i,o)}describe(i,o="shallow"){return this.configure({description:i},o)}optional(){return[this,"?"]}default(i){return TT(this,i,null),[this,"=",i]}from(i){return this.assert(i)}_pipe(...i){let o=i.reduce((n,p)=>n.rawPipeOnce(p),this);return this.$.finalize(o)}tryPipe(...i){let o=i.reduce((n,p)=>n.rawPipeOnce(a(p,"root")?p:(c,x)=>{try{return p(c,x)}catch(T){return x.error({code:"predicate",predicate:p,actual:`aborted due to error:
63
+ ${T}
64
+ `})}}),this);return this.$.finalize(o)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to(i){return this.$.finalize(this.toNode(this.$.parseDefinition(i)))}toNode(i){let o=oT(this,i,this.$);if(o instanceof L)return o.throw();return o}rawPipeOnce(i){if(a(i,"root"))return this.toNode(i);return this.distribute((o)=>o.hasKind("morph")?this.$.node("morph",{in:o.inner.in,morphs:[...o.morphs,i]}):this.$.node("morph",{in:o,morphs:[i]}),this.$.parseSchema)}narrow(i){return this.constrainOut("predicate",i)}constrain(i,o){return this._constrain("root",i,o)}constrainIn(i,o){return this._constrain("in",i,o)}constrainOut(i,o){return this._constrain("out",i,o)}_constrain(i,o,n){let p=this.$.node(o,n);if(p.isRoot())return p.isUnknown()?this:Xi(`Unexpected constraint node ${p}`);let c=i==="root"?this:this[i];if(c.hasKind("morph")||p.impliedBasis&&!c.extends(p.impliedBasis))return tA(o,p.impliedBasis,this);let x=this.$.node("intersection",{[p.kind]:p}),T=i==="out"?oT(this,x,this.$):so(this,x,this.$);if(T instanceof L)T.throw();return this.$.finalize(T)}onUndeclaredKey(i){let o=typeof i==="string"?i:i.rule,n=typeof i==="string"?!1:i.deep;return this.$.finalize(this.transform((p,c)=>p==="structure"?o==="ignore"?RA(c,{undeclared:1}):{...c,undeclared:o}:c,n?void 0:{shouldTransform:(p)=>!op(Lc,p.kind)}))}hasEqualMorphs(i){if(!this.includesTransform&&!i.includesTransform)return!0;if(!pp(this.shallowMorphs,i.shallowMorphs))return!1;if(!pp(this.flatMorphs,i.flatMorphs,{isEqual:(o,n)=>o.propString===n.propString&&(o.node.hasKind("morph")&&n.node.hasKind("morph")?o.node.hasEqualMorphs(n.node):o.node.hasKind("intersection")&&n.node.hasKind("intersection")?o.node.structure?.structuralMorphRef===n.node.structure?.structuralMorphRef:!1)}))return!1;return!0}onDeepUndeclaredKey(i){return this.onUndeclaredKey({rule:i,deep:!0})}filter(i){return this.constrainIn("predicate",i)}divisibleBy(i){return this.constrain("divisor",i)}matching(i){return this.constrain("pattern",i)}atLeast(i){return this.constrain("min",i)}atMost(i){return this.constrain("max",i)}moreThan(i){return this.constrain("min",Pc(i))}lessThan(i){return this.constrain("max",Pc(i))}atLeastLength(i){return this.constrain("minLength",i)}atMostLength(i){return this.constrain("maxLength",i)}moreThanLength(i){return this.constrain("minLength",Pc(i))}lessThanLength(i){return this.constrain("maxLength",Pc(i))}exactlyLength(i){return this.constrain("exactLength",i)}atOrAfter(i){return this.constrain("after",i)}atOrBefore(i){return this.constrain("before",i)}laterThan(i){return this.constrain("after",Pc(i))}earlierThan(i){return this.constrain("before",Pc(i))}}var q2="Expected a non-empty brand name after #",Pc=(i)=>typeof i==="object"&&!(i instanceof Date)?{...i,exclusive:!0}:{rule:i,exclusive:!0},mT=(i,o)=>a(o,"root")?a(i,"root")?i.extends(o):o.allows(i):a(i,"root")?i.hasUnit(o):o===i,Gv=(i)=>{if(i.hasKind("morph"))return null;if(i.hasKind("intersection"))return i.inner.structure??(i.basis?.domain==="object"?i.$.bindReference(V.intrinsic.emptyStructure):null);if(i.isBasis()&&i.domain==="object")return i.$.bindReference(V.intrinsic.emptyStructure);return null},k2=(i)=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
65
+ ${i}`,Kv=(i,o)=>`${i} operand must be an object (was ${o})`;var kn=(i,o)=>pi(Ym(i),(n,p)=>[p,o]);var h2=(i)=>typeof i==="string"?{reference:i}:i,Hv=(i)=>i instanceof L?V.intrinsic.never.internal:i,g2=ni({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:(i)=>i.startsWith("$")?i:`$ark.${i}`},resolve:{}},normalize:h2,defaults:{description:(i)=>i.reference},intersections:{alias:(i,o,n)=>n.$.lazilyResolve(()=>Hv(Bi(i.resolution,o.resolution,n)),`${i.reference}${n.pipe?"=>":"&"}${o.reference}`),...kn("alias",(i,o,n)=>{if(o.isUnknown())return i;if(o.isNever())return o;if(o.isBasis()&&!o.overlaps(V.intrinsic.object))return L.init("assignability",V.intrinsic.object,o);return n.$.lazilyResolve(()=>Hv(Bi(i.resolution,o,n)),`${i.reference}${n.pipe?"=>":"&"}${o.id}`)})}});class Uv extends wn{expression=this.reference;structure=void 0;get resolution(){let i=this._resolve();return bo[this.id]=i}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));let i=this.reference,o=bo[i],n=[];while(a(o,"context")){if(n.includes(o.id))return H(s2(o.id,n));n.push(o.id),o=bo[o.id]}if(!a(o,"root"))return Xi(`Unexpected resolution for reference ${this.reference}
66
+ Seen: [${n.join("->")}]
67
+ Resolution: ${oi(o)}`);return o}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;let i=this.reference.slice(1),o=this.$.resolutions[i];if(typeof o==="string")return o;if(a(o,"root"))return o.id;return Xi(`Unexpected resolution for reference ${this.reference}: ${oi(o)}`)}get defaultShortDescription(){return ko.object}innerToJsonSchema(i){return Wi.throwUnjsonifiableError(this.expression,"cyclic")}traverseAllows=(i,o)=>{let n=o.seen[this.reference];if(n?.includes(i))return!0;return o.seen[this.reference]=Ai(n,i),this.resolution.traverseAllows(i,o)};traverseApply=(i,o)=>{let n=o.seen[this.reference];if(n?.includes(i))return;o.seen[this.reference]=Ai(n,i),this.resolution.traverseApply(i,o)};compile(i){let o=this.resolutionId;i.if(`ctx.seen.${o} && ctx.seen.${o}.includes(data)`,()=>i.return(!0)),i.if(`!ctx.seen.${o}`,()=>i.line(`ctx.seen.${o} = []`)),i.line(`ctx.seen.${o}.push(data)`),i.return(i.invoke(o))}}var s2=(i,o)=>`Alias '${i}' has a shallow resolution cycle: ${[...o,i].join("->")}`,fT={implementation:g2,Node:Uv};class tp extends wn{traverseApply=(i,o)=>{if(!this.traverseAllows(i,o))o.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return Zp(this.errorContext)}compile(i){if(i.traversalKind==="Allows")i.return(this.compiledCondition);else i.if(this.compiledNegation,()=>i.line(`${i.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}var t2=ni({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:(i)=>typeof i==="string"?{domain:i}:Oc(i,"numberAllowsNaN")&&i.domain!=="number"?H(zm.writeBadAllowNanMessage(i.domain)):i,applyConfig:(i,o)=>i.numberAllowsNaN===void 0&&i.domain==="number"&&o.numberAllowsNaN?{...i,numberAllowsNaN:!0}:i,defaults:{description:(i)=>ko[i.domain],actual:(i)=>Number.isNaN(i)?"NaN":ko[Fo(i)]},intersections:{domain:(i,o)=>i.domain==="number"&&o.domain==="number"?i.numberAllowsNaN?o:i:L.init("domain",i,o)}});class Zv extends tp{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?(i)=>typeof i==="number"&&!Number.isNaN(i):(i)=>Fo(i)===this.domain;compiledCondition=this.domain==="object"?'((typeof data === "object" && data !== null) || typeof data === "function")':`typeof data === "${this.domain}"${this.requiresNaNCheck?" && !Number.isNaN(data)":""}`;compiledNegation=this.domain==="object"?'((typeof data !== "object" || data === null) && typeof data !== "function")':`typeof data !== "${this.domain}"${this.requiresNaNCheck?" || Number.isNaN(data)":""}`;expression=this.numberAllowsNaN?"number | NaN":this.domain;get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return ko[this.domain]}innerToJsonSchema(i){if(this.domain==="bigint"||this.domain==="symbol")return Wi.throwUnjsonifiableError(this.domain);return{type:this.domain}}}var zm={implementation:t2,Node:Zv,writeBadAllowNanMessage:(i)=>`numberAllowsNaN may only be specified with domain "number" (was ${i})`};var d2=ni({kind:"intersection",hasAssociatedError:!0,normalize:(i)=>{if(Ii(i))return i;let{structure:o,...n}=i,p=!!o,c=o??{},x=pi(n,(T,m)=>{if(di(T,lA)){if(p)H(`Flattened structure key ${T} cannot be specified alongside a root 'structure' key.`);return c[T]=m,[]}return[T,m]});if(a(c,"constraint")||!qn(c))x.structure=c;return x},finalizeInnerJson:({structure:i,...o})=>qo(i,"object")?{...i,...o}:o,keys:{domain:{child:!0,parse:(i,o)=>o.$.node("domain",i)},proto:{child:!0,parse:(i,o)=>o.$.node("proto",i)},structure:{child:!0,parse:(i,o)=>o.$.node("structure",i),serialize:(i)=>{if(!i.sequence?.minLength)return i.collapsibleJson;let{sequence:o,...n}=i.collapsibleJson,{minVariadicLength:p,...c}=o,x=c.variadic&&Object.keys(c).length===1?c.variadic:c;return{...n,sequence:x}}},divisor:{child:!0,parse:So("divisor")},max:{child:!0,parse:So("max")},min:{child:!0,parse:So("min")},maxLength:{child:!0,parse:So("maxLength")},minLength:{child:!0,parse:So("minLength")},exactLength:{child:!0,parse:So("exactLength")},before:{child:!0,parse:So("before")},after:{child:!0,parse:So("after")},pattern:{child:!0,parse:So("pattern")},predicate:{child:!0,parse:So("predicate")}},reduce:(i,o)=>Mv({},i,{$:o,invert:!1,pipe:!1}),defaults:{description:(i)=>{if(i.children.length===0)return"unknown";if(i.structure)return i.structure.description;let o=[];if(i.basis&&!i.refinements.some((n)=>n.impl.obviatesBasisDescription))o.push(i.basis.description);if(i.refinements.length){let n=i.refinements.toSorted((p,c)=>p.kind==="min"&&c.kind==="max"?-1:0).map((p)=>p.description);o.push(...n)}if(i.inner.predicate)o.push(...i.inner.predicate.map((n)=>n.description));return o.join(" and ")},expected:(i)=>` \u25E6 ${i.errors.map((o)=>o.expected).join(`
68
+ \u25E6 `)}`,problem:(i)=>`(${i.actual}) must be...
69
+ ${i.expected}`},intersections:{intersection:(i,o,n)=>Mv(i.inner,o.inner,n),...kn("intersection",(i,o,n)=>{if(i.children.length===0)return o;let{domain:p,proto:c,...x}=i.inner,T=c??p,m=T?Bi(T,o,n):o;return m instanceof L?m:i?.basis?.equals(m)?i:i.$.node("intersection",{...x,[m.kind]:m},{prereduced:!0})})}});class zv extends wn{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter((i)=>i.isRefinement());structure=this.inner.structure;expression=r2(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??"present"}innerToJsonSchema(i){return this.children.reduce((o,n)=>n.isBasis()?n.toJsonSchemaRecurse(i):n.reduceJsonSchema(o,i),{})}traverseAllows=(i,o)=>this.children.every((n)=>n.traverseAllows(i,o));traverseApply=(i,o)=>{let n=o.currentErrorCount;if(this.basis){if(this.basis.traverseApply(i,o),o.currentErrorCount>n)return}if(this.refinements.length){for(let p=0;p<this.refinements.length-1;p++)if(this.refinements[p].traverseApply(i,o),o.failFast&&o.currentErrorCount>n)return;if(this.refinements.at(-1).traverseApply(i,o),o.currentErrorCount>n)return}if(this.structure){if(this.structure.traverseApply(i,o),o.currentErrorCount>n)return}if(this.inner.predicate){for(let p=0;p<this.inner.predicate.length-1;p++)if(this.inner.predicate[p].traverseApply(i,o),o.failFast&&o.currentErrorCount>n)return;this.inner.predicate.at(-1).traverseApply(i,o)}};compile(i){if(i.traversalKind==="Allows"){this.children.forEach((o)=>i.check(o)),i.return(!0);return}if(i.initializeErrorCount(),this.basis){if(i.check(this.basis),this.children.length>1)i.returnIfFail()}if(this.refinements.length){for(let o=0;o<this.refinements.length-1;o++)i.check(this.refinements[o]),i.returnIfFailFast();if(i.check(this.refinements.at(-1)),this.structure||this.inner.predicate)i.returnIfFail()}if(this.structure){if(i.check(this.structure),this.inner.predicate)i.returnIfFail()}if(this.inner.predicate){for(let o=0;o<this.inner.predicate.length-1;o++)i.check(this.inner.predicate[o]),i.returnIfFail();i.check(this.inner.predicate.at(-1))}}}var Wf={implementation:d2,Node:zv},r2=(i)=>{let o=i.structure?.expression||`${i.basis&&!i.refinements.some((n)=>n.impl.obviatesBasisExpression)?i.basis.nestableExpression+" ":""}${i.refinements.map((n)=>n.expression).join(" & ")}`||"unknown";if(o==="Array == 0")o="[]";return o},Mv=(i,o,n)=>{let p={},c=i.proto??i.domain,x=o.proto??o.domain,T=c?x?Bi(c,x,n):c:x;if(T instanceof L)return T;if(T)p[T.kind]=T;return Bc({kind:"intersection",baseInner:p,l:Nc(i),r:Nc(o),roots:[],ctx:n})};var e2=ni({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(i,o)=>o.$.parseSchema(i)},morphs:{parse:Kp,serialize:(i)=>i.map((o)=>a(o,"root")?o.json:ki(o))},declaredIn:{child:!1,serialize:(i)=>i.json},declaredOut:{child:!1,serialize:(i)=>i.json}},normalize:(i)=>i,defaults:{description:(i)=>`a morph from ${i.in.description} to ${i.out?.description??"unknown"}`},intersections:{morph:(i,o,n)=>{if(!i.hasEqualMorphs(o))return H(iK(i.expression,o.expression));let p=Bi(i.in,o.in,n);if(p instanceof L)return p;let c={morphs:i.morphs};if(i.declaredIn||o.declaredIn){let x=Bi(i.in,o.in,n);if(x instanceof L)return x.throw();else c.declaredIn=x}if(i.declaredOut||o.declaredOut){let x=Bi(i.out,o.out,n);if(x instanceof L)return x.throw();else c.declaredOut=x}return p.distribute((x)=>n.$.node("morph",{...c,in:x}),n.$.parseSchema)},...kn("morph",(i,o,n)=>{let p=i.inner.in?Bi(i.inner.in,o,n):o;return p instanceof L?p:p.equals(i.inner.in)?i:n.$.node("morph",{...i.inner,in:p})})}});class uv extends wn{serializedMorphs=this.morphs.map(ki);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=a(this.lastMorph,"root")?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.out:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get in(){return this.declaredIn??this.inner.in?.in??V.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??V.intrinsic.unknown.internal}declareIn(i){return this.$.node("morph",{...this.inner,declaredIn:i})}declareOut(i){return this.$.node("morph",{...this.inner,declaredOut:i})}expression=`(In: ${this.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`;get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema(i){return Wi.throwUnjsonifiableError(this.expression,"morph")}compile(i){if(i.traversalKind==="Allows"){if(!this.introspectableIn)return;i.return(i.invoke(this.introspectableIn));return}if(this.introspectableIn)i.line(i.invoke(this.introspectableIn));i.line(`ctx.queueMorphs(${this.compiledMorphs})`)}traverseAllows=(i,o)=>!this.introspectableIn||this.introspectableIn.traverseAllows(i,o);traverseApply=(i,o)=>{if(this.introspectableIn)this.introspectableIn.traverseApply(i,o);o.queueMorphs(this.morphs)};hasEqualMorphs(i){return pp(this.morphs,i.morphs,{isEqual:(o,n)=>o===n||a(o,"root")&&a(n,"root")&&o.equals(n)})}}var Rf={implementation:e2,Node:uv},iK=(i,o)=>`The intersection of distinct morphs at a single path is indeterminate:
70
+ Left: ${i}
71
+ Right: ${o}`;var oK=ni({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:(i)=>qx(i)??An(i)},dateAllowsInvalid:{}},normalize:(i)=>{let o=typeof i==="string"?{proto:hp[i]}:typeof i==="function"?Ii(i)?i:{proto:i}:typeof i.proto==="string"?{...i,proto:hp[i.proto]}:i;if(typeof o.proto!=="function")H(FT.writeInvalidSchemaMessage(o.proto));if(Oc(o,"dateAllowsInvalid")&&o.proto!==Date)H(FT.writeBadInvalidDateMessage(o.proto));return o},applyConfig:(i,o)=>{if(i.dateAllowsInvalid===void 0&&i.proto===Date&&o.dateAllowsInvalid)return{...i,dateAllowsInvalid:!0};return i},defaults:{description:(i)=>i.builtinName?HA[i.builtinName]:`an instance of ${i.proto.name}`,actual:(i)=>i instanceof Date&&i.toString()==="Invalid Date"?"an invalid Date":lx(i)},intersections:{proto:(i,o)=>i.proto===Date&&o.proto===Date?i.dateAllowsInvalid?o:i:b1(i.proto,o.proto)?i:b1(o.proto,i.proto)?o:L.init("proto",i,o),domain:(i,o)=>o.domain==="object"?i:L.init("domain",V.intrinsic.object.internal,o)}});class Qv extends tp{builtinName=qx(this.proto);serializedConstructor=this.json.proto;requiresInvalidDateCheck=this.proto===Date&&!this.dateAllowsInvalid;traverseAllows=this.requiresInvalidDateCheck?(i)=>i instanceof Date&&i.toString()!=="Invalid Date":(i)=>i instanceof this.proto;compiledCondition=`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`;compiledNegation=`!(${this.compiledCondition})`;innerToJsonSchema(i){switch(this.builtinName){case"Array":return{type:"array"};default:return Wi.throwUnjsonifiableError(this.description)}}expression=this.dateAllowsInvalid?"Date | InvalidDate":this.proto.name;get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}domain="object";get defaultShortDescription(){return this.description}}var FT={implementation:oK,Node:Qv,writeBadInvalidDateMessage:(i)=>`dateAllowsInvalid may only be specified with constructor Date (was ${i.name})`,writeInvalidSchemaMessage:(i)=>`instanceOf operand must be a function (was ${Fo(i)})`};var nK=ni({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(i,o)=>{let n=[];if(i.forEach((p)=>{(a(p,"root")?p.branches:o.$.parseSchema(p).branches).forEach((x)=>{if(x.hasKind("morph")){let T=n.findIndex((m)=>m.hasKind("morph")&&m.hasEqualMorphs(x));if(T===-1)n.push(x);else{let m=n[T];n[T]=o.$.node("morph",{...m.inner,in:m.in.rawOr(x.in)})}}else n.push(x)})}),!o.def.ordered)n.sort((p,c)=>p.hash<c.hash?-1:1);return n}}},normalize:(i)=>Oi(i)?{branches:i}:i,reduce:(i,o)=>{let n=AK(i);if(n.length===1)return n[0];if(n.length===i.branches.length)return;return o.node("union",{...i,branches:n},{prereduced:!0})},defaults:{description:(i)=>i.distribute((o)=>o.description,ac),expected:(i)=>{let o=vA(i.errors,"propString"),n=Object.entries(o).map(([p,c])=>{let x=[];c.forEach((f)=>ln(x,f.expected));let T=ac(x),m=c.every((f)=>f.actual===c[0].actual)?c[0].actual:oi(c[0].data);return`${p&&`${p} `}must be ${T}${m&&` (was ${m})`}`});return ac(n)},problem:(i)=>i.expected,message:(i)=>i.problem},intersections:{union:(i,o,n)=>{if(i.isNever!==o.isNever)return L.init("presence",i,o);let p;if(i.ordered){if(o.ordered)H(wK(i.expression,o.expression));if(p=Yf(o.branches,i.branches,n),p instanceof L)p.invert()}else p=Yf(i.branches,o.branches,n);if(p instanceof L)return p;return n.$.parseSchema(i.ordered||o.ordered?{branches:p,ordered:!0}:{branches:p})},...kn("union",(i,o,n)=>{let p=Yf(i.branches,[o],n);if(p instanceof L)return p;if(p.length===1)return p[0];return n.$.parseSchema(i.ordered?{branches:p,ordered:!0}:{branches:p})})}});class Ev extends wn{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){let i=[],o=-1;return this.branches.forEach((n)=>{if(n.hasKind("unit")&&n.domain==="boolean"){if(o===-1)o=i.length,i.push(n);else i[o]=V.intrinsic.boolean;return}i.push(n)}),i}unitBranches=this.branches.filter((i)=>i.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?FK(this.discriminant):null;expression=this.distribute((i)=>i.nestableExpression,JK);createBranchedOptimisticRootApply(){return(i,o)=>{let n=this.traverseOptimistic(i);if(n!==nn)return n;let p=new On(i,this.$.resolvedConfig);return this.traverseApply(i,p),p.finalize(o)}}get shallowMorphs(){return this.branches.reduce((i,o)=>ln(i,o.shallowMorphs),[])}get defaultShortDescription(){return this.distribute((i)=>i.defaultShortDescription,ac)}innerToJsonSchema(i){if(this.branchGroups.length===1&&this.branchGroups[0].equals(V.intrinsic.boolean))return{type:"boolean"};let o=this.branchGroups.map((n)=>n.toJsonSchemaRecurse(i));if(o.every((n)=>Object.keys(n).length===1&&Oc(n,"const")))return{enum:o.map((n)=>n.const)};return{anyOf:o}}traverseAllows=(i,o)=>this.branches.some((n)=>n.traverseAllows(i,o));traverseApply=(i,o)=>{let n=[];for(let p=0;p<this.branches.length;p++){if(o.pushBranch(),this.branches[p].traverseApply(i,o),!o.hasError()){if(this.branches[p].includesTransform)return o.queuedMorphs.push(...o.popBranch().queuedMorphs);return o.popBranch()}n.push(o.popBranch().error)}o.errorFromNodeContext({code:"union",errors:n,meta:this.meta})};traverseOptimistic=(i)=>{for(let o=0;o<this.branches.length;o++){let n=this.branches[o];if(n.traverseAllows(i)){if(n.contextFreeMorph)return n.contextFreeMorph(i);return i}}return nn};compile(i){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable(i);let o=this.discriminant.optionallyChainedPropString;if(this.discriminant.kind==="domain")o=`typeof ${o} === "object" ? ${o} === null ? "null" : "object" : typeof ${o} === "function" ? "object" : typeof ${o}`;let n=this.discriminant.cases,p=Object.keys(n),{optimistic:c}=i;if(i.optimistic=!1,i.block(`switch(${o})`,()=>{for(let F in n){let $=n[F],J=F==="default"?F:`case ${F}`;i.line(`${J}: return ${$===!0?c?i.data:$:c?`${i.invoke($)} ? ${$.contextFreeMorph?`${ki($.contextFreeMorph)}(${i.data})`:i.data} : "${nn}"`:i.invoke($)}`)}return i}),i.traversalKind==="Allows"){i.return(c?`"${nn}"`:!1);return}let x=ac(this.discriminant.kind==="domain"?p.map((F)=>{let $=F.slice(1,-1);return $==="function"?ko.object:ko[$]}):p),T=this.discriminant.path.map((F)=>typeof F==="symbol"?ki(F):JSON.stringify(F)),m=JSON.stringify(x),f=this.discriminant.kind==="domain"?`${mK}[${o}]`:`${fK}(${o})`;i.line(`ctx.errorFromNodeContext({
72
72
  code: "predicate",
73
- expected: ${D},
74
- actual: ${M},
75
- relativePath: [${E}],
73
+ expected: ${m},
74
+ actual: ${f},
75
+ relativePath: [${T}],
76
76
  meta: ${this.compiledMeta}
77
- })`)}compileIndiscriminable(H){if(H.traversalKind==="Apply")H.const("errors","[]"),this.branches.forEach((A)=>H.line("ctx.pushBranch()").line(H.invoke(A)).if("!ctx.hasError()",()=>H.return(A.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)")),H.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`);else{let{optimistic:A}=H;H.optimistic=!1,this.branches.forEach((L)=>H.if(`${H.invoke(L)}`,()=>H.return(A?L.contextFreeMorph?`${rH(L.contextFreeMorph)}(${H.data})`:H.data:!0))),H.return(A?`"${LL}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){if(this.branches.length<2)return null;if(this.unitBranches.length===this.branches.length){let $=fH(this.unitBranches,(f,E)=>[`${E.in.serializedValue}`,E.hasKind("morph")?E:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:$}}let H=[];for(let $=0;$<this.branches.length-1;$++){let f=this.branches[$];for(let E=$+1;E<this.branches.length;E++){let D=this.branches[E],M=dA(f.in,D.in,f.$);if(!(M instanceof v))continue;for(let o of M){if(!o.kind||o.optional)continue;let u,t;if(o.kind==="domain"){let{l:B,r:U}=o;u=`"${typeof B==="string"?B:B.domain}"`,t=`"${typeof U==="string"?U:U.domain}"`}else if(o.kind==="unit")u=o.l.serializedValue,t=o.r.serializedValue;else continue;let i=H.find((B)=>II(B.path,o.path)&&B.kind===o.kind);if(!i)H.push({kind:o.kind,cases:{[u]:{branchIndices:[$],condition:o.l},[t]:{branchIndices:[E],condition:o.r}},path:o.path});else{if(i.cases[u])i.cases[u].branchIndices=bL(i.cases[u].branchIndices,$);else i.cases[u]??={branchIndices:[$],condition:o.l};if(i.cases[t])i.cases[t].branchIndices=bL(i.cases[t].branchIndices,E);else i.cases[t]??={branchIndices:[E],condition:o.r}}}}}let A=this.ordered?lP(H,this.branches):H;if(!A.length)return null;let L=vP(A,this),I={};for(let $ in L.best.cases){let f=aP(L,$);if(f===null){I[$]=!0;continue}if(f.length===this.branches.length)return null;if(this.ordered)f.sort((M,o)=>M.originalIndex-o.originalIndex);let E=f.map((M)=>M.branch),D=E.length===1?E[0]:this.$.node("union",this.ordered?{branches:E,ordered:!0}:E);Object.assign(this.referencesById,D.referencesById),I[$]=D}if(L.defaultEntries.length){let $=L.defaultEntries.map((f)=>f.branch);I.default=this.$.node("union",this.ordered?{branches:$,ordered:!0}:$,{prereduced:!0}),Object.assign(this.referencesById,I.default.referencesById)}return Object.assign(L.location,{cases:I})}}var vP=(H,A)=>{let L=H.sort((f,E)=>Object.keys(E.cases).length-Object.keys(f.cases).length)[0],I={kind:L.kind,path:L.path,optionallyChainedPropString:Yn(L.path)},$=A.branches.map((f,E)=>({originalIndex:E,branch:f}));return{best:L,location:I,defaultEntries:$,node:A}},aP=(H,A)=>{let L=H.best.cases[A],I=OP(L.condition,H.location.path,H.node.$),$=[],f=[];for(let E=0;E<H.defaultEntries.length;E++){let D=H.defaultEntries[E];if(L.branchIndices.includes(D.originalIndex)){let M=Nn(H.node.branches[D.originalIndex],H.location);if(M===null)$=null;else $?.push({originalIndex:D.originalIndex,branch:M})}else if(D.branch.hasKind("alias")&&I.hasKind("domain")&&I.domain==="object")$?.push(D);else{if(D.branch.in.overlaps(I)){let M=Nn(D.branch,H.location);$?.push({originalIndex:D.originalIndex,branch:M})}f.push(D)}}return H.defaultEntries=f,$},lP=(H,A)=>{return H.filter((I)=>{let $=Object.values(I.cases).map((f)=>f.branchIndices);for(let f=0;f<$.length-1;f++){let E=$[f];for(let D=f+1;D<$.length;D++){let M=$[D];for(let o of E)for(let u of M)if(o>u){if(A[o].overlaps(A[u]))return!1}}}return!0})},OP=(H,A,L)=>{let I=H==="undefined"?L.node("unit",{unit:void 0}):H==="null"?L.node("unit",{unit:null}):H==="boolean"?L.units([!0,!1]):H;for(let $=A.length-1;$>=0;$--){let f=A[$];I=L.node("intersection",typeof f==="number"?{proto:"Array",sequence:[...Tp(f).map((E)=>({})),I]}:{domain:"object",required:[{key:f,value:I}]})}return I},Yn=(H)=>H.reduce((A,L)=>A+g1(L,!0),"data"),sP=rH(_p),NP=rH(IH),_o={implementation:KP,Node:Rn},yP=(H)=>({kind:H.kind,path:H.path.map((A)=>typeof A==="string"?A:DI(A)),cases:fH(H.cases,(A,L)=>[A,L===!0?L:L.hasKind("union")&&L.discriminantJson?L.discriminantJson:L.json])}),RP={delimiter:" | ",finalDelimiter:" | "},YP=(H)=>b$(H,RP),b$=(H,A)=>{let L=A?.delimiter??", ",I=A?.finalDelimiter??" or ";if(H.length===0)return"never";if(H.length===1)return H[0];if(H.length===2&&H[0]==="false"&&H[1]==="true"||H[0]==="true"&&H[1]==="false")return"boolean";let $={},f=H.filter((D)=>$[D]?!1:$[D]=!0),E=f.pop();return`${f.join(L)}${f.length?I:""}${E}`},Fo=(H,A,L)=>{let I=A.map(()=>[]);for(let f=0;f<H.length;f++){let E={};for(let D=0;D<A.length;D++){if(I[D]===null)continue;if(H[f].equals(A[D])){I[D]=null,E={};break}let M=yH(H[f],A[D],L);if(M instanceof v)continue;if(M.equals(H[f])){I[D].push(H[f]),E={};break}if(M.equals(A[D]))I[D]=null;else E[D]=M}for(let D in E)I[D][f]=E[D]}let $=I.flatMap((f,E)=>f?.flatMap((D)=>D.branches)??A[E]);return $.length===0?v.init("union",H,A):$},QP=({branches:H,ordered:A})=>{if(H.length<2)return H;let L=H.map(()=>!0);for(let I=0;I<H.length;I++)for(let $=I+1;$<H.length&&L[I]&&L[$];$++){if(H[I].equals(H[$])){L[$]=!1;continue}let f=dA(H[I].in,H[$].in,H[0].$);if(f instanceof v)continue;if(!A)zP(H[I],H[$]);if(f.equals(H[I].in))L[I]=!!A;else if(f.equals(H[$].in))L[$]=!1}return H.filter((I,$)=>L[$])},zP=(H,A)=>{if(!H.includesTransform&&!A.includesTransform)return;if(!II(H.shallowMorphs,A.shallowMorphs))G(yn(H.expression,A.expression));if(!II(H.flatMorphs,A.flatMorphs,{isEqual:(L,I)=>L.propString===I.propString&&(L.node.hasKind("morph")&&I.node.hasKind("morph")?L.node.hasEqualMorphs(I.node):L.node.hasKind("intersection")&&I.node.hasKind("intersection")?L.node.structure?.structuralMorphRef===I.node.structure?.structuralMorphRef:!1)}))G(yn(H.expression,A.expression))},Nn=(H,A)=>H.transform((L,I)=>{if(L==="domain"||L==="unit")return null;return I},{shouldTransform:(L,I)=>{let $=Yn(I.path);if(!A.optionallyChainedPropString.startsWith($))return!1;if(L.hasKind("domain")&&L.domain==="object")return!0;if((L.hasKind("domain")||A.kind==="unit")&&$===A.optionallyChainedPropString)return!0;return L.children.length!==0&&L.kind!=="index"}}),yn=(H,A)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
78
- Left: ${H}
79
- Right: ${A}`,bP=(H,A)=>`The intersection of two ordered unions is indeterminate:
80
- Left: ${H}
81
- Right: ${A}`;var ZP=$H({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:(H)=>H instanceof Date?H.toISOString():iL(H)}},normalize:(H)=>H,defaults:{description:(H)=>IH(H.unit),problem:({expected:H,actual:A})=>`${H===A?`must be reference equal to ${H} (serialized to the same value)`:`must be ${H} (was ${A})`}`},intersections:{unit:(H,A)=>v.init("unit",H,A),...hL("unit",(H,A)=>{if(A.allows(H.unit))return H;let L=A.hasKind("intersection")?A.basis:A;if(L){let I=L.hasKind("domain")?L:S.intrinsic.object;if(H.domain!==I.domain){let $=H.domain==="undefined"||H.domain==="null"||H.domain==="boolean"?H.domain:S.intrinsic[H.domain];return v.init("domain",$,I)}}return v.init("assignability",H,A.hasKind("intersection")?A.children.find((I)=>!I.allows(H.unit)):A)})}});class zn extends qI{compiledValue=this.json.unit;serializedValue=typeof this.unit==="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Qn(this.unit,this.serializedValue);compiledNegation=Qn(this.unit,this.serializedValue,"negated");expression=IH(this.unit);domain=uA(this.unit);get defaultShortDescription(){return this.domain==="object"?rA.object:this.description}innerToJsonSchema(H){return this.unit===null?{type:"null"}:S.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:UH.throwUnjsonifiableError(this.defaultShortDescription)}traverseAllows=this.unit instanceof Date?(H)=>H instanceof Date&&H.toISOString()===this.compiledValue:Number.isNaN(this.unit)?(H)=>Number.isNaN(H):(H)=>H===this.unit}var Wo={implementation:ZP,Node:zn},Qn=(H,A,L)=>{if(H instanceof Date){let I=`data instanceof Date && data.toISOString() === ${A}`;return L?`!(${I})`:I}if(Number.isNaN(H))return`${L?"!":""}Number.isNaN(data)`;return`data ${L?"!":"="}== ${A}`};var hP=$H({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(H,A)=>{let L=A.$.parseSchema(H);if(!L.extends(S.intrinsic.key))return G(jP(L.expression));let I=L.branches.filter(($)=>$.hasKind("unit"));if(I.length)return G(rP(I.map(($)=>IH($.unit))));return L}},value:{child:!0,parse:(H,A)=>A.$.parseSchema(H)}},normalize:(H)=>H,defaults:{description:(H)=>`[${H.signature.expression}]: ${H.value.description}`},intersections:{index:(H,A,L)=>{if(H.signature.equals(A.signature)){let I=yH(H.value,A.value,L),$=I instanceof v?S.intrinsic.never.internal:I;return L.$.node("index",{signature:H.signature,value:$})}if(H.signature.extends(A.signature)&&H.value.subsumes(A.value))return A;if(A.signature.extends(H.signature)&&A.value.subsumes(H.value))return H;return null}}});class bn extends pL{impliedBasis=S.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=nH(this.value.flatRefs.map((H)=>KL([this.signature,...H.path],H.node)),KL([this.signature],this.value));traverseAllows=(H,A)=>bf(H).every((L)=>{if(this.signature.traverseAllows(L[0],A))return kA(L[0],()=>this.value.traverseAllows(L[1],A),A);return!0});traverseApply=(H,A)=>bf(H).forEach((L)=>{if(this.signature.traverseAllows(L[0],A))kA(L[0],()=>this.value.traverseApply(L[1],A),A)});_transform(H,A){A.path.push(this.signature);let L=super._transform(H,A);return A.path.pop(),L}compile(){}}var mo={implementation:hP,Node:bn},rP=(H)=>`Index keys ${H.join(", ")} should be specified as named props.`,jP=(H)=>`Indexed key definition '${H}' must be a string or symbol`;var kP=$H({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(H,A)=>A.$.parseSchema(H)}},normalize:(H)=>H,defaults:{description:(H)=>`${H.compiledKey}: ${H.value.description}`,expected:(H)=>H.missingValueDescription,actual:()=>"missing"},intersections:{required:fE,optional:fE}});class Zn extends EE{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=WI(this.errorContext)}var Po={implementation:kP,Node:Zn};var dP=$H({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:(H,A)=>{if(H.length===0)return;return H.map((L)=>A.$.parseSchema(L))}},optionals:{child:!0,parse:(H,A)=>{if(H.length===0)return;return H.map((L)=>A.$.parseSchema(L))}},defaultables:{child:(H)=>H.map((A)=>A[0]),parse:(H,A)=>{if(H.length===0)return;return H.map((L)=>{let I=A.$.parseSchema(L[0]);return ME(I,L[1],null),[I,L[1]]})},serialize:(H)=>H.map((A)=>[A[0].collapsibleJson,iL(A[1])])},variadic:{child:!0,parse:(H,A)=>A.$.parseSchema(H,A)},minVariadicLength:{parse:(H)=>H===0?void 0:H},postfix:{child:!0,parse:(H,A)=>{if(H.length===0)return;return H.map((L)=>A.$.parseSchema(L))}}},normalize:(H)=>{if(typeof H==="string")return{variadic:H};if("variadic"in H||"prefix"in H||"defaultables"in H||"optionals"in H||"postfix"in H||"minVariadicLength"in H){if(H.postfix?.length){if(!H.variadic)return G(HX);if(H.optionals?.length||H.defaultables?.length)return G(So)}if(H.minVariadicLength&&!H.variadic)return G("minVariadicLength may not be specified without a variadic element");return H}return{variadic:H}},reduce:(H,A)=>{let L=H.minVariadicLength??0,I=H.prefix?.slice()??[],$=H.defaultables?.slice()??[],f=H.optionals?.slice()??[],E=H.postfix?.slice()??[];if(H.variadic){while(f.at(-1)?.equals(H.variadic))f.pop();if(f.length===0&&$.length===0)while(I.at(-1)?.equals(H.variadic))I.pop(),L++;while(E[0]?.equals(H.variadic))E.shift(),L++}else if(f.length===0&&$.length===0)I.push(...E.splice(0));if(L!==H.minVariadicLength||H.prefix&&H.prefix.length!==I.length)return A.node("sequence",{...H,prefix:I,defaultables:$,optionals:f,postfix:E,minVariadicLength:L},{prereduced:!0})},defaults:{description:(H)=>{if(H.isVariadicOnly)return`${H.variadic.nestableExpression}[]`;return`[${H.tuple.map((L)=>L.kind==="defaultables"?`${L.node.nestableExpression} = ${IH(L.default)}`:L.kind==="optionals"?`${L.node.nestableExpression}?`:L.kind==="variadic"?`...${L.node.nestableExpression}[]`:L.node.expression).join(", ")}]`}},intersections:{sequence:(H,A,L)=>{let I=iE({l:H.tuple,r:A.tuple,disjoint:new v,result:[],fixedVariants:[],ctx:L}),$=I.disjoint.length===0?[I,...I.fixedVariants]:I.fixedVariants;return $.length===0?I.disjoint:$.length===1?L.$.node("sequence",hn($[0].result)):L.$.node("union",$.map((f)=>({proto:Array,sequence:hn(f.result)})))}}});class rn extends pL{impliedBasis=S.intrinsic.Array.internal;tuple=eP(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter((H)=>{if(H.kind==="defaultables"||H.kind==="optionals")return this.defaultablesAndOptionals.push(H.node),!0;return H.kind==="prefix"});variadicOrPostfix=LI(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return Ao(this.flatRefs,this.prevariadic.flatMap((H,A)=>nH(H.node.flatRefs.map((L)=>KL([`${A}`,...L.path],L.node)),KL([`${A}`],H.node)))),Ao(this.flatRefs,this.variadicOrPostfix.flatMap((H)=>nH(H.flatRefs.map((A)=>KL([S.intrinsic.nonNegativeIntegerString.internal,...A.path],A.node)),KL([S.intrinsic.nonNegativeIntegerString.internal],H)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node("minLength",this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node("maxLength",this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=gP(this);defaultValueMorphsReference=this.defaultValueMorphs.length?rH(this.defaultValueMorphs):void 0;elementAtIndex(H,A){if(A<this.prevariadic.length)return this.tuple[A];let L=H.length-this.postfixLength;if(A>=L)return{kind:"postfix",node:this.postfix[A-L]};return{kind:"variadic",node:this.variadic??xH(`Unexpected attempt to access index ${A} on ${this}`)}}traverseAllows=(H,A)=>{for(let L=0;L<H.length;L++)if(!this.elementAtIndex(H,L).node.traverseAllows(H[L],A))return!1;return!0};traverseApply=(H,A)=>{let L=0;for(;L<H.length;L++)kA(L,()=>this.elementAtIndex(H,L).node.traverseApply(H[L],A),A)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(H){if(this.prefix?.forEach((A,L)=>H.traverseKey(`${L}`,`data[${L}]`,A)),this.defaultablesAndOptionals.forEach((A,L)=>{let I=`${L+this.prefixLength}`;H.if(`${I} >= ${H.data}.length`,()=>H.traversalKind==="Allows"?H.return(!0):H.return()),H.traverseKey(I,`data[${I}]`,A)}),this.variadic){if(this.postfix)H.const("firstPostfixIndex",`${H.data}.length${this.postfix?`- ${this.postfix.length}`:""}`);H.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>H.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix?.forEach((A,L)=>{let I=`firstPostfixIndex + ${L}`;H.traverseKey(I,`data[${I}]`,A)})}if(H.traversalKind==="Allows")H.return(!0)}_transform(H,A){A.path.push(S.intrinsic.nonNegativeIntegerString.internal);let L=super._transform(H,A);return A.path.pop(),L}expression=this.description;reduceJsonSchema(H,A){if(this.prevariadic.length)H.prefixItems=this.prevariadic.map((L)=>{let I=L.node.toJsonSchemaRecurse(A);if(L.kind==="defaultables"){let $=typeof L.default==="function"?L.default():L.default;I.default=$}return I});if(this.minLength)H.minItems=this.minLength;if(this.variadic){if(H.items=this.variadic?.toJsonSchemaRecurse(A),this.maxLength)H.maxItems=this.maxLength}else H.items=!1,delete H.maxItems;if(this.postfix)return UH.throwUnjsonifiableError(`Postfix tuple element${this.postfixLength>1?"s":""} ${this.postfix.join(", ")}`);return H}}var qP={},gP=(H)=>{if(!H.defaultables)return[];let A=[],L="[",I=H.prefixLength+H.defaultablesLength-1;for(let $=H.prefixLength;$<=I;$++){let[f,E]=H.defaultables[$-H.prefixLength];A.push(Co($,f,E)),L+=`${$}: ${f.id} = ${iL(E)}, `}return L+="]",qP[L]??=A},Xo={implementation:dP,Node:rn},eP=(H)=>{let A=[];if(H.prefix?.forEach((L)=>A.push({kind:"prefix",node:L})),H.defaultables?.forEach(([L,I])=>A.push({kind:"defaultables",node:L,default:I})),H.optionals?.forEach((L)=>A.push({kind:"optionals",node:L})),H.variadic)A.push({kind:"variadic",node:H.variadic});return H.postfix?.forEach((L)=>A.push({kind:"postfix",node:L})),A},hn=(H)=>H.reduce((A,L)=>{if(L.kind==="variadic")A.variadic=L.node;else if(L.kind==="defaultables")A.defaultables=nH(A.defaultables,[[L.node,L.default]]);else A[L.kind]=nH(A[L.kind],L.node);return A},{}),So="A postfix required element cannot follow an optional or defaultable element",HX="A postfix element requires a variadic element",iE=(H)=>{let[A,...L]=H.l,[I,...$]=H.r;if(!A||!I)return H;let f=L.at(-1)?.kind==="postfix",E=$.at(-1)?.kind==="postfix",D=A.kind==="prefix"||I.kind==="prefix"?"prefix":A.kind==="postfix"||I.kind==="postfix"?"postfix":A.kind==="variadic"&&I.kind==="variadic"?"variadic":f||E?"prefix":A.kind==="defaultables"||I.kind==="defaultables"?"defaultables":"optionals";if(A.kind==="prefix"&&I.kind==="variadic"&&E){let t=iE({...H,fixedVariants:[],r:$.map((i)=>({...i,kind:"prefix"}))});if(t.disjoint.length===0)H.fixedVariants.push(t)}else if(I.kind==="prefix"&&A.kind==="variadic"&&f){let t=iE({...H,fixedVariants:[],l:L.map((i)=>({...i,kind:"prefix"}))});if(t.disjoint.length===0)H.fixedVariants.push(t)}let M=yH(A.node,I.node,H.ctx);if(M instanceof v)if(D==="prefix"||D==="postfix")H.disjoint.push(...M.withPrefixKey(D==="prefix"?H.result.length:`-${L.length+1}`,"required")),H.result=[...H.result,{kind:D,node:S.intrinsic.never.internal}];else if(D==="optionals"||D==="defaultables")return H;else return iE({...H,fixedVariants:[],l:L.map((t)=>({...t,kind:"prefix"})),r:L.map((t)=>({...t,kind:"prefix"}))});else if(D==="defaultables"){if(A.kind==="defaultables"&&I.kind==="defaultables"&&A.default!==I.default)G(Uo(A.default,I.default));H.result=[...H.result,{kind:D,node:M,default:A.kind==="defaultables"?A.default:I.kind==="defaultables"?I.default:xH(`Unexpected defaultable intersection from ${A.kind} and ${I.kind} elements.`)}]}else H.result=[...H.result,{kind:D,node:M}];let o=H.l.length,u=H.r.length;if(A.kind!=="variadic"||o>=u&&(I.kind==="variadic"||u===1))H.l=L;if(I.kind!=="variadic"||u>=o&&(A.kind==="variadic"||o===1))H.r=$;return iE(H)};var dn=(H)=>(A)=>{if(A.props.length||A.index){let L=A.index?.map(($)=>$[H])??[];if(A.props.forEach(($)=>L.push($[H])),A.undeclared)L.push(`+ (undeclared): ${A.undeclared}`);let I=`{ ${L.join(", ")} }`;return A.sequence?`${I} & ${A.sequence.description}`:I}return A.sequence?.description??"{}"},AX=dn("description"),LX=dn("expression"),jn=(H,A,L)=>{let I=H.required?"required":"optional";if(!A.signature.allows(H.key))return null;let $=dA(H.value,A.value,L);if($ instanceof v)if(I==="optional")return L.node("optional",{key:H.key,value:S.intrinsic.never.internal});else return $.withPrefixKey(H.key,H.kind);return null},IX=$H({kind:"structure",hasAssociatedError:!1,normalize:(H)=>H,applyConfig:(H,A)=>{if(!H.undeclared&&A.onUndeclaredKey!=="ignore")return{...H,undeclared:A.onUndeclaredKey};return H},keys:{required:{child:!0,parse:VA("required"),reduceIo:(H,A,L)=>{A.required=nH(A.required,L.map((I)=>I[H]));return}},optional:{child:!0,parse:VA("optional"),reduceIo:(H,A,L)=>{if(H==="in"){A.optional=L.map((I)=>I.in);return}L.forEach((I)=>A[I.outProp.kind]=nH(A[I.outProp.kind],I.outProp.out))}},index:{child:!0,parse:VA("index")},sequence:{child:!0,parse:VA("sequence")},undeclared:{parse:(H)=>H==="ignore"?void 0:H,reduceIo:(H,A,L)=>{if(L!=="delete")return;if(H==="in")delete A.undeclared;else A.undeclared="reject"}}},defaults:{description:AX},intersections:{structure:(H,A,L)=>{let I={...H.inner},$={...A.inner},f=new v;if(H.undeclared){let M=H.keyof();if(A.requiredKeys.forEach((o)=>{if(!M.allows(o))f.add("presence",S.intrinsic.never.internal,A.propsByKey[o].value,{path:[o]})}),$.optional)$.optional=$.optional.filter((o)=>M.allows(o.key));if($.index)$.index=$.index.flatMap((o)=>{if(o.signature.extends(M))return o;let u=dA(M,o.signature,L.$);if(u instanceof v)return[];let t=JD(u,o.value,L.$);if(t.required)$.required=LI($.required,t.required);if(t.optional)$.optional=LI($.optional,t.optional);return t.index??[]})}if(A.undeclared){let M=A.keyof();if(H.requiredKeys.forEach((o)=>{if(!M.allows(o))f.add("presence",H.propsByKey[o].value,S.intrinsic.never.internal,{path:[o]})}),I.optional)I.optional=I.optional.filter((o)=>M.allows(o.key));if(I.index)I.index=I.index.flatMap((o)=>{if(o.signature.extends(M))return o;let u=dA(M,o.signature,L.$);if(u instanceof v)return[];let t=JD(u,o.value,L.$);if(t.required)I.required=LI(I.required,t.required);if(t.optional)I.optional=LI(I.optional,t.optional);return t.index??[]})}let E={};if(H.undeclared||A.undeclared)E.undeclared=H.undeclared==="reject"||A.undeclared==="reject"?"reject":"delete";let D=y$({kind:"structure",baseInner:E,l:R$(I),r:R$($),roots:[],ctx:L});if(D instanceof v)f.push(...D);if(f.length)return f;return D}},reduce:(H,A)=>{if(H.index){if(!(H.required||H.optional))return;let L=!1,I=H.required??[],$=H.optional??[],f=[...$];for(let E of H.index){for(let D of I){let M=jn(D,E,A);if(M instanceof v)return M}for(let[D,M]of $.entries()){let o=jn(M,E,A);if(o instanceof v)return o;if(o===null)continue;f[D]=o,L=!0}}if(L)return A.node("structure",{...H,optional:f},{prereduced:!0})}}});class qn extends pL{impliedBasis=S.intrinsic.object.internal;impliedSiblings=this.children.flatMap((H)=>H.impliedSiblings??[]);props=LI(this.required,this.optional);propsByKey=fH(this.props,(H,A)=>[A.key,A]);propsByKeyReference=rH(this.propsByKey);expression=LX(this);requiredKeys=this.required?.map((H)=>H.key)??[];optionalKeys=this.optional?.map((H)=>H.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let H=this.$.units(this.literalKeys).branches;return this.index?.forEach(({signature:A})=>{H=H.concat(A.branches)}),this._keyof=this.$.node("union",H)}map(H){return this.$.node("structure",this.props.flatMap(H).reduce((A,L)=>{let I=this.propsByKey[L.key];if(NH(L)){if(L.kind!=="required"&&L.kind!=="optional")return G(`Map result must have kind "required" or "optional" (was ${L.kind})`);return A[L.kind]=nH(A[L.kind],L),A}let $=L.kind??I?.kind??"required",f=fH(L,(E,D)=>(E in DE.implementation.keys)?[E,D]:[]);return A[$]=nH(A[$],this.$.node($,f)),A},{}))}assertHasKeys(H){let A=H.filter((L)=>!oE(L,this.keyof()));if(A.length)return G(kn(this.expression,A))}get(H,...A){let L,I=!1,$=DX(H);if((typeof $==="string"||typeof $==="symbol")&&this.propsByKey[$])L=this.propsByKey[$].value,I=this.propsByKey[$].required;if(this.index?.forEach((E)=>{if(oE($,E.signature))L=L?.and(E.value)??E.value}),this.sequence&&oE($,S.intrinsic.nonNegativeIntegerString))if(b($,"root")){if(this.sequence.variadic)L=L?.and(this.sequence.element)??this.sequence.element}else{let E=Number.parseInt($);if(E<this.sequence.prevariadic.length){let D=this.sequence.prevariadic[E].node;L=L?.and(D)??D,I||=E<this.sequence.prefixLength}else if(this.sequence.variadic){let D=this.$.node("union",this.sequence.variadicOrPostfix);L=L?.and(D)??D}}if(!L){if(this.sequence?.variadic&&b($,"root")&&$.extends(S.intrinsic.number))return G(MX($.expression,this.sequence.expression));return G(kn(this.expression,[$]))}let f=L.get(...A);return I?f:f.or(S.intrinsic.undefined)}pick(...H){return this.assertHasKeys(H),this.$.node("structure",this.filterKeys("pick",H))}omit(...H){return this.assertHasKeys(H),this.$.node("structure",this.filterKeys("omit",H))}optionalize(){let{required:H,...A}=this.inner;return this.$.node("structure",{...A,optional:this.props.map((L)=>L.hasKind("required")?this.$.node("optional",L.inner):L)})}require(){let{optional:H,...A}=this.inner;return this.$.node("structure",{...A,required:this.props.map((L)=>L.hasKind("optional")?{key:L.key,value:L.value}:L)})}merge(H){let A=this.filterKeys("omit",[H.keyof()]);if(H.required)A.required=nH(A.required,H.required);if(H.optional)A.optional=nH(A.optional,H.optional);if(H.index)A.index=nH(A.index,H.index);if(H.sequence)A.sequence=H.sequence;if(H.undeclared)A.undeclared=H.undeclared;else delete A.undeclared;return this.$.node("structure",A)}filterKeys(H,A){let L=UD(this.inner),I=($)=>{let f=A.some((E)=>oE($,E));return H==="pick"?f:!f};if(L.required)L.required=L.required.filter(($)=>I($.key));if(L.optional)L.optional=L.optional.filter(($)=>I($.key));if(L.index)L.index=L.index.filter(($)=>I($.signature));return L}traverseAllows=(H,A)=>this._traverse("Allows",H,A);traverseApply=(H,A)=>this._traverse("Apply",H,A);_traverse=(H,A,L)=>{let I=L?.currentErrorCount??0;for(let $=0;$<this.props.length;$++)if(H==="Allows"){if(!this.props[$].traverseAllows(A,L))return!1}else if(this.props[$].traverseApply(A,L),L.failFast&&L.currentErrorCount>I)return!1;if(this.sequence){if(H==="Allows"){if(!this.sequence.traverseAllows(A,L))return!1}else if(this.sequence.traverseApply(A,L),L.failFast&&L.currentErrorCount>I)return!1}if(this.index||this.undeclared==="reject"){let $=Object.keys(A);$.push(...Object.getOwnPropertySymbols(A));for(let f=0;f<$.length;f++){let E=$[f];if(this.index){for(let D of this.index)if(D.signature.traverseAllows(E,L)){if(H==="Allows"){if(!kA(E,()=>D.value.traverseAllows(A[E],L),L))return!1}else if(kA(E,()=>D.value.traverseApply(A[E],L),L),L.failFast&&L.currentErrorCount>I)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(E)){if(H==="Allows")return!1;if(L.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[E],meta:this.meta}),L.failFast)return!1}}}if(this.structuralMorph&&L&&!L.hasError())L.queueMorphs([this.structuralMorph]);return!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter((H)=>H.hasDefault())??[])}declaresKey=(H)=>(H in this.propsByKey)||this.index?.some((A)=>A.signature.allows(H))||this.sequence!==void 0&&S.intrinsic.nonNegativeIntegerString.allows(H);_compileDeclaresKey(H){let A=[];if(this.props.length)A.push(`k in ${this.propsByKeyReference}`);if(this.index?.forEach((L)=>A.push(H.invoke(L.signature,{kind:"Allows",arg:"k"}))),this.sequence)A.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");return A.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",fX(this))}structuralMorphRef=this.structuralMorph&&rH(this.structuralMorph);compile(H){if(H.traversalKind==="Apply")H.initializeErrorCount();if(this.props.forEach((A)=>{if(H.check(A),H.traversalKind==="Apply")H.returnIfFailFast()}),this.sequence){if(H.check(this.sequence),H.traversalKind==="Apply")H.returnIfFailFast()}if(this.index||this.undeclared==="reject")H.const("keys","Object.keys(data)"),H.line("keys.push(...Object.getOwnPropertySymbols(data))"),H.for("i < keys.length",()=>this.compileExhaustiveEntry(H));if(H.traversalKind==="Allows")return H.return(!0);if(this.structuralMorphRef)H.if("ctx && !ctx.hasError()",()=>{return H.line("ctx.queueMorphs(["),EX(H,this),H.line("])")})}compileExhaustiveEntry(H){if(H.const("k","keys[i]"),this.index?.forEach((A)=>{H.if(`${H.invoke(A.signature,{arg:"k",kind:"Allows"})}`,()=>H.traverseKey("k","data[k]",A.value))}),this.undeclared==="reject")H.if(`!(${this._compileDeclaresKey(H)})`,()=>{if(H.traversalKind==="Allows")return H.return(!1);return H.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>H.return())});return H}reduceJsonSchema(H,A){switch(H.type){case"object":return this.reduceObjectJsonSchema(H,A);case"array":if(this.props.length||this.index)return UH.throwUnjsonifiableError(`Additional properties on array ${this.expression}`);return this.sequence?.reduceJsonSchema(H,A)??H;default:return UH.throwInternalOperandError("structure",H)}}reduceObjectJsonSchema(H,A){if(this.props.length){if(H.properties={},this.props.forEach((L)=>{if(typeof L.key==="symbol")return UH.throwUnjsonifiableError(`Symbolic key ${L.serializedKey}`);let I=L.value.toJsonSchemaRecurse(A);if(L.hasDefault()){let $=typeof L.default==="function"?L.default():L.default;I.default=$}H.properties[L.key]=I}),this.requiredKeys.length)H.required=this.requiredKeys}if(this.index?.forEach((L)=>{if(L.signature.equals(S.intrinsic.string))return H.additionalProperties=L.value.toJsonSchemaRecurse(A);if(!L.signature.extends(S.intrinsic.string))return UH.throwUnjsonifiableError(`Symbolic index signature ${L.signature.exclude(S.intrinsic.string)}`);L.signature.branches.forEach((I)=>{if(!I.hasKind("intersection")||I.inner.pattern?.length!==1)return UH.throwUnjsonifiableError(`Index signature ${I}`);H.patternProperties??={},H.patternProperties[I.inner.pattern[0].rule]=L.value.toJsonSchemaRecurse(A)})}),this.undeclared&&!H.additionalProperties)H.additionalProperties=!1;return H}}var Jo={},$X=(H)=>{let A="";for(let L=0;L<H.defaultable.length;L++)A+=H.defaultable[L].defaultValueMorphRef;if(H.sequence?.defaultValueMorphsReference)A+=H.sequence?.defaultValueMorphsReference;if(H.undeclared==="delete"){if(A+="delete !(",H.required?.forEach((L)=>A+=L.compiledKey+" | "),H.optional?.forEach((L)=>A+=L.compiledKey+" | "),H.index?.forEach((L)=>A+=L.signature.id+" | "),H.sequence)if(H.sequence.maxLength===null)A+=j.nonNegativeIntegerString.id;else A+=H.sequence.tuple.forEach((L,I)=>A+=I+" | ");A+=")"}return A},fX=(H)=>{let A=$X(H);if(!A)return;if(Jo[A])return Jo[A];let L=(I,$)=>{for(let f=0;f<H.defaultable.length;f++)if(!(H.defaultable[f].key in I))H.defaultable[f].defaultValueMorph(I,$);if(H.sequence?.defaultables)for(let f=I.length-H.sequence.prefixLength;f<H.sequence.defaultables.length;f++)H.sequence.defaultValueMorphs[f](I,$);if(H.undeclared==="delete"){for(let f in I)if(!H.declaresKey(f))delete I[f]}return I};return Jo[A]=L},EX=(H,A)=>{let I=`(data${A.defaultable.some(($)=>$.defaultValueMorph.length===2)||A.sequence?.defaultValueMorphs.some(($)=>$.length===2)?", ctx":""})`;return H.block(`${I} => `,($)=>{for(let f=0;f<A.defaultable.length;f++){let{serializedKey:E,defaultValueMorphRef:D}=A.defaultable[f];$.if(`!(${E} in data)`,(M)=>M.line(`${D}${I}`))}if(A.sequence?.defaultables)$.for(`i < ${A.sequence.defaultables.length}`,(f)=>f.set("data[i]",5),`data.length - ${A.sequence.prefixLength}`);if(A.undeclared==="delete")$.forIn("data",(f)=>f.if(`!(${A._compileDeclaresKey(f)})`,(E)=>E.line("delete data[k]")));return $.return("data")})},Vo={implementation:IX,Node:qn},DX=(H)=>{if(b(H,"root")&&H.hasKind("unit"))H=H.unit;if(typeof H==="number")H=`${H}`;return H},MX=(H,A)=>`${H} is not allowed as an array index on ${A}. Use the 'nonNegativeIntegerString' keyword instead.`,JD=(H,A,L)=>{let[I,$]=Cp(H.branches,(E)=>E.hasKind("unit"));if(!I.length)return{index:L.node("index",{signature:H,value:A})};let f={};if(I.forEach((E)=>{let D=L.node("required",{key:E.unit,value:A});f[D.kind]=nH(f[D.kind],D)}),$.length)f.index=L.node("index",{signature:$,value:A});return f},oX=(H)=>b(H,"root")?H.expression:IH(H),kn=(H,A)=>`Key${A.length===1?"":"s"} ${A.map(oX).join(", ")} ${A.length===1?"does":"do"} not exist on ${H}`;var Q$={...Gn,alias:uE.implementation,domain:SD.implementation,unit:Wo.implementation,proto:tE.implementation,union:_o.implementation,morph:Go.implementation,intersection:To.implementation,divisor:Eo.implementation,pattern:no.implementation,predicate:fo.implementation,required:Po.implementation,optional:DE.implementation,index:mo.implementation,sequence:Xo.implementation,structure:Vo.implementation};S.defaultConfig=Sp(Object.assign(fH(Q$,(H,A)=>[H,A.defaults]),{jitless:ap(),clone:wp,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{}}));S.resolvedConfig=HE(S.defaultConfig,S.config);var Xn={...Fn,alias:uE.Node,domain:SD.Node,unit:Wo.Node,proto:tE.Node,union:_o.Node,morph:Go.Node,intersection:To.Node,divisor:Eo.Node,pattern:no.Node,predicate:fo.Node,required:Po.Node,optional:DE.Node,index:mo.Node,sequence:Xo.Node,structure:Vo.Node};class Z$ extends Y1{get[RA](){return"module"}}var wo=(H,A)=>new Z$(fH(H,(L,I)=>[L,b(I,"module")?wo(I,A):A.bindReference(I)]));var uX=(H)=>KH(H)?H:("branches"in H)&&KH(H.branches)?H.branches:void 0,tX=(H,A)=>G(`Node of kind ${A} is not valid as a ${H} definition`),gn=(H)=>`#${H} duplicates public alias ${H}`,Ko={};S.ambient??={};var en,A9="function $",iX=(H)=>L9(H,I9(H)),L9=(H,A)=>{let L=A.write(A9,4),I=A.compile()();for(let $ of H){if($.precompilation)continue;if($.traverseAllows=I[`${$.id}Allows`].bind(I),$.isRoot()&&!$.allowsRequiresContext)$.allows=$.traverseAllows;if($.traverseApply=I[`${$.id}Apply`].bind(I),I[`${$.id}Optimistic`])$.traverseOptimistic=I[`${$.id}Optimistic`].bind(I);$.precompilation=L}},I9=(H)=>new xD().return(H.reduce((A,L)=>{let I=new ef({kind:"Allows"}).indent();L.compile(I);let $=I.write(`${L.id}Allows`),f=new ef({kind:"Apply"}).indent();L.compile(f);let E=f.write(`${L.id}Apply`),D=`${A}${$},
82
- ${E},
83
- `;if(!L.hasKind("union"))return D;let M=new ef({kind:"Allows",optimistic:!0}).indent();L.compile(M);let o=M.write(`${L.id}Optimistic`);return`${D}${o},
77
+ })`)}compileIndiscriminable(i){if(i.traversalKind==="Apply")i.const("errors","[]"),this.branches.forEach((o)=>i.line("ctx.pushBranch()").line(i.invoke(o)).if("!ctx.hasError()",()=>i.return(o.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)")),i.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`);else{let{optimistic:o}=i;i.optimistic=!1,this.branches.forEach((n)=>i.if(`${i.invoke(n)}`,()=>i.return(o?n.contextFreeMorph?`${ki(n.contextFreeMorph)}(${i.data})`:i.data:!0))),i.return(o?`"${nn}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){if(this.branches.length<2)return null;if(this.unitBranches.length===this.branches.length){let c=pi(this.unitBranches,(x,T)=>[`${T.in.serializedValue}`,T.hasKind("morph")?T:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:c}}let i=[];for(let c=0;c<this.branches.length-1;c++){let x=this.branches[c];for(let T=c+1;T<this.branches.length;T++){let m=this.branches[T],f=so(x.in,m.in,x.$);if(!(f instanceof L))continue;for(let F of f){if(!F.kind||F.optional)continue;let $,J;if(F.kind==="domain"){let{l:X,r:Y}=F;$=`"${typeof X==="string"?X:X.domain}"`,J=`"${typeof Y==="string"?Y:Y.domain}"`}else if(F.kind==="unit")$=F.l.serializedValue,J=F.r.serializedValue;else continue;let A=i.find((X)=>pp(X.path,F.path)&&X.kind===F.kind);if(!A)i.push({kind:F.kind,cases:{[$]:{branchIndices:[c],condition:F.l},[J]:{branchIndices:[T],condition:F.r}},path:F.path});else{if(A.cases[$])A.cases[$].branchIndices=ln(A.cases[$].branchIndices,c);else A.cases[$]??={branchIndices:[c],condition:F.l};if(A.cases[J])A.cases[J].branchIndices=ln(A.cases[J].branchIndices,T);else A.cases[J]??={branchIndices:[T],condition:F.r}}}}}let o=this.ordered?xK(i,this.branches):i;if(!o.length)return null;let n=pK(o,this),p={};for(let c in n.best.cases){let x=cK(n,c);if(x===null){p[c]=!0;continue}if(x.length===this.branches.length)return null;if(this.ordered)x.sort((f,F)=>f.originalIndex-F.originalIndex);let T=x.map((f)=>f.branch),m=T.length===1?T[0]:this.$.node("union",this.ordered?{branches:T,ordered:!0}:T);Object.assign(this.referencesById,m.referencesById),p[c]=m}if(n.defaultEntries.length){let c=n.defaultEntries.map((x)=>x.branch);p.default=this.$.node("union",this.ordered?{branches:c,ordered:!0}:c,{prereduced:!0}),Object.assign(this.referencesById,p.default.referencesById)}return Object.assign(n.location,{cases:p})}}var pK=(i,o)=>{let n=i.sort((x,T)=>Object.keys(T.cases).length-Object.keys(x.cases).length)[0],p={kind:n.kind,path:n.path,optionallyChainedPropString:Ov(n.path)},c=o.branches.map((x,T)=>({originalIndex:T,branch:x}));return{best:n,location:p,defaultEntries:c,node:o}},cK=(i,o)=>{let n=i.best.cases[o],p=TK(n.condition,i.location.path,i.node.$),c=[],x=[];for(let T=0;T<i.defaultEntries.length;T++){let m=i.defaultEntries[T];if(n.branchIndices.includes(m.originalIndex)){let f=Vv(i.node.branches[m.originalIndex],i.location);if(f===null)c=null;else c?.push({originalIndex:m.originalIndex,branch:f})}else if(m.branch.hasKind("alias")&&p.hasKind("domain")&&p.domain==="object")c?.push(m);else{if(m.branch.in.overlaps(p)){let f=Vv(m.branch,i.location);c?.push({originalIndex:m.originalIndex,branch:f})}x.push(m)}}return i.defaultEntries=x,c},xK=(i,o)=>{return i.filter((p)=>{let c=Object.values(p.cases).map((x)=>x.branchIndices);for(let x=0;x<c.length-1;x++){let T=c[x];for(let m=x+1;m<c.length;m++){let f=c[m];for(let F of T)for(let $ of f)if(F>$){if(o[F].overlaps(o[$]))return!1}}}return!0})},TK=(i,o,n)=>{let p=i==="undefined"?n.node("unit",{unit:void 0}):i==="null"?n.node("unit",{unit:null}):i==="boolean"?n.units([!0,!1]):i;for(let c=o.length-1;c>=0;c--){let x=o[c];p=n.node("intersection",typeof x==="number"?{proto:"Array",sequence:[...JA(x).map((T)=>({})),p]}:{domain:"object",required:[{key:x,value:p}]})}return p},Ov=(i)=>i.reduce((o,n)=>o+h1(n,!0),"data"),mK=ki(wA),fK=ki(oi),Gf={implementation:nK,Node:Ev},FK=(i)=>({kind:i.kind,path:i.path.map((o)=>typeof o==="string"?o:mp(o)),cases:pi(i.cases,(o,n)=>[o,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),$K={delimiter:" | ",finalDelimiter:" | "},JK=(i)=>ac(i,$K),ac=(i,o)=>{let n=o?.delimiter??", ",p=o?.finalDelimiter??" or ";if(i.length===0)return"never";if(i.length===1)return i[0];if(i.length===2&&i[0]==="false"&&i[1]==="true"||i[0]==="true"&&i[1]==="false")return"boolean";let c={},x=i.filter((m)=>c[m]?!1:c[m]=!0),T=x.pop();return`${x.join(n)}${x.length?p:""}${T}`},Yf=(i,o,n)=>{let p=o.map(()=>[]);for(let x=0;x<i.length;x++){let T={};for(let m=0;m<o.length;m++){if(p[m]===null)continue;if(i[x].equals(o[m])){p[m]=null,T={};break}let f=Bi(i[x],o[m],n);if(f instanceof L)continue;if(f.equals(i[x])){p[m].push(i[x]),T={};break}if(f.equals(o[m]))p[m]=null;else T[m]=f}for(let m in T)p[m][x]=T[m]}let c=p.flatMap((x,T)=>x?.flatMap((m)=>m.branches)??o[T]);return c.length===0?L.init("union",i,o):c},AK=({branches:i,ordered:o})=>{if(i.length<2)return i;let n=i.map(()=>!0);for(let p=0;p<i.length;p++)for(let c=p+1;c<i.length&&n[p]&&n[c];c++){if(i[p].equals(i[c])){n[c]=!1;continue}let x=so(i[p].in,i[c].in,i[0].$);if(x instanceof L)continue;if(!o)vK(i[p],i[c]);if(x.equals(i[p].in))n[p]=!!o;else if(x.equals(i[c].in))n[c]=!1}return i.filter((p,c)=>n[c])},vK=(i,o)=>{if(!i.includesTransform&&!o.includesTransform)return;if(!pp(i.shallowMorphs,o.shallowMorphs))H(Sv(i.expression,o.expression));if(!pp(i.flatMorphs,o.flatMorphs,{isEqual:(n,p)=>n.propString===p.propString&&(n.node.hasKind("morph")&&p.node.hasKind("morph")?n.node.hasEqualMorphs(p.node):n.node.hasKind("intersection")&&p.node.hasKind("intersection")?n.node.structure?.structuralMorphRef===p.node.structure?.structuralMorphRef:!1)}))H(Sv(i.expression,o.expression))},Vv=(i,o)=>i.transform((n,p)=>{if(n==="domain"||n==="unit")return null;return p},{shouldTransform:(n,p)=>{let c=Ov(p.path);if(!o.optionallyChainedPropString.startsWith(c))return!1;if(n.hasKind("domain")&&n.domain==="object")return!0;if((n.hasKind("domain")||o.kind==="unit")&&c===o.optionallyChainedPropString)return!0;return n.children.length!==0&&n.kind!=="index"}}),Sv=(i,o)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
78
+ Left: ${i}
79
+ Right: ${o}`,wK=(i,o)=>`The intersection of two ordered unions is indeterminate:
80
+ Left: ${i}
81
+ Right: ${o}`;var XK=ni({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:(i)=>i instanceof Date?i.toISOString():An(i)}},normalize:(i)=>i,defaults:{description:(i)=>oi(i.unit),problem:({expected:i,actual:o})=>`${i===o?`must be reference equal to ${i} (serialized to the same value)`:`must be ${i} (was ${o})`}`},intersections:{unit:(i,o)=>L.init("unit",i,o),...kn("unit",(i,o)=>{if(o.allows(i.unit))return i;let n=o.hasKind("intersection")?o.basis:o;if(n){let p=n.hasKind("domain")?n:V.intrinsic.object;if(i.domain!==p.domain){let c=i.domain==="undefined"||i.domain==="null"||i.domain==="boolean"?i.domain:V.intrinsic[i.domain];return L.init("domain",c,p)}}return L.init("assignability",i,o.hasKind("intersection")?o.children.find((p)=>!p.allows(i.unit)):o)})}});class Lv extends tp{compiledValue=this.json.unit;serializedValue=typeof this.unit==="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=_v(this.unit,this.serializedValue);compiledNegation=_v(this.unit,this.serializedValue,"negated");expression=oi(this.unit);domain=Fo(this.unit);get defaultShortDescription(){return this.domain==="object"?ko.object:this.description}innerToJsonSchema(i){return this.unit===null?{type:"null"}:V.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:Wi.throwUnjsonifiableError(this.defaultShortDescription)}traverseAllows=this.unit instanceof Date?(i)=>i instanceof Date&&i.toISOString()===this.compiledValue:Number.isNaN(this.unit)?(i)=>Number.isNaN(i):(i)=>i===this.unit}var Kf={implementation:XK,Node:Lv},_v=(i,o,n)=>{if(i instanceof Date){let p=`data instanceof Date && data.toISOString() === ${o}`;return n?`!(${p})`:p}if(Number.isNaN(i))return`${n?"!":""}Number.isNaN(data)`;return`data ${n?"!":"="}== ${o}`};var WK=ni({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(i,o)=>{let n=o.$.parseSchema(i);if(!n.extends(V.intrinsic.key))return H(YK(n.expression));let p=n.branches.filter((c)=>c.hasKind("unit"));if(p.length)return H(RK(p.map((c)=>oi(c.unit))));return n}},value:{child:!0,parse:(i,o)=>o.$.parseSchema(i)}},normalize:(i)=>i,defaults:{description:(i)=>`[${i.signature.expression}]: ${i.value.description}`},intersections:{index:(i,o,n)=>{if(i.signature.equals(o.signature)){let p=Bi(i.value,o.value,n),c=p instanceof L?V.intrinsic.never.internal:p;return n.$.node("index",{signature:i.signature,value:c})}if(i.signature.extends(o.signature)&&i.value.subsumes(o.value))return o;if(o.signature.extends(i.signature)&&o.value.subsumes(i.value))return i;return null}}});class Cv extends vn{impliedBasis=V.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Ai(this.value.flatRefs.map((i)=>_n([this.signature,...i.path],i.node)),_n([this.signature],this.value));traverseAllows=(i,o)=>Px(i).every((n)=>{if(this.signature.traverseAllows(n[0],o))return go(n[0],()=>this.value.traverseAllows(n[1],o),o);return!0});traverseApply=(i,o)=>Px(i).forEach((n)=>{if(this.signature.traverseAllows(n[0],o))go(n[0],()=>this.value.traverseApply(n[1],o),o)});_transform(i,o){o.path.push(this.signature);let n=super._transform(i,o);return o.path.pop(),n}compile(){}}var Hf={implementation:WK,Node:Cv},RK=(i)=>`Index keys ${i.join(", ")} should be specified as named props.`,YK=(i)=>`Indexed key definition '${i}' must be a string or symbol`;var GK=ni({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(i,o)=>o.$.parseSchema(i)}},normalize:(i)=>i,defaults:{description:(i)=>`${i.compiledKey}: ${i.value.description}`,expected:(i)=>i.missingValueDescription,actual:()=>"missing"},intersections:{required:pT,optional:pT}});class yv extends cT{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=Zp(this.errorContext)}var Uf={implementation:GK,Node:yv};var KK=ni({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:(i,o)=>{if(i.length===0)return;return i.map((n)=>o.$.parseSchema(n))}},optionals:{child:!0,parse:(i,o)=>{if(i.length===0)return;return i.map((n)=>o.$.parseSchema(n))}},defaultables:{child:(i)=>i.map((o)=>o[0]),parse:(i,o)=>{if(i.length===0)return;return i.map((n)=>{let p=o.$.parseSchema(n[0]);return TT(p,n[1],null),[p,n[1]]})},serialize:(i)=>i.map((o)=>[o[0].collapsibleJson,An(o[1])])},variadic:{child:!0,parse:(i,o)=>o.$.parseSchema(i,o)},minVariadicLength:{parse:(i)=>i===0?void 0:i},postfix:{child:!0,parse:(i,o)=>{if(i.length===0)return;return i.map((n)=>o.$.parseSchema(n))}}},normalize:(i)=>{if(typeof i==="string")return{variadic:i};if("variadic"in i||"prefix"in i||"defaultables"in i||"optionals"in i||"postfix"in i||"minVariadicLength"in i){if(i.postfix?.length){if(!i.variadic)return H(MK);if(i.optionals?.length||i.defaultables?.length)return H(Mf)}if(i.minVariadicLength&&!i.variadic)return H("minVariadicLength may not be specified without a variadic element");return i}return{variadic:i}},reduce:(i,o)=>{let n=i.minVariadicLength??0,p=i.prefix?.slice()??[],c=i.defaultables?.slice()??[],x=i.optionals?.slice()??[],T=i.postfix?.slice()??[];if(i.variadic){while(x.at(-1)?.equals(i.variadic))x.pop();if(x.length===0&&c.length===0)while(p.at(-1)?.equals(i.variadic))p.pop(),n++;while(T[0]?.equals(i.variadic))T.shift(),n++}else if(x.length===0&&c.length===0)p.push(...T.splice(0));if(n!==i.minVariadicLength||i.prefix&&i.prefix.length!==p.length)return o.node("sequence",{...i,prefix:p,defaultables:c,optionals:x,postfix:T,minVariadicLength:n},{prereduced:!0})},defaults:{description:(i)=>{if(i.isVariadicOnly)return`${i.variadic.nestableExpression}[]`;return`[${i.tuple.map((n)=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${oi(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`}},intersections:{sequence:(i,o,n)=>{let p=$T({l:i.tuple,r:o.tuple,disjoint:new L,result:[],fixedVariants:[],ctx:n}),c=p.disjoint.length===0?[p,...p.fixedVariants]:p.fixedVariants;return c.length===0?p.disjoint:c.length===1?n.$.node("sequence",Dv(c[0].result)):n.$.node("union",c.map((x)=>({proto:Array,sequence:Dv(x.result)})))}}});class Iv extends vn{impliedBasis=V.intrinsic.Array.internal;tuple=ZK(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter((i)=>{if(i.kind==="defaultables"||i.kind==="optionals")return this.defaultablesAndOptionals.push(i.node),!0;return i.kind==="prefix"});variadicOrPostfix=np(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return t1(this.flatRefs,this.prevariadic.flatMap((i,o)=>Ai(i.node.flatRefs.map((n)=>_n([`${o}`,...n.path],n.node)),_n([`${o}`],i.node)))),t1(this.flatRefs,this.variadicOrPostfix.flatMap((i)=>Ai(i.flatRefs.map((o)=>_n([V.intrinsic.nonNegativeIntegerString.internal,...o.path],o.node)),_n([V.intrinsic.nonNegativeIntegerString.internal],i)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node("minLength",this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node("maxLength",this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=UK(this);defaultValueMorphsReference=this.defaultValueMorphs.length?ki(this.defaultValueMorphs):void 0;elementAtIndex(i,o){if(o<this.prevariadic.length)return this.tuple[o];let n=i.length-this.postfixLength;if(o>=n)return{kind:"postfix",node:this.postfix[o-n]};return{kind:"variadic",node:this.variadic??Xi(`Unexpected attempt to access index ${o} on ${this}`)}}traverseAllows=(i,o)=>{for(let n=0;n<i.length;n++)if(!this.elementAtIndex(i,n).node.traverseAllows(i[n],o))return!1;return!0};traverseApply=(i,o)=>{let n=0;for(;n<i.length;n++)go(n,()=>this.elementAtIndex(i,n).node.traverseApply(i[n],o),o)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(i){if(this.prefix?.forEach((o,n)=>i.traverseKey(`${n}`,`data[${n}]`,o)),this.defaultablesAndOptionals.forEach((o,n)=>{let p=`${n+this.prefixLength}`;i.if(`${p} >= ${i.data}.length`,()=>i.traversalKind==="Allows"?i.return(!0):i.return()),i.traverseKey(p,`data[${p}]`,o)}),this.variadic){if(this.postfix)i.const("firstPostfixIndex",`${i.data}.length${this.postfix?`- ${this.postfix.length}`:""}`);i.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>i.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix?.forEach((o,n)=>{let p=`firstPostfixIndex + ${n}`;i.traverseKey(p,`data[${p}]`,o)})}if(i.traversalKind==="Allows")i.return(!0)}_transform(i,o){o.path.push(V.intrinsic.nonNegativeIntegerString.internal);let n=super._transform(i,o);return o.path.pop(),n}expression=this.description;reduceJsonSchema(i,o){if(this.prevariadic.length)i.prefixItems=this.prevariadic.map((n)=>{let p=n.node.toJsonSchemaRecurse(o);if(n.kind==="defaultables"){let c=typeof n.default==="function"?n.default():n.default;p.default=c}return p});if(this.minLength)i.minItems=this.minLength;if(this.variadic){if(i.items=this.variadic?.toJsonSchemaRecurse(o),this.maxLength)i.maxItems=this.maxLength}else i.items=!1,delete i.maxItems;if(this.postfix)return Wi.throwUnjsonifiableError(`Postfix tuple element${this.postfixLength>1?"s":""} ${this.postfix.join(", ")}`);return i}}var HK={},UK=(i)=>{if(!i.defaultables)return[];let o=[],n="[",p=i.prefixLength+i.defaultablesLength-1;for(let c=i.prefixLength;c<=p;c++){let[x,T]=i.defaultables[c-i.prefixLength];o.push(Xf(c,x,T)),n+=`${c}: ${x.id} = ${An(T)}, `}return n+="]",HK[n]??=o},Zf={implementation:KK,Node:Iv},ZK=(i)=>{let o=[];if(i.prefix?.forEach((n)=>o.push({kind:"prefix",node:n})),i.defaultables?.forEach(([n,p])=>o.push({kind:"defaultables",node:n,default:p})),i.optionals?.forEach((n)=>o.push({kind:"optionals",node:n})),i.variadic)o.push({kind:"variadic",node:i.variadic});return i.postfix?.forEach((n)=>o.push({kind:"postfix",node:n})),o},Dv=(i)=>i.reduce((o,n)=>{if(n.kind==="variadic")o.variadic=n.node;else if(n.kind==="defaultables")o.defaultables=Ai(o.defaultables,[[n.node,n.default]]);else o[n.kind]=Ai(o[n.kind],n.node);return o},{}),Mf="A postfix required element cannot follow an optional or defaultable element",MK="A postfix element requires a variadic element",$T=(i)=>{let[o,...n]=i.l,[p,...c]=i.r;if(!o||!p)return i;let x=n.at(-1)?.kind==="postfix",T=c.at(-1)?.kind==="postfix",m=o.kind==="prefix"||p.kind==="prefix"?"prefix":o.kind==="postfix"||p.kind==="postfix"?"postfix":o.kind==="variadic"&&p.kind==="variadic"?"variadic":x||T?"prefix":o.kind==="defaultables"||p.kind==="defaultables"?"defaultables":"optionals";if(o.kind==="prefix"&&p.kind==="variadic"&&T){let J=$T({...i,fixedVariants:[],r:c.map((A)=>({...A,kind:"prefix"}))});if(J.disjoint.length===0)i.fixedVariants.push(J)}else if(p.kind==="prefix"&&o.kind==="variadic"&&x){let J=$T({...i,fixedVariants:[],l:n.map((A)=>({...A,kind:"prefix"}))});if(J.disjoint.length===0)i.fixedVariants.push(J)}let f=Bi(o.node,p.node,i.ctx);if(f instanceof L)if(m==="prefix"||m==="postfix")i.disjoint.push(...f.withPrefixKey(m==="prefix"?i.result.length:`-${n.length+1}`,"required")),i.result=[...i.result,{kind:m,node:V.intrinsic.never.internal}];else if(m==="optionals"||m==="defaultables")return i;else return $T({...i,fixedVariants:[],l:n.map((J)=>({...J,kind:"prefix"})),r:n.map((J)=>({...J,kind:"prefix"}))});else if(m==="defaultables"){if(o.kind==="defaultables"&&p.kind==="defaultables"&&o.default!==p.default)H(wf(o.default,p.default));i.result=[...i.result,{kind:m,node:f,default:o.kind==="defaultables"?o.default:p.kind==="defaultables"?p.default:Xi(`Unexpected defaultable intersection from ${o.kind} and ${p.kind} elements.`)}]}else i.result=[...i.result,{kind:m,node:f}];let F=i.l.length,$=i.r.length;if(o.kind!=="variadic"||F>=$&&(p.kind==="variadic"||$===1))i.l=n;if(p.kind!=="variadic"||$>=F&&(o.kind==="variadic"||F===1))i.r=c;return $T(i)};var bv=(i)=>(o)=>{if(o.props.length||o.index){let n=o.index?.map((c)=>c[i])??[];if(o.props.forEach((c)=>n.push(c[i])),o.undeclared)n.push(`+ (undeclared): ${o.undeclared}`);let p=`{ ${n.join(", ")} }`;return o.sequence?`${p} & ${o.sequence.description}`:p}return o.sequence?.description??"{}"},zK=bv("description"),uK=bv("expression"),Bv=(i,o,n)=>{let p=i.required?"required":"optional";if(!o.signature.allows(i.key))return null;let c=so(i.value,o.value,n);if(c instanceof L)if(p==="optional")return n.node("optional",{key:i.key,value:V.intrinsic.never.internal});else return c.withPrefixKey(i.key,i.kind);return null},QK=ni({kind:"structure",hasAssociatedError:!1,normalize:(i)=>i,applyConfig:(i,o)=>{if(!i.undeclared&&o.onUndeclaredKey!=="ignore")return{...i,undeclared:o.onUndeclaredKey};return i},keys:{required:{child:!0,parse:So("required"),reduceIo:(i,o,n)=>{o.required=Ai(o.required,n.map((p)=>p[i]));return}},optional:{child:!0,parse:So("optional"),reduceIo:(i,o,n)=>{if(i==="in"){o.optional=n.map((p)=>p.in);return}n.forEach((p)=>o[p.outProp.kind]=Ai(o[p.outProp.kind],p.outProp.out))}},index:{child:!0,parse:So("index")},sequence:{child:!0,parse:So("sequence")},undeclared:{parse:(i)=>i==="ignore"?void 0:i,reduceIo:(i,o,n)=>{if(n!=="delete")return;if(i==="in")delete o.undeclared;else o.undeclared="reject"}}},defaults:{description:zK},intersections:{structure:(i,o,n)=>{let p={...i.inner},c={...o.inner},x=new L;if(i.undeclared){let f=i.keyof();if(o.requiredKeys.forEach((F)=>{if(!f.allows(F))x.add("presence",V.intrinsic.never.internal,o.propsByKey[F].value,{path:[F]})}),c.optional)c.optional=c.optional.filter((F)=>f.allows(F.key));if(c.index)c.index=c.index.flatMap((F)=>{if(F.signature.extends(f))return F;let $=so(f,F.signature,n.$);if($ instanceof L)return[];let J=um($,F.value,n.$);if(J.required)c.required=np(c.required,J.required);if(J.optional)c.optional=np(c.optional,J.optional);return J.index??[]})}if(o.undeclared){let f=o.keyof();if(i.requiredKeys.forEach((F)=>{if(!f.allows(F))x.add("presence",i.propsByKey[F].value,V.intrinsic.never.internal,{path:[F]})}),p.optional)p.optional=p.optional.filter((F)=>f.allows(F.key));if(p.index)p.index=p.index.flatMap((F)=>{if(F.signature.extends(f))return F;let $=so(f,F.signature,n.$);if($ instanceof L)return[];let J=um($,F.value,n.$);if(J.required)p.required=np(p.required,J.required);if(J.optional)p.optional=np(p.optional,J.optional);return J.index??[]})}let T={};if(i.undeclared||o.undeclared)T.undeclared=i.undeclared==="reject"||o.undeclared==="reject"?"reject":"delete";let m=Bc({kind:"structure",baseInner:T,l:Nc(p),r:Nc(c),roots:[],ctx:n});if(m instanceof L)x.push(...m);if(x.length)return x;return m}},reduce:(i,o)=>{if(i.index){if(!(i.required||i.optional))return;let n=!1,p=i.required??[],c=i.optional??[],x=[...c];for(let T of i.index){for(let m of p){let f=Bv(m,T,o);if(f instanceof L)return f}for(let[m,f]of c.entries()){let F=Bv(f,T,o);if(F instanceof L)return F;if(F===null)continue;x[m]=F,n=!0}}if(n)return o.node("structure",{...i,optional:x},{prereduced:!0})}}});class jv extends vn{impliedBasis=V.intrinsic.object.internal;impliedSiblings=this.children.flatMap((i)=>i.impliedSiblings??[]);props=np(this.required,this.optional);propsByKey=pi(this.props,(i,o)=>[o.key,o]);propsByKeyReference=ki(this.propsByKey);expression=uK(this);requiredKeys=this.required?.map((i)=>i.key)??[];optionalKeys=this.optional?.map((i)=>i.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let i=this.$.units(this.literalKeys).branches;return this.index?.forEach(({signature:o})=>{i=i.concat(o.branches)}),this._keyof=this.$.node("union",i)}map(i){return this.$.node("structure",this.props.flatMap(i).reduce((o,n)=>{let p=this.propsByKey[n.key];if(Ii(n)){if(n.kind!=="required"&&n.kind!=="optional")return H(`Map result must have kind "required" or "optional" (was ${n.kind})`);return o[n.kind]=Ai(o[n.kind],n),o}let c=n.kind??p?.kind??"required",x=pi(n,(T,m)=>(T in xT.implementation.keys)?[T,m]:[]);return o[c]=Ai(o[c],this.$.node(c,x)),o},{}))}assertHasKeys(i){let o=i.filter((n)=>!mT(n,this.keyof()));if(o.length)return H(Nv(this.expression,o))}get(i,...o){let n,p=!1,c=OK(i);if((typeof c==="string"||typeof c==="symbol")&&this.propsByKey[c])n=this.propsByKey[c].value,p=this.propsByKey[c].required;if(this.index?.forEach((T)=>{if(mT(c,T.signature))n=n?.and(T.value)??T.value}),this.sequence&&mT(c,V.intrinsic.nonNegativeIntegerString))if(a(c,"root")){if(this.sequence.variadic)n=n?.and(this.sequence.element)??this.sequence.element}else{let T=Number.parseInt(c);if(T<this.sequence.prevariadic.length){let m=this.sequence.prevariadic[T].node;n=n?.and(m)??m,p||=T<this.sequence.prefixLength}else if(this.sequence.variadic){let m=this.$.node("union",this.sequence.variadicOrPostfix);n=n?.and(m)??m}}if(!n){if(this.sequence?.variadic&&a(c,"root")&&c.extends(V.intrinsic.number))return H(_K(c.expression,this.sequence.expression));return H(Nv(this.expression,[c]))}let x=n.get(...o);return p?x:x.or(V.intrinsic.undefined)}pick(...i){return this.assertHasKeys(i),this.$.node("structure",this.filterKeys("pick",i))}omit(...i){return this.assertHasKeys(i),this.$.node("structure",this.filterKeys("omit",i))}optionalize(){let{required:i,...o}=this.inner;return this.$.node("structure",{...o,optional:this.props.map((n)=>n.hasKind("required")?this.$.node("optional",n.inner):n)})}require(){let{optional:i,...o}=this.inner;return this.$.node("structure",{...o,required:this.props.map((n)=>n.hasKind("optional")?{key:n.key,value:n.value}:n)})}merge(i){let o=this.filterKeys("omit",[i.keyof()]);if(i.required)o.required=Ai(o.required,i.required);if(i.optional)o.optional=Ai(o.optional,i.optional);if(i.index)o.index=Ai(o.index,i.index);if(i.sequence)o.sequence=i.sequence;if(i.undeclared)o.undeclared=i.undeclared;else delete o.undeclared;return this.$.node("structure",o)}filterKeys(i,o){let n=Xm(this.inner),p=(c)=>{let x=o.some((T)=>mT(c,T));return i==="pick"?x:!x};if(n.required)n.required=n.required.filter((c)=>p(c.key));if(n.optional)n.optional=n.optional.filter((c)=>p(c.key));if(n.index)n.index=n.index.filter((c)=>p(c.signature));return n}traverseAllows=(i,o)=>this._traverse("Allows",i,o);traverseApply=(i,o)=>this._traverse("Apply",i,o);_traverse=(i,o,n)=>{let p=n?.currentErrorCount??0;for(let c=0;c<this.props.length;c++)if(i==="Allows"){if(!this.props[c].traverseAllows(o,n))return!1}else if(this.props[c].traverseApply(o,n),n.failFast&&n.currentErrorCount>p)return!1;if(this.sequence){if(i==="Allows"){if(!this.sequence.traverseAllows(o,n))return!1}else if(this.sequence.traverseApply(o,n),n.failFast&&n.currentErrorCount>p)return!1}if(this.index||this.undeclared==="reject"){let c=Object.keys(o);c.push(...Object.getOwnPropertySymbols(o));for(let x=0;x<c.length;x++){let T=c[x];if(this.index){for(let m of this.index)if(m.signature.traverseAllows(T,n)){if(i==="Allows"){if(!go(T,()=>m.value.traverseAllows(o[T],n),n))return!1}else if(go(T,()=>m.value.traverseApply(o[T],n),n),n.failFast&&n.currentErrorCount>p)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(T)){if(i==="Allows")return!1;if(n.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[T],meta:this.meta}),n.failFast)return!1}}}if(this.structuralMorph&&n&&!n.hasError())n.queueMorphs([this.structuralMorph]);return!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter((i)=>i.hasDefault())??[])}declaresKey=(i)=>(i in this.propsByKey)||this.index?.some((o)=>o.signature.allows(i))||this.sequence!==void 0&&V.intrinsic.nonNegativeIntegerString.allows(i);_compileDeclaresKey(i){let o=[];if(this.props.length)o.push(`k in ${this.propsByKeyReference}`);if(this.index?.forEach((n)=>o.push(i.invoke(n.signature,{kind:"Allows",arg:"k"}))),this.sequence)o.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");return o.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",SK(this))}structuralMorphRef=this.structuralMorph&&ki(this.structuralMorph);compile(i){if(i.traversalKind==="Apply")i.initializeErrorCount();if(this.props.forEach((o)=>{if(i.check(o),i.traversalKind==="Apply")i.returnIfFailFast()}),this.sequence){if(i.check(this.sequence),i.traversalKind==="Apply")i.returnIfFailFast()}if(this.index||this.undeclared==="reject")i.const("keys","Object.keys(data)"),i.line("keys.push(...Object.getOwnPropertySymbols(data))"),i.for("i < keys.length",()=>this.compileExhaustiveEntry(i));if(i.traversalKind==="Allows")return i.return(!0);if(this.structuralMorphRef)i.if("ctx && !ctx.hasError()",()=>{return i.line("ctx.queueMorphs(["),EK(i,this),i.line("])")})}compileExhaustiveEntry(i){if(i.const("k","keys[i]"),this.index?.forEach((o)=>{i.if(`${i.invoke(o.signature,{arg:"k",kind:"Allows"})}`,()=>i.traverseKey("k","data[k]",o.value))}),this.undeclared==="reject")i.if(`!(${this._compileDeclaresKey(i)})`,()=>{if(i.traversalKind==="Allows")return i.return(!1);return i.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>i.return())});return i}reduceJsonSchema(i,o){switch(i.type){case"object":return this.reduceObjectJsonSchema(i,o);case"array":if(this.props.length||this.index)return Wi.throwUnjsonifiableError(`Additional properties on array ${this.expression}`);return this.sequence?.reduceJsonSchema(i,o)??i;default:return Wi.throwInternalOperandError("structure",i)}}reduceObjectJsonSchema(i,o){if(this.props.length){if(i.properties={},this.props.forEach((n)=>{if(typeof n.key==="symbol")return Wi.throwUnjsonifiableError(`Symbolic key ${n.serializedKey}`);let p=n.value.toJsonSchemaRecurse(o);if(n.hasDefault()){let c=typeof n.default==="function"?n.default():n.default;p.default=c}i.properties[n.key]=p}),this.requiredKeys.length)i.required=this.requiredKeys}if(this.index?.forEach((n)=>{if(n.signature.equals(V.intrinsic.string))return i.additionalProperties=n.value.toJsonSchemaRecurse(o);if(!n.signature.extends(V.intrinsic.string))return Wi.throwUnjsonifiableError(`Symbolic index signature ${n.signature.exclude(V.intrinsic.string)}`);n.signature.branches.forEach((p)=>{if(!p.hasKind("intersection")||p.inner.pattern?.length!==1)return Wi.throwUnjsonifiableError(`Index signature ${p}`);i.patternProperties??={},i.patternProperties[p.inner.pattern[0].rule]=n.value.toJsonSchemaRecurse(o)})}),this.undeclared&&!i.additionalProperties)i.additionalProperties=!1;return i}}var zf={},VK=(i)=>{let o="";for(let n=0;n<i.defaultable.length;n++)o+=i.defaultable[n].defaultValueMorphRef;if(i.sequence?.defaultValueMorphsReference)o+=i.sequence?.defaultValueMorphsReference;if(i.undeclared==="delete"){if(o+="delete !(",i.required?.forEach((n)=>o+=n.compiledKey+" | "),i.optional?.forEach((n)=>o+=n.compiledKey+" | "),i.index?.forEach((n)=>o+=n.signature.id+" | "),i.sequence)if(i.sequence.maxLength===null)o+=h.nonNegativeIntegerString.id;else o+=i.sequence.tuple.forEach((n,p)=>o+=p+" | ");o+=")"}return o},SK=(i)=>{let o=VK(i);if(!o)return;if(zf[o])return zf[o];let n=(p,c)=>{for(let x=0;x<i.defaultable.length;x++)if(!(i.defaultable[x].key in p))i.defaultable[x].defaultValueMorph(p,c);if(i.sequence?.defaultables)for(let x=p.length-i.sequence.prefixLength;x<i.sequence.defaultables.length;x++)i.sequence.defaultValueMorphs[x](p,c);if(i.undeclared==="delete"){for(let x in p)if(!i.declaresKey(x))delete p[x]}return p};return zf[o]=n},EK=(i,o)=>{let p=`(data${o.defaultable.some((c)=>c.defaultValueMorph.length===2)||o.sequence?.defaultValueMorphs.some((c)=>c.length===2)?", ctx":""})`;return i.block(`${p} => `,(c)=>{for(let x=0;x<o.defaultable.length;x++){let{serializedKey:T,defaultValueMorphRef:m}=o.defaultable[x];c.if(`!(${T} in data)`,(f)=>f.line(`${m}${p}`))}if(o.sequence?.defaultables)c.for(`i < ${o.sequence.defaultables.length}`,(x)=>x.set("data[i]",5),`data.length - ${o.sequence.prefixLength}`);if(o.undeclared==="delete")c.forIn("data",(x)=>x.if(`!(${o._compileDeclaresKey(x)})`,(T)=>T.line("delete data[k]")));return c.return("data")})},uf={implementation:QK,Node:jv},OK=(i)=>{if(a(i,"root")&&i.hasKind("unit"))i=i.unit;if(typeof i==="number")i=`${i}`;return i},_K=(i,o)=>`${i} is not allowed as an array index on ${o}. Use the 'nonNegativeIntegerString' keyword instead.`,um=(i,o,n)=>{let[p,c]=$A(i.branches,(T)=>T.hasKind("unit"));if(!p.length)return{index:n.node("index",{signature:i,value:o})};let x={};if(p.forEach((T)=>{let m=n.node("required",{key:T.unit,value:o});x[m.kind]=Ai(x[m.kind],m)}),c.length)x.index=n.node("index",{signature:c,value:o});return x},LK=(i)=>a(i,"root")?i.expression:oi(i),Nv=(i,o)=>`Key${o.length===1?"":"s"} ${o.map(LK).join(", ")} ${o.length===1?"does":"do"} not exist on ${i}`;var jc={...Jv,alias:fT.implementation,domain:zm.implementation,unit:Kf.implementation,proto:FT.implementation,union:Gf.implementation,morph:Rf.implementation,intersection:Wf.implementation,divisor:nf.implementation,pattern:$f.implementation,predicate:of.implementation,required:Uf.implementation,optional:xT.implementation,index:Hf.implementation,sequence:Zf.implementation,structure:uf.implementation};V.defaultConfig=GA(Object.assign(pi(jc,(i,o)=>[i,o.defaults]),{jitless:zA(),clone:UA,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{}}));V.resolvedConfig=rx(V.defaultConfig,V.config);var Rv={...Av,alias:fT.Node,domain:zm.Node,unit:Kf.Node,proto:FT.Node,union:Gf.Node,morph:Rf.Node,intersection:Wf.Node,divisor:nf.Node,pattern:$f.Node,predicate:of.Node,required:Uf.Node,optional:xT.Node,index:Hf.Node,sequence:Zf.Node,structure:uf.Node};class lc extends D1{get[No](){return"module"}}var Qf=(i,o)=>new lc(pi(i,(n,p)=>[n,a(p,"module")?Qf(p,o):o.bindReference(p)]));var CK=(i)=>Oi(i)?i:("branches"in i)&&Oi(i.branches)?i.branches:void 0,yK=(i,o)=>H(`Node of kind ${o} is not valid as a ${i} definition`),Pv=(i)=>`#${i} duplicates public alias ${i}`,Vf={};V.ambient??={};var av,qv="function $",DK=(i)=>kv(i,hv(i)),kv=(i,o)=>{let n=o.write(qv,4),p=o.compile()();for(let c of i){if(c.precompilation)continue;if(c.traverseAllows=p[`${c.id}Allows`].bind(p),c.isRoot()&&!c.allowsRequiresContext)c.allows=c.traverseAllows;if(c.traverseApply=p[`${c.id}Apply`].bind(p),p[`${c.id}Optimistic`])c.traverseOptimistic=p[`${c.id}Optimistic`].bind(p);c.precompilation=n}},hv=(i)=>new wm().return(i.reduce((o,n)=>{let p=new dx({kind:"Allows"}).indent();n.compile(p);let c=p.write(`${n.id}Allows`),x=new dx({kind:"Apply"}).indent();n.compile(x);let T=x.write(`${n.id}Apply`),m=`${o}${c},
82
+ ${T},
83
+ `;if(!n.hasKind("union"))return m;let f=new dx({kind:"Allows",optimistic:!0}).indent();n.compile(f);let F=f.write(`${n.id}Optimistic`);return`${m}${F},
84
84
  `},`{
85
- `)+"}");class VD{config;resolvedConfig;name;get[RA](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(H,A){if(this.config=HE(S.config,A),this.resolvedConfig=HE(S.resolvedConfig,A),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(Ko).length}`,this.name in Ko)G(`A Scope already named ${this.name} already exists`);Ko[this.name]=this,Object.entries(H).map((I)=>this.preparseOwnAliasEntry(...I)).forEach(([I,$])=>{let f=I;if(I[0]==="#"){if(f=I.slice(1),f in this.aliases)G(gn(f));this.aliases[f]=$}else{if(f in this.aliases)G(gn(I));this.aliases[f]=$,this.exportedNames.push(f)}if(!b($,"module")&&!b($,"generic")&&!FI($)){let E=this.preparseOwnDefinitionFormat($,{alias:f});if(b(E,"root"))this.resolutions[f]=this.bindReference(E);else this.resolutions[f]=this.createParseContext(E).id}}),en??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[en.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=S.intrinsic?fH(S.intrinsic,(I,$)=>I.startsWith("json")?[]:[I,this.bindReference($)]):{}}cacheGetter(H,A){return Object.defineProperty(this,H,{value:A}),A}get internal(){return this}_json;get json(){if(!this._json)this.export();return this._json}defineSchema(H){return H}generic=(...H)=>{let A=this;return(L,I)=>new PI(H,I?new FD(L):L,A,A,I??null)};units=(H,A)=>{let L=[];for(let $ of H)if(!L.includes($))L.push($);let I=L.map(($)=>this.node("unit",{unit:$},A));return this.node("union",I,{...A,prereduced:!0})};lazyResolutions=[];lazilyResolve(H,A){let L=this.node("alias",{reference:A??"synthetic",resolve:H},{prereduced:!0});if(!this.resolved)this.lazyResolutions.push(L);return L}schema=(H,A)=>this.finalize(this.parseSchema(H,A));parseSchema=(H,A)=>this.node($E(H),H,A);preparseNode(H,A,L){let I=typeof H==="string"?H:$E(A,H);if(NH(A)&&A.kind===I)return A;if(I==="alias"&&!L?.prereduced){let{reference:E}=uE.implementation.normalize(A,this);if(E.startsWith("$")){let D=this.resolveRoot(E.slice(1));A=D,I=D.kind}}else if(I==="union"&&hA(A,"object")){let E=uX(A);if(E?.length===1)A=E[0],I=$E(A)}if(NH(A)&&A.kind===I)return A;let f=Q$[I].normalize?.(A,this)??A;if(NH(f))return f.kind===I?f:tX(I,f.kind);return{...L,$:this,kind:I,def:f,prefix:L.alias??I}}bindReference(H){let A;if(NH(H))A=H.$===this?H:new H.constructor(H.attachments,this);else A=H.$===this?H:new PI(H.params,H.bodyDef,H.$,this,H.hkt);if(!this.resolved)Object.assign(this.referencesById,A.referencesById);return A}resolveRoot(H){return this.maybeResolveRoot(H)??G(lo(H))}maybeResolveRoot(H){let A=this.maybeResolve(H);if(b(A,"generic"))return;return A}maybeResolveSubalias(H){return vo(this.aliases,H)??vo(this.ambient,H)}get ambient(){return S.ambient}maybeResolve(H){let A=this.resolutions[H];if(A){if(typeof A!=="string")return this.bindReference(A);let I=YA[A];if(b(I,"root"))return this.resolutions[H]=I;if(b(I,"context")){if(I.phase==="resolving")return this.node("alias",{reference:`$${H}`},{prereduced:!0});if(I.phase==="resolved")return xH(`Unexpected resolved context for was uncached by its scope: ${IH(I)}`);I.phase="resolving";let $=this.bindReference(this.parseOwnDefinitionFormat(I.def,I));return I.phase="resolved",YA[$.id]=$,YA[I.id]=$,this.resolutions[H]=$}return xH(`Unexpected nodesById entry for ${A}: ${IH(I)}`)}let L=this.aliases[H]??this.ambient?.[H];if(!L)return this.maybeResolveSubalias(H);if(L=this.normalizeRootScopeValue(L),b(L,"generic"))return this.resolutions[H]=this.bindReference(L);if(b(L,"module"))if(L.root)return this.resolutions[H]=this.bindReference(L.root);else return G(E9(H));return this.resolutions[H]=this.parse(L,{alias:H})}createParseContext(H){let A=H.id??Bo(H.prefix);return YA[A]=Object.assign(H,{[RA]:"context",$:this,id:A,phase:"unresolved"})}traversal(H){return new wL(H,this.resolvedConfig)}import(...H){return new Z$(fH(this.export(...H),(A,L)=>[`#${A}`,L]))}precompilation;_exportedResolutions;_exports;export(...H){if(!this._exports){this._exports={};for(let L of this.exportedNames){let I=this.aliases[L];this._exports[L]=b(I,"module")?wo(I,this):H9(this.maybeResolve(L))}if(this.lazyResolutions.forEach((L)=>L.resolution),this._exportedResolutions=f9(this,this._exports),this._json=$9(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let L=I9(this.references);this.precompilation=L.write(A9,4),L9(this.references,L)}this.resolved=!0}let A=H.length?H:this.exportedNames;return new Z$(fH(A,(L,I)=>[I,this._exports[I]]))}resolve(H){return this.export()[H]}node=(H,A,L={})=>{let I=this.preparseNode(H,A,L);if(NH(I))return this.bindReference(I);let $=this.createParseContext(I),f=co($),E=this.bindReference(f);return YA[$.id]=E};parse=(H,A={})=>this.finalize(this.parseDefinition(H,A));parseDefinition(H,A={}){if(b(H,"root"))return this.bindReference(H);let L=this.preparseOwnDefinitionFormat(H,A);if(b(L,"root"))return this.bindReference(L);let I=this.createParseContext(L);YA[I.id]=I;let $=this.bindReference(this.parseOwnDefinitionFormat(H,I));if($.isCyclic)$=Pn($,I.id);return YA[I.id]=$,$}finalize(H){if(H9(H),!H.precompilation&&!this.resolvedConfig.jitless)iX(H.references);return H}}class ao extends VD{parseOwnDefinitionFormat(H,A){return co(A)}preparseOwnDefinitionFormat(H,A){return this.preparseNode($E(H),H,A)}preparseOwnAliasEntry(H,A){return[H,A]}normalizeRootScopeValue(H){return H}}var H9=(H)=>{return H.references.filter((A)=>A.hasKind("alias")).forEach((A)=>{Object.assign(A.referencesById,A.resolution.referencesById),H.references.forEach((L)=>{if(A.id in L.referencesById)Object.assign(L.referencesById,A.referencesById)})}),H},$9=(H)=>fH(H,(A,L)=>[A,b(L,"root")||b(L,"generic")?L.json:b(L,"module")?$9(L):xH(`Unexpected resolution ${IH(L)}`)]),vo=(H,A)=>{let L=A.indexOf(".");if(L===-1)return;let I=A.slice(0,L),$=H[I];if($===void 0)return;if(!b($,"module"))return G(pX(I));let f=A.slice(L+1),E=$[f];if(E===void 0)return vo($,f);if(b(E,"root")||b(E,"generic"))return E;if(b(E,"module"))return E.root??G(E9(A));xH(`Unexpected resolution for alias '${A}': ${IH(E)}`)},wD=(H,A)=>new ao(H,A),pE=new ao({});var f9=(H,A)=>{let L={};for(let I in A){let $=A[I];if(b($,"module")){let f=f9(H,$),E=fH(f,(D,M)=>[`${I}.${D}`,M]);Object.assign(L,E)}else if(b($,"root")||b($,"generic"))L[I]=$;else xH(`Unexpected scope resolution ${IH($)}`)}return L},lo=(H)=>`'${H}' is unresolvable`,pX=(H)=>`'${H}' must reference a module to be accessed using dot syntax`,E9=(H)=>`Reference to submodule '${H}' must specify an alias`;pE.export();var{schema:WH,node:h$,defineSchema:h6,generic:BL}=pE;var Oo="^(?:0|[1-9]\\d*)$",nX=new RegExp(Oo),k6=rH(nX);var D9=wD({bigint:"bigint",boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:"number",object:"object",string:"string",symbol:"symbol",true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();S.intrinsic={...D9};var M9=wD({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:Oo}},{prereducedAliases:!0}).export();Object.assign(S.intrinsic,M9);var BX=wD({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),j={...D9,...M9,...BX,emptyStructure:h$("structure",{},{prereduced:!0})};S.intrinsic={...j};var u9=(H)=>typeof H==="string"&&H[0]==="d"&&(H[1]==="'"||H[1]==='"')&&H.at(-1)===H[1],o9=(H)=>H.toString()!=="Invalid Date",t9=(H)=>H.slice(2,-1),so=(H)=>`'${H}' could not be parsed by the Date constructor`,i9=(H,A)=>cX(H,A),cX=(H,A)=>{let L=new Date(H);if(o9(L))return L;let I=zp(H);if(I!==void 0){let $=new Date(I);if(o9($))return $}return A?G(A===!0?so(H):A):void 0};var No=(H,A)=>{let L=H.scanner.shiftUntil(xX[n9[A]]);if(H.scanner.lookahead==="")return H.error(CX(L,A));if(H.scanner.shift(),A==="/"){try{new RegExp(L)}catch(I){G(String(I))}H.root=H.ctx.$.node("intersection",{domain:"string",pattern:L},{prereduced:!0})}else if(gH(A,yo))H.root=H.ctx.$.node("unit",{unit:L});else{let I=i9(L,so(L));H.root=H.ctx.$.node("unit",{meta:L,unit:I})}},yo={"'":1,'"':1},p9={"/":1,"'":1,'"':1},n9={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},xX={"'":(H)=>H.lookahead==="'",'"':(H)=>H.lookahead==='"',"/":(H)=>H.lookahead==="/"},UX={'"':"double-quote","'":"single-quote","/":"forward slash"},CX=(H,A)=>`${A}${H} requires a closing ${UX[n9[A]]}`;var B9=(H)=>`Private type references should not include '#'. Use '${H}' instead.`,KD="Optional definitions like 'string?' are only valid as properties in an object or tuple",vD="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";var c9={">":!0,">=":!0},x9={"<":!0,"<=":!0};var r$={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},U9=(H)=>`Unmatched )${H===""?"":` before ${H}`}`,aD=(H)=>`Missing ${H}`,C9=(H,A)=>`Left bounds are only valid when paired with right bounds (try ...${A}${H})`,lD=(H)=>`Left-bounded expressions must specify their limits using < or <= (was ${H})`,T9=(H,A,L,I)=>`An expression may have at most one left bound (parsed ${H}${r$[A]}, ${L}${r$[I]})`;var G9=(H,A,L)=>F9(H,A,L,[]),F9=(H,A,L,I)=>{let $=L.parseUntilFinalizer();if(I.push($.root),$.finalizer===">"){if(I.length!==A.params.length)return L.error(Ro(H,A.names,I.map((f)=>f.expression)));return I}if($.finalizer===",")return F9(H,A,L,I);return $.error(aD(">"))},Ro=(H,A,L)=>`${H}<${A.join(", ")}> requires exactly ${A.length} args (got ${L.length}${L.length===0?"":`: ${L.join(", ")}`})`;var Yo=(H)=>{let A=H.scanner.shiftUntilNextTerminator();if(A==="keyof")H.addPrefix("keyof");else H.root=GX(H,A)},TX=(H,A,L)=>{if(L.scanner.shiftUntilNonWhitespace(),L.scanner.shift()!=="<")return L.error(Ro(H,A.names,[]));let $=G9(H,A,L);return A(...$)},GX=(H,A)=>FX(H,A)??_X(H,A)??H.error(A===""?H.scanner.lookahead==="#"?B9(H.shiftedByOne().scanner.shiftUntilNextTerminator()):Qo(H):lo(A)),FX=(H,A)=>{if(H.ctx.args?.[A]){let I=H.ctx.args[A];if(typeof I!=="string")return I;return H.ctx.$.node("alias",{reference:I},{prereduced:!0})}let L=H.ctx.$.maybeResolve(A);if(b(L,"root"))return L;if(L===void 0)return;if(b(L,"generic"))return TX(A,L,H);return G(`Unexpected resolution ${IH(L)}`)},_X=(H,A)=>{let L=bp(A);if(L!==void 0)return H.ctx.$.node("unit",{unit:L});let I=hp(A);if(I!==void 0)return H.ctx.$.node("unit",{unit:I})},Qo=(H)=>{let A=H.previousOperator();return A?zo(A,H.scanner.unscanned):WX(H.scanner.unscanned)},zo=(H,A="")=>`Token '${H}' requires a right operand${A?` before '${A}'`:""}`,WX=(H)=>`Expected an expression${H?` before '${H}'`:""}`;var bo=(H)=>H.scanner.lookahead===""?H.error(Qo(H)):H.scanner.lookahead==="("?H.shiftedByOne().reduceGroupOpen():H.scanner.lookaheadIsIn(p9)?No(H,H.scanner.shift()):H.scanner.lookaheadIsIn(_I)?bo(H.shiftedByOne()):H.scanner.lookahead==="d"?H.scanner.nextLookahead in yo?No(H,`${H.scanner.shift()}${H.scanner.shift()}`):Yo(H):Yo(H);class oI extends d1{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in oI.terminatingChars))}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,..._I};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=(H,A)=>H===">"?A[0]==="="?A[1]==="=":A.trimStart()===""||gH(A.trimStart()[0],oI.terminatingChars):H==="="?A[0]!=="=":H===","||H==="?"}var W9=(H,A)=>{let L=mX(H,A);if(H.root.hasKind("unit")){if(typeof H.root.unit==="number"){H.reduceLeftBound(H.root.unit,L),H.unsetRoot();return}if(H.root.unit instanceof Date){let I=`d'${H.root.description??H.root.unit.toISOString()}'`;H.unsetRoot(),H.reduceLeftBound(I,L);return}}return XX(H,L)},m9={"<":1,">":1,"=":1},mX=(H,A)=>H.scanner.lookaheadIs("=")?`${A}${H.scanner.shift()}`:A;var _9=(H,A,L,I)=>{if(L.extends(S.intrinsic.number)){if(typeof A!=="number")return G(Zo(H,A,I));return H==="=="?["min","max"]:H[0]===">"?["min"]:["max"]}if(L.extends(S.intrinsic.lengthBoundable)){if(typeof A!=="number")return G(Zo(H,A,I));return H==="=="?["exactLength"]:H[0]===">"?["minLength"]:["maxLength"]}if(L.extends(S.intrinsic.Date))return H==="=="?["after","before"]:H[0]===">"?["after"]:["before"];return G(pn(L.expression))},PX=(H)=>({rule:u9(H.limit)?t9(H.limit):H.limit,exclusive:H.comparator.length===1}),XX=(H,A)=>{let L=H.unsetRoot(),I=H.scanner.location;H.parseOperand();let $=H.unsetRoot(),f=H.scanner.sliceChars(I,H.scanner.location);if(H.root=L,!$.hasKind("unit")||typeof $.unit!=="number"&&!($.unit instanceof Date))return H.error(Zo(A,f,"right"));let E=$.unit,D=A.length===1,M=_9(A,typeof E==="number"?E:f,L,"right");for(let u of M)H.constrainRoot(u,A==="=="?{rule:E}:{rule:E,exclusive:D});if(!H.branches.leftBound)return;if(!gH(A,x9))return H.error(lD(A));let o=_9(H.branches.leftBound.comparator,H.branches.leftBound.limit,L,"left");H.constrainRoot(o[0],PX(H.branches.leftBound)),H.branches.leftBound=null},Zo=(H,A,L)=>`Comparator ${L==="left"?r$[H]:H} must be ${L==="left"?"preceded":"followed"} by a corresponding literal (was ${A})`;var P9=(H)=>{H.scanner.shiftUntilNonWhitespace();let A=H.scanner.shiftUntilNextTerminator();H.root=H.root.brand(A)};var S9=(H)=>{let A=H.scanner.shiftUntilNextTerminator(),L=Zp(A,{errorOnFail:X9(A)});if(L===0)H.error(X9(0));H.root=H.root.constrain("divisor",L)},X9=(H)=>`% operator must be followed by a non-zero integer literal (was ${H})`;var ho=(H)=>{let A=H.scanner.shift();return A===""?H.finalize(""):A==="["?H.scanner.shift()==="]"?H.setRoot(H.root.array()):H.error(SX):A==="|"?H.scanner.lookahead===">"?H.shiftedByOne().pushRootToBranch("|>"):H.pushRootToBranch(A):A==="&"?H.pushRootToBranch(A):A===")"?H.finalizeGroup():oI.lookaheadIsFinalizing(A,H.scanner.unscanned)?H.finalize(A):gH(A,m9)?W9(H,A):A==="%"?S9(H):A==="#"?P9(H):(A in _I)?ho(H):H.error(OD(A))},OD=(H,A="")=>`'${H}' is not allowed here${A&&` (should be ${A})`}`,SX="Missing expected ']'";var J9=(H)=>{let A=H.unsetRoot();H.parseOperand();let L=H.unsetRoot();if(!L.hasKind("unit"))return H.error(JX(L.expression));let I=L.unit instanceof Date?()=>new Date(L.unit):L.unit;return[A,"=",I]},JX=(H)=>`Default value '${H}' must a literal value`;var ro=(H,A)=>{let L=A.$.maybeResolveRoot(H);if(L)return L;if(H.endsWith("[]")){let f=A.$.maybeResolveRoot(H.slice(0,-2));if(f)return f.array()}let I=new j$(new oI(H),A),$=VX(I);if(I.finalizer===">")G(OD(">"));return $},VX=(H)=>{H.parseOperand();let A=nE(H).root;if(!A)return xH(`Root was unexpectedly unset after parsing string '${H.scanner.scanned}'`);if(H.finalizer==="=")A=J9(H);else if(H.finalizer==="?")A=[A,"?"];if(H.scanner.shiftUntilNonWhitespace(),H.scanner.lookahead)G(OD(H.scanner.lookahead));return A},nE=(H)=>{while(H.finalizer===void 0)wX(H);return H},wX=(H)=>H.hasRoot()?H.parseOperator():H.parseOperand();class j${root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(H,A){this.scanner=H,this.ctx=A}error(H){return G(H)}hasRoot(){return this.root!==void 0}setRoot(H){this.root=H}unsetRoot(){let H=this.root;return this.root=void 0,H}constrainRoot(...H){this.root=this.root.constrain(H[0],H[1])}finalize(H){if(this.groups.length)return this.error(aD(")"));this.finalizeBranches(),this.finalizer=H}reduceLeftBound(H,A){let L=r$[A];if(!gH(L,c9))return this.error(lD(A));if(this.branches.leftBound)return this.error(T9(this.branches.leftBound.limit,this.branches.leftBound.comparator,H,L));this.branches.leftBound={comparator:L,limit:H}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch("|>"),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch("|"),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch("&"),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();let H=this.groups.pop();if(!H)return this.error(U9(this.scanner.unscanned));this.branches=H}addPrefix(H){this.branches.prefixes.push(H)}applyPrefixes(){while(this.branches.prefixes.length){let H=this.branches.prefixes.pop();this.root=H==="keyof"?this.root.keyof():xH(`Unexpected prefix '${H}'`)}}pushRootToBranch(H){this.assertRangeUnset(),this.applyPrefixes();let A=this.root;if(this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(A)??A,H==="&")return;if(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,H==="|")return;this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null}parseUntilFinalizer(){return nE(new j$(this.scanner,this.ctx))}parseOperator(){return ho(this)}parseOperand(){return bo(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(C9(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes.at(-1)??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedByOne(){return this.scanner.shift(),this}}var KX="An empty string is not a valid generic parameter name",sD=(H,A,L)=>{H.shiftUntilNonWhitespace();let I=H.shiftUntilNextTerminator();if(I===""){if(H.lookahead===""&&A.length)return A;return G(KX)}return H.shiftUntilNonWhitespace(),vX(H,I,A,L)},V9="extends ",vX=(H,A,L,I)=>{if(H.shiftUntilNonWhitespace(),H.unscanned.startsWith(V9))H.jumpForward(V9.length);else{if(H.lookahead===",")H.shift();return L.push(A),sD(H,L,I)}let $=nE(new j$(H,I));return L.push([A,$.root]),sD(H,L,I)};class jo extends VL{$;constructor(H){super((...A)=>new BE(H)(...A),{bind:H});this.$=H}in(H){return new BE(this.$,H===void 0?void 0:this.$.parse(H))}at(H,A){return new BE(this.$).at(H,A)}case(H,A){return new BE(this.$).case(H,A)}}class BE extends VL{$;in;key;branches=[];constructor(H,A){super((L)=>this.caseEntries(Object.entries(L).map(([I,$])=>I==="default"?[I,$]:[this.$.parse(I),$])));this.$=H,this.in=A}at(H,A){if(this.key)G(lX);if(this.branches.length)G(aX);return this.key=H,A?this.match(A):this}case(H,A){return this.caseEntry(this.$.parse(H),A)}caseEntry(H,A){let I=(this.key?this.$.parse({[this.key]:H}):H).pipe(A);return this.branches.push(I),this}match(H){return this(H)}strings(H){return this.caseEntries(Object.entries(H).map(([A,L])=>A==="default"?[A,L]:[this.$.node("unit",{unit:A}),L]))}caseEntries(H){for(let A=0;A<H.length;A++){let[L,I]=H[A];if(L==="default"){if(A!==H.length-1)G("default may only be specified as the last key of a switch definition");return this.default(I)}if(typeof I!=="function")return G(`Value for case "${L}" must be a function (was ${uA(I)})`);this.caseEntry(L,I)}return this}default(H){if(typeof H==="function")this.case(j.unknown,H);let A={branches:this.branches,ordered:!0};if(H==="never"||H==="assert")A.meta={onFail:w9};let L=this.$.node("union",A);if(!this.in)return this.$.finalize(L);let I=this.in.pipe(L);if(H==="never"||H==="assert")I=I.configureReferences({onFail:w9},"self");return this.$.finalize(I)}}var w9=(H)=>H.throw(),aX="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",lX="At most one key matcher may be specified per expression";var ND=(H,A)=>{if(KH(H)){if(H[1]==="=")return[A.$.parseOwnDefinitionFormat(H[0],A),"=",H[2]];if(H[1]==="?")return[A.$.parseOwnDefinitionFormat(H[0],A),"?"]}return yD(H,A)},K9="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",v9="Only required keys may specify default values, e.g. { value: 'number = 0' }";var a9=(H,A)=>{let L,I={},$=bf(H);for(let[E,D]of $){let M=NX(E);if(M.kind==="spread"){if(!ZL(I))return G(sX);let B=A.$.parseOwnDefinitionFormat(D,A);if(B.equals(j.object))continue;if(!B.hasKind("intersection")||!B.basis?.equals(j.object))return G(yX(B.expression));L=B.structure;continue}if(M.kind==="undeclared"){if(D!=="reject"&&D!=="delete"&&D!=="ignore")G(OX(D));I.undeclared=D;continue}let o=ND(D,A),u=M;if(M.kind==="required"){if(!KH(o))ko(I,"required",{key:M.normalized,value:o},A);else ko(I,"optional",o[1]==="="?{key:M.normalized,value:o[0],default:o[2]}:{key:M.normalized,value:o[0]},A);continue}if(KH(o)){if(o[1]==="?")G(K9);if(o[1]==="=")G(v9)}if(M.kind==="optional"){ko(I,"optional",{key:M.normalized,value:o},A);continue}let t=A.$.parseOwnDefinitionFormat(u.normalized,A),i=JD(t,o,A.$);if(i.index)I.index=nH(I.index,i.index);if(i.required)I.required=nH(I.required,i.required)}let f=A.$.node("structure",I);return A.$.parseSchema({domain:"object",structure:L?.merge(f)??f})},ko=(H,A,L,I)=>{H[A]=nH(H[A],I.$.node(A,L))},OX=(H)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${IH(H)})`,sX="Spread operator may only be used as the first key in an object",NX=(H)=>typeof H==="symbol"?{kind:"required",normalized:H}:H.at(-1)==="?"?H.at(-2)===jf?{kind:"required",normalized:`${H.slice(0,-2)}?`}:{kind:"optional",normalized:H.slice(0,-1)}:H[0]==="["&&H.at(-1)==="]"?{kind:"index",normalized:H.slice(1,-1)}:H[0]===jf&&H[1]==="["&&H.at(-1)==="]"?{kind:"required",normalized:H.slice(1)}:H==="..."?{kind:"spread"}:H==="+"?{kind:"undeclared"}:{kind:"required",normalized:H==="\\..."?"...":H==="\\+"?"+":H},yX=(H)=>`Spread operand must resolve to an object literal type (was ${H})`;var O9=(H,A)=>kX(H)?R9[H[0]](H,A):rX(H)?y9[H[1]](H,A):null,RX=(H,A)=>A.$.parseOwnDefinitionFormat(H[1],A).keyof(),qo=(H,A)=>{if(H[2]===void 0)return G(zo(H[1],""));let L=A.$.parseOwnDefinitionFormat(H[0],A),I=A.$.parseOwnDefinitionFormat(H[2],A);if(H[1]==="|")return A.$.node("union",{branches:[L,I]});let $=H[1]==="&"?dA(L,I,A.$):IE(L,I,A.$);if($ instanceof v)return $.throw();return $},YX=(H,A)=>A.$.parseOwnDefinitionFormat(H[0],A).array(),QX=(H,A)=>{if(typeof H[2]!=="function")return G(s9("=>",H[2]));return A.$.parseOwnDefinitionFormat(H[0],A).pipe(H[2])},s9=(H,A)=>`${H===":"?"Narrow":"Morph"} expression requires a function following '${H}' (was ${typeof A})`,zX=(H,A)=>{if(typeof H[2]!=="function")return G(s9(":",H[2]));return A.$.parseOwnDefinitionFormat(H[0],A).constrain("predicate",H[2])},bX=(H,A)=>A.$.parseOwnDefinitionFormat(H[0],A).configureReferences(H[2],"shallow"),N9=(H)=>H,ZX=N9({"[]":YX,"?":()=>G(KD)}),hX=N9({"|":qo,"&":qo,":":zX,"=>":QX,"|>":qo,"@":bX,"=":()=>G(vD)}),y9={...ZX,...hX},rX=(H)=>y9[H[1]]!==void 0,jX=(H)=>H,R9=jX({keyof:RX,instanceof:(H,A)=>{if(typeof H[1]!=="function")return G(l9(hf(H[1])));let L=H.slice(1).map((I)=>typeof I==="function"?A.$.node("proto",{proto:I}):G(l9(hf(I))));return L.length===1?L[0]:A.$.node("union",{branches:L})},"===":(H,A)=>A.$.units(H.slice(1))}),kX=(H)=>R9[H[0]]!==void 0,l9=(H)=>`Expected a constructor following 'instanceof' operator (was ${H})`;var z9=(H,A)=>{let L=[{}],I=0;while(I<H.length){let $=!1;if(H[I]==="..."&&I<H.length-1)$=!0,I++;let f=ND(H[I],A),[E,D,M]=!KH(f)?[f]:f;if(I++,$){if(!E.extends(S.intrinsic.Array))return G(gX(E.expression));L=L.flatMap((o)=>E.distribute((u)=>qX(UD(o),u)))}else L=L.map((o)=>{if(D==="?")return b9(o,E);if(D==="=")return dX(o,E,M);return go(o,E)})}return A.$.parseSchema(L.map(($)=>ZL($)?{proto:Array,exactLength:0}:{proto:Array,sequence:$}))},go=(H,A)=>{if(H.defaultables||H.optionals)return G(H.variadic?So:eX);if(H.variadic)H.postfix=nH(H.postfix,A);else H.prefix=nH(H.prefix,A);return H},b9=(H,A)=>{if(H.variadic)return G(Z9);return H.optionals=nH(H.optionals,A),H},dX=(H,A,L)=>{if(H.variadic)return G(Z9);if(H.optionals)return G(HS);return H.defaultables=nH(H.defaultables,[[A,L]]),H},Y9=(H,A)=>{if(H.postfix)G(Q9);if(H.variadic){if(!H.variadic.equals(A))G(Q9)}else H.variadic=A.internal;return H},qX=(H,A)=>{let L=A.select({method:"find",kind:"sequence"});if(!L)return Y9(H,S.intrinsic.unknown);if(L.prefix?.forEach((I)=>go(H,I)),L.optionals?.forEach((I)=>b9(H,I)),L.variadic)Y9(H,L.variadic);return L.postfix?.forEach((I)=>go(H,I)),H},gX=(H)=>`Spread element must be an array (was ${H})`,Q9="A tuple may have at most one variadic element",eX="A required element may not follow an optional element",Z9="An optional element may not follow a variadic element";var HS="A defaultable element may not follow an optional element without a default";var AS={},yD=(H,A)=>{if(typeof H==="string"){if(A.args&&Object.keys(A.args).some((I)=>H.includes(I)))return ro(H,A);let L=AS[A.$.name]??={};return L[H]??=ro(H,A)}return hA(H,"object")?LS(H,A):G(eo(uA(H)))},LS=(H,A)=>{let L=Zf(H);switch(L){case void 0:if(b(H,"root"))return H;return a9(H,A);case"Array":return IS(H,A);case"RegExp":return A.$.node("intersection",{domain:"string",pattern:H},{prereduced:!0});case"Function":{let I=FI(H)?H():H;if(b(I,"root"))return I;return G(eo("Function"))}default:return G(eo(L??IH(H)))}},IS=(H,A)=>O9(H,A)??z9(H,A),eo=(H)=>`Type definitions must be strings or objects (was ${H})`;class Hu extends VL{constructor(H){let A=Object.assign({errors:jA,hkt:JA,$:H,raw:H.parse,module:H.constructor.module,scope:H.constructor.scope,define:H.define,match:H.match,generic:H.generic,schema:H.schema,keywords:H.ambient,unit:H.unit,enumerated:H.enumerated,instanceOf:H.instanceOf,valueOf:H.valueOf,or:H.or,and:H.and,merge:H.merge,pipe:H.pipe},H.ambientAttachments);super((...L)=>{if(L.length===1)return H.parse(L[0]);if(L.length===2&&typeof L[0]==="string"&&L[0][0]==="<"&&L[0].at(-1)===">"){let I=L[0].slice(1,-1),$=H.parseGenericParams(I,{});return new PI($,L[1],H,H,null)}return H.parse(L)},{bind:H,attach:A})}}var k$=S;class RD extends VD{get ambientAttachments(){if(!k$.typeAttachments)return;return this.cacheGetter("ambientAttachments",fH(k$.typeAttachments,(H,A)=>[H,this.bindReference(A)]))}preparseOwnAliasEntry(H,A){let L=H.indexOf("<");if(L===-1){if(b(A,"module")||b(A,"generic"))return[H,A];let f=this.name==="ark"?H:H==="root"?this.name:`${this.name}.${H}`,E=this.resolvedConfig.keywords?.[f];if(E)A=[A,"@",E];return[H,A]}if(H.at(-1)!==">")G("'>' must be the last character of a generic declaration in a scope");let I=H.slice(0,L),$=H.slice(L+1,-1);return[I,()=>{let f=this.parseGenericParams($,{alias:I});return Dn(f,A,this)}]}parseGenericParams(H,A){return sD(new oI(H),[],this.createParseContext({...A,def:H,prefix:"generic"}))}normalizeRootScopeValue(H){if(FI(H)&&!b(H,"generic"))return H();return H}preparseOwnDefinitionFormat(H,A){return{...A,def:H,prefix:A.alias??"type"}}parseOwnDefinitionFormat(H,A){if(!(A.alias&&(A.alias in this.aliases))&&!A.args)A.args={this:A.id};let I=yD(H,A);if(KH(I)){if(I[1]==="=")return G(vD);if(I[1]==="?")return G(KD)}return I}unit=(H)=>this.units([H]);valueOf=(H)=>this.units(Jp(H));enumerated=(...H)=>this.units(H);instanceOf=(H)=>this.node("proto",{proto:H},{prereduced:!0});or=(...H)=>this.schema(H.map((A)=>this.parse(A)));and=(...H)=>H.reduce((A,L)=>A.and(this.parse(L)),this.intrinsic.unknown);merge=(...H)=>H.reduce((A,L)=>A.merge(this.parse(L)),this.intrinsic.object);pipe=(...H)=>this.intrinsic.unknown.pipe(...H);match=new jo(this);declare=()=>({type:this.type});define(H){return H}type=new Hu(this);static scope=(H,A={})=>new RD(H,A);static module=(H,A={})=>this.scope(H,A).export()}var Au=Object.assign(RD.scope,{define:(H)=>H}),uH=RD;class h9 extends JA{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}var $S=BL(["base",j.object],["props",j.object])((H)=>H.base.merge(H.props),h9),r9=uH.module({Key:j.key,Merge:$S});class j9 extends JA{}var fS=BL("element")((H)=>{let A=H.element.exclude(j.Array),L=A.array();return A.rawOr(L).pipe(GI).distribute((I)=>I.assertHasKind("morph").declareOut(L),WH)},j9),k9=uH.module({root:j.Array,readonly:"root",index:j.nonNegativeIntegerString,liftFrom:fS},{name:"Array"});var Lu=WH(["string",kI.FileConstructor]),ES=Lu.rawOr(Lu.array()),d9=WH({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:ES}}),q9=uH.module({root:["instanceof",FormData],value:Lu,parsed:d9,parse:WH({in:FormData,morphs:(H)=>{let A={};for(let[L,I]of H)if(L in A){let $=A[L];if(typeof $==="string"||$ instanceof kI.FileConstructor)A[L]=[$,I];else $.push(I)}else A[L]=I;return A},declaredOut:d9})},{name:"FormData"});var g9=uH.module({Int8:["instanceof",Int8Array],Uint8:["instanceof",Uint8Array],Uint8Clamped:["instanceof",Uint8ClampedArray],Int16:["instanceof",Int16Array],Uint16:["instanceof",Uint16Array],Int32:["instanceof",Int32Array],Uint32:["instanceof",Uint32Array],Float32:["instanceof",Float32Array],Float64:["instanceof",Float64Array],BigInt64:["instanceof",BigInt64Array],BigUint64:["instanceof",BigUint64Array]},{name:"TypedArray"});var DS={Boolean:1,Number:1,String:1},e9=uH.module({...fH({...Q1,...b1},(H,A)=>(H in DS)?[]:[H,["instanceof",A]]),Array:k9,TypedArray:g9,FormData:q9});var MS=WH({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-8640000000000000,meta:"a Unix timestamp after -8640000000000000"},max:{rule:8640000000000000,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),oS=WH({domain:"number",divisor:1}),YD=uH.module({root:j.number,integer:oS,epoch:MS,safe:WH({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"});var zH=(H,A)=>h$("intersection",{domain:"string",pattern:{rule:H.source,flags:H.flags,meta:A}}),H0=zH(kf,"a well-formed integer string"),t0=uH.module({root:H0,parse:WH({in:H0,morphs:(H,A)=>{let L=Number.parseInt(H);return Number.isSafeInteger(L)?L:A.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:j.integer})},{name:"string.integer"}),uS=zH(/^[0-9a-fA-F]+$/,"hex characters only"),tS=uH.module({root:zH(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,"base64-encoded"),url:zH(/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==|%3D%3D)?|[A-Za-z0-9_-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),A0=zH(/^[A-Z].*$/,"capitalized"),iS=uH.module({root:WH({in:"string",morphs:(H)=>H.charAt(0).toUpperCase()+H.slice(1),declaredOut:A0}),preformatted:A0},{name:"string.capitalize"}),pS=(H)=>{let A=H.replace(/[- ]+/g,""),L=0,I,$,f=!1;for(let E=A.length-1;E>=0;E--){if(I=A.substring(E,E+1),$=Number.parseInt(I,10),f)if($*=2,$>=10)L+=$%10+1;else L+=$;else L+=$;f=!f}return!!(L%10===0?A:!1)},nS=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,BS=WH({domain:"string",pattern:{meta:"a credit card number",rule:nS.source},predicate:{meta:"a credit card number",predicate:pS}});var cS=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;var xS=(H)=>!Number.isNaN(new Date(H).valueOf()),L0=WH({domain:"string",predicate:{meta:"a parsable date",predicate:xS}}).assertHasKind("intersection"),I0=t0.root.internal.narrow((H,A)=>{let L=Number.parseInt(H),I=YD.epoch(L);if(I instanceof jA)return A.errors.merge(I),!1;return!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),US=uH.module({root:I0,parse:WH({in:I0,morphs:(H)=>new Date(H),declaredOut:j.Date})},{name:"string.date.epoch"}),$0=zH(cS,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),CS=uH.module({root:$0,parse:WH({in:$0,morphs:(H)=>new Date(H),declaredOut:j.Date})},{name:"string.date.iso"}),TS=uH.module({root:L0,parse:WH({declaredIn:L0,in:"string",morphs:(H,A)=>{let L=new Date(H);if(Number.isNaN(L.valueOf()))return A.error("a parsable date");return L},declaredOut:j.Date}),iso:CS,epoch:US},{name:"string.date"}),GS=zH(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,"an email address"),f0="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",XI=`(${f0}[.]){3}${f0}`,FS=new RegExp(`^${XI}$`),$A="(?:[0-9a-fA-F]{1,4})",_S=new RegExp(`^((?:${$A}:){7}(?:${$A}|:)|(?:${$A}:){6}(?:${XI}|:${$A}|:)|(?:${$A}:){5}(?::${XI}|(:${$A}){1,2}|:)|(?:${$A}:){4}(?:(:${$A}){0,1}:${XI}|(:${$A}){1,3}|:)|(?:${$A}:){3}(?:(:${$A}){0,2}:${XI}|(:${$A}){1,4}|:)|(?:${$A}:){2}(?:(:${$A}){0,3}:${XI}|(:${$A}){1,5}|:)|(?:${$A}:){1}(?:(:${$A}){0,4}:${XI}|(:${$A}){1,6}|:)|(?::((?::${$A}){0,5}:${XI}|(?::${$A}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),WS=uH.module({root:["v4 | v6","@","an IP address"],v4:zH(FS,"an IPv4 address"),v6:zH(_S,"an IPv6 address")},{name:"string.ip"}),d$="a JSON string",i0=(H)=>{if(!(H instanceof SyntaxError))throw H;return`must be ${d$} (${H})`},mS=WH({meta:d$,domain:"string",predicate:{meta:d$,predicate:(H,A)=>{try{return JSON.parse(H),!0}catch(L){return A.reject({code:"predicate",expected:d$,problem:i0(L)})}}}}),PS=(H,A)=>{if(H.length===0)return A.error({code:"predicate",expected:d$,actual:"empty"});try{return JSON.parse(H)}catch(L){return A.error({code:"predicate",expected:d$,problem:i0(L)})}},XS=uH.module({root:mS,parse:WH({meta:"safe JSON string parser",in:"string",morphs:PS,declaredOut:j.jsonObject})},{name:"string.json"}),E0=zH(/^[a-z]*$/,"only lowercase letters"),SS=uH.module({root:WH({in:"string",morphs:(H)=>H.toLowerCase(),declaredOut:E0}),preformatted:E0},{name:"string.lower"}),p0=["NFC","NFD","NFKC","NFKD"],cE=fH(p0,(H,A)=>[A,WH({domain:"string",predicate:(L)=>L.normalize(A)===L,meta:`${A}-normalized unicode`})]),QD=fH(p0,(H,A)=>[A,WH({in:"string",morphs:(L)=>L.normalize(A),declaredOut:cE[A]})]),JS=uH.module({root:QD.NFC,preformatted:cE.NFC},{name:"string.normalize.NFC"}),VS=uH.module({root:QD.NFD,preformatted:cE.NFD},{name:"string.normalize.NFD"}),wS=uH.module({root:QD.NFKC,preformatted:cE.NFKC},{name:"string.normalize.NFKC"}),KS=uH.module({root:QD.NFKD,preformatted:cE.NFKD},{name:"string.normalize.NFKD"}),vS=uH.module({root:"NFC",NFC:JS,NFD:VS,NFKC:wS,NFKD:KS},{name:"string.normalize"}),D0=zH(nD,"a well-formed numeric string"),aS=uH.module({root:D0,parse:WH({in:D0,morphs:(H)=>Number.parseFloat(H),declaredOut:j.number})},{name:"string.numeric"}),lS=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,OS=zH(lS,"a semantic version (see https://semver.org/)"),M0=zH(/^\S.*\S$|^\S?$/,"trimmed"),sS=uH.module({root:WH({in:"string",morphs:(H)=>H.trim(),declaredOut:M0}),preformatted:M0},{name:"string.trim"}),o0=zH(/^[A-Z]*$/,"only uppercase letters"),NS=uH.module({root:WH({in:"string",morphs:(H)=>H.toUpperCase(),declaredOut:o0}),preformatted:o0},{name:"string.upper"}),yS=(H)=>{if(URL.canParse)return URL.canParse(H);try{return new URL(H),!0}catch{return!1}},u0=WH({domain:"string",predicate:{meta:"a URL string",predicate:yS}}),RS=uH.module({root:u0,parse:WH({declaredIn:u0,in:"string",morphs:(H,A)=>{try{return new URL(H)}catch{return A.error("a URL string")}},declaredOut:WH(URL)})},{name:"string.url"}),YS=uH.module({root:["versioned | nil | max","@","a UUID"],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i,v1:zH(/^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv1"),v2:zH(/^[0-9a-f]{8}-[0-9a-f]{4}-2[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv2"),v3:zH(/^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv3"),v4:zH(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv4"),v5:zH(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv5"),v6:zH(/^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv6"),v7:zH(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv7"),v8:zH(/^[0-9a-f]{8}-[0-9a-f]{4}-8[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),n0=uH.module({root:j.string,alpha:zH(/^[A-Za-z]*$/,"only letters"),alphanumeric:zH(/^[A-Za-z\d]*$/,"only letters and digits 0-9"),hex:uS,base64:tS,capitalize:iS,creditCard:BS,date:TS,digits:zH(/^\d*$/,"only digits 0-9"),email:GS,integer:t0,ip:WS,json:XS,lower:SS,normalize:vS,numeric:aS,semver:OS,trim:sS,upper:NS,url:RS,uuid:YS},{name:"string"});var B0=uH.module({bigint:j.bigint,boolean:j.boolean,false:j.false,never:j.never,null:j.null,number:j.number,object:j.object,string:j.string,symbol:j.symbol,true:j.true,unknown:j.unknown,undefined:j.undefined}),c0=uH.module({root:j.unknown,any:j.unknown},{name:"unknown"}),QS=uH.module({root:j.jsonObject,stringify:h$("morph",{in:j.jsonObject,morphs:(H)=>JSON.stringify(H),declaredOut:j.string})},{name:"object.json"}),x0=uH.module({root:j.object,json:QS},{name:"object"});class U0 extends JA{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var zS=BL(["K",j.key],"V")((H)=>({domain:"object",index:{signature:H.K,value:H.V}}),U0);class C0 extends JA{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var bS=BL(["T",j.object],["K",j.key])((H)=>H.T.pick(H.K),C0);class T0 extends JA{description='omit a set of properties from an object like `Omit(User, "age")`'}var ZS=BL(["T",j.object],["K",j.key])((H)=>H.T.omit(H.K),T0);class G0 extends JA{description="make all named properties of an object optional like `Partial(User)`"}var hS=BL(["T",j.object])((H)=>H.T.partial(),G0);class F0 extends JA{description="make all named properties of an object required like `Required(User)`"}var rS=BL(["T",j.object])((H)=>H.T.required(),F0);class _0 extends JA{description='exclude branches of a union like `Exclude("boolean", "true")`'}var jS=BL("T","U")((H)=>H.T.exclude(H.U),_0);class W0 extends JA{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var kS=BL("T","U")((H)=>H.T.extract(H.U),W0),m0=uH.module({Exclude:jS,Extract:kS,Omit:ZS,Partial:hS,Pick:bS,Record:zS,Required:rS});var SI=Au({...B0,...m0,...e9,...r9,string:n0,number:YD,object:x0,unknown:c0},{prereducedAliases:!0,name:"ark"}),tA=SI.export();Object.assign(k$.ambient,tA);k$.typeAttachments={string:tA.string.root,number:tA.number.root,bigint:tA.bigint,boolean:tA.boolean,symbol:tA.symbol,undefined:tA.undefined,null:tA.null,object:tA.object.root,unknown:tA.unknown.root,false:tA.false,true:tA.true,never:tA.never,arrayIndex:tA.Array.index,Key:tA.Key,Record:tA.Record,Array:tA.Array.root,Date:tA.Date};var eH=Object.assign(SI.type,k$.typeAttachments),dS=SI.match,qS=SI.generic,cQ=SI.schema,gS=SI.define,eS=SI.declare;function zD(H=Math.random){return H().toString(36).slice(2)}class xE extends Promise{fate;resolve;reject;done=!1;constructor(H){let A,L;super((I,$)=>{A=I,L=$});this.resolve=A,this.reject=L,this.use(H instanceof Promise?H:new Promise(H))}pass(H,A){if(H===this.fate)this.resolve(A),this.done=!0}fail(H,A){if(H===this.fate)this.reject(A),this.done=!0}use(H){if(H instanceof Promise){let A=H;this.fate=A,A.then((L)=>{this.pass(A,L)},(L)=>{this.fail(A,L)})}else this.resolve(H),this.fate=void 0}}var P0=(H,A,L=e.STORE)=>{return Iu(L,{key:`${H.key}:JSON`,get:({get:I})=>A.toJson(I(H)),set:({set:I},$)=>{I(H,A.fromJson($))}})};function N(H){while(H.child!==null)H=H.child;return H}class iH{Subscriber;subscribers=new Map;subscribe(H,A){return this.subscribers.set(H,A),()=>{this.unsubscribe(H)}}unsubscribe(H){this.subscribers.delete(H)}next(H){let A=this.subscribers.values();for(let L of A)L(H)}}class $u extends iH{state;constructor(H){super();this.state=H}next(H){this.state=H,super.next(H)}}function gI(H,A,L){let I={key:A.key,type:"atom_family"},$=H.families.get(A.key);if($)H.logger.error("\u2757","atom_family",A.key,`Overwriting an existing ${rL($)} "${$.key}" in store "${H.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let f=new iH,D=Object.assign((M)=>{let o=pH(M),u={key:A.key,subKey:o},t=`${A.key}(${o})`,i=N(H),B=A.default,U={key:t,default:B instanceof Function?B(M):B};if(A.effects)U.effects=A.effects(M);let x=eI(i,U,u);return f.next({type:"state_creation",token:x}),x},I,{subject:f,install:(M)=>gI(M,A),internalRoles:L});return H.families.set(A.key,D),H.defaults.set(A.key,A.default),I}function X0(H,A){if("mutable"in A)return UE(H,A);return gI(H,A)}function JI(H,A,L){let I={key:A.key,type:"readonly_selector_family"},$=H.families.get(A.key);if($)H.logger.error("\u2757","readonly_selector_family",A.key,`Overwriting an existing ${rL($)} "${$.key}" in store "${H.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let f=new iH,D=Object.assign((M)=>{let o=pH(M),u={key:A.key,subKey:o},t=`${A.key}(${o})`,i=N(H),B=CE(i,{key:t,get:A.get(M)},u);return f.next({type:"state_creation",token:B}),B},I,{internalRoles:L,subject:f,install:(M)=>JI(M,A),default:(M)=>{return A.get(M)({get:(...u)=>mH(H,...u),find:(...u)=>q(H,...u),json:(u)=>iA(H,u)})}});return H.families.set(A.key,D),I}function S0(H,A){if("set"in A)return TE(H,A);return JI(H,A)}class bD{_buffer;_index=0;constructor(H){let A;if(typeof H==="number")A=H;else A=H.length;this._buffer=Array.from({length:A})}get buffer(){return this._buffer}get index(){return this._index}add(H){this._buffer[this._index]=H,this._index=(this._index+1)%this._buffer.length}copy(){let H=new bD([...this._buffer]);return H._index=this._index,H}}var H5={atom_family:"atom",mutable_atom_family:"mutable_atom",selector_family:"selector",readonly_selector_family:"readonly_selector",molecule_family:"molecule"};function J0(H,A){let L=pH(A),I=`${H.key}(${L})`,$=H5[H.type],f={key:I,type:$};return Object.assign(f,{family:{key:H.key,subKey:L}}),Object.assign(f,{counterfeit:!0}),f}function jL(H){let A={key:H.key,type:H.type};if("family"in H)A.family=H.family;return A}class pA{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(H,A)=>`${H}:${A}`;warn;getRelatedKeys(H){return this.relations.get(H)}addRelation(H,A){let L=this.relations.get(H),I=this.relations.get(A);if(L)L.add(A);else L=new Set([A]),this.relations.set(H,L);if(I)I.add(H);else I=new Set([H]),this.relations.set(A,I)}deleteRelation(H,A){let L=this.relations.get(H);if(L){if(L.delete(A),L.size===0)this.relations.delete(H);let I=this.relations.get(A);if(I){if(I.delete(H),I.size===0)this.relations.delete(A)}}}replaceRelationsUnsafely(H,A){this.relations.set(H,new Set(A));for(let L of A){let I=new Set().add(H);this.relations.set(L,I)}}replaceRelationsSafely(H,A){let L=this.relations.get(H),I=this.isAType?.(H)?H:void 0,$=I===void 0?H:void 0;if(L)for(let f of L){I??=f,$??=f;let E=this.relations.get(f);if(E){if(E.size===1)this.relations.delete(f);else E.delete(H);this.contents.delete(this.makeContentKey(I,$))}}this.relations.set(H,new Set(A));for(let f of A){let E=this.relations.get(f);if(E)E.add(H);else E=new Set().add(H),this.relations.set(f,E)}}getContentInternal(H){return this.contents.get(H)}setContent(H,A){this.contents.set(H,A)}deleteContent(H){this.contents.delete(H)}constructor(H,A){if(this.a=H.between[0],this.b=H.between[1],this.cardinality=H.cardinality,!A?.externalStore)this.relations=new Map(H.relations?.map(([L,I])=>[L,new Set(I)])),this.contents=new Map(H.contents);if(this.isAType=A?.isAType??null,this.isBType=A?.isBType??null,this.isContent=A?.isContent??null,A?.makeContentKey)this.makeContentKey=A.makeContentKey;if(A?.externalStore){let L=A.externalStore;if(this.has=(I,$)=>L.has(I,$),this.addRelation=(I,$)=>{L.addRelation(I,$)},this.deleteRelation=(I,$)=>{L.deleteRelation(I,$)},this.replaceRelationsSafely=(I,$)=>{L.replaceRelationsSafely(I,$)},this.replaceRelationsUnsafely=(I,$)=>{L.replaceRelationsUnsafely(I,$)},this.getRelatedKeys=(I)=>L.getRelatedKeys(I),L.getContent)this.getContentInternal=(I)=>{return L.getContent(I)},this.setContent=(I,$)=>{L.setContent(I,$)},this.deleteContent=(I)=>{L.deleteContent(I)};for(let[I,$]of H.relations??[]){let f=this.isAType?.(I)?I:void 0,E=f===void 0?I:void 0;for(let D of $)f??=D,E??=D,this.addRelation(f,E)}for(let[I,$]of H.contents??[])this.setContent(I,$)}if(A?.warn)this.warn=A.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([H,A])=>[H,[...A]]),contents:[...this.contents.entries()]}}set(...H){let A,L,I;switch(H.length){case 1:{let $=H[0];A=$[this.a],L=$[this.b],I=void 0;break}case 2:{let $=H[0];if(typeof $==="string")[A,L]=H;else A=$[this.a],L=$[this.b],I=H[1];break}default:{A=H[0],L=H[1],I=H[2];break}}switch(this.cardinality){case"1:1":{let $=this.getRelatedKey(A);if($&&$!==L)this.delete(A,$)}case"1:n":{let $=this.getRelatedKey(L);if($&&$!==A)this.delete($,L)}break;case"n:n":}if(I){let $=this.makeContentKey(A,L);this.setContent($,I)}return this.addRelation(A,L),this}delete(H,A){A=typeof A==="string"?A:H[this.b];let L=typeof H==="string"?H:H[this.a];if(L===void 0&&typeof A==="string"){let I=this.getRelatedKeys(A);if(I)for(let $ of I)this.delete($,A)}if(typeof L==="string"&&A===void 0){let I=this.getRelatedKeys(L);if(I)for(let $ of I)this.delete(L,$)}if(typeof L==="string"&&typeof A==="string"){this.deleteRelation(L,A);let I=this.makeContentKey(L,A);this.deleteContent(I)}return this}getRelatedKey(H){let A=this.getRelatedKeys(H);if(A){if(A.size>1)this.warn?.(`${A.size} related keys were found for key "${H}": (${[...A].map((I)=>`"${I}"`).join(", ")}). Only one related key was expected.`);let L;for(let I of A){L=I;break}return L}}replaceRelations(H,A,L){let I=!Array.isArray(A),$=I?Object.keys(A):A;if(L?.reckless)this.replaceRelationsUnsafely(H,$);else this.replaceRelationsSafely(H,$);if(I)for(let f of $){let E=this.makeContentKey(H,f),D=A[f];this.setContent(E,D)}return this}getContent(H,A){let L=this.makeContentKey(H,A);return this.getContentInternal(L)}getRelationEntries(H){let A=H[this.a],L=H[this.b];if(A!==void 0&&L===void 0){let I=this.getRelatedKeys(A);if(I)return[...I].map(($)=>{return[$,this.getContent(A,$)]})}if(A===void 0&&L!==void 0){let I=this.getRelatedKeys(L);if(I)return[...I].map(($)=>{return[$,this.getContent($,L)]})}return[]}has(H,A){if(A)return this.getRelatedKeys(H)?.has(A)??!1;return this.relations.has(H)}}function FA(H){return"epoch"in H.transactionMeta}function PH(H){return"phase"in H.transactionMeta}var V0=(H)=>{let A=N(H);if(!PH(A)){H.logger.warn("\uD83D\uDC1E","transaction","???","abortTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}H.logger.info("\uD83E\uDE82","transaction",A.transactionMeta.update.key,"Aborting transaction"),A.parent.child=null};function XH(H){return H[0].toUpperCase()+H.slice(1)}function rL(H){return H.type.split("_").map(XH).join(" ")}class H$ extends Error{constructor(H,A){super(`${rL(H)} ${pH(H.key)} not found in store "${A.config.name}".`)}}function q$(H,A,L){return(...I)=>{let $=CH(H,A);if($)return $.run(I,L);throw new H$(A,H)}}var ZD=(H)=>(A)=>H instanceof Function?H(A):H;var VI=(H,A)=>{if(H.valueMap.has(A.key))return H.logger.info("\uD83D\uDCD6",A.type,A.key,"reading cached value"),w0(A,H);switch(A.type){case"selector":case"readonly_selector":return H.logger.info("\uD83E\uDDEE",A.type,A.key,"computing value"),A.get();case"atom":case"mutable_atom":{let L=A.default,I;if(L instanceof Function)I=L();else I=L;return H.logger.info("\uD83D\uDC81","atom",A.key,"could not find cached value; using default",I),I}}};var K0=(H,A)=>{if(H.operation.open){let L=performance.now();return H.logger.info("\u2757",A.type,A.key,`deferring setState at T-${L} until setState for "${H.operation.token.key}" is done`),L}H.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:A},H.logger.info("\u2B55",A.type,A.key,`operation start in store "${H.config.name}"${!PH(H)?"":` ${H.transactionMeta.phase} "${H.transactionMeta.update.key}"`}`)},v0=(H)=>{if(H.operation.open)H.logger.info("\uD83D\uDD34",H.operation.token.type,H.operation.token.key,`operation done in store "${H.config.name}"`);H.operation={open:!1},H.on.operationClose.next(H.operation)},a0=(H,A)=>{if(!H.operation.open)return H.logger.error("\uD83D\uDC1E","unknown",A,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0;return H.operation.done.has(A)},g$=(H,A)=>{if(!H.operation.open){H.logger.error("\uD83D\uDC1E","unknown",A,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}H.operation.done.add(A)};var l0=(H,A,L)=>{switch(A.type){case"mutable_atom":H.logger.info("\uD83D\uDCE2",A.type,A.key,"is now (",L.newValue,") subscribers:",A.subject.subscribers);break;case"atom":case"selector":case"readonly_selector":H.logger.info("\uD83D\uDCE2",A.type,A.key,"went (",L.oldValue,"->",L.newValue,") subscribers:",A.subject.subscribers)}A.subject.next(L)};var fu=(H,A)=>{let L=N(H),I=L.selectorAtoms.getRelatedKeys(A.key);if(L.logger.info("\uD83E\uDDF9",A.type,A.key,I?`evicting ${I.size} states downstream:`:"no downstream states",I??"to evict"),I){if(L.operation.open)L.logger.info("\uD83E\uDDF9",A.type,A.key,`[ ${[...L.operation.done].join(", ")} ] already done`);for(let $ of I){if(a0(L,$))continue;O0($,L),g$(L,$)}}};var s0=(H,A,L)=>{let I=VI(H,A),$=I;if(A.type==="mutable_atom"&&PH(H)){let{parent:E}=H;$=GE(H,A,E)}if($=ZD(L)($),H.logger.info("\uD83D\uDCDD","atom",A.key,"set to",$),$=cL(H,A.key,$,A.subject),y0(H,A.key))R0(H,A.key);g$(H,A.key),fu(H,A);let f={oldValue:I,newValue:$};if(!PH(H)){l0(H,A,f);return}if(H.on.transactionApplying.state===null){let{key:E}=A;if(N0(f.newValue))return;let D={type:"atom_update",key:E,...f};if(A.family)D.family=A.family;H.transactionMeta.update.updates.push(D),H.logger.info("\uD83D\uDCC1","atom",E,"stowed (",f.oldValue,"->",f.newValue,")")}else if(A.key.startsWith("*")){let E=A.key.slice(1),D=H.atoms.get(E),M=H.valueMap.get(E);if(D.type==="mutable_atom"&&PH(H)){let{parent:u}=H;M=GE(H,D,u)}if(M.do(f.newValue)===null)fu(H,D)}};var hD=(H,A,L)=>{switch(A.type){case"atom":case"mutable_atom":s0(H,A,L);break;case"selector":A.set(L);break}};function Y0(H,A){if(A.family){let L=H.families.get(A.family.key);if(L)return L}}function vH(H,...A){let L,I,$,f;if(A.length===2){if(L=A[0],f=A[1],I=Y0(H,L)??null,I)$=L.family?xA(L.family.subKey):null,L=q(H,I,$)}else I=A[0],$=A[1],f=A[2],L=q(H,I,$);if("counterfeit"in L&&"family"in L){let M=L.family.subKey,o=H.disposalTraces.buffer.find((u)=>u?.key===M);H.logger.error("\u274C",L.type,L.key,`could not be set because it was not found in the store "${H.config.name}".`,o?`This state was previously disposed:
86
- ${o.trace}`:"No previous disposal trace was found.");return}let E=K0(H,L);if(E){let M=H.on.operationClose.subscribe(`waiting to set "${L.key}" at T-${E}`,()=>{M(),H.logger.info("\uD83D\uDFE2",L.type,L.key,`resuming deferred setState from T-${E}`),vH(H,L,f)});return}let D=CH(H,L);hD(H,D,f),v0(H)}function rD(H,A,L){let{key:I,newValue:$,oldValue:f}=A,E=H==="newValue"?$:f,D={key:I,type:"atom"};if(A.family)Object.assign(D,{family:A.family});vH(L,D,E)}function Q0(H){let{stack:A}=H;if(A)return`
87
- `+A.split(`
85
+ `)+"}");class Qm{config;resolvedConfig;name;get[No](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(i,o){if(this.config=rx(V.config,o),this.resolvedConfig=rx(V.resolvedConfig,o),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(Vf).length}`,this.name in Vf)H(`A Scope already named ${this.name} already exists`);Vf[this.name]=this,Object.entries(i).map((p)=>this.preparseOwnAliasEntry(...p)).forEach(([p,c])=>{let x=p;if(p[0]==="#"){if(x=p.slice(1),x in this.aliases)H(Pv(x));this.aliases[x]=c}else{if(x in this.aliases)H(Pv(p));this.aliases[x]=c,this.exportedNames.push(x)}if(!a(c,"module")&&!a(c,"generic")&&!Hp(c)){let T=this.preparseOwnDefinitionFormat(c,{alias:x});if(a(T,"root"))this.resolutions[x]=this.bindReference(T);else this.resolutions[x]=this.createParseContext(T).id}}),av??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[av.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=V.intrinsic?pi(V.intrinsic,(p,c)=>p.startsWith("json")?[]:[p,this.bindReference(c)]):{}}cacheGetter(i,o){return Object.defineProperty(this,i,{value:o}),o}get internal(){return this}_json;get json(){if(!this._json)this.export();return this._json}defineSchema(i){return i}generic=(...i)=>{let o=this;return(n,p)=>new zp(i,p?new Gm(n):n,o,o,p??null)};units=(i,o)=>{let n=[];for(let c of i)if(!n.includes(c))n.push(c);let p=n.map((c)=>this.node("unit",{unit:c},o));return this.node("union",p,{...o,prereduced:!0})};lazyResolutions=[];lazilyResolve(i,o){let n=this.node("alias",{reference:o??"synthetic",resolve:i},{prereduced:!0});if(!this.resolved)this.lazyResolutions.push(n);return n}schema=(i,o)=>this.finalize(this.parseSchema(i,o));parseSchema=(i,o)=>this.node(nT(i),i,o);preparseNode(i,o,n){let p=typeof i==="string"?i:nT(o,i);if(Ii(o)&&o.kind===p)return o;if(p==="alias"&&!n?.prereduced){let{reference:T}=fT.implementation.normalize(o,this);if(T.startsWith("$")){let m=this.resolveRoot(T.slice(1));o=m,p=m.kind}}else if(p==="union"&&qo(o,"object")){let T=CK(o);if(T?.length===1)o=T[0],p=nT(o)}if(Ii(o)&&o.kind===p)return o;let x=jc[p].normalize?.(o,this)??o;if(Ii(x))return x.kind===p?x:yK(p,x.kind);return{...n,$:this,kind:p,def:x,prefix:n.alias??p}}bindReference(i){let o;if(Ii(i))o=i.$===this?i:new i.constructor(i.attachments,this);else o=i.$===this?i:new zp(i.params,i.bodyDef,i.$,this,i.hkt);if(!this.resolved)Object.assign(this.referencesById,o.referencesById);return o}resolveRoot(i){return this.maybeResolveRoot(i)??H(Of(i))}maybeResolveRoot(i){let o=this.maybeResolve(i);if(a(o,"generic"))return;return o}maybeResolveSubalias(i){return Sf(this.aliases,i)??Sf(this.ambient,i)}get ambient(){return V.ambient}maybeResolve(i){let o=this.resolutions[i];if(o){if(typeof o!=="string")return this.bindReference(o);let p=bo[o];if(a(p,"root"))return this.resolutions[i]=p;if(a(p,"context")){if(p.phase==="resolving")return this.node("alias",{reference:`$${i}`},{prereduced:!0});if(p.phase==="resolved")return Xi(`Unexpected resolved context for was uncached by its scope: ${oi(p)}`);p.phase="resolving";let c=this.bindReference(this.parseOwnDefinitionFormat(p.def,p));return p.phase="resolved",bo[c.id]=c,bo[p.id]=c,this.resolutions[i]=c}return Xi(`Unexpected nodesById entry for ${o}: ${oi(p)}`)}let n=this.aliases[i]??this.ambient?.[i];if(!n)return this.maybeResolveSubalias(i);if(n=this.normalizeRootScopeValue(n),a(n,"generic"))return this.resolutions[i]=this.bindReference(n);if(a(n,"module"))if(n.root)return this.resolutions[i]=this.bindReference(n.root);else return H(tv(i));return this.resolutions[i]=this.parse(n,{alias:i})}createParseContext(i){let o=i.id??Jf(i.prefix);return bo[o]=Object.assign(i,{[No]:"context",$:this,id:o,phase:"unresolved"})}traversal(i){return new On(i,this.resolvedConfig)}import(...i){return new lc(pi(this.export(...i),(o,n)=>[`#${o}`,n]))}precompilation;_exportedResolutions;_exports;export(...i){if(!this._exports){this._exports={};for(let n of this.exportedNames){let p=this.aliases[n];this._exports[n]=a(p,"module")?Qf(p,this):lv(this.maybeResolve(n))}if(this.lazyResolutions.forEach((n)=>n.resolution),this._exportedResolutions=sv(this,this._exports),this._json=gv(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let n=hv(this.references);this.precompilation=n.write(qv,4),kv(this.references,n)}this.resolved=!0}let o=i.length?i:this.exportedNames;return new lc(pi(o,(n,p)=>[p,this._exports[p]]))}resolve(i){return this.export()[i]}node=(i,o,n={})=>{let p=this.preparseNode(i,o,n);if(Ii(p))return this.bindReference(p);let c=this.createParseContext(p),x=Af(c),T=this.bindReference(x);return bo[c.id]=T};parse=(i,o={})=>this.finalize(this.parseDefinition(i,o));parseDefinition(i,o={}){if(a(i,"root"))return this.bindReference(i);let n=this.preparseOwnDefinitionFormat(i,o);if(a(n,"root"))return this.bindReference(n);let p=this.createParseContext(n);bo[p.id]=p;let c=this.bindReference(this.parseOwnDefinitionFormat(i,p));if(c.isCyclic)c=Wv(c,p.id);return bo[p.id]=c,c}finalize(i){if(lv(i),!i.precompilation&&!this.resolvedConfig.jitless)DK(i.references);return i}}class Ef extends Qm{parseOwnDefinitionFormat(i,o){return Af(o)}preparseOwnDefinitionFormat(i,o){return this.preparseNode(nT(i),i,o)}preparseOwnAliasEntry(i,o){return[i,o]}normalizeRootScopeValue(i){return i}}var lv=(i)=>{return i.references.filter((o)=>o.hasKind("alias")).forEach((o)=>{Object.assign(o.referencesById,o.resolution.referencesById),i.references.forEach((n)=>{if(o.id in n.referencesById)Object.assign(n.referencesById,o.referencesById)})}),i},gv=(i)=>pi(i,(o,n)=>[o,a(n,"root")||a(n,"generic")?n.json:a(n,"module")?gv(n):Xi(`Unexpected resolution ${oi(n)}`)]),Sf=(i,o)=>{let n=o.indexOf(".");if(n===-1)return;let p=o.slice(0,n),c=i[p];if(c===void 0)return;if(!a(c,"module"))return H(IK(p));let x=o.slice(n+1),T=c[x];if(T===void 0)return Sf(c,x);if(a(T,"root")||a(T,"generic"))return T;if(a(T,"module"))return T.root??H(tv(o));Xi(`Unexpected resolution for alias '${o}': ${oi(T)}`)},Vm=(i,o)=>new Ef(i,o),JT=new Ef({});var sv=(i,o)=>{let n={};for(let p in o){let c=o[p];if(a(c,"module")){let x=sv(i,c),T=pi(x,(m,f)=>[`${p}.${m}`,f]);Object.assign(n,T)}else if(a(c,"root")||a(c,"generic"))n[p]=c;else Xi(`Unexpected scope resolution ${oi(c)}`)}return n},Of=(i)=>`'${i}' is unresolvable`,IK=(i)=>`'${i}' must reference a module to be accessed using dot syntax`,tv=(i)=>`Reference to submodule '${i}' must specify an alias`;JT.export();var{schema:Zi,node:qc,defineSchema:fB,generic:Xn}=JT;var _f="^(?:0|[1-9]\\d*)$",BK=new RegExp(_f),JB=ki(BK);var dv=Vm({bigint:"bigint",boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:"number",object:"object",string:"string",symbol:"symbol",true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();V.intrinsic={...dv};var rv=Vm({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:_f}},{prereducedAliases:!0}).export();Object.assign(V.intrinsic,rv);var NK=Vm({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),h={...dv,...rv,...NK,emptyStructure:qc("structure",{},{prereduced:!0})};V.intrinsic={...h};var i4=(i)=>typeof i==="string"&&i[0]==="d"&&(i[1]==="'"||i[1]==='"')&&i.at(-1)===i[1],ev=(i)=>i.toString()!=="Invalid Date",o4=(i)=>i.slice(2,-1),Lf=(i)=>`'${i}' could not be parsed by the Date constructor`,n4=(i,o)=>bK(i,o),bK=(i,o)=>{let n=new Date(i);if(ev(n))return n;let p=CA(i);if(p!==void 0){let c=new Date(p);if(ev(c))return c}return o?H(o===!0?Lf(i):o):void 0};var Cf=(i,o)=>{let n=i.scanner.shiftUntil(jK[c4[o]]);if(i.scanner.lookahead==="")return i.error(aK(n,o));if(i.scanner.shift(),o==="/"){try{new RegExp(n)}catch(p){H(String(p))}i.root=i.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(di(o,yf))i.root=i.ctx.$.node("unit",{unit:n});else{let p=n4(n,Lf(n));i.root=i.ctx.$.node("unit",{meta:n,unit:p})}},yf={"'":1,'"':1},p4={"/":1,"'":1,'"':1},c4={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},jK={"'":(i)=>i.lookahead==="'",'"':(i)=>i.lookahead==='"',"/":(i)=>i.lookahead==="/"},PK={'"':"double-quote","'":"single-quote","/":"forward slash"},aK=(i,o)=>`${o}${i} requires a closing ${PK[c4[o]]}`;var x4=(i)=>`Private type references should not include '#'. Use '${i}' instead.`,Sm="Optional definitions like 'string?' are only valid as properties in an object or tuple",Em="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";var T4={">":!0,">=":!0},m4={"<":!0,"<=":!0};var kc={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},f4=(i)=>`Unmatched )${i===""?"":` before ${i}`}`,Om=(i)=>`Missing ${i}`,F4=(i,o)=>`Left bounds are only valid when paired with right bounds (try ...${o}${i})`,_m=(i)=>`Left-bounded expressions must specify their limits using < or <= (was ${i})`,$4=(i,o,n,p)=>`An expression may have at most one left bound (parsed ${i}${kc[o]}, ${n}${kc[p]})`;var J4=(i,o,n)=>A4(i,o,n,[]),A4=(i,o,n,p)=>{let c=n.parseUntilFinalizer();if(p.push(c.root),c.finalizer===">"){if(p.length!==o.params.length)return n.error(Df(i,o.names,p.map((x)=>x.expression)));return p}if(c.finalizer===",")return A4(i,o,n,p);return c.error(Om(">"))},Df=(i,o,n)=>`${i}<${o.join(", ")}> requires exactly ${o.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`;var If=(i)=>{let o=i.scanner.shiftUntilNextTerminator();if(o==="keyof")i.addPrefix("keyof");else i.root=qK(i,o)},lK=(i,o,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(Df(i,o.names,[]));let c=J4(i,o,n);return o(...c)},qK=(i,o)=>kK(i,o)??hK(i,o)??i.error(o===""?i.scanner.lookahead==="#"?x4(i.shiftedByOne().scanner.shiftUntilNextTerminator()):Bf(i):Of(o)),kK=(i,o)=>{if(i.ctx.args?.[o]){let p=i.ctx.args[o];if(typeof p!=="string")return p;return i.ctx.$.node("alias",{reference:p},{prereduced:!0})}let n=i.ctx.$.maybeResolve(o);if(a(n,"root"))return n;if(n===void 0)return;if(a(n,"generic"))return lK(o,n,i);return H(`Unexpected resolution ${oi(n)}`)},hK=(i,o)=>{let n=yA(o);if(n!==void 0)return i.ctx.$.node("unit",{unit:n});let p=IA(o);if(p!==void 0)return i.ctx.$.node("unit",{unit:p})},Bf=(i)=>{let o=i.previousOperator();return o?Nf(o,i.scanner.unscanned):gK(i.scanner.unscanned)},Nf=(i,o="")=>`Token '${i}' requires a right operand${o?` before '${o}'`:""}`,gK=(i)=>`Expected an expression${i?` before '${i}'`:""}`;var bf=(i)=>i.scanner.lookahead===""?i.error(Bf(i)):i.scanner.lookahead==="("?i.shiftedByOne().reduceGroupOpen():i.scanner.lookaheadIsIn(p4)?Cf(i,i.scanner.shift()):i.scanner.lookaheadIsIn(Up)?bf(i.shiftedByOne()):i.scanner.lookahead==="d"?i.scanner.nextLookahead in yf?Cf(i,`${i.scanner.shift()}${i.scanner.shift()}`):If(i):If(i);class Fp extends q1{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in Fp.terminatingChars))}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...Up};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=(i,o)=>i===">"?o[0]==="="?o[1]==="=":o.trimStart()===""||di(o.trimStart()[0],Fp.terminatingChars):i==="="?o[0]!=="=":i===","||i==="?"}var w4=(i,o)=>{let n=sK(i,o);if(i.root.hasKind("unit")){if(typeof i.root.unit==="number"){i.reduceLeftBound(i.root.unit,n),i.unsetRoot();return}if(i.root.unit instanceof Date){let p=`d'${i.root.description??i.root.unit.toISOString()}'`;i.unsetRoot(),i.reduceLeftBound(p,n);return}}return dK(i,n)},X4={"<":1,">":1,"=":1},sK=(i,o)=>i.scanner.lookaheadIs("=")?`${o}${i.scanner.shift()}`:o;var v4=(i,o,n,p)=>{if(n.extends(V.intrinsic.number)){if(typeof o!=="number")return H(jf(i,o,p));return i==="=="?["min","max"]:i[0]===">"?["min"]:["max"]}if(n.extends(V.intrinsic.lengthBoundable)){if(typeof o!=="number")return H(jf(i,o,p));return i==="=="?["exactLength"]:i[0]===">"?["minLength"]:["maxLength"]}if(n.extends(V.intrinsic.Date))return i==="=="?["after","before"]:i[0]===">"?["after"]:["before"];return H(pv(n.expression))},tK=(i)=>({rule:i4(i.limit)?o4(i.limit):i.limit,exclusive:i.comparator.length===1}),dK=(i,o)=>{let n=i.unsetRoot(),p=i.scanner.location;i.parseOperand();let c=i.unsetRoot(),x=i.scanner.sliceChars(p,i.scanner.location);if(i.root=n,!c.hasKind("unit")||typeof c.unit!=="number"&&!(c.unit instanceof Date))return i.error(jf(o,x,"right"));let T=c.unit,m=o.length===1,f=v4(o,typeof T==="number"?T:x,n,"right");for(let $ of f)i.constrainRoot($,o==="=="?{rule:T}:{rule:T,exclusive:m});if(!i.branches.leftBound)return;if(!di(o,m4))return i.error(_m(o));let F=v4(i.branches.leftBound.comparator,i.branches.leftBound.limit,n,"left");i.constrainRoot(F[0],tK(i.branches.leftBound)),i.branches.leftBound=null},jf=(i,o,n)=>`Comparator ${n==="left"?kc[i]:i} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${o})`;var W4=(i)=>{i.scanner.shiftUntilNonWhitespace();let o=i.scanner.shiftUntilNextTerminator();i.root=i.root.brand(o)};var Y4=(i)=>{let o=i.scanner.shiftUntilNextTerminator(),n=DA(o,{errorOnFail:R4(o)});if(n===0)i.error(R4(0));i.root=i.root.constrain("divisor",n)},R4=(i)=>`% operator must be followed by a non-zero integer literal (was ${i})`;var Pf=(i)=>{let o=i.scanner.shift();return o===""?i.finalize(""):o==="["?i.scanner.shift()==="]"?i.setRoot(i.root.array()):i.error(rK):o==="|"?i.scanner.lookahead===">"?i.shiftedByOne().pushRootToBranch("|>"):i.pushRootToBranch(o):o==="&"?i.pushRootToBranch(o):o===")"?i.finalizeGroup():Fp.lookaheadIsFinalizing(o,i.scanner.unscanned)?i.finalize(o):di(o,X4)?w4(i,o):o==="%"?Y4(i):o==="#"?W4(i):(o in Up)?Pf(i):i.error(Lm(o))},Lm=(i,o="")=>`'${i}' is not allowed here${o&&` (should be ${o})`}`,rK="Missing expected ']'";var G4=(i)=>{let o=i.unsetRoot();i.parseOperand();let n=i.unsetRoot();if(!n.hasKind("unit"))return i.error(eK(n.expression));let p=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[o,"=",p]},eK=(i)=>`Default value '${i}' must a literal value`;var af=(i,o)=>{let n=o.$.maybeResolveRoot(i);if(n)return n;if(i.endsWith("[]")){let x=o.$.maybeResolveRoot(i.slice(0,-2));if(x)return x.array()}let p=new hc(new Fp(i),o),c=iH(p);if(p.finalizer===">")H(Lm(">"));return c},iH=(i)=>{i.parseOperand();let o=AT(i).root;if(!o)return Xi(`Root was unexpectedly unset after parsing string '${i.scanner.scanned}'`);if(i.finalizer==="=")o=G4(i);else if(i.finalizer==="?")o=[o,"?"];if(i.scanner.shiftUntilNonWhitespace(),i.scanner.lookahead)H(Lm(i.scanner.lookahead));return o},AT=(i)=>{while(i.finalizer===void 0)oH(i);return i},oH=(i)=>i.hasRoot()?i.parseOperator():i.parseOperand();class hc{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(i,o){this.scanner=i,this.ctx=o}error(i){return H(i)}hasRoot(){return this.root!==void 0}setRoot(i){this.root=i}unsetRoot(){let i=this.root;return this.root=void 0,i}constrainRoot(...i){this.root=this.root.constrain(i[0],i[1])}finalize(i){if(this.groups.length)return this.error(Om(")"));this.finalizeBranches(),this.finalizer=i}reduceLeftBound(i,o){let n=kc[o];if(!di(n,T4))return this.error(_m(o));if(this.branches.leftBound)return this.error($4(this.branches.leftBound.limit,this.branches.leftBound.comparator,i,n));this.branches.leftBound={comparator:n,limit:i}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch("|>"),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch("|"),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch("&"),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();let i=this.groups.pop();if(!i)return this.error(f4(this.scanner.unscanned));this.branches=i}addPrefix(i){this.branches.prefixes.push(i)}applyPrefixes(){while(this.branches.prefixes.length){let i=this.branches.prefixes.pop();this.root=i==="keyof"?this.root.keyof():Xi(`Unexpected prefix '${i}'`)}}pushRootToBranch(i){this.assertRangeUnset(),this.applyPrefixes();let o=this.root;if(this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(o)??o,i==="&")return;if(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,i==="|")return;this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null}parseUntilFinalizer(){return AT(new hc(this.scanner,this.ctx))}parseOperator(){return Pf(this)}parseOperand(){return bf(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(F4(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes.at(-1)??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedByOne(){return this.scanner.shift(),this}}var nH="An empty string is not a valid generic parameter name",Cm=(i,o,n)=>{i.shiftUntilNonWhitespace();let p=i.shiftUntilNextTerminator();if(p===""){if(i.lookahead===""&&o.length)return o;return H(nH)}return i.shiftUntilNonWhitespace(),pH(i,p,o,n)},K4="extends ",pH=(i,o,n,p)=>{if(i.shiftUntilNonWhitespace(),i.unscanned.startsWith(K4))i.jumpForward(K4.length);else{if(i.lookahead===",")i.shift();return n.push(o),Cm(i,n,p)}let c=AT(new hc(i,p));return n.push([o,c.root]),Cm(i,n,p)};class lf extends En{$;constructor(i){super((...o)=>new vT(i)(...o),{bind:i});this.$=i}in(i){return new vT(this.$,i===void 0?void 0:this.$.parse(i))}at(i,o){return new vT(this.$).at(i,o)}case(i,o){return new vT(this.$).case(i,o)}}class vT extends En{$;in;key;branches=[];constructor(i,o){super((n)=>this.caseEntries(Object.entries(n).map(([p,c])=>p==="default"?[p,c]:[this.$.parse(p),c])));this.$=i,this.in=o}at(i,o){if(this.key)H(xH);if(this.branches.length)H(cH);return this.key=i,o?this.match(o):this}case(i,o){return this.caseEntry(this.$.parse(i),o)}caseEntry(i,o){let p=(this.key?this.$.parse({[this.key]:i}):i).pipe(o);return this.branches.push(p),this}match(i){return this(i)}strings(i){return this.caseEntries(Object.entries(i).map(([o,n])=>o==="default"?[o,n]:[this.$.node("unit",{unit:o}),n]))}caseEntries(i){for(let o=0;o<i.length;o++){let[n,p]=i[o];if(n==="default"){if(o!==i.length-1)H("default may only be specified as the last key of a switch definition");return this.default(p)}if(typeof p!=="function")return H(`Value for case "${n}" must be a function (was ${Fo(p)})`);this.caseEntry(n,p)}return this}default(i){if(typeof i==="function")this.case(h.unknown,i);let o={branches:this.branches,ordered:!0};if(i==="never"||i==="assert")o.meta={onFail:H4};let n=this.$.node("union",o);if(!this.in)return this.$.finalize(n);let p=this.in.pipe(n);if(i==="never"||i==="assert")p=p.configureReferences({onFail:H4},"self");return this.$.finalize(p)}}var H4=(i)=>i.throw(),cH="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",xH="At most one key matcher may be specified per expression";var ym=(i,o)=>{if(Oi(i)){if(i[1]==="=")return[o.$.parseOwnDefinitionFormat(i[0],o),"=",i[2]];if(i[1]==="?")return[o.$.parseOwnDefinitionFormat(i[0],o),"?"]}return Dm(i,o)},U4="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",Z4="Only required keys may specify default values, e.g. { value: 'number = 0' }";var M4=(i,o)=>{let n,p={},c=Px(i);for(let[T,m]of c){let f=fH(T);if(f.kind==="spread"){if(!qn(p))return H(mH);let X=o.$.parseOwnDefinitionFormat(m,o);if(X.equals(h.object))continue;if(!X.hasKind("intersection")||!X.basis?.equals(h.object))return H(FH(X.expression));n=X.structure;continue}if(f.kind==="undeclared"){if(m!=="reject"&&m!=="delete"&&m!=="ignore")H(TH(m));p.undeclared=m;continue}let F=ym(m,o),$=f;if(f.kind==="required"){if(!Oi(F))qf(p,"required",{key:f.normalized,value:F},o);else qf(p,"optional",F[1]==="="?{key:f.normalized,value:F[0],default:F[2]}:{key:f.normalized,value:F[0]},o);continue}if(Oi(F)){if(F[1]==="?")H(U4);if(F[1]==="=")H(Z4)}if(f.kind==="optional"){qf(p,"optional",{key:f.normalized,value:F},o);continue}let J=o.$.parseOwnDefinitionFormat($.normalized,o),A=um(J,F,o.$);if(A.index)p.index=Ai(p.index,A.index);if(A.required)p.required=Ai(p.required,A.required)}let x=o.$.node("structure",p);return o.$.parseSchema({domain:"object",structure:n?.merge(x)??x})},qf=(i,o,n,p)=>{i[o]=Ai(i[o],p.$.node(o,n))},TH=(i)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${oi(i)})`,mH="Spread operator may only be used as the first key in an object",fH=(i)=>typeof i==="symbol"?{kind:"required",normalized:i}:i.at(-1)==="?"?i.at(-2)===kx?{kind:"required",normalized:`${i.slice(0,-2)}?`}:{kind:"optional",normalized:i.slice(0,-1)}:i[0]==="["&&i.at(-1)==="]"?{kind:"index",normalized:i.slice(1,-1)}:i[0]===kx&&i[1]==="["&&i.at(-1)==="]"?{kind:"required",normalized:i.slice(1)}:i==="..."?{kind:"spread"}:i==="+"?{kind:"undeclared"}:{kind:"required",normalized:i==="\\..."?"...":i==="\\+"?"+":i},FH=(i)=>`Spread operand must resolve to an object literal type (was ${i})`;var u4=(i,o)=>GH(i)?E4[i[0]](i,o):RH(i)?S4[i[1]](i,o):null,$H=(i,o)=>o.$.parseOwnDefinitionFormat(i[1],o).keyof(),kf=(i,o)=>{if(i[2]===void 0)return H(Nf(i[1],""));let n=o.$.parseOwnDefinitionFormat(i[0],o),p=o.$.parseOwnDefinitionFormat(i[2],o);if(i[1]==="|")return o.$.node("union",{branches:[n,p]});let c=i[1]==="&"?so(n,p,o.$):oT(n,p,o.$);if(c instanceof L)return c.throw();return c},JH=(i,o)=>o.$.parseOwnDefinitionFormat(i[0],o).array(),AH=(i,o)=>{if(typeof i[2]!=="function")return H(Q4("=>",i[2]));return o.$.parseOwnDefinitionFormat(i[0],o).pipe(i[2])},Q4=(i,o)=>`${i===":"?"Narrow":"Morph"} expression requires a function following '${i}' (was ${typeof o})`,vH=(i,o)=>{if(typeof i[2]!=="function")return H(Q4(":",i[2]));return o.$.parseOwnDefinitionFormat(i[0],o).constrain("predicate",i[2])},wH=(i,o)=>o.$.parseOwnDefinitionFormat(i[0],o).configureReferences(i[2],"shallow"),V4=(i)=>i,XH=V4({"[]":JH,"?":()=>H(Sm)}),WH=V4({"|":kf,"&":kf,":":vH,"=>":AH,"|>":kf,"@":wH,"=":()=>H(Em)}),S4={...XH,...WH},RH=(i)=>S4[i[1]]!==void 0,YH=(i)=>i,E4=YH({keyof:$H,instanceof:(i,o)=>{if(typeof i[1]!=="function")return H(z4(lx(i[1])));let n=i.slice(1).map((p)=>typeof p==="function"?o.$.node("proto",{proto:p}):H(z4(lx(p))));return n.length===1?n[0]:o.$.node("union",{branches:n})},"===":(i,o)=>o.$.units(i.slice(1))}),GH=(i)=>E4[i[0]]!==void 0,z4=(i)=>`Expected a constructor following 'instanceof' operator (was ${i})`;var L4=(i,o)=>{let n=[{}],p=0;while(p<i.length){let c=!1;if(i[p]==="..."&&p<i.length-1)c=!0,p++;let x=ym(i[p],o),[T,m,f]=!Oi(x)?[x]:x;if(p++,c){if(!T.extends(V.intrinsic.Array))return H(UH(T.expression));n=n.flatMap((F)=>T.distribute(($)=>HH(Xm(F),$)))}else n=n.map((F)=>{if(m==="?")return C4(F,T);if(m==="=")return KH(F,T,f);return hf(F,T)})}return o.$.parseSchema(n.map((c)=>qn(c)?{proto:Array,exactLength:0}:{proto:Array,sequence:c}))},hf=(i,o)=>{if(i.defaultables||i.optionals)return H(i.variadic?Mf:ZH);if(i.variadic)i.postfix=Ai(i.postfix,o);else i.prefix=Ai(i.prefix,o);return i},C4=(i,o)=>{if(i.variadic)return H(y4);return i.optionals=Ai(i.optionals,o),i},KH=(i,o,n)=>{if(i.variadic)return H(y4);if(i.optionals)return H(MH);return i.defaultables=Ai(i.defaultables,[[o,n]]),i},O4=(i,o)=>{if(i.postfix)H(_4);if(i.variadic){if(!i.variadic.equals(o))H(_4)}else i.variadic=o.internal;return i},HH=(i,o)=>{let n=o.select({method:"find",kind:"sequence"});if(!n)return O4(i,V.intrinsic.unknown);if(n.prefix?.forEach((p)=>hf(i,p)),n.optionals?.forEach((p)=>C4(i,p)),n.variadic)O4(i,n.variadic);return n.postfix?.forEach((p)=>hf(i,p)),i},UH=(i)=>`Spread element must be an array (was ${i})`,_4="A tuple may have at most one variadic element",ZH="A required element may not follow an optional element",y4="An optional element may not follow a variadic element";var MH="A defaultable element may not follow an optional element without a default";var zH={},Dm=(i,o)=>{if(typeof i==="string"){if(o.args&&Object.keys(o.args).some((p)=>i.includes(p)))return af(i,o);let n=zH[o.$.name]??={};return n[i]??=af(i,o)}return qo(i,"object")?uH(i,o):H(gf(Fo(i)))},uH=(i,o)=>{let n=ax(i);switch(n){case void 0:if(a(i,"root"))return i;return M4(i,o);case"Array":return QH(i,o);case"RegExp":return o.$.node("intersection",{domain:"string",pattern:i},{prereduced:!0});case"Function":{let p=Hp(i)?i():i;if(a(p,"root"))return p;return H(gf("Function"))}default:return H(gf(n??oi(i)))}},QH=(i,o)=>u4(i,o)??L4(i,o),gf=(i)=>`Type definitions must be strings or objects (was ${i})`;class sf extends En{constructor(i){let o=Object.assign({errors:ho,hkt:Vo,$:i,raw:i.parse,module:i.constructor.module,scope:i.constructor.scope,define:i.define,match:i.match,generic:i.generic,schema:i.schema,keywords:i.ambient,unit:i.unit,enumerated:i.enumerated,instanceOf:i.instanceOf,valueOf:i.valueOf,or:i.or,and:i.and,merge:i.merge,pipe:i.pipe},i.ambientAttachments);super((...n)=>{if(n.length===1)return i.parse(n[0]);if(n.length===2&&typeof n[0]==="string"&&n[0][0]==="<"&&n[0].at(-1)===">"){let p=n[0].slice(1,-1),c=i.parseGenericParams(p,{});return new zp(c,n[1],i,i,null)}return i.parse(n)},{bind:i,attach:o})}}var gc=V;class Im extends Qm{get ambientAttachments(){if(!gc.typeAttachments)return;return this.cacheGetter("ambientAttachments",pi(gc.typeAttachments,(i,o)=>[i,this.bindReference(o)]))}preparseOwnAliasEntry(i,o){let n=i.indexOf("<");if(n===-1){if(a(o,"module")||a(o,"generic"))return[i,o];let x=this.name==="ark"?i:i==="root"?this.name:`${this.name}.${i}`,T=this.resolvedConfig.keywords?.[x];if(T)o=[o,"@",T];return[i,o]}if(i.at(-1)!==">")H("'>' must be the last character of a generic declaration in a scope");let p=i.slice(0,n),c=i.slice(n+1,-1);return[p,()=>{let x=this.parseGenericParams(c,{alias:p});return rA(x,o,this)}]}parseGenericParams(i,o){return Cm(new Fp(i),[],this.createParseContext({...o,def:i,prefix:"generic"}))}normalizeRootScopeValue(i){if(Hp(i)&&!a(i,"generic"))return i();return i}preparseOwnDefinitionFormat(i,o){return{...o,def:i,prefix:o.alias??"type"}}parseOwnDefinitionFormat(i,o){if(!(o.alias&&(o.alias in this.aliases))&&!o.args)o.args={this:o.id};let p=Dm(i,o);if(Oi(p)){if(p[1]==="=")return H(Em);if(p[1]==="?")return H(Sm)}return p}unit=(i)=>this.units([i]);valueOf=(i)=>this.units(KA(i));enumerated=(...i)=>this.units(i);instanceOf=(i)=>this.node("proto",{proto:i},{prereduced:!0});or=(...i)=>this.schema(i.map((o)=>this.parse(o)));and=(...i)=>i.reduce((o,n)=>o.and(this.parse(n)),this.intrinsic.unknown);merge=(...i)=>i.reduce((o,n)=>o.merge(this.parse(n)),this.intrinsic.object);pipe=(...i)=>this.intrinsic.unknown.pipe(...i);match=new lf(this);declare=()=>({type:this.type});define(i){return i}type=new sf(this);static scope=(i,o={})=>new Im(i,o);static module=(i,o={})=>this.scope(i,o).export()}var tf=Object.assign(Im.scope,{define:(i)=>i}),fi=Im;class D4 extends Vo{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}var VH=Xn(["base",h.object],["props",h.object])((i)=>i.base.merge(i.props),D4),I4=fi.module({Key:h.key,Merge:VH});class B4 extends Vo{}var SH=Xn("element")((i)=>{let o=i.element.exclude(h.Array),n=o.array();return o.rawOr(n).pipe(Kp).distribute((p)=>p.assertHasKind("morph").declareOut(n),Zi)},B4),N4=fi.module({root:h.Array,readonly:"root",index:h.nonNegativeIntegerString,liftFrom:SH},{name:"Array"});var df=Zi(["string",gp.FileConstructor]),EH=df.rawOr(df.array()),b4=Zi({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:EH}}),j4=fi.module({root:["instanceof",FormData],value:df,parsed:b4,parse:Zi({in:FormData,morphs:(i)=>{let o={};for(let[n,p]of i)if(n in o){let c=o[n];if(typeof c==="string"||c instanceof gp.FileConstructor)o[n]=[c,p];else c.push(p)}else o[n]=p;return o},declaredOut:b4})},{name:"FormData"});var P4=fi.module({Int8:["instanceof",Int8Array],Uint8:["instanceof",Uint8Array],Uint8Clamped:["instanceof",Uint8ClampedArray],Int16:["instanceof",Int16Array],Uint16:["instanceof",Uint16Array],Int32:["instanceof",Int32Array],Uint32:["instanceof",Uint32Array],Float32:["instanceof",Float32Array],Float64:["instanceof",Float64Array],BigInt64:["instanceof",BigInt64Array],BigUint64:["instanceof",BigUint64Array]},{name:"TypedArray"});var OH={Boolean:1,Number:1,String:1},a4=fi.module({...pi({...I1,...N1},(i,o)=>(i in OH)?[]:[i,["instanceof",o]]),Array:N4,TypedArray:P4,FormData:j4});var _H=Zi({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-8640000000000000,meta:"a Unix timestamp after -8640000000000000"},max:{rule:8640000000000000,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),LH=Zi({domain:"number",divisor:1}),Bm=fi.module({root:h.number,integer:LH,epoch:_H,safe:Zi({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"});var Pi=(i,o)=>qc("intersection",{domain:"string",pattern:{rule:i.source,flags:i.flags,meta:o}}),l4=Pi(hx,"a well-formed integer string"),ow=fi.module({root:l4,parse:Zi({in:l4,morphs:(i,o)=>{let n=Number.parseInt(i);return Number.isSafeInteger(n)?n:o.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:h.integer})},{name:"string.integer"}),CH=Pi(/^[0-9a-fA-F]+$/,"hex characters only"),yH=fi.module({root:Pi(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,"base64-encoded"),url:Pi(/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==|%3D%3D)?|[A-Za-z0-9_-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),q4=Pi(/^[A-Z].*$/,"capitalized"),DH=fi.module({root:Zi({in:"string",morphs:(i)=>i.charAt(0).toUpperCase()+i.slice(1),declaredOut:q4}),preformatted:q4},{name:"string.capitalize"}),IH=(i)=>{let o=i.replace(/[- ]+/g,""),n=0,p,c,x=!1;for(let T=o.length-1;T>=0;T--){if(p=o.substring(T,T+1),c=Number.parseInt(p,10),x)if(c*=2,c>=10)n+=c%10+1;else n+=c;else n+=c;x=!x}return!!(n%10===0?o:!1)},BH=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,NH=Zi({domain:"string",pattern:{meta:"a credit card number",rule:BH.source},predicate:{meta:"a credit card number",predicate:IH}});var bH=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;var jH=(i)=>!Number.isNaN(new Date(i).valueOf()),k4=Zi({domain:"string",predicate:{meta:"a parsable date",predicate:jH}}).assertHasKind("intersection"),h4=ow.root.internal.narrow((i,o)=>{let n=Number.parseInt(i),p=Bm.epoch(n);if(p instanceof ho)return o.errors.merge(p),!1;return!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),PH=fi.module({root:h4,parse:Zi({in:h4,morphs:(i)=>new Date(i),declaredOut:h.Date})},{name:"string.date.epoch"}),g4=Pi(bH,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),aH=fi.module({root:g4,parse:Zi({in:g4,morphs:(i)=>new Date(i),declaredOut:h.Date})},{name:"string.date.iso"}),lH=fi.module({root:k4,parse:Zi({declaredIn:k4,in:"string",morphs:(i,o)=>{let n=new Date(i);if(Number.isNaN(n.valueOf()))return o.error("a parsable date");return n},declaredOut:h.Date}),iso:aH,epoch:PH},{name:"string.date"}),qH=Pi(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,"an email address"),s4="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",up=`(${s4}[.]){3}${s4}`,kH=new RegExp(`^${up}$`),po="(?:[0-9a-fA-F]{1,4})",hH=new RegExp(`^((?:${po}:){7}(?:${po}|:)|(?:${po}:){6}(?:${up}|:${po}|:)|(?:${po}:){5}(?::${up}|(:${po}){1,2}|:)|(?:${po}:){4}(?:(:${po}){0,1}:${up}|(:${po}){1,3}|:)|(?:${po}:){3}(?:(:${po}){0,2}:${up}|(:${po}){1,4}|:)|(?:${po}:){2}(?:(:${po}){0,3}:${up}|(:${po}){1,5}|:)|(?:${po}:){1}(?:(:${po}){0,4}:${up}|(:${po}){1,6}|:)|(?::((?::${po}){0,5}:${up}|(?::${po}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),gH=fi.module({root:["v4 | v6","@","an IP address"],v4:Pi(kH,"an IPv4 address"),v6:Pi(hH,"an IPv6 address")},{name:"string.ip"}),sc="a JSON string",nw=(i)=>{if(!(i instanceof SyntaxError))throw i;return`must be ${sc} (${i})`},sH=Zi({meta:sc,domain:"string",predicate:{meta:sc,predicate:(i,o)=>{try{return JSON.parse(i),!0}catch(n){return o.reject({code:"predicate",expected:sc,problem:nw(n)})}}}}),tH=(i,o)=>{if(i.length===0)return o.error({code:"predicate",expected:sc,actual:"empty"});try{return JSON.parse(i)}catch(n){return o.error({code:"predicate",expected:sc,problem:nw(n)})}},dH=fi.module({root:sH,parse:Zi({meta:"safe JSON string parser",in:"string",morphs:tH,declaredOut:h.jsonObject})},{name:"string.json"}),t4=Pi(/^[a-z]*$/,"only lowercase letters"),rH=fi.module({root:Zi({in:"string",morphs:(i)=>i.toLowerCase(),declaredOut:t4}),preformatted:t4},{name:"string.lower"}),pw=["NFC","NFD","NFKC","NFKD"],wT=pi(pw,(i,o)=>[o,Zi({domain:"string",predicate:(n)=>n.normalize(o)===n,meta:`${o}-normalized unicode`})]),Nm=pi(pw,(i,o)=>[o,Zi({in:"string",morphs:(n)=>n.normalize(o),declaredOut:wT[o]})]),eH=fi.module({root:Nm.NFC,preformatted:wT.NFC},{name:"string.normalize.NFC"}),iU=fi.module({root:Nm.NFD,preformatted:wT.NFD},{name:"string.normalize.NFD"}),oU=fi.module({root:Nm.NFKC,preformatted:wT.NFKC},{name:"string.normalize.NFKC"}),nU=fi.module({root:Nm.NFKD,preformatted:wT.NFKD},{name:"string.normalize.NFKD"}),pU=fi.module({root:"NFC",NFC:eH,NFD:iU,NFKC:oU,NFKD:nU},{name:"string.normalize"}),d4=Pi(Jm,"a well-formed numeric string"),cU=fi.module({root:d4,parse:Zi({in:d4,morphs:(i)=>Number.parseFloat(i),declaredOut:h.number})},{name:"string.numeric"}),xU=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,TU=Pi(xU,"a semantic version (see https://semver.org/)"),r4=Pi(/^\S.*\S$|^\S?$/,"trimmed"),mU=fi.module({root:Zi({in:"string",morphs:(i)=>i.trim(),declaredOut:r4}),preformatted:r4},{name:"string.trim"}),e4=Pi(/^[A-Z]*$/,"only uppercase letters"),fU=fi.module({root:Zi({in:"string",morphs:(i)=>i.toUpperCase(),declaredOut:e4}),preformatted:e4},{name:"string.upper"}),FU=(i)=>{if(URL.canParse)return URL.canParse(i);try{return new URL(i),!0}catch{return!1}},iw=Zi({domain:"string",predicate:{meta:"a URL string",predicate:FU}}),$U=fi.module({root:iw,parse:Zi({declaredIn:iw,in:"string",morphs:(i,o)=>{try{return new URL(i)}catch{return o.error("a URL string")}},declaredOut:Zi(URL)})},{name:"string.url"}),JU=fi.module({root:["versioned | nil | max","@","a UUID"],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i,v1:Pi(/^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv1"),v2:Pi(/^[0-9a-f]{8}-[0-9a-f]{4}-2[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv2"),v3:Pi(/^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv3"),v4:Pi(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv4"),v5:Pi(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv5"),v6:Pi(/^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv6"),v7:Pi(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv7"),v8:Pi(/^[0-9a-f]{8}-[0-9a-f]{4}-8[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),cw=fi.module({root:h.string,alpha:Pi(/^[A-Za-z]*$/,"only letters"),alphanumeric:Pi(/^[A-Za-z\d]*$/,"only letters and digits 0-9"),hex:CH,base64:yH,capitalize:DH,creditCard:NH,date:lH,digits:Pi(/^\d*$/,"only digits 0-9"),email:qH,integer:ow,ip:gH,json:dH,lower:rH,normalize:pU,numeric:cU,semver:TU,trim:mU,upper:fU,url:$U,uuid:JU},{name:"string"});var xw=fi.module({bigint:h.bigint,boolean:h.boolean,false:h.false,never:h.never,null:h.null,number:h.number,object:h.object,string:h.string,symbol:h.symbol,true:h.true,unknown:h.unknown,undefined:h.undefined}),Tw=fi.module({root:h.unknown,any:h.unknown},{name:"unknown"}),AU=fi.module({root:h.jsonObject,stringify:qc("morph",{in:h.jsonObject,morphs:(i)=>JSON.stringify(i),declaredOut:h.string})},{name:"object.json"}),mw=fi.module({root:h.object,json:AU},{name:"object"});class fw extends Vo{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var vU=Xn(["K",h.key],"V")((i)=>({domain:"object",index:{signature:i.K,value:i.V}}),fw);class Fw extends Vo{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var wU=Xn(["T",h.object],["K",h.key])((i)=>i.T.pick(i.K),Fw);class $w extends Vo{description='omit a set of properties from an object like `Omit(User, "age")`'}var XU=Xn(["T",h.object],["K",h.key])((i)=>i.T.omit(i.K),$w);class Jw extends Vo{description="make all named properties of an object optional like `Partial(User)`"}var WU=Xn(["T",h.object])((i)=>i.T.partial(),Jw);class Aw extends Vo{description="make all named properties of an object required like `Required(User)`"}var RU=Xn(["T",h.object])((i)=>i.T.required(),Aw);class vw extends Vo{description='exclude branches of a union like `Exclude("boolean", "true")`'}var YU=Xn("T","U")((i)=>i.T.exclude(i.U),vw);class ww extends Vo{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var GU=Xn("T","U")((i)=>i.T.extract(i.U),ww),Xw=fi.module({Exclude:YU,Extract:GU,Omit:XU,Partial:WU,Pick:wU,Record:vU,Required:RU});var Qp=tf({...xw,...Xw,...a4,...I4,string:cw,number:Bm,object:mw,unknown:Tw},{prereducedAliases:!0,name:"ark"}),$o=Qp.export();Object.assign(gc.ambient,$o);gc.typeAttachments={string:$o.string.root,number:$o.number.root,bigint:$o.bigint,boolean:$o.boolean,symbol:$o.symbol,undefined:$o.undefined,null:$o.null,object:$o.object.root,unknown:$o.unknown.root,false:$o.false,true:$o.true,never:$o.never,arrayIndex:$o.Array.index,Key:$o.Key,Record:$o.Record,Array:$o.Array.root,Date:$o.Date};var ri=Object.assign(Qp.type,gc.typeAttachments),KU=Qp.match,HU=Qp.generic,_j=Qp.schema,UU=Qp.define,ZU=Qp.declare;function bm(i=Math.random){return i().toString(36).slice(2)}class XT extends Promise{fate;resolve;reject;done=!1;constructor(i){let o,n;super((p,c)=>{o=p,n=c});this.resolve=o,this.reject=n,this.use(i instanceof Promise?i:new Promise(i))}pass(i,o){if(i===this.fate)this.resolve(o),this.done=!0}fail(i,o){if(i===this.fate)this.reject(o),this.done=!0}use(i){if(i instanceof Promise){let o=i;this.fate=o,o.then((n)=>{this.pass(o,n)},(n)=>{this.fail(o,n)})}else this.resolve(i),this.fate=void 0}}var Ww=(i,o,n=d.STORE)=>{return rf(n,{key:`${i.key}:JSON`,get:({get:p})=>o.toJson(p(i)),set:({set:p},c)=>{p(i,o.fromJson(c))}})};function I(i){while(i.child!==null)i=i.child;return i}class $i{Subscriber;subscribers=new Map;subscribe(i,o){return this.subscribers.set(i,o),()=>{this.unsubscribe(i)}}unsubscribe(i){this.subscribers.delete(i)}next(i){let o=this.subscribers.values();for(let n of o)n(i)}}class ef extends $i{state;constructor(i){super();this.state=i}next(i){this.state=i,super.next(i)}}function dp(i,o,n){let p={key:o.key,type:"atom_family"},c=i.families.get(o.key);if(c)i.logger.error("\u2757","atom_family",o.key,`Overwriting an existing ${hn(c)} "${c.key}" in store "${i.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let x=new $i,m=Object.assign((f)=>{let F=Ji(f),$={key:o.key,subKey:F},J=`${o.key}(${F})`,A=I(i),X=o.default,Y={key:J,default:X instanceof Function?X(f):X};if(o.effects)Y.effects=o.effects(f);let R=rp(A,Y,$);return x.next({type:"state_creation",token:R}),R},p,{subject:x,install:(f)=>dp(f,o),internalRoles:n});return i.families.set(o.key,m),i.defaults.set(o.key,o.default),p}function Rw(i,o){if("mutable"in o)return WT(i,o);return dp(i,o)}function Vp(i,o,n){let p={key:o.key,type:"readonly_selector_family"},c=i.families.get(o.key);if(c)i.logger.error("\u2757","readonly_selector_family",o.key,`Overwriting an existing ${hn(c)} "${c.key}" in store "${i.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let x=new $i,m=Object.assign((f)=>{let F=Ji(f),$={key:o.key,subKey:F},J=`${o.key}(${F})`,A=I(i),X=RT(A,{key:J,get:o.get(f)},$);return x.next({type:"state_creation",token:X}),X},p,{internalRoles:n,subject:x,install:(f)=>Vp(f,o),default:(f)=>{return o.get(f)({get:(...$)=>Mi(i,...$),find:(...$)=>t(i,...$),json:($)=>Jo(i,$)})}});return i.families.set(o.key,m),p}function Yw(i,o){if("set"in o)return YT(i,o);return Vp(i,o)}class jm{_buffer;_index=0;constructor(i){let o;if(typeof i==="number")o=i;else o=i.length;this._buffer=Array.from({length:o})}get buffer(){return this._buffer}get index(){return this._index}add(i){this._buffer[this._index]=i,this._index=(this._index+1)%this._buffer.length}copy(){let i=new jm([...this._buffer]);return i._index=this._index,i}}var MU={atom_family:"atom",mutable_atom_family:"mutable_atom",selector_family:"selector",readonly_selector_family:"readonly_selector",molecule_family:"molecule"};function Gw(i,o){let n=Ji(o),p=`${i.key}(${n})`,c=MU[i.type],x={key:p,type:c};return Object.assign(x,{family:{key:i.key,subKey:n}}),Object.assign(x,{counterfeit:!0}),x}function gn(i){let o={key:i.key,type:i.type};if("family"in i)o.family=i.family;return o}class Ao{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(i,o)=>`${i}:${o}`;warn;getRelatedKeys(i){return this.relations.get(i)}addRelation(i,o){let n=this.relations.get(i),p=this.relations.get(o);if(n)n.add(o);else n=new Set([o]),this.relations.set(i,n);if(p)p.add(i);else p=new Set([i]),this.relations.set(o,p)}deleteRelation(i,o){let n=this.relations.get(i);if(n){if(n.delete(o),n.size===0)this.relations.delete(i);let p=this.relations.get(o);if(p){if(p.delete(i),p.size===0)this.relations.delete(o)}}}replaceRelationsUnsafely(i,o){this.relations.set(i,new Set(o));for(let n of o){let p=new Set().add(i);this.relations.set(n,p)}}replaceRelationsSafely(i,o){let n=this.relations.get(i),p=this.isAType?.(i)?i:void 0,c=p===void 0?i:void 0;if(n)for(let x of n){p??=x,c??=x;let T=this.relations.get(x);if(T){if(T.size===1)this.relations.delete(x);else T.delete(i);this.contents.delete(this.makeContentKey(p,c))}}this.relations.set(i,new Set(o));for(let x of o){let T=this.relations.get(x);if(T)T.add(i);else T=new Set().add(i),this.relations.set(x,T)}}getContentInternal(i){return this.contents.get(i)}setContent(i,o){this.contents.set(i,o)}deleteContent(i){this.contents.delete(i)}constructor(i,o){if(this.a=i.between[0],this.b=i.between[1],this.cardinality=i.cardinality,!o?.externalStore)this.relations=new Map(i.relations?.map(([n,p])=>[n,new Set(p)])),this.contents=new Map(i.contents);if(this.isAType=o?.isAType??null,this.isBType=o?.isBType??null,this.isContent=o?.isContent??null,o?.makeContentKey)this.makeContentKey=o.makeContentKey;if(o?.externalStore){let n=o.externalStore;if(this.has=(p,c)=>n.has(p,c),this.addRelation=(p,c)=>{n.addRelation(p,c)},this.deleteRelation=(p,c)=>{n.deleteRelation(p,c)},this.replaceRelationsSafely=(p,c)=>{n.replaceRelationsSafely(p,c)},this.replaceRelationsUnsafely=(p,c)=>{n.replaceRelationsUnsafely(p,c)},this.getRelatedKeys=(p)=>n.getRelatedKeys(p),n.getContent)this.getContentInternal=(p)=>{return n.getContent(p)},this.setContent=(p,c)=>{n.setContent(p,c)},this.deleteContent=(p)=>{n.deleteContent(p)};for(let[p,c]of i.relations??[]){let x=this.isAType?.(p)?p:void 0,T=x===void 0?p:void 0;for(let m of c)x??=m,T??=m,this.addRelation(x,T)}for(let[p,c]of i.contents??[])this.setContent(p,c)}if(o?.warn)this.warn=o.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([i,o])=>[i,[...o]]),contents:[...this.contents.entries()]}}set(...i){let o,n,p;switch(i.length){case 1:{let c=i[0];o=c[this.a],n=c[this.b],p=void 0;break}case 2:{let c=i[0];if(typeof c==="string")[o,n]=i;else o=c[this.a],n=c[this.b],p=i[1];break}default:{o=i[0],n=i[1],p=i[2];break}}switch(this.cardinality){case"1:1":{let c=this.getRelatedKey(o);if(c&&c!==n)this.delete(o,c)}case"1:n":{let c=this.getRelatedKey(n);if(c&&c!==o)this.delete(c,n)}break;case"n:n":}if(p){let c=this.makeContentKey(o,n);this.setContent(c,p)}return this.addRelation(o,n),this}delete(i,o){o=typeof o==="string"?o:i[this.b];let n=typeof i==="string"?i:i[this.a];if(n===void 0&&typeof o==="string"){let p=this.getRelatedKeys(o);if(p)for(let c of p)this.delete(c,o)}if(typeof n==="string"&&o===void 0){let p=this.getRelatedKeys(n);if(p)for(let c of p)this.delete(n,c)}if(typeof n==="string"&&typeof o==="string"){this.deleteRelation(n,o);let p=this.makeContentKey(n,o);this.deleteContent(p)}return this}getRelatedKey(i){let o=this.getRelatedKeys(i);if(o){if(o.size>1)this.warn?.(`${o.size} related keys were found for key "${i}": (${[...o].map((p)=>`"${p}"`).join(", ")}). Only one related key was expected.`);let n;for(let p of o){n=p;break}return n}}replaceRelations(i,o,n){let p=!Array.isArray(o),c=p?Object.keys(o):o;if(n?.reckless)this.replaceRelationsUnsafely(i,c);else this.replaceRelationsSafely(i,c);if(p)for(let x of c){let T=this.makeContentKey(i,x),m=o[x];this.setContent(T,m)}return this}getContent(i,o){let n=this.makeContentKey(i,o);return this.getContentInternal(n)}getRelationEntries(i){let o=i[this.a],n=i[this.b];if(o!==void 0&&n===void 0){let p=this.getRelatedKeys(o);if(p)return[...p].map((c)=>{return[c,this.getContent(o,c)]})}if(o===void 0&&n!==void 0){let p=this.getRelatedKeys(n);if(p)return[...p].map((c)=>{return[c,this.getContent(c,n)]})}return[]}has(i,o){if(o)return this.getRelatedKeys(i)?.has(o)??!1;return this.relations.has(i)}}function Ho(i){return"epoch"in i.transactionMeta}function zi(i){return"phase"in i.transactionMeta}var Kw=(i)=>{let o=I(i);if(!zi(o)){i.logger.warn("\uD83D\uDC1E","transaction","???","abortTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}i.logger.info("\uD83E\uDE82","transaction",o.transactionMeta.update.key,"Aborting transaction"),o.parent.child=null};function ui(i){return i[0].toUpperCase()+i.slice(1)}function hn(i){return i.type.split("_").map(ui).join(" ")}class ep extends Error{constructor(i,o){super(`${hn(i)} ${Ji(i.key)} not found in store "${o.config.name}".`)}}function tc(i,o,n){return(...p)=>{let c=Ri(i,o);if(c)return c.run(p,n);throw new ep(o,i)}}var Pm=(i)=>(o)=>i instanceof Function?i(o):i;var Sp=(i,o)=>{if(i.valueMap.has(o.key))return i.logger.info("\uD83D\uDCD6",o.type,o.key,"reading cached value"),Hw(o,i);switch(o.type){case"selector":case"readonly_selector":return i.logger.info("\uD83E\uDDEE",o.type,o.key,"computing value"),o.get();case"atom":case"mutable_atom":{let n=o.default,p;if(n instanceof Function)p=n();else p=n;return i.logger.info("\uD83D\uDC81","atom",o.key,"could not find cached value; using default",p),p}}};var Uw=(i,o)=>{if(i.operation.open){let n=performance.now();return i.logger.info("\u2757",o.type,o.key,`deferring setState at T-${n} until setState for "${i.operation.token.key}" is done`),n}i.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:o},i.logger.info("\u2B55",o.type,o.key,`operation start in store "${i.config.name}"${!zi(i)?"":` ${i.transactionMeta.phase} "${i.transactionMeta.update.key}"`}`)},Zw=(i)=>{if(i.operation.open)i.logger.info("\uD83D\uDD34",i.operation.token.type,i.operation.token.key,`operation done in store "${i.config.name}"`);i.operation={open:!1},i.on.operationClose.next(i.operation)},Mw=(i,o)=>{if(!i.operation.open)return i.logger.error("\uD83D\uDC1E","unknown",o,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0;return i.operation.done.has(o)},dc=(i,o)=>{if(!i.operation.open){i.logger.error("\uD83D\uDC1E","unknown",o,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}i.operation.done.add(o)};var zw=(i,o,n)=>{switch(o.type){case"mutable_atom":i.logger.info("\uD83D\uDCE2",o.type,o.key,"is now (",n.newValue,") subscribers:",o.subject.subscribers);break;case"atom":case"selector":case"readonly_selector":i.logger.info("\uD83D\uDCE2",o.type,o.key,"went (",n.oldValue,"->",n.newValue,") subscribers:",o.subject.subscribers)}o.subject.next(n)};var iF=(i,o)=>{let n=I(i),p=n.selectorAtoms.getRelatedKeys(o.key);if(n.logger.info("\uD83E\uDDF9",o.type,o.key,p?`evicting ${p.size} states downstream:`:"no downstream states",p??"to evict"),p){if(n.operation.open)n.logger.info("\uD83E\uDDF9",o.type,o.key,`[ ${[...n.operation.done].join(", ")} ] already done`);for(let c of p){if(Mw(n,c))continue;uw(c,n),dc(n,c)}}};var Qw=(i,o,n)=>{let p=Sp(i,o),c=p;if(o.type==="mutable_atom"&&zi(i)){let{parent:T}=i;c=GT(i,o,T)}if(c=Pm(n)(c),i.logger.info("\uD83D\uDCDD","atom",o.key,"set to",c),c=Wn(i,o.key,c,o.subject),Sw(i,o.key))Ew(i,o.key);dc(i,o.key),iF(i,o);let x={oldValue:p,newValue:c};if(!zi(i)){zw(i,o,x);return}if(i.on.transactionApplying.state===null){let{key:T}=o;if(Vw(x.newValue))return;let m={type:"atom_update",key:T,...x};if(o.family)m.family=o.family;i.transactionMeta.update.updates.push(m),i.logger.info("\uD83D\uDCC1","atom",T,"stowed (",x.oldValue,"->",x.newValue,")")}else if(o.key.startsWith("*")){let T=o.key.slice(1),m=i.atoms.get(T),f=i.valueMap.get(T);if(m.type==="mutable_atom"&&zi(i)){let{parent:$}=i;f=GT(i,m,$)}if(f.do(x.newValue)===null)iF(i,m)}};var am=(i,o,n)=>{switch(o.type){case"atom":case"mutable_atom":Qw(i,o,n);break;case"selector":o.set(n);break}};function Ow(i,o){if(o.family){let n=i.families.get(o.family.key);if(n)return n}}function _i(i,...o){let n,p,c,x;if(o.length===2){if(n=o[0],x=o[1],p=Ow(i,n)??null,p)c=n.family?Wo(n.family.subKey):null,n=t(i,p,c)}else p=o[0],c=o[1],x=o[2],n=t(i,p,c);if("counterfeit"in n&&"family"in n){let f=n.family.subKey,F=i.disposalTraces.buffer.find(($)=>$?.key===f);i.logger.error("\u274C",n.type,n.key,`could not be set because it was not found in the store "${i.config.name}".`,F?`This state was previously disposed:
86
+ ${F.trace}`:"No previous disposal trace was found.");return}let T=Uw(i,n);if(T){let f=i.on.operationClose.subscribe(`waiting to set "${n.key}" at T-${T}`,()=>{f(),i.logger.info("\uD83D\uDFE2",n.type,n.key,`resuming deferred setState from T-${T}`),_i(i,n,x)});return}let m=Ri(i,n);am(i,m,x),Zw(i)}function lm(i,o,n){let{key:p,newValue:c,oldValue:x}=o,T=i==="newValue"?c:x,m={key:p,type:"atom"};if(o.family)Object.assign(m,{family:o.family});_i(n,m,T)}function _w(i){let{stack:o}=i;if(o)return`
87
+ `+o.split(`
88
88
  `)?.slice(1)?.join(`
89
- `);return""}function z0(H,A=e.STORE){let L={key:H,stringKey:pH(H),dependsOn:"any"};return A.molecules.set(pH(H),L),H}function A$(H,A,L,I="any"){let $=A,f=pH(L),E=[],D=N(H);if(Array.isArray($))for(let u of $){let t=pH(u);if(D.molecules.get(t))H.moleculeGraph.set(t,f,{source:t});else E.push(t)}else{let u=pH($);if(D.molecules.get(u))H.moleculeGraph.set(u,f,{source:u});else E.push(u)}if(E.length===0)D.molecules.set(f,{key:L,stringKey:f,dependsOn:I});let M={type:"molecule_creation",key:L,provenance:$};if(PH(D)&&D.transactionMeta.phase==="building")D.transactionMeta.update.updates.push(M);else D.on.moleculeCreation.next(M);for(let u of E){let t=H.disposalTraces.buffer.find((i)=>i?.key===u);H.logger.error("\u274C","molecule",L,"allocation failed:",`Could not allocate to ${u} in store "${H.config.name}".`,t?`
90
- ${u} was most recently disposed
91
- ${t.trace}`:`No previous disposal trace for ${u} was found.`)}return L}function b0(H,A,L,I){let $=`T$--${A}==${L}++${I}`;return A$(H,[L,I],$,"all"),$}function L$(H,A){let L=pH(A),I=H.molecules.get(L);if(!I){let B=H.disposalTraces.buffer.find((U)=>U?.key===L);H.logger.error("\u274C","molecule",A,"deallocation failed:",`Could not find allocation for ${L} in store "${H.config.name}".`,B?`
92
- This state was most recently deallocated
93
- ${B.trace}`:`No previous disposal trace for ${L} was found.`);return}let $=H.moleculeJoins.getRelatedKeys(I.key);if($)for(let B of $){let U=H.joins.get(B);if(U)U.relations.delete(I.key),U.molecules.delete(I.stringKey)}H.moleculeJoins.delete(I.stringKey);let f=[],E=[],D={type:"molecule_disposal",key:I.key,values:E,provenance:f},M=N(H);M.molecules.delete(L);let o=PH(M)&&M.transactionMeta.phase==="building";if(o)M.transactionMeta.update.updates.push(D);let u=H.moleculeGraph.getRelationEntries({downstreamMoleculeKey:I.stringKey});if(u)for(let[B,{source:U}]of u)if(U===I.stringKey){let x=xA(B);L$(H,x)}else f.push(U);let t=M.moleculeData.getRelatedKeys(I.stringKey);if(t)for(let B of t){let U=M.families.get(B),x=q(H,U,I.key);E.push([U.key,x]),I$(H,x)}if(M.moleculeGraph.delete(I.stringKey),M.moleculeJoins.delete(I.stringKey),M.moleculeData.delete(I.stringKey),!o)M.on.moleculeDisposal.next(D);M.molecules.delete(I.stringKey);let i=Q0(new Error);H.disposalTraces.add({key:L,trace:i})}function e$(H,A,L,I){let $=pH(L),f=N(H),E=f.molecules.get($);if(!E){let i=H.disposalTraces.buffer.find((B)=>B?.key===$);return H.logger.error("\u274C","molecule",L,"claim failed:",`Could not allocate to ${$} in store "${H.config.name}".`,i?`
89
+ `);return""}function Lw(i,o=d.STORE){let n={key:i,stringKey:Ji(i),dependsOn:"any"};return o.molecules.set(Ji(i),n),i}function ic(i,o,n,p="any"){let c=o,x=Ji(n),T=[],m=I(i);if(Array.isArray(c))for(let $ of c){let J=Ji($);if(m.molecules.get(J))i.moleculeGraph.set(J,x,{source:J});else T.push(J)}else{let $=Ji(c);if(m.molecules.get($))i.moleculeGraph.set($,x,{source:$});else T.push($)}if(T.length===0)m.molecules.set(x,{key:n,stringKey:x,dependsOn:p});let f={type:"molecule_creation",key:n,provenance:c};if(zi(m)&&m.transactionMeta.phase==="building")m.transactionMeta.update.updates.push(f);else m.on.moleculeCreation.next(f);for(let $ of T){let J=i.disposalTraces.buffer.find((A)=>A?.key===$);i.logger.error("\u274C","molecule",n,"allocation failed:",`Could not allocate to ${$} in store "${i.config.name}".`,J?`
94
90
  ${$} was most recently disposed
95
- ${i.trace}`:`No previous disposal trace for ${$} was found.`),L}let D=pH(A),M=f.molecules.get(D);if(!M){let i=H.disposalTraces.buffer.find((B)=>B?.key===D);return H.logger.error("\u274C","molecule",L,"claim failed:",`Could not allocate to ${D} in store "${H.config.name}".`,i?`
96
- ${D} was most recently disposed
97
- ${i.trace}`:`No previous disposal trace for ${D} was found.`),L}let o=H.moleculeGraph.getRelationEntries({downstreamMoleculeKey:E.stringKey}).filter(([,{source:i}])=>i!==$).map(([i])=>xA(i));if(I)f.moleculeGraph.delete($);f.moleculeGraph.set({upstreamMoleculeKey:M.stringKey,downstreamMoleculeKey:E.stringKey},{source:M.stringKey});let u={type:"molecule_transfer",key:E.key,from:o,to:[M.key]};if(PH(f)&&f.transactionMeta.phase==="building")f.transactionMeta.update.updates.push(u);return L}function Eu(H,A,L){switch(A){case"newValue":{Z0(H,L);break}case"oldValue":{I$(L,H.token);break}}}function Du(H,A,L){switch(A){case"newValue":{I$(L,H.token);break}case"oldValue":{if(Z0(H,L),H.subType==="atom")L.valueMap.set(H.token.key,H.value);break}}}function Z0(H,A){let{family:L}=H.token;if(L){let I=A.families.get(L.key);if(I)q(A,I,xA(L.subKey))}}function h0(H,A,L){switch(A){case"newValue":A$(L,H.provenance,H.key);break;case"oldValue":L$(L,H.key);break}}function r0(H,A,L){switch(A){case"newValue":L$(L,H.key);break;case"oldValue":{let I=H.provenance.map(xA);A$(L,I,H.key);for(let[$,f]of H.values){let E=L.families.get($);if(E){q(L,E,H.key);let D=`${$}(${pH(H.key)})`;L.valueMap.set(D,f)}}}break}}function j0(H,A,L){switch(A){case"newValue":{let I=H.to.length===1?H.to[0]:H.to;e$(L,I,H.key,"exclusive")}break;case"oldValue":{let I=H.from.length===1?H.from[0]:H.from;e$(L,I,H.key,"exclusive")}break}}function jD(H,A,L){let I=H==="newValue"?A.updates:[...A.updates].reverse();for(let $ of I)switch($.type){case"atom_update":case"selector_update":rD(H,$,L);break;case"state_creation":Eu($,H,L);break;case"state_disposal":Du($,H,L);break;case"molecule_creation":h0($,H,L);break;case"molecule_disposal":r0($,H,L);break;case"molecule_transfer":j0($,H,L);break;case"transaction_update":jD(H,$,L);break}}function Mu(H,A){return H.transactionMeta.actionContinuities.getRelatedKey(A)}function A5(H,A){return H.transactionMeta.epoch.get(A)}function k0(H,A){if(!FA(H))return;let I=Mu(H,A);if(I===void 0)return;return A5(H,I)}function d0(H,A,L){if(FA(H)&&A)H.transactionMeta.epoch.set(A,L)}function q0(H,A,L){if(!FA(H))return;let $=Mu(H,A);if($!==void 0)H.transactionMeta.epoch.set($,L)}var g0=(H,A)=>{let L=N(A),{parent:I}=L;if(I===null||!PH(L)||L.transactionMeta?.phase!=="building"){A.logger.warn("\uD83D\uDC1E","transaction","???","applyTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}L.transactionMeta.phase="applying",L.transactionMeta.update.output=H,I.child=null,I.on.transactionApplying.next(L.transactionMeta);let{updates:$}=L.transactionMeta.update;if(A.logger.info("\uD83D\uDEC4","transaction",L.transactionMeta.update.key,`Applying transaction with ${$.length} updates:`,$),jD("newValue",L.transactionMeta.update,I),FA(I))q0(I,L.transactionMeta.update.key,L.transactionMeta.update.epoch),CH(A,{key:L.transactionMeta.update.key,type:"transaction"})?.subject.next(L.transactionMeta.update),A.logger.info("\uD83D\uDEEC","transaction",L.transactionMeta.update.key,"Finished applying transaction.");else if(PH(I))I.transactionMeta.update.updates.push(L.transactionMeta.update);I.on.transactionApplying.next(null)};function e0(H,A,L){if(!FA(H))return;let{epoch:$,actionContinuities:f}=H.transactionMeta;if(f.set(A,L),!$.has(A))$.set(A,-1)}function HB(H){return{store:H}}function mH(H,...A){let L,I,$;if(A.length===1)L=A[0];else I=A[0],$=A[1],L=q(H,I,$);if("counterfeit"in L&&"family"in L){I=H.families.get(L.family.key);let f=L.family.subKey,E=H.disposalTraces.buffer.find((D)=>D?.key===f);switch(H.logger.error("\u274C",L.type,L.key,`could not be retrieved because it was not found in the store "${H.config.name}".`,E?`This state was previously disposed:
98
- ${E.trace}`:"No previous disposal trace was found."),I.type){case"atom_family":case"mutable_atom_family":return H.defaults.get(I.key);case"selector_family":case"readonly_selector_family":{if(H.defaults.has(I.key))return H.defaults.get(L.family.key);let D=CH(H,I).default(f);return H.defaults.set(I.key,D),D}}}return VI(H,CH(H,L))}class xL extends Map{deleted=new Set;source;constructor(H){super();this.source=H}get(H){if(super.has(H))return super.get(H);if(!this.deleted.has(H)&&this.source.has(H))return this.source.get(H);return}set(H,A){return this.deleted.delete(H),super.set(H,A)}hasOwn(H){return super.has(H)}has(H){return!this.deleted.has(H)&&(super.has(H)||this.source.has(H))}delete(H){return this.deleted.add(H),super.delete(H)}}var AB=(H,A,L,I)=>{let $=N(H),f={parent:$,child:null,on:$.on,loggers:$.loggers,logger:$.logger,config:$.config,atoms:new xL($.atoms),atomsThatAreDefault:new Set($.atomsThatAreDefault),families:new xL($.families),joins:new xL($.joins),operation:{open:!1},readonlySelectors:new xL($.readonlySelectors),timelines:new xL($.timelines),timelineTopics:new pA($.timelineTopics.toJSON()),trackers:new Map,transactions:new xL($.transactions),selectorAtoms:new pA($.selectorAtoms.toJSON()),selectorGraph:new pA($.selectorGraph.toJSON(),{makeContentKey:(...o)=>o.sort().join(":")}),selectors:new xL($.selectors),valueMap:new xL($.valueMap),defaults:$.defaults,disposalTraces:H.disposalTraces.copy(),molecules:new xL($.molecules),moleculeGraph:new pA($.moleculeGraph.toJSON(),{makeContentKey:$.moleculeGraph.makeContentKey}),moleculeData:new pA($.moleculeData.toJSON(),{makeContentKey:$.moleculeData.makeContentKey}),moleculeJoins:new pA($.moleculeJoins.toJSON(),{makeContentKey:$.moleculeJoins.makeContentKey}),miscResources:new xL($.miscResources)},E=k0(H,A),D={phase:"building",update:{type:"transaction_update",key:A,id:I,epoch:E===void 0?Number.NaN:E+1,updates:[],params:L,output:void 0},toolkit:{get:(...o)=>mH(M,...o),set:(...o)=>{vH(M,...o)},run:(o,u=zD())=>q$(M,o,u),find:(...o)=>q(H,...o),json:(o)=>iA(M,o),dispose:(...o)=>{I$(M,...o)},env:()=>HB(M)}},M=Object.assign(f,{transactionMeta:D});return $.child=M,H.logger.info("\uD83D\uDEEB","transaction",A,"Building transaction with params:",L),M};function ou(H,A){let L={key:A.key,type:"transaction",run:(f,E)=>{let D=AB(H,A.key,f,E);try{let M=N(H),{toolkit:o}=D.transactionMeta,u=A.do(o,...f);return g0(u,M),u}catch(M){throw V0(I),H.logger.warn("\uD83D\uDCA5","transaction",A.key,"caught:",M),M}},install:(f)=>ou(f,A),subject:new iH},I=N(H);I.transactions.set(L.key,L);let $=jL(L);return H.on.transactionCreation.next($),$}class LB{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;selectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new pA({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new pA({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...H)=>H.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new pA({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new pA({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new bD(100);molecules=new Map;moleculeJoins=new pA({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...H)=>H.sort().join(":")});moleculeGraph=new pA({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...H)=>H.sort().join(":")});moleculeData=new pA({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...H)=>H.sort().join(":")});miscResources=new Map;on={atomCreation:new iH,atomDisposal:new iH,selectorCreation:new iH,selectorDisposal:new iH,timelineCreation:new iH,transactionCreation:new iH,transactionApplying:new $u(null),operationClose:new iH,moleculeCreation:new iH,moleculeDisposal:new iH};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new $$("warn",(H,A,L)=>!IB(L))];logger={error:(...H)=>{for(let A of this.loggers)A.error(...H)},info:(...H)=>{for(let A of this.loggers)A.info(...H)},warn:(...H)=>{for(let A of this.loggers)A.warn(...H)}};constructor(H,A=null){if(this.config={...A?.config,...H},A!==null){if(this.valueMap=new Map(A?.valueMap),this.operation={...A?.operation},FA(A))this.transactionMeta={epoch:new Map(A?.transactionMeta.epoch),actionContinuities:new pA(A?.transactionMeta.actionContinuities.toJSON())};for(let[,I]of A.families){if(I.internalRoles?.includes("mutable")||I.internalRoles?.includes("join"))continue;I.install(this)}let L=new Set;for(let[,I]of A.atoms){if(L.has(I.key))continue;if(I.install(this),I.type==="mutable_atom"){let $=iA(A,I),f=uI(I);L.add($.key),L.add(f.key)}}for(let[,I]of A.readonlySelectors)I.install(this);for(let[,I]of A.selectors){if(L.has(I.key))continue;I.install(this)}for(let[,I]of A.transactions)I.install(this);for(let[,I]of A.timelines)I.install(this)}}}var e={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new LB({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function CH(H,A){let L,I=H;while(I!==null){switch(A.type){case"atom":case"mutable_atom":L=I.atoms.get(A.key);break;case"selector":L=I.selectors.get(A.key);break;case"readonly_selector":L=I.readonlySelectors.get(A.key);break;case"atom_family":case"mutable_atom_family":case"selector_family":case"readonly_selector_family":L=I.families.get(A.key);break;case"timeline":L=I.timelines.get(A.key);break;case"transaction":L=I.transactions.get(A.key);break}if(L)return L;I=I.child}throw new H$(A,H)}function $B(H,A,L){let I=H.families.get(A.key);if(I===void 0)throw new H$(A,H);let $=I(L),f=N(H);if($.family){if(FA(f))switch($.type){case"atom":case"mutable_atom":H.on.atomCreation.next($);break;case"selector":case"readonly_selector":H.on.selectorCreation.next($);break}else if(PH(f)&&f.on.transactionApplying.state===null)f.transactionMeta.update.updates.push({type:"state_creation",token:$})}return $}function fB(H,A,L){let I=pH(L),$=`${A.key}(${I})`,f=N(H),E;switch(A.type){case"atom_family":case"mutable_atom_family":E=f.atoms.get($);break;case"selector_family":E=f.selectors.get($);break;case"readonly_selector_family":E=f.readonlySelectors.get($);break}if(E)return jL(E);return E}function q(H,A,L){let I=fB(H,A,L);if(I)return I;let $=pH(L),f=H.molecules.get($);if(!f&&H.config.lifespan==="immortal"){let E=J0(A,L);return H.logger.error("\u274C",E.type,E.key,`was not found in store "${H.config.name}"; returned a counterfeit token.`),E}if(I=$B(H,A,L),f)N(H).moleculeData.set($,A.key);return I}function I$(H,...A){let L;if(A.length===1)L=A[0];else{let I=A[0],$=A[1];L=q(H,I,$)}try{CH(H,L)}catch(I){H.logger.error("\u274C",L.type,L.key,`could not be disposed because it was not found in the store "${H.config.name}".`);return}switch(L.type){case"atom":case"mutable_atom":uu(H,L);break;case"selector":case"readonly_selector":EB(H,L);break}}var kD=(H,A)=>N(H).atoms.has(A),L5=(H,A)=>N(H).selectors.has(A),I5=(H,A)=>N(H).readonlySelectors.has(A),DB=(H,A)=>kD(H,A)||L5(H,A)||I5(H,A);var dD=(H,A)=>{return N(A).selectorGraph.getRelationEntries({downstreamSelectorKey:H}).filter(([I,{source:$}])=>$!==H).map(([I,{source:$}])=>$).filter((I)=>DB(A,I))};var tu=(H,A,L)=>{let I=[],$=dD(H,L);while($.length>0){let f=$.shift();if(A.has(f))continue;if(A.add(f),!kD(L,f))$.push(...dD(f,L));else if(!I.includes(f))I.push(f)}return I},MB=(H,A)=>{let L=H.key,I=dD(L,A),$=new Set;return I.flatMap((f)=>kD(A,f)?f:tu(f,$,A))};var oB=(H,A,L,I)=>{let $=N(I);if(A.type==="atom"||A.type==="mutable_atom")$.selectorAtoms.set({selectorKey:H,atomKey:A.key}),I.logger.info("\uD83D\uDD0D","selector",H,`discovers root atom "${A.key}"`);else{let f=tu(A.key,L,I);I.logger.info("\uD83D\uDD0D","selector",H,`discovers root atoms: [ ${f.map((E)=>`"${E}"`).join(", ")} ]`);for(let E of f)$.selectorAtoms=$.selectorAtoms.set({selectorKey:H,atomKey:E})}L.add(A.key)};var qD=(H,A,L)=>({get:(...I)=>{let $=N(L),f;if(I.length===2){let[M,o]=I;f=q(L,M,o)}else[f]=I;let E=CH(L,f),D=VI(L,E);return L.logger.info("\uD83D\uDD0C","selector",H,`registers dependency ( "${f.key}" =`,D,")"),$.selectorGraph.set({upstreamSelectorKey:f.key,downstreamSelectorKey:H},{source:f.key}),oB(H,f,A,L),D},set:(...I)=>{let $,f;if(I.length===2)$=I[0],f=I[1];else{let M=I[0],o=I[1];f=I[2],$=q(L,M,o)}let E=N(L),D=CH(E,$);hD(E,D,f)},find:(...I)=>q(L,...I),json:(I)=>iA(L,I)});var CE=(H,A,L)=>{let I=N(H),$=new iH,f=new Set,{get:E,find:D,json:M}=qD(A.key,f,I),o=()=>{let B=A.get({get:E,find:D,json:M});return cL(N(H),A.key,B,$),f.clear(),B},u={...A,subject:$,install:(B)=>CE(B,A,L),get:o,type:"readonly_selector",...L&&{family:L}};I.readonlySelectors.set(A.key,u);let t=o();H.logger.info("\u2728",u.type,u.key,"=",t);let i={key:A.key,type:"readonly_selector"};if(L)i.family=L;return i};var FE=(H,A,L)=>{let I=N(H),$=new iH,f=new Set,E=qD(A.key,f,I),{find:D,get:M,json:o}=E,u={find:D,get:M,json:o},t=(T=A.get,F=N(H))=>{let m=T(u);return cL(F,A.key,m,$),f.clear(),m},B={...A,subject:$,install:(T)=>FE(T,A,L),get:t,set:(T)=>{let F=N(H),m=t(A.get,F),Y=ZD(T)(m);if(H.logger.info("\uD83D\uDCDD","selector",A.key,"set (",m,"->",Y,")"),cL(F,A.key,Y,$),g$(F,A.key),FA(F))$.next({newValue:Y,oldValue:m});A.set(E,Y)},type:"selector",...L&&{family:L}};I.selectors.set(A.key,B);let U=t();H.logger.info("\u2728",B.type,B.key,"=",U);let x={key:A.key,type:"selector"};if(L)x.family=L;return x};function Iu(H,A){if("set"in A){let $=FE(H,A,void 0);return H.on.selectorCreation.next($),$}let I=CE(H,A,void 0);return H.on.selectorCreation.next(I),I}function EB(H,A){let L=N(H),{key:I}=A,$=CH(L,A);if(!$.family)H.logger.error("\u274C","selector",I,"Standalone selectors cannot be disposed.");else{if(L.molecules.get($.family.subKey))L.moleculeData.delete($.family.subKey,$.family.key);let E;switch(A.type){case"selector":L.selectors.delete(I),E={key:$.family.key,type:"selector_family"},CH(H,E).subject.next({type:"state_disposal",subType:"selector",token:A});break;case"readonly_selector":L.readonlySelectors.delete(I),E={key:$.family.key,type:"readonly_selector_family"},CH(H,E).subject.next({type:"state_disposal",subType:"selector",token:A});break}if(L.valueMap.delete(I),L.selectorAtoms.delete(I),L.selectorGraph.delete(I),H.logger.info("\uD83D\uDD25",A.type,I,"deleted"),PH(L)&&L.transactionMeta.phase==="building")L.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:A});else H.on.selectorDisposal.next(A)}}function TE(H,A,L){let I={key:A.key,type:"selector_family"},$=H.families.get(A.key);if($)H.logger.error("\u2757","selector_family",A.key,`Overwriting an existing ${rL($)} "${$.key}" in store "${H.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let f=new iH,D=Object.assign((M)=>{let o=pH(M),u={key:A.key,subKey:o},t=`${A.key}(${o})`,i=N(H),B=FE(i,{key:t,get:A.get(M),set:A.set(M)},u);return f.next({type:"state_creation",token:B}),B},I,{internalRoles:L,subject:f,install:(M)=>TE(M,A),default:(M)=>{return A.get(M)({get:(...u)=>mH(H,...u),find:(...u)=>q(H,...u),json:(u)=>iA(H,u)})}});return H.families.set(A.key,D),I}function uB(H,A,L){return TE(H,{key:`${A.key}:JSON`,get:($)=>({get:f})=>{let E=f(A,$);return L.toJson(E)},set:($)=>({set:f},E)=>{f(A,$,L.fromJson(E))}},["mutable","json"])}var xA=(H)=>JSON.parse(H),pH=(H)=>JSON.stringify(H),pr=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];var tB=(H,A)=>{let L=N(H);if(L.operation.open)return L.operation.prev.get(A.key);return L.valueMap.get(A.key)};var nu=(H,A)=>{let L=N(H);return MB(A,H).map(($)=>{let f=L.atoms.get($);if(f===void 0)throw new Error(`Atom "${$}", a dependency of selector "${A.key}", not found in store "${H.config.name}".`);return f.subject.subscribe(`${A.type}:${A.key}`,(E)=>{H.logger.info("\uD83D\uDCE2",A.type,A.key,"root",$,"went",E.oldValue,"->",E.newValue);let D=tB(L,A),M=VI(L,A);H.logger.info("\u2728",A.type,A.key,"went",D,"->",M),A.subject.next({newValue:M,oldValue:D})})})};function wA(H,A,L,I){function $(t){if(H.operation.open){let i=H.on.operationClose.subscribe(`state subscription ${L}`,()=>{i(),I(t)})}else I(t)}let f=CH(H,A);H.logger.info("\uD83D\uDC40",f.type,f.key,`Adding subscription "${L}"`);let E=f.type==="selector"||f.type==="readonly_selector",D=null,M=$;if(E)D=nu(H,f),M=(t)=>{if(D)D.length=0,D.push(...nu(H,f));$(t)};let o=f.subject.subscribe(L,M);return()=>{if(H.logger.info("\uD83D\uDE48",f.type,f.key,`Removing subscription "${L}"`),o(),D)for(let t of D)t()}}var iu=(H,A,L,I)=>{let $=CH(H,A);H.logger.info("\uD83D\uDC40","timeline",A.key,`Adding subscription "${L}"`);let f=$.subject.subscribe(L,I);return()=>{H.logger.info("\uD83D\uDE48","timeline",A.key,`Removing subscription "${L}" from timeline`),f()}};var pu=(H,A,L,I)=>{let $=CH(H,A);H.logger.info("\uD83D\uDC40","transaction",A.key,`Adding subscription "${L}"`);let f=$.subject.subscribe(L,I);return()=>{H.logger.info("\uD83D\uDE48","transaction",A.key,`Removing subscription "${L}"`),f()}};class f${Update;initializeState(H,A){let L=`*${H.key}`;A.atoms.delete(L),A.valueMap.delete(L);let I=H.family?{key:`*${H.family.key}`,subKey:H.family.subKey}:void 0,$=eI(A,{key:L,default:null},I);if(A.parent?.valueMap.has(L)){let f=A.parent.valueMap.get(L);A.valueMap.set(L,f)}return $}unsubscribeFromInnerValue;unsubscribeFromState;observeCore(H,A,L){let I=`tracker:${L.config.name}:${PH(L)?L.transactionMeta.update.key:"main"}:${H.key}`,$=mH(L,H);this.unsubscribeFromInnerValue=$.subscribe(I,(f)=>{vH(L,A,f)}),this.unsubscribeFromState=wA(L,H,I,(f)=>{if(f.newValue!==f.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=f.newValue.subscribe(I,(E)=>{vH(L,A,E)})})}updateCore(H,A,L){let I=`tracker:${L.config.name}:${PH(L)?L.transactionMeta.update.key:"main"}:${H.key}`;wA(L,A,I,({newValue:$,oldValue:f})=>{let E=L.timelineTopics.getRelatedKey(A.key);if(E){if(L.timelines.get(E)?.timeTraveling){let o=iu(L,{key:E,type:"timeline"},I,(u)=>{o(),vH(L,H,(t)=>{if(u==="redo"&&$)t.do($);else if(u==="undo"&&f)t.undo(f);return t})});return}}let D=L.on.operationClose.subscribe(I,()=>{D();let M=mH(L,H),o=$===null?-1:M.getUpdateNumber($),u=o-M.cacheUpdateNumber;if($&&u===1)vH(L,H,(t)=>(t.do($),t));else L.logger.info("\u274C","mutable_atom",H.key,`could not be updated. Expected update number ${M.cacheUpdateNumber+1}, but got ${o}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor(H,A){this.mutableState=H;let L=N(A);this.latestUpdateState=this.initializeState(H,L),this.observeCore(H,this.latestUpdateState,L),this.updateCore(H,this.latestUpdateState,L),L.trackers.set(H.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),L.trackers.delete(H.key)}}}function _E(H,A,L){H.logger.info("\uD83D\uDD28","atom",A.key,`creating in store "${H.config.name}"`);let I=N(H),$=I.atoms.get(A.key);if($&&$.type==="mutable_atom")return H.logger.error("\u274C","atom",A.key,"Tried to create atom, but it already exists in the store."),jL($);let f=new iH,E={...A,type:"mutable_atom",install:(o)=>{return o.logger.info("\uD83D\uDEE0\uFE0F","atom",A.key,`installing in store "${o.config.name}"`),_E(o,A,L)},subject:f};if(L)E.family=L;let D=A.default();I.atoms.set(E.key,E),gD(H,A.key),cL(I,A.key,D,f);let M=jL(E);if(A.effects){let o=0,u=[];for(let t of A.effects){let i=t({setSelf:(B)=>{vH(H,M,B)},onSet:(B)=>wA(H,M,`effect[${o}]`,B)});if(i)u.push(i);++o}E.cleanup=()=>{for(let t of u)t()}}if(new f$(M,H),!L)P0(M,A,H);return M}class Bu{trackers=new Map;Update;latestUpdateAtoms;mutableAtoms;constructor(H,A){let L=gI(A,{key:`*${H.key}`,default:null},["mutable","updates"]);this.latestUpdateAtoms=CH(A,L),this.mutableAtoms=H,this.mutableAtoms.subject.subscribe(`store=${A.config.name}::tracker-atom-family`,(I)=>{let{type:$,token:f}=I;if(f.family){let E=xA(f.family.subKey);switch($){case"state_creation":this.trackers.set(E,new f$(f,A));break;case"state_disposal":{let D=this.trackers.get(E);if(D)D[Symbol.dispose](),this.trackers.delete(E)}break}}})}}function UE(H,A,L){let I={key:A.key,type:"mutable_atom_family"},$=H.families.get(A.key);if($)H.logger.error("\u2757","mutable_atom_family",A.key,`Overwriting an existing ${rL($)} "${$.key}" in store "${H.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let f=new iH,D=Object.assign((M)=>{let o=pH(M),u={key:A.key,subKey:o},t=`${A.key}(${o})`,i=N(H),B={key:t,default:()=>A.default(M),toJson:A.toJson,fromJson:A.fromJson,mutable:!0};if(A.effects)B.effects=A.effects(M);let U=_E(i,B,u);return f.next({type:"state_creation",token:U}),U},I,{subject:f,install:(M)=>UE(M,A),toJson:A.toJson,fromJson:A.fromJson,internalRoles:L});return H.families.set(A.key,D),uB(H,D,A),new Bu(D,H),I}var cu=(H,A)=>{let L=N(A),I=`${H.key}:JSON`;return L.families.get(I)};var iA=(H,A)=>{if(A.family){let I=N(H),f={key:`${A.family.key}:JSON`,type:"selector_family"},E=CH(I,f),D=JSON.parse(A.family.subKey);return q(H,E,D)}return{type:"selector",key:`${A.key}:JSON`}};var uI=(H)=>{let L={type:"atom",key:`*${H.key}`};if(H.family)L.family={key:`*${H.family.key}`,subKey:H.family.subKey};return L};function N0(H){return typeof H==="object"&&H!==null&&"do"in H&&"undo"in H&&"subscribe"in H}function GE(H,A,L){let I=L.valueMap.get(A.key),$=H.valueMap.get(A.key);if(I!==$)return $;if(I===void 0)return A.default();L.logger.info("\uD83D\uDCC3","atom",A.key,"copying");let f=A.toJson(I),E=A.fromJson(f);return H.valueMap.set(A.key,E),new f$(A,L),E}function cL(H,A,L,I){let $=H.valueMap.get(A);if($ instanceof xE)$.use(L);if(L instanceof Promise){let f=new xE(L);return H.valueMap.set(A,f),f.then((E)=>{cL(H,A,E,I),I.next({newValue:E,oldValue:f})}).catch((E)=>{H.logger.error("\uD83D\uDCA5","state",A,"rejected:",E)}),f}return H.valueMap.set(A,L),L}var w0=(H,A)=>{let L=A.valueMap.get(H.key);if(H.type==="mutable_atom"&&PH(A)){let{parent:I}=A;L=GE(A,H,I)}return L},O0=(H,A)=>{let L=A.valueMap.get(H);if(L instanceof xE){let I=L,$=A.selectors.get(H)??A.readonlySelectors.get(H);if($)I.use($.get());return}if(A.operation.open)A.operation.prev.set(H,L);A.valueMap.delete(H),A.logger.info("\uD83D\uDDD1","state",H,"evicted")};var y0=(H,A)=>{return N(H).atomsThatAreDefault.has(A)},gD=(H,A)=>{let L=N(H);L.atomsThatAreDefault=new Set(L.atomsThatAreDefault).add(A)},R0=(H,A)=>{let L=N(H);L.atomsThatAreDefault=new Set(N(H).atomsThatAreDefault),L.atomsThatAreDefault.delete(A)};function eI(H,A,L){H.logger.info("\uD83D\uDD28","atom",A.key,`creating in store "${H.config.name}"`);let I=N(H),$=I.atoms.get(A.key);if($&&$.type==="atom")return H.logger.error("\u274C","atom",A.key,"Tried to create atom, but it already exists in the store."),jL($);let f=new iH,E={...A,type:"atom",install:(o)=>{return o.logger.info("\uD83D\uDEE0\uFE0F","atom",A.key,`installing in store "${o.config.name}"`),eI(o,A,L)},subject:f};if(L)E.family=L;let D=A.default;if(A.default instanceof Function)D=A.default();I.atoms.set(E.key,E),gD(H,A.key),cL(I,A.key,D,f);let M=jL(E);if(A.effects){let o=0,u=[];for(let t of A.effects){let i=t({setSelf:(B)=>{vH(H,M,B)},onSet:(B)=>wA(H,M,`effect[${o}]`,B)});if(i)u.push(i);++o}E.cleanup=()=>{for(let t of u)t()}}return M}function iB(H,A){if("mutable"in A){let $=_E(H,A,void 0);return H.on.atomCreation.next($),$}let I=eI(H,A,void 0);return H.on.atomCreation.next(I),I}function uu(H,A){let L=N(H),{key:I,family:$}=A,f=CH(L,A);if(!$)H.logger.error("\u274C","atom",I,"Standalone atoms cannot be disposed.");else{f.cleanup?.();let E=H.valueMap.get(f.key),D=CH(H,{key:$.key,type:"atom_family"}),M={type:"state_disposal",subType:"atom",token:A,value:E};D.subject.next(M);let o=PH(L);if(L.atoms.delete(I),L.valueMap.delete(I),L.selectorAtoms.delete(I),L.atomsThatAreDefault.delete(I),H.timelineTopics.delete(I),A.type==="mutable_atom"){let u=uI(A);uu(H,u),H.trackers.delete(I)}if(H.logger.info("\uD83D\uDD25","atom",I,"deleted"),o&&L.transactionMeta.phase==="building"){let u=L.transactionMeta.update.updates.at(-1);if(!(u?.type==="molecule_disposal"&&u.values.some(([B])=>B===f.family?.key)))L.transactionMeta.update.updates.push(M)}else H.on.atomDisposal.next(A)}}class nA extends Set{mode="record";subject=new iH;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(H,A=0){super(H);if(H instanceof nA)this.parent=H,this.cacheUpdateNumber=H.cacheUpdateNumber;if(A)this.cacheLimit=A,this.cache=new Array(A),this.subscribe("auto cache",(L)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=L})}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(H){let A=new nA(H.members,H.cacheLimit);return A.cache=H.cache,A.cacheIdx=H.cacheIdx,A.cacheUpdateNumber=H.cacheUpdateNumber,A}add(H){let A=super.add(H);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${pH(H)}`);return A}clear(){let H=this.mode==="record"?[...this]:null;if(super.clear(),H)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify(H)}`)}delete(H){let A=super.delete(H);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${pH(H)}`);return A}parent;child=null;transactionUpdates=null;transaction(H){this.mode="transaction",this.transactionUpdates=[],this.child=new nA(this);let A=this.child._subscribe("transaction",(L)=>{this.transactionUpdates?.push(L)});try{if(H(this.child)){for(let I of this.transactionUpdates)this.doStep(I);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(L){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",L),L}finally{A(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe(H,A){return this.subject.subscribe(H,A)}subscribe(H,A){return this.subject.subscribe(H,(L)=>{A(`${this.cacheUpdateNumber}=${L}`)})}emit(H){this.subject.next(H)}doStep(H){let A=H.indexOf(":"),L=H.substring(0,A),I=H.substring(A+1);switch(L){case"add":this.add(JSON.parse(I));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(I));break;case"tx":for(let $ of I.split(";"))this.doStep($)}}getUpdateNumber(H){let A=H.indexOf("=");return Number(H.substring(0,A))}do(H){let A=H.indexOf("="),L=Number(H.substring(0,A)),I=L-this.cacheUpdateNumber;if(I>0){if(I===1){this.mode="playback";let f=H.substring(A+1);return this.doStep(f),this.mode="record",this.cacheUpdateNumber=L,null}return this.cacheUpdateNumber+1}if(Math.abs(I)<this.cacheLimit){let f=this.cacheIdx+I;if(this.cache[f]===H)return null;this.mode="playback";let D=!1;while(!D){this.cacheIdx%=this.cacheLimit;let o=this.cache[this.cacheIdx];if(this.cacheIdx--,!o)return"OUT_OF_RANGE";this.undo(o),D=this.cacheIdx===f-1}let M=H.substring(A+1);return this.doStep(M),this.mode="record",this.cacheUpdateNumber=L,null}return"OUT_OF_RANGE"}undoStep(H){let A=H.indexOf(":"),L=H.substring(0,A),I=H.substring(A+1);switch(L){case"add":this.delete(JSON.parse(I));break;case"del":this.add(JSON.parse(I));break;case"clear":{let $=JSON.parse(I);for(let f of $)this.add(f);break}case"tx":{let $=I.split(";");for(let f=$.length-1;f>=0;f--)this.undoStep($[f])}}}undo(H){let A=H.indexOf("=");if(Number(H.substring(0,A))===this.cacheUpdateNumber){this.mode="playback";let I=H.substring(A+1);return this.undoStep(I),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}}class WE{toolkit;options;defaultContent;molecules=new Map;relations;states;core;transact(H,A){let L=this.toolkit;this.toolkit=H,A(this),this.toolkit=L}store;realm;[Symbol.dispose](){}constructor(H,A,L=e.STORE){this.store=L,this.realm=new xu(L),this.options=H,this.defaultContent=A,this.store.miscResources.set(`join:${H.key}`,this),this.realm.allocate("root",H.key),this.toolkit={get:(...W)=>mH(L,...W),set:(...W)=>{vH(L,...W)},find:(...W)=>q(L,...W),json:(W)=>iA(L,W)};let I=H.between[0],$=H.between[1],f=UE(L,{key:`${H.key}/relatedKeys`,default:()=>new nA,mutable:!0,fromJson:(W)=>nA.fromJSON(W),toJson:(W)=>W.toJSON()},["join","relations"]);this.core={relatedKeysAtoms:f};let E=({get:W},P)=>W(f,P),D=({set:W},P,V)=>{if(!this.store.molecules.has(pH(P)))this.realm.allocate(H.key,P);W(f,P,(J)=>J.add(V)),W(f,V,(J)=>J.add(P))},M=({set:W},P,V)=>{W(f,P,(J)=>{return J.delete(V),J}),W(f,V,(J)=>{return J.delete(P),J})},o=(W,P,V)=>{let{find:J,get:a,set:h}=W,X=J(f,P),MH=a(X);for(let Z of MH){if(V.includes(Z))continue;h(f,Z,(wH)=>{return wH.delete(P),wH})}h(X,(Z)=>{return Z.transaction((oH)=>{oH.clear();for(let wH of V){let DA=E(W,wH),ZA=DA.has(P);if(this.relations.cardinality==="1:n"){let HI=[];for(let w of DA){if(w===P)continue;let r=E(W,w);if(r.delete(wH),r.size===0)HI.push(w)}if(!ZA&&DA.size>0)DA.clear();for(let w of HI){let r=[wH,w].sort(),TH=`"${r[0]}:${r[1]}"`;this.molecules.delete(TH)}}if(!ZA)DA.add(P);oH.add(wH)}return!0}),Z})},u=(W,P,V)=>{let{set:J}=W;J(f,P,(a)=>{return a.transaction((h)=>{for(let X of V)h.add(X);return!0}),a});for(let a of V)J(f,a,(h)=>{return h.add(P),h});return!0},t=(W,P,V)=>{let J=E(W,P);return V?J.has(V):J.size>0},i={getRelatedKeys:(W)=>E(this.toolkit,W),addRelation:(W,P)=>{this.store.moleculeJoins.set(W,H.key),this.store.moleculeJoins.set(P,H.key),D(this.toolkit,W,P)},deleteRelation:(W,P)=>{M(this.toolkit,W,P)},replaceRelationsSafely:(W,P)=>{o(this.toolkit,W,P)},replaceRelationsUnsafely:(W,P)=>{u(this.toolkit,W,P)},has:(W,P)=>t(this.toolkit,W,P)},B,U;if(A){U=gI(L,{key:`${H.key}/content`,default:A},["join","content"]);let W=({get:J},a)=>J(U,a),P=({set:J},a,h)=>{J(U,a,h)};B=Object.assign(i,{getContent:(J)=>{return W(this.toolkit,J)},setContent:(J,a)=>{P(this.toolkit,J,a)},deleteContent:(J)=>{this.realm.deallocate(J)}})}else B=i;let x=new pA(H,{externalStore:B,isAType:H.isAType,isBType:H.isBType,makeContentKey:(...W)=>{let[P,V]=W,J=W.sort(),a=`${J[0]}:${J[1]}`,h=L.molecules.get(pH(P)),X=L.molecules.get(pH(V));if(!h)this.realm.allocate(H.key,P);if(!X)this.realm.allocate(H.key,V);return this.realm.allocate(P,a,"all"),this.realm.claim(V,a),this.store.moleculeJoins.set(a,H.key),a}}),T=()=>JI(L,{key:`${H.key}/singleRelatedKey`,get:(W)=>({get:P})=>{let V=P(f,W);for(let J of V)return J;return null}},["join","keys"]),F=()=>{return JI(L,{key:`${H.key}/multipleRelatedKeys`,get:(W)=>({get:P})=>{let V=cu(f,L);return P(V,W).members}},["join","keys"])},m=()=>JI(L,{key:`${H.key}/singleRelatedEntry`,get:(W)=>({get:P})=>{let V=P(f,W);for(let J of V){let a=x.isAType?.(W)?W:void 0,h=a===void 0?W:void 0;a??=J,h??=J;let X=x.makeContentKey(a,h),MH=P(U,X);return[J,MH]}return null}},["join","entries"]),Y=()=>JI(L,{key:`${H.key}/multipleRelatedEntries`,get:(W)=>({get:P})=>{let V=cu(f,L);return P(V,W).members.map((a)=>{let h=x.isAType?.(W)?W:void 0,X=h===void 0?W:void 0;h??=a,X??=a;let MH=x.makeContentKey(h,X),Z=P(U,MH);return[a,Z]})}},["join","entries"]);switch(H.cardinality){case"1:1":{let W=T(),P=`${I}KeyOf${XH($)}`,V=`${$}KeyOf${XH(I)}`,J={[P]:W,[V]:W},a;if(A){let h=m(),X=`${I}EntryOf${XH($)}`,MH=`${$}EntryOf${XH(I)}`,Z={[X]:h,[MH]:h};a=Object.assign(J,Z)}else a=J;this.relations=x,this.states=a;break}case"1:n":{let W=T(),P=F(),V=`${I}KeyOf${XH($)}`,J=`${$}KeysOf${XH(I)}`,a={[V]:W,[J]:P},h;if(A){let X=m(),MH=Y(),Z=`${I}EntryOf${XH($)}`,oH=`${$}EntriesOf${XH(I)}`,wH={[Z]:X,[oH]:MH};h=Object.assign(a,wH)}else h=a;this.relations=x,this.states=h;break}case"n:n":{let W=F(),P=`${I}KeysOf${XH($)}`,V=`${$}KeysOf${XH(I)}`,J={[P]:W,[V]:W},a;if(A){let h=Y(),X=`${I}EntriesOf${XH($)}`,MH=`${$}EntriesOf${XH(I)}`,Z={[X]:h,[MH]:h};a=Object.assign(J,Z)}else a=J;this.relations=x,this.states=a}}}}function Hf(H,A){let L=A.joins.get(H.key);if(L===void 0){let $=e.STORE.joins.get(H.key);if($===void 0)throw new Error(`Join "${H.key}" not found in store "${A.config.name}"`);L=new WE($.options,$.defaultContent,A),A.joins.set(H.key,L)}return L}function wI(H,A,L){let I=Hf(H,L),$=N(L);if(PH($)){let{toolkit:f}=$.transactionMeta;I.transact(f,({relations:E})=>{A(E)})}else A(I.relations)}function Af(H,A,L){let I=Hf(H,L),$;switch(H.cardinality){case"1:1":{let f=`${H.a}KeyOf${XH(H.b)}`,E=`${H.b}KeyOf${XH(H.a)}`;$={get[f](){let M=I.states[f];return q(L,M,A)},get[E](){let M=I.states[E];return q(L,M,A)}};let D=`${H.a}EntryOf${XH(H.b)}`;if(D in I.states){let M=`${H.b}EntryOf${XH(H.a)}`;Object.assign($,{get[D](){let o=I.states[D];return q(L,o,A)},get[M](){let o=I.states[M];return q(L,o,A)}})}break}case"1:n":{let f=`${H.a}KeyOf${XH(H.b)}`,E=`${H.b}KeysOf${XH(H.a)}`;$={get[f](){let M=I.states[f];return q(L,M,A)},get[E](){let M=I.states[E];return q(L,M,A)}};let D=`${H.a}EntryOf${XH(H.b)}`;if(D in I.states){let M=`${H.b}EntriesOf${XH(H.a)}`;Object.assign($,{get[D](){let o=I.states[D];return q(L,o,A)},get[M](){let o=I.states[M];return q(L,o,A)}})}break}case"n:n":{let f=`${H.a}KeysOf${XH(H.b)}`,E=`${H.b}KeysOf${XH(H.a)}`;$={get[f](){let M=I.states[f];return q(L,M,A)},get[E](){let M=I.states[E];return q(L,M,A)}};let D=`${H.a}EntriesOf${XH(H.b)}`;if(D in I.states){let M=`${H.b}EntriesOf${XH(H.a)}`;Object.assign($,{get[D](){let o=I.states[D];return q(L,o,A)},get[M](){let o=I.states[M];return q(L,o,A)}})}}}return $}function pB(H,A){return Hf(H,A).core.relatedKeysAtoms}function IB(H){return H.startsWith("\uD83D\uDD0D ")}function KI(H){return iB(e.STORE,H)}function E$(H){return X0(e.STORE,H)}function eD(H,A,L=e.STORE){return L.joins.set(H.key,new WE(H,A,L)),{key:H.key,type:"join",a:H.between[0],b:H.between[1],cardinality:H.cardinality}}function nB(H){return pB(H,e.STORE)}var Uu=(H)=>(A,L,I,$,...f)=>{console[H](`${A} ${L} "${I}" ${$}`,...f)},$5={error:Uu("error"),info:Uu("info"),warn:Uu("warn")};class $${logLevel;filter;logger;constructor(H,A,L=$5){this.logLevel=H,this.filter=A,this.logger=L}error=(...H)=>{if((this.filter?.(...H)??!0)&&this.logLevel!==null)this.logger.error(...H)};info=(...H)=>{if((this.filter?.(...H)??!0)&&this.logLevel==="info")this.logger.info(...H)};warn=(...H)=>{if((this.filter?.(...H)??!0)&&this.logLevel!=="error"&&this.logLevel!==null)this.logger.warn(...H)}}var ld=Symbol("claim");class BB{store;constructor(H=e.STORE){this.store=H,z0("root",H)}allocate(H,A,L){return A$(this.store,H,A,L)}fuse(H,A,L){return b0(this.store,H,A,L)}deallocate(H){L$(this.store,H)}claim(H,A,L){return e$(this.store,H,A,L)}}class xu{store;realm;constructor(H=e.STORE){this.store=H,this.realm=new BB(H)}allocate(H,A,L){A$(this.store,H,A,L)}deallocate(H){L$(this.store,H)}claim(H,A,L){e$(this.store,H,A,L)}}function HM(H){return S0(e.STORE,H)}function D$(H){return ou(e.STORE,H)}class cB extends Map{set(H,A){if(this.has(H))return console.warn("Tried to set a key that already exists in an InvariantMap",{key:H,value:A}),this;return super.set(H,A)}clear(){throw new Error("Cannot clear an InvariantMap")}}class AM{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(H){this.key=H}static existing=new cB;static create(H,A){let L=new AM(H),{type:I,globals:$,actions:f,perspectives:E}=A(L),D={type:I,key:H,globals:$,actions:f,perspectives:E};return AM.existing.set(H,D),D}add(...H){switch(H[0].type){case"atom":case"mutable_atom":this.globals.push(...H);break;case"transaction":this.actions.push(...H);break;case"atom_family":case"mutable_atom_family":{let[L,I]=H;this.perspectives.push({type:"realtime_perspective",resourceAtoms:L,viewAtoms:I})}break}return this}}function xB(H){let{key:A,config:L}=H,I=AM.create(A,L),{actions:$}=I;for(let f of $)e0(e.STORE,A,f.key);return d0(e.STORE,A,-1),I}var Zd=KI({key:"usersInRoomIndex",mutable:!0,default:()=>new nA,toJson:(H)=>H.toJSON(),fromJson:(H)=>nA.fromJSON(H)}),Cu=KI({key:"roomIndex",default:()=>new nA,mutable:!0,toJson:(H)=>H.toJSON(),fromJson:(H)=>nA.fromJSON(H)}),f5={enteredAtEpoch:0},mE=eD({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:(H)=>typeof H==="string",isBType:(H)=>typeof H==="string"},f5),hd=HM({key:"usersInMyRoomView",get:(H)=>({find:A})=>{let L=nB(mE);return[A(L,H)]}});import{spawn as E5}from"child_process";class Lf{listeners;globalListeners;handleEvent(H,...A){for(let I of this.globalListeners)I(H,...A);let L=this.listeners.get(H);if(L)for(let I of L)I(...A)}id="no_id_retrieved";emit;constructor(H){this.emit=H,this.listeners=new Map,this.globalListeners=new Set}on(H,A){let L=this.listeners.get(H);if(L)L.add(A);else this.listeners.set(H,new Set([A]));return this}onAny(H){return this.globalListeners.add(H),this}off(H,A){let L=this.listeners.get(H);if(L)if(A)L.delete(A);else this.listeners.delete(H);return this}offAny(H){return this.globalListeners.delete(H),this}}class PE extends Lf{incompleteData="";unprocessedEvents=[];incompleteLog="";unprocessedLogs=[];id="#####";process;key;logger;handleLog(H){if(Array.isArray(H)){let[A,...L]=H;switch(A){case"i":this.logger.info(...L);break;case"w":this.logger.warn(...L);break;case"e":this.logger.error(...L);break;default:return}}}constructor(H,A,L){super((I,...$)=>{let f=JSON.stringify([I,...$])+"\x03",E=(D)=>{if(D.code==="EPIPE")console.error("EPIPE error during write",this.process.stdin);this.process.stdin.removeListener("error",E)};return this.process.stdin.once("error",E),this.process.stdin.write(f),this});if(this.process=H,this.key=A,this.logger=L??{info:(...I)=>{console.info(this.id,this.key,...I)},warn:(...I)=>{console.warn(this.id,this.key,...I)},error:(...I)=>{console.error(this.id,this.key,...I)}},this.process.stdout.on("data",(I)=>{let $=I.toString();if($==="ALIVE")return;this.unprocessedEvents.push(...$.split("\x03"));let f=this.unprocessedEvents.shift();this.incompleteData+=f??"";try{if(this.incompleteData.startsWith("error"))console.log("\u2757",this.incompleteData);let E=xA(this.incompleteData);this.handleEvent(...E);while(this.unprocessedEvents.length>0){let D=this.unprocessedEvents.shift();if(D){if(this.unprocessedEvents.length===0)this.incompleteData=D;E=xA(D),this.handleEvent(...E)}}this.incompleteData=""}catch(E){console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.warn(this.incompleteData),console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.error(E)}}),this.process.stderr.on("data",(I)=>{let $=I.toString();this.unprocessedLogs.push(...$.split("\x03"));let f=this.unprocessedLogs.shift();this.incompleteLog+=f??"";try{let E=xA(this.incompleteLog);this.handleLog(E);while(this.unprocessedLogs.length>0)if(this.incompleteLog=this.unprocessedLogs.shift()??"",this.incompleteLog)E=xA(this.incompleteLog),this.handleLog(E)}catch(E){console.error("\u274C\u274C\u274C"),console.error(this.incompleteLog),console.error(E),console.error("\u274C\u274C\u274C\uFE0F")}}),H.pid)this.id=H.pid.toString()}}class UB extends Lf{in;out;id="no_id_retrieved";disposalFunctions=[];constructor(H){super((...A)=>{return this.out.next(A),this});this.id=H,this.in=new iH,this.out=new iH,this.in.subscribe("socket",(A)=>{this.handleEvent(...A)})}dispose(){for(let H of this.disposalFunctions)H()}}class Tu extends Lf{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...H){this.process.stderr.write(pH(H.map((A)=>A instanceof nA?`{ ${A.toJSON().members.join(" | ")} }`:A))+"\x03")}logger={info:(...H)=>{this.log("i",...H)},warn:(...H)=>{this.log("w",...H)},error:(...H)=>{this.log("e",...H)}};constructor(){super((H,...A)=>{let L=JSON.stringify([H,...A]);return this.process.stdout.write(L+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",(H)=>{let A=H.toString();this.unprocessedEvents.push(...A.split("\x03"));let L=this.unprocessedEvents.shift();this.incompleteData+=L??"";try{let I=xA(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",I),this.handleEvent(...I);while(this.unprocessedEvents.length>0){let $=this.unprocessedEvents.shift();if($){if(this.unprocessedEvents.length===0)this.incompleteData=$;let f=xA($);this.handleEvent(...f)}}this.incompleteData=""}catch(I){if(I instanceof Error)this.logger.error("\u2757",I.message,I.cause,I.stack)}}),this.on("exit",()=>{this.logger.info("\uD83D\uDD25",this.id,'received "exit"'),process.exit(0)}),process.on("exit",(H)=>{this.logger.info("\uD83D\uDD25",this.id,`exited with code ${H}`)}),process.on("end",()=>{this.logger.info("\uD83D\uDD25",this.id,"ended"),process.exit(0)}),process.on("SIGTERM",()=>{this.logger.error("\uD83D\uDD25",this.id,"terminated"),process.exit(0)}),process.on("SIGINT",()=>{this.logger.error("\uD83D\uDD25",this.id,"interrupted"),process.exit(0)}),process.pid)this.id=process.pid?.toString();this.on("user-joins",(H)=>{this.logger.info("\uD83D\uDC64","user",H,"joined");let A=new UB(`user:${H}`);this.relays.set(H,A),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let L of this.relayServices){let I=L(A);if(I)A.disposalFunctions.push(I)}this.on(`user:${H}`,(...L)=>{A.in.next(L)}),A.out.subscribe("socket",(L)=>{this.emit(...L)})}),this.on("user-leaves",(H)=>{let A=this.relays.get(H);if(this.off(`relay:${H}`),A)A.dispose(),this.relays.delete(H)}),process.stdout.write("ALIVE")}relay(H){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push(H)}}var Gu=E$({key:"roomArguments",default:["echo",["Hello World!"]]}),CB=HM({key:"room",get:(H)=>async({get:A,find:L})=>{let I=L(Gu,H),$=A(I),[f,E]=$,D=await new Promise((M)=>{let o=E5(f,E,{env:process.env}),u=(t)=>{if(t.toString()==="ALIVE")o.stdout.off("data",u),M(o)};o.stdout.on("data",u)});return new PE(D,H)}});var Cq=D$({key:"createRoom",do:({get:H,set:A,find:L},I,$,f)=>{let E=f?[$,f]:[$],D=L(Gu,I);A(D,E),A(Cu,(u)=>u.add(I));let M=L(CB,I);return H(M)}}),Tq=D$({key:"joinRoom",do:(H,A,L,I)=>{let $={enteredAtEpoch:I};return wI(mE,(f)=>{f.set({room:A,user:L},$)},H.env().store),$}}),Gq=D$({key:"leaveRoom",do:(H,A,L)=>{wI(mE,(I)=>{I.delete({room:A,user:L})},H.env().store)}}),Fq=D$({key:"destroyRoom",do:(H,A)=>{wI(mE,(L)=>{L.delete({room:A})},H.env().store),H.set(Cu,(L)=>(L.delete(A),L))}});function Fu(H,A){return A.map((L)=>{switch(L.type){case"transaction_update":{let I=Fu(H,L.updates);return{...L,updates:I}}case"atom_update":case"selector_update":case"molecule_creation":case"molecule_disposal":case"molecule_transfer":case"state_creation":case"state_disposal":return L}}).filter((L)=>{switch(L.type){case"atom_update":case"selector_update":return H.includes(L.key);case"state_creation":case"state_disposal":return H.includes(L.token.key);case"molecule_creation":case"transaction_update":case"molecule_disposal":case"molecule_transfer":return!0}})}var mq=E$({key:"redactor",default:{occlude:(H)=>H}}),If=E$({key:"unacknowledgedUpdates",default:()=>[]});var LM=E$({key:"sockets",default:null}),_u=KI({key:"socketsIndex",mutable:!0,default:()=>new nA,toJson:(H)=>H.toJSON(),fromJson:(H)=>nA.fromJSON(H)}),Wu=KI({key:"usersIndex",mutable:!0,default:()=>new nA,toJson:(H)=>H.toJSON(),fromJson:(H)=>nA.fromJSON(H)}),M$=eD({key:"usersOfSockets",between:["user","socket"],cardinality:"1:1",isAType:(H)=>H.startsWith("user::"),isBType:(H)=>H.startsWith("socket::")});function TB(H,A,L,I){let $=A.key;return function f(){let E=[];for(let M of A.globals){let o=M.type==="mutable_atom"?iA(H,M):M,u=mH(H,o);E.push(o,u)}for(let M of A.perspectives){let{viewAtoms:o,resourceAtoms:u}=M,t=q(H,o,L),i=mH(H,t);H.logger.info("\uD83D\uDC41","atom",u.key,`${L} can see`,{viewAtoms:o,resourceAtoms:u,userView:i});for(let B of i){let U=B.type==="mutable_atom"?iA(H,B):B,x=mH(H,U);E.push(U,x)}}let D=FA(H)?H.transactionMeta.epoch.get($)??null:null;I?.emit(`continuity-init:${$}`,D,E)}}function GB(H,A,L){let I=A.key;return function $(f){H.logger.info("\uD83D\uDECE\uFE0F","continuity",I,"received",f);let{key:E,id:D}=f,M=`tx-run:${E}:${D}`,o=`${M}:start`,u=`${M}:end`;performance.mark(o);try{q$(H,{type:"transaction",key:E},D)(...f.params)}catch(i){if(i instanceof Error)H.logger.error("\u274C","continuity",I,`failed to run transaction ${E} from ${L} with update ${D}`,i.message)}performance.mark(u);let t=performance.measure(M,o,u);H?.logger.info("\uD83D\uDE80","transaction",E,D,L,t.duration)}}function FB(H,A,L,I){let $=A.key;return function f(E){if(H.logger.info("\uD83D\uDC4D","continuity",$,`${L} acknowledged epoch ${E}`),I[0]?.epoch===E)vH(H,If,L,(M)=>{return M.shift(),H.logger.info("\uD83D\uDC4D","continuity",$,`${L} unacknowledged update queue now has`,M.length,"items"),M})}}function _B(H,A,L,I){let $=A.key,f=[];for(let E of A.actions){let D=pu(H,E,`sync-continuity:${$}:${L}`,(M)=>{try{let o=A.globals.map((i)=>{if(i.type==="atom")return i.key;return uI(i).key}).concat(A.perspectives.flatMap((i)=>{let{viewAtoms:B}=i,U=q(H,B,L);return mH(H,U).map((T)=>{return T.type==="mutable_atom"?"*"+T.key:T.key})})),u=Fu(o,M.updates),t={...M,updates:u};vH(H,If,L,(i)=>{if(t)i.push(t),i.sort((B,U)=>B.epoch-U.epoch),H.logger.info("\uD83D\uDC4D","continuity",$,`${L} unacknowledged update queue now has`,i.length,"items");return i}),I?.emit(`tx-new:${$}`,t)}catch(o){if(o instanceof Error)H.logger.error("\u274C","continuity",$,`${L} failed to send update from transaction ${E.key} to ${L}`,o.message)}});f.push(D)}return f}function WB(H,A,L,I){let $=A.key,f=[];for(let E of A.perspectives){let{viewAtoms:D}=E,M=q(H,D,L),o=wA(H,M,`sync-continuity:${$}:${L}:perspective:${E.resourceAtoms.key}`,({oldValue:u,newValue:t})=>{let i=u.map((T)=>T.key),B=t.map((T)=>T.key),U=u.filter((T)=>!B.includes(T.key)),x=t.filter((T)=>!i.includes(T.key)).flatMap((T)=>{let F=T.type==="mutable_atom"?iA(H,T):T,m=mH(H,F);return[F,m]});if(H.logger.info("\uD83D\uDC41","atom",E.resourceAtoms.key,`${L} has a new perspective`,{oldKeys:i,newKeys:B,revealed:x,concealed:U}),x.length>0)I?.emit(`reveal:${$}`,x);if(U.length>0)I?.emit(`conceal:${$}`,U)});f.push(o)}return f}function mB({socket:H,store:A=e.STORE}){return function L(I){let $=H,f=I.key,E=Af(M$,`socket::${$.id}`,A).userKeyOfSocket,D=mH(A,E);if(!D)return A.logger.error("\u274C","continuity",f,`Tried to create a synchronizer for a socket (${$.id}) that is not connected to a user.`),()=>{};let M=Af(M$,D,A).socketKeyOfUser,o=wA(A,M,`sync-continuity:${f}:${D}`,({newValue:F})=>{if(A.logger.info("\uD83D\uDC4B","continuity",f,`seeing ${D} on new socket ${F}`),F===null){A.logger.warn("\u274C","continuity",f,`User (${D}) is not connected to a socket, waiting for them to reappear.`);return}let m=q(A,LM,F);$=mH(A,m);for(let W of u)$?.emit(`tx-new:${f}`,W)}),u=mH(A,If,D),t=[],i=WB(A,I,D,$),B=_B(A,I,D,$);t.push(...i,...B);let U=TB(A,I,D,H);$.off(`get:${f}`,U),$.on(`get:${f}`,U);let x=GB(A,I,D);$.off(`tx-run:${f}`,x),$.on(`tx-run:${f}`,x);let T=FB(A,I,D,u);return $?.on(`ack:${f}`,T),()=>{for(let F of t)F();$?.off(`ack:${f}`,T),$?.off(`get:${f}`,U),$?.off(`tx-run:${f}`,x)}}}var h_=s1(Dt(),1);var n=Symbol.for("drizzle:entityKind"),Og=Symbol.for("drizzle:hasOwnEntityKind");function _(H,A){if(!H||typeof H!=="object")return!1;if(H instanceof A)return!0;if(!Object.prototype.hasOwnProperty.call(A,n))throw new Error(`Class "${A.name??"<unknown>"}" 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 L=Object.getPrototypeOf(H).constructor;if(L)while(L){if(n in L&&L[n]===A[n])return!0;L=Object.getPrototypeOf(L)}return!1}class aH{constructor(H,A){this.table=H,this.config=A,this.name=A.name,this.keyAsName=A.keyAsName,this.notNull=A.notNull,this.default=A.default,this.defaultFn=A.defaultFn,this.onUpdateFn=A.onUpdateFn,this.hasDefault=A.hasDefault,this.primary=A.primaryKey,this.isUnique=A.isUnique,this.uniqueName=A.uniqueName,this.uniqueType=A.uniqueType,this.dataType=A.dataType,this.columnType=A.columnType,this.generated=A.generated,this.generatedIdentity=A.generatedIdentity}static[n]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(H){return H}mapToDriverValue(H){return H}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class Mt{static[n]="ColumnBuilder";config;constructor(H,A,L){this.config={name:H,keyAsName:H==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:A,columnType:L,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(H){return this.config.default=H,this.config.hasDefault=!0,this}$defaultFn(H){return this.config.defaultFn=H,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(H){return this.config.onUpdateFn=H,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(H){if(this.config.name!=="")return;this.config.name=H}}var OL=Symbol.for("drizzle:Name");class ot{static[n]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(H,A){if(this.reference=()=>{let{name:L,columns:I,foreignColumns:$}=H();return{name:L,columns:I,foreignTable:$[0].table,foreignColumns:$}},A)this._onUpdate=A.onUpdate,this._onDelete=A.onDelete}onUpdate(H){return this._onUpdate=H===void 0?"no action":H,this}onDelete(H){return this._onDelete=H===void 0?"no action":H,this}build(H){return new Fx(H,this)}}class Fx{constructor(H,A){this.table=H,this.reference=A.reference,this.onUpdate=A._onUpdate,this.onDelete=A._onDelete}static[n]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:H,columns:A,foreignColumns:L}=this.reference(),I=A.map((E)=>E.name),$=L.map((E)=>E.name),f=[this.table[OL],...I,L[0].table[OL],...$];return H??`${f.join("_")}_fk`}}function TM(H,...A){return H(...A)}function _x(H,A){return`${H[OL]}_${A.join("_")}_unique`}function Wx(H,A,L){for(let I=A;I<H.length;I++){let $=H[I];if($==="\\"){I++;continue}if($==='"')return[H.slice(A,I).replace(/\\/g,""),I+1];if(L)continue;if($===","||$==="}")return[H.slice(A,I).replace(/\\/g,""),I]}return[H.slice(A).replace(/\\/g,""),H.length]}function mx(H,A=0){let L=[],I=A,$=!1;while(I<H.length){let f=H[I];if(f===","){if($||I===A)L.push("");$=!0,I++;continue}if($=!1,f==="\\"){I+=2;continue}if(f==='"'){let[M,o]=Wx(H,I+1,!0);L.push(M),I=o;continue}if(f==="}")return[L,I+1];if(f==="{"){let[M,o]=mx(H,I+1);L.push(M),I=o;continue}let[E,D]=Wx(H,I,!1);L.push(E),I=D}return[L,I]}function Px(H){let[A]=mx(H,1);return A}function ut(H){return`{${H.map((A)=>{if(Array.isArray(A))return ut(A);if(typeof A==="string")return`"${A.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${A}`}).join(",")}}`}class z extends Mt{foreignKeyConfigs=[];static[n]="PgColumnBuilder";array(H){return new Sx(this.config.name,this,H)}references(H,A={}){return this.foreignKeyConfigs.push({ref:H,actions:A}),this}unique(H,A){return this.config.isUnique=!0,this.config.uniqueName=H,this.config.uniqueType=A?.nulls,this}generatedAlwaysAs(H){return this.config.generated={as:H,type:"always",mode:"stored"},this}buildForeignKeys(H,A){return this.foreignKeyConfigs.map(({ref:L,actions:I})=>{return TM(($,f)=>{let E=new ot(()=>{let D=$();return{columns:[H],foreignColumns:[D]}});if(f.onUpdate)E.onUpdate(f.onUpdate);if(f.onDelete)E.onDelete(f.onDelete);return E.build(A)},L,I)})}buildExtraConfigColumn(H){return new Xx(H,this.config)}}class K extends aH{constructor(H,A){if(!A.uniqueName)A.uniqueName=_x(H,[A.name]);super(H,A);this.table=H}static[n]="PgColumn"}class Xx extends K{static[n]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(H){return this.indexConfig.opClass=H,this}}class NE{static[n]="IndexedColumn";constructor(H,A,L,I){this.name=H,this.keyAsName=A,this.type=L,this.indexConfig=I}name;keyAsName;type;indexConfig}class Sx extends z{static[n]="PgArrayBuilder";constructor(H,A,L){super(H,"array","PgArray");this.config.baseBuilder=A,this.config.size=L}build(H){let A=this.config.baseBuilder.build(H);return new tt(H,this.config,A)}}class tt extends K{constructor(H,A,L,I){super(H,A);this.baseColumn=L,this.range=I,this.size=A.size}size;static[n]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue(H){if(typeof H==="string")H=Px(H);return H.map((A)=>this.baseColumn.mapFromDriverValue(A))}mapToDriverValue(H,A=!1){let L=H.map((I)=>I===null?null:_(this.baseColumn,tt)?this.baseColumn.mapToDriverValue(I,!0):this.baseColumn.mapToDriverValue(I));if(A)return L;return ut(L)}}var it=Symbol.for("drizzle:isPgEnum");function Jx(H){return!!H&&typeof H==="function"&&it in H&&H[it]===!0}class Vx extends z{static[n]="PgEnumColumnBuilder";constructor(H,A){super(H,"string","PgEnumColumn");this.config.enum=A}build(H){return new wx(H,this.config)}}class wx extends K{static[n]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(H,A){super(H,A);this.enum=A.enum}getSQLType(){return this.enum.enumName}}function GM(H,A){return m4(H,A,void 0)}function m4(H,A,L){let I=Object.assign(($)=>new Vx($??"",I),{enumName:H,enumValues:A,schema:L,[it]:!0});return I}class BA{static[n]="Subquery";constructor(H,A,L,I=!1){this._={brand:"Subquery",sql:H,selectedFields:A,alias:L,isWith:I}}}class yE extends BA{static[n]="WithSubquery"}var Kx="0.41.0";var pt,nt,lH={startActiveSpan(H,A){if(!pt)return A();if(!nt)nt=pt.trace.getTracer("drizzle-orm",Kx);return TM((L,I)=>I.startActiveSpan(H,($)=>{try{return A($)}catch(f){throw $.setStatus({code:L.SpanStatusCode.ERROR,message:f instanceof Error?f.message:"Unknown error"}),f}finally{$.end()}}),pt,nt)}};var RH=Symbol.for("drizzle:ViewBaseConfig");var FM=Symbol.for("drizzle:Schema"),_M=Symbol.for("drizzle:Columns"),vx=Symbol.for("drizzle:ExtraConfigColumns"),Bt=Symbol.for("drizzle:OriginalName"),ct=Symbol.for("drizzle:BaseName"),RE=Symbol.for("drizzle:IsAlias"),ax=Symbol.for("drizzle:ExtraConfigBuilder"),P4=Symbol.for("drizzle:IsDrizzleTable");class y{static[n]="Table";static Symbol={Name:OL,Schema:FM,OriginalName:Bt,Columns:_M,ExtraConfigColumns:vx,BaseName:ct,IsAlias:RE,ExtraConfigBuilder:ax};[OL];[Bt];[FM];[_M];[vx];[ct];[RE]=!1;[P4]=!0;[ax]=void 0;constructor(H,A,L){this[OL]=this[Bt]=H,this[FM]=A,this[ct]=L}}function UA(H){return H[OL]}function n$(H){return`${H[FM]??"public"}.${H[OL]}`}function xt(H){return H!==null&&H!==void 0&&typeof H.getSQL==="function"}function X4(H){let A={sql:"",params:[]};for(let L of H)if(A.sql+=L.sql,A.params.push(...L.params),L.typings?.length){if(!A.typings)A.typings=[];A.typings.push(...L.typings)}return A}class cA{static[n]="StringChunk";value;constructor(H){this.value=Array.isArray(H)?H:[H]}getSQL(){return new R([this])}}class R{constructor(H){this.queryChunks=H}static[n]="SQL";decoder=Ox;shouldInlineParams=!1;append(H){return this.queryChunks.push(...H.queryChunks),this}toQuery(H){return lH.startActiveSpan("drizzle.buildSQL",(A)=>{let L=this.buildQueryFromSourceParams(this.queryChunks,H);return A?.setAttributes({"drizzle.query.text":L.sql,"drizzle.query.params":JSON.stringify(L.params)}),L})}buildQueryFromSourceParams(H,A){let L=Object.assign({},A,{inlineParams:A.inlineParams||this.shouldInlineParams,paramStartIndex:A.paramStartIndex||{value:0}}),{casing:I,escapeName:$,escapeParam:f,prepareTyping:E,inlineParams:D,paramStartIndex:M}=L;return X4(H.map((o)=>{if(_(o,cA))return{sql:o.value.join(""),params:[]};if(_(o,WM))return{sql:$(o.value),params:[]};if(o===void 0)return{sql:"",params:[]};if(Array.isArray(o)){let u=[new cA("(")];for(let[t,i]of o.entries())if(u.push(i),t<o.length-1)u.push(new cA(", "));return u.push(new cA(")")),this.buildQueryFromSourceParams(u,L)}if(_(o,R))return this.buildQueryFromSourceParams(o.queryChunks,{...L,inlineParams:D||o.shouldInlineParams});if(_(o,y)){let u=o[y.Symbol.Schema],t=o[y.Symbol.Name];return{sql:u===void 0||o[RE]?$(t):$(u)+"."+$(t),params:[]}}if(_(o,aH)){let u=I.getColumnCasing(o);if(A.invokeSource==="indexes")return{sql:$(u),params:[]};let t=o.table[y.Symbol.Schema];return{sql:o.table[RE]||t===void 0?$(o.table[y.Symbol.Name])+"."+$(u):$(t)+"."+$(o.table[y.Symbol.Name])+"."+$(u),params:[]}}if(_(o,gA)){let u=o[RH].schema,t=o[RH].name;return{sql:u===void 0||o[RH].isAlias?$(t):$(u)+"."+$(t),params:[]}}if(_(o,EL)){if(_(o.value,NI))return{sql:f(M.value++,o),params:[o],typings:["none"]};let u=o.value===null?null:o.encoder.mapToDriverValue(o.value);if(_(u,R))return this.buildQueryFromSourceParams([u],L);if(D)return{sql:this.mapInlineParam(u,L),params:[]};let t=["none"];if(E)t=[E(o.encoder)];return{sql:f(M.value++,u),params:[u],typings:t}}if(_(o,NI))return{sql:f(M.value++,o),params:[o],typings:["none"]};if(_(o,R.Aliased)&&o.fieldAlias!==void 0)return{sql:$(o.fieldAlias),params:[]};if(_(o,BA)){if(o._.isWith)return{sql:$(o._.alias),params:[]};return this.buildQueryFromSourceParams([new cA("("),o._.sql,new cA(") "),new WM(o._.alias)],L)}if(Jx(o)){if(o.schema)return{sql:$(o.schema)+"."+$(o.enumName),params:[]};return{sql:$(o.enumName),params:[]}}if(xt(o)){if(o.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([o.getSQL()],L);return this.buildQueryFromSourceParams([new cA("("),o.getSQL(),new cA(")")],L)}if(D)return{sql:this.mapInlineParam(o,L),params:[]};return{sql:f(M.value++,o),params:[o],typings:["none"]}}))}mapInlineParam(H,{escapeString:A}){if(H===null)return"null";if(typeof H==="number"||typeof H==="boolean")return H.toString();if(typeof H==="string")return A(H);if(typeof H==="object"){let L=H.toString();if(L==="[object Object]")return A(JSON.stringify(H));return A(L)}throw new Error("Unexpected param value: "+H)}getSQL(){return this}as(H){if(H===void 0)return this;return new R.Aliased(this,H)}mapWith(H){return this.decoder=typeof H==="function"?{mapFromDriverValue:H}:H,this}inlineParams(){return this.shouldInlineParams=!0,this}if(H){return H?this:void 0}}class WM{constructor(H){this.value=H}static[n]="Name";brand;getSQL(){return new R([this])}}function lx(H){return typeof H==="object"&&H!==null&&"mapToDriverValue"in H&&typeof H.mapToDriverValue==="function"}var Ox={mapFromDriverValue:(H)=>H},sx={mapToDriverValue:(H)=>H},We={...Ox,...sx};class EL{constructor(H,A=sx){this.value=H,this.encoder=A}static[n]="Param";brand;getSQL(){return new R([this])}}function c(H,...A){let L=[];if(A.length>0||H.length>0&&H[0]!=="")L.push(new cA(H[0]));for(let[I,$]of A.entries())L.push($,new cA(H[I+1]));return new R(L)}((H)=>{function A(){return new R([])}H.empty=A;function L(M){return new R(M)}H.fromList=L;function I(M){return new R([new cA(M)])}H.raw=I;function $(M,o){let u=[];for(let[t,i]of M.entries()){if(t>0&&o!==void 0)u.push(o);u.push(i)}return new R(u)}H.join=$;function f(M){return new WM(M)}H.identifier=f;function E(M){return new NI(M)}H.placeholder=E;function D(M,o){return new EL(M,o)}H.param=D})(c||(c={}));((H)=>{class A{constructor(L,I){this.sql=L,this.fieldAlias=I}static[n]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new A(this.sql,this.fieldAlias)}}H.Aliased=A})(R||(R={}));class NI{constructor(H){this.name=H}static[n]="Placeholder";getSQL(){return new R([this])}}function Ut(H,A){return H.map((L)=>{if(_(L,NI)){if(!(L.name in A))throw new Error(`No value for placeholder "${L.name}" was provided`);return A[L.name]}if(_(L,EL)&&_(L.value,NI)){if(!(L.value.name in A))throw new Error(`No value for placeholder "${L.value.name}" was provided`);return L.encoder.mapToDriverValue(A[L.value.name])}return L})}var S4=Symbol.for("drizzle:IsDrizzleView");class gA{static[n]="View";[RH];[S4]=!0;constructor({name:H,schema:A,selectedFields:L,query:I}){this[RH]={name:H,originalName:H,schema:A,selectedFields:L,query:I,isExisting:!I,isAlias:!1}}getSQL(){return new R([this])}}aH.prototype.getSQL=function(){return new R([this])};y.prototype.getSQL=function(){return new R([this])};BA.prototype.getSQL=function(){return new R([this])};class xf{constructor(H){this.table=H}static[n]="ColumnAliasProxyHandler";get(H,A){if(A==="table")return this.table;return H[A]}}class YE{constructor(H,A){this.alias=H,this.replaceOriginalName=A}static[n]="TableAliasProxyHandler";get(H,A){if(A===y.Symbol.IsAlias)return!0;if(A===y.Symbol.Name)return this.alias;if(this.replaceOriginalName&&A===y.Symbol.OriginalName)return this.alias;if(A===RH)return{...H[RH],name:this.alias,isAlias:!0};if(A===y.Symbol.Columns){let I=H[y.Symbol.Columns];if(!I)return I;let $={};return Object.keys(I).map((f)=>{$[f]=new Proxy(I[f],new xf(new Proxy(H,this)))}),$}let L=H[A];if(_(L,aH))return new Proxy(L,new xf(new Proxy(H,this)));return L}}function mM(H,A){return new Proxy(H,new YE(A,!1))}function dL(H,A){return new Proxy(H,new xf(new Proxy(H.table,new YE(A,!1))))}function Ct(H,A){return new R.Aliased(QE(H.sql,A),H.fieldAlias)}function QE(H,A){return c.join(H.queryChunks.map((L)=>{if(_(L,aH))return dL(L,A);if(_(L,R))return QE(L,A);if(_(L,R.Aliased))return Ct(L,A);return L}))}class PM extends Error{static[n]="DrizzleError";constructor({message:H,cause:A}){super(H);this.name="DrizzleError",this.cause=A}}class Tt extends PM{static[n]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}function eA(H,A){if(lx(A)&&!xt(H)&&!_(H,EL)&&!_(H,NI)&&!_(H,aH)&&!_(H,y)&&!_(H,gA))return new EL(H,A);return H}var qL=(H,A)=>{return c`${H} = ${eA(A,H)}`},Nx=(H,A)=>{return c`${H} <> ${eA(A,H)}`};function B$(...H){let A=H.filter((L)=>L!==void 0);if(A.length===0)return;if(A.length===1)return new R(A);return new R([new cA("("),c.join(A,new cA(" and ")),new cA(")")])}function yx(...H){let A=H.filter((L)=>L!==void 0);if(A.length===0)return;if(A.length===1)return new R(A);return new R([new cA("("),c.join(A,new cA(" or ")),new cA(")")])}function Rx(H){return c`not ${H}`}var XM=(H,A)=>{return c`${H} > ${eA(A,H)}`},Yx=(H,A)=>{return c`${H} >= ${eA(A,H)}`},Qx=(H,A)=>{return c`${H} < ${eA(A,H)}`},zx=(H,A)=>{return c`${H} <= ${eA(A,H)}`};function bx(H,A){if(Array.isArray(A)){if(A.length===0)return c`false`;return c`${H} in ${A.map((L)=>eA(L,H))}`}return c`${H} in ${eA(A,H)}`}function Zx(H,A){if(Array.isArray(A)){if(A.length===0)return c`true`;return c`${H} not in ${A.map((L)=>eA(L,H))}`}return c`${H} not in ${eA(A,H)}`}function hx(H){return c`${H} is null`}function rx(H){return c`${H} is not null`}function jx(H){return c`exists ${H}`}function kx(H){return c`not exists ${H}`}function dx(H,A,L){return c`${H} between ${eA(A,H)} and ${eA(L,H)}`}function qx(H,A,L){return c`${H} not between ${eA(A,H)} and ${eA(L,H)}`}function gx(H,A){return c`${H} like ${A}`}function ex(H,A){return c`${H} not like ${A}`}function H8(H,A){return c`${H} ilike ${A}`}function A8(H,A){return c`${H} not ilike ${A}`}function L8(H){return c`${H} asc`}function I8(H){return c`${H} desc`}class $8{static[n]="ConsoleLogWriter";write(H){console.log(H)}}class Gt{static[n]="DefaultLogger";writer;constructor(H){this.writer=H?.writer??new $8}logQuery(H,A){let L=A.map(($)=>{try{return JSON.stringify($)}catch{return String($)}}),I=L.length?` -- params: [${L.join(", ")}]`:"";this.writer.write(`Query: ${H}${I}`)}}class Ft{static[n]="NoopLogger";logQuery(){}}class QA{static[n]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(H){return this.then(void 0,H)}finally(H){return this.then((A)=>{return H?.(),A},(A)=>{throw H?.(),A})}then(H,A){return this.execute().then(H,A)}}function f8(H,A,L){let I={},$=H.reduce((f,{path:E,field:D},M)=>{let o;if(_(D,aH))o=D;else if(_(D,R))o=D.decoder;else o=D.sql.decoder;let u=f;for(let[t,i]of E.entries())if(t<E.length-1){if(!(i in u))u[i]={};u=u[i]}else{let B=A[M],U=u[i]=B===null?null:o.mapFromDriverValue(B);if(L&&_(D,aH)&&E.length===2){let x=E[0];if(!(x in I))I[x]=U===null?UA(D.table):!1;else if(typeof I[x]==="string"&&I[x]!==UA(D.table))I[x]=!1}}return f},{});if(L&&Object.keys(I).length>0){for(let[f,E]of Object.entries(I))if(typeof E==="string"&&!L[E])$[f]=null}return $}function FL(H,A){return Object.entries(H).reduce((L,[I,$])=>{if(typeof I!=="string")return L;let f=A?[...A,I]:[I];if(_($,aH)||_($,R)||_($,R.Aliased))L.push({path:f,field:$});else if(_($,y))L.push(...FL($[y.Symbol.Columns],f));else L.push(...FL($,f));return L},[])}function zE(H,A){let L=Object.keys(H),I=Object.keys(A);if(L.length!==I.length)return!1;for(let[$,f]of L.entries())if(f!==I[$])return!1;return!0}function SM(H,A){let L=Object.entries(A).filter(([,I])=>I!==void 0).map(([I,$])=>{if(_($,R)||_($,aH))return[I,$];else return[I,new EL($,H[y.Symbol.Columns][I])]});if(L.length===0)throw new Error("No values to set");return Object.fromEntries(L)}function E8(H,A){for(let L of A)for(let I of Object.getOwnPropertyNames(L.prototype)){if(I==="constructor")continue;Object.defineProperty(H.prototype,I,Object.getOwnPropertyDescriptor(L.prototype,I)||Object.create(null))}}function D8(H){return H[y.Symbol.Columns]}function iI(H){return _(H,BA)?H._.alias:_(H,gA)?H[RH].name:_(H,R)?void 0:H[y.Symbol.IsAlias]?H[y.Symbol.Name]:H[y.Symbol.BaseName]}function BH(H,A){return{name:typeof H==="string"&&H.length>0?H:"",config:typeof H==="object"?H:A}}function M8(H){if(typeof H!=="object"||H===null)return!1;if(H.constructor.name!=="Object")return!1;if("logger"in H){let A=typeof H.logger;if(A!=="boolean"&&(A!=="object"||typeof H.logger.logQuery!=="function")&&A!=="undefined")return!1;return!0}if("schema"in H){let A=typeof H.schema;if(A!=="object"&&A!=="undefined")return!1;return!0}if("casing"in H){let A=typeof H.casing;if(A!=="string"&&A!=="undefined")return!1;return!0}if("mode"in H){if(H.mode!=="default"||H.mode!=="planetscale"||H.mode!==void 0)return!1;return!0}if("connection"in H){let A=typeof H.connection;if(A!=="string"&&A!=="object"&&A!=="undefined")return!1;return!0}if("client"in H){let A=typeof H.client;if(A!=="object"&&A!=="function"&&A!=="undefined")return!1;return!0}if(Object.keys(H).length===0)return!0;return!1}class yI extends z{static[n]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(H){if(H){let{name:A,...L}=H;this.config.generatedIdentity={type:"always",sequenceName:A,sequenceOptions:L}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(H){if(H){let{name:A,...L}=H;this.config.generatedIdentity={type:"byDefault",sequenceName:A,sequenceOptions:L}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class o8 extends yI{static[n]="PgBigInt53Builder";constructor(H){super(H,"number","PgBigInt53")}build(H){return new u8(H,this.config)}}class u8 extends K{static[n]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(H){if(typeof H==="number")return H;return Number(H)}}class t8 extends yI{static[n]="PgBigInt64Builder";constructor(H){super(H,"bigint","PgBigInt64")}build(H){return new i8(H,this.config)}}class i8 extends K{static[n]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(H){return BigInt(H)}}function p8(H,A){let{name:L,config:I}=BH(H,A);if(I.mode==="number")return new o8(L);return new t8(L)}class n8 extends z{static[n]="PgBigSerial53Builder";constructor(H){super(H,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build(H){return new B8(H,this.config)}}class B8 extends K{static[n]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(H){if(typeof H==="number")return H;return Number(H)}}class c8 extends z{static[n]="PgBigSerial64Builder";constructor(H){super(H,"bigint","PgBigSerial64");this.config.hasDefault=!0}build(H){return new x8(H,this.config)}}class x8 extends K{static[n]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(H){return BigInt(H)}}function U8(H,A){let{name:L,config:I}=BH(H,A);if(I.mode==="number")return new n8(L);return new c8(L)}class C8 extends z{static[n]="PgBooleanBuilder";constructor(H){super(H,"boolean","PgBoolean")}build(H){return new T8(H,this.config)}}class T8 extends K{static[n]="PgBoolean";getSQLType(){return"boolean"}}function bE(H){return new C8(H??"")}class G8 extends z{static[n]="PgCharBuilder";constructor(H,A){super(H,"string","PgChar");this.config.length=A.length,this.config.enumValues=A.enum}build(H){return new F8(H,this.config)}}class F8 extends K{static[n]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function _8(H,A={}){let{name:L,config:I}=BH(H,A);return new G8(L,I)}class W8 extends z{static[n]="PgCidrBuilder";constructor(H){super(H,"string","PgCidr")}build(H){return new m8(H,this.config)}}class m8 extends K{static[n]="PgCidr";getSQLType(){return"cidr"}}function P8(H){return new W8(H??"")}class X8 extends z{static[n]="PgCustomColumnBuilder";constructor(H,A,L){super(H,"custom","PgCustomColumn");this.config.fieldConfig=A,this.config.customTypeParams=L}build(H){return new S8(H,this.config)}}class S8 extends K{static[n]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(H,A){super(H,A);this.sqlName=A.customTypeParams.dataType(A.fieldConfig),this.mapTo=A.customTypeParams.toDriver,this.mapFrom=A.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(H){return typeof this.mapFrom==="function"?this.mapFrom(H):H}mapToDriverValue(H){return typeof this.mapTo==="function"?this.mapTo(H):H}}function J8(H){return(A,L)=>{let{name:I,config:$}=BH(A,L);return new X8(I,$,H)}}class pI extends z{static[n]="PgDateColumnBaseBuilder";defaultNow(){return this.default(c`now()`)}}class V8 extends pI{static[n]="PgDateBuilder";constructor(H){super(H,"date","PgDate")}build(H){return new JM(H,this.config)}}class JM extends K{static[n]="PgDate";getSQLType(){return"date"}mapFromDriverValue(H){return new Date(H)}mapToDriverValue(H){return H.toISOString()}}class w8 extends pI{static[n]="PgDateStringBuilder";constructor(H){super(H,"string","PgDateString")}build(H){return new VM(H,this.config)}}class VM extends K{static[n]="PgDateString";getSQLType(){return"date"}}function K8(H,A){let{name:L,config:I}=BH(H,A);if(I?.mode==="date")return new V8(L);return new w8(L)}class v8 extends z{static[n]="PgDoublePrecisionBuilder";constructor(H){super(H,"number","PgDoublePrecision")}build(H){return new a8(H,this.config)}}class a8 extends K{static[n]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(H){if(typeof H==="string")return Number.parseFloat(H);return H}}function l8(H){return new v8(H??"")}class O8 extends z{static[n]="PgInetBuilder";constructor(H){super(H,"string","PgInet")}build(H){return new s8(H,this.config)}}class s8 extends K{static[n]="PgInet";getSQLType(){return"inet"}}function N8(H){return new O8(H??"")}class y8 extends yI{static[n]="PgIntegerBuilder";constructor(H){super(H,"number","PgInteger")}build(H){return new R8(H,this.config)}}class R8 extends K{static[n]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(H){if(typeof H==="string")return Number.parseInt(H);return H}}function wM(H){return new y8(H??"")}class Y8 extends z{static[n]="PgIntervalBuilder";constructor(H,A){super(H,"string","PgInterval");this.config.intervalConfig=A}build(H){return new Q8(H,this.config)}}class Q8 extends K{static[n]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let H=this.fields?` ${this.fields}`:"",A=this.precision?`(${this.precision})`:"";return`interval${H}${A}`}}function z8(H,A={}){let{name:L,config:I}=BH(H,A);return new Y8(L,I)}class b8 extends z{static[n]="PgJsonBuilder";constructor(H){super(H,"json","PgJson")}build(H){return new KM(H,this.config)}}class KM extends K{static[n]="PgJson";constructor(H,A){super(H,A)}getSQLType(){return"json"}mapToDriverValue(H){return JSON.stringify(H)}mapFromDriverValue(H){if(typeof H==="string")try{return JSON.parse(H)}catch{return H}return H}}function Z8(H){return new b8(H??"")}class h8 extends z{static[n]="PgJsonbBuilder";constructor(H){super(H,"json","PgJsonb")}build(H){return new vM(H,this.config)}}class vM extends K{static[n]="PgJsonb";constructor(H,A){super(H,A)}getSQLType(){return"jsonb"}mapToDriverValue(H){return JSON.stringify(H)}mapFromDriverValue(H){if(typeof H==="string")try{return JSON.parse(H)}catch{return H}return H}}function r8(H){return new h8(H??"")}class j8 extends z{static[n]="PgLineBuilder";constructor(H){super(H,"array","PgLine")}build(H){return new k8(H,this.config)}}class k8 extends K{static[n]="PgLine";getSQLType(){return"line"}mapFromDriverValue(H){let[A,L,I]=H.slice(1,-1).split(",");return[Number.parseFloat(A),Number.parseFloat(L),Number.parseFloat(I)]}mapToDriverValue(H){return`{${H[0]},${H[1]},${H[2]}}`}}class d8 extends z{static[n]="PgLineABCBuilder";constructor(H){super(H,"json","PgLineABC")}build(H){return new q8(H,this.config)}}class q8 extends K{static[n]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(H){let[A,L,I]=H.slice(1,-1).split(",");return{a:Number.parseFloat(A),b:Number.parseFloat(L),c:Number.parseFloat(I)}}mapToDriverValue(H){return`{${H.a},${H.b},${H.c}}`}}function g8(H,A){let{name:L,config:I}=BH(H,A);if(!I?.mode||I.mode==="tuple")return new j8(L);return new d8(L)}class e8 extends z{static[n]="PgMacaddrBuilder";constructor(H){super(H,"string","PgMacaddr")}build(H){return new HU(H,this.config)}}class HU extends K{static[n]="PgMacaddr";getSQLType(){return"macaddr"}}function AU(H){return new e8(H??"")}class LU extends z{static[n]="PgMacaddr8Builder";constructor(H){super(H,"string","PgMacaddr8")}build(H){return new IU(H,this.config)}}class IU extends K{static[n]="PgMacaddr8";getSQLType(){return"macaddr8"}}function $U(H){return new LU(H??"")}class fU extends z{static[n]="PgNumericBuilder";constructor(H,A,L){super(H,"string","PgNumeric");this.config.precision=A,this.config.scale=L}build(H){return new aM(H,this.config)}}class aM extends K{static[n]="PgNumeric";precision;scale;constructor(H,A){super(H,A);this.precision=A.precision,this.scale=A.scale}mapFromDriverValue(H){if(typeof H==="string")return H;return String(H)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}class EU extends z{static[n]="PgNumericNumberBuilder";constructor(H,A,L){super(H,"number","PgNumericNumber");this.config.precision=A,this.config.scale=L}build(H){return new DU(H,this.config)}}class DU extends K{static[n]="PgNumericNumber";precision;scale;constructor(H,A){super(H,A);this.precision=A.precision,this.scale=A.scale}mapFromDriverValue(H){if(typeof H==="number")return H;return Number(H)}mapToDriverValue=String;getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}class MU extends z{static[n]="PgNumericBigIntBuilder";constructor(H,A,L){super(H,"bigint","PgNumericBigInt");this.config.precision=A,this.config.scale=L}build(H){return new oU(H,this.config)}}class oU extends K{static[n]="PgNumericBigInt";precision;scale;constructor(H,A){super(H,A);this.precision=A.precision,this.scale=A.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}function uU(H,A){let{name:L,config:I}=BH(H,A),$=I?.mode;return $==="number"?new EU(L,I?.precision,I?.scale):$==="bigint"?new MU(L,I?.precision,I?.scale):new fU(L,I?.precision,I?.scale)}class tU extends z{static[n]="PgPointTupleBuilder";constructor(H){super(H,"array","PgPointTuple")}build(H){return new iU(H,this.config)}}class iU extends K{static[n]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(H){if(typeof H==="string"){let[A,L]=H.slice(1,-1).split(",");return[Number.parseFloat(A),Number.parseFloat(L)]}return[H.x,H.y]}mapToDriverValue(H){return`(${H[0]},${H[1]})`}}class pU extends z{static[n]="PgPointObjectBuilder";constructor(H){super(H,"json","PgPointObject")}build(H){return new nU(H,this.config)}}class nU extends K{static[n]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(H){if(typeof H==="string"){let[A,L]=H.slice(1,-1).split(",");return{x:Number.parseFloat(A),y:Number.parseFloat(L)}}return H}mapToDriverValue(H){return`(${H.x},${H.y})`}}function BU(H,A){let{name:L,config:I}=BH(H,A);if(!I?.mode||I.mode==="tuple")return new tU(L);return new pU(L)}function J4(H){let A=[];for(let L=0;L<H.length;L+=2)A.push(Number.parseInt(H.slice(L,L+2),16));return new Uint8Array(A)}function cU(H,A){let L=new ArrayBuffer(8),I=new DataView(L);for(let $=0;$<8;$++)I.setUint8($,H[A+$]);return I.getFloat64(0,!0)}function _t(H){let A=J4(H),L=0,I=A[L];L+=1;let $=new DataView(A.buffer),f=$.getUint32(L,I===1);L+=4;let E;if(f&536870912)E=$.getUint32(L,I===1),L+=4;if((f&65535)===1){let D=cU(A,L);L+=8;let M=cU(A,L);return L+=8,[D,M]}throw new Error("Unsupported geometry type")}class xU extends z{static[n]="PgGeometryBuilder";constructor(H){super(H,"array","PgGeometry")}build(H){return new UU(H,this.config)}}class UU extends K{static[n]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(H){return _t(H)}mapToDriverValue(H){return`point(${H[0]} ${H[1]})`}}class CU extends z{static[n]="PgGeometryObjectBuilder";constructor(H){super(H,"json","PgGeometryObject")}build(H){return new TU(H,this.config)}}class TU extends K{static[n]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(H){let A=_t(H);return{x:A[0],y:A[1]}}mapToDriverValue(H){return`point(${H.x} ${H.y})`}}function GU(H,A){let{name:L,config:I}=BH(H,A);if(!I?.mode||I.mode==="tuple")return new xU(L);return new CU(L)}class FU extends z{static[n]="PgRealBuilder";constructor(H,A){super(H,"number","PgReal");this.config.length=A}build(H){return new _U(H,this.config)}}class _U extends K{static[n]="PgReal";constructor(H,A){super(H,A)}getSQLType(){return"real"}mapFromDriverValue=(H)=>{if(typeof H==="string")return Number.parseFloat(H);return H}}function WU(H){return new FU(H??"")}class mU extends z{static[n]="PgSerialBuilder";constructor(H){super(H,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(H){return new PU(H,this.config)}}class PU extends K{static[n]="PgSerial";getSQLType(){return"serial"}}function XU(H){return new mU(H??"")}class SU extends yI{static[n]="PgSmallIntBuilder";constructor(H){super(H,"number","PgSmallInt")}build(H){return new JU(H,this.config)}}class JU extends K{static[n]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=(H)=>{if(typeof H==="string")return Number(H);return H}}function VU(H){return new SU(H??"")}class wU extends z{static[n]="PgSmallSerialBuilder";constructor(H){super(H,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(H){return new KU(H,this.config)}}class KU extends K{static[n]="PgSmallSerial";getSQLType(){return"smallserial"}}function vU(H){return new wU(H??"")}class aU extends z{static[n]="PgTextBuilder";constructor(H,A){super(H,"string","PgText");this.config.enumValues=A.enum}build(H){return new lU(H,this.config)}}class lU extends K{static[n]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function OU(H,A={}){let{name:L,config:I}=BH(H,A);return new aU(L,I)}class sU extends pI{constructor(H,A,L){super(H,"string","PgTime");this.withTimezone=A,this.precision=L,this.config.withTimezone=A,this.config.precision=L}static[n]="PgTimeBuilder";build(H){return new lM(H,this.config)}}class lM extends K{static[n]="PgTime";withTimezone;precision;constructor(H,A){super(H,A);this.withTimezone=A.withTimezone,this.precision=A.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function NU(H,A={}){let{name:L,config:I}=BH(H,A);return new sU(L,I.withTimezone??!1,I.precision)}class yU extends pI{static[n]="PgTimestampBuilder";constructor(H,A,L){super(H,"date","PgTimestamp");this.config.withTimezone=A,this.config.precision=L}build(H){return new OM(H,this.config)}}class OM extends K{static[n]="PgTimestamp";withTimezone;precision;constructor(H,A){super(H,A);this.withTimezone=A.withTimezone,this.precision=A.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=(H)=>{return new Date(this.withTimezone?H:H+"+0000")};mapToDriverValue=(H)=>{return H.toISOString()}}class RU extends pI{static[n]="PgTimestampStringBuilder";constructor(H,A,L){super(H,"string","PgTimestampString");this.config.withTimezone=A,this.config.precision=L}build(H){return new sM(H,this.config)}}class sM extends K{static[n]="PgTimestampString";withTimezone;precision;constructor(H,A){super(H,A);this.withTimezone=A.withTimezone,this.precision=A.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function sL(H,A={}){let{name:L,config:I}=BH(H,A);if(I?.mode==="string")return new RU(L,I.withTimezone??!1,I.precision);return new yU(L,I?.withTimezone??!1,I?.precision)}class YU extends z{static[n]="PgUUIDBuilder";constructor(H){super(H,"string","PgUUID")}defaultRandom(){return this.default(c`gen_random_uuid()`)}build(H){return new NM(H,this.config)}}class NM extends K{static[n]="PgUUID";getSQLType(){return"uuid"}}function DL(H){return new YU(H??"")}class QU extends z{static[n]="PgVarcharBuilder";constructor(H,A){super(H,"string","PgVarchar");this.config.length=A.length,this.config.enumValues=A.enum}build(H){return new zU(H,this.config)}}class zU extends K{static[n]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function lA(H,A={}){let{name:L,config:I}=BH(H,A);return new QU(L,I)}class bU extends z{static[n]="PgBinaryVectorBuilder";constructor(H,A){super(H,"string","PgBinaryVector");this.config.dimensions=A.dimensions}build(H){return new ZU(H,this.config)}}class ZU extends K{static[n]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function hU(H,A){let{name:L,config:I}=BH(H,A);return new bU(L,I)}class rU extends z{static[n]="PgHalfVectorBuilder";constructor(H,A){super(H,"array","PgHalfVector");this.config.dimensions=A.dimensions}build(H){return new jU(H,this.config)}}class jU extends K{static[n]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(H){return JSON.stringify(H)}mapFromDriverValue(H){return H.slice(1,-1).split(",").map((A)=>Number.parseFloat(A))}}function kU(H,A){let{name:L,config:I}=BH(H,A);return new rU(L,I)}class dU extends z{static[n]="PgSparseVectorBuilder";constructor(H,A){super(H,"string","PgSparseVector");this.config.dimensions=A.dimensions}build(H){return new qU(H,this.config)}}class qU extends K{static[n]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function gU(H,A){let{name:L,config:I}=BH(H,A);return new dU(L,I)}class eU extends z{static[n]="PgVectorBuilder";constructor(H,A){super(H,"array","PgVector");this.config.dimensions=A.dimensions}build(H){return new HC(H,this.config)}}class HC extends K{static[n]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(H){return JSON.stringify(H)}mapFromDriverValue(H){return H.slice(1,-1).split(",").map((A)=>Number.parseFloat(A))}}function AC(H,A){let{name:L,config:I}=BH(H,A);return new eU(L,I)}function LC(){return{bigint:p8,bigserial:U8,boolean:bE,char:_8,cidr:P8,customType:J8,date:K8,doublePrecision:l8,inet:N8,integer:wM,interval:z8,json:Z8,jsonb:r8,line:g8,macaddr:AU,macaddr8:$U,numeric:uU,point:BU,geometry:GU,real:WU,serial:XU,smallint:VU,smallserial:vU,text:OU,time:NU,timestamp:sL,uuid:DL,varchar:lA,bit:hU,halfvec:kU,sparsevec:gU,vector:AC}}var Wt=Symbol.for("drizzle:PgInlineForeignKeys"),IC=Symbol.for("drizzle:EnableRLS");class WA extends y{static[n]="PgTable";static Symbol=Object.assign({},y.Symbol,{InlineForeignKeys:Wt,EnableRLS:IC});[Wt]=[];[IC]=!1;[y.Symbol.ExtraConfigBuilder]=void 0;[y.Symbol.ExtraConfigColumns]={}}function V4(H,A,L,I,$=H){let f=new WA(H,I,$),E=typeof A==="function"?A(LC()):A,D=Object.fromEntries(Object.entries(E).map(([u,t])=>{let i=t;i.setName(u);let B=i.build(f);return f[Wt].push(...i.buildForeignKeys(B,f)),[u,B]})),M=Object.fromEntries(Object.entries(E).map(([u,t])=>{let i=t;i.setName(u);let B=i.buildExtraConfigColumn(f);return[u,B]})),o=Object.assign(f,D);if(o[y.Symbol.Columns]=D,o[y.Symbol.ExtraConfigColumns]=M,L)o[WA.Symbol.ExtraConfigBuilder]=L;return Object.assign(o,{enableRLS:()=>{return o[WA.Symbol.EnableRLS]=!0,o}})}var RI=(H,A,L)=>{return V4(H,A,L,void 0)};function $C(...H){if(H[0].columns)return new ZE(H[0].columns,H[0].name);return new ZE(H)}class ZE{static[n]="PgPrimaryKeyBuilder";columns;name;constructor(H,A){this.columns=H,this.name=A}build(H){return new fC(H,this.columns,this.name)}}class fC{constructor(H,A,L){this.table=H,this.columns=A,this.name=L}static[n]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[WA.Symbol.Name]}_${this.columns.map((H)=>H.name).join("_")}_pk`}}class mt{constructor(H,A,L){this.sourceTable=H,this.referencedTable=A,this.relationName=L,this.referencedTableName=A[y.Symbol.Name]}static[n]="Relation";referencedTableName;fieldName}class EC{constructor(H,A){this.table=H,this.config=A}static[n]="Relations"}class YI extends mt{constructor(H,A,L,I){super(H,A,L?.relationName);this.config=L,this.isNullable=I}static[n]="One";withFieldName(H){let A=new YI(this.sourceTable,this.referencedTable,this.config,this.isNullable);return A.fieldName=H,A}}class hE extends mt{constructor(H,A,L){super(H,A,L?.relationName);this.config=L}static[n]="Many";withFieldName(H){let A=new hE(this.sourceTable,this.referencedTable,this.config);return A.fieldName=H,A}}function DC(){return{and:B$,between:dx,eq:qL,exists:jx,gt:XM,gte:Yx,ilike:H8,inArray:bx,isNull:hx,isNotNull:rx,like:gx,lt:Qx,lte:zx,ne:Nx,not:Rx,notBetween:qx,notExists:kx,notLike:ex,notIlike:A8,notInArray:Zx,or:yx,sql:c}}function MC(){return{sql:c,asc:L8,desc:I8}}function oC(H,A){if(Object.keys(H).length===1&&"default"in H&&!_(H.default,y))H=H.default;let L={},I={},$={};for(let[f,E]of Object.entries(H))if(_(E,y)){let D=n$(E),M=I[D];L[D]=f,$[f]={tsName:f,dbName:E[y.Symbol.Name],schema:E[y.Symbol.Schema],columns:E[y.Symbol.Columns],relations:M?.relations??{},primaryKey:M?.primaryKey??[]};for(let u of Object.values(E[y.Symbol.Columns]))if(u.primary)$[f].primaryKey.push(u);let o=E[y.Symbol.ExtraConfigBuilder]?.(E[y.Symbol.ExtraConfigColumns]);if(o){for(let u of Object.values(o))if(_(u,ZE))$[f].primaryKey.push(...u.columns)}}else if(_(E,EC)){let D=n$(E.table),M=L[D],o=E.config(A(E.table)),u;for(let[t,i]of Object.entries(o))if(M){let B=$[M];if(B.relations[t]=i,u)B.primaryKey.push(...u)}else{if(!(D in I))I[D]={relations:{},primaryKey:u};I[D].relations[t]=i}}return{tables:$,tableNamesMap:L}}function w4(H){return function A(L,I){return new YI(H,L,I,I?.fields.reduce(($,f)=>$&&f.notNull,!0)??!1)}}function K4(H){return function A(L,I){return new hE(H,L,I)}}function uC(H,A,L){if(_(L,YI)&&L.config)return{fields:L.config.fields,references:L.config.references};let I=A[n$(L.referencedTable)];if(!I)throw new Error(`Table "${L.referencedTable[y.Symbol.Name]}" not found in schema`);let $=H[I];if(!$)throw new Error(`Table "${I}" not found in schema`);let f=L.sourceTable,E=A[n$(f)];if(!E)throw new Error(`Table "${f[y.Symbol.Name]}" not found in schema`);let D=[];for(let M of Object.values($.relations))if(L.relationName&&L!==M&&M.relationName===L.relationName||!L.relationName&&M.referencedTable===L.sourceTable)D.push(M);if(D.length>1)throw L.relationName?new Error(`There are multiple relations with name "${L.relationName}" in table "${I}"`):new Error(`There are multiple relations between "${I}" and "${L.sourceTable[y.Symbol.Name]}". Please specify relation name`);if(D[0]&&_(D[0],YI)&&D[0].config)return{fields:D[0].config.references,references:D[0].config.fields};throw new Error(`There is not enough information to infer relation "${E}.${L.fieldName}"`)}function tC(H){return{one:w4(H),many:K4(H)}}function yM(H,A,L,I,$=(f)=>f){let f={};for(let[E,D]of I.entries())if(D.isJson){let M=A.relations[D.tsKey],o=L[E],u=typeof o==="string"?JSON.parse(o):o;f[D.tsKey]=_(M,YI)?u&&yM(H,H[D.relationTableTsKey],u,D.selection,$):u.map((t)=>yM(H,H[D.relationTableTsKey],t,D.selection,$))}else{let M=$(L[E]),o=D.field,u;if(_(o,aH))u=o;else if(_(o,R))u=o.decoder;else u=o.sql.decoder;f[D.tsKey]=M===null?null:u.mapFromDriverValue(M)}return f}var eF=s1(gF(),1),{Server:H_,Namespace:m$H,Socket:P$H}=eF.default;import{readFileSync as I_}from"fs";import{resolve as Ti}from"path";function Sa(H,A){let L={},I=[];for(let $ in H){let f=H[$],E=A[$],D=f["~standard"].validate(E);if(D instanceof Promise)throw new Error(`Validation must be synchronous, but ${$} returned a Promise.`);if(D.issues){I.push(...D.issues.map((M)=>({...M,path:[$,...M.path??[]]})));continue}L[$]=D.value}if(I.length)return{issues:I};return{value:L}}function A_(H){let A=H.runtimeEnvStrict??H.runtimeEnv??process.env;if(H.emptyStringAsUndefined??!1){for(let[m,Y]of Object.entries(A))if(Y==="")delete A[m]}if(!!H.skipValidation)return A;let $=typeof H.client==="object"?H.client:{},f=typeof H.server==="object"?H.server:{},E=typeof H.shared==="object"?H.shared:{},D=H.isServer??(typeof window==="undefined"||("Deno"in window)),M=D?{...f,...E,...$}:{...$,...E},o=Sa(M,A),u=H.onValidationError??((m)=>{throw console.error("\u274C Invalid environment variables:",m),new Error("Invalid environment variables")}),t=H.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(o.issues)return u(o.issues);let i=(m)=>{if(!H.clientPrefix)return!0;return!m.startsWith(H.clientPrefix)&&!(m in E)},B=(m)=>{return D||!i(m)},U=(m)=>{return m==="__esModule"||m==="$$typeof"},x=(H.extends??[]).reduce((m,Y)=>{return Object.assign(m,Y)},{}),T=Object.assign(o.value,x);return new Proxy(T,{get(m,Y){if(typeof Y!=="string")return;if(U(Y))return;if(!B(Y))return t(Y);return Reflect.get(m,Y)}})}var Ja="__vite_start_time"in globalThis,Va=typeof window!=="undefined",w$H="vitest"in globalThis,xI=eH("string"),L_=eH('"true" | "false" | undefined'),LA=A_({isServer:!Ja&&!Va,server:{CI:eH("string | undefined").pipe(Boolean),POSTGRES_USER:xI,POSTGRES_PASSWORD:xI,POSTGRES_DATABASE:xI,POSTGRES_HOST:xI,POSTGRES_PORT:xI.pipe((H)=>Number.parseInt(H,10)),BACKEND_PORT:xI.pipe((H)=>Number.parseInt(H,10)),RUN_WORKERS_FROM_SOURCE:L_.pipe((H)=>H==="true"),FRONTEND_PORT:xI.pipe((H)=>Number.parseInt(H,10)),FRONTEND_ORIGINS:xI.pipe.try((H)=>JSON.parse(H),eH("string[]")),OPENAI_API_KEY:eH("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:xI,VITE_USE_SELF_SIGNED_CERTIFICATE:L_.pipe((H)=>H==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var $_=Ti(import.meta.dirname,"../dev"),Gi=LA.VITE_USE_SELF_SIGNED_CERTIFICATE?{cert:I_(Ti($_,"./cert.pem"),"utf-8"),key:I_(Ti($_,"./key.pem"),"utf-8")}:void 0;var hI=new Tu,DH=LA.VITE_USE_SELF_SIGNED_CERTIFICATE?console:hI.logger;e.STORE.loggers[0]=new $$("warn",void 0,DH);if(DH!==console)Object.assign(console,DH,{log:DH.info});import{spawn as wa}from"child_process";import{resolve as Ka}from"path";function Fi(H,A,L=H.logger){let I=LA.RUN_WORKERS_FROM_SOURCE?"ts":"js",$=A.endsWith(".bun")?"bun":"node",E=[Ka(import.meta.dir,`${A}.${I}`)];if($==="node"&&I==="ts")E.push("--experimental-strip-types");let D=wa($,E);return new PE(D,A,L)}var f_=s1(Dt(),1);var va=604800000,i1=(()=>{let{__userSessionMap:H}=globalThis;if(!H){H=globalThis.__userSessionMap=new Map;let A=new f_.CronJob("00 00 03 * * *",()=>{for(let[L,I]of H.entries()){let $=Date.now();for(let[f,E]of I.entries())if($-E>va)I.delete(f);if(I.size===0)H.delete(L)}});A.start(),process.on("exit",()=>{A.stop(),DH.info("\uD83D\uDEEC autoExpiry stopped")})}return H})();import ml from"path";import Il from"os";import $l from"fs";var p1=new Map,_i=new Map,Wi=Symbol("OriginError"),Kf={};class PL extends Promise{constructor(H,A,L,I,$={}){let f,E;super((D,M)=>{f=D,E=M});this.tagged=Array.isArray(H.raw),this.strings=H,this.args=A,this.handler=L,this.canceller=I,this.options=$,this.state=null,this.statement=null,this.resolve=(D)=>(this.active=!1,f(D)),this.reject=(D)=>(this.active=!1,E(D)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[Wi]=this.handler.debug?new Error:this.tagged&&aa(this.strings)}get origin(){return(this.handler.debug?this[Wi].stack:this.tagged&&_i.has(this.strings)?_i.get(this.strings):_i.set(this.strings,this[Wi].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor(H=1,A){if(this.options.simple=!1,typeof H==="function")A=H,H=1;if(this.cursorRows=H,typeof A==="function")return this.cursorFn=A,this;let L;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};L&&L();let I=new Promise(($,f)=>{this.cursorFn=(E)=>{return $({value:E,done:!1}),new Promise((D)=>L=D)},this.resolve=()=>(this.active=!1,$({done:!0})),this.reject=(E)=>(this.active=!1,f(E))});return this.execute(),I},return(){return L&&L(Kf),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw new Error(".stream has been renamed to .forEach")}forEach(H){return this.forEachFn=H,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}}function aa(H){if(p1.has(H))return p1.get(H);let A=Error.stackTraceLimit;return Error.stackTraceLimit=4,p1.set(H,new Error),Error.stackTraceLimit=A,p1.get(H)}class vf extends Error{constructor(H){super(H.message);this.name=this.constructor.name,Object.assign(this,H)}}var EA={connection:E_,postgres:D_,generic:M_,notSupported:o_};function E_(H,A,L){let{host:I,port:$}=L||A,f=Object.assign(new Error("write "+H+" "+(A.path||I+":"+$)),{code:H,errno:H,address:A.path||I},A.path?{}:{port:$});return Error.captureStackTrace(f,E_),f}function D_(H){let A=new vf(H);return Error.captureStackTrace(A,D_),A}function M_(H,A){let L=Object.assign(new Error(H+": "+A),{code:H});return Error.captureStackTrace(L,M_),L}function o_(H){let A=Object.assign(new Error(H+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:H});return Error.captureStackTrace(A,o_),A}var la={string:{to:25,from:null,serialize:(H)=>""+H},number:{to:0,from:[21,23,26,700,701],serialize:(H)=>""+H,parse:(H)=>+H},json:{to:114,from:[114,3802],serialize:(H)=>JSON.stringify(H),parse:(H)=>JSON.parse(H)},boolean:{to:16,from:16,serialize:(H)=>H===!0?"t":"f",parse:(H)=>H==="t"},date:{to:1184,from:[1082,1114,1184],serialize:(H)=>(H instanceof Date?H:new Date(H)).toISOString(),parse:(H)=>new Date(H)},bytea:{to:17,from:17,serialize:(H)=>"\\x"+Buffer.from(H).toString("hex"),parse:(H)=>Buffer.from(H.slice(2),"hex")}};class c1{then(){mi()}catch(){mi()}finally(){mi()}}class ID extends c1{constructor(H){super();this.value=C1(H)}}class eL extends c1{constructor(H,A,L){super();this.value=H,this.type=A,this.array=L}}class x1 extends c1{constructor(H,A){super();this.first=H,this.rest=A}build(H,A,L,I){let $=Oa.map(([f,E])=>({fn:E,i:H.search(f)})).sort((f,E)=>f.i-E.i).pop();return $.i===-1?Vi(this.first,I):$.fn(this.first,this.rest,A,L,I)}}function U1(H,A,L,I){let $=H instanceof eL?H.value:H;if($===void 0){if(H instanceof eL?H.value=I.transform.undefined:$=H=I.transform.undefined,$===void 0)throw EA.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+L.push(H instanceof eL?(A.push(H.value),H.array?H.array[H.type||B1(H.value)]||H.type||p_(H.value):H.type):(A.push(H),B1(H)))}var t_=B_(la);function Si(H,A,L,I,$,f){for(let E=1;E<H.strings.length;E++)A+=Ji(A,L,I,$,f)+H.strings[E],L=H.args[E];return A}function Ji(H,A,L,I,$){return A instanceof x1?A.build(H,L,I,$):A instanceof PL?Xi(A,L,I,$):A instanceof ID?A.value:A&&A[0]instanceof PL?A.reduce((f,E)=>f+" "+Xi(E,L,I,$),""):U1(A,L,I,$)}function Xi(H,A,L,I){return H.fragment=!0,Si(H,H.strings[0],H.args[0],A,L,I)}function i_(H,A,L,I,$){return H.map((f)=>"("+I.map((E)=>Ji("values",f[E],A,L,$)).join(",")+")").join(",")}function u_(H,A,L,I,$){let f=Array.isArray(H[0]),E=A.length?A.flat():Object.keys(f?H[0]:H);return i_(f?H:[H],L,I,E,$)}function n1(H,A,L,I,$){if(typeof H==="string"&&(H=[H].concat(A)),Array.isArray(H))return Vi(H,$);let f;return(A.length?A.flat():Object.keys(H)).map((D)=>{return f=H[D],(f instanceof PL?Xi(f,L,I,$):f instanceof ID?f.value:U1(f,L,I,$))+" as "+C1($.transform.column.to?$.transform.column.to(D):D)}).join(",")}var Oa=Object.entries({values:u_,in:(...H)=>{let A=u_(...H);return A==="()"?"(null)":A},select:n1,as:n1,returning:n1,"\\(":n1,update(H,A,L,I,$){return(A.length?A.flat():Object.keys(H)).map((f)=>C1($.transform.column.to?$.transform.column.to(f):f)+"="+Ji("values",H[f],L,I,$))},insert(H,A,L,I,$){let f=A.length?A.flat():Object.keys(Array.isArray(H)?H[0]:H);return"("+Vi(f,$)+")values"+i_(Array.isArray(H)?H:[H],L,I,f,$)}}).map(([H,A])=>[new RegExp("((?:^|[\\s(])"+H+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),A]);function mi(){throw EA.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:sa,parsers:Na}=t_;function p_(H){if(Array.isArray(H))return p_(H[0]);return typeof H==="string"?1009:0}var n_=function(H){let A=B_(H||{});return{serializers:Object.assign({},sa,A.serializers),parsers:Object.assign({},Na,A.parsers)}};function B_(H){return Object.keys(H).reduce((A,L)=>{if(H[L].from&&[].concat(H[L].from).forEach((I)=>A.parsers[I]=H[L].parse),H[L].serialize)A.serializers[H[L].to]=H[L].serialize,H[L].from&&[].concat(H[L].from).forEach((I)=>A.serializers[I]=H[L].serialize);return A},{parsers:{},serializers:{}})}function Vi(H,{transform:{column:A}}){return H.map((L)=>C1(A.to?A.to(L):L)).join(",")}var C1=function H(A){return'"'+A.replace(/"/g,'""').replace(/\./g,'"."')+'"'},B1=function H(A){return A instanceof eL?A.type:A instanceof Date?1184:A instanceof Uint8Array?17:A===!0||A===!1?16:typeof A==="bigint"?20:Array.isArray(A)?H(A[0]):0},ya=/\\/g,Ra=/"/g;function Ya(H){return H.replace(ya,"\\\\").replace(Ra,"\\\"")}var c_=function H(A,L,I,$){if(Array.isArray(A)===!1)return A;if(!A.length)return"{}";let f=A[0],E=$===1020?";":",";if(Array.isArray(f)&&!f.type)return"{"+A.map((D)=>H(D,L,I,$)).join(E)+"}";return"{"+A.map((D)=>{if(D===void 0){if(D=I.transform.undefined,D===void 0)throw EA.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return D===null?"null":'"'+Ya(L?L(D.type?D.value:D):""+D)+'"'}).join(E)+"}"},Pi={i:0,char:null,str:"",quoted:!1,last:0},x_=function H(A,L,I){return Pi.i=Pi.last=0,U_(Pi,A,L,I)};function U_(H,A,L,I){let $=[],f=I===1020?";":",";for(;H.i<A.length;H.i++){if(H.char=A[H.i],H.quoted)if(H.char==="\\")H.str+=A[++H.i];else if(H.char==='"')$.push(L?L(H.str):H.str),H.str="",H.quoted=A[H.i+1]==='"',H.last=H.i+2;else H.str+=H.char;else if(H.char==='"')H.quoted=!0;else if(H.char==="{")H.last=++H.i,$.push(U_(H,A,L,I));else if(H.char==="}"){H.quoted=!1,H.last<H.i&&$.push(L?L(A.slice(H.last,H.i)):A.slice(H.last,H.i)),H.last=H.i+1;break}else if(H.char===f&&H.p!=="}"&&H.p!=='"')$.push(L?L(A.slice(H.last,H.i)):A.slice(H.last,H.i)),H.last=H.i+1;H.p=H.char}return H.last<H.i&&$.push(L?L(A.slice(H.last,H.i+1)):A.slice(H.last,H.i+1)),$}var W$=(H)=>{let A=H[0];for(let L=1;L<H.length;L++)A+=H[L]==="_"?H[++L].toUpperCase():H[L];return A},m$=(H)=>{let A=H[0].toUpperCase();for(let L=1;L<H.length;L++)A+=H[L]==="_"?H[++L].toUpperCase():H[L];return A},P$=(H)=>H.replace(/_/g,"-"),HD=(H)=>H.replace(/([A-Z])/g,"_$1").toLowerCase(),AD=(H)=>(H.slice(0,1)+H.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),LD=(H)=>H.replace(/-/g,"_");function wi(H){return function A(L,I){return typeof L==="object"&&L!==null&&(I.type===114||I.type===3802)?Array.isArray(L)?L.map(($)=>A($,I)):Object.entries(L).reduce(($,[f,E])=>Object.assign($,{[H(f)]:A(E,I)}),{}):L}}W$.column={from:W$};W$.value={from:wi(W$)};HD.column={to:HD};var Ki={...W$};Ki.column.to=HD;m$.column={from:m$};m$.value={from:wi(m$)};AD.column={to:AD};var vi={...m$};vi.column.to=AD;P$.column={from:P$};P$.value={from:wi(P$)};LD.column={to:LD};var ai={...P$};ai.column.to=LD;import C_ from"net";import Za from"tls";import $D from"crypto";import li from"stream";import{performance as T_}from"perf_hooks";class X$ extends Array{constructor(){super();Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}}var tL=Qa;function Qa(H=[]){let A=H.slice(),L=0;return{get length(){return A.length-L},remove:(I)=>{let $=A.indexOf(I);return $===-1?null:(A.splice($,1),I)},push:(I)=>(A.push(I),I),shift:()=>{let I=A[L++];if(L===A.length)L=0,A=[];else A[L-1]=void 0;return I}}}var NA=Buffer.allocUnsafe(256),za="BCcDdEFfHPpQSX".split("").reduce((H,A)=>{let L=A.charCodeAt(0);return H[A]=()=>{return NA[0]=L,VH.i=5,VH},H},{}),VH=Object.assign(ba,za,{N:String.fromCharCode(0),i:0,inc(H){return VH.i+=H,VH},str(H){let A=Buffer.byteLength(H);return T1(A),VH.i+=NA.write(H,VH.i,A,"utf8"),VH},i16(H){return T1(2),NA.writeUInt16BE(H,VH.i),VH.i+=2,VH},i32(H,A){if(A||A===0)return NA.writeUInt32BE(H,A),VH;return T1(4),NA.writeUInt32BE(H,VH.i),VH.i+=4,VH},z(H){return T1(H),NA.fill(0,VH.i,VH.i+H),VH.i+=H,VH},raw(H){return NA=Buffer.concat([NA.subarray(0,VH.i),H]),VH.i=NA.length,VH},end(H=1){NA.writeUInt32BE(VH.i-H,H);let A=NA.subarray(0,VH.i);return VH.i=0,NA=Buffer.allocUnsafe(256),A}}),k=VH;function T1(H){if(NA.length-VH.i<H){let A=NA,L=A.length;NA=Buffer.allocUnsafe(L+(L>>1)+H),A.copy(NA)}}function ba(){return VH.i=0,VH}var Ni=__,ha=1,rI=k().S().end(),G_=k().H().end(),ra=k().i32(8).i32(80877103).end(8),ja=Buffer.concat([k().E().str(k.N).i32(0).end(),rI]),ka=k().D().str("S").str(k.N).end(),af=()=>{},da=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),qa={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function __(H,A={},{onopen:L=af,onend:I=af,onclose:$=af}={}){let{ssl:f,max:E,user:D,host:M,port:o,database:u,parsers:t,transform:i,onnotice:B,onnotify:U,onparameter:x,max_pipeline:T,keep_alive:F,backoff:m,target_session_attrs:Y}=H,W=tL(),P=ha++,V={pid:null,secret:null},J=si(a1,H.idle_timeout),a=si(a1,H.max_lifetime),h=si(e_,H.connect_timeout),X=null,MH,Z=new X$,oH=Buffer.alloc(0),wH=H.fetch_types,DA={},ZA={},HI=Math.random().toString(36).slice(2),w=1,r=0,TH=0,bH=0,MA=0,tH=0,OH=0,IA=0,hH=null,YH=null,mA=!1,sH=null,XL=null,PA=null,UI=null,oA=null,QH=null,SL=null,QL=null,l=null,yf=null,XA={queue:A.closed,idleTimer:J,connect(p){PA=p||!0,up()},terminate:Yf,execute:Rf,cancel:k_,end:a1,count:0,id:P};return A.closed&&A.closed.push(XA),XA;async function j_(){let p;try{p=H.socket?await Promise.resolve(H.socket(H)):new C_.Socket}catch(C){w$(C);return}return p.on("error",w$),p.on("close",tp),p.on("drain",Mp),p}async function k_({pid:p,secret:C},d,GH){try{MH=k().i32(16).i32(80877102).i32(p).i32(C).end(16),await op(),X.once("error",GH),X.once("close",d)}catch(kH){GH(kH)}}function Rf(p){if(mA)return tD(p,EA.connection("CONNECTION_DESTROYED",H));if(p.cancelled)return;try{return p.state=V,l?W.push(p):(l=p,l.active=!0),g_(p),GA(d_(p))&&!p.describeFirst&&!p.cursorFn&&W.length<T&&(!p.options.onexecute||p.options.onexecute(XA))}catch(C){return W.length===0&&GA(rI),zL(C),!0}}function d_(p){if(p.parameters.length>=65534)throw EA.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return p.options.simple?k().Q().str(p.statement.string+k.N).end():p.describeFirst?Buffer.concat([fp(p),G_]):p.prepare?p.prepared?uD(p):Buffer.concat([fp(p),uD(p)]):q_(p)}function fp(p){return Buffer.concat([pp(p.statement.string,p.parameters,p.statement.types,p.statement.name),sW("S",p.statement.name)])}function uD(p){return Buffer.concat([OW(p.parameters,p.statement.types,p.statement.name,p.cursorName),p.cursorFn?np("",p.cursorRows):ja])}function q_(p){return Buffer.concat([pp(p.statement.string,p.parameters,p.statement.types),ka,uD(p)])}function g_(p){let C=[],d=[],GH=Si(p,p.strings[0],p.args[0],C,d,H);!p.tagged&&p.args.forEach((kH)=>U1(kH,C,d,H)),p.prepare=H.prepare&&("prepare"in p.options?p.options.prepare:!0),p.string=GH,p.signature=p.prepare&&d+GH,p.onlyDescribe&&delete ZA[p.signature],p.parameters=p.parameters||C,p.prepared=p.prepare&&p.signature in ZA,p.describeFirst=p.onlyDescribe||C.length&&!p.prepared,p.statement=p.prepared?ZA[p.signature]:{string:GH,types:d,name:p.prepare?HI+w++:""},typeof H.debug==="function"&&H.debug(P,GH,C,d)}function GA(p,C){if(QH=QH?Buffer.concat([QH,p]):Buffer.from(p),C||QH.length>=1024)return Ep(C);return YH===null&&(YH=setImmediate(Ep)),!0}function Ep(p){let C=X.write(QH,p);return YH!==null&&clearImmediate(YH),QH=YH=null,C}function e_(){zL(EA.connection("CONNECT_TIMEOUT",H,X)),X.destroy()}async function Dp(){if(GA(ra),!await new Promise((C)=>X.once("data",(d)=>C(d[0]===83)))&&f==="prefer")return V$();X.removeAllListeners(),X=Za.connect({socket:X,servername:C_.isIP(X.host)?void 0:X.host,...f==="require"||f==="allow"||f==="prefer"?{rejectUnauthorized:!1}:f==="verify-full"?{}:typeof f==="object"?f:{}}),X.on("secureConnect",V$),X.on("error",w$),X.on("close",tp),X.on("drain",Mp)}function Mp(){!l&&L(XA)}function v1(p){if(sH){if(sH.push(p),TH-=p.length,TH>=0)return}oH=sH?Buffer.concat(sH,tH-TH):oH.length===0?p:Buffer.concat([oH,p],oH.length+p.length);while(oH.length>4){if(tH=oH.readUInt32BE(1),tH>=oH.length){TH=tH-oH.length,sH=[oH];break}try{HW(oH.subarray(0,tH+1))}catch(C){l&&(l.cursorFn||l.describeFirst)&&GA(rI),zL(C)}oH=oH.subarray(tH+1),TH=0,sH=null}}async function op(){if(mA=!1,DA={},X||(X=await j_()),!X)return;if(h.start(),H.socket)return f?Dp():V$();if(X.on("connect",f?Dp:V$),H.path)return X.connect(H.path);X.ssl=f,X.connect(o[bH],M[bH]),X.host=M[bH],X.port=o[bH],bH=(bH+1)%o.length}function up(){setTimeout(op,r?r+OH-T_.now():0)}function V$(){try{ZA={},wH=H.fetch_types,HI=Math.random().toString(36).slice(2),w=1,a.start(),X.on("data",v1),F&&X.setKeepAlive&&X.setKeepAlive(!0,1000*F);let p=yW();GA(p)}catch(p){w$(p)}}function w$(p){if(XA.queue===A.connecting&&H.host[MA+1])return;zL(p);while(W.length)tD(W.shift(),p)}function zL(p){oA&&(oA.destroy(p),oA=null),l&&tD(l,p),PA&&(tD(PA,p),PA=null)}function tD(p,C){"query"in C||"parameters"in C||Object.defineProperties(C,{stack:{value:C.stack+p.origin.replace(/.*\n/,`
99
- `),enumerable:H.debug},query:{value:p.string,enumerable:H.debug},parameters:{value:p.parameters,enumerable:H.debug},args:{value:p.args,enumerable:H.debug},types:{value:p.statement&&p.statement.types,enumerable:H.debug}}),p.reject(C)}function a1(){return UI||(!XA.reserved&&I(XA),!XA.reserved&&!PA&&!l&&W.length===0?(Yf(),new Promise((p)=>X&&X.readyState!=="closed"?X.once("close",p):p())):UI=new Promise((p)=>SL=p))}function Yf(){if(mA=!0,oA||l||PA||W.length)w$(EA.connection("CONNECTION_DESTROYED",H));if(clearImmediate(YH),X)X.removeListener("data",v1),X.removeListener("connect",V$),X.readyState==="open"&&X.end(k().X().end());SL&&(SL(),UI=SL=null)}async function tp(p){if(oH=Buffer.alloc(0),TH=0,sH=null,clearImmediate(YH),X.removeListener("data",v1),X.removeListener("connect",V$),J.cancel(),a.cancel(),h.cancel(),X.removeAllListeners(),X=null,PA)return up();!p&&(l||W.length)&&w$(EA.connection("CONNECTION_CLOSED",H,X)),r=T_.now(),p&&H.shared.retries++,OH=(typeof m==="function"?m(H.shared.retries):m)*1000,$(XA,EA.connection("CONNECTION_CLOSED",H,X))}function HW(p,C=p[0]){(C===68?AW:C===100?SW:C===65?FW:C===83?LW:C===90?IW:C===67?$W:C===50?ip:C===49?fW:C===116?EW:C===84?DW:C===82?MW:C===110?nW:C===75?BW:C===69?TW:C===115?_W:C===51?WW:C===71?mW:C===78?VW:C===72?PW:C===99?JW:C===73?wW:C===86?KW:C===118?vW:C===87?XW:aW)(p)}function AW(p){let C=7,d,GH,kH,SA=l.isRaw?new Array(l.statement.columns.length):{};for(let yA=0;yA<l.statement.columns.length;yA++)GH=l.statement.columns[yA],d=p.readInt32BE(C),C+=4,kH=d===-1?null:l.isRaw===!0?p.subarray(C,C+=d):GH.parser===void 0?p.toString("utf8",C,C+=d):GH.parser.array===!0?GH.parser(p.toString("utf8",C+1,C+=d)):GH.parser(p.toString("utf8",C,C+=d)),l.isRaw?SA[yA]=l.isRaw===!0?kH:i.value.from?i.value.from(kH,GH):kH:SA[GH.name]=i.value.from?i.value.from(kH,GH):kH;l.forEachFn?l.forEachFn(i.row.from?i.row.from(SA):SA,Z):Z[IA++]=i.row.from?i.row.from(SA):SA}function LW(p){let[C,d]=p.toString("utf8",5,p.length-1).split(k.N);if(DA[C]=d,H.parameters[C]!==d)H.parameters[C]=d,x&&x(C,d)}function IW(p){if(l&&l.options.simple&&l.resolve(XL||Z),l=XL=null,Z=new X$,h.cancel(),PA){if(Y){if(!DA.in_hot_standby||!DA.default_transaction_read_only)return CW();else if(UW(Y,DA))return Yf()}if(wH)return PA===!0&&(PA=null),cW();PA!==!0&&Rf(PA),H.shared.retries=MA=0,PA=null;return}while(W.length&&(l=W.shift())&&(l.active=!0,l.cancelled))__(H).cancel(l.state,l.cancelled.resolve,l.cancelled.reject);if(l)return;XA.reserved?!XA.reserved.release&&p[5]===73?UI?Yf():(XA.reserved=null,L(XA)):XA.reserved():UI?Yf():L(XA)}function $W(p){IA=0;for(let C=p.length-1;C>0;C--){if(p[C]===32&&p[C+1]<58&&Z.count===null)Z.count=+p.toString("utf8",C+1,p.length-1);if(p[C-1]>=65){Z.command=p.toString("utf8",5,C),Z.state=V;break}}if(yf&&(yf(),yf=null),Z.command==="BEGIN"&&E!==1&&!XA.reserved)return zL(EA.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(l.options.simple)return ip();if(l.cursorFn)Z.count&&l.cursorFn(Z),GA(rI);l.resolve(Z)}function fW(){l.parsing=!1}function ip(){!Z.statement&&(Z.statement=l.statement),Z.columns=l.statement.columns}function EW(p){let C=p.readUInt16BE(5);for(let d=0;d<C;++d)!l.statement.types[d]&&(l.statement.types[d]=p.readUInt32BE(7+d*4));l.prepare&&(ZA[l.signature]=l.statement),l.describeFirst&&!l.onlyDescribe&&(GA(uD(l)),l.describeFirst=!1)}function DW(p){if(Z.command)XL=XL||[Z],XL.push(Z=new X$),Z.count=null,l.statement.columns=null;let C=p.readUInt16BE(5),d=7,GH;l.statement.columns=Array(C);for(let kH=0;kH<C;++kH){GH=d;while(p[d++]!==0);let SA=p.readUInt32BE(d),yA=p.readUInt16BE(d+4),CI=p.readUInt32BE(d+6);l.statement.columns[kH]={name:i.column.from?i.column.from(p.toString("utf8",GH,d-1)):p.toString("utf8",GH,d-1),parser:t[CI],table:SA,number:yA,type:CI},d+=18}if(Z.statement=l.statement,l.onlyDescribe)return l.resolve(l.statement),GA(rI)}async function MW(p,C=p.readUInt32BE(5)){(C===3?oW:C===5?uW:C===10?tW:C===11?iW:C===12?pW:C!==0?lW:af)(p,C)}async function oW(){let p=await l1();GA(k().p().str(p).z(1).end())}async function uW(p){let C="md5"+await F_(Buffer.concat([Buffer.from(await F_(await l1()+D)),p.subarray(9)]));GA(k().p().str(C).z(1).end())}async function tW(){QL=(await $D.randomBytes(18)).toString("base64"),k().p().str("SCRAM-SHA-256"+k.N);let p=k.i;GA(k.inc(4).str("n,,n=*,r="+QL).i32(k.i-p-4,p).end())}async function iW(p){let C=p.toString("utf8",9).split(",").reduce((yA,CI)=>(yA[CI[0]]=CI.slice(2),yA),{}),d=await $D.pbkdf2Sync(await l1(),Buffer.from(C.s,"base64"),parseInt(C.i),32,"sha256"),GH=await G1(d,"Client Key"),kH="n=*,r="+QL+",r="+C.r+",s="+C.s+",i="+C.i+",c=biws,r="+C.r;hH=(await G1(await G1(d,"Server Key"),kH)).toString("base64");let SA="c=biws,r="+C.r+",p="+ea(GH,Buffer.from(await G1(await ga(GH),kH))).toString("base64");GA(k().p().str(SA).end())}function pW(p){if(p.toString("utf8",9).split(k.N,1)[0].slice(2)===hH)return;zL(EA.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),X.destroy()}function l1(){return Promise.resolve(typeof H.pass==="function"?H.pass():H.pass)}function nW(){if(Z.statement=l.statement,Z.statement.columns=[],l.onlyDescribe)return l.resolve(l.statement),GA(rI)}function BW(p){V.pid=p.readUInt32BE(5),V.secret=p.readUInt32BE(9)}async function cW(){wH=!1,(await new PL([`
91
+ ${J.trace}`:`No previous disposal trace for ${$} was found.`)}return n}function Cw(i,o,n,p){let c=`T$--${o}==${n}++${p}`;return ic(i,[n,p],c,"all"),c}function oc(i,o){let n=Ji(o),p=i.molecules.get(n);if(!p){let X=i.disposalTraces.buffer.find((Y)=>Y?.key===n);i.logger.error("\u274C","molecule",o,"deallocation failed:",`Could not find allocation for ${n} in store "${i.config.name}".`,X?`
92
+ This state was most recently deallocated
93
+ ${X.trace}`:`No previous disposal trace for ${n} was found.`);return}let c=i.moleculeJoins.getRelatedKeys(p.key);if(c)for(let X of c){let Y=i.joins.get(X);if(Y)Y.relations.delete(p.key),Y.molecules.delete(p.stringKey)}i.moleculeJoins.delete(p.stringKey);let x=[],T=[],m={type:"molecule_disposal",key:p.key,values:T,provenance:x},f=I(i);f.molecules.delete(n);let F=zi(f)&&f.transactionMeta.phase==="building";if(F)f.transactionMeta.update.updates.push(m);let $=i.moleculeGraph.getRelationEntries({downstreamMoleculeKey:p.stringKey});if($)for(let[X,{source:Y}]of $)if(Y===p.stringKey){let R=Wo(X);oc(i,R)}else x.push(Y);let J=f.moleculeData.getRelatedKeys(p.stringKey);if(J)for(let X of J){let Y=f.families.get(X),R=t(i,Y,p.key);T.push([Y.key,R]),nc(i,R)}if(f.moleculeGraph.delete(p.stringKey),f.moleculeJoins.delete(p.stringKey),f.moleculeData.delete(p.stringKey),!F)f.on.moleculeDisposal.next(m);f.molecules.delete(p.stringKey);let A=_w(new Error);i.disposalTraces.add({key:n,trace:A})}function rc(i,o,n,p){let c=Ji(n),x=I(i),T=x.molecules.get(c);if(!T){let A=i.disposalTraces.buffer.find((X)=>X?.key===c);return i.logger.error("\u274C","molecule",n,"claim failed:",`Could not allocate to ${c} in store "${i.config.name}".`,A?`
94
+ ${c} was most recently disposed
95
+ ${A.trace}`:`No previous disposal trace for ${c} was found.`),n}let m=Ji(o),f=x.molecules.get(m);if(!f){let A=i.disposalTraces.buffer.find((X)=>X?.key===m);return i.logger.error("\u274C","molecule",n,"claim failed:",`Could not allocate to ${m} in store "${i.config.name}".`,A?`
96
+ ${m} was most recently disposed
97
+ ${A.trace}`:`No previous disposal trace for ${m} was found.`),n}let F=i.moleculeGraph.getRelationEntries({downstreamMoleculeKey:T.stringKey}).filter(([,{source:A}])=>A!==c).map(([A])=>Wo(A));if(p)x.moleculeGraph.delete(c);x.moleculeGraph.set({upstreamMoleculeKey:f.stringKey,downstreamMoleculeKey:T.stringKey},{source:f.stringKey});let $={type:"molecule_transfer",key:T.key,from:F,to:[f.key]};if(zi(x)&&x.transactionMeta.phase==="building")x.transactionMeta.update.updates.push($);return n}function oF(i,o,n){switch(o){case"newValue":{yw(i,n);break}case"oldValue":{nc(n,i.token);break}}}function nF(i,o,n){switch(o){case"newValue":{nc(n,i.token);break}case"oldValue":{if(yw(i,n),i.subType==="atom")n.valueMap.set(i.token.key,i.value);break}}}function yw(i,o){let{family:n}=i.token;if(n){let p=o.families.get(n.key);if(p)t(o,p,Wo(n.subKey))}}function Dw(i,o,n){switch(o){case"newValue":ic(n,i.provenance,i.key);break;case"oldValue":oc(n,i.key);break}}function Iw(i,o,n){switch(o){case"newValue":oc(n,i.key);break;case"oldValue":{let p=i.provenance.map(Wo);ic(n,p,i.key);for(let[c,x]of i.values){let T=n.families.get(c);if(T){t(n,T,i.key);let m=`${c}(${Ji(i.key)})`;n.valueMap.set(m,x)}}}break}}function Bw(i,o,n){switch(o){case"newValue":{let p=i.to.length===1?i.to[0]:i.to;rc(n,p,i.key,"exclusive")}break;case"oldValue":{let p=i.from.length===1?i.from[0]:i.from;rc(n,p,i.key,"exclusive")}break}}function qm(i,o,n){let p=i==="newValue"?o.updates:[...o.updates].reverse();for(let c of p)switch(c.type){case"atom_update":case"selector_update":lm(i,c,n);break;case"state_creation":oF(c,i,n);break;case"state_disposal":nF(c,i,n);break;case"molecule_creation":Dw(c,i,n);break;case"molecule_disposal":Iw(c,i,n);break;case"molecule_transfer":Bw(c,i,n);break;case"transaction_update":qm(i,c,n);break}}function pF(i,o){return i.transactionMeta.actionContinuities.getRelatedKey(o)}function zU(i,o){return i.transactionMeta.epoch.get(o)}function Nw(i,o){if(!Ho(i))return;let p=pF(i,o);if(p===void 0)return;return zU(i,p)}function bw(i,o,n){if(Ho(i)&&o)i.transactionMeta.epoch.set(o,n)}function jw(i,o,n){if(!Ho(i))return;let c=pF(i,o);if(c!==void 0)i.transactionMeta.epoch.set(c,n)}var Pw=(i,o)=>{let n=I(o),{parent:p}=n;if(p===null||!zi(n)||n.transactionMeta?.phase!=="building"){o.logger.warn("\uD83D\uDC1E","transaction","???","applyTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}n.transactionMeta.phase="applying",n.transactionMeta.update.output=i,p.child=null,p.on.transactionApplying.next(n.transactionMeta);let{updates:c}=n.transactionMeta.update;if(o.logger.info("\uD83D\uDEC4","transaction",n.transactionMeta.update.key,`Applying transaction with ${c.length} updates:`,c),qm("newValue",n.transactionMeta.update,p),Ho(p))jw(p,n.transactionMeta.update.key,n.transactionMeta.update.epoch),Ri(o,{key:n.transactionMeta.update.key,type:"transaction"})?.subject.next(n.transactionMeta.update),o.logger.info("\uD83D\uDEEC","transaction",n.transactionMeta.update.key,"Finished applying transaction.");else if(zi(p))p.transactionMeta.update.updates.push(n.transactionMeta.update);p.on.transactionApplying.next(null)};function aw(i,o,n){if(!Ho(i))return;let{epoch:c,actionContinuities:x}=i.transactionMeta;if(x.set(o,n),!c.has(o))c.set(o,-1)}function lw(i){return{store:i}}function Mi(i,...o){let n,p,c;if(o.length===1)n=o[0];else p=o[0],c=o[1],n=t(i,p,c);if("counterfeit"in n&&"family"in n){p=i.families.get(n.family.key);let x=n.family.subKey,T=i.disposalTraces.buffer.find((m)=>m?.key===x);switch(i.logger.error("\u274C",n.type,n.key,`could not be retrieved because it was not found in the store "${i.config.name}".`,T?`This state was previously disposed:
98
+ ${T.trace}`:"No previous disposal trace was found."),p.type){case"atom_family":case"mutable_atom_family":return i.defaults.get(p.key);case"selector_family":case"readonly_selector_family":{if(i.defaults.has(p.key))return i.defaults.get(n.family.key);let m=Ri(i,p).default(x);return i.defaults.set(p.key,m),m}}}return Sp(i,Ri(i,n))}class Rn extends Map{deleted=new Set;source;constructor(i){super();this.source=i}get(i){if(super.has(i))return super.get(i);if(!this.deleted.has(i)&&this.source.has(i))return this.source.get(i);return}set(i,o){return this.deleted.delete(i),super.set(i,o)}hasOwn(i){return super.has(i)}has(i){return!this.deleted.has(i)&&(super.has(i)||this.source.has(i))}delete(i){return this.deleted.add(i),super.delete(i)}}var qw=(i,o,n,p)=>{let c=I(i),x={parent:c,child:null,on:c.on,loggers:c.loggers,logger:c.logger,config:c.config,atoms:new Rn(c.atoms),atomsThatAreDefault:new Set(c.atomsThatAreDefault),families:new Rn(c.families),joins:new Rn(c.joins),operation:{open:!1},readonlySelectors:new Rn(c.readonlySelectors),timelines:new Rn(c.timelines),timelineTopics:new Ao(c.timelineTopics.toJSON()),trackers:new Map,transactions:new Rn(c.transactions),selectorAtoms:new Ao(c.selectorAtoms.toJSON()),selectorGraph:new Ao(c.selectorGraph.toJSON(),{makeContentKey:(...F)=>F.sort().join(":")}),selectors:new Rn(c.selectors),valueMap:new Rn(c.valueMap),defaults:c.defaults,disposalTraces:i.disposalTraces.copy(),molecules:new Rn(c.molecules),moleculeGraph:new Ao(c.moleculeGraph.toJSON(),{makeContentKey:c.moleculeGraph.makeContentKey}),moleculeData:new Ao(c.moleculeData.toJSON(),{makeContentKey:c.moleculeData.makeContentKey}),moleculeJoins:new Ao(c.moleculeJoins.toJSON(),{makeContentKey:c.moleculeJoins.makeContentKey}),miscResources:new Rn(c.miscResources)},T=Nw(i,o),m={phase:"building",update:{type:"transaction_update",key:o,id:p,epoch:T===void 0?Number.NaN:T+1,updates:[],params:n,output:void 0},toolkit:{get:(...F)=>Mi(f,...F),set:(...F)=>{_i(f,...F)},run:(F,$=bm())=>tc(f,F,$),find:(...F)=>t(i,...F),json:(F)=>Jo(f,F),dispose:(...F)=>{nc(f,...F)},env:()=>lw(f)}},f=Object.assign(x,{transactionMeta:m});return c.child=f,i.logger.info("\uD83D\uDEEB","transaction",o,"Building transaction with params:",n),f};function cF(i,o){let n={key:o.key,type:"transaction",run:(x,T)=>{let m=qw(i,o.key,x,T);try{let f=I(i),{toolkit:F}=m.transactionMeta,$=o.do(F,...x);return Pw($,f),$}catch(f){throw Kw(p),i.logger.warn("\uD83D\uDCA5","transaction",o.key,"caught:",f),f}},install:(x)=>cF(x,o),subject:new $i},p=I(i);p.transactions.set(n.key,n);let c=gn(n);return i.on.transactionCreation.next(c),c}class kw{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;selectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new Ao({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new Ao({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...i)=>i.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new Ao({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new Ao({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new jm(100);molecules=new Map;moleculeJoins=new Ao({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...i)=>i.sort().join(":")});moleculeGraph=new Ao({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...i)=>i.sort().join(":")});moleculeData=new Ao({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...i)=>i.sort().join(":")});miscResources=new Map;on={atomCreation:new $i,atomDisposal:new $i,selectorCreation:new $i,selectorDisposal:new $i,timelineCreation:new $i,transactionCreation:new $i,transactionApplying:new ef(null),operationClose:new $i,moleculeCreation:new $i,moleculeDisposal:new $i};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new pc("warn",(i,o,n)=>!hw(n))];logger={error:(...i)=>{for(let o of this.loggers)o.error(...i)},info:(...i)=>{for(let o of this.loggers)o.info(...i)},warn:(...i)=>{for(let o of this.loggers)o.warn(...i)}};constructor(i,o=null){if(this.config={...o?.config,...i},o!==null){if(this.valueMap=new Map(o?.valueMap),this.operation={...o?.operation},Ho(o))this.transactionMeta={epoch:new Map(o?.transactionMeta.epoch),actionContinuities:new Ao(o?.transactionMeta.actionContinuities.toJSON())};for(let[,p]of o.families){if(p.internalRoles?.includes("mutable")||p.internalRoles?.includes("join"))continue;p.install(this)}let n=new Set;for(let[,p]of o.atoms){if(n.has(p.key))continue;if(p.install(this),p.type==="mutable_atom"){let c=Jo(o,p),x=$p(p);n.add(c.key),n.add(x.key)}}for(let[,p]of o.readonlySelectors)p.install(this);for(let[,p]of o.selectors){if(n.has(p.key))continue;p.install(this)}for(let[,p]of o.transactions)p.install(this);for(let[,p]of o.timelines)p.install(this)}}}var d={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new kw({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function Ri(i,o){let n,p=i;while(p!==null){switch(o.type){case"atom":case"mutable_atom":n=p.atoms.get(o.key);break;case"selector":n=p.selectors.get(o.key);break;case"readonly_selector":n=p.readonlySelectors.get(o.key);break;case"atom_family":case"mutable_atom_family":case"selector_family":case"readonly_selector_family":n=p.families.get(o.key);break;case"timeline":n=p.timelines.get(o.key);break;case"transaction":n=p.transactions.get(o.key);break}if(n)return n;p=p.child}throw new ep(o,i)}function gw(i,o,n){let p=i.families.get(o.key);if(p===void 0)throw new ep(o,i);let c=p(n),x=I(i);if(c.family){if(Ho(x))switch(c.type){case"atom":case"mutable_atom":i.on.atomCreation.next(c);break;case"selector":case"readonly_selector":i.on.selectorCreation.next(c);break}else if(zi(x)&&x.on.transactionApplying.state===null)x.transactionMeta.update.updates.push({type:"state_creation",token:c})}return c}function sw(i,o,n){let p=Ji(n),c=`${o.key}(${p})`,x=I(i),T;switch(o.type){case"atom_family":case"mutable_atom_family":T=x.atoms.get(c);break;case"selector_family":T=x.selectors.get(c);break;case"readonly_selector_family":T=x.readonlySelectors.get(c);break}if(T)return gn(T);return T}function t(i,o,n){let p=sw(i,o,n);if(p)return p;let c=Ji(n),x=i.molecules.get(c);if(!x&&i.config.lifespan==="immortal"){let T=Gw(o,n);return i.logger.error("\u274C",T.type,T.key,`was not found in store "${i.config.name}"; returned a counterfeit token.`),T}if(p=gw(i,o,n),x)I(i).moleculeData.set(c,o.key);return p}function nc(i,...o){let n;if(o.length===1)n=o[0];else{let p=o[0],c=o[1];n=t(i,p,c)}try{Ri(i,n)}catch(p){i.logger.error("\u274C",n.type,n.key,`could not be disposed because it was not found in the store "${i.config.name}".`);return}switch(n.type){case"atom":case"mutable_atom":xF(i,n);break;case"selector":case"readonly_selector":tw(i,n);break}}var km=(i,o)=>I(i).atoms.has(o),uU=(i,o)=>I(i).selectors.has(o),QU=(i,o)=>I(i).readonlySelectors.has(o),dw=(i,o)=>km(i,o)||uU(i,o)||QU(i,o);var hm=(i,o)=>{return I(o).selectorGraph.getRelationEntries({downstreamSelectorKey:i}).filter(([p,{source:c}])=>c!==i).map(([p,{source:c}])=>c).filter((p)=>dw(o,p))};var TF=(i,o,n)=>{let p=[],c=hm(i,n);while(c.length>0){let x=c.shift();if(o.has(x))continue;if(o.add(x),!km(n,x))c.push(...hm(x,n));else if(!p.includes(x))p.push(x)}return p},rw=(i,o)=>{let n=i.key,p=hm(n,o),c=new Set;return p.flatMap((x)=>km(o,x)?x:TF(x,c,o))};var ew=(i,o,n,p)=>{let c=I(p);if(o.type==="atom"||o.type==="mutable_atom")c.selectorAtoms.set({selectorKey:i,atomKey:o.key}),p.logger.info("\uD83D\uDD0D","selector",i,`discovers root atom "${o.key}"`);else{let x=TF(o.key,n,p);p.logger.info("\uD83D\uDD0D","selector",i,`discovers root atoms: [ ${x.map((T)=>`"${T}"`).join(", ")} ]`);for(let T of x)c.selectorAtoms=c.selectorAtoms.set({selectorKey:i,atomKey:T})}n.add(o.key)};var gm=(i,o,n)=>({get:(...p)=>{let c=I(n),x;if(p.length===2){let[f,F]=p;x=t(n,f,F)}else[x]=p;let T=Ri(n,x),m=Sp(n,T);return n.logger.info("\uD83D\uDD0C","selector",i,`registers dependency ( "${x.key}" =`,m,")"),c.selectorGraph.set({upstreamSelectorKey:x.key,downstreamSelectorKey:i},{source:x.key}),ew(i,x,o,n),m},set:(...p)=>{let c,x;if(p.length===2)c=p[0],x=p[1];else{let f=p[0],F=p[1];x=p[2],c=t(n,f,F)}let T=I(n),m=Ri(T,c);am(T,m,x)},find:(...p)=>t(n,...p),json:(p)=>Jo(n,p)});var RT=(i,o,n)=>{let p=I(i),c=new $i,x=new Set,{get:T,find:m,json:f}=gm(o.key,x,p),F=()=>{let X=o.get({get:T,find:m,json:f});return Wn(I(i),o.key,X,c),x.clear(),X},$={...o,subject:c,install:(X)=>RT(X,o,n),get:F,type:"readonly_selector",...n&&{family:n}};p.readonlySelectors.set(o.key,$);let J=F();i.logger.info("\u2728",$.type,$.key,"=",J);let A={key:o.key,type:"readonly_selector"};if(n)A.family=n;return A};var KT=(i,o,n)=>{let p=I(i),c=new $i,x=new Set,T=gm(o.key,x,p),{find:m,get:f,json:F}=T,$={find:m,get:f,json:F},J=(K=o.get,U=I(i))=>{let z=K($);return Wn(U,o.key,z,c),x.clear(),z},X={...o,subject:c,install:(K)=>KT(K,o,n),get:J,set:(K)=>{let U=I(i),z=J(o.get,U),b=Pm(K)(z);if(i.logger.info("\uD83D\uDCDD","selector",o.key,"set (",z,"->",b,")"),Wn(U,o.key,b,c),dc(U,o.key),Ho(U))c.next({newValue:b,oldValue:z});o.set(T,b)},type:"selector",...n&&{family:n}};p.selectors.set(o.key,X);let Y=J();i.logger.info("\u2728",X.type,X.key,"=",Y);let R={key:o.key,type:"selector"};if(n)R.family=n;return R};function rf(i,o){if("set"in o){let c=KT(i,o,void 0);return i.on.selectorCreation.next(c),c}let p=RT(i,o,void 0);return i.on.selectorCreation.next(p),p}function tw(i,o){let n=I(i),{key:p}=o,c=Ri(n,o);if(!c.family)i.logger.error("\u274C","selector",p,"Standalone selectors cannot be disposed.");else{if(n.molecules.get(c.family.subKey))n.moleculeData.delete(c.family.subKey,c.family.key);let T;switch(o.type){case"selector":n.selectors.delete(p),T={key:c.family.key,type:"selector_family"},Ri(i,T).subject.next({type:"state_disposal",subType:"selector",token:o});break;case"readonly_selector":n.readonlySelectors.delete(p),T={key:c.family.key,type:"readonly_selector_family"},Ri(i,T).subject.next({type:"state_disposal",subType:"selector",token:o});break}if(n.valueMap.delete(p),n.selectorAtoms.delete(p),n.selectorGraph.delete(p),i.logger.info("\uD83D\uDD25",o.type,p,"deleted"),zi(n)&&n.transactionMeta.phase==="building")n.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:o});else i.on.selectorDisposal.next(o)}}function YT(i,o,n){let p={key:o.key,type:"selector_family"},c=i.families.get(o.key);if(c)i.logger.error("\u2757","selector_family",o.key,`Overwriting an existing ${hn(c)} "${c.key}" in store "${i.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let x=new $i,m=Object.assign((f)=>{let F=Ji(f),$={key:o.key,subKey:F},J=`${o.key}(${F})`,A=I(i),X=KT(A,{key:J,get:o.get(f),set:o.set(f)},$);return x.next({type:"state_creation",token:X}),X},p,{internalRoles:n,subject:x,install:(f)=>YT(f,o),default:(f)=>{return o.get(f)({get:(...$)=>Mi(i,...$),find:(...$)=>t(i,...$),json:($)=>Jo(i,$)})}});return i.families.set(o.key,m),p}function i8(i,o,n){return YT(i,{key:`${o.key}:JSON`,get:(c)=>({get:x})=>{let T=x(o,c);return n.toJson(T)},set:(c)=>({set:x},T)=>{x(o,c,n.fromJson(T))}},["mutable","json"])}var Wo=(i)=>JSON.parse(i),Ji=(i)=>JSON.stringify(i),Sk=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];var o8=(i,o)=>{let n=I(i);if(n.operation.open)return n.operation.prev.get(o.key);return n.valueMap.get(o.key)};var FF=(i,o)=>{let n=I(i);return rw(o,i).map((c)=>{let x=n.atoms.get(c);if(x===void 0)throw new Error(`Atom "${c}", a dependency of selector "${o.key}", not found in store "${i.config.name}".`);return x.subject.subscribe(`${o.type}:${o.key}`,(T)=>{i.logger.info("\uD83D\uDCE2",o.type,o.key,"root",c,"went",T.oldValue,"->",T.newValue);let m=o8(n,o),f=Sp(n,o);i.logger.info("\u2728",o.type,o.key,"went",m,"->",f),o.subject.next({newValue:f,oldValue:m})})})};function Eo(i,o,n,p){function c(J){if(i.operation.open){let A=i.on.operationClose.subscribe(`state subscription ${n}`,()=>{A(),p(J)})}else p(J)}let x=Ri(i,o);i.logger.info("\uD83D\uDC40",x.type,x.key,`Adding subscription "${n}"`);let T=x.type==="selector"||x.type==="readonly_selector",m=null,f=c;if(T)m=FF(i,x),f=(J)=>{if(m)m.length=0,m.push(...FF(i,x));c(J)};let F=x.subject.subscribe(n,f);return()=>{if(i.logger.info("\uD83D\uDE48",x.type,x.key,`Removing subscription "${n}"`),F(),m)for(let J of m)J()}}var mF=(i,o,n,p)=>{let c=Ri(i,o);i.logger.info("\uD83D\uDC40","timeline",o.key,`Adding subscription "${n}"`);let x=c.subject.subscribe(n,p);return()=>{i.logger.info("\uD83D\uDE48","timeline",o.key,`Removing subscription "${n}" from timeline`),x()}};var fF=(i,o,n,p)=>{let c=Ri(i,o);i.logger.info("\uD83D\uDC40","transaction",o.key,`Adding subscription "${n}"`);let x=c.subject.subscribe(n,p);return()=>{i.logger.info("\uD83D\uDE48","transaction",o.key,`Removing subscription "${n}"`),x()}};class cc{Update;initializeState(i,o){let n=`*${i.key}`;o.atoms.delete(n),o.valueMap.delete(n);let p=i.family?{key:`*${i.family.key}`,subKey:i.family.subKey}:void 0,c=rp(o,{key:n,default:null},p);if(o.parent?.valueMap.has(n)){let x=o.parent.valueMap.get(n);o.valueMap.set(n,x)}return c}unsubscribeFromInnerValue;unsubscribeFromState;observeCore(i,o,n){let p=`tracker:${n.config.name}:${zi(n)?n.transactionMeta.update.key:"main"}:${i.key}`,c=Mi(n,i);this.unsubscribeFromInnerValue=c.subscribe(p,(x)=>{_i(n,o,x)}),this.unsubscribeFromState=Eo(n,i,p,(x)=>{if(x.newValue!==x.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=x.newValue.subscribe(p,(T)=>{_i(n,o,T)})})}updateCore(i,o,n){let p=`tracker:${n.config.name}:${zi(n)?n.transactionMeta.update.key:"main"}:${i.key}`;Eo(n,o,p,({newValue:c,oldValue:x})=>{let T=n.timelineTopics.getRelatedKey(o.key);if(T){if(n.timelines.get(T)?.timeTraveling){let F=mF(n,{key:T,type:"timeline"},p,($)=>{F(),_i(n,i,(J)=>{if($==="redo"&&c)J.do(c);else if($==="undo"&&x)J.undo(x);return J})});return}}let m=n.on.operationClose.subscribe(p,()=>{m();let f=Mi(n,i),F=c===null?-1:f.getUpdateNumber(c),$=F-f.cacheUpdateNumber;if(c&&$===1)_i(n,i,(J)=>(J.do(c),J));else n.logger.info("\u274C","mutable_atom",i.key,`could not be updated. Expected update number ${f.cacheUpdateNumber+1}, but got ${F}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor(i,o){this.mutableState=i;let n=I(o);this.latestUpdateState=this.initializeState(i,n),this.observeCore(i,this.latestUpdateState,n),this.updateCore(i,this.latestUpdateState,n),n.trackers.set(i.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),n.trackers.delete(i.key)}}}function HT(i,o,n){i.logger.info("\uD83D\uDD28","atom",o.key,`creating in store "${i.config.name}"`);let p=I(i),c=p.atoms.get(o.key);if(c&&c.type==="mutable_atom")return i.logger.error("\u274C","atom",o.key,"Tried to create atom, but it already exists in the store."),gn(c);let x=new $i,T={...o,type:"mutable_atom",install:(F)=>{return F.logger.info("\uD83D\uDEE0\uFE0F","atom",o.key,`installing in store "${F.config.name}"`),HT(F,o,n)},subject:x};if(n)T.family=n;let m=o.default();p.atoms.set(T.key,T),sm(i,o.key),Wn(p,o.key,m,x);let f=gn(T);if(o.effects){let F=0,$=[];for(let J of o.effects){let A=J({setSelf:(X)=>{_i(i,f,X)},onSet:(X)=>Eo(i,f,`effect[${F}]`,X)});if(A)$.push(A);++F}T.cleanup=()=>{for(let J of $)J()}}if(new cc(f,i),!n)Ww(f,o,i);return f}class $F{trackers=new Map;Update;latestUpdateAtoms;mutableAtoms;constructor(i,o){let n=dp(o,{key:`*${i.key}`,default:null},["mutable","updates"]);this.latestUpdateAtoms=Ri(o,n),this.mutableAtoms=i,this.mutableAtoms.subject.subscribe(`store=${o.config.name}::tracker-atom-family`,(p)=>{let{type:c,token:x}=p;if(x.family){let T=Wo(x.family.subKey);switch(c){case"state_creation":this.trackers.set(T,new cc(x,o));break;case"state_disposal":{let m=this.trackers.get(T);if(m)m[Symbol.dispose](),this.trackers.delete(T)}break}}})}}function WT(i,o,n){let p={key:o.key,type:"mutable_atom_family"},c=i.families.get(o.key);if(c)i.logger.error("\u2757","mutable_atom_family",o.key,`Overwriting an existing ${hn(c)} "${c.key}" in store "${i.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let x=new $i,m=Object.assign((f)=>{let F=Ji(f),$={key:o.key,subKey:F},J=`${o.key}(${F})`,A=I(i),X={key:J,default:()=>o.default(f),toJson:o.toJson,fromJson:o.fromJson,mutable:!0};if(o.effects)X.effects=o.effects(f);let Y=HT(A,X,$);return x.next({type:"state_creation",token:Y}),Y},p,{subject:x,install:(f)=>WT(f,o),toJson:o.toJson,fromJson:o.fromJson,internalRoles:n});return i.families.set(o.key,m),i8(i,m,o),new $F(m,i),p}var JF=(i,o)=>{let n=I(o),p=`${i.key}:JSON`;return n.families.get(p)};var Jo=(i,o)=>{if(o.family){let p=I(i),x={key:`${o.family.key}:JSON`,type:"selector_family"},T=Ri(p,x),m=JSON.parse(o.family.subKey);return t(i,T,m)}return{type:"selector",key:`${o.key}:JSON`}};var $p=(i)=>{let n={type:"atom",key:`*${i.key}`};if(i.family)n.family={key:`*${i.family.key}`,subKey:i.family.subKey};return n};function Vw(i){return typeof i==="object"&&i!==null&&"do"in i&&"undo"in i&&"subscribe"in i}function GT(i,o,n){let p=n.valueMap.get(o.key),c=i.valueMap.get(o.key);if(p!==c)return c;if(p===void 0)return o.default();n.logger.info("\uD83D\uDCC3","atom",o.key,"copying");let x=o.toJson(p),T=o.fromJson(x);return i.valueMap.set(o.key,T),new cc(o,n),T}function Wn(i,o,n,p){let c=i.valueMap.get(o);if(c instanceof XT)c.use(n);if(n instanceof Promise){let x=new XT(n);return i.valueMap.set(o,x),x.then((T)=>{Wn(i,o,T,p),p.next({newValue:T,oldValue:x})}).catch((T)=>{i.logger.error("\uD83D\uDCA5","state",o,"rejected:",T)}),x}return i.valueMap.set(o,n),n}var Hw=(i,o)=>{let n=o.valueMap.get(i.key);if(i.type==="mutable_atom"&&zi(o)){let{parent:p}=o;n=GT(o,i,p)}return n},uw=(i,o)=>{let n=o.valueMap.get(i);if(n instanceof XT){let p=n,c=o.selectors.get(i)??o.readonlySelectors.get(i);if(c)p.use(c.get());return}if(o.operation.open)o.operation.prev.set(i,n);o.valueMap.delete(i),o.logger.info("\uD83D\uDDD1","state",i,"evicted")};var Sw=(i,o)=>{return I(i).atomsThatAreDefault.has(o)},sm=(i,o)=>{let n=I(i);n.atomsThatAreDefault=new Set(n.atomsThatAreDefault).add(o)},Ew=(i,o)=>{let n=I(i);n.atomsThatAreDefault=new Set(I(i).atomsThatAreDefault),n.atomsThatAreDefault.delete(o)};function rp(i,o,n){i.logger.info("\uD83D\uDD28","atom",o.key,`creating in store "${i.config.name}"`);let p=I(i),c=p.atoms.get(o.key);if(c&&c.type==="atom")return i.logger.error("\u274C","atom",o.key,"Tried to create atom, but it already exists in the store."),gn(c);let x=new $i,T={...o,type:"atom",install:(F)=>{return F.logger.info("\uD83D\uDEE0\uFE0F","atom",o.key,`installing in store "${F.config.name}"`),rp(F,o,n)},subject:x};if(n)T.family=n;let m=o.default;if(o.default instanceof Function)m=o.default();p.atoms.set(T.key,T),sm(i,o.key),Wn(p,o.key,m,x);let f=gn(T);if(o.effects){let F=0,$=[];for(let J of o.effects){let A=J({setSelf:(X)=>{_i(i,f,X)},onSet:(X)=>Eo(i,f,`effect[${F}]`,X)});if(A)$.push(A);++F}T.cleanup=()=>{for(let J of $)J()}}return f}function n8(i,o){if("mutable"in o){let c=HT(i,o,void 0);return i.on.atomCreation.next(c),c}let p=rp(i,o,void 0);return i.on.atomCreation.next(p),p}function xF(i,o){let n=I(i),{key:p,family:c}=o,x=Ri(n,o);if(!c)i.logger.error("\u274C","atom",p,"Standalone atoms cannot be disposed.");else{x.cleanup?.();let T=i.valueMap.get(x.key),m=Ri(i,{key:c.key,type:"atom_family"}),f={type:"state_disposal",subType:"atom",token:o,value:T};m.subject.next(f);let F=zi(n);if(n.atoms.delete(p),n.valueMap.delete(p),n.selectorAtoms.delete(p),n.atomsThatAreDefault.delete(p),i.timelineTopics.delete(p),o.type==="mutable_atom"){let $=$p(o);xF(i,$),i.trackers.delete(p)}if(i.logger.info("\uD83D\uDD25","atom",p,"deleted"),F&&n.transactionMeta.phase==="building"){let $=n.transactionMeta.update.updates.at(-1);if(!($?.type==="molecule_disposal"&&$.values.some(([X])=>X===x.family?.key)))n.transactionMeta.update.updates.push(f)}else i.on.atomDisposal.next(o)}}class vo extends Set{mode="record";subject=new $i;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(i,o=0){super(i);if(i instanceof vo)this.parent=i,this.cacheUpdateNumber=i.cacheUpdateNumber;if(o)this.cacheLimit=o,this.cache=new Array(o),this.subscribe("auto cache",(n)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=n})}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(i){let o=new vo(i.members,i.cacheLimit);return o.cache=i.cache,o.cacheIdx=i.cacheIdx,o.cacheUpdateNumber=i.cacheUpdateNumber,o}add(i){let o=super.add(i);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${Ji(i)}`);return o}clear(){let i=this.mode==="record"?[...this]:null;if(super.clear(),i)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify(i)}`)}delete(i){let o=super.delete(i);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${Ji(i)}`);return o}parent;child=null;transactionUpdates=null;transaction(i){this.mode="transaction",this.transactionUpdates=[],this.child=new vo(this);let o=this.child._subscribe("transaction",(n)=>{this.transactionUpdates?.push(n)});try{if(i(this.child)){for(let p of this.transactionUpdates)this.doStep(p);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(n){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",n),n}finally{o(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe(i,o){return this.subject.subscribe(i,o)}subscribe(i,o){return this.subject.subscribe(i,(n)=>{o(`${this.cacheUpdateNumber}=${n}`)})}emit(i){this.subject.next(i)}doStep(i){let o=i.indexOf(":"),n=i.substring(0,o),p=i.substring(o+1);switch(n){case"add":this.add(JSON.parse(p));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(p));break;case"tx":for(let c of p.split(";"))this.doStep(c)}}getUpdateNumber(i){let o=i.indexOf("=");return Number(i.substring(0,o))}do(i){let o=i.indexOf("="),n=Number(i.substring(0,o)),p=n-this.cacheUpdateNumber;if(p>0){if(p===1){this.mode="playback";let x=i.substring(o+1);return this.doStep(x),this.mode="record",this.cacheUpdateNumber=n,null}return this.cacheUpdateNumber+1}if(Math.abs(p)<this.cacheLimit){let x=this.cacheIdx+p;if(this.cache[x]===i)return null;this.mode="playback";let m=!1;while(!m){this.cacheIdx%=this.cacheLimit;let F=this.cache[this.cacheIdx];if(this.cacheIdx--,!F)return"OUT_OF_RANGE";this.undo(F),m=this.cacheIdx===x-1}let f=i.substring(o+1);return this.doStep(f),this.mode="record",this.cacheUpdateNumber=n,null}return"OUT_OF_RANGE"}undoStep(i){let o=i.indexOf(":"),n=i.substring(0,o),p=i.substring(o+1);switch(n){case"add":this.delete(JSON.parse(p));break;case"del":this.add(JSON.parse(p));break;case"clear":{let c=JSON.parse(p);for(let x of c)this.add(x);break}case"tx":{let c=p.split(";");for(let x=c.length-1;x>=0;x--)this.undoStep(c[x])}}}undo(i){let o=i.indexOf("=");if(Number(i.substring(0,o))===this.cacheUpdateNumber){this.mode="playback";let p=i.substring(o+1);return this.undoStep(p),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}}class UT{toolkit;options;defaultContent;molecules=new Map;relations;states;core;transact(i,o){let n=this.toolkit;this.toolkit=i,o(this),this.toolkit=n}store;realm;[Symbol.dispose](){}constructor(i,o,n=d.STORE){this.store=n,this.realm=new AF(n),this.options=i,this.defaultContent=o,this.store.miscResources.set(`join:${i.key}`,this),this.realm.allocate("root",i.key),this.toolkit={get:(...M)=>Mi(n,...M),set:(...M)=>{_i(n,...M)},find:(...M)=>t(n,...M),json:(M)=>Jo(n,M)};let p=i.between[0],c=i.between[1],x=WT(n,{key:`${i.key}/relatedKeys`,default:()=>new vo,mutable:!0,fromJson:(M)=>vo.fromJSON(M),toJson:(M)=>M.toJSON()},["join","relations"]);this.core={relatedKeysAtoms:x};let T=({get:M},u)=>M(x,u),m=({set:M},u,E)=>{if(!this.store.molecules.has(Ji(u)))this.realm.allocate(i.key,u);M(x,u,(S)=>S.add(E)),M(x,E,(S)=>S.add(u))},f=({set:M},u,E)=>{M(x,u,(S)=>{return S.delete(E),S}),M(x,E,(S)=>{return S.delete(u),S})},F=(M,u,E)=>{let{find:S,get:C,set:q}=M,Q=S(x,u),Ti=C(Q);for(let l of Ti){if(E.includes(l))continue;q(x,l,(Ei)=>{return Ei.delete(u),Ei})}q(Q,(l)=>{return l.transaction((mi)=>{mi.clear();for(let Ei of E){let To=T(M,Ei),lo=To.has(u);if(this.relations.cardinality==="1:n"){let ip=[];for(let O of To){if(O===u)continue;let k=T(M,O);if(k.delete(Ei),k.size===0)ip.push(O)}if(!lo&&To.size>0)To.clear();for(let O of ip){let k=[Ei,O].sort(),Yi=`"${k[0]}:${k[1]}"`;this.molecules.delete(Yi)}}if(!lo)To.add(u);mi.add(Ei)}return!0}),l})},$=(M,u,E)=>{let{set:S}=M;S(x,u,(C)=>{return C.transaction((q)=>{for(let Q of E)q.add(Q);return!0}),C});for(let C of E)S(x,C,(q)=>{return q.add(u),q});return!0},J=(M,u,E)=>{let S=T(M,u);return E?S.has(E):S.size>0},A={getRelatedKeys:(M)=>T(this.toolkit,M),addRelation:(M,u)=>{this.store.moleculeJoins.set(M,i.key),this.store.moleculeJoins.set(u,i.key),m(this.toolkit,M,u)},deleteRelation:(M,u)=>{f(this.toolkit,M,u)},replaceRelationsSafely:(M,u)=>{F(this.toolkit,M,u)},replaceRelationsUnsafely:(M,u)=>{$(this.toolkit,M,u)},has:(M,u)=>J(this.toolkit,M,u)},X,Y;if(o){Y=dp(n,{key:`${i.key}/content`,default:o},["join","content"]);let M=({get:S},C)=>S(Y,C),u=({set:S},C,q)=>{S(Y,C,q)};X=Object.assign(A,{getContent:(S)=>{return M(this.toolkit,S)},setContent:(S,C)=>{u(this.toolkit,S,C)},deleteContent:(S)=>{this.realm.deallocate(S)}})}else X=A;let R=new Ao(i,{externalStore:X,isAType:i.isAType,isBType:i.isBType,makeContentKey:(...M)=>{let[u,E]=M,S=M.sort(),C=`${S[0]}:${S[1]}`,q=n.molecules.get(Ji(u)),Q=n.molecules.get(Ji(E));if(!q)this.realm.allocate(i.key,u);if(!Q)this.realm.allocate(i.key,E);return this.realm.allocate(u,C,"all"),this.realm.claim(E,C),this.store.moleculeJoins.set(C,i.key),C}}),K=()=>Vp(n,{key:`${i.key}/singleRelatedKey`,get:(M)=>({get:u})=>{let E=u(x,M);for(let S of E)return S;return null}},["join","keys"]),U=()=>{return Vp(n,{key:`${i.key}/multipleRelatedKeys`,get:(M)=>({get:u})=>{let E=JF(x,n);return u(E,M).members}},["join","keys"])},z=()=>Vp(n,{key:`${i.key}/singleRelatedEntry`,get:(M)=>({get:u})=>{let E=u(x,M);for(let S of E){let C=R.isAType?.(M)?M:void 0,q=C===void 0?M:void 0;C??=S,q??=S;let Q=R.makeContentKey(C,q),Ti=u(Y,Q);return[S,Ti]}return null}},["join","entries"]),b=()=>Vp(n,{key:`${i.key}/multipleRelatedEntries`,get:(M)=>({get:u})=>{let E=JF(x,n);return u(E,M).members.map((C)=>{let q=R.isAType?.(M)?M:void 0,Q=q===void 0?M:void 0;q??=C,Q??=C;let Ti=R.makeContentKey(q,Q),l=u(Y,Ti);return[C,l]})}},["join","entries"]);switch(i.cardinality){case"1:1":{let M=K(),u=`${p}KeyOf${ui(c)}`,E=`${c}KeyOf${ui(p)}`,S={[u]:M,[E]:M},C;if(o){let q=z(),Q=`${p}EntryOf${ui(c)}`,Ti=`${c}EntryOf${ui(p)}`,l={[Q]:q,[Ti]:q};C=Object.assign(S,l)}else C=S;this.relations=R,this.states=C;break}case"1:n":{let M=K(),u=U(),E=`${p}KeyOf${ui(c)}`,S=`${c}KeysOf${ui(p)}`,C={[E]:M,[S]:u},q;if(o){let Q=z(),Ti=b(),l=`${p}EntryOf${ui(c)}`,mi=`${c}EntriesOf${ui(p)}`,Ei={[l]:Q,[mi]:Ti};q=Object.assign(C,Ei)}else q=C;this.relations=R,this.states=q;break}case"n:n":{let M=U(),u=`${p}KeysOf${ui(c)}`,E=`${c}KeysOf${ui(p)}`,S={[u]:M,[E]:M},C;if(o){let q=b(),Q=`${p}EntriesOf${ui(c)}`,Ti=`${c}EntriesOf${ui(p)}`,l={[Q]:q,[Ti]:q};C=Object.assign(S,l)}else C=S;this.relations=R,this.states=C}}}}function ec(i,o){let n=o.joins.get(i.key);if(n===void 0){let c=d.STORE.joins.get(i.key);if(c===void 0)throw new Error(`Join "${i.key}" not found in store "${o.config.name}"`);n=new UT(c.options,c.defaultContent,o),o.joins.set(i.key,n)}return n}function Ep(i,o,n){let p=ec(i,n),c=I(n);if(zi(c)){let{toolkit:x}=c.transactionMeta;p.transact(x,({relations:T})=>{o(T)})}else o(p.relations)}function ix(i,o,n){let p=ec(i,n),c;switch(i.cardinality){case"1:1":{let x=`${i.a}KeyOf${ui(i.b)}`,T=`${i.b}KeyOf${ui(i.a)}`;c={get[x](){let f=p.states[x];return t(n,f,o)},get[T](){let f=p.states[T];return t(n,f,o)}};let m=`${i.a}EntryOf${ui(i.b)}`;if(m in p.states){let f=`${i.b}EntryOf${ui(i.a)}`;Object.assign(c,{get[m](){let F=p.states[m];return t(n,F,o)},get[f](){let F=p.states[f];return t(n,F,o)}})}break}case"1:n":{let x=`${i.a}KeyOf${ui(i.b)}`,T=`${i.b}KeysOf${ui(i.a)}`;c={get[x](){let f=p.states[x];return t(n,f,o)},get[T](){let f=p.states[T];return t(n,f,o)}};let m=`${i.a}EntryOf${ui(i.b)}`;if(m in p.states){let f=`${i.b}EntriesOf${ui(i.a)}`;Object.assign(c,{get[m](){let F=p.states[m];return t(n,F,o)},get[f](){let F=p.states[f];return t(n,F,o)}})}break}case"n:n":{let x=`${i.a}KeysOf${ui(i.b)}`,T=`${i.b}KeysOf${ui(i.a)}`;c={get[x](){let f=p.states[x];return t(n,f,o)},get[T](){let f=p.states[T];return t(n,f,o)}};let m=`${i.a}EntriesOf${ui(i.b)}`;if(m in p.states){let f=`${i.b}EntriesOf${ui(i.a)}`;Object.assign(c,{get[m](){let F=p.states[m];return t(n,F,o)},get[f](){let F=p.states[f];return t(n,F,o)}})}}}return c}function p8(i,o){return ec(i,o).core.relatedKeysAtoms}function hw(i){return i.startsWith("\uD83D\uDD0D ")}function Op(i){return n8(d.STORE,i)}function xc(i){return Rw(d.STORE,i)}function tm(i,o,n=d.STORE){return n.joins.set(i.key,new UT(i,o,n)),{key:i.key,type:"join",a:i.between[0],b:i.between[1],cardinality:i.cardinality}}function c8(i){return p8(i,d.STORE)}var vF=(i)=>(o,n,p,c,...x)=>{console[i](`${o} ${n} "${p}" ${c}`,...x)},VU={error:vF("error"),info:vF("info"),warn:vF("warn")};class pc{logLevel;filter;logger;constructor(i,o,n=VU){this.logLevel=i,this.filter=o,this.logger=n}error=(...i)=>{if((this.filter?.(...i)??!0)&&this.logLevel!==null)this.logger.error(...i)};info=(...i)=>{if((this.filter?.(...i)??!0)&&this.logLevel==="info")this.logger.info(...i)};warn=(...i)=>{if((this.filter?.(...i)??!0)&&this.logLevel!=="error"&&this.logLevel!==null)this.logger.warn(...i)}}var ds=Symbol("claim");class x8{store;constructor(i=d.STORE){this.store=i,Lw("root",i)}allocate(i,o,n){return ic(this.store,i,o,n)}fuse(i,o,n){return Cw(this.store,i,o,n)}deallocate(i){oc(this.store,i)}claim(i,o,n){return rc(this.store,i,o,n)}}class AF{store;realm;constructor(i=d.STORE){this.store=i,this.realm=new x8(i)}allocate(i,o,n){ic(this.store,i,o,n)}deallocate(i){oc(this.store,i)}claim(i,o,n){rc(this.store,i,o,n)}}function dm(i){return Yw(d.STORE,i)}function Tc(i){return cF(d.STORE,i)}class T8 extends Map{set(i,o){if(this.has(i))return console.warn("Tried to set a key that already exists in an InvariantMap",{key:i,value:o}),this;return super.set(i,o)}clear(){throw new Error("Cannot clear an InvariantMap")}}class rm{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(i){this.key=i}static existing=new T8;static create(i,o){let n=new rm(i),{type:p,globals:c,actions:x,perspectives:T}=o(n),m={type:p,key:i,globals:c,actions:x,perspectives:T};return rm.existing.set(i,m),m}add(...i){switch(i[0].type){case"atom":case"mutable_atom":this.globals.push(...i);break;case"transaction":this.actions.push(...i);break;case"atom_family":case"mutable_atom_family":{let[n,p]=i;this.perspectives.push({type:"realtime_perspective",resourceAtoms:n,viewAtoms:p})}break}return this}}function m8(i){let{key:o,config:n}=i,p=rm.create(o,n),{actions:c}=p;for(let x of c)aw(d.STORE,o,x.key);return bw(d.STORE,o,-1),p}var mt=Op({key:"usersInRoomIndex",mutable:!0,default:()=>new vo,toJson:(i)=>i.toJSON(),fromJson:(i)=>vo.fromJSON(i)}),wF=Op({key:"roomIndex",default:()=>new vo,mutable:!0,toJson:(i)=>i.toJSON(),fromJson:(i)=>vo.fromJSON(i)}),SU={enteredAtEpoch:0},ZT=tm({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:(i)=>typeof i==="string",isBType:(i)=>typeof i==="string"},SU),ft=dm({key:"usersInMyRoomView",get:(i)=>({find:o})=>{let n=c8(ZT);return[o(n,i)]}});import{spawn as EU}from"child_process";class ox{listeners;globalListeners;handleEvent(i,...o){for(let p of this.globalListeners)p(i,...o);let n=this.listeners.get(i);if(n)for(let p of n)p(...o)}id="no_id_retrieved";emit;constructor(i){this.emit=i,this.listeners=new Map,this.globalListeners=new Set}on(i,o){let n=this.listeners.get(i);if(n)n.add(o);else this.listeners.set(i,new Set([o]));return this}onAny(i){return this.globalListeners.add(i),this}off(i,o){let n=this.listeners.get(i);if(n)if(o)n.delete(o);else this.listeners.delete(i);return this}offAny(i){return this.globalListeners.delete(i),this}}class MT extends ox{incompleteData="";unprocessedEvents=[];incompleteLog="";unprocessedLogs=[];id="#####";process;key;logger;handleLog(i){if(Array.isArray(i)){let[o,...n]=i;switch(o){case"i":this.logger.info(...n);break;case"w":this.logger.warn(...n);break;case"e":this.logger.error(...n);break;default:return}}}constructor(i,o,n){super((p,...c)=>{let x=JSON.stringify([p,...c])+"\x03",T=(m)=>{if(m.code==="EPIPE")console.error("EPIPE error during write",this.process.stdin);this.process.stdin.removeListener("error",T)};return this.process.stdin.once("error",T),this.process.stdin.write(x),this});if(this.process=i,this.key=o,this.logger=n??{info:(...p)=>{console.info(this.id,this.key,...p)},warn:(...p)=>{console.warn(this.id,this.key,...p)},error:(...p)=>{console.error(this.id,this.key,...p)}},this.process.stdout.on("data",(p)=>{let c=p.toString();if(c==="ALIVE")return;this.unprocessedEvents.push(...c.split("\x03"));let x=this.unprocessedEvents.shift();this.incompleteData+=x??"";try{if(this.incompleteData.startsWith("error"))console.log("\u2757",this.incompleteData);let T=Wo(this.incompleteData);this.handleEvent(...T);while(this.unprocessedEvents.length>0){let m=this.unprocessedEvents.shift();if(m){if(this.unprocessedEvents.length===0)this.incompleteData=m;T=Wo(m),this.handleEvent(...T)}}this.incompleteData=""}catch(T){console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.warn(this.incompleteData),console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.error(T)}}),this.process.stderr.on("data",(p)=>{let c=p.toString();this.unprocessedLogs.push(...c.split("\x03"));let x=this.unprocessedLogs.shift();this.incompleteLog+=x??"";try{let T=Wo(this.incompleteLog);this.handleLog(T);while(this.unprocessedLogs.length>0)if(this.incompleteLog=this.unprocessedLogs.shift()??"",this.incompleteLog)T=Wo(this.incompleteLog),this.handleLog(T)}catch(T){console.error("\u274C\u274C\u274C"),console.error(this.incompleteLog),console.error(T),console.error("\u274C\u274C\u274C\uFE0F")}}),i.pid)this.id=i.pid.toString()}}class f8 extends ox{in;out;id="no_id_retrieved";disposalFunctions=[];constructor(i){super((...o)=>{return this.out.next(o),this});this.id=i,this.in=new $i,this.out=new $i,this.in.subscribe("socket",(o)=>{this.handleEvent(...o)})}dispose(){for(let i of this.disposalFunctions)i()}}class XF extends ox{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...i){this.process.stderr.write(Ji(i.map((o)=>o instanceof vo?`{ ${o.toJSON().members.join(" | ")} }`:o))+"\x03")}logger={info:(...i)=>{this.log("i",...i)},warn:(...i)=>{this.log("w",...i)},error:(...i)=>{this.log("e",...i)}};constructor(){super((i,...o)=>{let n=JSON.stringify([i,...o]);return this.process.stdout.write(n+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",(i)=>{let o=i.toString();this.unprocessedEvents.push(...o.split("\x03"));let n=this.unprocessedEvents.shift();this.incompleteData+=n??"";try{let p=Wo(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",p),this.handleEvent(...p);while(this.unprocessedEvents.length>0){let c=this.unprocessedEvents.shift();if(c){if(this.unprocessedEvents.length===0)this.incompleteData=c;let x=Wo(c);this.handleEvent(...x)}}this.incompleteData=""}catch(p){if(p instanceof Error)this.logger.error("\u2757",p.message,p.cause,p.stack)}}),this.on("exit",()=>{this.logger.info("\uD83D\uDD25",this.id,'received "exit"'),process.exit(0)}),process.on("exit",(i)=>{this.logger.info("\uD83D\uDD25",this.id,`exited with code ${i}`)}),process.on("end",()=>{this.logger.info("\uD83D\uDD25",this.id,"ended"),process.exit(0)}),process.on("SIGTERM",()=>{this.logger.error("\uD83D\uDD25",this.id,"terminated"),process.exit(0)}),process.on("SIGINT",()=>{this.logger.error("\uD83D\uDD25",this.id,"interrupted"),process.exit(0)}),process.pid)this.id=process.pid?.toString();this.on("user-joins",(i)=>{this.logger.info("\uD83D\uDC64","user",i,"joined");let o=new f8(`user:${i}`);this.relays.set(i,o),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let n of this.relayServices){let p=n(o);if(p)o.disposalFunctions.push(p)}this.on(`user:${i}`,(...n)=>{o.in.next(n)}),o.out.subscribe("socket",(n)=>{this.emit(...n)})}),this.on("user-leaves",(i)=>{let o=this.relays.get(i);if(this.off(`relay:${i}`),o)o.dispose(),this.relays.delete(i)}),process.stdout.write("ALIVE")}relay(i){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push(i)}}var WF=xc({key:"roomArguments",default:["echo",["Hello World!"]]}),F8=dm({key:"room",get:(i)=>async({get:o,find:n})=>{let p=n(WF,i),c=o(p),[x,T]=c,m=await new Promise((f)=>{let F=EU(x,T,{env:process.env}),$=(J)=>{if(J.toString()==="ALIVE")F.stdout.off("data",$),f(F)};F.stdout.on("data",$)});return new MT(m,i)}});var yt=Tc({key:"createRoom",do:({get:i,set:o,find:n},p,c,x)=>{let T=x?[c,x]:[c],m=n(WF,p);o(m,T),o(wF,($)=>$.add(p));let f=n(F8,p);return i(f)}}),Dt=Tc({key:"joinRoom",do:(i,o,n,p)=>{let c={enteredAtEpoch:p};return Ep(ZT,(x)=>{x.set({room:o,user:n},c)},i.env().store),c}}),It=Tc({key:"leaveRoom",do:(i,o,n)=>{Ep(ZT,(p)=>{p.delete({room:o,user:n})},i.env().store)}}),Bt=Tc({key:"destroyRoom",do:(i,o)=>{Ep(ZT,(n)=>{n.delete({room:o})},i.env().store),i.set(wF,(n)=>(n.delete(o),n))}});function RF(i,o){return o.map((n)=>{switch(n.type){case"transaction_update":{let p=RF(i,n.updates);return{...n,updates:p}}case"atom_update":case"selector_update":case"molecule_creation":case"molecule_disposal":case"molecule_transfer":case"state_creation":case"state_disposal":return n}}).filter((n)=>{switch(n.type){case"atom_update":case"selector_update":return i.includes(n.key);case"state_creation":case"state_disposal":return i.includes(n.token.key);case"molecule_creation":case"transaction_update":case"molecule_disposal":case"molecule_transfer":return!0}})}var jt=xc({key:"redactor",default:{occlude:(i)=>i}}),nx=xc({key:"unacknowledgedUpdates",default:()=>[]});var em=xc({key:"sockets",default:null}),YF=Op({key:"socketsIndex",mutable:!0,default:()=>new vo,toJson:(i)=>i.toJSON(),fromJson:(i)=>vo.fromJSON(i)}),GF=Op({key:"usersIndex",mutable:!0,default:()=>new vo,toJson:(i)=>i.toJSON(),fromJson:(i)=>vo.fromJSON(i)}),mc=tm({key:"usersOfSockets",between:["user","socket"],cardinality:"1:1",isAType:(i)=>i.startsWith("user::"),isBType:(i)=>i.startsWith("socket::")});function $8(i,o,n,p){let c=o.key;return function x(){let T=[];for(let f of o.globals){let F=f.type==="mutable_atom"?Jo(i,f):f,$=Mi(i,F);T.push(F,$)}for(let f of o.perspectives){let{viewAtoms:F,resourceAtoms:$}=f,J=t(i,F,n),A=Mi(i,J);i.logger.info("\uD83D\uDC41","atom",$.key,`${n} can see`,{viewAtoms:F,resourceAtoms:$,userView:A});for(let X of A){let Y=X.type==="mutable_atom"?Jo(i,X):X,R=Mi(i,Y);T.push(Y,R)}}let m=Ho(i)?i.transactionMeta.epoch.get(c)??null:null;p?.emit(`continuity-init:${c}`,m,T)}}function J8(i,o,n){let p=o.key;return function c(x){i.logger.info("\uD83D\uDECE\uFE0F","continuity",p,"received",x);let{key:T,id:m}=x,f=`tx-run:${T}:${m}`,F=`${f}:start`,$=`${f}:end`;performance.mark(F);try{tc(i,{type:"transaction",key:T},m)(...x.params)}catch(A){if(A instanceof Error)i.logger.error("\u274C","continuity",p,`failed to run transaction ${T} from ${n} with update ${m}`,A.message)}performance.mark($);let J=performance.measure(f,F,$);i?.logger.info("\uD83D\uDE80","transaction",T,m,n,J.duration)}}function A8(i,o,n,p){let c=o.key;return function x(T){if(i.logger.info("\uD83D\uDC4D","continuity",c,`${n} acknowledged epoch ${T}`),p[0]?.epoch===T)_i(i,nx,n,(f)=>{return f.shift(),i.logger.info("\uD83D\uDC4D","continuity",c,`${n} unacknowledged update queue now has`,f.length,"items"),f})}}function v8(i,o,n,p){let c=o.key,x=[];for(let T of o.actions){let m=fF(i,T,`sync-continuity:${c}:${n}`,(f)=>{try{let F=o.globals.map((A)=>{if(A.type==="atom")return A.key;return $p(A).key}).concat(o.perspectives.flatMap((A)=>{let{viewAtoms:X}=A,Y=t(i,X,n);return Mi(i,Y).map((K)=>{return K.type==="mutable_atom"?"*"+K.key:K.key})})),$=RF(F,f.updates),J={...f,updates:$};_i(i,nx,n,(A)=>{if(J)A.push(J),A.sort((X,Y)=>X.epoch-Y.epoch),i.logger.info("\uD83D\uDC4D","continuity",c,`${n} unacknowledged update queue now has`,A.length,"items");return A}),p?.emit(`tx-new:${c}`,J)}catch(F){if(F instanceof Error)i.logger.error("\u274C","continuity",c,`${n} failed to send update from transaction ${T.key} to ${n}`,F.message)}});x.push(m)}return x}function w8(i,o,n,p){let c=o.key,x=[];for(let T of o.perspectives){let{viewAtoms:m}=T,f=t(i,m,n),F=Eo(i,f,`sync-continuity:${c}:${n}:perspective:${T.resourceAtoms.key}`,({oldValue:$,newValue:J})=>{let A=$.map((K)=>K.key),X=J.map((K)=>K.key),Y=$.filter((K)=>!X.includes(K.key)),R=J.filter((K)=>!A.includes(K.key)).flatMap((K)=>{let U=K.type==="mutable_atom"?Jo(i,K):K,z=Mi(i,U);return[U,z]});if(i.logger.info("\uD83D\uDC41","atom",T.resourceAtoms.key,`${n} has a new perspective`,{oldKeys:A,newKeys:X,revealed:R,concealed:Y}),R.length>0)p?.emit(`reveal:${c}`,R);if(Y.length>0)p?.emit(`conceal:${c}`,Y)});x.push(F)}return x}function X8({socket:i,store:o=d.STORE}){return function n(p){let c=i,x=p.key,T=ix(mc,`socket::${c.id}`,o).userKeyOfSocket,m=Mi(o,T);if(!m)return o.logger.error("\u274C","continuity",x,`Tried to create a synchronizer for a socket (${c.id}) that is not connected to a user.`),()=>{};let f=ix(mc,m,o).socketKeyOfUser,F=Eo(o,f,`sync-continuity:${x}:${m}`,({newValue:U})=>{if(o.logger.info("\uD83D\uDC4B","continuity",x,`seeing ${m} on new socket ${U}`),U===null){o.logger.warn("\u274C","continuity",x,`User (${m}) is not connected to a socket, waiting for them to reappear.`);return}let z=t(o,em,U);c=Mi(o,z);for(let M of $)c?.emit(`tx-new:${x}`,M)}),$=Mi(o,nx,m),J=[],A=w8(o,p,m,c),X=v8(o,p,m,c);J.push(...A,...X);let Y=$8(o,p,m,i);c.off(`get:${x}`,Y),c.on(`get:${x}`,Y);let R=J8(o,p,m);c.off(`tx-run:${x}`,R),c.on(`tx-run:${x}`,R);let K=A8(o,p,m,$);return c?.on(`ack:${x}`,K),()=>{for(let U of J)U();c?.off(`ack:${x}`,K),c?.off(`get:${x}`,Y),c?.off(`tx-run:${x}`,R)}}}var DY=C1(n$(),1);var w=Symbol.for("drizzle:entityKind"),rd=Symbol.for("drizzle:hasOwnEntityKind");function Z(i,o){if(!i||typeof i!=="object")return!1;if(i instanceof o)return!0;if(!Object.prototype.hasOwnProperty.call(o,w))throw new Error(`Class "${o.name??"<unknown>"}" 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 n=Object.getPrototypeOf(i).constructor;if(n)while(n){if(w in n&&n[w]===o[w])return!0;n=Object.getPrototypeOf(n)}return!1}class Li{constructor(i,o){this.table=i,this.config=o,this.name=o.name,this.keyAsName=o.keyAsName,this.notNull=o.notNull,this.default=o.default,this.defaultFn=o.defaultFn,this.onUpdateFn=o.onUpdateFn,this.hasDefault=o.hasDefault,this.primary=o.primaryKey,this.isUnique=o.isUnique,this.uniqueName=o.uniqueName,this.uniqueType=o.uniqueType,this.dataType=o.dataType,this.columnType=o.columnType,this.generated=o.generated,this.generatedIdentity=o.generatedIdentity}static[w]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(i){return i}mapToDriverValue(i){return i}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class p${static[w]="ColumnBuilder";config;constructor(i,o,n){this.config={name:i,keyAsName:i==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:o,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(i){return this.config.default=i,this.config.hasDefault=!0,this}$defaultFn(i){return this.config.defaultFn=i,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(i){return this.config.onUpdateFn=i,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(i){if(this.config.name!=="")return;this.config.name=i}}var Dn=Symbol.for("drizzle:Name");class c${static[w]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(i,o){if(this.reference=()=>{let{name:n,columns:p,foreignColumns:c}=i();return{name:n,columns:p,foreignTable:c[0].table,foreignColumns:c}},o)this._onUpdate=o.onUpdate,this._onDelete=o.onDelete}onUpdate(i){return this._onUpdate=i===void 0?"no action":i,this}onDelete(i){return this._onDelete=i===void 0?"no action":i,this}build(i){return new A3(i,this)}}class A3{constructor(i,o){this.table=i,this.reference=o.reference,this.onUpdate=o._onUpdate,this.onDelete=o._onDelete}static[w]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:i,columns:o,foreignColumns:n}=this.reference(),p=o.map((T)=>T.name),c=n.map((T)=>T.name),x=[this.table[Dn],...p,n[0].table[Dn],...c];return i??`${x.join("_")}_fk`}}function R0(i,...o){return i(...o)}function v3(i,o){return`${i[Dn]}_${o.join("_")}_unique`}function w3(i,o,n){for(let p=o;p<i.length;p++){let c=i[p];if(c==="\\"){p++;continue}if(c==='"')return[i.slice(o,p).replace(/\\/g,""),p+1];if(n)continue;if(c===","||c==="}")return[i.slice(o,p).replace(/\\/g,""),p]}return[i.slice(o).replace(/\\/g,""),i.length]}function X3(i,o=0){let n=[],p=o,c=!1;while(p<i.length){let x=i[p];if(x===","){if(c||p===o)n.push("");c=!0,p++;continue}if(c=!1,x==="\\"){p+=2;continue}if(x==='"'){let[f,F]=w3(i,p+1,!0);n.push(f),p=F;continue}if(x==="}")return[n,p+1];if(x==="{"){let[f,F]=X3(i,p+1);n.push(f),p=F;continue}let[T,m]=w3(i,p,!1);n.push(T),p=m}return[n,p]}function W3(i){let[o]=X3(i,1);return o}function x$(i){return`{${i.map((o)=>{if(Array.isArray(o))return x$(o);if(typeof o==="string")return`"${o.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${o}`}).join(",")}}`}class j extends p${foreignKeyConfigs=[];static[w]="PgColumnBuilder";array(i){return new Y3(this.config.name,this,i)}references(i,o={}){return this.foreignKeyConfigs.push({ref:i,actions:o}),this}unique(i,o){return this.config.isUnique=!0,this.config.uniqueName=i,this.config.uniqueType=o?.nulls,this}generatedAlwaysAs(i){return this.config.generated={as:i,type:"always",mode:"stored"},this}buildForeignKeys(i,o){return this.foreignKeyConfigs.map(({ref:n,actions:p})=>{return R0((c,x)=>{let T=new c$(()=>{let m=c();return{columns:[i],foreignColumns:[m]}});if(x.onUpdate)T.onUpdate(x.onUpdate);if(x.onDelete)T.onDelete(x.onDelete);return T.build(o)},n,p)})}buildExtraConfigColumn(i){return new R3(i,this.config)}}class _ extends Li{constructor(i,o){if(!o.uniqueName)o.uniqueName=v3(i,[o.name]);super(i,o);this.table=i}static[w]="PgColumn"}class R3 extends _{static[w]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(i){return this.indexConfig.opClass=i,this}}class DT{static[w]="IndexedColumn";constructor(i,o,n,p){this.name=i,this.keyAsName=o,this.type=n,this.indexConfig=p}name;keyAsName;type;indexConfig}class Y3 extends j{static[w]="PgArrayBuilder";constructor(i,o,n){super(i,"array","PgArray");this.config.baseBuilder=o,this.config.size=n}build(i){let o=this.config.baseBuilder.build(i);return new T$(i,this.config,o)}}class T$ extends _{constructor(i,o,n,p){super(i,o);this.baseColumn=n,this.range=p,this.size=o.size}size;static[w]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue(i){if(typeof i==="string")i=W3(i);return i.map((o)=>this.baseColumn.mapFromDriverValue(o))}mapToDriverValue(i,o=!1){let n=i.map((p)=>p===null?null:Z(this.baseColumn,T$)?this.baseColumn.mapToDriverValue(p,!0):this.baseColumn.mapToDriverValue(p));if(o)return n;return x$(n)}}var m$=Symbol.for("drizzle:isPgEnum");function G3(i){return!!i&&typeof i==="function"&&m$ in i&&i[m$]===!0}class K3 extends j{static[w]="PgEnumColumnBuilder";constructor(i,o){super(i,"string","PgEnumColumn");this.config.enum=o}build(i){return new H3(i,this.config)}}class H3 extends _{static[w]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(i,o){super(i,o);this.enum=o.enum}getSQLType(){return this.enum.enumName}}function Y0(i,o){return sM(i,o,void 0)}function sM(i,o,n){let p=Object.assign((c)=>new K3(c??"",p),{enumName:i,enumValues:o,schema:n,[m$]:!0});return p}class wo{static[w]="Subquery";constructor(i,o,n,p=!1){this._={brand:"Subquery",sql:i,selectedFields:o,alias:n,isWith:p}}}class IT extends wo{static[w]="WithSubquery"}var U3="0.41.0";var f$,F$,Ci={startActiveSpan(i,o){if(!f$)return o();if(!F$)F$=f$.trace.getTracer("drizzle-orm",U3);return R0((n,p)=>p.startActiveSpan(i,(c)=>{try{return o(c)}catch(x){throw c.setStatus({code:n.SpanStatusCode.ERROR,message:x instanceof Error?x.message:"Unknown error"}),x}finally{c.end()}}),f$,F$)}};var Ni=Symbol.for("drizzle:ViewBaseConfig");var G0=Symbol.for("drizzle:Schema"),K0=Symbol.for("drizzle:Columns"),Z3=Symbol.for("drizzle:ExtraConfigColumns"),$$=Symbol.for("drizzle:OriginalName"),J$=Symbol.for("drizzle:BaseName"),BT=Symbol.for("drizzle:IsAlias"),M3=Symbol.for("drizzle:ExtraConfigBuilder"),tM=Symbol.for("drizzle:IsDrizzleTable");class B{static[w]="Table";static Symbol={Name:Dn,Schema:G0,OriginalName:$$,Columns:K0,ExtraConfigColumns:Z3,BaseName:J$,IsAlias:BT,ExtraConfigBuilder:M3};[Dn];[$$];[G0];[K0];[Z3];[J$];[BT]=!1;[tM]=!0;[M3]=void 0;constructor(i,o,n){this[Dn]=this[$$]=i,this[G0]=o,this[J$]=n}}function Ro(i){return i[Dn]}function vc(i){return`${i[G0]??"public"}.${i[Dn]}`}function A$(i){return i!==null&&i!==void 0&&typeof i.getSQL==="function"}function dM(i){let o={sql:"",params:[]};for(let n of i)if(o.sql+=n.sql,o.params.push(...n.params),n.typings?.length){if(!o.typings)o.typings=[];o.typings.push(...n.typings)}return o}class Xo{static[w]="StringChunk";value;constructor(i){this.value=Array.isArray(i)?i:[i]}getSQL(){return new N([this])}}class N{constructor(i){this.queryChunks=i}static[w]="SQL";decoder=u3;shouldInlineParams=!1;append(i){return this.queryChunks.push(...i.queryChunks),this}toQuery(i){return Ci.startActiveSpan("drizzle.buildSQL",(o)=>{let n=this.buildQueryFromSourceParams(this.queryChunks,i);return o?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(i,o){let n=Object.assign({},o,{inlineParams:o.inlineParams||this.shouldInlineParams,paramStartIndex:o.paramStartIndex||{value:0}}),{casing:p,escapeName:c,escapeParam:x,prepareTyping:T,inlineParams:m,paramStartIndex:f}=n;return dM(i.map((F)=>{if(Z(F,Xo))return{sql:F.value.join(""),params:[]};if(Z(F,H0))return{sql:c(F.value),params:[]};if(F===void 0)return{sql:"",params:[]};if(Array.isArray(F)){let $=[new Xo("(")];for(let[J,A]of F.entries())if($.push(A),J<F.length-1)$.push(new Xo(", "));return $.push(new Xo(")")),this.buildQueryFromSourceParams($,n)}if(Z(F,N))return this.buildQueryFromSourceParams(F.queryChunks,{...n,inlineParams:m||F.shouldInlineParams});if(Z(F,B)){let $=F[B.Symbol.Schema],J=F[B.Symbol.Name];return{sql:$===void 0||F[BT]?c(J):c($)+"."+c(J),params:[]}}if(Z(F,Li)){let $=p.getColumnCasing(F);if(o.invokeSource==="indexes")return{sql:c($),params:[]};let J=F.table[B.Symbol.Schema];return{sql:F.table[BT]||J===void 0?c(F.table[B.Symbol.Name])+"."+c($):c(J)+"."+c(F.table[B.Symbol.Name])+"."+c($),params:[]}}if(Z(F,ro)){let $=F[Ni].schema,J=F[Ni].name;return{sql:$===void 0||F[Ni].isAlias?c(J):c($)+"."+c(J),params:[]}}if(Z(F,Tn)){if(Z(F.value,Ip))return{sql:x(f.value++,F),params:[F],typings:["none"]};let $=F.value===null?null:F.encoder.mapToDriverValue(F.value);if(Z($,N))return this.buildQueryFromSourceParams([$],n);if(m)return{sql:this.mapInlineParam($,n),params:[]};let J=["none"];if(T)J=[T(F.encoder)];return{sql:x(f.value++,$),params:[$],typings:J}}if(Z(F,Ip))return{sql:x(f.value++,F),params:[F],typings:["none"]};if(Z(F,N.Aliased)&&F.fieldAlias!==void 0)return{sql:c(F.fieldAlias),params:[]};if(Z(F,wo)){if(F._.isWith)return{sql:c(F._.alias),params:[]};return this.buildQueryFromSourceParams([new Xo("("),F._.sql,new Xo(") "),new H0(F._.alias)],n)}if(G3(F)){if(F.schema)return{sql:c(F.schema)+"."+c(F.enumName),params:[]};return{sql:c(F.enumName),params:[]}}if(A$(F)){if(F.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([F.getSQL()],n);return this.buildQueryFromSourceParams([new Xo("("),F.getSQL(),new Xo(")")],n)}if(m)return{sql:this.mapInlineParam(F,n),params:[]};return{sql:x(f.value++,F),params:[F],typings:["none"]}}))}mapInlineParam(i,{escapeString:o}){if(i===null)return"null";if(typeof i==="number"||typeof i==="boolean")return i.toString();if(typeof i==="string")return o(i);if(typeof i==="object"){let n=i.toString();if(n==="[object Object]")return o(JSON.stringify(i));return o(n)}throw new Error("Unexpected param value: "+i)}getSQL(){return this}as(i){if(i===void 0)return this;return new N.Aliased(this,i)}mapWith(i){return this.decoder=typeof i==="function"?{mapFromDriverValue:i}:i,this}inlineParams(){return this.shouldInlineParams=!0,this}if(i){return i?this:void 0}}class H0{constructor(i){this.value=i}static[w]="Name";brand;getSQL(){return new N([this])}}function z3(i){return typeof i==="object"&&i!==null&&"mapToDriverValue"in i&&typeof i.mapToDriverValue==="function"}var u3={mapFromDriverValue:(i)=>i},Q3={mapToDriverValue:(i)=>i},br={...u3,...Q3};class Tn{constructor(i,o=Q3){this.value=i,this.encoder=o}static[w]="Param";brand;getSQL(){return new N([this])}}function W(i,...o){let n=[];if(o.length>0||i.length>0&&i[0]!=="")n.push(new Xo(i[0]));for(let[p,c]of o.entries())n.push(c,new Xo(i[p+1]));return new N(n)}((i)=>{function o(){return new N([])}i.empty=o;function n(f){return new N(f)}i.fromList=n;function p(f){return new N([new Xo(f)])}i.raw=p;function c(f,F){let $=[];for(let[J,A]of f.entries()){if(J>0&&F!==void 0)$.push(F);$.push(A)}return new N($)}i.join=c;function x(f){return new H0(f)}i.identifier=x;function T(f){return new Ip(f)}i.placeholder=T;function m(f,F){return new Tn(f,F)}i.param=m})(W||(W={}));((i)=>{class o{constructor(n,p){this.sql=n,this.fieldAlias=p}static[w]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new o(this.sql,this.fieldAlias)}}i.Aliased=o})(N||(N={}));class Ip{constructor(i){this.name=i}static[w]="Placeholder";getSQL(){return new N([this])}}function v$(i,o){return i.map((n)=>{if(Z(n,Ip)){if(!(n.name in o))throw new Error(`No value for placeholder "${n.name}" was provided`);return o[n.name]}if(Z(n,Tn)&&Z(n.value,Ip)){if(!(n.value.name in o))throw new Error(`No value for placeholder "${n.value.name}" was provided`);return n.encoder.mapToDriverValue(o[n.value.name])}return n})}var rM=Symbol.for("drizzle:IsDrizzleView");class ro{static[w]="View";[Ni];[rM]=!0;constructor({name:i,schema:o,selectedFields:n,query:p}){this[Ni]={name:i,originalName:i,schema:o,selectedFields:n,query:p,isExisting:!p,isAlias:!1}}getSQL(){return new N([this])}}Li.prototype.getSQL=function(){return new N([this])};B.prototype.getSQL=function(){return new N([this])};wo.prototype.getSQL=function(){return new N([this])};class Xx{constructor(i){this.table=i}static[w]="ColumnAliasProxyHandler";get(i,o){if(o==="table")return this.table;return i[o]}}class NT{constructor(i,o){this.alias=i,this.replaceOriginalName=o}static[w]="TableAliasProxyHandler";get(i,o){if(o===B.Symbol.IsAlias)return!0;if(o===B.Symbol.Name)return this.alias;if(this.replaceOriginalName&&o===B.Symbol.OriginalName)return this.alias;if(o===Ni)return{...i[Ni],name:this.alias,isAlias:!0};if(o===B.Symbol.Columns){let p=i[B.Symbol.Columns];if(!p)return p;let c={};return Object.keys(p).map((x)=>{c[x]=new Proxy(p[x],new Xx(new Proxy(i,this)))}),c}let n=i[o];if(Z(n,Li))return new Proxy(n,new Xx(new Proxy(i,this)));return n}}function U0(i,o){return new Proxy(i,new NT(o,!1))}function tn(i,o){return new Proxy(i,new Xx(new Proxy(i.table,new NT(o,!1))))}function w$(i,o){return new N.Aliased(bT(i.sql,o),i.fieldAlias)}function bT(i,o){return W.join(i.queryChunks.map((n)=>{if(Z(n,Li))return tn(n,o);if(Z(n,N))return bT(n,o);if(Z(n,N.Aliased))return w$(n,o);return n}))}class Z0 extends Error{static[w]="DrizzleError";constructor({message:i,cause:o}){super(i);this.name="DrizzleError",this.cause=o}}class X$ extends Z0{static[w]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}function eo(i,o){if(z3(o)&&!A$(i)&&!Z(i,Tn)&&!Z(i,Ip)&&!Z(i,Li)&&!Z(i,B)&&!Z(i,ro))return new Tn(i,o);return i}var dn=(i,o)=>{return W`${i} = ${eo(o,i)}`},V3=(i,o)=>{return W`${i} <> ${eo(o,i)}`};function wc(...i){let o=i.filter((n)=>n!==void 0);if(o.length===0)return;if(o.length===1)return new N(o);return new N([new Xo("("),W.join(o,new Xo(" and ")),new Xo(")")])}function S3(...i){let o=i.filter((n)=>n!==void 0);if(o.length===0)return;if(o.length===1)return new N(o);return new N([new Xo("("),W.join(o,new Xo(" or ")),new Xo(")")])}function E3(i){return W`not ${i}`}var M0=(i,o)=>{return W`${i} > ${eo(o,i)}`},O3=(i,o)=>{return W`${i} >= ${eo(o,i)}`},_3=(i,o)=>{return W`${i} < ${eo(o,i)}`},L3=(i,o)=>{return W`${i} <= ${eo(o,i)}`};function C3(i,o){if(Array.isArray(o)){if(o.length===0)return W`false`;return W`${i} in ${o.map((n)=>eo(n,i))}`}return W`${i} in ${eo(o,i)}`}function y3(i,o){if(Array.isArray(o)){if(o.length===0)return W`true`;return W`${i} not in ${o.map((n)=>eo(n,i))}`}return W`${i} not in ${eo(o,i)}`}function D3(i){return W`${i} is null`}function I3(i){return W`${i} is not null`}function B3(i){return W`exists ${i}`}function N3(i){return W`not exists ${i}`}function b3(i,o,n){return W`${i} between ${eo(o,i)} and ${eo(n,i)}`}function j3(i,o,n){return W`${i} not between ${eo(o,i)} and ${eo(n,i)}`}function P3(i,o){return W`${i} like ${o}`}function a3(i,o){return W`${i} not like ${o}`}function l3(i,o){return W`${i} ilike ${o}`}function q3(i,o){return W`${i} not ilike ${o}`}function k3(i){return W`${i} asc`}function h3(i){return W`${i} desc`}class g3{static[w]="ConsoleLogWriter";write(i){console.log(i)}}class W${static[w]="DefaultLogger";writer;constructor(i){this.writer=i?.writer??new g3}logQuery(i,o){let n=o.map((c)=>{try{return JSON.stringify(c)}catch{return String(c)}}),p=n.length?` -- params: [${n.join(", ")}]`:"";this.writer.write(`Query: ${i}${p}`)}}class R${static[w]="NoopLogger";logQuery(){}}class jo{static[w]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(i){return this.then(void 0,i)}finally(i){return this.then((o)=>{return i?.(),o},(o)=>{throw i?.(),o})}then(i,o){return this.execute().then(i,o)}}function s3(i,o,n){let p={},c=i.reduce((x,{path:T,field:m},f)=>{let F;if(Z(m,Li))F=m;else if(Z(m,N))F=m.decoder;else F=m.sql.decoder;let $=x;for(let[J,A]of T.entries())if(J<T.length-1){if(!(A in $))$[A]={};$=$[A]}else{let X=o[f],Y=$[A]=X===null?null:F.mapFromDriverValue(X);if(n&&Z(m,Li)&&T.length===2){let R=T[0];if(!(R in p))p[R]=Y===null?Ro(m.table):!1;else if(typeof p[R]==="string"&&p[R]!==Ro(m.table))p[R]=!1}}return x},{});if(n&&Object.keys(p).length>0){for(let[x,T]of Object.entries(p))if(typeof T==="string"&&!n[T])c[x]=null}return c}function Un(i,o){return Object.entries(i).reduce((n,[p,c])=>{if(typeof p!=="string")return n;let x=o?[...o,p]:[p];if(Z(c,Li)||Z(c,N)||Z(c,N.Aliased))n.push({path:x,field:c});else if(Z(c,B))n.push(...Un(c[B.Symbol.Columns],x));else n.push(...Un(c,x));return n},[])}function jT(i,o){let n=Object.keys(i),p=Object.keys(o);if(n.length!==p.length)return!1;for(let[c,x]of n.entries())if(x!==p[c])return!1;return!0}function z0(i,o){let n=Object.entries(o).filter(([,p])=>p!==void 0).map(([p,c])=>{if(Z(c,N)||Z(c,Li))return[p,c];else return[p,new Tn(c,i[B.Symbol.Columns][p])]});if(n.length===0)throw new Error("No values to set");return Object.fromEntries(n)}function t3(i,o){for(let n of o)for(let p of Object.getOwnPropertyNames(n.prototype)){if(p==="constructor")continue;Object.defineProperty(i.prototype,p,Object.getOwnPropertyDescriptor(n.prototype,p)||Object.create(null))}}function d3(i){return i[B.Symbol.Columns]}function Ap(i){return Z(i,wo)?i._.alias:Z(i,ro)?i[Ni].name:Z(i,N)?void 0:i[B.Symbol.IsAlias]?i[B.Symbol.Name]:i[B.Symbol.BaseName]}function vi(i,o){return{name:typeof i==="string"&&i.length>0?i:"",config:typeof i==="object"?i:o}}function r3(i){if(typeof i!=="object"||i===null)return!1;if(i.constructor.name!=="Object")return!1;if("logger"in i){let o=typeof i.logger;if(o!=="boolean"&&(o!=="object"||typeof i.logger.logQuery!=="function")&&o!=="undefined")return!1;return!0}if("schema"in i){let o=typeof i.schema;if(o!=="object"&&o!=="undefined")return!1;return!0}if("casing"in i){let o=typeof i.casing;if(o!=="string"&&o!=="undefined")return!1;return!0}if("mode"in i){if(i.mode!=="default"||i.mode!=="planetscale"||i.mode!==void 0)return!1;return!0}if("connection"in i){let o=typeof i.connection;if(o!=="string"&&o!=="object"&&o!=="undefined")return!1;return!0}if("client"in i){let o=typeof i.client;if(o!=="object"&&o!=="function"&&o!=="undefined")return!1;return!0}if(Object.keys(i).length===0)return!0;return!1}class Bp extends j{static[w]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(i){if(i){let{name:o,...n}=i;this.config.generatedIdentity={type:"always",sequenceName:o,sequenceOptions:n}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(i){if(i){let{name:o,...n}=i;this.config.generatedIdentity={type:"byDefault",sequenceName:o,sequenceOptions:n}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class e3 extends Bp{static[w]="PgBigInt53Builder";constructor(i){super(i,"number","PgBigInt53")}build(i){return new iX(i,this.config)}}class iX extends _{static[w]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(i){if(typeof i==="number")return i;return Number(i)}}class oX extends Bp{static[w]="PgBigInt64Builder";constructor(i){super(i,"bigint","PgBigInt64")}build(i){return new nX(i,this.config)}}class nX extends _{static[w]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(i){return BigInt(i)}}function pX(i,o){let{name:n,config:p}=vi(i,o);if(p.mode==="number")return new e3(n);return new oX(n)}class cX extends j{static[w]="PgBigSerial53Builder";constructor(i){super(i,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build(i){return new xX(i,this.config)}}class xX extends _{static[w]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(i){if(typeof i==="number")return i;return Number(i)}}class TX extends j{static[w]="PgBigSerial64Builder";constructor(i){super(i,"bigint","PgBigSerial64");this.config.hasDefault=!0}build(i){return new mX(i,this.config)}}class mX extends _{static[w]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(i){return BigInt(i)}}function fX(i,o){let{name:n,config:p}=vi(i,o);if(p.mode==="number")return new cX(n);return new TX(n)}class FX extends j{static[w]="PgBooleanBuilder";constructor(i){super(i,"boolean","PgBoolean")}build(i){return new $X(i,this.config)}}class $X extends _{static[w]="PgBoolean";getSQLType(){return"boolean"}}function PT(i){return new FX(i??"")}class JX extends j{static[w]="PgCharBuilder";constructor(i,o){super(i,"string","PgChar");this.config.length=o.length,this.config.enumValues=o.enum}build(i){return new AX(i,this.config)}}class AX extends _{static[w]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function vX(i,o={}){let{name:n,config:p}=vi(i,o);return new JX(n,p)}class wX extends j{static[w]="PgCidrBuilder";constructor(i){super(i,"string","PgCidr")}build(i){return new XX(i,this.config)}}class XX extends _{static[w]="PgCidr";getSQLType(){return"cidr"}}function WX(i){return new wX(i??"")}class RX extends j{static[w]="PgCustomColumnBuilder";constructor(i,o,n){super(i,"custom","PgCustomColumn");this.config.fieldConfig=o,this.config.customTypeParams=n}build(i){return new YX(i,this.config)}}class YX extends _{static[w]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(i,o){super(i,o);this.sqlName=o.customTypeParams.dataType(o.fieldConfig),this.mapTo=o.customTypeParams.toDriver,this.mapFrom=o.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(i){return typeof this.mapFrom==="function"?this.mapFrom(i):i}mapToDriverValue(i){return typeof this.mapTo==="function"?this.mapTo(i):i}}function GX(i){return(o,n)=>{let{name:p,config:c}=vi(o,n);return new RX(p,c,i)}}class vp extends j{static[w]="PgDateColumnBaseBuilder";defaultNow(){return this.default(W`now()`)}}class KX extends vp{static[w]="PgDateBuilder";constructor(i){super(i,"date","PgDate")}build(i){return new u0(i,this.config)}}class u0 extends _{static[w]="PgDate";getSQLType(){return"date"}mapFromDriverValue(i){return new Date(i)}mapToDriverValue(i){return i.toISOString()}}class HX extends vp{static[w]="PgDateStringBuilder";constructor(i){super(i,"string","PgDateString")}build(i){return new Q0(i,this.config)}}class Q0 extends _{static[w]="PgDateString";getSQLType(){return"date"}}function UX(i,o){let{name:n,config:p}=vi(i,o);if(p?.mode==="date")return new KX(n);return new HX(n)}class ZX extends j{static[w]="PgDoublePrecisionBuilder";constructor(i){super(i,"number","PgDoublePrecision")}build(i){return new MX(i,this.config)}}class MX extends _{static[w]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(i){if(typeof i==="string")return Number.parseFloat(i);return i}}function zX(i){return new ZX(i??"")}class uX extends j{static[w]="PgInetBuilder";constructor(i){super(i,"string","PgInet")}build(i){return new QX(i,this.config)}}class QX extends _{static[w]="PgInet";getSQLType(){return"inet"}}function VX(i){return new uX(i??"")}class SX extends Bp{static[w]="PgIntegerBuilder";constructor(i){super(i,"number","PgInteger")}build(i){return new EX(i,this.config)}}class EX extends _{static[w]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(i){if(typeof i==="string")return Number.parseInt(i);return i}}function V0(i){return new SX(i??"")}class OX extends j{static[w]="PgIntervalBuilder";constructor(i,o){super(i,"string","PgInterval");this.config.intervalConfig=o}build(i){return new _X(i,this.config)}}class _X extends _{static[w]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let i=this.fields?` ${this.fields}`:"",o=this.precision?`(${this.precision})`:"";return`interval${i}${o}`}}function LX(i,o={}){let{name:n,config:p}=vi(i,o);return new OX(n,p)}class CX extends j{static[w]="PgJsonBuilder";constructor(i){super(i,"json","PgJson")}build(i){return new S0(i,this.config)}}class S0 extends _{static[w]="PgJson";constructor(i,o){super(i,o)}getSQLType(){return"json"}mapToDriverValue(i){return JSON.stringify(i)}mapFromDriverValue(i){if(typeof i==="string")try{return JSON.parse(i)}catch{return i}return i}}function yX(i){return new CX(i??"")}class DX extends j{static[w]="PgJsonbBuilder";constructor(i){super(i,"json","PgJsonb")}build(i){return new E0(i,this.config)}}class E0 extends _{static[w]="PgJsonb";constructor(i,o){super(i,o)}getSQLType(){return"jsonb"}mapToDriverValue(i){return JSON.stringify(i)}mapFromDriverValue(i){if(typeof i==="string")try{return JSON.parse(i)}catch{return i}return i}}function IX(i){return new DX(i??"")}class BX extends j{static[w]="PgLineBuilder";constructor(i){super(i,"array","PgLine")}build(i){return new NX(i,this.config)}}class NX extends _{static[w]="PgLine";getSQLType(){return"line"}mapFromDriverValue(i){let[o,n,p]=i.slice(1,-1).split(",");return[Number.parseFloat(o),Number.parseFloat(n),Number.parseFloat(p)]}mapToDriverValue(i){return`{${i[0]},${i[1]},${i[2]}}`}}class bX extends j{static[w]="PgLineABCBuilder";constructor(i){super(i,"json","PgLineABC")}build(i){return new jX(i,this.config)}}class jX extends _{static[w]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(i){let[o,n,p]=i.slice(1,-1).split(",");return{a:Number.parseFloat(o),b:Number.parseFloat(n),c:Number.parseFloat(p)}}mapToDriverValue(i){return`{${i.a},${i.b},${i.c}}`}}function PX(i,o){let{name:n,config:p}=vi(i,o);if(!p?.mode||p.mode==="tuple")return new BX(n);return new bX(n)}class aX extends j{static[w]="PgMacaddrBuilder";constructor(i){super(i,"string","PgMacaddr")}build(i){return new lX(i,this.config)}}class lX extends _{static[w]="PgMacaddr";getSQLType(){return"macaddr"}}function qX(i){return new aX(i??"")}class kX extends j{static[w]="PgMacaddr8Builder";constructor(i){super(i,"string","PgMacaddr8")}build(i){return new hX(i,this.config)}}class hX extends _{static[w]="PgMacaddr8";getSQLType(){return"macaddr8"}}function gX(i){return new kX(i??"")}class sX extends j{static[w]="PgNumericBuilder";constructor(i,o,n){super(i,"string","PgNumeric");this.config.precision=o,this.config.scale=n}build(i){return new O0(i,this.config)}}class O0 extends _{static[w]="PgNumeric";precision;scale;constructor(i,o){super(i,o);this.precision=o.precision,this.scale=o.scale}mapFromDriverValue(i){if(typeof i==="string")return i;return String(i)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}class tX extends j{static[w]="PgNumericNumberBuilder";constructor(i,o,n){super(i,"number","PgNumericNumber");this.config.precision=o,this.config.scale=n}build(i){return new dX(i,this.config)}}class dX extends _{static[w]="PgNumericNumber";precision;scale;constructor(i,o){super(i,o);this.precision=o.precision,this.scale=o.scale}mapFromDriverValue(i){if(typeof i==="number")return i;return Number(i)}mapToDriverValue=String;getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}class rX extends j{static[w]="PgNumericBigIntBuilder";constructor(i,o,n){super(i,"bigint","PgNumericBigInt");this.config.precision=o,this.config.scale=n}build(i){return new eX(i,this.config)}}class eX extends _{static[w]="PgNumericBigInt";precision;scale;constructor(i,o){super(i,o);this.precision=o.precision,this.scale=o.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}}function i7(i,o){let{name:n,config:p}=vi(i,o),c=p?.mode;return c==="number"?new tX(n,p?.precision,p?.scale):c==="bigint"?new rX(n,p?.precision,p?.scale):new sX(n,p?.precision,p?.scale)}class o7 extends j{static[w]="PgPointTupleBuilder";constructor(i){super(i,"array","PgPointTuple")}build(i){return new n7(i,this.config)}}class n7 extends _{static[w]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(i){if(typeof i==="string"){let[o,n]=i.slice(1,-1).split(",");return[Number.parseFloat(o),Number.parseFloat(n)]}return[i.x,i.y]}mapToDriverValue(i){return`(${i[0]},${i[1]})`}}class p7 extends j{static[w]="PgPointObjectBuilder";constructor(i){super(i,"json","PgPointObject")}build(i){return new c7(i,this.config)}}class c7 extends _{static[w]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(i){if(typeof i==="string"){let[o,n]=i.slice(1,-1).split(",");return{x:Number.parseFloat(o),y:Number.parseFloat(n)}}return i}mapToDriverValue(i){return`(${i.x},${i.y})`}}function x7(i,o){let{name:n,config:p}=vi(i,o);if(!p?.mode||p.mode==="tuple")return new o7(n);return new p7(n)}function eM(i){let o=[];for(let n=0;n<i.length;n+=2)o.push(Number.parseInt(i.slice(n,n+2),16));return new Uint8Array(o)}function T7(i,o){let n=new ArrayBuffer(8),p=new DataView(n);for(let c=0;c<8;c++)p.setUint8(c,i[o+c]);return p.getFloat64(0,!0)}function Y$(i){let o=eM(i),n=0,p=o[n];n+=1;let c=new DataView(o.buffer),x=c.getUint32(n,p===1);n+=4;let T;if(x&536870912)T=c.getUint32(n,p===1),n+=4;if((x&65535)===1){let m=T7(o,n);n+=8;let f=T7(o,n);return n+=8,[m,f]}throw new Error("Unsupported geometry type")}class m7 extends j{static[w]="PgGeometryBuilder";constructor(i){super(i,"array","PgGeometry")}build(i){return new f7(i,this.config)}}class f7 extends _{static[w]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(i){return Y$(i)}mapToDriverValue(i){return`point(${i[0]} ${i[1]})`}}class F7 extends j{static[w]="PgGeometryObjectBuilder";constructor(i){super(i,"json","PgGeometryObject")}build(i){return new $7(i,this.config)}}class $7 extends _{static[w]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(i){let o=Y$(i);return{x:o[0],y:o[1]}}mapToDriverValue(i){return`point(${i.x} ${i.y})`}}function J7(i,o){let{name:n,config:p}=vi(i,o);if(!p?.mode||p.mode==="tuple")return new m7(n);return new F7(n)}class A7 extends j{static[w]="PgRealBuilder";constructor(i,o){super(i,"number","PgReal");this.config.length=o}build(i){return new v7(i,this.config)}}class v7 extends _{static[w]="PgReal";constructor(i,o){super(i,o)}getSQLType(){return"real"}mapFromDriverValue=(i)=>{if(typeof i==="string")return Number.parseFloat(i);return i}}function w7(i){return new A7(i??"")}class X7 extends j{static[w]="PgSerialBuilder";constructor(i){super(i,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(i){return new W7(i,this.config)}}class W7 extends _{static[w]="PgSerial";getSQLType(){return"serial"}}function R7(i){return new X7(i??"")}class Y7 extends Bp{static[w]="PgSmallIntBuilder";constructor(i){super(i,"number","PgSmallInt")}build(i){return new G7(i,this.config)}}class G7 extends _{static[w]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=(i)=>{if(typeof i==="string")return Number(i);return i}}function K7(i){return new Y7(i??"")}class H7 extends j{static[w]="PgSmallSerialBuilder";constructor(i){super(i,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(i){return new U7(i,this.config)}}class U7 extends _{static[w]="PgSmallSerial";getSQLType(){return"smallserial"}}function Z7(i){return new H7(i??"")}class M7 extends j{static[w]="PgTextBuilder";constructor(i,o){super(i,"string","PgText");this.config.enumValues=o.enum}build(i){return new z7(i,this.config)}}class z7 extends _{static[w]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function u7(i,o={}){let{name:n,config:p}=vi(i,o);return new M7(n,p)}class Q7 extends vp{constructor(i,o,n){super(i,"string","PgTime");this.withTimezone=o,this.precision=n,this.config.withTimezone=o,this.config.precision=n}static[w]="PgTimeBuilder";build(i){return new _0(i,this.config)}}class _0 extends _{static[w]="PgTime";withTimezone;precision;constructor(i,o){super(i,o);this.withTimezone=o.withTimezone,this.precision=o.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function V7(i,o={}){let{name:n,config:p}=vi(i,o);return new Q7(n,p.withTimezone??!1,p.precision)}class S7 extends vp{static[w]="PgTimestampBuilder";constructor(i,o,n){super(i,"date","PgTimestamp");this.config.withTimezone=o,this.config.precision=n}build(i){return new L0(i,this.config)}}class L0 extends _{static[w]="PgTimestamp";withTimezone;precision;constructor(i,o){super(i,o);this.withTimezone=o.withTimezone,this.precision=o.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=(i)=>{return new Date(this.withTimezone?i:i+"+0000")};mapToDriverValue=(i)=>{return i.toISOString()}}class E7 extends vp{static[w]="PgTimestampStringBuilder";constructor(i,o,n){super(i,"string","PgTimestampString");this.config.withTimezone=o,this.config.precision=n}build(i){return new C0(i,this.config)}}class C0 extends _{static[w]="PgTimestampString";withTimezone;precision;constructor(i,o){super(i,o);this.withTimezone=o.withTimezone,this.precision=o.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function In(i,o={}){let{name:n,config:p}=vi(i,o);if(p?.mode==="string")return new E7(n,p.withTimezone??!1,p.precision);return new S7(n,p?.withTimezone??!1,p?.precision)}class O7 extends j{static[w]="PgUUIDBuilder";constructor(i){super(i,"string","PgUUID")}defaultRandom(){return this.default(W`gen_random_uuid()`)}build(i){return new y0(i,this.config)}}class y0 extends _{static[w]="PgUUID";getSQLType(){return"uuid"}}function mn(i){return new O7(i??"")}class _7 extends j{static[w]="PgVarcharBuilder";constructor(i,o){super(i,"string","PgVarchar");this.config.length=o.length,this.config.enumValues=o.enum}build(i){return new L7(i,this.config)}}class L7 extends _{static[w]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function Co(i,o={}){let{name:n,config:p}=vi(i,o);return new _7(n,p)}class C7 extends j{static[w]="PgBinaryVectorBuilder";constructor(i,o){super(i,"string","PgBinaryVector");this.config.dimensions=o.dimensions}build(i){return new y7(i,this.config)}}class y7 extends _{static[w]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function D7(i,o){let{name:n,config:p}=vi(i,o);return new C7(n,p)}class I7 extends j{static[w]="PgHalfVectorBuilder";constructor(i,o){super(i,"array","PgHalfVector");this.config.dimensions=o.dimensions}build(i){return new B7(i,this.config)}}class B7 extends _{static[w]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(i){return JSON.stringify(i)}mapFromDriverValue(i){return i.slice(1,-1).split(",").map((o)=>Number.parseFloat(o))}}function N7(i,o){let{name:n,config:p}=vi(i,o);return new I7(n,p)}class b7 extends j{static[w]="PgSparseVectorBuilder";constructor(i,o){super(i,"string","PgSparseVector");this.config.dimensions=o.dimensions}build(i){return new j7(i,this.config)}}class j7 extends _{static[w]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function P7(i,o){let{name:n,config:p}=vi(i,o);return new b7(n,p)}class a7 extends j{static[w]="PgVectorBuilder";constructor(i,o){super(i,"array","PgVector");this.config.dimensions=o.dimensions}build(i){return new l7(i,this.config)}}class l7 extends _{static[w]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(i){return JSON.stringify(i)}mapFromDriverValue(i){return i.slice(1,-1).split(",").map((o)=>Number.parseFloat(o))}}function q7(i,o){let{name:n,config:p}=vi(i,o);return new a7(n,p)}function k7(){return{bigint:pX,bigserial:fX,boolean:PT,char:vX,cidr:WX,customType:GX,date:UX,doublePrecision:zX,inet:VX,integer:V0,interval:LX,json:yX,jsonb:IX,line:PX,macaddr:qX,macaddr8:gX,numeric:i7,point:x7,geometry:J7,real:w7,serial:R7,smallint:K7,smallserial:Z7,text:u7,time:V7,timestamp:In,uuid:mn,varchar:Co,bit:D7,halfvec:N7,sparsevec:P7,vector:q7}}var G$=Symbol.for("drizzle:PgInlineForeignKeys"),h7=Symbol.for("drizzle:EnableRLS");class Zo extends B{static[w]="PgTable";static Symbol=Object.assign({},B.Symbol,{InlineForeignKeys:G$,EnableRLS:h7});[G$]=[];[h7]=!1;[B.Symbol.ExtraConfigBuilder]=void 0;[B.Symbol.ExtraConfigColumns]={}}function iz(i,o,n,p,c=i){let x=new Zo(i,p,c),T=typeof o==="function"?o(k7()):o,m=Object.fromEntries(Object.entries(T).map(([$,J])=>{let A=J;A.setName($);let X=A.build(x);return x[G$].push(...A.buildForeignKeys(X,x)),[$,X]})),f=Object.fromEntries(Object.entries(T).map(([$,J])=>{let A=J;A.setName($);let X=A.buildExtraConfigColumn(x);return[$,X]})),F=Object.assign(x,m);if(F[B.Symbol.Columns]=m,F[B.Symbol.ExtraConfigColumns]=f,n)F[Zo.Symbol.ExtraConfigBuilder]=n;return Object.assign(F,{enableRLS:()=>{return F[Zo.Symbol.EnableRLS]=!0,F}})}var Np=(i,o,n)=>{return iz(i,o,n,void 0)};function g7(...i){if(i[0].columns)return new aT(i[0].columns,i[0].name);return new aT(i)}class aT{static[w]="PgPrimaryKeyBuilder";columns;name;constructor(i,o){this.columns=i,this.name=o}build(i){return new s7(i,this.columns,this.name)}}class s7{constructor(i,o,n){this.table=i,this.columns=o,this.name=n}static[w]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[Zo.Symbol.Name]}_${this.columns.map((i)=>i.name).join("_")}_pk`}}class K${constructor(i,o,n){this.sourceTable=i,this.referencedTable=o,this.relationName=n,this.referencedTableName=o[B.Symbol.Name]}static[w]="Relation";referencedTableName;fieldName}class t7{constructor(i,o){this.table=i,this.config=o}static[w]="Relations"}class bp extends K${constructor(i,o,n,p){super(i,o,n?.relationName);this.config=n,this.isNullable=p}static[w]="One";withFieldName(i){let o=new bp(this.sourceTable,this.referencedTable,this.config,this.isNullable);return o.fieldName=i,o}}class lT extends K${constructor(i,o,n){super(i,o,n?.relationName);this.config=n}static[w]="Many";withFieldName(i){let o=new lT(this.sourceTable,this.referencedTable,this.config);return o.fieldName=i,o}}function d7(){return{and:wc,between:b3,eq:dn,exists:B3,gt:M0,gte:O3,ilike:l3,inArray:C3,isNull:D3,isNotNull:I3,like:P3,lt:_3,lte:L3,ne:V3,not:E3,notBetween:j3,notExists:N3,notLike:a3,notIlike:q3,notInArray:y3,or:S3,sql:W}}function r7(){return{sql:W,asc:k3,desc:h3}}function e7(i,o){if(Object.keys(i).length===1&&"default"in i&&!Z(i.default,B))i=i.default;let n={},p={},c={};for(let[x,T]of Object.entries(i))if(Z(T,B)){let m=vc(T),f=p[m];n[m]=x,c[x]={tsName:x,dbName:T[B.Symbol.Name],schema:T[B.Symbol.Schema],columns:T[B.Symbol.Columns],relations:f?.relations??{},primaryKey:f?.primaryKey??[]};for(let $ of Object.values(T[B.Symbol.Columns]))if($.primary)c[x].primaryKey.push($);let F=T[B.Symbol.ExtraConfigBuilder]?.(T[B.Symbol.ExtraConfigColumns]);if(F){for(let $ of Object.values(F))if(Z($,aT))c[x].primaryKey.push(...$.columns)}}else if(Z(T,t7)){let m=vc(T.table),f=n[m],F=T.config(o(T.table)),$;for(let[J,A]of Object.entries(F))if(f){let X=c[f];if(X.relations[J]=A,$)X.primaryKey.push(...$)}else{if(!(m in p))p[m]={relations:{},primaryKey:$};p[m].relations[J]=A}}return{tables:c,tableNamesMap:n}}function oz(i){return function o(n,p){return new bp(i,n,p,p?.fields.reduce((c,x)=>c&&x.notNull,!0)??!1)}}function nz(i){return function o(n,p){return new lT(i,n,p)}}function iW(i,o,n){if(Z(n,bp)&&n.config)return{fields:n.config.fields,references:n.config.references};let p=o[vc(n.referencedTable)];if(!p)throw new Error(`Table "${n.referencedTable[B.Symbol.Name]}" not found in schema`);let c=i[p];if(!c)throw new Error(`Table "${p}" not found in schema`);let x=n.sourceTable,T=o[vc(x)];if(!T)throw new Error(`Table "${x[B.Symbol.Name]}" not found in schema`);let m=[];for(let f of Object.values(c.relations))if(n.relationName&&n!==f&&f.relationName===n.relationName||!n.relationName&&f.referencedTable===n.sourceTable)m.push(f);if(m.length>1)throw n.relationName?new Error(`There are multiple relations with name "${n.relationName}" in table "${p}"`):new Error(`There are multiple relations between "${p}" and "${n.sourceTable[B.Symbol.Name]}". Please specify relation name`);if(m[0]&&Z(m[0],bp)&&m[0].config)return{fields:m[0].config.references,references:m[0].config.fields};throw new Error(`There is not enough information to infer relation "${T}.${n.fieldName}"`)}function oW(i){return{one:oz(i),many:nz(i)}}function D0(i,o,n,p,c=(x)=>x){let x={};for(let[T,m]of p.entries())if(m.isJson){let f=o.relations[m.tsKey],F=n[T],$=typeof F==="string"?JSON.parse(F):F;x[m.tsKey]=Z(f,bp)?$&&D0(i,i[m.relationTableTsKey],$,m.selection,c):$.map((J)=>D0(i,i[m.relationTableTsKey],J,m.selection,c))}else{let f=c(n[T]),F=m.field,$;if(Z(F,Li))$=F;else if(Z(F,N))$=F.decoder;else $=F.sql.decoder;x[m.tsKey]=f===null?null:$.mapFromDriverValue(f)}return x}var aR=C1(PR(),1),{Server:lR,Namespace:jpi,Socket:Ppi}=aR.default;import{readFileSync as hR}from"fs";import{resolve as XJ}from"path";function rS(i,o){let n={},p=[];for(let c in i){let x=i[c],T=o[c],m=x["~standard"].validate(T);if(m instanceof Promise)throw new Error(`Validation must be synchronous, but ${c} returned a Promise.`);if(m.issues){p.push(...m.issues.map((f)=>({...f,path:[c,...f.path??[]]})));continue}n[c]=m.value}if(p.length)return{issues:p};return{value:n}}function qR(i){let o=i.runtimeEnvStrict??i.runtimeEnv??process.env;if(i.emptyStringAsUndefined??!1){for(let[z,b]of Object.entries(o))if(b==="")delete o[z]}if(!!i.skipValidation)return o;let c=typeof i.client==="object"?i.client:{},x=typeof i.server==="object"?i.server:{},T=typeof i.shared==="object"?i.shared:{},m=i.isServer??(typeof window==="undefined"||("Deno"in window)),f=m?{...x,...T,...c}:{...c,...T},F=rS(f,o),$=i.onValidationError??((z)=>{throw console.error("\u274C Invalid environment variables:",z),new Error("Invalid environment variables")}),J=i.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(F.issues)return $(F.issues);let A=(z)=>{if(!i.clientPrefix)return!0;return!z.startsWith(i.clientPrefix)&&!(z in T)},X=(z)=>{return m||!A(z)},Y=(z)=>{return z==="__esModule"||z==="$$typeof"},R=(i.extends??[]).reduce((z,b)=>{return Object.assign(z,b)},{}),K=Object.assign(F.value,R);return new Proxy(K,{get(z,b){if(typeof b!=="string")return;if(Y(b))return;if(!X(b))return J(b);return Reflect.get(z,b)}})}var eS="__vite_start_time"in globalThis,iE=typeof window!=="undefined",hpi="vitest"in globalThis,Rp=ri("string"),kR=ri('"true" | "false" | undefined'),oo=qR({isServer:!eS&&!iE,server:{CI:ri("string | undefined").pipe(Boolean),POSTGRES_USER:Rp,POSTGRES_PASSWORD:Rp,POSTGRES_DATABASE:Rp,POSTGRES_HOST:Rp,POSTGRES_PORT:Rp.pipe((i)=>Number.parseInt(i,10)),BACKEND_PORT:Rp.pipe((i)=>Number.parseInt(i,10)),RUN_WORKERS_FROM_SOURCE:kR.pipe((i)=>i==="true"),FRONTEND_PORT:Rp.pipe((i)=>Number.parseInt(i,10)),FRONTEND_ORIGINS:Rp.pipe.try((i)=>JSON.parse(i),ri("string[]")),OPENAI_API_KEY:ri("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Rp,VITE_USE_SELF_SIGNED_CERTIFICATE:kR.pipe((i)=>i==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var gR=XJ(import.meta.dirname,"../dev"),WJ=oo.VITE_USE_SELF_SIGNED_CERTIFICATE?{cert:hR(XJ(gR,"./cert.pem"),"utf-8"),key:hR(XJ(gR,"./key.pem"),"utf-8")}:void 0;var qp=new XF,xi=oo.VITE_USE_SELF_SIGNED_CERTIFICATE?console:qp.logger;d.STORE.loggers[0]=new pc("warn",void 0,xi);if(xi!==console)Object.assign(console,xi,{log:xi.info});import{spawn as oE}from"child_process";import{resolve as nE}from"path";function RJ(i,o,n=i.logger){let p=oo.RUN_WORKERS_FROM_SOURCE?"ts":"js",c=o.endsWith(".bun")?"bun":"node",T=[nE(import.meta.dir,`${o}.${p}`)];if(c==="node"&&p==="ts")T.push("--experimental-strip-types");let m=oE(c,T);return new MT(m,o,n)}var sR=C1(n$(),1);var pE=604800000,F1=(()=>{let{__userSessionMap:i}=globalThis;if(!i){i=globalThis.__userSessionMap=new Map;let o=new sR.CronJob("00 00 03 * * *",()=>{for(let[n,p]of i.entries()){let c=Date.now();for(let[x,T]of p.entries())if(c-T>pE)p.delete(x);if(p.size===0)i.delete(n)}});o.start(),process.on("exit",async()=>{await o.stop(),xi.info("\uD83D\uDEEC autoExpiry stopped")})}return i})();import sE from"path";import QE from"os";import VE from"fs";var $1=new Map,YJ=new Map,GJ=Symbol("OriginError"),Ex={};class un extends Promise{constructor(i,o,n,p,c={}){let x,T;super((m,f)=>{x=m,T=f});this.tagged=Array.isArray(i.raw),this.strings=i,this.args=o,this.handler=n,this.canceller=p,this.options=c,this.state=null,this.statement=null,this.resolve=(m)=>(this.active=!1,x(m)),this.reject=(m)=>(this.active=!1,T(m)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[GJ]=this.handler.debug?new Error:this.tagged&&cE(this.strings)}get origin(){return(this.handler.debug?this[GJ].stack:this.tagged&&YJ.has(this.strings)?YJ.get(this.strings):YJ.set(this.strings,this[GJ].stack).get(this.strings))||""}static get[Symbol.species](){return Promise}cancel(){return this.canceller&&(this.canceller(this),this.canceller=null)}simple(){return this.options.simple=!0,this.options.prepare=!1,this}async readable(){return this.simple(),this.streaming=!0,this}async writable(){return this.simple(),this.streaming=!0,this}cursor(i=1,o){if(this.options.simple=!1,typeof i==="function")o=i,i=1;if(this.cursorRows=i,typeof o==="function")return this.cursorFn=o,this;let n;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};n&&n();let p=new Promise((c,x)=>{this.cursorFn=(T)=>{return c({value:T,done:!1}),new Promise((m)=>n=m)},this.resolve=()=>(this.active=!1,c({done:!0})),this.reject=(T)=>(this.active=!1,x(T))});return this.execute(),p},return(){return n&&n(Ex),{done:!0}}})}}describe(){return this.options.simple=!1,this.onlyDescribe=this.options.prepare=!0,this}stream(){throw new Error(".stream has been renamed to .forEach")}forEach(i){return this.forEachFn=i,this.handle(),this}raw(){return this.isRaw=!0,this}values(){return this.isRaw="values",this}async handle(){!this.executed&&(this.executed=!0)&&await 1&&this.handler(this)}execute(){return this.handle(),this}then(){return this.handle(),super.then.apply(this,arguments)}catch(){return this.handle(),super.catch.apply(this,arguments)}finally(){return this.handle(),super.finally.apply(this,arguments)}}function cE(i){if($1.has(i))return $1.get(i);let o=Error.stackTraceLimit;return Error.stackTraceLimit=4,$1.set(i,new Error),Error.stackTraceLimit=o,$1.get(i)}class Ox extends Error{constructor(i){super(i.message);this.name=this.constructor.name,Object.assign(this,i)}}var xo={connection:tR,postgres:dR,generic:rR,notSupported:eR};function tR(i,o,n){let{host:p,port:c}=n||o,x=Object.assign(new Error("write "+i+" "+(o.path||p+":"+c)),{code:i,errno:i,address:o.path||p},o.path?{}:{port:c});return Error.captureStackTrace(x,tR),x}function dR(i){let o=new Ox(i);return Error.captureStackTrace(o,dR),o}function rR(i,o){let n=Object.assign(new Error(i+": "+o),{code:i});return Error.captureStackTrace(n,rR),n}function eR(i){let o=Object.assign(new Error(i+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:i});return Error.captureStackTrace(o,eR),o}var xE={string:{to:25,from:null,serialize:(i)=>""+i},number:{to:0,from:[21,23,26,700,701],serialize:(i)=>""+i,parse:(i)=>+i},json:{to:114,from:[114,3802],serialize:(i)=>JSON.stringify(i),parse:(i)=>JSON.parse(i)},boolean:{to:16,from:16,serialize:(i)=>i===!0?"t":"f",parse:(i)=>i==="t"},date:{to:1184,from:[1082,1114,1184],serialize:(i)=>(i instanceof Date?i:new Date(i)).toISOString(),parse:(i)=>new Date(i)},bytea:{to:17,from:17,serialize:(i)=>"\\x"+Buffer.from(i).toString("hex"),parse:(i)=>Buffer.from(i.slice(2),"hex")}};class v1{then(){KJ()}catch(){KJ()}finally(){KJ()}}class om extends v1{constructor(i){super();this.value=W1(i)}}class en extends v1{constructor(i,o,n){super();this.value=i,this.type=o,this.array=n}}class w1 extends v1{constructor(i,o){super();this.first=i,this.rest=o}build(i,o,n,p){let c=TE.map(([x,T])=>({fn:T,i:i.search(x)})).sort((x,T)=>x.i-T.i).pop();return c.i===-1?zJ(this.first,p):c.fn(this.first,this.rest,o,n,p)}}function X1(i,o,n,p){let c=i instanceof en?i.value:i;if(c===void 0){if(i instanceof en?i.value=p.transform.undefined:c=i=p.transform.undefined,c===void 0)throw xo.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+n.push(i instanceof en?(o.push(i.value),i.array?i.array[i.type||A1(i.value)]||i.type||pY(i.value):i.type):(o.push(i),A1(i)))}var oY=xY(xE);function ZJ(i,o,n,p,c,x){for(let T=1;T<i.strings.length;T++)o+=MJ(o,n,p,c,x)+i.strings[T],n=i.args[T];return o}function MJ(i,o,n,p,c){return o instanceof w1?o.build(i,n,p,c):o instanceof un?UJ(o,n,p,c):o instanceof om?o.value:o&&o[0]instanceof un?o.reduce((x,T)=>x+" "+UJ(T,n,p,c),""):X1(o,n,p,c)}function UJ(i,o,n,p){return i.fragment=!0,ZJ(i,i.strings[0],i.args[0],o,n,p)}function nY(i,o,n,p,c){return i.map((x)=>"("+p.map((T)=>MJ("values",x[T],o,n,c)).join(",")+")").join(",")}function iY(i,o,n,p,c){let x=Array.isArray(i[0]),T=o.length?o.flat():Object.keys(x?i[0]:i);return nY(x?i:[i],n,p,T,c)}function J1(i,o,n,p,c){if(typeof i==="string"&&(i=[i].concat(o)),Array.isArray(i))return zJ(i,c);let x;return(o.length?o.flat():Object.keys(i)).map((m)=>{return x=i[m],(x instanceof un?UJ(x,n,p,c):x instanceof om?x.value:X1(x,n,p,c))+" as "+W1(c.transform.column.to?c.transform.column.to(m):m)}).join(",")}var TE=Object.entries({values:iY,in:(...i)=>{let o=iY(...i);return o==="()"?"(null)":o},select:J1,as:J1,returning:J1,"\\(":J1,update(i,o,n,p,c){return(o.length?o.flat():Object.keys(i)).map((x)=>W1(c.transform.column.to?c.transform.column.to(x):x)+"="+MJ("values",i[x],n,p,c))},insert(i,o,n,p,c){let x=o.length?o.flat():Object.keys(Array.isArray(i)?i[0]:i);return"("+zJ(x,c)+")values"+nY(Array.isArray(i)?i:[i],n,p,x,c)}}).map(([i,o])=>[new RegExp("((?:^|[\\s(])"+i+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),o]);function KJ(){throw xo.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:mE,parsers:fE}=oY;function pY(i){if(Array.isArray(i))return pY(i[0]);return typeof i==="string"?1009:0}var cY=function(i){let o=xY(i||{});return{serializers:Object.assign({},mE,o.serializers),parsers:Object.assign({},fE,o.parsers)}};function xY(i){return Object.keys(i).reduce((o,n)=>{if(i[n].from&&[].concat(i[n].from).forEach((p)=>o.parsers[p]=i[n].parse),i[n].serialize)o.serializers[i[n].to]=i[n].serialize,i[n].from&&[].concat(i[n].from).forEach((p)=>o.serializers[p]=i[n].serialize);return o},{parsers:{},serializers:{}})}function zJ(i,{transform:{column:o}}){return i.map((n)=>W1(o.to?o.to(n):n)).join(",")}var W1=function i(o){return'"'+o.replace(/"/g,'""').replace(/\./g,'"."')+'"'},A1=function i(o){return o instanceof en?o.type:o instanceof Date?1184:o instanceof Uint8Array?17:o===!0||o===!1?16:typeof o==="bigint"?20:Array.isArray(o)?i(o[0]):0},FE=/\\/g,$E=/"/g;function JE(i){return i.replace(FE,"\\\\").replace($E,"\\\"")}var TY=function i(o,n,p,c){if(Array.isArray(o)===!1)return o;if(!o.length)return"{}";let x=o[0],T=c===1020?";":",";if(Array.isArray(x)&&!x.type)return"{"+o.map((m)=>i(m,n,p,c)).join(T)+"}";return"{"+o.map((m)=>{if(m===void 0){if(m=p.transform.undefined,m===void 0)throw xo.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return m===null?"null":'"'+JE(n?n(m.type?m.value:m):""+m)+'"'}).join(T)+"}"},HJ={i:0,char:null,str:"",quoted:!1,last:0},mY=function i(o,n,p){return HJ.i=HJ.last=0,fY(HJ,o,n,p)};function fY(i,o,n,p){let c=[],x=p===1020?";":",";for(;i.i<o.length;i.i++){if(i.char=o[i.i],i.quoted)if(i.char==="\\")i.str+=o[++i.i];else if(i.char==='"')c.push(n?n(i.str):i.str),i.str="",i.quoted=o[i.i+1]==='"',i.last=i.i+2;else i.str+=i.char;else if(i.char==='"')i.quoted=!0;else if(i.char==="{")i.last=++i.i,c.push(fY(i,o,n,p));else if(i.char==="}"){i.quoted=!1,i.last<i.i&&c.push(n?n(o.slice(i.last,i.i)):o.slice(i.last,i.i)),i.last=i.i+1;break}else if(i.char===x&&i.p!=="}"&&i.p!=='"')c.push(n?n(o.slice(i.last,i.i)):o.slice(i.last,i.i)),i.last=i.i+1;i.p=i.char}return i.last<i.i&&c.push(n?n(o.slice(i.last,i.i+1)):o.slice(i.last,i.i+1)),c}var Zc=(i)=>{let o=i[0];for(let n=1;n<i.length;n++)o+=i[n]==="_"?i[++n].toUpperCase():i[n];return o},Mc=(i)=>{let o=i[0].toUpperCase();for(let n=1;n<i.length;n++)o+=i[n]==="_"?i[++n].toUpperCase():i[n];return o},zc=(i)=>i.replace(/_/g,"-"),rT=(i)=>i.replace(/([A-Z])/g,"_$1").toLowerCase(),eT=(i)=>(i.slice(0,1)+i.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),im=(i)=>i.replace(/-/g,"_");function uJ(i){return function o(n,p){return typeof n==="object"&&n!==null&&(p.type===114||p.type===3802)?Array.isArray(n)?n.map((c)=>o(c,p)):Object.entries(n).reduce((c,[x,T])=>Object.assign(c,{[i(x)]:o(T,p)}),{}):n}}Zc.column={from:Zc};Zc.value={from:uJ(Zc)};rT.column={to:rT};var QJ={...Zc};QJ.column.to=rT;Mc.column={from:Mc};Mc.value={from:uJ(Mc)};eT.column={to:eT};var VJ={...Mc};VJ.column.to=eT;zc.column={from:zc};zc.value={from:uJ(zc)};im.column={to:im};var SJ={...zc};SJ.column.to=im;import FY from"net";import XE from"tls";import nm from"crypto";import EJ from"stream";import{performance as $Y}from"perf_hooks";class uc extends Array{constructor(){super();Object.defineProperties(this,{count:{value:null,writable:!0},state:{value:null,writable:!0},command:{value:null,writable:!0},columns:{value:null,writable:!0},statement:{value:null,writable:!0}})}static get[Symbol.species](){return Array}}var Jn=AE;function AE(i=[]){let o=i.slice(),n=0;return{get length(){return o.length-n},remove:(p)=>{let c=o.indexOf(p);return c===-1?null:(o.splice(c,1),p)},push:(p)=>(o.push(p),p),shift:()=>{let p=o[n++];if(n===o.length)n=0,o=[];else o[n-1]=void 0;return p}}}var Io=Buffer.allocUnsafe(256),vE="BCcDdEFfHPpQSX".split("").reduce((i,o)=>{let n=o.charCodeAt(0);return i[o]=()=>{return Io[0]=n,Si.i=5,Si},i},{}),Si=Object.assign(wE,vE,{N:String.fromCharCode(0),i:0,inc(i){return Si.i+=i,Si},str(i){let o=Buffer.byteLength(i);return R1(o),Si.i+=Io.write(i,Si.i,o,"utf8"),Si},i16(i){return R1(2),Io.writeUInt16BE(i,Si.i),Si.i+=2,Si},i32(i,o){if(o||o===0)return Io.writeUInt32BE(i,o),Si;return R1(4),Io.writeUInt32BE(i,Si.i),Si.i+=4,Si},z(i){return R1(i),Io.fill(0,Si.i,Si.i+i),Si.i+=i,Si},raw(i){return Io=Buffer.concat([Io.subarray(0,Si.i),i]),Si.i=Io.length,Si},end(i=1){Io.writeUInt32BE(Si.i-i,i);let o=Io.subarray(0,Si.i);return Si.i=0,Io=Buffer.allocUnsafe(256),o}}),g=Si;function R1(i){if(Io.length-Si.i<i){let o=Io,n=o.length;Io=Buffer.allocUnsafe(n+(n>>1)+i),o.copy(Io)}}function wE(){return Si.i=0,Si}var LJ=vY,WE=1,kp=g().S().end(),JY=g().H().end(),RE=g().i32(8).i32(80877103).end(8),YE=Buffer.concat([g().E().str(g.N).i32(0).end(),kp]),GE=g().D().str("S").str(g.N).end(),_x=()=>{},KE=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),HE={83:"severity_local",86:"severity",67:"code",77:"message",68:"detail",72:"hint",80:"position",112:"internal_position",113:"internal_query",87:"where",115:"schema_name",116:"table_name",99:"column_name",100:"data type_name",110:"constraint_name",70:"file",76:"line",82:"routine"};function vY(i,o={},{onopen:n=_x,onend:p=_x,onclose:c=_x}={}){let{ssl:x,max:T,user:m,host:f,port:F,database:$,parsers:J,transform:A,onnotice:X,onnotify:Y,onparameter:R,max_pipeline:K,keep_alive:U,backoff:z,target_session_attrs:b}=i,M=Jn(),u=WE++,E={pid:null,secret:null},S=_J(O1,i.idle_timeout),C=_J(O1,i.max_lifetime),q=_J(aY,i.connect_timeout),Q=null,Ti,l=new uc,mi=Buffer.alloc(0),Ei=i.fetch_types,To={},lo={},ip=Math.random().toString(36).slice(2),O=1,k=0,Yi=0,ai=0,mo=0,Fi=0,yi=0,no=0,qi=null,bi=null,Mo=!1,Di=null,Qn=null,zo=null,Yp=null,fo=null,ji=null,Vn=null,Pn=null,y=null,Ix=null,uo={queue:o.closed,idleTimer:S,connect(v){zo=v||!0,xA()},terminate:Nx,execute:Bx,cancel:NY,end:O1,count:0,id:u};return o.closed&&o.closed.push(uo),uo;async function BY(){let v;try{v=i.socket?await Promise.resolve(i.socket(i)):new FY.Socket}catch(G){Ec(G);return}return v.on("error",Ec),v.on("close",TA),v.on("drain",pA),v}async function NY({pid:v,secret:G},s,Gi){try{Ti=g().i32(16).i32(80877102).i32(v).i32(G).end(16),await cA(),Q.once("error",Gi),Q.once("close",s)}catch(gi){Gi(gi)}}function Bx(v){if(Mo)return Fm(v,xo.connection("CONNECTION_DESTROYED",i));if(v.cancelled)return;try{return v.state=E,y?M.push(v):(y=v,y.active=!0),PY(v),Ko(bY(v))&&!v.describeFirst&&!v.cursorFn&&M.length<K&&(!v.options.onexecute||v.options.onexecute(uo))}catch(G){return M.length===0&&Ko(kp),an(G),!0}}function bY(v){if(v.parameters.length>=65534)throw xo.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return v.options.simple?g().Q().str(v.statement.string+g.N).end():v.describeFirst?Buffer.concat([iA(v),JY]):v.prepare?v.prepared?fm(v):Buffer.concat([iA(v),fm(v)]):jY(v)}function iA(v){return Buffer.concat([fA(v.statement.string,v.parameters,v.statement.types,v.statement.name),QG("S",v.statement.name)])}function fm(v){return Buffer.concat([uG(v.parameters,v.statement.types,v.statement.name,v.cursorName),v.cursorFn?FA("",v.cursorRows):YE])}function jY(v){return Buffer.concat([fA(v.statement.string,v.parameters,v.statement.types),GE,fm(v)])}function PY(v){let G=[],s=[],Gi=ZJ(v,v.strings[0],v.args[0],G,s,i);!v.tagged&&v.args.forEach((gi)=>X1(gi,G,s,i)),v.prepare=i.prepare&&("prepare"in v.options?v.options.prepare:!0),v.string=Gi,v.signature=v.prepare&&s+Gi,v.onlyDescribe&&delete lo[v.signature],v.parameters=v.parameters||G,v.prepared=v.prepare&&v.signature in lo,v.describeFirst=v.onlyDescribe||G.length&&!v.prepared,v.statement=v.prepared?lo[v.signature]:{string:Gi,types:s,name:v.prepare?ip+O++:""},typeof i.debug==="function"&&i.debug(u,Gi,G,s)}function Ko(v,G){if(ji=ji?Buffer.concat([ji,v]):Buffer.from(v),G||ji.length>=1024)return oA(G);return bi===null&&(bi=setImmediate(oA)),!0}function oA(v){let G=Q.write(ji,v);return bi!==null&&clearImmediate(bi),ji=bi=null,G}function aY(){an(xo.connection("CONNECT_TIMEOUT",i,Q)),Q.destroy()}async function nA(){if(Ko(RE),!await new Promise((G)=>Q.once("data",(s)=>G(s[0]===83)))&&x==="prefer")return Sc();Q.removeAllListeners(),Q=XE.connect({socket:Q,servername:FY.isIP(Q.host)?void 0:Q.host,...x==="require"||x==="allow"||x==="prefer"?{rejectUnauthorized:!1}:x==="verify-full"?{}:typeof x==="object"?x:{}}),Q.on("secureConnect",Sc),Q.on("error",Ec),Q.on("close",TA),Q.on("drain",pA)}function pA(){!y&&n(uo)}function E1(v){if(Di){if(Di.push(v),Yi-=v.length,Yi>=0)return}mi=Di?Buffer.concat(Di,Fi-Yi):mi.length===0?v:Buffer.concat([mi,v],mi.length+v.length);while(mi.length>4){if(Fi=mi.readUInt32BE(1),Fi>=mi.length){Yi=Fi-mi.length,Di=[mi];break}try{lY(mi.subarray(0,Fi+1))}catch(G){y&&(y.cursorFn||y.describeFirst)&&Ko(kp),an(G)}mi=mi.subarray(Fi+1),Yi=0,Di=null}}async function cA(){if(Mo=!1,To={},Q||(Q=await BY()),!Q)return;if(q.start(),i.socket)return x?nA():Sc();if(Q.on("connect",x?nA:Sc),i.path)return Q.connect(i.path);Q.ssl=x,Q.connect(F[ai],f[ai]),Q.host=f[ai],Q.port=F[ai],ai=(ai+1)%F.length}function xA(){setTimeout(cA,k?k+yi-$Y.now():0)}function Sc(){try{lo={},Ei=i.fetch_types,ip=Math.random().toString(36).slice(2),O=1,C.start(),Q.on("data",E1),U&&Q.setKeepAlive&&Q.setKeepAlive(!0,1000*U);let v=SG();Ko(v)}catch(v){Ec(v)}}function Ec(v){if(uo.queue===o.connecting&&i.host[mo+1])return;an(v);while(M.length)Fm(M.shift(),v)}function an(v){fo&&(fo.destroy(v),fo=null),y&&Fm(y,v),zo&&(Fm(zo,v),zo=null)}function Fm(v,G){"query"in G||"parameters"in G||Object.defineProperties(G,{stack:{value:G.stack+v.origin.replace(/.*\n/,`
99
+ `),enumerable:i.debug},query:{value:v.string,enumerable:i.debug},parameters:{value:v.parameters,enumerable:i.debug},args:{value:v.args,enumerable:i.debug},types:{value:v.statement&&v.statement.types,enumerable:i.debug}}),v.reject(G)}function O1(){return Yp||(!uo.reserved&&p(uo),!uo.reserved&&!zo&&!y&&M.length===0?(Nx(),new Promise((v)=>Q&&Q.readyState!=="closed"?Q.once("close",v):v())):Yp=new Promise((v)=>Vn=v))}function Nx(){if(Mo=!0,fo||y||zo||M.length)Ec(xo.connection("CONNECTION_DESTROYED",i));if(clearImmediate(bi),Q)Q.removeListener("data",E1),Q.removeListener("connect",Sc),Q.readyState==="open"&&Q.end(g().X().end());Vn&&(Vn(),Yp=Vn=null)}async function TA(v){if(mi=Buffer.alloc(0),Yi=0,Di=null,clearImmediate(bi),Q.removeListener("data",E1),Q.removeListener("connect",Sc),S.cancel(),C.cancel(),q.cancel(),Q.removeAllListeners(),Q=null,zo)return xA();!v&&(y||M.length)&&Ec(xo.connection("CONNECTION_CLOSED",i,Q)),k=$Y.now(),v&&i.shared.retries++,yi=(typeof z==="function"?z(i.shared.retries):z)*1000,c(uo,xo.connection("CONNECTION_CLOSED",i,Q))}function lY(v,G=v[0]){(G===68?qY:G===100?YG:G===65?AG:G===83?kY:G===90?hY:G===67?gY:G===50?mA:G===49?sY:G===116?tY:G===84?dY:G===82?rY:G===110?cG:G===75?xG:G===69?$G:G===115?vG:G===51?wG:G===71?XG:G===78?KG:G===72?WG:G===99?GG:G===73?HG:G===86?UG:G===118?ZG:G===87?RG:MG)(v)}function qY(v){let G=7,s,Gi,gi,Qo=y.isRaw?new Array(y.statement.columns.length):{};for(let Bo=0;Bo<y.statement.columns.length;Bo++)Gi=y.statement.columns[Bo],s=v.readInt32BE(G),G+=4,gi=s===-1?null:y.isRaw===!0?v.subarray(G,G+=s):Gi.parser===void 0?v.toString("utf8",G,G+=s):Gi.parser.array===!0?Gi.parser(v.toString("utf8",G+1,G+=s)):Gi.parser(v.toString("utf8",G,G+=s)),y.isRaw?Qo[Bo]=y.isRaw===!0?gi:A.value.from?A.value.from(gi,Gi):gi:Qo[Gi.name]=A.value.from?A.value.from(gi,Gi):gi;y.forEachFn?y.forEachFn(A.row.from?A.row.from(Qo):Qo,l):l[no++]=A.row.from?A.row.from(Qo):Qo}function kY(v){let[G,s]=v.toString("utf8",5,v.length-1).split(g.N);if(To[G]=s,i.parameters[G]!==s)i.parameters[G]=s,R&&R(G,s)}function hY(v){if(y&&y.options.simple&&y.resolve(Qn||l),y=Qn=null,l=new uc,q.cancel(),zo){if(b){if(!To.in_hot_standby||!To.default_transaction_read_only)return FG();else if(fG(b,To))return Nx()}if(Ei)return zo===!0&&(zo=null),TG();zo!==!0&&Bx(zo),i.shared.retries=mo=0,zo=null;return}while(M.length&&(y=M.shift())&&(y.active=!0,y.cancelled))vY(i).cancel(y.state,y.cancelled.resolve,y.cancelled.reject);if(y)return;uo.reserved?!uo.reserved.release&&v[5]===73?Yp?Nx():(uo.reserved=null,n(uo)):uo.reserved():Yp?Nx():n(uo)}function gY(v){no=0;for(let G=v.length-1;G>0;G--){if(v[G]===32&&v[G+1]<58&&l.count===null)l.count=+v.toString("utf8",G+1,v.length-1);if(v[G-1]>=65){l.command=v.toString("utf8",5,G),l.state=E;break}}if(Ix&&(Ix(),Ix=null),l.command==="BEGIN"&&T!==1&&!uo.reserved)return an(xo.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(y.options.simple)return mA();if(y.cursorFn)l.count&&y.cursorFn(l),Ko(kp);y.resolve(l)}function sY(){y.parsing=!1}function mA(){!l.statement&&(l.statement=y.statement),l.columns=y.statement.columns}function tY(v){let G=v.readUInt16BE(5);for(let s=0;s<G;++s)!y.statement.types[s]&&(y.statement.types[s]=v.readUInt32BE(7+s*4));y.prepare&&(lo[y.signature]=y.statement),y.describeFirst&&!y.onlyDescribe&&(Ko(fm(y)),y.describeFirst=!1)}function dY(v){if(l.command)Qn=Qn||[l],Qn.push(l=new uc),l.count=null,y.statement.columns=null;let G=v.readUInt16BE(5),s=7,Gi;y.statement.columns=Array(G);for(let gi=0;gi<G;++gi){Gi=s;while(v[s++]!==0);let Qo=v.readUInt32BE(s),Bo=v.readUInt16BE(s+4),Gp=v.readUInt32BE(s+6);y.statement.columns[gi]={name:A.column.from?A.column.from(v.toString("utf8",Gi,s-1)):v.toString("utf8",Gi,s-1),parser:J[Gp],table:Qo,number:Bo,type:Gp},s+=18}if(l.statement=y.statement,y.onlyDescribe)return y.resolve(y.statement),Ko(kp)}async function rY(v,G=v.readUInt32BE(5)){(G===3?eY:G===5?iG:G===10?oG:G===11?nG:G===12?pG:G!==0?zG:_x)(v,G)}async function eY(){let v=await _1();Ko(g().p().str(v).z(1).end())}async function iG(v){let G="md5"+await AY(Buffer.concat([Buffer.from(await AY(await _1()+m)),v.subarray(9)]));Ko(g().p().str(G).z(1).end())}async function oG(){Pn=(await nm.randomBytes(18)).toString("base64"),g().p().str("SCRAM-SHA-256"+g.N);let v=g.i;Ko(g.inc(4).str("n,,n=*,r="+Pn).i32(g.i-v-4,v).end())}async function nG(v){let G=v.toString("utf8",9).split(",").reduce((Bo,Gp)=>(Bo[Gp[0]]=Gp.slice(2),Bo),{}),s=await nm.pbkdf2Sync(await _1(),Buffer.from(G.s,"base64"),parseInt(G.i),32,"sha256"),Gi=await Y1(s,"Client Key"),gi="n=*,r="+Pn+",r="+G.r+",s="+G.s+",i="+G.i+",c=biws,r="+G.r;qi=(await Y1(await Y1(s,"Server Key"),gi)).toString("base64");let Qo="c=biws,r="+G.r+",p="+ZE(Gi,Buffer.from(await Y1(await UE(Gi),gi))).toString("base64");Ko(g().p().str(Qo).end())}function pG(v){if(v.toString("utf8",9).split(g.N,1)[0].slice(2)===qi)return;an(xo.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),Q.destroy()}function _1(){return Promise.resolve(typeof i.pass==="function"?i.pass():i.pass)}function cG(){if(l.statement=y.statement,l.statement.columns=[],y.onlyDescribe)return y.resolve(y.statement),Ko(kp)}function xG(v){E.pid=v.readUInt32BE(5),E.secret=v.readUInt32BE(9)}async function TG(){Ei=!1,(await new un([`
100
100
  select b.oid, b.typarray
101
101
  from pg_catalog.pg_type a
102
102
  left join pg_catalog.pg_type b on b.oid = a.typelem
103
103
  where a.typcategory = 'A'
104
104
  group by b.oid, b.typarray
105
105
  order by b.oid
106
- `],[],Rf)).forEach(({oid:C,typarray:d})=>xW(C,d))}function xW(p,C){if(!!H.parsers[C]&&!!H.serializers[C])return;let d=H.parsers[p];H.shared.typeArrayMap[p]=C,H.parsers[C]=(GH)=>x_(GH,d,C),H.parsers[C].array=!0,H.serializers[C]=(GH)=>c_(GH,H.serializers[p],H,C)}function UW(p,C){return p==="read-write"&&C.default_transaction_read_only==="on"||p==="read-only"&&C.default_transaction_read_only==="off"||p==="primary"&&C.in_hot_standby==="on"||p==="standby"&&C.in_hot_standby==="off"||p==="prefer-standby"&&C.in_hot_standby==="off"&&H.host[MA]}function CW(){let p=new PL([`
106
+ `],[],Bx)).forEach(({oid:G,typarray:s})=>mG(G,s))}function mG(v,G){if(!!i.parsers[G]&&!!i.serializers[G])return;let s=i.parsers[v];i.shared.typeArrayMap[v]=G,i.parsers[G]=(Gi)=>mY(Gi,s,G),i.parsers[G].array=!0,i.serializers[G]=(Gi)=>TY(Gi,i.serializers[v],i,G)}function fG(v,G){return v==="read-write"&&G.default_transaction_read_only==="on"||v==="read-only"&&G.default_transaction_read_only==="off"||v==="primary"&&G.in_hot_standby==="on"||v==="standby"&&G.in_hot_standby==="off"||v==="prefer-standby"&&G.in_hot_standby==="off"&&i.host[mo]}function FG(){let v=new un([`
107
107
  show transaction_read_only;
108
108
  select pg_catalog.pg_is_in_recovery()
109
- `],[],Rf,null,{simple:!0});p.resolve=([[C],[d]])=>{DA.default_transaction_read_only=C.transaction_read_only,DA.in_hot_standby=d.pg_is_in_recovery?"on":"off"},p.execute()}function TW(p){l&&(l.cursorFn||l.describeFirst)&&GA(rI);let C=EA.postgres(Oi(p));l&&l.retried?zL(l.retried):l&&l.prepared&&da.has(C.routine)?GW(l,C):zL(C)}function GW(p,C){delete ZA[p.signature],p.retried=C,Rf(p)}function FW(p){if(!U)return;let C=9;while(p[C++]!==0);U(p.toString("utf8",9,C-1),p.toString("utf8",C,p.length-1))}async function _W(){try{let p=await Promise.resolve(l.cursorFn(Z));IA=0,p===Kf?GA(NW(l.portal)):(Z=new X$,GA(np("",l.cursorRows)))}catch(p){GA(rI),l.reject(p)}}function WW(){Z.count&&l.cursorFn(Z),l.resolve(Z)}function mW(){oA=new li.Writable({autoDestroy:!0,write(p,C,d){X.write(k().d().raw(p).end(),d)},destroy(p,C){C(p),X.write(k().f().str(p+k.N).end()),oA=null},final(p){X.write(k().c().end()),yf=p}}),l.resolve(oA)}function PW(){oA=new li.Readable({read(){X.resume()}}),l.resolve(oA)}function XW(){oA=new li.Duplex({autoDestroy:!0,read(){X.resume()},write(p,C,d){X.write(k().d().raw(p).end(),d)},destroy(p,C){C(p),X.write(k().f().str(p+k.N).end()),oA=null},final(p){X.write(k().c().end()),yf=p}}),l.resolve(oA)}function SW(p){oA&&(oA.push(p.subarray(5))||X.pause())}function JW(){oA&&oA.push(null),oA=null}function VW(p){B?B(Oi(p)):console.log(Oi(p))}function wW(){}function KW(){zL(EA.notSupported("FunctionCallResponse"))}function vW(){zL(EA.notSupported("NegotiateProtocolVersion"))}function aW(p){console.error("Postgres.js : Unknown Message:",p[0])}function lW(p,C){console.error("Postgres.js : Unknown Auth:",C)}function OW(p,C,d="",GH=""){let kH,SA;return k().B().str(GH+k.N).str(d+k.N).i16(0).i16(p.length),p.forEach((yA,CI)=>{if(yA===null)return k.i32(4294967295);SA=C[CI],p[CI]=yA=SA in H.serializers?H.serializers[SA](yA):""+yA,kH=k.i,k.inc(4).str(yA).i32(k.i-kH-4,kH)}),k.i16(0),k.end()}function pp(p,C,d,GH=""){return k().P().str(GH+k.N).str(p+k.N).i16(C.length),C.forEach((kH,SA)=>k.i32(d[SA]||0)),k.end()}function sW(p,C=""){return k().D().str(p).str(C+k.N).end()}function np(p="",C=0){return Buffer.concat([k().E().str(p+k.N).i32(C).end(),G_])}function NW(p=""){return Buffer.concat([k().C().str("P").str(p+k.N).end(),k().S().end()])}function yW(){return MH||k().inc(4).i16(3).z(2).str(Object.entries(Object.assign({user:D,database:u,client_encoding:"UTF8"},H.connection)).filter(([,p])=>p).map(([p,C])=>p+k.N+C).join(k.N)).z(2).end(0)}}function Oi(H){let A={},L=5;for(let I=5;I<H.length-1;I++)if(H[I]===0)A[qa[H[L]]]=H.toString("utf8",L+1,I),L=I+1;return A}function F_(H){return $D.createHash("md5").update(H).digest("hex")}function G1(H,A){return $D.createHmac("sha256",H).update(A).digest()}function ga(H){return $D.createHash("sha256").update(H).digest()}function ea(H,A){let L=Math.max(H.length,A.length),I=Buffer.allocUnsafe(L);for(let $=0;$<L;$++)I[$]=H[$]^A[$];return I}function si(H,A){if(A=typeof A==="function"?A():A,!A)return{cancel:af,start:af};let L;return{cancel(){L&&(clearTimeout(L),L=null)},start(){L&&clearTimeout(L),L=setTimeout(I,A*1000,arguments)}};function I($){H.apply(null,$),L=null}}var W_=()=>{};function yi(H,A){let L=new Map,I="postgresjs_"+Math.random().toString(36).slice(2),$={},f,E,D=!1,M=t.sql=H({...A,transform:{column:{},value:{},row:{}},max:1,fetch_types:!1,idle_timeout:null,max_lifetime:null,connection:{...A.connection,replication:"database"},onclose:async function(){if(D)return;E=null,$.pid=$.secret=void 0,i(await B(M,I,A.publications)),L.forEach((x)=>x.forEach(({onsubscribe:T})=>T()))},no_subscribe:!0}),o=M.end,u=M.close;return M.end=async()=>{return D=!0,E&&await new Promise((x)=>(E.once("close",x),E.end())),o()},M.close=async()=>{return E&&await new Promise((x)=>(E.once("close",x),E.end())),u()},t;async function t(x,T,F=W_,m=W_){if(x=Ll(x),!f)f=B(M,I,A.publications);let Y={fn:T,onsubscribe:F},W=L.has(x)?L.get(x).add(Y):L.set(x,new Set([Y])).get(x),P=()=>{W.delete(Y),W.size===0&&L.delete(x)};return f.then((V)=>{return i(V),F(),E&&E.on("error",m),{unsubscribe:P,state:$,sql:M}})}function i(x){E=x.stream,$.pid=x.state.pid,$.secret=x.state.secret}async function B(x,T,F){if(!F)throw new Error("Missing publication names");let m=await x.unsafe(`CREATE_REPLICATION_SLOT ${T} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`),[Y]=m,W=await x.unsafe(`START_REPLICATION SLOT ${T} LOGICAL ${Y.consistent_point} (proto_version '1', publication_names '${F}')`).writable(),P={lsn:Buffer.concat(Y.consistent_point.split("/").map((X)=>Buffer.from(("00000000"+X).slice(-8),"hex")))};return W.on("data",J),W.on("error",V),W.on("close",x.close),{stream:W,state:m.state};function V(X){console.error("Unexpected error during logical streaming - reconnecting",X)}function J(X){if(X[0]===119)Al(X.subarray(25),P,x.options.parsers,a,A.transform);else if(X[0]===107&&X[17])P.lsn=X.subarray(1,9),h()}function a(X,MH){let Z=MH.relation.schema+"."+MH.relation.table;U("*",X,MH),U("*:"+Z,X,MH),MH.relation.keys.length&&U("*:"+Z+"="+MH.relation.keys.map((oH)=>X[oH.name]),X,MH),U(MH.command,X,MH),U(MH.command+":"+Z,X,MH),MH.relation.keys.length&&U(MH.command+":"+Z+"="+MH.relation.keys.map((oH)=>X[oH.name]),X,MH)}function h(){let X=Buffer.alloc(34);X[0]=114,X.fill(P.lsn,1),X.writeBigInt64BE(BigInt(Date.now()-Date.UTC(2000,0,1))*BigInt(1000),25),W.write(X)}}function U(x,T,F){L.has(x)&&L.get(x).forEach(({fn:m})=>m(T,F,x))}}function Hl(H){return new Date(Date.UTC(2000,0,1)+Number(H/BigInt(1000)))}function Al(H,A,L,I,$){let f=(E,[D,M])=>(E[D.charCodeAt(0)]=M,E);Object.entries({R:(E)=>{let D=1,M=A[E.readUInt32BE(D)]={schema:E.toString("utf8",D+=4,D=E.indexOf(0,D))||"pg_catalog",table:E.toString("utf8",D+1,D=E.indexOf(0,D+1)),columns:Array(E.readUInt16BE(D+=2)),keys:[]};D+=2;let o=0,u;while(D<E.length)u=M.columns[o++]={key:E[D++],name:$.column.from?$.column.from(E.toString("utf8",D,D=E.indexOf(0,D))):E.toString("utf8",D,D=E.indexOf(0,D)),type:E.readUInt32BE(D+=1),parser:L[E.readUInt32BE(D)],atttypmod:E.readUInt32BE(D+=4)},u.key&&M.keys.push(u),D+=4},Y:()=>{},O:()=>{},B:(E)=>{A.date=Hl(E.readBigInt64BE(9)),A.lsn=E.subarray(1,9)},I:(E)=>{let D=1,M=A[E.readUInt32BE(D)],{row:o}=F1(E,M.columns,D+=7,$);I(o,{command:"insert",relation:M})},D:(E)=>{let D=1,M=A[E.readUInt32BE(D)];D+=4;let o=E[D]===75;I(o||E[D]===79?F1(E,M.columns,D+=3,$).row:null,{command:"delete",relation:M,key:o})},U:(E)=>{let D=1,M=A[E.readUInt32BE(D)];D+=4;let o=E[D]===75,u=o||E[D]===79?F1(E,M.columns,D+=3,$):null;u&&(D=u.i);let{row:t}=F1(E,M.columns,D+3,$);I(t,{command:"update",relation:M,key:o,old:u&&u.row})},T:()=>{},C:()=>{}}).reduce(f,{})[H[0]](H)}function F1(H,A,L,I){let $,f,E,D=I.raw?new Array(A.length):{};for(let M=0;M<A.length;M++)$=H[L++],f=A[M],E=$===110?null:$===117?void 0:f.parser===void 0?H.toString("utf8",L+4,L+=4+H.readUInt32BE(L)):f.parser.array===!0?f.parser(H.toString("utf8",L+5,L+=4+H.readUInt32BE(L))):f.parser(H.toString("utf8",L+4,L+=4+H.readUInt32BE(L))),I.raw?D[M]=I.raw===!0?E:I.value.from?I.value.from(E,f):E:D[f.name]=I.value.from?I.value.from(E,f):E;return{i:L,row:I.row.from?I.row.from(D):D}}function Ll(H){let A=H.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i)||[];if(!A)throw new Error("Malformed subscribe pattern: "+H);let[,L,I,$]=A;return(L||"*")+(I?":"+(I.indexOf(".")===-1?"public."+I:I):"")+($?"="+$:"")}import m_ from"stream";function Ri(H,A,L=393216){return new Promise(async(I,$)=>{await H.begin(async(f)=>{let E;!A&&([{oid:A}]=await f`select lo_creat(-1) as oid`);let[{fd:D}]=await f`select lo_open(${A}, ${L}) as fd`,M={writable:u,readable:o,close:()=>f`select lo_close(${D})`.then(E),tell:()=>f`select lo_tell64(${D})`,read:(t)=>f`select loread(${D}, ${t}) as data`,write:(t)=>f`select lowrite(${D}, ${t})`,truncate:(t)=>f`select lo_truncate64(${D}, ${t})`,seek:(t,i=0)=>f`select lo_lseek64(${D}, ${t}, ${i})`,size:()=>f`
109
+ `],[],Bx,null,{simple:!0});v.resolve=([[G],[s]])=>{To.default_transaction_read_only=G.transaction_read_only,To.in_hot_standby=s.pg_is_in_recovery?"on":"off"},v.execute()}function $G(v){y&&(y.cursorFn||y.describeFirst)&&Ko(kp);let G=xo.postgres(OJ(v));y&&y.retried?an(y.retried):y&&y.prepared&&KE.has(G.routine)?JG(y,G):an(G)}function JG(v,G){delete lo[v.signature],v.retried=G,Bx(v)}function AG(v){if(!Y)return;let G=9;while(v[G++]!==0);Y(v.toString("utf8",9,G-1),v.toString("utf8",G,v.length-1))}async function vG(){try{let v=await Promise.resolve(y.cursorFn(l));no=0,v===Ex?Ko(VG(y.portal)):(l=new uc,Ko(FA("",y.cursorRows)))}catch(v){Ko(kp),y.reject(v)}}function wG(){l.count&&y.cursorFn(l),y.resolve(l)}function XG(){fo=new EJ.Writable({autoDestroy:!0,write(v,G,s){Q.write(g().d().raw(v).end(),s)},destroy(v,G){G(v),Q.write(g().f().str(v+g.N).end()),fo=null},final(v){Q.write(g().c().end()),Ix=v}}),y.resolve(fo)}function WG(){fo=new EJ.Readable({read(){Q.resume()}}),y.resolve(fo)}function RG(){fo=new EJ.Duplex({autoDestroy:!0,read(){Q.resume()},write(v,G,s){Q.write(g().d().raw(v).end(),s)},destroy(v,G){G(v),Q.write(g().f().str(v+g.N).end()),fo=null},final(v){Q.write(g().c().end()),Ix=v}}),y.resolve(fo)}function YG(v){fo&&(fo.push(v.subarray(5))||Q.pause())}function GG(){fo&&fo.push(null),fo=null}function KG(v){X?X(OJ(v)):console.log(OJ(v))}function HG(){}function UG(){an(xo.notSupported("FunctionCallResponse"))}function ZG(){an(xo.notSupported("NegotiateProtocolVersion"))}function MG(v){console.error("Postgres.js : Unknown Message:",v[0])}function zG(v,G){console.error("Postgres.js : Unknown Auth:",G)}function uG(v,G,s="",Gi=""){let gi,Qo;return g().B().str(Gi+g.N).str(s+g.N).i16(0).i16(v.length),v.forEach((Bo,Gp)=>{if(Bo===null)return g.i32(4294967295);Qo=G[Gp],v[Gp]=Bo=Qo in i.serializers?i.serializers[Qo](Bo):""+Bo,gi=g.i,g.inc(4).str(Bo).i32(g.i-gi-4,gi)}),g.i16(0),g.end()}function fA(v,G,s,Gi=""){return g().P().str(Gi+g.N).str(v+g.N).i16(G.length),G.forEach((gi,Qo)=>g.i32(s[Qo]||0)),g.end()}function QG(v,G=""){return g().D().str(v).str(G+g.N).end()}function FA(v="",G=0){return Buffer.concat([g().E().str(v+g.N).i32(G).end(),JY])}function VG(v=""){return Buffer.concat([g().C().str("P").str(v+g.N).end(),g().S().end()])}function SG(){return Ti||g().inc(4).i16(3).z(2).str(Object.entries(Object.assign({user:m,database:$,client_encoding:"UTF8"},i.connection)).filter(([,v])=>v).map(([v,G])=>v+g.N+G).join(g.N)).z(2).end(0)}}function OJ(i){let o={},n=5;for(let p=5;p<i.length-1;p++)if(i[p]===0)o[HE[i[n]]]=i.toString("utf8",n+1,p),n=p+1;return o}function AY(i){return nm.createHash("md5").update(i).digest("hex")}function Y1(i,o){return nm.createHmac("sha256",i).update(o).digest()}function UE(i){return nm.createHash("sha256").update(i).digest()}function ZE(i,o){let n=Math.max(i.length,o.length),p=Buffer.allocUnsafe(n);for(let c=0;c<n;c++)p[c]=i[c]^o[c];return p}function _J(i,o){if(o=typeof o==="function"?o():o,!o)return{cancel:_x,start:_x};let n;return{cancel(){n&&(clearTimeout(n),n=null)},start(){n&&clearTimeout(n),n=setTimeout(p,o*1000,arguments)}};function p(c){i.apply(null,c),n=null}}var wY=()=>{};function CJ(i,o){let n=new Map,p="postgresjs_"+Math.random().toString(36).slice(2),c={},x,T,m=!1,f=J.sql=i({...o,transform:{column:{},value:{},row:{}},max:1,fetch_types:!1,idle_timeout:null,max_lifetime:null,connection:{...o.connection,replication:"database"},onclose:async function(){if(m)return;T=null,c.pid=c.secret=void 0,A(await X(f,p,o.publications)),n.forEach((R)=>R.forEach(({onsubscribe:K})=>K()))},no_subscribe:!0}),F=f.end,$=f.close;return f.end=async()=>{return m=!0,T&&await new Promise((R)=>(T.once("close",R),T.end())),F()},f.close=async()=>{return T&&await new Promise((R)=>(T.once("close",R),T.end())),$()},J;async function J(R,K,U=wY,z=wY){if(R=uE(R),!x)x=X(f,p,o.publications);let b={fn:K,onsubscribe:U},M=n.has(R)?n.get(R).add(b):n.set(R,new Set([b])).get(R),u=()=>{M.delete(b),M.size===0&&n.delete(R)};return x.then((E)=>{return A(E),U(),T&&T.on("error",z),{unsubscribe:u,state:c,sql:f}})}function A(R){T=R.stream,c.pid=R.state.pid,c.secret=R.state.secret}async function X(R,K,U){if(!U)throw new Error("Missing publication names");let z=await R.unsafe(`CREATE_REPLICATION_SLOT ${K} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`),[b]=z,M=await R.unsafe(`START_REPLICATION SLOT ${K} LOGICAL ${b.consistent_point} (proto_version '1', publication_names '${U}')`).writable(),u={lsn:Buffer.concat(b.consistent_point.split("/").map((Q)=>Buffer.from(("00000000"+Q).slice(-8),"hex")))};return M.on("data",S),M.on("error",E),M.on("close",R.close),{stream:M,state:z.state};function E(Q){console.error("Unexpected error during logical streaming - reconnecting",Q)}function S(Q){if(Q[0]===119)zE(Q.subarray(25),u,R.options.parsers,C,o.transform);else if(Q[0]===107&&Q[17])u.lsn=Q.subarray(1,9),q()}function C(Q,Ti){let l=Ti.relation.schema+"."+Ti.relation.table;Y("*",Q,Ti),Y("*:"+l,Q,Ti),Ti.relation.keys.length&&Y("*:"+l+"="+Ti.relation.keys.map((mi)=>Q[mi.name]),Q,Ti),Y(Ti.command,Q,Ti),Y(Ti.command+":"+l,Q,Ti),Ti.relation.keys.length&&Y(Ti.command+":"+l+"="+Ti.relation.keys.map((mi)=>Q[mi.name]),Q,Ti)}function q(){let Q=Buffer.alloc(34);Q[0]=114,Q.fill(u.lsn,1),Q.writeBigInt64BE(BigInt(Date.now()-Date.UTC(2000,0,1))*BigInt(1000),25),M.write(Q)}}function Y(R,K,U){n.has(R)&&n.get(R).forEach(({fn:z})=>z(K,U,R))}}function ME(i){return new Date(Date.UTC(2000,0,1)+Number(i/BigInt(1000)))}function zE(i,o,n,p,c){let x=(T,[m,f])=>(T[m.charCodeAt(0)]=f,T);Object.entries({R:(T)=>{let m=1,f=o[T.readUInt32BE(m)]={schema:T.toString("utf8",m+=4,m=T.indexOf(0,m))||"pg_catalog",table:T.toString("utf8",m+1,m=T.indexOf(0,m+1)),columns:Array(T.readUInt16BE(m+=2)),keys:[]};m+=2;let F=0,$;while(m<T.length)$=f.columns[F++]={key:T[m++],name:c.column.from?c.column.from(T.toString("utf8",m,m=T.indexOf(0,m))):T.toString("utf8",m,m=T.indexOf(0,m)),type:T.readUInt32BE(m+=1),parser:n[T.readUInt32BE(m)],atttypmod:T.readUInt32BE(m+=4)},$.key&&f.keys.push($),m+=4},Y:()=>{},O:()=>{},B:(T)=>{o.date=ME(T.readBigInt64BE(9)),o.lsn=T.subarray(1,9)},I:(T)=>{let m=1,f=o[T.readUInt32BE(m)],{row:F}=G1(T,f.columns,m+=7,c);p(F,{command:"insert",relation:f})},D:(T)=>{let m=1,f=o[T.readUInt32BE(m)];m+=4;let F=T[m]===75;p(F||T[m]===79?G1(T,f.columns,m+=3,c).row:null,{command:"delete",relation:f,key:F})},U:(T)=>{let m=1,f=o[T.readUInt32BE(m)];m+=4;let F=T[m]===75,$=F||T[m]===79?G1(T,f.columns,m+=3,c):null;$&&(m=$.i);let{row:J}=G1(T,f.columns,m+3,c);p(J,{command:"update",relation:f,key:F,old:$&&$.row})},T:()=>{},C:()=>{}}).reduce(x,{})[i[0]](i)}function G1(i,o,n,p){let c,x,T,m=p.raw?new Array(o.length):{};for(let f=0;f<o.length;f++)c=i[n++],x=o[f],T=c===110?null:c===117?void 0:x.parser===void 0?i.toString("utf8",n+4,n+=4+i.readUInt32BE(n)):x.parser.array===!0?x.parser(i.toString("utf8",n+5,n+=4+i.readUInt32BE(n))):x.parser(i.toString("utf8",n+4,n+=4+i.readUInt32BE(n))),p.raw?m[f]=p.raw===!0?T:p.value.from?p.value.from(T,x):T:m[x.name]=p.value.from?p.value.from(T,x):T;return{i:n,row:p.row.from?p.row.from(m):m}}function uE(i){let o=i.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i)||[];if(!o)throw new Error("Malformed subscribe pattern: "+i);let[,n,p,c]=o;return(n||"*")+(p?":"+(p.indexOf(".")===-1?"public."+p:p):"")+(c?"="+c:"")}import XY from"stream";function yJ(i,o,n=393216){return new Promise(async(p,c)=>{await i.begin(async(x)=>{let T;!o&&([{oid:o}]=await x`select lo_creat(-1) as oid`);let[{fd:m}]=await x`select lo_open(${o}, ${n}) as fd`,f={writable:$,readable:F,close:()=>x`select lo_close(${m})`.then(T),tell:()=>x`select lo_tell64(${m})`,read:(J)=>x`select loread(${m}, ${J}) as data`,write:(J)=>x`select lowrite(${m}, ${J})`,truncate:(J)=>x`select lo_truncate64(${m}, ${J})`,seek:(J,A=0)=>x`select lo_lseek64(${m}, ${J}, ${A})`,size:()=>x`
110
110
  select
111
- lo_lseek64(${D}, location, 0) as position,
111
+ lo_lseek64(${m}, location, 0) as position,
112
112
  seek.size
113
113
  from (
114
114
  select
@@ -116,10 +116,10 @@ ${E.trace}`:"No previous disposal trace was found."),I.type){case"atom_family":c
116
116
  tell.location
117
117
  from (select lo_tell64($1) as location) tell
118
118
  ) seek
119
- `};return I(M),new Promise(async(t)=>E=t);async function o({highWaterMark:t=16384,start:i=0,end:B=1/0}={}){let U=B-i;return i&&await M.seek(i),new m_.Readable({highWaterMark:t,async read(x){let T=x>U?x-U:x;U-=x;let[{data:F}]=await M.read(T);if(this.push(F),F.length<x)this.push(null)}})}async function u({highWaterMark:t=16384,start:i=0}={}){return i&&await M.seek(i),new m_.Writable({highWaterMark:t,write(B,U,x){M.write(B).then(()=>x(),x)}})}}).catch($)})}Object.assign(_1,{PostgresError:vf,toPascal:m$,pascal:vi,toCamel:W$,camel:Ki,toKebab:P$,kebab:ai,fromPascal:AD,fromCamel:HD,fromKebab:LD,BigInt:{to:20,from:[20],parse:(H)=>BigInt(H),serialize:(H)=>H.toString()}});var lf=_1;function _1(H,A){let L=fl(H,A),I=L.no_subscribe||yi(_1,{...L}),$=!1,f=tL(),E=tL(),D=tL(),M=tL(),o=tL(),u=tL(),t=tL(),i=tL(),B={connecting:E,reserved:D,closed:M,ended:o,open:u,busy:t,full:i},U=[...Array(L.max)].map(()=>Ni(L,B,{onopen:ZA,onend:DA,onclose:HI})),x=T(a);return Object.assign(x,{get parameters(){return L.parameters},largeObject:Ri.bind(null,x),subscribe:I,CLOSE:Kf,END:Kf,PostgresError:vf,options:L,reserve:Y,listen:F,begin:W,close:Z,end:MH}),x;function T(w){return w.debug=L.debug,Object.entries(L.types).reduce((tH,[OH,IA])=>{return tH[OH]=(hH)=>new eL(hH,IA.to),tH},r),Object.assign(TH,{types:r,typed:r,unsafe:bH,notify:m,array:J,json:V,file:MA}),TH;function r(tH,OH){return new eL(tH,OH)}function TH(tH,...OH){return tH&&Array.isArray(tH.raw)?new PL(tH,OH,w,X):typeof tH==="string"&&!OH.length?new ID(L.transform.column.to?L.transform.column.to(tH):tH):new x1(tH,OH)}function bH(tH,OH=[],IA={}){return arguments.length===2&&!Array.isArray(OH)&&(IA=OH,OH=[]),new PL([tH],OH,w,X,{prepare:!1,...IA,simple:"simple"in IA?IA.simple:OH.length===0})}function MA(tH,OH=[],IA={}){return arguments.length===2&&!Array.isArray(OH)&&(IA=OH,OH=[]),new PL([],OH,(YH)=>{$l.readFile(tH,"utf8",(mA,sH)=>{if(mA)return YH.reject(mA);YH.strings=[sH],w(YH)})},X,{...IA,simple:"simple"in IA?IA.simple:OH.length===0})}}async function F(w,r,TH){let bH={fn:r,onlisten:TH},MA=F.sql||(F.sql=_1({...L,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(F.channels).forEach(([YH,{listeners:mA}])=>{delete F.channels[YH],Promise.all(mA.map((sH)=>F(YH,sH.fn,sH.onlisten).catch(()=>{})))})},onnotify(YH,mA){YH in F.channels&&F.channels[YH].listeners.forEach((sH)=>sH.fn(mA))}})),tH=F.channels||(F.channels={});if(w in tH){tH[w].listeners.push(bH);let YH=await tH[w].result;return bH.onlisten&&bH.onlisten(),{state:YH.state,unlisten:hH}}tH[w]={result:MA`listen ${MA.unsafe('"'+w.replace(/"/g,'""')+'"')}`,listeners:[bH]};let IA=await tH[w].result;return bH.onlisten&&bH.onlisten(),{state:IA.state,unlisten:hH};async function hH(){if(w in tH===!1)return;if(tH[w].listeners=tH[w].listeners.filter((YH)=>YH!==bH),tH[w].listeners.length)return;return delete tH[w],MA`unlisten ${MA.unsafe('"'+w.replace(/"/g,'""')+'"')}`}}async function m(w,r){return await x`select pg_notify(${w}, ${""+r})`}async function Y(){let w=tL(),r=u.length?u.shift():await new Promise((MA)=>{f.push({reserve:MA}),M.length&&wH(M.shift())});P(r,D),r.reserved=()=>w.length?r.execute(w.shift()):P(r,D),r.reserved.release=!0;let TH=T(bH);return TH.release=()=>{r.reserved=null,ZA(r)},TH;function bH(MA){r.queue===i?w.push(MA):r.execute(MA)||P(r,i)}}async function W(w,r){!r&&(r=w,w="");let TH=tL(),bH=0,MA,tH=null;try{return await x.unsafe("begin "+w.replace(/[^a-z ]/ig,""),[],{onexecute:IA}).execute(),await Promise.race([OH(MA,r),new Promise((hH,YH)=>MA.onclose=YH)])}catch(hH){throw hH}async function OH(hH,YH,mA){let sH=T(oA);sH.savepoint=UI,sH.prepare=(QH)=>tH=QH.replace(/[^a-z0-9$-_. ]/gi);let XL,PA;mA&&await sH`savepoint ${sH(mA)}`;try{if(PA=await new Promise((QH,SL)=>{let QL=YH(sH);Promise.resolve(Array.isArray(QL)?Promise.all(QL):QL).then(QH,SL)}),XL)throw XL}catch(QH){throw await(mA?sH`rollback to ${sH(mA)}`:sH`rollback`),QH instanceof vf&&QH.code==="25P02"&&XL||QH}if(!mA)tH?await sH`prepare transaction '${sH.unsafe(tH)}'`:await sH`commit`;return PA;function UI(QH,SL){if(QH&&Array.isArray(QH.raw))return UI((QL)=>QL.apply(QL,arguments));return arguments.length===1&&(SL=QH,QH=null),OH(hH,SL,"s"+bH+++(QH?"_"+QH:""))}function oA(QH){QH.catch((SL)=>XL||(XL=SL)),hH.queue===i?TH.push(QH):hH.execute(QH)||P(hH,i)}}function IA(hH){MA=hH,P(hH,D),hH.reserved=()=>TH.length?hH.execute(TH.shift()):P(hH,D)}}function P(w,r){return w.queue.remove(w),r.push(w),w.queue=r,r===u?w.idleTimer.start():w.idleTimer.cancel(),w}function V(w){return new eL(w,3802)}function J(w,r){if(!Array.isArray(w))return J(Array.from(arguments));return new eL(w,r||(w.length?B1(w)||25:0),L.shared.typeArrayMap)}function a(w){if($)return w.reject(EA.connection("CONNECTION_ENDED",L,L));if(u.length)return h(u.shift(),w);if(M.length)return wH(M.shift(),w);t.length?h(t.shift(),w):f.push(w)}function h(w,r){return w.execute(r)?P(w,t):P(w,i)}function X(w){return new Promise((r,TH)=>{w.state?w.active?Ni(L).cancel(w.state,r,TH):w.cancelled={resolve:r,reject:TH}:(f.remove(w),w.cancelled=!0,w.reject(EA.generic("57014","canceling statement due to user request")),r())})}async function MH({timeout:w=null}={}){if($)return $;await 1;let r;return $=Promise.race([new Promise((TH)=>w!==null&&(r=setTimeout(oH,w*1000,TH))),Promise.all(U.map((TH)=>TH.end()).concat(F.sql?F.sql.end({timeout:0}):[],I.sql?I.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(r))}async function Z(){await Promise.all(U.map((w)=>w.end()))}async function oH(w){await Promise.all(U.map((r)=>r.terminate()));while(f.length)f.shift().reject(EA.connection("CONNECTION_DESTROYED",L));w()}function wH(w,r){return P(w,E),w.connect(r),w}function DA(w){P(w,o)}function ZA(w){if(f.length===0)return P(w,u);let r=Math.ceil(f.length/(E.length+1)),TH=!0;while(TH&&f.length&&r-- >0){let bH=f.shift();if(bH.reserve)return bH.reserve(w);TH=w.execute(bH)}TH?P(w,t):P(w,i)}function HI(w,r){P(w,M),w.reserved=null,w.onclose&&(w.onclose(r),w.onclose=null),L.onclose&&L.onclose(w.id),f.length&&wH(w,f.shift())}}function fl(H,A){if(H&&H.shared)return H;let L=process.env,I=(!H||typeof H==="string"?A:H)||{},{url:$,multihost:f}=ul(H),E=[...$.searchParams].reduce((i,[B,U])=>(i[B]=U,i),{}),D=I.hostname||I.host||f||$.hostname||L.PGHOST||"localhost",M=I.port||$.port||L.PGPORT||5432,o=I.user||I.username||$.username||L.PGUSERNAME||L.PGUSER||tl();I.no_prepare&&(I.prepare=!1),E.sslmode&&(E.ssl=E.sslmode,delete E.sslmode),"timeout"in I&&(console.log("The timeout option is deprecated, use idle_timeout instead"),I.idle_timeout=I.timeout),E.sslrootcert==="system"&&(E.ssl="verify-full");let u=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],t={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:Ml,max_pipeline:100,backoff:Dl,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(D)?D:D.split(",").map((i)=>i.split(":")[0]),port:Array.isArray(M)?M:D.split(",").map((i)=>parseInt(i.split(":")[1]||M)),path:I.path||D.indexOf("/")>-1&&D+"/.s.PGSQL."+M,database:I.database||I.db||($.pathname||"").slice(1)||L.PGDATABASE||o,user:o,pass:I.pass||I.password||$.password||L.PGPASSWORD||"",...Object.entries(t).reduce((i,[B,U])=>{let x=B in I?I[B]:(B in E)?E[B]==="disable"||E[B]==="false"?!1:E[B]:L["PG"+B.toUpperCase()]||U;return i[B]=typeof x==="string"&&u.includes(B)?+x:x,i},{}),connection:{application_name:"postgres.js",...I.connection,...Object.entries(E).reduce((i,[B,U])=>((B in t)||(i[B]=U),i),{})},types:I.types||{},target_session_attrs:El(I,$,L),onnotice:I.onnotice,onnotify:I.onnotify,onclose:I.onclose,onparameter:I.onparameter,socket:I.socket,transform:ol(I.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...n_(I.types)}}function El(H,A,L){let I=H.target_session_attrs||A.searchParams.get("target_session_attrs")||L.PGTARGETSESSIONATTRS;if(!I||["read-write","read-only","primary","standby","prefer-standby"].includes(I))return I;throw new Error("target_session_attrs "+I+" is not supported")}function Dl(H){return(0.5+Math.random()/2)*Math.min(3**H/100,20)}function Ml(){return 60*(30+Math.random()*30)}function ol(H){return{undefined:H.undefined,column:{from:typeof H.column==="function"?H.column:H.column&&H.column.from,to:H.column&&H.column.to},value:{from:typeof H.value==="function"?H.value:H.value&&H.value.from,to:H.value&&H.value.to},row:{from:typeof H.row==="function"?H.row:H.row&&H.row.from,to:H.row&&H.row.to}}}function ul(H){if(!H||typeof H!=="string")return{url:{searchParams:new Map}};let A=H;A=A.slice(A.indexOf("://")+3).split(/[?/]/)[0],A=decodeURIComponent(A.slice(A.indexOf("@")+1));let L=new URL(H.replace(A,A.split(",")[0]));return{url:{username:decodeURIComponent(L.username),password:decodeURIComponent(L.password),host:L.host,hostname:L.hostname,port:L.port,pathname:L.pathname,searchParams:L.searchParams},multihost:A.indexOf(",")>-1&&A}}function tl(){try{return Il.userInfo().username}catch(H){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class qH{static[n]="SelectionProxyHandler";config;constructor(H){this.config={...H}}get(H,A){if(A==="_")return{...H._,selectedFields:new Proxy(H._.selectedFields,this)};if(A===RH)return{...H[RH],selectedFields:new Proxy(H[RH].selectedFields,this)};if(typeof A==="symbol")return H[A];let I=(_(H,BA)?H._.selectedFields:_(H,gA)?H[RH].selectedFields:H)[A];if(_(I,R.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!I.isSelectionField)return I.sql;let $=I.clone();return $.isSelectionField=!0,$}if(_(I,R)){if(this.config.sqlBehavior==="sql")return I;throw new Error(`You tried to reference "${A}" 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(_(I,aH)){if(this.config.alias)return new Proxy(I,new xf(new Proxy(I.table,new YE(this.config.alias,this.config.replaceOriginalName??!1))));return I}if(typeof I!=="object"||I===null)return I;return new Proxy(I,new qH(this.config))}}class W1 extends QA{constructor(H,A,L,I){super();this.session=A,this.dialect=L,this.config={table:H,withList:I}}static[n]="PgDelete";config;where(H){return this.config.where=H,this}returning(H=this.config.table[y.Symbol.Columns]){return this.config.returningFields=H,this.config.returning=FL(H),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:H,...A}=this.dialect.sqlToQuery(this.getSQL());return A}_prepare(H){return lH.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,H,!0)})}prepare(H){return this._prepare(H)}authToken;setToken(H){return this.authToken=H,this}execute=(H)=>{return lH.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(H,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new qH({alias:UA(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}function il(H){return(H.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((L)=>L.toLowerCase()).join("_")}function pl(H){return(H.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((L,I,$)=>{let f=$===0?I.toLowerCase():`${I[0].toUpperCase()}${I.slice(1)}`;return L+f},"")}function nl(H){return H}class Yi{static[n]="CasingCache";cache={};cachedTables={};convert;constructor(H){this.convert=H==="snake_case"?il:H==="camelCase"?pl:nl}getColumnCasing(H){if(!H.keyAsName)return H.name;let A=H.table[y.Symbol.Schema]??"public",L=H.table[y.Symbol.OriginalName],I=`${A}.${L}.${H.name}`;if(!this.cache[I])this.cacheTable(H.table);return this.cache[I]}cacheTable(H){let A=H[y.Symbol.Schema]??"public",L=H[y.Symbol.OriginalName],I=`${A}.${L}`;if(!this.cachedTables[I]){for(let $ of Object.values(H[y.Symbol.Columns])){let f=`${I}.${$.name}`;this.cache[f]=this.convert($.name)}this.cachedTables[I]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class fD extends gA{static[n]="PgViewBase"}class S${static[n]="PgDialect";casing;constructor(H){this.casing=new Yi(H?.casing)}async migrate(H,A,L){let I=typeof L==="string"?"__drizzle_migrations":L.migrationsTable??"__drizzle_migrations",$=typeof L==="string"?"drizzle":L.migrationsSchema??"drizzle",f=c`
120
- CREATE TABLE IF NOT EXISTS ${c.identifier($)}.${c.identifier(I)} (
119
+ `};return p(f),new Promise(async(J)=>T=J);async function F({highWaterMark:J=16384,start:A=0,end:X=1/0}={}){let Y=X-A;return A&&await f.seek(A),new XY.Readable({highWaterMark:J,async read(R){let K=R>Y?R-Y:R;Y-=R;let[{data:U}]=await f.read(K);if(this.push(U),U.length<R)this.push(null)}})}async function $({highWaterMark:J=16384,start:A=0}={}){return A&&await f.seek(A),new XY.Writable({highWaterMark:J,write(X,Y,R){f.write(X).then(()=>R(),R)}})}}).catch(c)})}Object.assign(K1,{PostgresError:Ox,toPascal:Mc,pascal:VJ,toCamel:Zc,camel:QJ,toKebab:zc,kebab:SJ,fromPascal:eT,fromCamel:rT,fromKebab:im,BigInt:{to:20,from:[20],parse:(i)=>BigInt(i),serialize:(i)=>i.toString()}});var Lx=K1;function K1(i,o){let n=SE(i,o),p=n.no_subscribe||CJ(K1,{...n}),c=!1,x=Jn(),T=Jn(),m=Jn(),f=Jn(),F=Jn(),$=Jn(),J=Jn(),A=Jn(),X={connecting:T,reserved:m,closed:f,ended:F,open:$,busy:J,full:A},Y=[...Array(n.max)].map(()=>LJ(n,X,{onopen:lo,onend:To,onclose:ip})),R=K(C);return Object.assign(R,{get parameters(){return n.parameters},largeObject:yJ.bind(null,R),subscribe:p,CLOSE:Ex,END:Ex,PostgresError:Ox,options:n,reserve:b,listen:U,begin:M,close:l,end:Ti}),R;function K(O){return O.debug=n.debug,Object.entries(n.types).reduce((Fi,[yi,no])=>{return Fi[yi]=(qi)=>new en(qi,no.to),Fi},k),Object.assign(Yi,{types:k,typed:k,unsafe:ai,notify:z,array:S,json:E,file:mo}),Yi;function k(Fi,yi){return new en(Fi,yi)}function Yi(Fi,...yi){return Fi&&Array.isArray(Fi.raw)?new un(Fi,yi,O,Q):typeof Fi==="string"&&!yi.length?new om(n.transform.column.to?n.transform.column.to(Fi):Fi):new w1(Fi,yi)}function ai(Fi,yi=[],no={}){return arguments.length===2&&!Array.isArray(yi)&&(no=yi,yi=[]),new un([Fi],yi,O,Q,{prepare:!1,...no,simple:"simple"in no?no.simple:yi.length===0})}function mo(Fi,yi=[],no={}){return arguments.length===2&&!Array.isArray(yi)&&(no=yi,yi=[]),new un([],yi,(bi)=>{VE.readFile(Fi,"utf8",(Mo,Di)=>{if(Mo)return bi.reject(Mo);bi.strings=[Di],O(bi)})},Q,{...no,simple:"simple"in no?no.simple:yi.length===0})}}async function U(O,k,Yi){let ai={fn:k,onlisten:Yi},mo=U.sql||(U.sql=K1({...n,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(U.channels).forEach(([bi,{listeners:Mo}])=>{delete U.channels[bi],Promise.all(Mo.map((Di)=>U(bi,Di.fn,Di.onlisten).catch(()=>{})))})},onnotify(bi,Mo){bi in U.channels&&U.channels[bi].listeners.forEach((Di)=>Di.fn(Mo))}})),Fi=U.channels||(U.channels={});if(O in Fi){Fi[O].listeners.push(ai);let bi=await Fi[O].result;return ai.onlisten&&ai.onlisten(),{state:bi.state,unlisten:qi}}Fi[O]={result:mo`listen ${mo.unsafe('"'+O.replace(/"/g,'""')+'"')}`,listeners:[ai]};let no=await Fi[O].result;return ai.onlisten&&ai.onlisten(),{state:no.state,unlisten:qi};async function qi(){if(O in Fi===!1)return;if(Fi[O].listeners=Fi[O].listeners.filter((bi)=>bi!==ai),Fi[O].listeners.length)return;return delete Fi[O],mo`unlisten ${mo.unsafe('"'+O.replace(/"/g,'""')+'"')}`}}async function z(O,k){return await R`select pg_notify(${O}, ${""+k})`}async function b(){let O=Jn(),k=$.length?$.shift():await new Promise((mo)=>{x.push({reserve:mo}),f.length&&Ei(f.shift())});u(k,m),k.reserved=()=>O.length?k.execute(O.shift()):u(k,m),k.reserved.release=!0;let Yi=K(ai);return Yi.release=()=>{k.reserved=null,lo(k)},Yi;function ai(mo){k.queue===A?O.push(mo):k.execute(mo)||u(k,A)}}async function M(O,k){!k&&(k=O,O="");let Yi=Jn(),ai=0,mo,Fi=null;try{return await R.unsafe("begin "+O.replace(/[^a-z ]/ig,""),[],{onexecute:no}).execute(),await Promise.race([yi(mo,k),new Promise((qi,bi)=>mo.onclose=bi)])}catch(qi){throw qi}async function yi(qi,bi,Mo){let Di=K(fo);Di.savepoint=Yp,Di.prepare=(ji)=>Fi=ji.replace(/[^a-z0-9$-_. ]/gi);let Qn,zo;Mo&&await Di`savepoint ${Di(Mo)}`;try{if(zo=await new Promise((ji,Vn)=>{let Pn=bi(Di);Promise.resolve(Array.isArray(Pn)?Promise.all(Pn):Pn).then(ji,Vn)}),Qn)throw Qn}catch(ji){throw await(Mo?Di`rollback to ${Di(Mo)}`:Di`rollback`),ji instanceof Ox&&ji.code==="25P02"&&Qn||ji}if(!Mo)Fi?await Di`prepare transaction '${Di.unsafe(Fi)}'`:await Di`commit`;return zo;function Yp(ji,Vn){if(ji&&Array.isArray(ji.raw))return Yp((Pn)=>Pn.apply(Pn,arguments));return arguments.length===1&&(Vn=ji,ji=null),yi(qi,Vn,"s"+ai+++(ji?"_"+ji:""))}function fo(ji){ji.catch((Vn)=>Qn||(Qn=Vn)),qi.queue===A?Yi.push(ji):qi.execute(ji)||u(qi,A)}}function no(qi){mo=qi,u(qi,m),qi.reserved=()=>Yi.length?qi.execute(Yi.shift()):u(qi,m)}}function u(O,k){return O.queue.remove(O),k.push(O),O.queue=k,k===$?O.idleTimer.start():O.idleTimer.cancel(),O}function E(O){return new en(O,3802)}function S(O,k){if(!Array.isArray(O))return S(Array.from(arguments));return new en(O,k||(O.length?A1(O)||25:0),n.shared.typeArrayMap)}function C(O){if(c)return O.reject(xo.connection("CONNECTION_ENDED",n,n));if($.length)return q($.shift(),O);if(f.length)return Ei(f.shift(),O);J.length?q(J.shift(),O):x.push(O)}function q(O,k){return O.execute(k)?u(O,J):u(O,A)}function Q(O){return new Promise((k,Yi)=>{O.state?O.active?LJ(n).cancel(O.state,k,Yi):O.cancelled={resolve:k,reject:Yi}:(x.remove(O),O.cancelled=!0,O.reject(xo.generic("57014","canceling statement due to user request")),k())})}async function Ti({timeout:O=null}={}){if(c)return c;await 1;let k;return c=Promise.race([new Promise((Yi)=>O!==null&&(k=setTimeout(mi,O*1000,Yi))),Promise.all(Y.map((Yi)=>Yi.end()).concat(U.sql?U.sql.end({timeout:0}):[],p.sql?p.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(k))}async function l(){await Promise.all(Y.map((O)=>O.end()))}async function mi(O){await Promise.all(Y.map((k)=>k.terminate()));while(x.length)x.shift().reject(xo.connection("CONNECTION_DESTROYED",n));O()}function Ei(O,k){return u(O,T),O.connect(k),O}function To(O){u(O,F)}function lo(O){if(x.length===0)return u(O,$);let k=Math.ceil(x.length/(T.length+1)),Yi=!0;while(Yi&&x.length&&k-- >0){let ai=x.shift();if(ai.reserve)return ai.reserve(O);Yi=O.execute(ai)}Yi?u(O,J):u(O,A)}function ip(O,k){u(O,f),O.reserved=null,O.onclose&&(O.onclose(k),O.onclose=null),n.onclose&&n.onclose(O.id),x.length&&Ei(O,x.shift())}}function SE(i,o){if(i&&i.shared)return i;let n=process.env,p=(!i||typeof i==="string"?o:i)||{},{url:c,multihost:x}=CE(i),T=[...c.searchParams].reduce((A,[X,Y])=>(A[X]=Y,A),{}),m=p.hostname||p.host||x||c.hostname||n.PGHOST||"localhost",f=p.port||c.port||n.PGPORT||5432,F=p.user||p.username||c.username||n.PGUSERNAME||n.PGUSER||yE();p.no_prepare&&(p.prepare=!1),T.sslmode&&(T.ssl=T.sslmode,delete T.sslmode),"timeout"in p&&(console.log("The timeout option is deprecated, use idle_timeout instead"),p.idle_timeout=p.timeout),T.sslrootcert==="system"&&(T.ssl="verify-full");let $=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],J={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:_E,max_pipeline:100,backoff:OE,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(m)?m:m.split(",").map((A)=>A.split(":")[0]),port:Array.isArray(f)?f:m.split(",").map((A)=>parseInt(A.split(":")[1]||f)),path:p.path||m.indexOf("/")>-1&&m+"/.s.PGSQL."+f,database:p.database||p.db||(c.pathname||"").slice(1)||n.PGDATABASE||F,user:F,pass:p.pass||p.password||c.password||n.PGPASSWORD||"",...Object.entries(J).reduce((A,[X,Y])=>{let R=X in p?p[X]:(X in T)?T[X]==="disable"||T[X]==="false"?!1:T[X]:n["PG"+X.toUpperCase()]||Y;return A[X]=typeof R==="string"&&$.includes(X)?+R:R,A},{}),connection:{application_name:"postgres.js",...p.connection,...Object.entries(T).reduce((A,[X,Y])=>((X in J)||(A[X]=Y),A),{})},types:p.types||{},target_session_attrs:EE(p,c,n),onnotice:p.onnotice,onnotify:p.onnotify,onclose:p.onclose,onparameter:p.onparameter,socket:p.socket,transform:LE(p.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...cY(p.types)}}function EE(i,o,n){let p=i.target_session_attrs||o.searchParams.get("target_session_attrs")||n.PGTARGETSESSIONATTRS;if(!p||["read-write","read-only","primary","standby","prefer-standby"].includes(p))return p;throw new Error("target_session_attrs "+p+" is not supported")}function OE(i){return(0.5+Math.random()/2)*Math.min(3**i/100,20)}function _E(){return 60*(30+Math.random()*30)}function LE(i){return{undefined:i.undefined,column:{from:typeof i.column==="function"?i.column:i.column&&i.column.from,to:i.column&&i.column.to},value:{from:typeof i.value==="function"?i.value:i.value&&i.value.from,to:i.value&&i.value.to},row:{from:typeof i.row==="function"?i.row:i.row&&i.row.from,to:i.row&&i.row.to}}}function CE(i){if(!i||typeof i!=="string")return{url:{searchParams:new Map}};let o=i;o=o.slice(o.indexOf("://")+3).split(/[?/]/)[0],o=decodeURIComponent(o.slice(o.indexOf("@")+1));let n=new URL(i.replace(o,o.split(",")[0]));return{url:{username:decodeURIComponent(n.username),password:decodeURIComponent(n.password),host:n.host,hostname:n.hostname,port:n.port,pathname:n.pathname,searchParams:n.searchParams},multihost:o.indexOf(",")>-1&&o}}function yE(){try{return QE.userInfo().username}catch(i){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class ti{static[w]="SelectionProxyHandler";config;constructor(i){this.config={...i}}get(i,o){if(o==="_")return{...i._,selectedFields:new Proxy(i._.selectedFields,this)};if(o===Ni)return{...i[Ni],selectedFields:new Proxy(i[Ni].selectedFields,this)};if(typeof o==="symbol")return i[o];let p=(Z(i,wo)?i._.selectedFields:Z(i,ro)?i[Ni].selectedFields:i)[o];if(Z(p,N.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!p.isSelectionField)return p.sql;let c=p.clone();return c.isSelectionField=!0,c}if(Z(p,N)){if(this.config.sqlBehavior==="sql")return p;throw new Error(`You tried to reference "${o}" 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(Z(p,Li)){if(this.config.alias)return new Proxy(p,new Xx(new Proxy(p.table,new NT(this.config.alias,this.config.replaceOriginalName??!1))));return p}if(typeof p!=="object"||p===null)return p;return new Proxy(p,new ti(this.config))}}class H1 extends jo{constructor(i,o,n,p){super();this.session=o,this.dialect=n,this.config={table:i,withList:p}}static[w]="PgDelete";config;where(i){return this.config.where=i,this}returning(i=this.config.table[B.Symbol.Columns]){return this.config.returningFields=i,this.config.returning=Un(i),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:i,...o}=this.dialect.sqlToQuery(this.getSQL());return o}_prepare(i){return Ci.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,i,!0)})}prepare(i){return this._prepare(i)}authToken;setToken(i){return this.authToken=i,this}execute=(i)=>{return Ci.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(i,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new ti({alias:Ro(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}function DE(i){return(i.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((n)=>n.toLowerCase()).join("_")}function IE(i){return(i.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((n,p,c)=>{let x=c===0?p.toLowerCase():`${p[0].toUpperCase()}${p.slice(1)}`;return n+x},"")}function BE(i){return i}class DJ{static[w]="CasingCache";cache={};cachedTables={};convert;constructor(i){this.convert=i==="snake_case"?DE:i==="camelCase"?IE:BE}getColumnCasing(i){if(!i.keyAsName)return i.name;let o=i.table[B.Symbol.Schema]??"public",n=i.table[B.Symbol.OriginalName],p=`${o}.${n}.${i.name}`;if(!this.cache[p])this.cacheTable(i.table);return this.cache[p]}cacheTable(i){let o=i[B.Symbol.Schema]??"public",n=i[B.Symbol.OriginalName],p=`${o}.${n}`;if(!this.cachedTables[p]){for(let c of Object.values(i[B.Symbol.Columns])){let x=`${p}.${c.name}`;this.cache[x]=this.convert(c.name)}this.cachedTables[p]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class pm extends ro{static[w]="PgViewBase"}class Qc{static[w]="PgDialect";casing;constructor(i){this.casing=new DJ(i?.casing)}async migrate(i,o,n){let p=typeof n==="string"?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",c=typeof n==="string"?"drizzle":n.migrationsSchema??"drizzle",x=W`
120
+ CREATE TABLE IF NOT EXISTS ${W.identifier(c)}.${W.identifier(p)} (
121
121
  id SERIAL PRIMARY KEY,
122
122
  hash text NOT NULL,
123
123
  created_at bigint
124
124
  )
125
- `;await A.execute(c`CREATE SCHEMA IF NOT EXISTS ${c.identifier($)}`),await A.execute(f);let D=(await A.all(c`select id, hash, created_at from ${c.identifier($)}.${c.identifier(I)} order by created_at desc limit 1`))[0];await A.transaction(async(M)=>{for await(let o of H)if(!D||Number(D.created_at)<o.folderMillis){for(let u of o.sql)await M.execute(c.raw(u));await M.execute(c`insert into ${c.identifier($)}.${c.identifier(I)} ("hash", "created_at") values(${o.hash}, ${o.folderMillis})`)}})}escapeName(H){return`"${H}"`}escapeParam(H){return`$${H+1}`}escapeString(H){return`'${H.replace(/'/g,"''")}'`}buildWithCTE(H){if(!H?.length)return;let A=[c`with `];for(let[L,I]of H.entries())if(A.push(c`${c.identifier(I._.alias)} as (${I._.sql})`),L<H.length-1)A.push(c`, `);return A.push(c` `),c.join(A)}buildDeleteQuery({table:H,where:A,returning:L,withList:I}){let $=this.buildWithCTE(I),f=L?c` returning ${this.buildSelection(L,{isSingleTable:!0})}`:void 0,E=A?c` where ${A}`:void 0;return c`${$}delete from ${H}${E}${f}`}buildUpdateSet(H,A){let L=H[y.Symbol.Columns],I=Object.keys(L).filter((f)=>A[f]!==void 0||L[f]?.onUpdateFn!==void 0),$=I.length;return c.join(I.flatMap((f,E)=>{let D=L[f],M=A[f]??c.param(D.onUpdateFn(),D),o=c`${c.identifier(this.casing.getColumnCasing(D))} = ${M}`;if(E<$-1)return[o,c.raw(", ")];return[o]}))}buildUpdateQuery({table:H,set:A,where:L,returning:I,withList:$,from:f,joins:E}){let D=this.buildWithCTE($),M=H[WA.Symbol.Name],o=H[WA.Symbol.Schema],u=H[WA.Symbol.OriginalName],t=M===u?void 0:M,i=c`${o?c`${c.identifier(o)}.`:void 0}${c.identifier(u)}${t&&c` ${c.identifier(t)}`}`,B=this.buildUpdateSet(H,A),U=f&&c.join([c.raw(" from "),this.buildFromTable(f)]),x=this.buildJoins(E),T=I?c` returning ${this.buildSelection(I,{isSingleTable:!f})}`:void 0,F=L?c` where ${L}`:void 0;return c`${D}update ${i} set ${B}${U}${x}${F}${T}`}buildSelection(H,{isSingleTable:A=!1}={}){let L=H.length,I=H.flatMap(({field:$},f)=>{let E=[];if(_($,R.Aliased)&&$.isSelectionField)E.push(c.identifier($.fieldAlias));else if(_($,R.Aliased)||_($,R)){let D=_($,R.Aliased)?$.sql:$;if(A)E.push(new R(D.queryChunks.map((M)=>{if(_(M,K))return c.identifier(this.casing.getColumnCasing(M));return M})));else E.push(D);if(_($,R.Aliased))E.push(c` as ${c.identifier($.fieldAlias)}`)}else if(_($,aH))if(A)E.push(c.identifier(this.casing.getColumnCasing($)));else E.push($);if(f<L-1)E.push(c`, `);return E});return c.join(I)}buildJoins(H){if(!H||H.length===0)return;let A=[];for(let[L,I]of H.entries()){if(L===0)A.push(c` `);let $=I.table,f=I.lateral?c` lateral`:void 0;if(_($,WA)){let E=$[WA.Symbol.Name],D=$[WA.Symbol.Schema],M=$[WA.Symbol.OriginalName],o=E===M?void 0:I.alias;A.push(c`${c.raw(I.joinType)} join${f} ${D?c`${c.identifier(D)}.`:void 0}${c.identifier(M)}${o&&c` ${c.identifier(o)}`} on ${I.on}`)}else if(_($,gA)){let E=$[RH].name,D=$[RH].schema,M=$[RH].originalName,o=E===M?void 0:I.alias;A.push(c`${c.raw(I.joinType)} join${f} ${D?c`${c.identifier(D)}.`:void 0}${c.identifier(M)}${o&&c` ${c.identifier(o)}`} on ${I.on}`)}else A.push(c`${c.raw(I.joinType)} join${f} ${$} on ${I.on}`);if(L<H.length-1)A.push(c` `)}return c.join(A)}buildFromTable(H){if(_(H,y)&&H[y.Symbol.IsAlias]){let A=c`${c.identifier(H[y.Symbol.OriginalName])}`;if(H[y.Symbol.Schema])A=c`${c.identifier(H[y.Symbol.Schema])}.${A}`;return c`${A} ${c.identifier(H[y.Symbol.Name])}`}return H}buildSelectQuery({withList:H,fields:A,fieldsFlat:L,where:I,having:$,table:f,joins:E,orderBy:D,groupBy:M,limit:o,offset:u,lockingClause:t,distinct:i,setOperators:B}){let U=L??FL(A);for(let oH of U)if(_(oH.field,aH)&&UA(oH.field.table)!==(_(f,BA)?f._.alias:_(f,fD)?f[RH].name:_(f,R)?void 0:UA(f))&&!((wH)=>E?.some(({alias:DA})=>DA===(wH[y.Symbol.IsAlias]?UA(wH):wH[y.Symbol.BaseName])))(oH.field.table)){let wH=UA(oH.field.table);throw new Error(`Your "${oH.path.join("->")}" field references a column "${wH}"."${oH.field.name}", but the table "${wH}" is not part of the query! Did you forget to join it?`)}let x=!E||E.length===0,T=this.buildWithCTE(H),F;if(i)F=i===!0?c` distinct`:c` distinct on (${c.join(i.on,c`, `)})`;let m=this.buildSelection(U,{isSingleTable:x}),Y=this.buildFromTable(f),W=this.buildJoins(E),P=I?c` where ${I}`:void 0,V=$?c` having ${$}`:void 0,J;if(D&&D.length>0)J=c` order by ${c.join(D,c`, `)}`;let a;if(M&&M.length>0)a=c` group by ${c.join(M,c`, `)}`;let h=typeof o==="object"||typeof o==="number"&&o>=0?c` limit ${o}`:void 0,X=u?c` offset ${u}`:void 0,MH=c.empty();if(t){let oH=c` for ${c.raw(t.strength)}`;if(t.config.of)oH.append(c` of ${c.join(Array.isArray(t.config.of)?t.config.of:[t.config.of],c`, `)}`);if(t.config.noWait)oH.append(c` no wait`);else if(t.config.skipLocked)oH.append(c` skip locked`);MH.append(oH)}let Z=c`${T}select${F} ${m} from ${Y}${W}${P}${a}${V}${J}${h}${X}${MH}`;if(B.length>0)return this.buildSetOperations(Z,B);return Z}buildSetOperations(H,A){let[L,...I]=A;if(!L)throw new Error("Cannot pass undefined values to any set operator");if(I.length===0)return this.buildSetOperationQuery({leftSelect:H,setOperator:L});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:H,setOperator:L}),I)}buildSetOperationQuery({leftSelect:H,setOperator:{type:A,isAll:L,rightSelect:I,limit:$,orderBy:f,offset:E}}){let D=c`(${H.getSQL()}) `,M=c`(${I.getSQL()})`,o;if(f&&f.length>0){let B=[];for(let U of f)if(_(U,K))B.push(c.identifier(U.name));else if(_(U,R)){for(let x=0;x<U.queryChunks.length;x++){let T=U.queryChunks[x];if(_(T,K))U.queryChunks[x]=c.identifier(T.name)}B.push(c`${U}`)}else B.push(c`${U}`);o=c` order by ${c.join(B,c`, `)} `}let u=typeof $==="object"||typeof $==="number"&&$>=0?c` limit ${$}`:void 0,t=c.raw(`${A} ${L?"all ":""}`),i=E?c` offset ${E}`:void 0;return c`${D}${t}${M}${o}${u}${i}`}buildInsertQuery({table:H,values:A,onConflict:L,returning:I,withList:$,select:f,overridingSystemValue_:E}){let D=[],M=H[y.Symbol.Columns],o=Object.entries(M).filter(([T,F])=>!F.shouldDisableInsert()),u=o.map(([,T])=>c.identifier(this.casing.getColumnCasing(T)));if(f){let T=A;if(_(T,R))D.push(T);else D.push(T.getSQL())}else{let T=A;D.push(c.raw("values "));for(let[F,m]of T.entries()){let Y=[];for(let[W,P]of o){let V=m[W];if(V===void 0||_(V,EL)&&V.value===void 0)if(P.defaultFn!==void 0){let J=P.defaultFn(),a=_(J,R)?J:c.param(J,P);Y.push(a)}else if(!P.default&&P.onUpdateFn!==void 0){let J=P.onUpdateFn(),a=_(J,R)?J:c.param(J,P);Y.push(a)}else Y.push(c`default`);else Y.push(V)}if(D.push(Y),F<T.length-1)D.push(c`, `)}}let t=this.buildWithCTE($),i=c.join(D),B=I?c` returning ${this.buildSelection(I,{isSingleTable:!0})}`:void 0,U=L?c` on conflict ${L}`:void 0,x=E===!0?c`overriding system value `:void 0;return c`${t}insert into ${H} ${u} ${x}${i}${U}${B}`}buildRefreshMaterializedViewQuery({view:H,concurrently:A,withNoData:L}){let I=A?c` concurrently`:void 0,$=L?c` with no data`:void 0;return c`refresh materialized view${I} ${H}${$}`}prepareTyping(H){if(_(H,vM)||_(H,KM))return"json";else if(_(H,aM))return"decimal";else if(_(H,lM))return"time";else if(_(H,OM)||_(H,sM))return"timestamp";else if(_(H,JM)||_(H,VM))return"date";else if(_(H,NM))return"uuid";else return"none"}sqlToQuery(H,A){return H.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:A})}buildRelationalQueryWithoutPK({fullSchema:H,schema:A,tableNamesMap:L,table:I,tableConfig:$,queryConfig:f,tableAlias:E,nestedQueryRelation:D,joinOn:M}){let o=[],u,t,i=[],B,U=[];if(f===!0)o=Object.entries($.columns).map(([F,m])=>({dbKey:m.name,tsKey:F,field:dL(m,E),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let T=Object.fromEntries(Object.entries($.columns).map(([V,J])=>[V,dL(J,E)]));if(f.where){let V=typeof f.where==="function"?f.where(T,DC()):f.where;B=V&&QE(V,E)}let F=[],m=[];if(f.columns){let V=!1;for(let[J,a]of Object.entries(f.columns)){if(a===void 0)continue;if(J in $.columns){if(!V&&a===!0)V=!0;m.push(J)}}if(m.length>0)m=V?m.filter((J)=>f.columns?.[J]===!0):Object.keys($.columns).filter((J)=>!m.includes(J))}else m=Object.keys($.columns);for(let V of m){let J=$.columns[V];F.push({tsKey:V,value:J})}let Y=[];if(f.with)Y=Object.entries(f.with).filter((V)=>!!V[1]).map(([V,J])=>({tsKey:V,queryConfig:J,relation:$.relations[V]}));let W;if(f.extras){W=typeof f.extras==="function"?f.extras(T,{sql:c}):f.extras;for(let[V,J]of Object.entries(W))F.push({tsKey:V,value:Ct(J,E)})}for(let{tsKey:V,value:J}of F)o.push({dbKey:_(J,R.Aliased)?J.fieldAlias:$.columns[V].name,tsKey:V,field:_(J,aH)?dL(J,E):J,relationTableTsKey:void 0,isJson:!1,selection:[]});let P=typeof f.orderBy==="function"?f.orderBy(T,MC()):f.orderBy??[];if(!Array.isArray(P))P=[P];i=P.map((V)=>{if(_(V,aH))return dL(V,E);return QE(V,E)}),u=f.limit,t=f.offset;for(let{tsKey:V,queryConfig:J,relation:a}of Y){let h=uC(A,L,a),X=n$(a.referencedTable),MH=L[X],Z=`${E}_${V}`,oH=B$(...h.fields.map((ZA,HI)=>qL(dL(h.references[HI],Z),dL(ZA,E)))),wH=this.buildRelationalQueryWithoutPK({fullSchema:H,schema:A,tableNamesMap:L,table:H[MH],tableConfig:A[MH],queryConfig:_(a,YI)?J===!0?{limit:1}:{...J,limit:1}:J,tableAlias:Z,joinOn:oH,nestedQueryRelation:a}),DA=c`${c.identifier(Z)}.${c.identifier("data")}`.as(V);U.push({on:c`true`,table:new BA(wH.sql,{},Z),alias:Z,joinType:"left",lateral:!0}),o.push({dbKey:V,tsKey:V,field:DA,relationTableTsKey:MH,isJson:!0,selection:wH.selection})}}if(o.length===0)throw new PM({message:`No fields selected for table "${$.tsName}" ("${E}")`});let x;if(B=B$(M,B),D){let T=c`json_build_array(${c.join(o.map(({field:Y,tsKey:W,isJson:P})=>P?c`${c.identifier(`${E}_${W}`)}.${c.identifier("data")}`:_(Y,R.Aliased)?Y.sql:Y),c`, `)})`;if(_(D,hE))T=c`coalesce(json_agg(${T}${i.length>0?c` order by ${c.join(i,c`, `)}`:void 0}), '[]'::json)`;let F=[{dbKey:"data",tsKey:"data",field:T.as("data"),isJson:!0,relationTableTsKey:$.tsName,selection:o}];if(u!==void 0||t!==void 0||i.length>0)x=this.buildSelectQuery({table:mM(I,E),fields:{},fieldsFlat:[{path:[],field:c.raw("*")}],where:B,limit:u,offset:t,orderBy:i,setOperators:[]}),B=void 0,u=void 0,t=void 0,i=[];else x=mM(I,E);x=this.buildSelectQuery({table:_(x,WA)?x:new BA(x,{},E),fields:{},fieldsFlat:F.map(({field:Y})=>({path:[],field:_(Y,aH)?dL(Y,E):Y})),joins:U,where:B,limit:u,offset:t,orderBy:i,setOperators:[]})}else x=this.buildSelectQuery({table:mM(I,E),fields:{},fieldsFlat:o.map(({field:T})=>({path:[],field:_(T,aH)?dL(T,E):T})),joins:U,where:B,limit:u,offset:t,orderBy:i,setOperators:[]});return{tableTsKey:$.tsName,sql:x,selection:o}}}class Qi{static[n]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class bA{static[n]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor(H){if(this.fields=H.fields,this.session=H.session,this.dialect=H.dialect,H.withList)this.withList=H.withList;this.distinct=H.distinct}authToken;setToken(H){return this.authToken=H,this}from(H){let A=!!this.fields,L=H,I;if(this.fields)I=this.fields;else if(_(L,BA))I=Object.fromEntries(Object.keys(L._.selectedFields).map(($)=>[$,L[$]]));else if(_(L,fD))I=L[RH].selectedFields;else if(_(L,R))I={};else I=D8(L);return new zi({table:L,fields:I,isPartialSelect:A,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class P_ extends Qi{static[n]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:H,fields:A,isPartialSelect:L,session:I,dialect:$,withList:f,distinct:E}){super();this.config={withList:f,table:H,fields:{...A},distinct:E,setOperators:[]},this.isPartialSelect=L,this.session=I,this.dialect=$,this._={selectedFields:A},this.tableName=iI(H),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}createJoin(H){return(A,L)=>{let I=this.tableName,$=iI(A);if(typeof $==="string"&&this.config.joins?.some((f)=>f.alias===$))throw new Error(`Alias "${$}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof I==="string")this.config.fields={[I]:this.config.fields};if(typeof $==="string"&&!_(A,R)){let f=_(A,BA)?A._.selectedFields:_(A,gA)?A[RH].selectedFields:A[y.Symbol.Columns];this.config.fields[$]=f}}if(typeof L==="function")L=L(new Proxy(this.config.fields,new qH({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:L,table:A,joinType:H,alias:$}),typeof $==="string")switch(H){case"left":{this.joinsNotNullableMap[$]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([f])=>[f,!1])),this.joinsNotNullableMap[$]=!0;break}case"inner":{this.joinsNotNullableMap[$]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([f])=>[f,!1])),this.joinsNotNullableMap[$]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(H,A){return(L)=>{let I=typeof L==="function"?L(Bl()):L;if(!zE(this.getSelectedFields(),I.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:H,isAll:A,rightSelect:I}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);intersectAll=this.createSetOperator("intersect",!0);except=this.createSetOperator("except",!1);exceptAll=this.createSetOperator("except",!0);addSetOperators(H){return this.config.setOperators.push(...H),this}where(H){if(typeof H==="function")H=H(new Proxy(this.config.fields,new qH({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=H,this}having(H){if(typeof H==="function")H=H(new Proxy(this.config.fields,new qH({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=H,this}groupBy(...H){if(typeof H[0]==="function"){let A=H[0](new Proxy(this.config.fields,new qH({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(A)?A:[A]}else this.config.groupBy=H;return this}orderBy(...H){if(typeof H[0]==="function"){let A=H[0](new Proxy(this.config.fields,new qH({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),L=Array.isArray(A)?A:[A];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=L;else this.config.orderBy=L}else{let A=H;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=A;else this.config.orderBy=A}return this}limit(H){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=H;else this.config.limit=H;return this}offset(H){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=H;else this.config.offset=H;return this}for(H,A={}){return this.config.lockingClause={strength:H,config:A},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:H,...A}=this.dialect.sqlToQuery(this.getSQL());return A}as(H){return new Proxy(new BA(this.getSQL(),this.config.fields,H),new qH({alias:H,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new qH({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class zi extends P_{static[n]="PgSelect";_prepare(H){let{session:A,config:L,dialect:I,joinsNotNullableMap:$,authToken:f}=this;if(!A)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");return lH.startActiveSpan("drizzle.prepareQuery",()=>{let E=FL(L.fields),D=A.prepareQuery(I.sqlToQuery(this.getSQL()),E,H,!0);return D.joinsNotNullableMap=$,D.setToken(f)})}prepare(H){return this._prepare(H)}authToken;setToken(H){return this.authToken=H,this}execute=(H)=>{return lH.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(H,this.authToken)})}}E8(zi,[QA]);function Of(H,A){return(L,I,...$)=>{let f=[I,...$].map((E)=>({type:H,isAll:A,rightSelect:E}));for(let E of f)if(!zE(L.getSelectedFields(),E.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return L.addSetOperators(f)}}var Bl=()=>({union:cl,unionAll:xl,intersect:Ul,intersectAll:Cl,except:Tl,exceptAll:Gl}),cl=Of("union",!1),xl=Of("union",!0),Ul=Of("intersect",!1),Cl=Of("intersect",!0),Tl=Of("except",!1),Gl=Of("except",!0);class ED{static[n]="PgQueryBuilder";dialect;dialectConfig;constructor(H){this.dialect=_(H,S$)?H:void 0,this.dialectConfig=_(H,S$)?void 0:H}$with=(H,A)=>{let L=this;return{as:($)=>{if(typeof $==="function")$=$(L);return new Proxy(new yE($.getSQL(),A??("getSelectedFields"in $?$.getSelectedFields()??{}:{}),H,!0),new qH({alias:H,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...H){let A=this;function L(f){return new bA({fields:f??void 0,session:void 0,dialect:A.getDialect(),withList:H})}function I(f){return new bA({fields:f??void 0,session:void 0,dialect:A.getDialect(),distinct:!0})}function $(f,E){return new bA({fields:E??void 0,session:void 0,dialect:A.getDialect(),distinct:{on:f}})}return{select:L,selectDistinct:I,selectDistinctOn:$}}select(H){return new bA({fields:H??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(H){return new bA({fields:H??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(H,A){return new bA({fields:A??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:H}})}getDialect(){if(!this.dialect)this.dialect=new S$(this.dialectConfig);return this.dialect}}class m1{constructor(H,A,L,I,$){this.table=H,this.session=A,this.dialect=L,this.withList=I,this.overridingSystemValue_=$}static[n]="PgInsertBuilder";authToken;setToken(H){return this.authToken=H,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values(H){if(H=Array.isArray(H)?H:[H],H.length===0)throw new Error("values() must be called with at least one value");let A=H.map((L)=>{let I={},$=this.table[y.Symbol.Columns];for(let f of Object.keys(L)){let E=L[f];I[f]=_(E,R)?E:new EL(E,$[f])}return I});return new bi(this.table,A,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select(H){let A=typeof H==="function"?H(new ED):H;if(!_(A,R)&&!zE(this.table[_M],A._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new bi(this.table,A,this.session,this.dialect,this.withList,!0)}}class bi extends QA{constructor(H,A,L,I,$,f,E){super();this.session=L,this.dialect=I,this.config={table:H,values:A,withList:$,select:f,overridingSystemValue_:E}}static[n]="PgInsert";config;returning(H=this.config.table[y.Symbol.Columns]){return this.config.returningFields=H,this.config.returning=FL(H),this}onConflictDoNothing(H={}){if(H.target===void 0)this.config.onConflict=c`do nothing`;else{let A="";A=Array.isArray(H.target)?H.target.map((I)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(I))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(H.target));let L=H.where?c` where ${H.where}`:void 0;this.config.onConflict=c`(${c.raw(A)})${L} do nothing`}return this}onConflictDoUpdate(H){if(H.where&&(H.targetWhere||H.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');let A=H.where?c` where ${H.where}`:void 0,L=H.targetWhere?c` where ${H.targetWhere}`:void 0,I=H.setWhere?c` where ${H.setWhere}`:void 0,$=this.dialect.buildUpdateSet(this.config.table,SM(this.config.table,H.set)),f="";return f=Array.isArray(H.target)?H.target.map((E)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(E))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(H.target)),this.config.onConflict=c`(${c.raw(f)})${L} do update set ${$}${A}${I}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:H,...A}=this.dialect.sqlToQuery(this.getSQL());return A}_prepare(H){return lH.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,H,!0)})}prepare(H){return this._prepare(H)}authToken;setToken(H){return this.authToken=H,this}execute=(H)=>{return lH.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(H,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new qH({alias:UA(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class Zi extends QA{constructor(H,A,L){super();this.session=A,this.dialect=L,this.config={view:H}}static[n]="PgRefreshMaterializedView";config;concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:H,...A}=this.dialect.sqlToQuery(this.getSQL());return A}_prepare(H){return lH.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,H,!0)})}prepare(H){return this._prepare(H)}authToken;setToken(H){return this.authToken=H,this}execute=(H)=>{return lH.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(H,this.authToken)})}}class P1{constructor(H,A,L,I){this.table=H,this.session=A,this.dialect=L,this.withList=I}static[n]="PgUpdateBuilder";authToken;setToken(H){return this.authToken=H,this}set(H){return new X_(this.table,SM(this.table,H),this.session,this.dialect,this.withList).setToken(this.authToken)}}class X_ extends QA{constructor(H,A,L,I,$){super();this.session=L,this.dialect=I,this.config={set:A,table:H,withList:$,joins:[]},this.tableName=iI(H),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[n]="PgUpdate";config;tableName;joinsNotNullableMap;from(H){let A=H,L=iI(A);if(typeof L==="string")this.joinsNotNullableMap[L]=!0;return this.config.from=A,this}getTableLikeFields(H){if(_(H,WA))return H[y.Symbol.Columns];else if(_(H,BA))return H._.selectedFields;return H[RH].selectedFields}createJoin(H){return(A,L)=>{let I=iI(A);if(typeof I==="string"&&this.config.joins.some(($)=>$.alias===I))throw new Error(`Alias "${I}" is already used in this query`);if(typeof L==="function"){let $=this.config.from&&!_(this.config.from,R)?this.getTableLikeFields(this.config.from):void 0;L=L(new Proxy(this.config.table[y.Symbol.Columns],new qH({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),$&&new Proxy($,new qH({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:L,table:A,joinType:H,alias:I}),typeof I==="string")switch(H){case"left":{this.joinsNotNullableMap[I]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([$])=>[$,!1])),this.joinsNotNullableMap[I]=!0;break}case"inner":{this.joinsNotNullableMap[I]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([$])=>[$,!1])),this.joinsNotNullableMap[I]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(H){return this.config.where=H,this}returning(H){if(!H){if(H=Object.assign({},this.config.table[y.Symbol.Columns]),this.config.from){let A=iI(this.config.from);if(typeof A==="string"&&this.config.from&&!_(this.config.from,R)){let L=this.getTableLikeFields(this.config.from);H[A]=L}for(let L of this.config.joins){let I=iI(L.table);if(typeof I==="string"&&!_(L.table,R)){let $=this.getTableLikeFields(L.table);H[I]=$}}}}return this.config.returningFields=H,this.config.returning=FL(H),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:H,...A}=this.dialect.sqlToQuery(this.getSQL());return A}_prepare(H){let A=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,H,!0);return A.joinsNotNullableMap=this.joinsNotNullableMap,A}prepare(H){return this._prepare(H)}authToken;setToken(H){return this.authToken=H,this}execute=(H)=>{return this._prepare().execute(H,this.authToken)};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new qH({alias:UA(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class DD extends R{constructor(H){super(DD.buildEmbeddedCount(H.source,H.filters).queryChunks);this.params=H,this.mapWith(Number),this.session=H.session,this.sql=DD.buildCount(H.source,H.filters)}sql;token;static[n]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount(H,A){return c`(select count(*) from ${H}${c.raw(" where ").if(A)}${A})`}static buildCount(H,A){return c`select count(*) as count from ${H}${c.raw(" where ").if(A)}${A};`}setToken(H){return this.token=H,this}then(H,A){return Promise.resolve(this.session.count(this.sql,this.token)).then(H,A)}catch(H){return this.then(void 0,H)}finally(H){return this.then((A)=>{return H?.(),A},(A)=>{throw H?.(),A})}}class ri{constructor(H,A,L,I,$,f,E){this.fullSchema=H,this.schema=A,this.tableNamesMap=L,this.table=I,this.tableConfig=$,this.dialect=f,this.session=E}static[n]="PgRelationalQueryBuilder";findMany(H){return new hi(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,H?H:{},"many")}findFirst(H){return new hi(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,H?{...H,limit:1}:{limit:1},"first")}}class hi extends QA{constructor(H,A,L,I,$,f,E,D,M){super();this.fullSchema=H,this.schema=A,this.tableNamesMap=L,this.table=I,this.tableConfig=$,this.dialect=f,this.session=E,this.config=D,this.mode=M}static[n]="PgRelationalQuery";_prepare(H){return lH.startActiveSpan("drizzle.prepareQuery",()=>{let{query:A,builtQuery:L}=this._toSQL();return this.session.prepareQuery(L,void 0,H,!0,(I,$)=>{let f=I.map((E)=>yM(this.schema,this.tableConfig,E,A.selection,$));if(this.mode==="first")return f[0];return f})})}prepare(H){return this._prepare(H)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let H=this._getQuery(),A=this.dialect.sqlToQuery(H.sql);return{query:H,builtQuery:A}}toSQL(){return this._toSQL().builtQuery}authToken;setToken(H){return this.authToken=H,this}execute(){return lH.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class ji extends QA{constructor(H,A,L,I){super();this.execute=H,this.sql=A,this.query=L,this.mapBatchResult=I}static[n]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult(H,A){return A?this.mapBatchResult(H):H}_prepare(){return this}isResponseInArrayMode(){return!1}}class MD{constructor(H,A,L){if(this.dialect=H,this.session=A,this._=L?{schema:L.schema,fullSchema:L.fullSchema,tableNamesMap:L.tableNamesMap,session:A}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:A},this.query={},this._.schema)for(let[I,$]of Object.entries(this._.schema))this.query[I]=new ri(L.fullSchema,this._.schema,this._.tableNamesMap,L.fullSchema[I],$,H,A)}static[n]="PgDatabase";query;$with=(H,A)=>{let L=this;return{as:($)=>{if(typeof $==="function")$=$(new ED(L.dialect));return new Proxy(new yE($.getSQL(),A??("getSelectedFields"in $?$.getSelectedFields()??{}:{}),H,!0),new qH({alias:H,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count(H,A){return new DD({source:H,filters:A,session:this.session})}with(...H){let A=this;function L(M){return new bA({fields:M??void 0,session:A.session,dialect:A.dialect,withList:H})}function I(M){return new bA({fields:M??void 0,session:A.session,dialect:A.dialect,withList:H,distinct:!0})}function $(M,o){return new bA({fields:o??void 0,session:A.session,dialect:A.dialect,withList:H,distinct:{on:M}})}function f(M){return new P1(M,A.session,A.dialect,H)}function E(M){return new m1(M,A.session,A.dialect,H)}function D(M){return new W1(M,A.session,A.dialect,H)}return{select:L,selectDistinct:I,selectDistinctOn:$,update:f,insert:E,delete:D}}select(H){return new bA({fields:H??void 0,session:this.session,dialect:this.dialect})}selectDistinct(H){return new bA({fields:H??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(H,A){return new bA({fields:A??void 0,session:this.session,dialect:this.dialect,distinct:{on:H}})}update(H){return new P1(H,this.session,this.dialect)}insert(H){return new m1(H,this.session,this.dialect)}delete(H){return new W1(H,this.session,this.dialect)}refreshMaterializedView(H){return new Zi(H,this.session,this.dialect)}authToken;execute(H){let A=typeof H==="string"?c.raw(H):H.getSQL(),L=this.dialect.sqlToQuery(A),I=this.session.prepareQuery(L,void 0,void 0,!1);return new ji(()=>I.execute(void 0,this.authToken),A,L,($)=>I.mapResult($,!0))}transaction(H,A){return this.session.transaction(H,A)}}class S_{constructor(H,A){this.unique=H,this.name=A}static[n]="PgIndexBuilderOn";on(...H){return new X1(H.map((A)=>{if(_(A,R))return A;A=A;let L=new NE(A.name,!!A.keyAsName,A.columnType,A.indexConfig);return A.indexConfig=JSON.parse(JSON.stringify(A.defaultConfig)),L}),this.unique,!1,this.name)}onOnly(...H){return new X1(H.map((A)=>{if(_(A,R))return A;A=A;let L=new NE(A.name,!!A.keyAsName,A.columnType,A.indexConfig);return A.indexConfig=A.defaultConfig,L}),this.unique,!0,this.name)}using(H,...A){return new X1(A.map((L)=>{if(_(L,R))return L;L=L;let I=new NE(L.name,!!L.keyAsName,L.columnType,L.indexConfig);return L.indexConfig=JSON.parse(JSON.stringify(L.defaultConfig)),I}),this.unique,!0,this.name,H)}}class X1{static[n]="PgIndexBuilder";config;constructor(H,A,L,I,$="btree"){this.config={name:I,columns:H,unique:A,only:L,method:$}}concurrently(){return this.config.concurrently=!0,this}with(H){return this.config.with=H,this}where(H){return this.config.where=H,this}build(H){return new J_(this.config,H)}}class J_{static[n]="PgIndex";config;constructor(H,A){this.config={...H,table:A}}}function ki(H){return new S_(!0,H)}class di{constructor(H){this.query=H}authToken;getQuery(){return this.query}mapResult(H,A){return H}setToken(H){return this.authToken=H,this}static[n]="PgPreparedQuery";joinsNotNullableMap}class qi{constructor(H){this.dialect=H}static[n]="PgSession";execute(H,A){return lH.startActiveSpan("drizzle.operation",()=>{return lH.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery(H),void 0,void 0,!1)}).setToken(A).execute(void 0,A)})}all(H){return this.prepareQuery(this.dialect.sqlToQuery(H),void 0,void 0,!1).all()}async count(H,A){let L=await this.execute(H,A);return Number(L[0].count)}}class gi extends MD{constructor(H,A,L,I=0){super(H,A,L);this.schema=L,this.nestedIndex=I}static[n]="PgTransaction";rollback(){throw new Tt}getTransactionConfigSQL(H){let A=[];if(H.isolationLevel)A.push(`isolation level ${H.isolationLevel}`);if(H.accessMode)A.push(H.accessMode);if(typeof H.deferrable==="boolean")A.push(H.deferrable?"deferrable":"not deferrable");return c.raw(A.join(" "))}setTransaction(H){return this.session.execute(c`set transaction ${this.getTransactionConfigSQL(H)}`)}}class V_ extends di{constructor(H,A,L,I,$,f,E){super({sql:A,params:L});this.client=H,this.queryString=A,this.params=L,this.logger=I,this.fields=$,this._isResponseInArrayMode=f,this.customResultMapper=E}static[n]="PostgresJsPreparedQuery";async execute(H={}){return lH.startActiveSpan("drizzle.execute",async(A)=>{let L=Ut(this.params,H);A?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(L)}),this.logger.logQuery(this.queryString,L);let{fields:I,queryString:$,client:f,joinsNotNullableMap:E,customResultMapper:D}=this;if(!I&&!D)return lH.startActiveSpan("drizzle.driver.execute",()=>{return f.unsafe($,L)});let M=await lH.startActiveSpan("drizzle.driver.execute",()=>{return A?.setAttributes({"drizzle.query.text":$,"drizzle.query.params":JSON.stringify(L)}),f.unsafe($,L).values()});return lH.startActiveSpan("drizzle.mapResponse",()=>{return D?D(M):M.map((o)=>f8(I,o,E))})})}all(H={}){return lH.startActiveSpan("drizzle.execute",async(A)=>{let L=Ut(this.params,H);return A?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(L)}),this.logger.logQuery(this.queryString,L),lH.startActiveSpan("drizzle.driver.execute",()=>{return A?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(L)}),this.client.unsafe(this.queryString,L)})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class oD extends qi{constructor(H,A,L,I={}){super(A);this.client=H,this.schema=L,this.options=I,this.logger=I.logger??new Ft}static[n]="PostgresJsSession";logger;prepareQuery(H,A,L,I,$){return new V_(this.client,H.sql,H.params,this.logger,A,I,$)}query(H,A){return this.logger.logQuery(H,A),this.client.unsafe(H,A).values()}queryObjects(H,A){return this.client.unsafe(H,A)}transaction(H,A){return this.client.begin(async(L)=>{let I=new oD(L,this.dialect,this.schema,this.options),$=new ei(this.dialect,I,this.schema);if(A)await $.setTransaction(A);return H($)})}}class ei extends gi{constructor(H,A,L,I=0){super(H,A,L,I);this.session=A}static[n]="PostgresJsTransaction";transaction(H){return this.session.client.savepoint((A)=>{let L=new oD(A,this.dialect,this.schema,this.session.options),I=new ei(this.dialect,L,this.schema);return H(I)})}}class w_ extends MD{static[n]="PostgresJsDatabase"}function sf(H,A={}){let L=(M)=>M;for(let M of["1184","1082","1083","1114","1182","1185","1115","1231"])H.options.parsers[M]=L,H.options.serializers[M]=L;H.options.serializers["114"]=L,H.options.serializers["3802"]=L;let I=new S$({casing:A.casing}),$;if(A.logger===!0)$=new Gt;else if(A.logger!==!1)$=A.logger;let f;if(A.schema){let M=oC(A.schema,tC);f={fullSchema:A.schema,schema:M.tables,tableNamesMap:M.tableNamesMap}}let E=new oD(H,I,f,{logger:$}),D=new w_(I,E,f);return D.$client=H,D}function S1(...H){if(typeof H[0]==="string"){let A=lf(H[0]);return sf(A,H[1])}if(M8(H[0])){let{connection:A,client:L,...I}=H[0];if(L)return sf(L,I);if(typeof A==="object"&&A.url!==void 0){let{url:f,...E}=A,D=lf(f,E);return sf(D,I)}let $=lf(A);return sf($,I)}return sf(H[0],H[1])}((H)=>{function A(L){return sf({options:{parsers:{},serializers:{}}},L)}H.mock=A})(S1||(S1={}));var Ap={};bW(Ap,{users:()=>YL,userChanges:()=>_l,untrackedUserColumnNames:()=>Fl,twoFactorMethod:()=>O_,trackedUserColumnName:()=>l_,trackableUserColumnNames:()=>a_,role:()=>v_,players:()=>Hp,passwordResetAttempts:()=>Wl,loginHistory:()=>Nf,games:()=>J1,banishedIps:()=>V1});function K_(H){return c`lower(${H})`}var v_=GM("role",["admin","user"]),YL=RI("users",{id:DL().primaryKey().defaultRandom(),username:lA({length:16}).notNull(),email:lA({length:254}).notNull(),password:lA({length:254}).notNull(),createdAt:sL({withTimezone:!0}).notNull().defaultNow(),createdIp:lA({length:45}).notNull(),isActive:bE().notNull().default(!1),verifiedAt:sL({withTimezone:!0}),userRole:v_().default("user")},(H)=>[ki("usernameUniqueIndex").on(K_(H.username)),ki("emailUniqueIndex").on(K_(H.email))]),Fl=["id","createdAt","createdIp","isActive","verifiedAt"],a_=["username","email","password","userRole"],l_=GM("trackedUserColumnName",a_),_l=RI("userChanges",{id:DL().primaryKey().defaultRandom(),userId:DL().notNull().references(()=>YL.id,{onDelete:"cascade"}),changedAt:sL({withTimezone:!0}).notNull().defaultNow(),changedIp:lA({length:45}).notNull(),changedColumn:l_().notNull(),oldValue:lA({length:255}),newValue:lA({length:255})}),J1=RI("games",{id:DL().primaryKey().defaultRandom()}),Hp=RI("players",{userId:DL().notNull().references(()=>YL.id,{onDelete:"cascade"}),gameId:DL().notNull().references(()=>J1.id,{onDelete:"cascade"}),score:wM().notNull()},(H)=>[$C({name:"players_userId_gameId_pk",columns:[H.userId,H.gameId]})]),Nf=RI("loginHistory",{id:DL().primaryKey().defaultRandom(),userId:DL().references(()=>YL.id,{onDelete:"cascade"}),loginTime:sL({withTimezone:!0}).notNull().defaultNow(),ipAddress:lA({length:45}).notNull(),userAgent:lA({length:1024}),successful:bE().notNull().default(!1)}),O_=GM("twoFactorMethod",["email","phone"]),Wl=RI("passwordResetAttempts",{id:DL().primaryKey().defaultRandom(),userId:DL().notNull().references(()=>YL.id,{onDelete:"cascade"}),requestedIp:lA({length:45}).notNull(),requestedAt:sL({withTimezone:!0}).notNull().defaultNow(),succeededIp:lA({length:45}),succeededAt:sL({withTimezone:!0}),verificationMethod:O_().notNull()}),V1=RI("banishedIps",{ip:lA({length:45}).primaryKey(),reason:lA({length:2048}).notNull(),banishedAt:sL({withTimezone:!0}).notNull().defaultNow(),banishedUntil:sL({withTimezone:!0})});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class Lp{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(ml.resolve(__dirname,"notify_update.sql"));let H=[UA(YL),UA(J1),UA(Hp)];await this.sql`SELECT create_notify_triggers(${this.sql.array(H)})`,await this.sql.listen("table_update",(A)=>{let L=A.split(","),I=L[0],$=L[1],f=`${I}("${$}")`;if(this.observers.has(f))this.observers.get(f).next(f)})}constructor(H=!1,A={host:LA.POSTGRES_HOST,port:LA.POSTGRES_PORT,user:LA.POSTGRES_USER,password:LA.POSTGRES_PASSWORD,database:LA.POSTGRES_DATABASE}){this.options=A,this.sql=lf(A),this.drizzle=S1(this.sql,{schema:Ap,logger:H})}observe(H,A){if(!this.observers.has(H))this.observers.set(H,new iH);this.observers.get(H).subscribe("SINGLETON",A)}}import{createHash as Pl}from"crypto";function Ip(H){let A=Pl("sha256").update(H).digest("hex");return`${A.substring(0,8)}-${A.substring(8,12)}-${A.substring(12,16)}-${A.substring(16,20)}-${A.substring(20,32)}`}var s_=["123","321","abc","admin","adobe","alexander","amanda","andrea","andrew","angel","apple","asdf","ashley","baby","banana","baseball","batman","bear","biteme","blazer","blonde","boston","buster","butterfly","cameron","charlie","cheese","chelsea","chicken","chocolate","chris","compaq","computer","cookie","corvette","cowboys","dakota","dallas","daniel","david","diamond","dolphin","donald","dragon","eagle","flower","football","frank","freedom","friend","gateway","george","ginger","god","golf","hannah","hardcore","harley","heather","hello","hottie","hunter","internet","jasmine","jennifer","jessica","jesus","johnny","jordan","joshua","justin","justme","killer","knight","lakers","letmein","liverpool","login","london","love","lucky","mackenzie","maggie","master","matrix","matthew","maverick","melissa","mercedes","michael","michelle","mickey","miller","money","monkey","morgan","mother","muffin","mustang","natasha","nathan","nicole","ninja","orange","pass","password","patrick","peanut","pepper","phoenix","photoshop","pokemon","princess","purple","qazwsx","qwerty","rainbow","ranger","root","samantha","samsung","scooter","secret","shadow","simpson","smile","soccer","sparkle","starwars","summer","sunflower","sunshine","superman","taylor","temp","test","thomas","tigers","tigger","tinkerbell","trust","turtle","victoria","welcome","whatever","william","winter","yellow","zaq12wsx","zxcvbn"];var Xl=3,Sl=15,Jl=/^[a-zA-Z0-9_-]+$/,oMH=eH(Jl).pipe(eH(`string > ${Xl} & string < ${Sl}`)).brand("username"),N_=20,y_={"0":"o","1":"l","3":"e","4":"a","5":"s","7":"t","@":"a",$:"s","!":"i"};function Vl(H){let A="";for(let L of H)if(L in y_)A+=y_[L];else A+=L;return A}function wl(H){let A=H.toLocaleLowerCase(),L=Vl(A);for(let I of s_){if(L.includes(I))return!0;if(A.includes(I))return!0}return!1}function Kl(H){let A=new Set(H).size;return H.length*Math.log2(A)}function vl(H){let A=0,L=100;if(wl(H))A-=L;return A+=Kl(H)*0.5,Math.max(A,0)}var uMH=eH("string").narrow((H,A)=>{let L=vl(H);return L>=N_?!0:A.mustBe(`Of complexity ${N_} or more. Was ${L.toFixed(2)}.`)}).brand("password"),R_=eH({"+":"delete",username:"string",password:"string"}),tMH=eH("string").brand("email"),Y_=eH({"+":"delete",username:"string",password:"string",email:"string"});var w1={100:'"Continue"',101:'"Switching Protocols"',102:'"Processing"',103:'"Early Hints"',200:'"OK"',201:'"Created"',202:'"Accepted"',203:'"Non-Authoritative Information"',204:'"No Content"',205:'"Reset Content"',206:'"Partial Content"',207:'"Multi-Status"',208:'"Already Reported"',226:'"IM Used"',300:'"Multiple Choices"',301:'"Moved Permanently"',302:'"Found"',303:'"See Other"',304:'"Not Modified"',305:'"Use Proxy"',306:'"Switch Proxy"',307:'"Temporary Redirect"',308:'"Permanent Redirect"',400:'"Bad Request"',401:'"Unauthorized"',402:'"Payment Required"',403:'"Forbidden"',404:'"Not Found"',405:'"Method Not Allowed"',406:'"Not Acceptable"',407:'"Proxy Authentication Required"',408:'"Request Timeout"',409:'"Conflict"',410:'"Gone"',411:'"Length Required"',412:'"Precondition Failed"',413:'"Payload Too Large"',414:'"URI Too Long"',415:'"Unsupported Media Type"',416:'"Range Not Satisfiable"',417:'"Expectation Failed"',418:`"I'm a teapot"`,421:'"Misdirected Request"',422:'"Unprocessable Entity"',423:'"Locked"',424:'"Failed Dependency"',425:'"Too Early"',426:'"Upgrade Required"',428:'"Precondition Required"',429:'"Too Many Requests"',431:'"Request Header Fields Too Large"',451:'"Unavailable For Legal Reasons"',500:'"Internal Server Error"',501:'"Not Implemented"',502:'"Bad Gateway"',503:'"Service Unavailable"',504:'"Gateway Timeout"',505:'"HTTP Version Not Supported"',506:'"Variant Also Negotiates"',507:'"Insufficient Storage"',508:'"Loop Detected"',510:'"Not Extended"',511:'"Network Authentication Required"'};function al(H){return Number.parseInt(H,10)}var ll=eH(w1),Ol=ll.keyof().pipe((H)=>al(H)),Q_=eH([Ol,"string"]);var z_=KI({key:"count",default:0}),sl=D$({key:"incrementTX",do:({set:H})=>{H(z_,(A)=>A+1)}}),b_=xB({key:"countContinuity",config:(H)=>H.add(z_).add(sl)});var Z_=Fi(hI,"backend.worker.game.bun",DH),J$=new Lp({logQuery(H,A){DH.info("\uD83D\uDCDD query",H,A)}});e.STORE.loggers[0]=new $$("info",void 0,DH);var sMH=(()=>{let{__tribunalDaily:H}=globalThis;if(!H)H=new h_.CronJob("00 15 * * * *",()=>{Fi(hI,"backend.worker.tribunal.bun",DH)}),H.start(),process.on("exit",()=>{H.stop(),DH.info("\u231B tribunal daily cronjob stopped")}),DH.info("\u23F3 tribunal daily cronjob started");return H})();function Rl(H){if(Gi)return yl(Gi,H);return Nl({},H)}var r_=Rl((H,A)=>{let L;H.on("data",(I)=>(L??=[]).push(I)).on("end",async()=>{let I=H.headers.authorization;try{if(typeof H.url==="undefined")throw[400,"No URL"];let $=H.socket.remoteAddress;if(!$)throw[400,"No IP address"];let f=new Date,E=new URL(H.url,LA.VITE_BACKEND_ORIGIN);DH.info(f,$,H.method,E.pathname);let D=await J$.drizzle.query.banishedIps.findFirst({columns:{banishedUntil:!0},where:qL(V1.ip,$)}),M=D?.banishedUntil===null,o=D?.banishedUntil&&D.banishedUntil>f;if(M||o){DH.info(`\uD83D\uDE45 request from banned ip ${$}`);return}switch(H.method){case"POST":if(!L)throw[400,"No data received"];switch(E.pathname){case`/sign-up-${Ip("sign-up")}`:{let u=Buffer.concat(L).toString(),t=JSON.parse(u),i=Y_(t);if(i instanceof eH.errors)throw DH.warn("signup parsed",i),[400,"Signup failed"];let{username:B,password:U,email:x}=i;if(DH.info(`\uD83D\uDD11 attempting to sign up: ${B}`),await J$.drizzle.query.users.findFirst({columns:{id:!0},where:qL(YL.email,x)}))throw[400,"User already exists"];let F=await N1(U,10);await J$.drizzle.insert(YL).values({username:B,email:x,password:F,createdIp:$}),DH.info(`\uD83D\uDD11 user created: ${B}`),A.writeHead(201,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${LA.FRONTEND_ORIGINS[0]}`}),A.end(w1[201])}break;case`/login-${Ip("login")}`:{let u=!1,t=null;try{let i=new Date(+f-600000);DH.info("\uD83D\uDD11 ten minutes ago",{tenMinutesAgo:i,now:f});let B=await J$.drizzle.query.loginHistory.findMany({columns:{userId:!0,successful:!0},where:B$(qL(Nf.ipAddress,$),qL(Nf.successful,!1),XM(Nf.loginTime,i)),limit:10});DH.info(`\uD83D\uDD11 ${B.length}/10 recent failed logins from ${$}`);let U=10-B.length;if(U<1)throw DH.info(`\uD83D\uDD11 too many recent failed logins from ${$}`),await J$.drizzle.insert(V1).values({ip:$,reason:"Too many recent login attempts.",banishedAt:f,banishedUntil:new Date(+f+86400000)}),[429,"Too many recent login attempts."];let x=Buffer.concat(L).toString(),T=JSON.parse(x),F=R_(T);if(F instanceof eH.errors)throw DH.warn("login parsed",F),[400,`${U} attempts remaining.`];let{username:m,password:Y}=F,W=await J$.drizzle.query.users.findFirst({columns:{id:!0,password:!0},where:qL(YL.username,m)});if(DH.info("\uD83D\uDD11 login attempt as user",m),!W)throw DH.info(`\uD83D\uDD11 user ${m} does not exist`),[400,`${U} attempts remaining.`];let{password:P}=W;if(t=W.id,await y1(Y,P)){let J=crypto.randomUUID(),a=i1.get(m);if(!a)a=new Map,i1.set(m,a);a.set(J,Number(f)),u=!0,DH.info("\uD83D\uDD11 login successful as",m),A.writeHead(200,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${LA.FRONTEND_ORIGINS[0]}`}),A.end(`${m} ${J}`)}}finally{await J$.drizzle.insert(Nf).values({userId:t,successful:u,ipAddress:$,userAgent:H.headers["user-agent"]??"Withheld"}),DH.info(`\uD83D\uDD11 recorded login attempt from ${$}`)}}break;default:throw[404,"Not found"]}break;case void 0:throw[400,"No Method"];default:throw[405,"Method not allowed"]}}catch($){let f=Q_($);if(f instanceof eH.errors)DH.error($),A.writeHead(500,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${LA.FRONTEND_ORIGINS[0]}`}),A.end("Internal Server Error");else{let[E,D]=f,o=`${w1[E]}. ${D}`;DH.info(`\u274C ${E}: ${o}`),A.writeHead(E,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${LA.FRONTEND_ORIGINS[0]}`}),A.end(o)}}})}),$p=r_.listen(LA.BACKEND_PORT).address(),Yl=typeof $p==="string"?null:$p===null?null:$p.port;if(Yl===null)throw new Error("Could not determine port for test server");new H_(r_,{cors:{origin:LA.FRONTEND_ORIGINS,methods:["GET","POST"]}}).use((H,A)=>{let{username:L,sessionKey:I}=H.handshake.auth;if(!(L&&I)){A(new Error("No auth header provided"));return}let $=`user::${L}`,f=`socket::${H.id}`;if(i1.get(L)?.has(I)){let D=q(e.STORE,LM,f);vH(e.STORE,D,H),wI(M$,(M)=>{M.set($,f)},e.STORE),vH(e.STORE,Wu,(M)=>M.add($)),vH(e.STORE,_u,(M)=>M.add(f)),DH.info(`${L} connected on ${H.id}`),A()}else DH.info(`${L} couldn't authenticate`),A(new Error("Authentication error"))}).on("connection",(H)=>{let L=mB({socket:H,store:e.STORE})(b_);H.on("disconnect",()=>{let I=`socket::${H.id}`,$=Af(M$,I,e.STORE).userKeyOfSocket,f=mH(e.STORE,$);if(wI(M$,(E)=>{E.delete(I)},e.STORE),f)vH(e.STORE,Wu,(E)=>(E.delete(f),E));vH(e.STORE,_u,(E)=>(E.delete(I),E)),DH.info(`${H.id} disconnected`),L()})});async function K1(){DH.info("\uD83E\uDDF9 closing workers");let H=new Promise((A)=>Z_.process.once("close",A));Z_.emit("timeToStop"),await H,DH.info("\uD83D\uDEEC backend server exiting"),process.exit(0)}process.on("SIGINT",async()=>{DH.info("\u2757 received SIGINT; exiting gracefully"),await K1()});process.on("SIGTERM",async()=>{DH.info("\u2757 received SIGTERM; exiting gracefully"),await K1()});process.on("exit",async()=>{DH.info("\u2757 received exit; exiting gracefully"),await K1()});hI.on("updatesReady",()=>{DH.info('\u2757 backend server received signal "updatesReady"'),hI.emit("readyToUpdate"),DH.info('\u2757 backend server has sent signal "readyToUpdate"; now awaits signal "timeToStop"'),hI.on("timeToStop",async()=>{DH.info('\u2757 backend server received signal "timeToStop"; exiting gracefully'),await K1()})});DH.info(`\uD83D\uDEEB backend server ready on port ${LA.BACKEND_PORT}`);hI.emit("alive");export{sMH as tribunalDaily};
125
+ `;await o.execute(W`CREATE SCHEMA IF NOT EXISTS ${W.identifier(c)}`),await o.execute(x);let m=(await o.all(W`select id, hash, created_at from ${W.identifier(c)}.${W.identifier(p)} order by created_at desc limit 1`))[0];await o.transaction(async(f)=>{for await(let F of i)if(!m||Number(m.created_at)<F.folderMillis){for(let $ of F.sql)await f.execute(W.raw($));await f.execute(W`insert into ${W.identifier(c)}.${W.identifier(p)} ("hash", "created_at") values(${F.hash}, ${F.folderMillis})`)}})}escapeName(i){return`"${i}"`}escapeParam(i){return`$${i+1}`}escapeString(i){return`'${i.replace(/'/g,"''")}'`}buildWithCTE(i){if(!i?.length)return;let o=[W`with `];for(let[n,p]of i.entries())if(o.push(W`${W.identifier(p._.alias)} as (${p._.sql})`),n<i.length-1)o.push(W`, `);return o.push(W` `),W.join(o)}buildDeleteQuery({table:i,where:o,returning:n,withList:p}){let c=this.buildWithCTE(p),x=n?W` returning ${this.buildSelection(n,{isSingleTable:!0})}`:void 0,T=o?W` where ${o}`:void 0;return W`${c}delete from ${i}${T}${x}`}buildUpdateSet(i,o){let n=i[B.Symbol.Columns],p=Object.keys(n).filter((x)=>o[x]!==void 0||n[x]?.onUpdateFn!==void 0),c=p.length;return W.join(p.flatMap((x,T)=>{let m=n[x],f=o[x]??W.param(m.onUpdateFn(),m),F=W`${W.identifier(this.casing.getColumnCasing(m))} = ${f}`;if(T<c-1)return[F,W.raw(", ")];return[F]}))}buildUpdateQuery({table:i,set:o,where:n,returning:p,withList:c,from:x,joins:T}){let m=this.buildWithCTE(c),f=i[Zo.Symbol.Name],F=i[Zo.Symbol.Schema],$=i[Zo.Symbol.OriginalName],J=f===$?void 0:f,A=W`${F?W`${W.identifier(F)}.`:void 0}${W.identifier($)}${J&&W` ${W.identifier(J)}`}`,X=this.buildUpdateSet(i,o),Y=x&&W.join([W.raw(" from "),this.buildFromTable(x)]),R=this.buildJoins(T),K=p?W` returning ${this.buildSelection(p,{isSingleTable:!x})}`:void 0,U=n?W` where ${n}`:void 0;return W`${m}update ${A} set ${X}${Y}${R}${U}${K}`}buildSelection(i,{isSingleTable:o=!1}={}){let n=i.length,p=i.flatMap(({field:c},x)=>{let T=[];if(Z(c,N.Aliased)&&c.isSelectionField)T.push(W.identifier(c.fieldAlias));else if(Z(c,N.Aliased)||Z(c,N)){let m=Z(c,N.Aliased)?c.sql:c;if(o)T.push(new N(m.queryChunks.map((f)=>{if(Z(f,_))return W.identifier(this.casing.getColumnCasing(f));return f})));else T.push(m);if(Z(c,N.Aliased))T.push(W` as ${W.identifier(c.fieldAlias)}`)}else if(Z(c,Li))if(o)T.push(W.identifier(this.casing.getColumnCasing(c)));else T.push(c);if(x<n-1)T.push(W`, `);return T});return W.join(p)}buildJoins(i){if(!i||i.length===0)return;let o=[];for(let[n,p]of i.entries()){if(n===0)o.push(W` `);let c=p.table,x=p.lateral?W` lateral`:void 0;if(Z(c,Zo)){let T=c[Zo.Symbol.Name],m=c[Zo.Symbol.Schema],f=c[Zo.Symbol.OriginalName],F=T===f?void 0:p.alias;o.push(W`${W.raw(p.joinType)} join${x} ${m?W`${W.identifier(m)}.`:void 0}${W.identifier(f)}${F&&W` ${W.identifier(F)}`} on ${p.on}`)}else if(Z(c,ro)){let T=c[Ni].name,m=c[Ni].schema,f=c[Ni].originalName,F=T===f?void 0:p.alias;o.push(W`${W.raw(p.joinType)} join${x} ${m?W`${W.identifier(m)}.`:void 0}${W.identifier(f)}${F&&W` ${W.identifier(F)}`} on ${p.on}`)}else o.push(W`${W.raw(p.joinType)} join${x} ${c} on ${p.on}`);if(n<i.length-1)o.push(W` `)}return W.join(o)}buildFromTable(i){if(Z(i,B)&&i[B.Symbol.IsAlias]){let o=W`${W.identifier(i[B.Symbol.OriginalName])}`;if(i[B.Symbol.Schema])o=W`${W.identifier(i[B.Symbol.Schema])}.${o}`;return W`${o} ${W.identifier(i[B.Symbol.Name])}`}return i}buildSelectQuery({withList:i,fields:o,fieldsFlat:n,where:p,having:c,table:x,joins:T,orderBy:m,groupBy:f,limit:F,offset:$,lockingClause:J,distinct:A,setOperators:X}){let Y=n??Un(o);for(let mi of Y)if(Z(mi.field,Li)&&Ro(mi.field.table)!==(Z(x,wo)?x._.alias:Z(x,pm)?x[Ni].name:Z(x,N)?void 0:Ro(x))&&!((Ei)=>T?.some(({alias:To})=>To===(Ei[B.Symbol.IsAlias]?Ro(Ei):Ei[B.Symbol.BaseName])))(mi.field.table)){let Ei=Ro(mi.field.table);throw new Error(`Your "${mi.path.join("->")}" field references a column "${Ei}"."${mi.field.name}", but the table "${Ei}" is not part of the query! Did you forget to join it?`)}let R=!T||T.length===0,K=this.buildWithCTE(i),U;if(A)U=A===!0?W` distinct`:W` distinct on (${W.join(A.on,W`, `)})`;let z=this.buildSelection(Y,{isSingleTable:R}),b=this.buildFromTable(x),M=this.buildJoins(T),u=p?W` where ${p}`:void 0,E=c?W` having ${c}`:void 0,S;if(m&&m.length>0)S=W` order by ${W.join(m,W`, `)}`;let C;if(f&&f.length>0)C=W` group by ${W.join(f,W`, `)}`;let q=typeof F==="object"||typeof F==="number"&&F>=0?W` limit ${F}`:void 0,Q=$?W` offset ${$}`:void 0,Ti=W.empty();if(J){let mi=W` for ${W.raw(J.strength)}`;if(J.config.of)mi.append(W` of ${W.join(Array.isArray(J.config.of)?J.config.of:[J.config.of],W`, `)}`);if(J.config.noWait)mi.append(W` no wait`);else if(J.config.skipLocked)mi.append(W` skip locked`);Ti.append(mi)}let l=W`${K}select${U} ${z} from ${b}${M}${u}${C}${E}${S}${q}${Q}${Ti}`;if(X.length>0)return this.buildSetOperations(l,X);return l}buildSetOperations(i,o){let[n,...p]=o;if(!n)throw new Error("Cannot pass undefined values to any set operator");if(p.length===0)return this.buildSetOperationQuery({leftSelect:i,setOperator:n});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:i,setOperator:n}),p)}buildSetOperationQuery({leftSelect:i,setOperator:{type:o,isAll:n,rightSelect:p,limit:c,orderBy:x,offset:T}}){let m=W`(${i.getSQL()}) `,f=W`(${p.getSQL()})`,F;if(x&&x.length>0){let X=[];for(let Y of x)if(Z(Y,_))X.push(W.identifier(Y.name));else if(Z(Y,N)){for(let R=0;R<Y.queryChunks.length;R++){let K=Y.queryChunks[R];if(Z(K,_))Y.queryChunks[R]=W.identifier(K.name)}X.push(W`${Y}`)}else X.push(W`${Y}`);F=W` order by ${W.join(X,W`, `)} `}let $=typeof c==="object"||typeof c==="number"&&c>=0?W` limit ${c}`:void 0,J=W.raw(`${o} ${n?"all ":""}`),A=T?W` offset ${T}`:void 0;return W`${m}${J}${f}${F}${$}${A}`}buildInsertQuery({table:i,values:o,onConflict:n,returning:p,withList:c,select:x,overridingSystemValue_:T}){let m=[],f=i[B.Symbol.Columns],F=Object.entries(f).filter(([K,U])=>!U.shouldDisableInsert()),$=F.map(([,K])=>W.identifier(this.casing.getColumnCasing(K)));if(x){let K=o;if(Z(K,N))m.push(K);else m.push(K.getSQL())}else{let K=o;m.push(W.raw("values "));for(let[U,z]of K.entries()){let b=[];for(let[M,u]of F){let E=z[M];if(E===void 0||Z(E,Tn)&&E.value===void 0)if(u.defaultFn!==void 0){let S=u.defaultFn(),C=Z(S,N)?S:W.param(S,u);b.push(C)}else if(!u.default&&u.onUpdateFn!==void 0){let S=u.onUpdateFn(),C=Z(S,N)?S:W.param(S,u);b.push(C)}else b.push(W`default`);else b.push(E)}if(m.push(b),U<K.length-1)m.push(W`, `)}}let J=this.buildWithCTE(c),A=W.join(m),X=p?W` returning ${this.buildSelection(p,{isSingleTable:!0})}`:void 0,Y=n?W` on conflict ${n}`:void 0,R=T===!0?W`overriding system value `:void 0;return W`${J}insert into ${i} ${$} ${R}${A}${Y}${X}`}buildRefreshMaterializedViewQuery({view:i,concurrently:o,withNoData:n}){let p=o?W` concurrently`:void 0,c=n?W` with no data`:void 0;return W`refresh materialized view${p} ${i}${c}`}prepareTyping(i){if(Z(i,E0)||Z(i,S0))return"json";else if(Z(i,O0))return"decimal";else if(Z(i,_0))return"time";else if(Z(i,L0)||Z(i,C0))return"timestamp";else if(Z(i,u0)||Z(i,Q0))return"date";else if(Z(i,y0))return"uuid";else return"none"}sqlToQuery(i,o){return i.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:o})}buildRelationalQueryWithoutPK({fullSchema:i,schema:o,tableNamesMap:n,table:p,tableConfig:c,queryConfig:x,tableAlias:T,nestedQueryRelation:m,joinOn:f}){let F=[],$,J,A=[],X,Y=[];if(x===!0)F=Object.entries(c.columns).map(([U,z])=>({dbKey:z.name,tsKey:U,field:tn(z,T),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let K=Object.fromEntries(Object.entries(c.columns).map(([E,S])=>[E,tn(S,T)]));if(x.where){let E=typeof x.where==="function"?x.where(K,d7()):x.where;X=E&&bT(E,T)}let U=[],z=[];if(x.columns){let E=!1;for(let[S,C]of Object.entries(x.columns)){if(C===void 0)continue;if(S in c.columns){if(!E&&C===!0)E=!0;z.push(S)}}if(z.length>0)z=E?z.filter((S)=>x.columns?.[S]===!0):Object.keys(c.columns).filter((S)=>!z.includes(S))}else z=Object.keys(c.columns);for(let E of z){let S=c.columns[E];U.push({tsKey:E,value:S})}let b=[];if(x.with)b=Object.entries(x.with).filter((E)=>!!E[1]).map(([E,S])=>({tsKey:E,queryConfig:S,relation:c.relations[E]}));let M;if(x.extras){M=typeof x.extras==="function"?x.extras(K,{sql:W}):x.extras;for(let[E,S]of Object.entries(M))U.push({tsKey:E,value:w$(S,T)})}for(let{tsKey:E,value:S}of U)F.push({dbKey:Z(S,N.Aliased)?S.fieldAlias:c.columns[E].name,tsKey:E,field:Z(S,Li)?tn(S,T):S,relationTableTsKey:void 0,isJson:!1,selection:[]});let u=typeof x.orderBy==="function"?x.orderBy(K,r7()):x.orderBy??[];if(!Array.isArray(u))u=[u];A=u.map((E)=>{if(Z(E,Li))return tn(E,T);return bT(E,T)}),$=x.limit,J=x.offset;for(let{tsKey:E,queryConfig:S,relation:C}of b){let q=iW(o,n,C),Q=vc(C.referencedTable),Ti=n[Q],l=`${T}_${E}`,mi=wc(...q.fields.map((lo,ip)=>dn(tn(q.references[ip],l),tn(lo,T)))),Ei=this.buildRelationalQueryWithoutPK({fullSchema:i,schema:o,tableNamesMap:n,table:i[Ti],tableConfig:o[Ti],queryConfig:Z(C,bp)?S===!0?{limit:1}:{...S,limit:1}:S,tableAlias:l,joinOn:mi,nestedQueryRelation:C}),To=W`${W.identifier(l)}.${W.identifier("data")}`.as(E);Y.push({on:W`true`,table:new wo(Ei.sql,{},l),alias:l,joinType:"left",lateral:!0}),F.push({dbKey:E,tsKey:E,field:To,relationTableTsKey:Ti,isJson:!0,selection:Ei.selection})}}if(F.length===0)throw new Z0({message:`No fields selected for table "${c.tsName}" ("${T}")`});let R;if(X=wc(f,X),m){let K=W`json_build_array(${W.join(F.map(({field:b,tsKey:M,isJson:u})=>u?W`${W.identifier(`${T}_${M}`)}.${W.identifier("data")}`:Z(b,N.Aliased)?b.sql:b),W`, `)})`;if(Z(m,lT))K=W`coalesce(json_agg(${K}${A.length>0?W` order by ${W.join(A,W`, `)}`:void 0}), '[]'::json)`;let U=[{dbKey:"data",tsKey:"data",field:K.as("data"),isJson:!0,relationTableTsKey:c.tsName,selection:F}];if($!==void 0||J!==void 0||A.length>0)R=this.buildSelectQuery({table:U0(p,T),fields:{},fieldsFlat:[{path:[],field:W.raw("*")}],where:X,limit:$,offset:J,orderBy:A,setOperators:[]}),X=void 0,$=void 0,J=void 0,A=[];else R=U0(p,T);R=this.buildSelectQuery({table:Z(R,Zo)?R:new wo(R,{},T),fields:{},fieldsFlat:U.map(({field:b})=>({path:[],field:Z(b,Li)?tn(b,T):b})),joins:Y,where:X,limit:$,offset:J,orderBy:A,setOperators:[]})}else R=this.buildSelectQuery({table:U0(p,T),fields:{},fieldsFlat:F.map(({field:K})=>({path:[],field:Z(K,Li)?tn(K,T):K})),joins:Y,where:X,limit:$,offset:J,orderBy:A,setOperators:[]});return{tableTsKey:c.tsName,sql:R,selection:F}}}class IJ{static[w]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class ao{static[w]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor(i){if(this.fields=i.fields,this.session=i.session,this.dialect=i.dialect,i.withList)this.withList=i.withList;this.distinct=i.distinct}authToken;setToken(i){return this.authToken=i,this}from(i){let o=!!this.fields,n=i,p;if(this.fields)p=this.fields;else if(Z(n,wo))p=Object.fromEntries(Object.keys(n._.selectedFields).map((c)=>[c,n[c]]));else if(Z(n,pm))p=n[Ni].selectedFields;else if(Z(n,N))p={};else p=d3(n);return new BJ({table:n,fields:p,isPartialSelect:o,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class WY extends IJ{static[w]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:i,fields:o,isPartialSelect:n,session:p,dialect:c,withList:x,distinct:T}){super();this.config={withList:x,table:i,fields:{...o},distinct:T,setOperators:[]},this.isPartialSelect=n,this.session=p,this.dialect=c,this._={selectedFields:o},this.tableName=Ap(i),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}createJoin(i){return(o,n)=>{let p=this.tableName,c=Ap(o);if(typeof c==="string"&&this.config.joins?.some((x)=>x.alias===c))throw new Error(`Alias "${c}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof p==="string")this.config.fields={[p]:this.config.fields};if(typeof c==="string"&&!Z(o,N)){let x=Z(o,wo)?o._.selectedFields:Z(o,ro)?o[Ni].selectedFields:o[B.Symbol.Columns];this.config.fields[c]=x}}if(typeof n==="function")n=n(new Proxy(this.config.fields,new ti({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:n,table:o,joinType:i,alias:c}),typeof c==="string")switch(i){case"left":{this.joinsNotNullableMap[c]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([x])=>[x,!1])),this.joinsNotNullableMap[c]=!0;break}case"inner":{this.joinsNotNullableMap[c]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([x])=>[x,!1])),this.joinsNotNullableMap[c]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(i,o){return(n)=>{let p=typeof n==="function"?n(NE()):n;if(!jT(this.getSelectedFields(),p.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:i,isAll:o,rightSelect:p}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);intersectAll=this.createSetOperator("intersect",!0);except=this.createSetOperator("except",!1);exceptAll=this.createSetOperator("except",!0);addSetOperators(i){return this.config.setOperators.push(...i),this}where(i){if(typeof i==="function")i=i(new Proxy(this.config.fields,new ti({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=i,this}having(i){if(typeof i==="function")i=i(new Proxy(this.config.fields,new ti({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=i,this}groupBy(...i){if(typeof i[0]==="function"){let o=i[0](new Proxy(this.config.fields,new ti({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(o)?o:[o]}else this.config.groupBy=i;return this}orderBy(...i){if(typeof i[0]==="function"){let o=i[0](new Proxy(this.config.fields,new ti({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),n=Array.isArray(o)?o:[o];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=n;else this.config.orderBy=n}else{let o=i;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=o;else this.config.orderBy=o}return this}limit(i){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=i;else this.config.limit=i;return this}offset(i){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=i;else this.config.offset=i;return this}for(i,o={}){return this.config.lockingClause={strength:i,config:o},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:i,...o}=this.dialect.sqlToQuery(this.getSQL());return o}as(i){return new Proxy(new wo(this.getSQL(),this.config.fields,i),new ti({alias:i,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new ti({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class BJ extends WY{static[w]="PgSelect";_prepare(i){let{session:o,config:n,dialect:p,joinsNotNullableMap:c,authToken:x}=this;if(!o)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");return Ci.startActiveSpan("drizzle.prepareQuery",()=>{let T=Un(n.fields),m=o.prepareQuery(p.sqlToQuery(this.getSQL()),T,i,!0);return m.joinsNotNullableMap=c,m.setToken(x)})}prepare(i){return this._prepare(i)}authToken;setToken(i){return this.authToken=i,this}execute=(i)=>{return Ci.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(i,this.authToken)})}}t3(BJ,[jo]);function Cx(i,o){return(n,p,...c)=>{let x=[p,...c].map((T)=>({type:i,isAll:o,rightSelect:T}));for(let T of x)if(!jT(n.getSelectedFields(),T.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return n.addSetOperators(x)}}var NE=()=>({union:bE,unionAll:jE,intersect:PE,intersectAll:aE,except:lE,exceptAll:qE}),bE=Cx("union",!1),jE=Cx("union",!0),PE=Cx("intersect",!1),aE=Cx("intersect",!0),lE=Cx("except",!1),qE=Cx("except",!0);class cm{static[w]="PgQueryBuilder";dialect;dialectConfig;constructor(i){this.dialect=Z(i,Qc)?i:void 0,this.dialectConfig=Z(i,Qc)?void 0:i}$with=(i,o)=>{let n=this;return{as:(c)=>{if(typeof c==="function")c=c(n);return new Proxy(new IT(c.getSQL(),o??("getSelectedFields"in c?c.getSelectedFields()??{}:{}),i,!0),new ti({alias:i,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...i){let o=this;function n(x){return new ao({fields:x??void 0,session:void 0,dialect:o.getDialect(),withList:i})}function p(x){return new ao({fields:x??void 0,session:void 0,dialect:o.getDialect(),distinct:!0})}function c(x,T){return new ao({fields:T??void 0,session:void 0,dialect:o.getDialect(),distinct:{on:x}})}return{select:n,selectDistinct:p,selectDistinctOn:c}}select(i){return new ao({fields:i??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(i){return new ao({fields:i??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(i,o){return new ao({fields:o??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:i}})}getDialect(){if(!this.dialect)this.dialect=new Qc(this.dialectConfig);return this.dialect}}class U1{constructor(i,o,n,p,c){this.table=i,this.session=o,this.dialect=n,this.withList=p,this.overridingSystemValue_=c}static[w]="PgInsertBuilder";authToken;setToken(i){return this.authToken=i,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values(i){if(i=Array.isArray(i)?i:[i],i.length===0)throw new Error("values() must be called with at least one value");let o=i.map((n)=>{let p={},c=this.table[B.Symbol.Columns];for(let x of Object.keys(n)){let T=n[x];p[x]=Z(T,N)?T:new Tn(T,c[x])}return p});return new NJ(this.table,o,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select(i){let o=typeof i==="function"?i(new cm):i;if(!Z(o,N)&&!jT(this.table[K0],o._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new NJ(this.table,o,this.session,this.dialect,this.withList,!0)}}class NJ extends jo{constructor(i,o,n,p,c,x,T){super();this.session=n,this.dialect=p,this.config={table:i,values:o,withList:c,select:x,overridingSystemValue_:T}}static[w]="PgInsert";config;returning(i=this.config.table[B.Symbol.Columns]){return this.config.returningFields=i,this.config.returning=Un(i),this}onConflictDoNothing(i={}){if(i.target===void 0)this.config.onConflict=W`do nothing`;else{let o="";o=Array.isArray(i.target)?i.target.map((p)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(p))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(i.target));let n=i.where?W` where ${i.where}`:void 0;this.config.onConflict=W`(${W.raw(o)})${n} do nothing`}return this}onConflictDoUpdate(i){if(i.where&&(i.targetWhere||i.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');let o=i.where?W` where ${i.where}`:void 0,n=i.targetWhere?W` where ${i.targetWhere}`:void 0,p=i.setWhere?W` where ${i.setWhere}`:void 0,c=this.dialect.buildUpdateSet(this.config.table,z0(this.config.table,i.set)),x="";return x=Array.isArray(i.target)?i.target.map((T)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(T))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(i.target)),this.config.onConflict=W`(${W.raw(x)})${n} do update set ${c}${o}${p}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:i,...o}=this.dialect.sqlToQuery(this.getSQL());return o}_prepare(i){return Ci.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,i,!0)})}prepare(i){return this._prepare(i)}authToken;setToken(i){return this.authToken=i,this}execute=(i)=>{return Ci.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(i,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new ti({alias:Ro(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class bJ extends jo{constructor(i,o,n){super();this.session=o,this.dialect=n,this.config={view:i}}static[w]="PgRefreshMaterializedView";config;concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:i,...o}=this.dialect.sqlToQuery(this.getSQL());return o}_prepare(i){return Ci.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,i,!0)})}prepare(i){return this._prepare(i)}authToken;setToken(i){return this.authToken=i,this}execute=(i)=>{return Ci.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(i,this.authToken)})}}class Z1{constructor(i,o,n,p){this.table=i,this.session=o,this.dialect=n,this.withList=p}static[w]="PgUpdateBuilder";authToken;setToken(i){return this.authToken=i,this}set(i){return new RY(this.table,z0(this.table,i),this.session,this.dialect,this.withList).setToken(this.authToken)}}class RY extends jo{constructor(i,o,n,p,c){super();this.session=n,this.dialect=p,this.config={set:o,table:i,withList:c,joins:[]},this.tableName=Ap(i),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[w]="PgUpdate";config;tableName;joinsNotNullableMap;from(i){let o=i,n=Ap(o);if(typeof n==="string")this.joinsNotNullableMap[n]=!0;return this.config.from=o,this}getTableLikeFields(i){if(Z(i,Zo))return i[B.Symbol.Columns];else if(Z(i,wo))return i._.selectedFields;return i[Ni].selectedFields}createJoin(i){return(o,n)=>{let p=Ap(o);if(typeof p==="string"&&this.config.joins.some((c)=>c.alias===p))throw new Error(`Alias "${p}" is already used in this query`);if(typeof n==="function"){let c=this.config.from&&!Z(this.config.from,N)?this.getTableLikeFields(this.config.from):void 0;n=n(new Proxy(this.config.table[B.Symbol.Columns],new ti({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),c&&new Proxy(c,new ti({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:n,table:o,joinType:i,alias:p}),typeof p==="string")switch(i){case"left":{this.joinsNotNullableMap[p]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([c])=>[c,!1])),this.joinsNotNullableMap[p]=!0;break}case"inner":{this.joinsNotNullableMap[p]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([c])=>[c,!1])),this.joinsNotNullableMap[p]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(i){return this.config.where=i,this}returning(i){if(!i){if(i=Object.assign({},this.config.table[B.Symbol.Columns]),this.config.from){let o=Ap(this.config.from);if(typeof o==="string"&&this.config.from&&!Z(this.config.from,N)){let n=this.getTableLikeFields(this.config.from);i[o]=n}for(let n of this.config.joins){let p=Ap(n.table);if(typeof p==="string"&&!Z(n.table,N)){let c=this.getTableLikeFields(n.table);i[p]=c}}}}return this.config.returningFields=i,this.config.returning=Un(i),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:i,...o}=this.dialect.sqlToQuery(this.getSQL());return o}_prepare(i){let o=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,i,!0);return o.joinsNotNullableMap=this.joinsNotNullableMap,o}prepare(i){return this._prepare(i)}authToken;setToken(i){return this.authToken=i,this}execute=(i)=>{return this._prepare().execute(i,this.authToken)};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new ti({alias:Ro(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class xm extends N{constructor(i){super(xm.buildEmbeddedCount(i.source,i.filters).queryChunks);this.params=i,this.mapWith(Number),this.session=i.session,this.sql=xm.buildCount(i.source,i.filters)}sql;token;static[w]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount(i,o){return W`(select count(*) from ${i}${W.raw(" where ").if(o)}${o})`}static buildCount(i,o){return W`select count(*) as count from ${i}${W.raw(" where ").if(o)}${o};`}setToken(i){return this.token=i,this}then(i,o){return Promise.resolve(this.session.count(this.sql,this.token)).then(i,o)}catch(i){return this.then(void 0,i)}finally(i){return this.then((o)=>{return i?.(),o},(o)=>{throw i?.(),o})}}class PJ{constructor(i,o,n,p,c,x,T){this.fullSchema=i,this.schema=o,this.tableNamesMap=n,this.table=p,this.tableConfig=c,this.dialect=x,this.session=T}static[w]="PgRelationalQueryBuilder";findMany(i){return new jJ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,i?i:{},"many")}findFirst(i){return new jJ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,i?{...i,limit:1}:{limit:1},"first")}}class jJ extends jo{constructor(i,o,n,p,c,x,T,m,f){super();this.fullSchema=i,this.schema=o,this.tableNamesMap=n,this.table=p,this.tableConfig=c,this.dialect=x,this.session=T,this.config=m,this.mode=f}static[w]="PgRelationalQuery";_prepare(i){return Ci.startActiveSpan("drizzle.prepareQuery",()=>{let{query:o,builtQuery:n}=this._toSQL();return this.session.prepareQuery(n,void 0,i,!0,(p,c)=>{let x=p.map((T)=>D0(this.schema,this.tableConfig,T,o.selection,c));if(this.mode==="first")return x[0];return x})})}prepare(i){return this._prepare(i)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let i=this._getQuery(),o=this.dialect.sqlToQuery(i.sql);return{query:i,builtQuery:o}}toSQL(){return this._toSQL().builtQuery}authToken;setToken(i){return this.authToken=i,this}execute(){return Ci.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class aJ extends jo{constructor(i,o,n,p){super();this.execute=i,this.sql=o,this.query=n,this.mapBatchResult=p}static[w]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult(i,o){return o?this.mapBatchResult(i):i}_prepare(){return this}isResponseInArrayMode(){return!1}}class Tm{constructor(i,o,n){if(this.dialect=i,this.session=o,this._=n?{schema:n.schema,fullSchema:n.fullSchema,tableNamesMap:n.tableNamesMap,session:o}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:o},this.query={},this._.schema)for(let[p,c]of Object.entries(this._.schema))this.query[p]=new PJ(n.fullSchema,this._.schema,this._.tableNamesMap,n.fullSchema[p],c,i,o)}static[w]="PgDatabase";query;$with=(i,o)=>{let n=this;return{as:(c)=>{if(typeof c==="function")c=c(new cm(n.dialect));return new Proxy(new IT(c.getSQL(),o??("getSelectedFields"in c?c.getSelectedFields()??{}:{}),i,!0),new ti({alias:i,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count(i,o){return new xm({source:i,filters:o,session:this.session})}with(...i){let o=this;function n(f){return new ao({fields:f??void 0,session:o.session,dialect:o.dialect,withList:i})}function p(f){return new ao({fields:f??void 0,session:o.session,dialect:o.dialect,withList:i,distinct:!0})}function c(f,F){return new ao({fields:F??void 0,session:o.session,dialect:o.dialect,withList:i,distinct:{on:f}})}function x(f){return new Z1(f,o.session,o.dialect,i)}function T(f){return new U1(f,o.session,o.dialect,i)}function m(f){return new H1(f,o.session,o.dialect,i)}return{select:n,selectDistinct:p,selectDistinctOn:c,update:x,insert:T,delete:m}}select(i){return new ao({fields:i??void 0,session:this.session,dialect:this.dialect})}selectDistinct(i){return new ao({fields:i??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(i,o){return new ao({fields:o??void 0,session:this.session,dialect:this.dialect,distinct:{on:i}})}update(i){return new Z1(i,this.session,this.dialect)}insert(i){return new U1(i,this.session,this.dialect)}delete(i){return new H1(i,this.session,this.dialect)}refreshMaterializedView(i){return new bJ(i,this.session,this.dialect)}authToken;execute(i){let o=typeof i==="string"?W.raw(i):i.getSQL(),n=this.dialect.sqlToQuery(o),p=this.session.prepareQuery(n,void 0,void 0,!1);return new aJ(()=>p.execute(void 0,this.authToken),o,n,(c)=>p.mapResult(c,!0))}transaction(i,o){return this.session.transaction(i,o)}}class YY{constructor(i,o){this.unique=i,this.name=o}static[w]="PgIndexBuilderOn";on(...i){return new M1(i.map((o)=>{if(Z(o,N))return o;o=o;let n=new DT(o.name,!!o.keyAsName,o.columnType,o.indexConfig);return o.indexConfig=JSON.parse(JSON.stringify(o.defaultConfig)),n}),this.unique,!1,this.name)}onOnly(...i){return new M1(i.map((o)=>{if(Z(o,N))return o;o=o;let n=new DT(o.name,!!o.keyAsName,o.columnType,o.indexConfig);return o.indexConfig=o.defaultConfig,n}),this.unique,!0,this.name)}using(i,...o){return new M1(o.map((n)=>{if(Z(n,N))return n;n=n;let p=new DT(n.name,!!n.keyAsName,n.columnType,n.indexConfig);return n.indexConfig=JSON.parse(JSON.stringify(n.defaultConfig)),p}),this.unique,!0,this.name,i)}}class M1{static[w]="PgIndexBuilder";config;constructor(i,o,n,p,c="btree"){this.config={name:p,columns:i,unique:o,only:n,method:c}}concurrently(){return this.config.concurrently=!0,this}with(i){return this.config.with=i,this}where(i){return this.config.where=i,this}build(i){return new GY(this.config,i)}}class GY{static[w]="PgIndex";config;constructor(i,o){this.config={...i,table:o}}}function lJ(i){return new YY(!0,i)}class qJ{constructor(i){this.query=i}authToken;getQuery(){return this.query}mapResult(i,o){return i}setToken(i){return this.authToken=i,this}static[w]="PgPreparedQuery";joinsNotNullableMap}class kJ{constructor(i){this.dialect=i}static[w]="PgSession";execute(i,o){return Ci.startActiveSpan("drizzle.operation",()=>{return Ci.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery(i),void 0,void 0,!1)}).setToken(o).execute(void 0,o)})}all(i){return this.prepareQuery(this.dialect.sqlToQuery(i),void 0,void 0,!1).all()}async count(i,o){let n=await this.execute(i,o);return Number(n[0].count)}}class hJ extends Tm{constructor(i,o,n,p=0){super(i,o,n);this.schema=n,this.nestedIndex=p}static[w]="PgTransaction";rollback(){throw new X$}getTransactionConfigSQL(i){let o=[];if(i.isolationLevel)o.push(`isolation level ${i.isolationLevel}`);if(i.accessMode)o.push(i.accessMode);if(typeof i.deferrable==="boolean")o.push(i.deferrable?"deferrable":"not deferrable");return W.raw(o.join(" "))}setTransaction(i){return this.session.execute(W`set transaction ${this.getTransactionConfigSQL(i)}`)}}class KY extends qJ{constructor(i,o,n,p,c,x,T){super({sql:o,params:n});this.client=i,this.queryString=o,this.params=n,this.logger=p,this.fields=c,this._isResponseInArrayMode=x,this.customResultMapper=T}static[w]="PostgresJsPreparedQuery";async execute(i={}){return Ci.startActiveSpan("drizzle.execute",async(o)=>{let n=v$(this.params,i);o?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(n)}),this.logger.logQuery(this.queryString,n);let{fields:p,queryString:c,client:x,joinsNotNullableMap:T,customResultMapper:m}=this;if(!p&&!m)return Ci.startActiveSpan("drizzle.driver.execute",()=>{return x.unsafe(c,n)});let f=await Ci.startActiveSpan("drizzle.driver.execute",()=>{return o?.setAttributes({"drizzle.query.text":c,"drizzle.query.params":JSON.stringify(n)}),x.unsafe(c,n).values()});return Ci.startActiveSpan("drizzle.mapResponse",()=>{return m?m(f):f.map((F)=>s3(p,F,T))})})}all(i={}){return Ci.startActiveSpan("drizzle.execute",async(o)=>{let n=v$(this.params,i);return o?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(n)}),this.logger.logQuery(this.queryString,n),Ci.startActiveSpan("drizzle.driver.execute",()=>{return o?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(n)}),this.client.unsafe(this.queryString,n)})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class mm extends kJ{constructor(i,o,n,p={}){super(o);this.client=i,this.schema=n,this.options=p,this.logger=p.logger??new R$}static[w]="PostgresJsSession";logger;prepareQuery(i,o,n,p,c){return new KY(this.client,i.sql,i.params,this.logger,o,p,c)}query(i,o){return this.logger.logQuery(i,o),this.client.unsafe(i,o).values()}queryObjects(i,o){return this.client.unsafe(i,o)}transaction(i,o){return this.client.begin(async(n)=>{let p=new mm(n,this.dialect,this.schema,this.options),c=new gJ(this.dialect,p,this.schema);if(o)await c.setTransaction(o);return i(c)})}}class gJ extends hJ{constructor(i,o,n,p=0){super(i,o,n,p);this.session=o}static[w]="PostgresJsTransaction";transaction(i){return this.session.client.savepoint((o)=>{let n=new mm(o,this.dialect,this.schema,this.session.options),p=new gJ(this.dialect,n,this.schema);return i(p)})}}class HY extends Tm{static[w]="PostgresJsDatabase"}function yx(i,o={}){let n=(f)=>f;for(let f of["1184","1082","1083","1114","1182","1185","1115","1231"])i.options.parsers[f]=n,i.options.serializers[f]=n;i.options.serializers["114"]=n,i.options.serializers["3802"]=n;let p=new Qc({casing:o.casing}),c;if(o.logger===!0)c=new W$;else if(o.logger!==!1)c=o.logger;let x;if(o.schema){let f=e7(o.schema,oW);x={fullSchema:o.schema,schema:f.tables,tableNamesMap:f.tableNamesMap}}let T=new mm(i,p,x,{logger:c}),m=new HY(p,T,x);return m.$client=i,m}function z1(...i){if(typeof i[0]==="string"){let o=Lx(i[0]);return yx(o,i[1])}if(r3(i[0])){let{connection:o,client:n,...p}=i[0];if(n)return yx(n,p);if(typeof o==="object"&&o.url!==void 0){let{url:x,...T}=o,m=Lx(x,T);return yx(m,p)}let c=Lx(o);return yx(c,p)}return yx(i[0],i[1])}((i)=>{function o(n){return yx({options:{parsers:{},serializers:{}}},n)}i.mock=o})(z1||(z1={}));var tJ={};CG(tJ,{users:()=>jn,userChanges:()=>hE,untrackedUserColumnNames:()=>kE,twoFactorMethod:()=>uY,trackedUserColumnName:()=>zY,trackableUserColumnNames:()=>MY,role:()=>ZY,players:()=>sJ,passwordResetAttempts:()=>gE,loginHistory:()=>Dx,games:()=>u1,banishedIps:()=>Q1});function UY(i){return W`lower(${i})`}var ZY=Y0("role",["admin","user"]),jn=Np("users",{id:mn().primaryKey().defaultRandom(),username:Co({length:16}).notNull(),email:Co({length:254}).notNull(),password:Co({length:254}).notNull(),createdAt:In({withTimezone:!0}).notNull().defaultNow(),createdIp:Co({length:45}).notNull(),isActive:PT().notNull().default(!1),verifiedAt:In({withTimezone:!0}),userRole:ZY().default("user")},(i)=>[lJ("usernameUniqueIndex").on(UY(i.username)),lJ("emailUniqueIndex").on(UY(i.email))]),kE=["id","createdAt","createdIp","isActive","verifiedAt"],MY=["username","email","password","userRole"],zY=Y0("trackedUserColumnName",MY),hE=Np("userChanges",{id:mn().primaryKey().defaultRandom(),userId:mn().notNull().references(()=>jn.id,{onDelete:"cascade"}),changedAt:In({withTimezone:!0}).notNull().defaultNow(),changedIp:Co({length:45}).notNull(),changedColumn:zY().notNull(),oldValue:Co({length:255}),newValue:Co({length:255})}),u1=Np("games",{id:mn().primaryKey().defaultRandom()}),sJ=Np("players",{userId:mn().notNull().references(()=>jn.id,{onDelete:"cascade"}),gameId:mn().notNull().references(()=>u1.id,{onDelete:"cascade"}),score:V0().notNull()},(i)=>[g7({name:"players_userId_gameId_pk",columns:[i.userId,i.gameId]})]),Dx=Np("loginHistory",{id:mn().primaryKey().defaultRandom(),userId:mn().references(()=>jn.id,{onDelete:"cascade"}),loginTime:In({withTimezone:!0}).notNull().defaultNow(),ipAddress:Co({length:45}).notNull(),userAgent:Co({length:1024}),successful:PT().notNull().default(!1)}),uY=Y0("twoFactorMethod",["email","phone"]),gE=Np("passwordResetAttempts",{id:mn().primaryKey().defaultRandom(),userId:mn().notNull().references(()=>jn.id,{onDelete:"cascade"}),requestedIp:Co({length:45}).notNull(),requestedAt:In({withTimezone:!0}).notNull().defaultNow(),succeededIp:Co({length:45}),succeededAt:In({withTimezone:!0}),verificationMethod:uY().notNull()}),Q1=Np("banishedIps",{ip:Co({length:45}).primaryKey(),reason:Co({length:2048}).notNull(),banishedAt:In({withTimezone:!0}).notNull().defaultNow(),banishedUntil:In({withTimezone:!0})});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class dJ{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(sE.resolve(__dirname,"notify_update.sql"));let i=[Ro(jn),Ro(u1),Ro(sJ)];await this.sql`SELECT create_notify_triggers(${this.sql.array(i)})`,await this.sql.listen("table_update",(o)=>{let n=o.split(","),p=n[0],c=n[1],x=`${p}("${c}")`;if(this.observers.has(x))this.observers.get(x).next(x)})}constructor(i=!1,o={host:oo.POSTGRES_HOST,port:oo.POSTGRES_PORT,user:oo.POSTGRES_USER,password:oo.POSTGRES_PASSWORD,database:oo.POSTGRES_DATABASE}){this.options=o,this.sql=Lx(o),this.drizzle=z1(this.sql,{schema:tJ,logger:i})}observe(i,o){if(!this.observers.has(i))this.observers.set(i,new $i);this.observers.get(i).subscribe("SINGLETON",o)}}import{createHash as tE}from"crypto";function rJ(i){let o=tE("sha256").update(i).digest("hex");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20,32)}`}var QY=["123","321","abc","admin","adobe","alexander","amanda","andrea","andrew","angel","apple","asdf","ashley","baby","banana","baseball","batman","bear","biteme","blazer","blonde","boston","buster","butterfly","cameron","charlie","cheese","chelsea","chicken","chocolate","chris","compaq","computer","cookie","corvette","cowboys","dakota","dallas","daniel","david","diamond","dolphin","donald","dragon","eagle","flower","football","frank","freedom","friend","gateway","george","ginger","god","golf","hannah","hardcore","harley","heather","hello","hottie","hunter","internet","jasmine","jennifer","jessica","jesus","johnny","jordan","joshua","justin","justme","killer","knight","lakers","letmein","liverpool","login","london","love","lucky","mackenzie","maggie","master","matrix","matthew","maverick","melissa","mercedes","michael","michelle","mickey","miller","money","monkey","morgan","mother","muffin","mustang","natasha","nathan","nicole","ninja","orange","pass","password","patrick","peanut","pepper","phoenix","photoshop","pokemon","princess","purple","qazwsx","qwerty","rainbow","ranger","root","samantha","samsung","scooter","secret","shadow","simpson","smile","soccer","sparkle","starwars","summer","sunflower","sunshine","superman","taylor","temp","test","thomas","tigers","tigger","tinkerbell","trust","turtle","victoria","welcome","whatever","william","winter","yellow","zaq12wsx","zxcvbn"];var dE=3,rE=15,eE=/^[a-zA-Z0-9_-]+$/,zmi=ri(eE).pipe(ri(`string > ${dE} & string < ${rE}`)).brand("username"),VY=20,SY={"0":"o","1":"l","3":"e","4":"a","5":"s","7":"t","@":"a",$:"s","!":"i"};function iO(i){let o="";for(let n of i)if(n in SY)o+=SY[n];else o+=n;return o}function oO(i){let o=i.toLocaleLowerCase(),n=iO(o);for(let p of QY){if(n.includes(p))return!0;if(o.includes(p))return!0}return!1}function nO(i){let o=new Set(i).size;return i.length*Math.log2(o)}function pO(i){let o=0,n=100;if(oO(i))o-=n;return o+=nO(i)*0.5,Math.max(o,0)}var umi=ri("string").narrow((i,o)=>{let n=pO(i);return n>=VY?!0:o.mustBe(`Of complexity ${VY} or more. Was ${n.toFixed(2)}.`)}).brand("password"),EY=ri({"+":"delete",username:"string",password:"string"}),Qmi=ri("string").brand("email"),OY=ri({"+":"delete",username:"string",password:"string",email:"string"});var V1={100:'"Continue"',101:'"Switching Protocols"',102:'"Processing"',103:'"Early Hints"',200:'"OK"',201:'"Created"',202:'"Accepted"',203:'"Non-Authoritative Information"',204:'"No Content"',205:'"Reset Content"',206:'"Partial Content"',207:'"Multi-Status"',208:'"Already Reported"',226:'"IM Used"',300:'"Multiple Choices"',301:'"Moved Permanently"',302:'"Found"',303:'"See Other"',304:'"Not Modified"',305:'"Use Proxy"',306:'"Switch Proxy"',307:'"Temporary Redirect"',308:'"Permanent Redirect"',400:'"Bad Request"',401:'"Unauthorized"',402:'"Payment Required"',403:'"Forbidden"',404:'"Not Found"',405:'"Method Not Allowed"',406:'"Not Acceptable"',407:'"Proxy Authentication Required"',408:'"Request Timeout"',409:'"Conflict"',410:'"Gone"',411:'"Length Required"',412:'"Precondition Failed"',413:'"Payload Too Large"',414:'"URI Too Long"',415:'"Unsupported Media Type"',416:'"Range Not Satisfiable"',417:'"Expectation Failed"',418:`"I'm a teapot"`,421:'"Misdirected Request"',422:'"Unprocessable Entity"',423:'"Locked"',424:'"Failed Dependency"',425:'"Too Early"',426:'"Upgrade Required"',428:'"Precondition Required"',429:'"Too Many Requests"',431:'"Request Header Fields Too Large"',451:'"Unavailable For Legal Reasons"',500:'"Internal Server Error"',501:'"Not Implemented"',502:'"Bad Gateway"',503:'"Service Unavailable"',504:'"Gateway Timeout"',505:'"HTTP Version Not Supported"',506:'"Variant Also Negotiates"',507:'"Insufficient Storage"',508:'"Loop Detected"',510:'"Not Extended"',511:'"Network Authentication Required"'};function cO(i){return Number.parseInt(i,10)}var xO=ri(V1),TO=xO.keyof().pipe((i)=>cO(i)),_Y=ri([TO,"string"]);var LY=Op({key:"count",default:0}),mO=Tc({key:"incrementTX",do:({set:i})=>{i(LY,(o)=>o+1)}}),CY=m8({key:"countContinuity",config:(i)=>i.add(LY).add(mO)});var yY=RJ(qp,"backend.worker.game.bun",xi),Vc=new dJ({logQuery(i,o){xi.info("\uD83D\uDCDD query",i,o)}});d.STORE.loggers[0]=new pc("info",void 0,xi);var emi=(()=>{let{__tribunalDaily:i}=globalThis;if(!i)i=new DY.CronJob("00 15 * * * *",()=>{RJ(qp,"backend.worker.tribunal.bun",xi)}),i.start(),process.on("exit",()=>{i.stop(),xi.info("\u231B tribunal daily cronjob stopped")}),xi.info("\u23F3 tribunal daily cronjob started");return i})();function $O(i){if(WJ)return FO(WJ,i);return fO({},i)}var IY=$O((i,o)=>{let n;i.on("data",(p)=>(n??=[]).push(p)).on("end",async()=>{let p=i.headers.authorization;try{if(typeof i.url==="undefined")throw[400,"No URL"];let c=i.socket.remoteAddress;if(!c)throw[400,"No IP address"];let x=new Date,T=new URL(i.url,oo.VITE_BACKEND_ORIGIN);xi.info(x,c,i.method,T.pathname);let m=await Vc.drizzle.query.banishedIps.findFirst({columns:{banishedUntil:!0},where:dn(Q1.ip,c)}),f=m?.banishedUntil===null,F=m?.banishedUntil&&m.banishedUntil>x;if(f||F){xi.info(`\uD83D\uDE45 request from banned ip ${c}`);return}switch(i.method){case"POST":if(!n)throw[400,"No data received"];switch(T.pathname){case`/sign-up-${rJ("sign-up")}`:{let $=Buffer.concat(n).toString(),J=JSON.parse($),A=OY(J);if(A instanceof ri.errors)throw xi.warn("signup parsed",A),[400,"Signup failed"];let{username:X,password:Y,email:R}=A;if(xi.info(`\uD83D\uDD11 attempting to sign up: ${X}`),await Vc.drizzle.query.users.findFirst({columns:{id:!0},where:dn(jn.email,R)}))throw[400,"User already exists"];let U=await Bun.password.hash(Y,{algorithm:"bcrypt",cost:10});await Vc.drizzle.insert(jn).values({username:X,email:R,password:U,createdIp:c}),xi.info(`\uD83D\uDD11 user created: ${X}`),o.writeHead(201,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${oo.FRONTEND_ORIGINS[0]}`}),o.end(V1[201])}break;case`/login-${rJ("login")}`:{let $=!1,J=null;try{let A=new Date(+x-600000);xi.info("\uD83D\uDD11 ten minutes ago",{tenMinutesAgo:A,now:x});let X=await Vc.drizzle.query.loginHistory.findMany({columns:{userId:!0,successful:!0},where:wc(dn(Dx.ipAddress,c),dn(Dx.successful,!1),M0(Dx.loginTime,A)),limit:10});xi.info(`\uD83D\uDD11 ${X.length}/10 recent failed logins from ${c}`);let Y=10-X.length;if(Y<1)throw xi.info(`\uD83D\uDD11 too many recent failed logins from ${c}`),await Vc.drizzle.insert(Q1).values({ip:c,reason:"Too many recent login attempts.",banishedAt:x,banishedUntil:new Date(+x+86400000)}),[429,"Too many recent login attempts."];let R=Buffer.concat(n).toString(),K=JSON.parse(R),U=EY(K);if(U instanceof ri.errors)throw xi.warn("login parsed",U),[400,`${Y} attempts remaining.`];let{username:z,password:b}=U,M=await Vc.drizzle.query.users.findFirst({columns:{id:!0,password:!0},where:dn(jn.username,z)});if(xi.info("\uD83D\uDD11 login attempt as user",z),!M)throw xi.info(`\uD83D\uDD11 user ${z} does not exist`),[400,`${Y} attempts remaining.`];let{password:u}=M;if(J=M.id,await Bun.password.verify(b,u)){let S=crypto.randomUUID(),C=F1.get(z);if(!C)C=new Map,F1.set(z,C);C.set(S,Number(x)),$=!0,xi.info("\uD83D\uDD11 login successful as",z),o.writeHead(200,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${oo.FRONTEND_ORIGINS[0]}`}),o.end(`${z} ${S}`)}}finally{await Vc.drizzle.insert(Dx).values({userId:J,successful:$,ipAddress:c,userAgent:i.headers["user-agent"]??"Withheld"}),xi.info(`\uD83D\uDD11 recorded login attempt from ${c}`)}}break;default:throw[404,"Not found"]}break;case void 0:throw[400,"No Method"];default:throw[405,"Method not allowed"]}}catch(c){let x=_Y(c);if(x instanceof ri.errors)xi.error(c),o.writeHead(500,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${oo.FRONTEND_ORIGINS[0]}`}),o.end("Internal Server Error");else{let[T,m]=x,F=`${V1[T]}. ${m}`;xi.info(`\u274C ${T}: ${F}`),o.writeHead(T,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${oo.FRONTEND_ORIGINS[0]}`}),o.end(F)}}})}),eJ=IY.listen(oo.BACKEND_PORT).address(),JO=typeof eJ==="string"?null:eJ===null?null:eJ.port;if(JO===null)throw new Error("Could not determine port for test server");new lR(IY,{cors:{origin:oo.FRONTEND_ORIGINS,methods:["GET","POST"]}}).use((i,o)=>{let{username:n,sessionKey:p}=i.handshake.auth;if(!(n&&p)){o(new Error("No auth header provided"));return}let c=`user::${n}`,x=`socket::${i.id}`;if(F1.get(n)?.has(p)){let m=t(d.STORE,em,x);_i(d.STORE,m,i),Ep(mc,(f)=>{f.set(c,x)},d.STORE),_i(d.STORE,GF,(f)=>f.add(c)),_i(d.STORE,YF,(f)=>f.add(x)),xi.info(`${n} connected on ${i.id}`),o()}else xi.info(`${n} couldn't authenticate`),o(new Error("Authentication error"))}).on("connection",(i)=>{let n=X8({socket:i,store:d.STORE})(CY);i.on("disconnect",()=>{let p=`socket::${i.id}`,c=ix(mc,p,d.STORE).userKeyOfSocket,x=Mi(d.STORE,c);if(Ep(mc,(T)=>{T.delete(p)},d.STORE),x)_i(d.STORE,GF,(T)=>(T.delete(x),T));_i(d.STORE,YF,(T)=>(T.delete(p),T)),xi.info(`${i.id} disconnected`),n()})});async function S1(){xi.info("\uD83E\uDDF9 closing workers");let i=new Promise((o)=>yY.process.once("close",o));yY.emit("timeToStop"),await i,xi.info("\uD83D\uDEEC backend server exiting"),process.exit(0)}process.on("SIGINT",async()=>{xi.info("\u2757 received SIGINT; exiting gracefully"),await S1()});process.on("SIGTERM",async()=>{xi.info("\u2757 received SIGTERM; exiting gracefully"),await S1()});process.on("exit",async()=>{xi.info("\u2757 received exit; exiting gracefully"),await S1()});qp.on("updatesReady",()=>{xi.info('\u2757 backend server received signal "updatesReady"'),qp.emit("readyToUpdate"),xi.info('\u2757 backend server has sent signal "readyToUpdate"; now awaits signal "timeToStop"'),qp.on("timeToStop",async()=>{xi.info('\u2757 backend server received signal "timeToStop"; exiting gracefully'),await S1()})});xi.info(`\uD83D\uDEEB backend server ready on port ${oo.BACKEND_PORT}`);qp.emit("alive");export{emi as tribunalDaily};