tempest.games 0.1.37 → 0.1.39

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,76 +1,114 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var n3=Object.create;var{getPrototypeOf:i3,defineProperty:$f,getOwnPropertyNames:o3}=Object;var c3=Object.prototype.hasOwnProperty;var wf=(n,i,o)=>{o=n!=null?n3(i3(n)):{};let c=i||!n||!n.__esModule?$f(o,"default",{value:n,enumerable:!0}):o;for(let p of o3(n))if(!c3.call(c,p))$f(c,p,{get:()=>n[p],enumerable:!0});return c};var C=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);var p3=(n,i)=>{for(var o in i)$f(n,o,{get:i[o],enumerable:!0,configurable:!0,set:(c)=>i[o]=()=>c})};var Kn=import.meta.require;var aJ=C((mJ)=>{Object.defineProperty(mJ,"__esModule",{value:!0});class ro extends Error{}class iw extends ro{constructor(n){super(`Invalid DateTime: ${n.toMessage()}`)}}class ow extends ro{constructor(n){super(`Invalid Interval: ${n.toMessage()}`)}}class cw extends ro{constructor(n){super(`Invalid Duration: ${n.toMessage()}`)}}class Hc extends ro{}class Pf extends ro{constructor(n){super(`Invalid unit ${n}`)}}class wi extends ro{}class Vo extends ro{constructor(){super("Zone is an abstract class")}}var u="numeric",ao="short",ji="long",Um={year:u,month:u,day:u},pw={year:u,month:ao,day:u},J3={year:u,month:ao,day:u,weekday:ao},xw={year:u,month:ji,day:u},mw={year:u,month:ji,day:u,weekday:ji},aw={hour:u,minute:u},fw={hour:u,minute:u,second:u},vw={hour:u,minute:u,second:u,timeZoneName:ao},$w={hour:u,minute:u,second:u,timeZoneName:ji},ww={hour:u,minute:u,hourCycle:"h23"},Jw={hour:u,minute:u,second:u,hourCycle:"h23"},Aw={hour:u,minute:u,second:u,hourCycle:"h23",timeZoneName:ao},Fw={hour:u,minute:u,second:u,hourCycle:"h23",timeZoneName:ji},Tw={year:u,month:u,day:u,hour:u,minute:u},Rw={year:u,month:u,day:u,hour:u,minute:u,second:u},Sw={year:u,month:ao,day:u,hour:u,minute:u},Xw={year:u,month:ao,day:u,hour:u,minute:u,second:u},A3={year:u,month:ao,day:u,weekday:ao,hour:u,minute:u},Ww={year:u,month:ji,day:u,hour:u,minute:u,timeZoneName:ao},Kw={year:u,month:ji,day:u,hour:u,minute:u,second:u,timeZoneName:ao},lw={year:u,month:ji,day:u,weekday:ji,hour:u,minute:u,timeZoneName:ji},Gw={year:u,month:ji,day:u,weekday:ji,hour:u,minute:u,second:u,timeZoneName:ji};class Qc{get type(){throw new Vo}get name(){throw new Vo}get ianaName(){return this.name}get isUniversal(){throw new Vo}offsetName(n,i){throw new Vo}formatOffset(n,i){throw new Vo}offset(n){throw new Vo}equals(n){throw new Vo}get isValid(){throw new Vo}}var uf=null;class Wx extends Qc{static get instance(){if(uf===null)uf=new Wx;return uf}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(n,{format:i,locale:o}){return Bw(n,i,o)}formatOffset(n,i){return Sx(this.offset(n),i)}offset(n){return-new Date(n).getTimezoneOffset()}equals(n){return n.type==="system"}get isValid(){return!0}}var zm={};function F3(n){if(!zm[n])zm[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"});return zm[n]}var T3={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function R3(n,i){let o=n.format(i).replace(/\u200E/g,""),c=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(o),[,p,x,m,a,f,v,$]=c;return[m,p,x,a,f,v,$]}function S3(n,i){let o=n.formatToParts(i),c=[];for(let p=0;p<o.length;p++){let{type:x,value:m}=o[p],a=T3[x];if(x==="era")c[a]=m;else if(!nn(a))c[a]=parseInt(m,10)}return c}var lm={};class Go extends Qc{static create(n){if(!lm[n])lm[n]=new Go(n);return lm[n]}static resetCache(){lm={},zm={}}static isValidSpecifier(n){return this.isValidZone(n)}static isValidZone(n){if(!n)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:n}).format(),!0}catch(i){return!1}}constructor(n){super();this.zoneName=n,this.valid=Go.isValidZone(n)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(n,{format:i,locale:o}){return Bw(n,i,o,this.name)}formatOffset(n,i){return Sx(this.offset(n),i)}offset(n){let i=new Date(n);if(isNaN(i))return NaN;let o=F3(this.name),[c,p,x,m,a,f,v]=o.formatToParts?S3(o,i):R3(o,i);if(m==="BC")c=-Math.abs(c)+1;let w=Bm({year:c,month:p,day:x,hour:a===24?0:a,minute:f,second:v,millisecond:0}),J=+i,S=J%1000;return J-=S>=0?S:1000+S,(w-J)/60000}equals(n){return n.type==="iana"&&n.name===this.name}get isValid(){return this.valid}}var H1={};function X3(n,i={}){let o=JSON.stringify([n,i]),c=H1[o];if(!c)c=new Intl.ListFormat(n,i),H1[o]=c;return c}var If={};function yf(n,i={}){let o=JSON.stringify([n,i]),c=If[o];if(!c)c=new Intl.DateTimeFormat(n,i),If[o]=c;return c}var kf={};function W3(n,i={}){let o=JSON.stringify([n,i]),c=kf[o];if(!c)c=new Intl.NumberFormat(n,i),kf[o]=c;return c}var Zf={};function K3(n,i={}){let{base:o,...c}=i,p=JSON.stringify([n,c]),x=Zf[p];if(!x)x=new Intl.RelativeTimeFormat(n,i),Zf[p]=x;return x}var Fx=null;function l3(){if(Fx)return Fx;else return Fx=new Intl.DateTimeFormat().resolvedOptions().locale,Fx}var Qm={};function Mw(n){if(!Qm[n])Qm[n]=new Intl.DateTimeFormat(n).resolvedOptions();return Qm[n]}var z1={};function G3(n){let i=z1[n];if(!i){let o=new Intl.Locale(n);i="getWeekInfo"in o?o.getWeekInfo():o.weekInfo,z1[n]=i}return i}function M3(n){let i=n.indexOf("-x-");if(i!==-1)n=n.substring(0,i);let o=n.indexOf("-u-");if(o===-1)return[n];else{let c,p;try{c=yf(n).resolvedOptions(),p=n}catch(a){let f=n.substring(0,o);c=yf(f).resolvedOptions(),p=f}let{numberingSystem:x,calendar:m}=c;return[p,x,m]}}function Y3(n,i,o){if(o||i){if(!n.includes("-u-"))n+="-u";if(o)n+=`-ca-${o}`;if(i)n+=`-nu-${i}`;return n}else return n}function H3(n){let i=[];for(let o=1;o<=12;o++){let c=e.utc(2009,o,1);i.push(n(c))}return i}function z3(n){let i=[];for(let o=1;o<=7;o++){let c=e.utc(2016,11,13+o);i.push(n(c))}return i}function Gm(n,i,o,c){let p=n.listingMode();if(p==="error")return null;else if(p==="en")return o(i);else return c(i)}function Q3(n){if(n.numberingSystem&&n.numberingSystem!=="latn")return!1;else return n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||Mw(n.locale).numberingSystem==="latn"}class Yw{constructor(n,i,o){this.padTo=o.padTo||0,this.floor=o.floor||!1;let{padTo:c,floor:p,...x}=o;if(!i||Object.keys(x).length>0){let m={useGrouping:!1,...o};if(o.padTo>0)m.minimumIntegerDigits=o.padTo;this.inf=W3(n,m)}}format(n){if(this.inf){let i=this.floor?Math.floor(n):n;return this.inf.format(i)}else{let i=this.floor?Math.floor(n):nv(n,3);return tn(i,this.padTo)}}}class Hw{constructor(n,i,o){this.opts=o,this.originalZone=void 0;let c=void 0;if(this.opts.timeZone)this.dt=n;else if(n.zone.type==="fixed"){let x=-1*(n.offset/60),m=x>=0?`Etc/GMT+${x}`:`Etc/GMT${x}`;if(n.offset!==0&&Go.create(m).valid)c=m,this.dt=n;else c="UTC",this.dt=n.offset===0?n:n.setZone("UTC").plus({minutes:n.offset}),this.originalZone=n.zone}else if(n.zone.type==="system")this.dt=n;else if(n.zone.type==="iana")this.dt=n,c=n.zone.name;else c="UTC",this.dt=n.setZone("UTC").plus({minutes:n.offset}),this.originalZone=n.zone;let p={...this.opts};p.timeZone=p.timeZone||c,this.dtf=yf(i,p)}format(){if(this.originalZone)return this.formatToParts().map(({value:n})=>n).join("");return this.dtf.format(this.dt.toJSDate())}formatToParts(){let n=this.dtf.formatToParts(this.dt.toJSDate());if(this.originalZone)return n.map((i)=>{if(i.type==="timeZoneName"){let o=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...i,value:o}}else return i});return n}resolvedOptions(){return this.dtf.resolvedOptions()}}class zw{constructor(n,i,o){if(this.opts={style:"long",...o},!i&&bw())this.rtf=K3(n,o)}format(n,i){if(this.rtf)return this.rtf.format(n,i);else return t3(i,n,this.opts.numeric,this.opts.style!=="long")}formatToParts(n,i){if(this.rtf)return this.rtf.formatToParts(n,i);else return[]}}var E3={firstDay:1,minimalDays:4,weekend:[6,7]};class ln{static fromOpts(n){return ln.create(n.locale,n.numberingSystem,n.outputCalendar,n.weekSettings,n.defaultToEN)}static create(n,i,o,c,p=!1){let x=n||Ln.defaultLocale,m=x||(p?"en-US":l3()),a=i||Ln.defaultNumberingSystem,f=o||Ln.defaultOutputCalendar,v=qf(c)||Ln.defaultWeekSettings;return new ln(m,a,f,v,x)}static resetCache(){Fx=null,If={},kf={},Zf={},Qm={}}static fromObject({locale:n,numberingSystem:i,outputCalendar:o,weekSettings:c}={}){return ln.create(n,i,o,c)}constructor(n,i,o,c,p){let[x,m,a]=M3(n);this.locale=x,this.numberingSystem=i||m||null,this.outputCalendar=o||a||null,this.weekSettings=c,this.intl=Y3(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=p,this.fastNumbersCached=null}get fastNumbers(){if(this.fastNumbersCached==null)this.fastNumbersCached=Q3(this);return this.fastNumbersCached}listingMode(){let n=this.isEnglish(),i=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return n&&i?"en":"intl"}clone(n){if(!n||Object.getOwnPropertyNames(n).length===0)return this;else return ln.create(n.locale||this.specifiedLocale,n.numberingSystem||this.numberingSystem,n.outputCalendar||this.outputCalendar,qf(n.weekSettings)||this.weekSettings,n.defaultToEN||!1)}redefaultToEN(n={}){return this.clone({...n,defaultToEN:!0})}redefaultToSystem(n={}){return this.clone({...n,defaultToEN:!1})}months(n,i=!1){return Gm(this,n,Lw,()=>{let o=i?{month:n,day:"numeric"}:{month:n},c=i?"format":"standalone";if(!this.monthsCache[c][n])this.monthsCache[c][n]=H3((p)=>this.extract(p,o,"month"));return this.monthsCache[c][n]})}weekdays(n,i=!1){return Gm(this,n,Cw,()=>{let o=i?{weekday:n,year:"numeric",month:"long",day:"numeric"}:{weekday:n},c=i?"format":"standalone";if(!this.weekdaysCache[c][n])this.weekdaysCache[c][n]=z3((p)=>this.extract(p,o,"weekday"));return this.weekdaysCache[c][n]})}meridiems(){return Gm(this,void 0,()=>Iw,()=>{if(!this.meridiemCache){let n={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[e.utc(2016,11,13,9),e.utc(2016,11,13,19)].map((i)=>this.extract(i,n,"dayperiod"))}return this.meridiemCache})}eras(n){return Gm(this,n,yw,()=>{let i={era:n};if(!this.eraCache[n])this.eraCache[n]=[e.utc(-40,1,1),e.utc(2017,1,1)].map((o)=>this.extract(o,i,"era"));return this.eraCache[n]})}extract(n,i,o){let c=this.dtFormatter(n,i),p=c.formatToParts(),x=p.find((m)=>m.type.toLowerCase()===o);return x?x.value:null}numberFormatter(n={}){return new Yw(this.intl,n.forceSimple||this.fastNumbers,n)}dtFormatter(n,i={}){return new Hw(n,this.intl,i)}relFormatter(n={}){return new zw(this.intl,this.isEnglish(),n)}listFormatter(n={}){return X3(this.intl,n)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||Mw(this.intl).locale.startsWith("en-us")}getWeekSettings(){if(this.weekSettings)return this.weekSettings;else if(!uw())return E3;else return G3(this.locale)}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(n){return this.locale===n.locale&&this.numberingSystem===n.numberingSystem&&this.outputCalendar===n.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}var Bf=null;class Ki extends Qc{static get utcInstance(){if(Bf===null)Bf=new Ki(0);return Bf}static instance(n){return n===0?Ki.utcInstance:new Ki(n)}static parseSpecifier(n){if(n){let i=n.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(i)return new Ki(jm(i[1],i[2]))}return null}constructor(n){super();this.fixed=n}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Sx(this.fixed,"narrow")}`}get ianaName(){if(this.fixed===0)return"Etc/UTC";else return`Etc/GMT${Sx(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(n,i){return Sx(this.fixed,i)}get isUniversal(){return!0}offset(){return this.fixed}equals(n){return n.type==="fixed"&&n.fixed===this.fixed}get isValid(){return!0}}class tf extends Qc{constructor(n){super();this.zoneName=n}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 Po(n,i){if(nn(n)||n===null)return i;else if(n instanceof Qc)return n;else if(u3(n)){let o=n.toLowerCase();if(o==="default")return i;else if(o==="local"||o==="system")return Wx.instance;else if(o==="utc"||o==="gmt")return Ki.utcInstance;else return Ki.parseSpecifier(o)||Go.create(n)}else if(to(n))return Ki.instance(n);else if(typeof n==="object"&&"offset"in n&&typeof n.offset==="function")return n;else return new tf(n)}var rf={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"},Q1={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]},O3=rf.hanidec.replace(/[\[|\]]/g,"").split("");function U3(n){let i=parseInt(n,10);if(isNaN(i)){i="";for(let o=0;o<n.length;o++){let c=n.charCodeAt(o);if(n[o].search(rf.hanidec)!==-1)i+=O3.indexOf(n[o]);else for(let p in Q1){let[x,m]=Q1[p];if(c>=x&&c<=m)i+=c-x}}return parseInt(i,10)}else return i}var ap={};function V3(){ap={}}function xo({numberingSystem:n},i=""){let o=n||"latn";if(!ap[o])ap[o]={};if(!ap[o][i])ap[o][i]=new RegExp(`${rf[o]}${i}`);return ap[o][i]}var E1=()=>Date.now(),O1="system",U1=null,V1=null,_1=null,b1=60,u1,B1=null;class Ln{static get now(){return E1}static set now(n){E1=n}static set defaultZone(n){O1=n}static get defaultZone(){return Po(O1,Wx.instance)}static get defaultLocale(){return U1}static set defaultLocale(n){U1=n}static get defaultNumberingSystem(){return V1}static set defaultNumberingSystem(n){V1=n}static get defaultOutputCalendar(){return _1}static set defaultOutputCalendar(n){_1=n}static get defaultWeekSettings(){return B1}static set defaultWeekSettings(n){B1=qf(n)}static get twoDigitCutoffYear(){return b1}static set twoDigitCutoffYear(n){b1=n%100}static get throwOnInvalid(){return u1}static set throwOnInvalid(n){u1=n}static resetCaches(){ln.resetCache(),Go.resetCache(),e.resetCache(),V3()}}class Pi{constructor(n,i){this.reason=n,this.explanation=i}toMessage(){if(this.explanation)return`${this.reason}: ${this.explanation}`;else return this.reason}}var Qw=[0,31,59,90,120,151,181,212,243,273,304,334],Ew=[0,31,60,91,121,152,182,213,244,274,305,335];function ti(n,i){return new Pi("unit out of range",`you specified ${i} (of type ${typeof i}) as a ${n}, which is invalid`)}function df(n,i,o){let c=new Date(Date.UTC(n,i-1,o));if(n<100&&n>=0)c.setUTCFullYear(c.getUTCFullYear()-1900);let p=c.getUTCDay();return p===0?7:p}function Ow(n,i,o){return o+(Kx(n)?Ew:Qw)[i-1]}function Uw(n,i){let o=Kx(n)?Ew:Qw,c=o.findIndex((x)=>x<i),p=i-o[c];return{month:c+1,day:p}}function gf(n,i){return(n-i+7)%7+1}function Vm(n,i=4,o=1){let{year:c,month:p,day:x}=n,m=Ow(c,p,x),a=gf(df(c,p,x),o),f=Math.floor((m-a+14-i)/7),v;if(f<1)v=c-1,f=Xx(v,i,o);else if(f>Xx(c,i,o))v=c+1,f=1;else v=c;return{weekYear:v,weekNumber:f,weekday:a,...Dm(n)}}function j1(n,i=4,o=1){let{weekYear:c,weekNumber:p,weekday:x}=n,m=gf(df(c,1,i),o),a=vp(c),f=p*7+x-m-7+i,v;if(f<1)v=c-1,f+=vp(v);else if(f>a)v=c+1,f-=vp(c);else v=c;let{month:$,day:w}=Uw(v,f);return{year:v,month:$,day:w,...Dm(n)}}function jf(n){let{year:i,month:o,day:c}=n,p=Ow(i,o,c);return{year:i,ordinal:p,...Dm(n)}}function D1(n){let{year:i,ordinal:o}=n,{month:c,day:p}=Uw(i,o);return{year:i,month:c,day:p,...Dm(n)}}function L1(n,i){if(!nn(n.localWeekday)||!nn(n.localWeekNumber)||!nn(n.localWeekYear)){if(!nn(n.weekday)||!nn(n.weekNumber)||!nn(n.weekYear))throw new Hc("Cannot mix locale-based week fields with ISO-based week fields");if(!nn(n.localWeekday))n.weekday=n.localWeekday;if(!nn(n.localWeekNumber))n.weekNumber=n.localWeekNumber;if(!nn(n.localWeekYear))n.weekYear=n.localWeekYear;return delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:i.getMinDaysInFirstWeek(),startOfWeek:i.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function _3(n,i=4,o=1){let c=um(n.weekYear),p=ri(n.weekNumber,1,Xx(n.weekYear,i,o)),x=ri(n.weekday,1,7);if(!c)return ti("weekYear",n.weekYear);else if(!p)return ti("week",n.weekNumber);else if(!x)return ti("weekday",n.weekday);else return!1}function b3(n){let i=um(n.year),o=ri(n.ordinal,1,vp(n.year));if(!i)return ti("year",n.year);else if(!o)return ti("ordinal",n.ordinal);else return!1}function Vw(n){let i=um(n.year),o=ri(n.month,1,12),c=ri(n.day,1,_m(n.year,n.month));if(!i)return ti("year",n.year);else if(!o)return ti("month",n.month);else if(!c)return ti("day",n.day);else return!1}function _w(n){let{hour:i,minute:o,second:c,millisecond:p}=n,x=ri(i,0,23)||i===24&&o===0&&c===0&&p===0,m=ri(o,0,59),a=ri(c,0,59),f=ri(p,0,999);if(!x)return ti("hour",i);else if(!m)return ti("minute",o);else if(!a)return ti("second",c);else if(!f)return ti("millisecond",p);else return!1}function nn(n){return typeof n==="undefined"}function to(n){return typeof n==="number"}function um(n){return typeof n==="number"&&n%1===0}function u3(n){return typeof n==="string"}function B3(n){return Object.prototype.toString.call(n)==="[object Date]"}function bw(){try{return typeof Intl!=="undefined"&&!!Intl.RelativeTimeFormat}catch(n){return!1}}function uw(){try{return typeof Intl!=="undefined"&&!!Intl.Locale&&(("weekInfo"in Intl.Locale.prototype)||("getWeekInfo"in Intl.Locale.prototype))}catch(n){return!1}}function j3(n){return Array.isArray(n)?n:[n]}function N1(n,i,o){if(n.length===0)return;return n.reduce((c,p)=>{let x=[i(p),p];if(!c)return x;else if(o(c[0],x[0])===c[0])return c;else return x},null)[1]}function D3(n,i){return i.reduce((o,c)=>{return o[c]=n[c],o},{})}function wp(n,i){return Object.prototype.hasOwnProperty.call(n,i)}function qf(n){if(n==null)return null;else if(typeof n!=="object")throw new wi("Week settings must be an object");else{if(!ri(n.firstDay,1,7)||!ri(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some((i)=>!ri(i,1,7)))throw new wi("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}}function ri(n,i,o){return um(n)&&n>=i&&n<=o}function L3(n,i){return n-i*Math.floor(n/i)}function tn(n,i=2){let o=n<0,c;if(o)c="-"+(""+-n).padStart(i,"0");else c=(""+n).padStart(i,"0");return c}function so(n){if(nn(n)||n===null||n==="")return;else return parseInt(n,10)}function Mc(n){if(nn(n)||n===null||n==="")return;else return parseFloat(n)}function ef(n){if(nn(n)||n===null||n==="")return;else{let i=parseFloat("0."+n)*1000;return Math.floor(i)}}function nv(n,i,o=!1){let c=10**i;return(o?Math.trunc:Math.round)(n*c)/c}function Kx(n){return n%4===0&&(n%100!==0||n%400===0)}function vp(n){return Kx(n)?366:365}function _m(n,i){let o=L3(i-1,12)+1,c=n+(i-o)/12;if(o===2)return Kx(c)?29:28;else return[31,null,31,30,31,30,31,31,30,31,30,31][o-1]}function Bm(n){let i=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);if(n.year<100&&n.year>=0)i=new Date(i),i.setUTCFullYear(n.year,n.month-1,n.day);return+i}function h1(n,i,o){return-gf(df(n,1,i),o)+i-1}function Xx(n,i=4,o=1){let c=h1(n,i,o),p=h1(n+1,i,o);return(vp(n)-c+p)/7}function sf(n){if(n>99)return n;else return n>Ln.twoDigitCutoffYear?1900+n:2000+n}function Bw(n,i,o,c=null){let p=new Date(n),x={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};if(c)x.timeZone=c;let m={timeZoneName:i,...x},a=new Intl.DateTimeFormat(o,m).formatToParts(p).find((f)=>f.type.toLowerCase()==="timezonename");return a?a.value:null}function jm(n,i){let o=parseInt(n,10);if(Number.isNaN(o))o=0;let c=parseInt(i,10)||0,p=o<0||Object.is(o,-0)?-c:c;return o*60+p}function jw(n){let i=Number(n);if(typeof n==="boolean"||n===""||Number.isNaN(i))throw new wi(`Invalid unit value ${n}`);return i}function bm(n,i){let o={};for(let c in n)if(wp(n,c)){let p=n[c];if(p===void 0||p===null)continue;o[i(c)]=jw(p)}return o}function Sx(n,i){let o=Math.trunc(Math.abs(n/60)),c=Math.trunc(Math.abs(n%60)),p=n>=0?"+":"-";switch(i){case"short":return`${p}${tn(o,2)}:${tn(c,2)}`;case"narrow":return`${p}${o}${c>0?`:${c}`:""}`;case"techie":return`${p}${tn(o,2)}${tn(c,2)}`;default:throw new RangeError(`Value format ${i} is out of range for property format`)}}function Dm(n){return D3(n,["hour","minute","second","millisecond"])}var N3=["January","February","March","April","May","June","July","August","September","October","November","December"],Dw=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h3=["J","F","M","A","M","J","J","A","S","O","N","D"];function Lw(n){switch(n){case"narrow":return[...h3];case"short":return[...Dw];case"long":return[...N3];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 Nw=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],hw=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],C3=["M","T","W","T","F","S","S"];function Cw(n){switch(n){case"narrow":return[...C3];case"short":return[...hw];case"long":return[...Nw];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Iw=["AM","PM"],I3=["Before Christ","Anno Domini"],y3=["BC","AD"],k3=["B","A"];function yw(n){switch(n){case"narrow":return[...k3];case"short":return[...y3];case"long":return[...I3];default:return null}}function Z3(n){return Iw[n.hour<12?0:1]}function q3(n,i){return Cw(i)[n.weekday-1]}function s3(n,i){return Lw(i)[n.month-1]}function P3(n,i){return yw(i)[n.year<0?0:1]}function t3(n,i,o="always",c=!1){let p={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(n)===-1;if(o==="auto"&&x){let w=n==="days";switch(i){case 1:return w?"tomorrow":`next ${p[n][0]}`;case-1:return w?"yesterday":`last ${p[n][0]}`;case 0:return w?"today":`this ${p[n][0]}`}}let m=Object.is(i,-0)||i<0,a=Math.abs(i),f=a===1,v=p[n],$=c?f?v[1]:v[2]||v[1]:f?p[n][0]:n;return m?`${a} ${$} ago`:`in ${a} ${$}`}function C1(n,i){let o="";for(let c of n)if(c.literal)o+=c.val;else o+=i(c.val);return o}var r3={D:Um,DD:pw,DDD:xw,DDDD:mw,t:aw,tt:fw,ttt:vw,tttt:$w,T:ww,TT:Jw,TTT:Aw,TTTT:Fw,f:Tw,ff:Sw,fff:Ww,ffff:lw,F:Rw,FF:Xw,FFF:Kw,FFFF:Gw};class Wi{static create(n,i={}){return new Wi(n,i)}static parseFormat(n){let i=null,o="",c=!1,p=[];for(let x=0;x<n.length;x++){let m=n.charAt(x);if(m==="'"){if(o.length>0)p.push({literal:c||/^\s+$/.test(o),val:o});i=null,o="",c=!c}else if(c)o+=m;else if(m===i)o+=m;else{if(o.length>0)p.push({literal:/^\s+$/.test(o),val:o});o=m,i=m}}if(o.length>0)p.push({literal:c||/^\s+$/.test(o),val:o});return p}static macroTokenToFormatOpts(n){return r3[n]}constructor(n,i){this.opts=i,this.loc=n,this.systemLoc=null}formatWithSystemDefault(n,i){if(this.systemLoc===null)this.systemLoc=this.loc.redefaultToSystem();return this.systemLoc.dtFormatter(n,{...this.opts,...i}).format()}dtFormatter(n,i={}){return this.loc.dtFormatter(n,{...this.opts,...i})}formatDateTime(n,i){return this.dtFormatter(n,i).format()}formatDateTimeParts(n,i){return this.dtFormatter(n,i).formatToParts()}formatInterval(n,i){return this.dtFormatter(n.start,i).dtf.formatRange(n.start.toJSDate(),n.end.toJSDate())}resolvedOptions(n,i){return this.dtFormatter(n,i).resolvedOptions()}num(n,i=0){if(this.opts.forceSimple)return tn(n,i);let o={...this.opts};if(i>0)o.padTo=i;return this.loc.numberFormatter(o).format(n)}formatDateTimeFromString(n,i){let o=this.loc.listingMode()==="en",c=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",p=(J,S)=>this.loc.extract(n,J,S),x=(J)=>{if(n.isOffsetFixed&&n.offset===0&&J.allowZ)return"Z";return n.isValid?n.zone.formatOffset(n.ts,J.format):""},m=()=>o?Z3(n):p({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(J,S)=>o?s3(n,J):p(S?{month:J}:{month:J,day:"numeric"},"month"),f=(J,S)=>o?q3(n,J):p(S?{weekday:J}:{weekday:J,month:"long",day:"numeric"},"weekday"),v=(J)=>{let S=Wi.macroTokenToFormatOpts(J);if(S)return this.formatWithSystemDefault(n,S);else return J},$=(J)=>o?P3(n,J):p({era:J},"era"),w=(J)=>{switch(J){case"S":return this.num(n.millisecond);case"u":case"SSS":return this.num(n.millisecond,3);case"s":return this.num(n.second);case"ss":return this.num(n.second,2);case"uu":return this.num(Math.floor(n.millisecond/10),2);case"uuu":return this.num(Math.floor(n.millisecond/100));case"m":return this.num(n.minute);case"mm":return this.num(n.minute,2);case"h":return this.num(n.hour%12===0?12:n.hour%12);case"hh":return this.num(n.hour%12===0?12:n.hour%12,2);case"H":return this.num(n.hour);case"HH":return this.num(n.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 n.zone.offsetName(n.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return n.zone.offsetName(n.ts,{format:"long",locale:this.loc.locale});case"z":return n.zoneName;case"a":return m();case"d":return c?p({day:"numeric"},"day"):this.num(n.day);case"dd":return c?p({day:"2-digit"},"day"):this.num(n.day,2);case"c":return this.num(n.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return this.num(n.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return c?p({month:"numeric",day:"numeric"},"month"):this.num(n.month);case"LL":return c?p({month:"2-digit",day:"numeric"},"month"):this.num(n.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return c?p({month:"numeric"},"month"):this.num(n.month);case"MM":return c?p({month:"2-digit"},"month"):this.num(n.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return c?p({year:"numeric"},"year"):this.num(n.year);case"yy":return c?p({year:"2-digit"},"year"):this.num(n.year.toString().slice(-2),2);case"yyyy":return c?p({year:"numeric"},"year"):this.num(n.year,4);case"yyyyyy":return c?p({year:"numeric"},"year"):this.num(n.year,6);case"G":return $("short");case"GG":return $("long");case"GGGGG":return $("narrow");case"kk":return this.num(n.weekYear.toString().slice(-2),2);case"kkkk":return this.num(n.weekYear,4);case"W":return this.num(n.weekNumber);case"WW":return this.num(n.weekNumber,2);case"n":return this.num(n.localWeekNumber);case"nn":return this.num(n.localWeekNumber,2);case"ii":return this.num(n.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(n.localWeekYear,4);case"o":return this.num(n.ordinal);case"ooo":return this.num(n.ordinal,3);case"q":return this.num(n.quarter);case"qq":return this.num(n.quarter,2);case"X":return this.num(Math.floor(n.ts/1000));case"x":return this.num(n.ts);default:return v(J)}};return C1(Wi.parseFormat(i),w)}formatDurationFromString(n,i){let o=(a)=>{switch(a[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}},c=(a)=>(f)=>{let v=o(f);if(v)return this.num(a.get(v),f.length);else return f},p=Wi.parseFormat(i),x=p.reduce((a,{literal:f,val:v})=>f?a:a.concat(v),[]),m=n.shiftTo(...x.map(o).filter((a)=>a));return C1(p,c(m))}}var kw=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Jp(...n){let i=n.reduce((o,c)=>o+c.source,"");return RegExp(`^${i}$`)}function Ap(...n){return(i)=>n.reduce(([o,c,p],x)=>{let[m,a,f]=x(i,p);return[{...o,...m},a||c,f]},[{},null,1]).slice(0,2)}function Fp(n,...i){if(n==null)return[null,null];for(let[o,c]of i){let p=o.exec(n);if(p)return c(p)}return[null,null]}function Zw(...n){return(i,o)=>{let c={},p;for(p=0;p<n.length;p++)c[n[p]]=so(i[o+p]);return[c,null,o+p]}}var qw=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,d3=`(?:${qw.source}?(?:\\[(${kw.source})\\])?)?`,iv=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,sw=RegExp(`${iv.source}${d3}`),ov=RegExp(`(?:T${sw.source})?`),g3=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,e3=/(\d{4})-?W(\d\d)(?:-?(\d))?/,n7=/(\d{4})-?(\d{3})/,i7=Zw("weekYear","weekNumber","weekDay"),o7=Zw("year","ordinal"),c7=/(\d{4})-(\d\d)-(\d\d)/,Pw=RegExp(`${iv.source} ?(?:${qw.source}|(${kw.source}))?`),p7=RegExp(`(?: ${Pw.source})?`);function $p(n,i,o){let c=n[i];return nn(c)?o:so(c)}function x7(n,i){return[{year:$p(n,i),month:$p(n,i+1,1),day:$p(n,i+2,1)},null,i+3]}function Tp(n,i){return[{hours:$p(n,i,0),minutes:$p(n,i+1,0),seconds:$p(n,i+2,0),milliseconds:ef(n[i+3])},null,i+4]}function lx(n,i){let o=!n[i]&&!n[i+1],c=jm(n[i+1],n[i+2]),p=o?null:Ki.instance(c);return[{},p,i+3]}function Gx(n,i){let o=n[i]?Go.create(n[i]):null;return[{},o,i+1]}var m7=RegExp(`^T?${iv.source}$`),a7=/^-?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 f7(n){let[i,o,c,p,x,m,a,f,v]=n,$=i[0]==="-",w=f&&f[0]==="-",J=(S,X=!1)=>S!==void 0&&(X||S&&$)?-S:S;return[{years:J(Mc(o)),months:J(Mc(c)),weeks:J(Mc(p)),days:J(Mc(x)),hours:J(Mc(m)),minutes:J(Mc(a)),seconds:J(Mc(f),f==="-0"),milliseconds:J(ef(v),w)}]}var v7={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function cv(n,i,o,c,p,x,m){let a={year:i.length===2?sf(so(i)):so(i),month:Dw.indexOf(o)+1,day:so(c),hour:so(p),minute:so(x)};if(m)a.second=so(m);if(n)a.weekday=n.length>3?Nw.indexOf(n)+1:hw.indexOf(n)+1;return a}var $7=/^(?:(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 w7(n){let[,i,o,c,p,x,m,a,f,v,$,w]=n,J=cv(i,p,c,o,x,m,a),S;if(f)S=v7[f];else if(v)S=0;else S=jm($,w);return[J,new Ki(S)]}function J7(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var A7=/^(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$/,F7=/^(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$/,T7=/^(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 I1(n){let[,i,o,c,p,x,m,a]=n;return[cv(i,p,c,o,x,m,a),Ki.utcInstance]}function R7(n){let[,i,o,c,p,x,m,a]=n;return[cv(i,a,o,c,p,x,m),Ki.utcInstance]}var S7=Jp(g3,ov),X7=Jp(e3,ov),W7=Jp(n7,ov),K7=Jp(sw),tw=Ap(x7,Tp,lx,Gx),l7=Ap(i7,Tp,lx,Gx),G7=Ap(o7,Tp,lx,Gx),M7=Ap(Tp,lx,Gx);function Y7(n){return Fp(n,[S7,tw],[X7,l7],[W7,G7],[K7,M7])}function H7(n){return Fp(J7(n),[$7,w7])}function z7(n){return Fp(n,[A7,I1],[F7,I1],[T7,R7])}function Q7(n){return Fp(n,[a7,f7])}var E7=Ap(Tp);function O7(n){return Fp(n,[m7,E7])}var U7=Jp(c7,p7),V7=Jp(Pw),_7=Ap(Tp,lx,Gx);function b7(n){return Fp(n,[U7,tw],[V7,_7])}var y1="Invalid Duration",rw={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}},u7={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},...rw},si=365.2425,pp=30.436875,B7={years:{quarters:4,months:12,weeks:si/7,days:si,hours:si*24,minutes:si*24*60,seconds:si*24*60*60,milliseconds:si*24*60*60*1000},quarters:{months:3,weeks:si/28,days:si/4,hours:si*24/4,minutes:si*24*60/4,seconds:si*24*60*60/4,milliseconds:si*24*60*60*1000/4},months:{weeks:pp/7,days:pp,hours:pp*24,minutes:pp*24*60,seconds:pp*24*60*60,milliseconds:pp*24*60*60*1000},...rw},zc=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],j7=zc.slice(0).reverse();function qo(n,i,o=!1){let c={values:o?i.values:{...n.values,...i.values||{}},loc:n.loc.clone(i.loc),conversionAccuracy:i.conversionAccuracy||n.conversionAccuracy,matrix:i.matrix||n.matrix};return new An(c)}function dw(n,i){var o;let c=(o=i.milliseconds)!=null?o:0;for(let p of j7.slice(1))if(i[p])c+=i[p]*n[p].milliseconds;return c}function k1(n,i){let o=dw(n,i)<0?-1:1;zc.reduceRight((c,p)=>{if(!nn(i[p])){if(c){let x=i[c]*o,m=n[p][c],a=Math.floor(x/m);i[p]+=a*o,i[c]-=a*m*o}return p}else return c},null),zc.reduce((c,p)=>{if(!nn(i[p])){if(c){let x=i[c]%1;i[c]-=x,i[p]+=x*n[c][p]}return p}else return c},null)}function D7(n){let i={};for(let[o,c]of Object.entries(n))if(c!==0)i[o]=c;return i}class An{constructor(n){let i=n.conversionAccuracy==="longterm"||!1,o=i?B7:u7;if(n.matrix)o=n.matrix;this.values=n.values,this.loc=n.loc||ln.create(),this.conversionAccuracy=i?"longterm":"casual",this.invalid=n.invalid||null,this.matrix=o,this.isLuxonDuration=!0}static fromMillis(n,i){return An.fromObject({milliseconds:n},i)}static fromObject(n,i={}){if(n==null||typeof n!=="object")throw new wi(`Duration.fromObject: argument expected to be an object, got ${n===null?"null":typeof n}`);return new An({values:bm(n,An.normalizeUnit),loc:ln.fromObject(i),conversionAccuracy:i.conversionAccuracy,matrix:i.matrix})}static fromDurationLike(n){if(to(n))return An.fromMillis(n);else if(An.isDuration(n))return n;else if(typeof n==="object")return An.fromObject(n);else throw new wi(`Unknown duration argument ${n} of type ${typeof n}`)}static fromISO(n,i){let[o]=Q7(n);if(o)return An.fromObject(o,i);else return An.invalid("unparsable",`the input "${n}" can't be parsed as ISO 8601`)}static fromISOTime(n,i){let[o]=O7(n);if(o)return An.fromObject(o,i);else return An.invalid("unparsable",`the input "${n}" can't be parsed as ISO 8601`)}static invalid(n,i=null){if(!n)throw new wi("need to specify a reason the Duration is invalid");let o=n instanceof Pi?n:new Pi(n,i);if(Ln.throwOnInvalid)throw new cw(o);else return new An({invalid:o})}static normalizeUnit(n){let i={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"}[n?n.toLowerCase():n];if(!i)throw new Pf(n);return i}static isDuration(n){return n&&n.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(n,i={}){let o={...i,floor:i.round!==!1&&i.floor!==!1};return this.isValid?Wi.create(this.loc,o).formatDurationFromString(this,n):y1}toHuman(n={}){if(!this.isValid)return y1;let i=zc.map((o)=>{let c=this.values[o];if(nn(c))return null;return this.loc.numberFormatter({style:"unit",unitDisplay:"long",...n,unit:o.slice(0,-1)}).format(c)}).filter((o)=>o);return this.loc.listFormatter({type:"conjunction",style:n.listStyle||"narrow",...n}).format(i)}toObject(){if(!this.isValid)return{};return{...this.values}}toISO(){if(!this.isValid)return null;let n="P";if(this.years!==0)n+=this.years+"Y";if(this.months!==0||this.quarters!==0)n+=this.months+this.quarters*3+"M";if(this.weeks!==0)n+=this.weeks+"W";if(this.days!==0)n+=this.days+"D";if(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)n+="T";if(this.hours!==0)n+=this.hours+"H";if(this.minutes!==0)n+=this.minutes+"M";if(this.seconds!==0||this.milliseconds!==0)n+=nv(this.seconds+this.milliseconds/1000,3)+"S";if(n==="P")n+="T0S";return n}toISOTime(n={}){if(!this.isValid)return null;let i=this.toMillis();if(i<0||i>=86400000)return null;return n={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...n,includeOffset:!1},e.fromMillis(i,{zone:"UTC"}).toISOTime(n)}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 dw(this.matrix,this.values)}valueOf(){return this.toMillis()}plus(n){if(!this.isValid)return this;let i=An.fromDurationLike(n),o={};for(let c of zc)if(wp(i.values,c)||wp(this.values,c))o[c]=i.get(c)+this.get(c);return qo(this,{values:o},!0)}minus(n){if(!this.isValid)return this;let i=An.fromDurationLike(n);return this.plus(i.negate())}mapUnits(n){if(!this.isValid)return this;let i={};for(let o of Object.keys(this.values))i[o]=jw(n(this.values[o],o));return qo(this,{values:i},!0)}get(n){return this[An.normalizeUnit(n)]}set(n){if(!this.isValid)return this;let i={...this.values,...bm(n,An.normalizeUnit)};return qo(this,{values:i})}reconfigure({locale:n,numberingSystem:i,conversionAccuracy:o,matrix:c}={}){let x={loc:this.loc.clone({locale:n,numberingSystem:i}),matrix:c,conversionAccuracy:o};return qo(this,x)}as(n){return this.isValid?this.shiftTo(n).get(n):NaN}normalize(){if(!this.isValid)return this;let n=this.toObject();return k1(this.matrix,n),qo(this,{values:n},!0)}rescale(){if(!this.isValid)return this;let n=D7(this.normalize().shiftToAll().toObject());return qo(this,{values:n},!0)}shiftTo(...n){if(!this.isValid)return this;if(n.length===0)return this;n=n.map((x)=>An.normalizeUnit(x));let i={},o={},c=this.toObject(),p;for(let x of zc)if(n.indexOf(x)>=0){p=x;let m=0;for(let f in o)m+=this.matrix[f][x]*o[f],o[f]=0;if(to(c[x]))m+=c[x];let a=Math.trunc(m);i[x]=a,o[x]=(m*1000-a*1000)/1000}else if(to(c[x]))o[x]=c[x];for(let x in o)if(o[x]!==0)i[p]+=x===p?o[x]:o[x]/this.matrix[p][x];return k1(this.matrix,i),qo(this,{values:i},!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 n={};for(let i of Object.keys(this.values))n[i]=this.values[i]===0?0:-this.values[i];return qo(this,{values:n},!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(n){if(!this.isValid||!n.isValid)return!1;if(!this.loc.equals(n.loc))return!1;function i(o,c){if(o===void 0||o===0)return c===void 0||c===0;return o===c}for(let o of zc)if(!i(this.values[o],n.values[o]))return!1;return!0}}var xp="Invalid Interval";function L7(n,i){if(!n||!n.isValid)return hn.invalid("missing or invalid start");else if(!i||!i.isValid)return hn.invalid("missing or invalid end");else if(i<n)return hn.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${i.toISO()}`);else return null}class hn{constructor(n){this.s=n.start,this.e=n.end,this.invalid=n.invalid||null,this.isLuxonInterval=!0}static invalid(n,i=null){if(!n)throw new wi("need to specify a reason the Interval is invalid");let o=n instanceof Pi?n:new Pi(n,i);if(Ln.throwOnInvalid)throw new ow(o);else return new hn({invalid:o})}static fromDateTimes(n,i){let o=Ax(n),c=Ax(i),p=L7(o,c);if(p==null)return new hn({start:o,end:c});else return p}static after(n,i){let o=An.fromDurationLike(i),c=Ax(n);return hn.fromDateTimes(c,c.plus(o))}static before(n,i){let o=An.fromDurationLike(i),c=Ax(n);return hn.fromDateTimes(c.minus(o),c)}static fromISO(n,i){let[o,c]=(n||"").split("/",2);if(o&&c){let p,x;try{p=e.fromISO(o,i),x=p.isValid}catch(f){x=!1}let m,a;try{m=e.fromISO(c,i),a=m.isValid}catch(f){a=!1}if(x&&a)return hn.fromDateTimes(p,m);if(x){let f=An.fromISO(c,i);if(f.isValid)return hn.after(p,f)}else if(a){let f=An.fromISO(o,i);if(f.isValid)return hn.before(m,f)}}return hn.invalid("unparsable",`the input "${n}" can't be parsed as ISO 8601`)}static isInterval(n){return n&&n.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(n="milliseconds"){return this.isValid?this.toDuration(...[n]).get(n):NaN}count(n="milliseconds",i){if(!this.isValid)return NaN;let o=this.start.startOf(n,i),c;if(i!=null&&i.useLocaleWeeks)c=this.end.reconfigure({locale:o.locale});else c=this.end;return c=c.startOf(n,i),Math.floor(c.diff(o,n).get(n))+(c.valueOf()!==this.end.valueOf())}hasSame(n){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,n):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(n){if(!this.isValid)return!1;return this.s>n}isBefore(n){if(!this.isValid)return!1;return this.e<=n}contains(n){if(!this.isValid)return!1;return this.s<=n&&this.e>n}set({start:n,end:i}={}){if(!this.isValid)return this;return hn.fromDateTimes(n||this.s,i||this.e)}splitAt(...n){if(!this.isValid)return[];let i=n.map(Ax).filter((x)=>this.contains(x)).sort((x,m)=>x.toMillis()-m.toMillis()),o=[],{s:c}=this,p=0;while(c<this.e){let x=i[p]||this.e,m=+x>+this.e?this.e:x;o.push(hn.fromDateTimes(c,m)),c=m,p+=1}return o}splitBy(n){let i=An.fromDurationLike(n);if(!this.isValid||!i.isValid||i.as("milliseconds")===0)return[];let{s:o}=this,c=1,p,x=[];while(o<this.e){let m=this.start.plus(i.mapUnits((a)=>a*c));p=+m>+this.e?this.e:m,x.push(hn.fromDateTimes(o,p)),o=p,c+=1}return x}divideEqually(n){if(!this.isValid)return[];return this.splitBy(this.length()/n).slice(0,n)}overlaps(n){return this.e>n.s&&this.s<n.e}abutsStart(n){if(!this.isValid)return!1;return+this.e===+n.s}abutsEnd(n){if(!this.isValid)return!1;return+n.e===+this.s}engulfs(n){if(!this.isValid)return!1;return this.s<=n.s&&this.e>=n.e}equals(n){if(!this.isValid||!n.isValid)return!1;return this.s.equals(n.s)&&this.e.equals(n.e)}intersection(n){if(!this.isValid)return this;let i=this.s>n.s?this.s:n.s,o=this.e<n.e?this.e:n.e;if(i>=o)return null;else return hn.fromDateTimes(i,o)}union(n){if(!this.isValid)return this;let i=this.s<n.s?this.s:n.s,o=this.e>n.e?this.e:n.e;return hn.fromDateTimes(i,o)}static merge(n){let[i,o]=n.sort((c,p)=>c.s-p.s).reduce(([c,p],x)=>{if(!p)return[c,x];else if(p.overlaps(x)||p.abutsStart(x))return[c,p.union(x)];else return[c.concat([p]),x]},[[],null]);if(o)i.push(o);return i}static xor(n){let i=null,o=0,c=[],p=n.map((a)=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),x=Array.prototype.concat(...p),m=x.sort((a,f)=>a.time-f.time);for(let a of m)if(o+=a.type==="s"?1:-1,o===1)i=a.time;else{if(i&&+i!==+a.time)c.push(hn.fromDateTimes(i,a.time));i=null}return hn.merge(c)}difference(...n){return hn.xor([this].concat(n)).map((i)=>this.intersection(i)).filter((i)=>i&&!i.isEmpty())}toString(){if(!this.isValid)return xp;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(n=Um,i={}){return this.isValid?Wi.create(this.s.loc.clone(i),n).formatInterval(this):xp}toISO(n){if(!this.isValid)return xp;return`${this.s.toISO(n)}/${this.e.toISO(n)}`}toISODate(){if(!this.isValid)return xp;return`${this.s.toISODate()}/${this.e.toISODate()}`}toISOTime(n){if(!this.isValid)return xp;return`${this.s.toISOTime(n)}/${this.e.toISOTime(n)}`}toFormat(n,{separator:i=" \u2013 "}={}){if(!this.isValid)return xp;return`${this.s.toFormat(n)}${i}${this.e.toFormat(n)}`}toDuration(n,i){if(!this.isValid)return An.invalid(this.invalidReason);return this.e.diff(this.s,n,i)}mapEndpoints(n){return hn.fromDateTimes(n(this.s),n(this.e))}}class fp{static hasDST(n=Ln.defaultZone){let i=e.now().setZone(n).set({month:12});return!n.isUniversal&&i.offset!==i.set({month:6}).offset}static isValidIANAZone(n){return Go.isValidZone(n)}static normalizeZone(n){return Po(n,Ln.defaultZone)}static getStartOfWeek({locale:n=null,locObj:i=null}={}){return(i||ln.create(n)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:n=null,locObj:i=null}={}){return(i||ln.create(n)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:n=null,locObj:i=null}={}){return(i||ln.create(n)).getWeekendDays().slice()}static months(n="long",{locale:i=null,numberingSystem:o=null,locObj:c=null,outputCalendar:p="gregory"}={}){return(c||ln.create(i,o,p)).months(n)}static monthsFormat(n="long",{locale:i=null,numberingSystem:o=null,locObj:c=null,outputCalendar:p="gregory"}={}){return(c||ln.create(i,o,p)).months(n,!0)}static weekdays(n="long",{locale:i=null,numberingSystem:o=null,locObj:c=null}={}){return(c||ln.create(i,o,null)).weekdays(n)}static weekdaysFormat(n="long",{locale:i=null,numberingSystem:o=null,locObj:c=null}={}){return(c||ln.create(i,o,null)).weekdays(n,!0)}static meridiems({locale:n=null}={}){return ln.create(n).meridiems()}static eras(n="short",{locale:i=null}={}){return ln.create(i,null,"gregory").eras(n)}static features(){return{relative:bw(),localeWeek:uw()}}}function Z1(n,i){let o=(p)=>p.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),c=o(i)-o(n);return Math.floor(An.fromMillis(c).as("days"))}function N7(n,i,o){let c=[["years",(f,v)=>v.year-f.year],["quarters",(f,v)=>v.quarter-f.quarter+(v.year-f.year)*4],["months",(f,v)=>v.month-f.month+(v.year-f.year)*12],["weeks",(f,v)=>{let $=Z1(f,v);return($-$%7)/7}],["days",Z1]],p={},x=n,m,a;for(let[f,v]of c)if(o.indexOf(f)>=0)if(m=f,p[f]=v(n,i),a=x.plus(p),a>i){if(p[f]--,n=x.plus(p),n>i)a=n,p[f]--,n=x.plus(p)}else n=a;return[n,p,a,m]}function h7(n,i,o,c){let[p,x,m,a]=N7(n,i,o),f=i-p,v=o.filter((w)=>["hours","minutes","seconds","milliseconds"].indexOf(w)>=0);if(v.length===0){if(m<i)m=p.plus({[a]:1});if(m!==p)x[a]=(x[a]||0)+f/(m-p)}let $=An.fromObject(x,c);if(v.length>0)return An.fromMillis(f,c).shiftTo(...v).plus($);else return $}var C7="missing Intl.DateTimeFormat.formatToParts support";function Xn(n,i=(o)=>o){return{regex:n,deser:([o])=>i(U3(o))}}var I7=String.fromCharCode(160),gw=`[ ${I7}]`,ew=new RegExp(gw,"g");function y7(n){return n.replace(/\./g,"\\.?").replace(ew,gw)}function q1(n){return n.replace(/\./g,"").replace(ew," ").toLowerCase()}function mo(n,i){if(n===null)return null;else return{regex:RegExp(n.map(y7).join("|")),deser:([o])=>n.findIndex((c)=>q1(o)===q1(c))+i}}function s1(n,i){return{regex:n,deser:([,o,c])=>jm(o,c),groups:i}}function Mm(n){return{regex:n,deser:([i])=>i}}function k7(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Z7(n,i){let o=xo(i),c=xo(i,"{2}"),p=xo(i,"{3}"),x=xo(i,"{4}"),m=xo(i,"{6}"),a=xo(i,"{1,2}"),f=xo(i,"{1,3}"),v=xo(i,"{1,6}"),$=xo(i,"{1,9}"),w=xo(i,"{2,4}"),J=xo(i,"{4,6}"),S=(K)=>({regex:RegExp(k7(K.val)),deser:([M])=>M,literal:!0}),R=((K)=>{if(n.literal)return S(K);switch(K.val){case"G":return mo(i.eras("short"),0);case"GG":return mo(i.eras("long"),0);case"y":return Xn(v);case"yy":return Xn(w,sf);case"yyyy":return Xn(x);case"yyyyy":return Xn(J);case"yyyyyy":return Xn(m);case"M":return Xn(a);case"MM":return Xn(c);case"MMM":return mo(i.months("short",!0),1);case"MMMM":return mo(i.months("long",!0),1);case"L":return Xn(a);case"LL":return Xn(c);case"LLL":return mo(i.months("short",!1),1);case"LLLL":return mo(i.months("long",!1),1);case"d":return Xn(a);case"dd":return Xn(c);case"o":return Xn(f);case"ooo":return Xn(p);case"HH":return Xn(c);case"H":return Xn(a);case"hh":return Xn(c);case"h":return Xn(a);case"mm":return Xn(c);case"m":return Xn(a);case"q":return Xn(a);case"qq":return Xn(c);case"s":return Xn(a);case"ss":return Xn(c);case"S":return Xn(f);case"SSS":return Xn(p);case"u":return Mm($);case"uu":return Mm(a);case"uuu":return Xn(o);case"a":return mo(i.meridiems(),0);case"kkkk":return Xn(x);case"kk":return Xn(w,sf);case"W":return Xn(a);case"WW":return Xn(c);case"E":case"c":return Xn(o);case"EEE":return mo(i.weekdays("short",!1),1);case"EEEE":return mo(i.weekdays("long",!1),1);case"ccc":return mo(i.weekdays("short",!0),1);case"cccc":return mo(i.weekdays("long",!0),1);case"Z":case"ZZ":return s1(new RegExp(`([+-]${a.source})(?::(${c.source}))?`),2);case"ZZZ":return s1(new RegExp(`([+-]${a.source})(${c.source})?`),2);case"z":return Mm(/[a-z_+-/]{1,256}?/i);case" ":return Mm(/[^\S\n\r]/);default:return S(K)}})(n)||{invalidReason:C7};return R.token=n,R}var q7={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 s7(n,i,o){let{type:c,value:p}=n;if(c==="literal"){let f=/^\s+$/.test(p);return{literal:!f,val:f?" ":p}}let x=i[c],m=c;if(c==="hour")if(i.hour12!=null)m=i.hour12?"hour12":"hour24";else if(i.hourCycle!=null)if(i.hourCycle==="h11"||i.hourCycle==="h12")m="hour12";else m="hour24";else m=o.hour12?"hour12":"hour24";let a=q7[m];if(typeof a==="object")a=a[x];if(a)return{literal:!1,val:a};return}function P7(n){return[`^${n.map((o)=>o.regex).reduce((o,c)=>`${o}(${c.source})`,"")}$`,n]}function t7(n,i,o){let c=n.match(i);if(c){let p={},x=1;for(let m in o)if(wp(o,m)){let a=o[m],f=a.groups?a.groups+1:1;if(!a.literal&&a.token)p[a.token.val[0]]=a.deser(c.slice(x,x+f));x+=f}return[c,p]}else return[c,{}]}function r7(n){let i=(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}},o=null,c;if(!nn(n.z))o=Go.create(n.z);if(!nn(n.Z)){if(!o)o=new Ki(n.Z);c=n.Z}if(!nn(n.q))n.M=(n.q-1)*3+1;if(!nn(n.h)){if(n.h<12&&n.a===1)n.h+=12;else if(n.h===12&&n.a===0)n.h=0}if(n.G===0&&n.y)n.y=-n.y;if(!nn(n.u))n.S=ef(n.u);return[Object.keys(n).reduce((x,m)=>{let a=i(m);if(a)x[a]=n[m];return x},{}),o,c]}var Df=null;function d7(){if(!Df)Df=e.fromMillis(1555555555555);return Df}function g7(n,i){if(n.literal)return n;let o=Wi.macroTokenToFormatOpts(n.val),c=oJ(o,i);if(c==null||c.includes(void 0))return n;return c}function nJ(n,i){return Array.prototype.concat(...n.map((o)=>g7(o,i)))}class pv{constructor(n,i){if(this.locale=n,this.format=i,this.tokens=nJ(Wi.parseFormat(i),n),this.units=this.tokens.map((o)=>Z7(o,n)),this.disqualifyingUnit=this.units.find((o)=>o.invalidReason),!this.disqualifyingUnit){let[o,c]=P7(this.units);this.regex=RegExp(o,"i"),this.handlers=c}}explainFromTokens(n){if(!this.isValid)return{input:n,tokens:this.tokens,invalidReason:this.invalidReason};else{let[i,o]=t7(n,this.regex,this.handlers),[c,p,x]=o?r7(o):[null,null,void 0];if(wp(o,"a")&&wp(o,"H"))throw new Hc("Can't include meridiem when specifying 24-hour format");return{input:n,tokens:this.tokens,regex:this.regex,rawMatches:i,matches:o,result:c,zone:p,specificOffset:x}}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function iJ(n,i,o){return new pv(n,o).explainFromTokens(i)}function e7(n,i,o){let{result:c,zone:p,specificOffset:x,invalidReason:m}=iJ(n,i,o);return[c,p,x,m]}function oJ(n,i){if(!n)return null;let c=Wi.create(i,n).dtFormatter(d7()),p=c.formatToParts(),x=c.resolvedOptions();return p.map((m)=>s7(m,n,x))}var Lf="Invalid DateTime",P1=8640000000000000;function Tx(n){return new Pi("unsupported zone",`the zone "${n.name}" is not supported`)}function Nf(n){if(n.weekData===null)n.weekData=Vm(n.c);return n.weekData}function hf(n){if(n.localWeekData===null)n.localWeekData=Vm(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek());return n.localWeekData}function Yc(n,i){let o={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new e({...o,...i,old:o})}function cJ(n,i,o){let c=n-i*60*1000,p=o.offset(c);if(i===p)return[c,i];c-=(p-i)*60*1000;let x=o.offset(c);if(p===x)return[c,p];return[n-Math.min(p,x)*60*1000,Math.max(p,x)]}function Ym(n,i){n+=i*60*1000;let o=new Date(n);return{year:o.getUTCFullYear(),month:o.getUTCMonth()+1,day:o.getUTCDate(),hour:o.getUTCHours(),minute:o.getUTCMinutes(),second:o.getUTCSeconds(),millisecond:o.getUTCMilliseconds()}}function Em(n,i,o){return cJ(Bm(n),i,o)}function t1(n,i){let o=n.o,c=n.c.year+Math.trunc(i.years),p=n.c.month+Math.trunc(i.months)+Math.trunc(i.quarters)*3,x={...n.c,year:c,month:p,day:Math.min(n.c.day,_m(c,p))+Math.trunc(i.days)+Math.trunc(i.weeks)*7},m=An.fromObject({years:i.years-Math.trunc(i.years),quarters:i.quarters-Math.trunc(i.quarters),months:i.months-Math.trunc(i.months),weeks:i.weeks-Math.trunc(i.weeks),days:i.days-Math.trunc(i.days),hours:i.hours,minutes:i.minutes,seconds:i.seconds,milliseconds:i.milliseconds}).as("milliseconds"),a=Bm(x),[f,v]=cJ(a,o,n.zone);if(m!==0)f+=m,v=n.zone.offset(f);return{ts:f,o:v}}function mp(n,i,o,c,p,x){let{setZone:m,zone:a}=o;if(n&&Object.keys(n).length!==0||i){let f=i||a,v=e.fromObject(n,{...o,zone:f,specificOffset:x});return m?v:v.setZone(a)}else return e.invalid(new Pi("unparsable",`the input "${p}" can't be parsed as ${c}`))}function Hm(n,i,o=!0){return n.isValid?Wi.create(ln.create("en-US"),{allowZ:o,forceSimple:!0}).formatDateTimeFromString(n,i):null}function Cf(n,i){let o=n.c.year>9999||n.c.year<0,c="";if(o&&n.c.year>=0)c+="+";if(c+=tn(n.c.year,o?6:4),i)c+="-",c+=tn(n.c.month),c+="-",c+=tn(n.c.day);else c+=tn(n.c.month),c+=tn(n.c.day);return c}function r1(n,i,o,c,p,x){let m=tn(n.c.hour);if(i){if(m+=":",m+=tn(n.c.minute),n.c.millisecond!==0||n.c.second!==0||!o)m+=":"}else m+=tn(n.c.minute);if(n.c.millisecond!==0||n.c.second!==0||!o){if(m+=tn(n.c.second),n.c.millisecond!==0||!c)m+=".",m+=tn(n.c.millisecond,3)}if(p)if(n.isOffsetFixed&&n.offset===0&&!x)m+="Z";else if(n.o<0)m+="-",m+=tn(Math.trunc(-n.o/60)),m+=":",m+=tn(Math.trunc(-n.o%60));else m+="+",m+=tn(Math.trunc(n.o/60)),m+=":",m+=tn(Math.trunc(n.o%60));if(x)m+="["+n.zone.ianaName+"]";return m}var pJ={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},nX={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},iX={ordinal:1,hour:0,minute:0,second:0,millisecond:0},xJ=["year","month","day","hour","minute","second","millisecond"],oX=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],cX=["year","ordinal","hour","minute","second","millisecond"];function pX(n){let i={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"}[n.toLowerCase()];if(!i)throw new Pf(n);return i}function d1(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return pX(n)}}function xX(n){if(Rx===void 0)Rx=Ln.now();if(n.type!=="iana")return n.offset(Rx);let i=n.name;if(!Om[i])Om[i]=n.offset(Rx);return Om[i]}function g1(n,i){let o=Po(i.zone,Ln.defaultZone);if(!o.isValid)return e.invalid(Tx(o));let c=ln.fromObject(i),p,x;if(!nn(n.year)){for(let f of xJ)if(nn(n[f]))n[f]=pJ[f];let m=Vw(n)||_w(n);if(m)return e.invalid(m);let a=xX(o);[p,x]=Em(n,a,o)}else p=Ln.now();return new e({ts:p,zone:o,loc:c,o:x})}function e1(n,i,o){let c=nn(o.round)?!0:o.round,p=(m,a)=>{return m=nv(m,c||o.calendary?0:2,!0),i.loc.clone(o).relFormatter(o).format(m,a)},x=(m)=>{if(o.calendary)if(!i.hasSame(n,m))return i.startOf(m).diff(n.startOf(m),m).get(m);else return 0;else return i.diff(n,m).get(m)};if(o.unit)return p(x(o.unit),o.unit);for(let m of o.units){let a=x(m);if(Math.abs(a)>=1)return p(a,m)}return p(n>i?-0:0,o.units[o.units.length-1])}function nw(n){let i={},o;if(n.length>0&&typeof n[n.length-1]==="object")i=n[n.length-1],o=Array.from(n).slice(0,n.length-1);else o=Array.from(n);return[i,o]}var Rx,Om={};class e{constructor(n){let i=n.zone||Ln.defaultZone,o=n.invalid||(Number.isNaN(n.ts)?new Pi("invalid input"):null)||(!i.isValid?Tx(i):null);this.ts=nn(n.ts)?Ln.now():n.ts;let c=null,p=null;if(!o)if(n.old&&n.old.ts===this.ts&&n.old.zone.equals(i))[c,p]=[n.old.c,n.old.o];else{let m=to(n.o)&&!n.old?n.o:i.offset(this.ts);c=Ym(this.ts,m),o=Number.isNaN(c.year)?new Pi("invalid input"):null,c=o?null:c,p=o?null:m}this._zone=i,this.loc=n.loc||ln.create(),this.invalid=o,this.weekData=null,this.localWeekData=null,this.c=c,this.o=p,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[n,i]=nw(arguments),[o,c,p,x,m,a,f]=i;return g1({year:o,month:c,day:p,hour:x,minute:m,second:a,millisecond:f},n)}static utc(){let[n,i]=nw(arguments),[o,c,p,x,m,a,f]=i;return n.zone=Ki.utcInstance,g1({year:o,month:c,day:p,hour:x,minute:m,second:a,millisecond:f},n)}static fromJSDate(n,i={}){let o=B3(n)?n.valueOf():NaN;if(Number.isNaN(o))return e.invalid("invalid input");let c=Po(i.zone,Ln.defaultZone);if(!c.isValid)return e.invalid(Tx(c));return new e({ts:o,zone:c,loc:ln.fromObject(i)})}static fromMillis(n,i={}){if(!to(n))throw new wi(`fromMillis requires a numerical input, but received a ${typeof n} with value ${n}`);else if(n<-P1||n>P1)return e.invalid("Timestamp out of range");else return new e({ts:n,zone:Po(i.zone,Ln.defaultZone),loc:ln.fromObject(i)})}static fromSeconds(n,i={}){if(!to(n))throw new wi("fromSeconds requires a numerical input");else return new e({ts:n*1000,zone:Po(i.zone,Ln.defaultZone),loc:ln.fromObject(i)})}static fromObject(n,i={}){n=n||{};let o=Po(i.zone,Ln.defaultZone);if(!o.isValid)return e.invalid(Tx(o));let c=ln.fromObject(i),p=bm(n,d1),{minDaysInFirstWeek:x,startOfWeek:m}=L1(p,c),a=Ln.now(),f=!nn(i.specificOffset)?i.specificOffset:o.offset(a),v=!nn(p.ordinal),$=!nn(p.year),w=!nn(p.month)||!nn(p.day),J=$||w,S=p.weekYear||p.weekNumber;if((J||v)&&S)throw new Hc("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(w&&v)throw new Hc("Can't mix ordinal dates with month/day");let X=S||p.weekday&&!J,R,K,M=Ym(a,f);if(X)R=oX,K=nX,M=Vm(M,x,m);else if(v)R=cX,K=iX,M=jf(M);else R=xJ,K=pJ;let Y=!1;for(let y of R){let H=p[y];if(!nn(H))Y=!0;else if(Y)p[y]=K[y];else p[y]=M[y]}let I=X?_3(p,x,m):v?b3(p):Vw(p),G=I||_w(p);if(G)return e.invalid(G);let z=X?j1(p,x,m):v?D1(p):p,[E,Q]=Em(z,f,o),b=new e({ts:E,zone:o,o:Q,loc:c});if(p.weekday&&J&&n.weekday!==b.weekday)return e.invalid("mismatched weekday",`you can't specify both a weekday of ${p.weekday} and a date of ${b.toISO()}`);if(!b.isValid)return e.invalid(b.invalid);return b}static fromISO(n,i={}){let[o,c]=Y7(n);return mp(o,c,i,"ISO 8601",n)}static fromRFC2822(n,i={}){let[o,c]=H7(n);return mp(o,c,i,"RFC 2822",n)}static fromHTTP(n,i={}){let[o,c]=z7(n);return mp(o,c,i,"HTTP",i)}static fromFormat(n,i,o={}){if(nn(n)||nn(i))throw new wi("fromFormat requires an input string and a format");let{locale:c=null,numberingSystem:p=null}=o,x=ln.fromOpts({locale:c,numberingSystem:p,defaultToEN:!0}),[m,a,f,v]=e7(x,n,i);if(v)return e.invalid(v);else return mp(m,a,o,`format ${i}`,n,f)}static fromString(n,i,o={}){return e.fromFormat(n,i,o)}static fromSQL(n,i={}){let[o,c]=b7(n);return mp(o,c,i,"SQL",n)}static invalid(n,i=null){if(!n)throw new wi("need to specify a reason the DateTime is invalid");let o=n instanceof Pi?n:new Pi(n,i);if(Ln.throwOnInvalid)throw new iw(o);else return new e({invalid:o})}static isDateTime(n){return n&&n.isLuxonDateTime||!1}static parseFormatForOpts(n,i={}){let o=oJ(n,ln.fromObject(i));return!o?null:o.map((c)=>c?c.val:null).join("")}static expandFormat(n,i={}){return nJ(Wi.parseFormat(n),ln.fromObject(i)).map((c)=>c.val).join("")}static resetCache(){Rx=void 0,Om={}}get(n){return this[n]}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?Nf(this).weekYear:NaN}get weekNumber(){return this.isValid?Nf(this).weekNumber:NaN}get weekday(){return this.isValid?Nf(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?hf(this).weekday:NaN}get localWeekNumber(){return this.isValid?hf(this).weekNumber:NaN}get localWeekYear(){return this.isValid?hf(this).weekYear:NaN}get ordinal(){return this.isValid?jf(this.c).ordinal:NaN}get monthShort(){return this.isValid?fp.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?fp.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?fp.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?fp.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 n=86400000,i=60000,o=Bm(this.c),c=this.zone.offset(o-n),p=this.zone.offset(o+n),x=this.zone.offset(o-c*i),m=this.zone.offset(o-p*i);if(x===m)return[this];let a=o-x*i,f=o-m*i,v=Ym(a,x),$=Ym(f,m);if(v.hour===$.hour&&v.minute===$.minute&&v.second===$.second&&v.millisecond===$.millisecond)return[Yc(this,{ts:a}),Yc(this,{ts:f})];return[this]}get isInLeapYear(){return Kx(this.year)}get daysInMonth(){return _m(this.year,this.month)}get daysInYear(){return this.isValid?vp(this.year):NaN}get weeksInWeekYear(){return this.isValid?Xx(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Xx(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(n={}){let{locale:i,numberingSystem:o,calendar:c}=Wi.create(this.loc.clone(n),n).resolvedOptions(this);return{locale:i,numberingSystem:o,outputCalendar:c}}toUTC(n=0,i={}){return this.setZone(Ki.instance(n),i)}toLocal(){return this.setZone(Ln.defaultZone)}setZone(n,{keepLocalTime:i=!1,keepCalendarTime:o=!1}={}){if(n=Po(n,Ln.defaultZone),n.equals(this.zone))return this;else if(!n.isValid)return e.invalid(Tx(n));else{let c=this.ts;if(i||o){let p=n.offset(this.ts),x=this.toObject();[c]=Em(x,p,n)}return Yc(this,{ts:c,zone:n})}}reconfigure({locale:n,numberingSystem:i,outputCalendar:o}={}){let c=this.loc.clone({locale:n,numberingSystem:i,outputCalendar:o});return Yc(this,{loc:c})}setLocale(n){return this.reconfigure({locale:n})}set(n){if(!this.isValid)return this;let i=bm(n,d1),{minDaysInFirstWeek:o,startOfWeek:c}=L1(i,this.loc),p=!nn(i.weekYear)||!nn(i.weekNumber)||!nn(i.weekday),x=!nn(i.ordinal),m=!nn(i.year),a=!nn(i.month)||!nn(i.day),f=m||a,v=i.weekYear||i.weekNumber;if((f||x)&&v)throw new Hc("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&x)throw new Hc("Can't mix ordinal dates with month/day");let $;if(p)$=j1({...Vm(this.c,o,c),...i},o,c);else if(!nn(i.ordinal))$=D1({...jf(this.c),...i});else if($={...this.toObject(),...i},nn(i.day))$.day=Math.min(_m($.year,$.month),$.day);let[w,J]=Em($,this.o,this.zone);return Yc(this,{ts:w,o:J})}plus(n){if(!this.isValid)return this;let i=An.fromDurationLike(n);return Yc(this,t1(this,i))}minus(n){if(!this.isValid)return this;let i=An.fromDurationLike(n).negate();return Yc(this,t1(this,i))}startOf(n,{useLocaleWeeks:i=!1}={}){if(!this.isValid)return this;let o={},c=An.normalizeUnit(n);switch(c){case"years":o.month=1;case"quarters":case"months":o.day=1;case"weeks":case"days":o.hour=0;case"hours":o.minute=0;case"minutes":o.second=0;case"seconds":o.millisecond=0;break}if(c==="weeks")if(i){let p=this.loc.getStartOfWeek(),{weekday:x}=this;if(x<p)o.weekNumber=this.weekNumber-1;o.weekday=p}else o.weekday=1;if(c==="quarters"){let p=Math.ceil(this.month/3);o.month=(p-1)*3+1}return this.set(o)}endOf(n,i){return this.isValid?this.plus({[n]:1}).startOf(n,i).minus(1):this}toFormat(n,i={}){return this.isValid?Wi.create(this.loc.redefaultToEN(i)).formatDateTimeFromString(this,n):Lf}toLocaleString(n=Um,i={}){return this.isValid?Wi.create(this.loc.clone(i),n).formatDateTime(this):Lf}toLocaleParts(n={}){return this.isValid?Wi.create(this.loc.clone(n),n).formatDateTimeParts(this):[]}toISO({format:n="extended",suppressSeconds:i=!1,suppressMilliseconds:o=!1,includeOffset:c=!0,extendedZone:p=!1}={}){if(!this.isValid)return null;let x=n==="extended",m=Cf(this,x);return m+="T",m+=r1(this,x,i,o,c,p),m}toISODate({format:n="extended"}={}){if(!this.isValid)return null;return Cf(this,n==="extended")}toISOWeekDate(){return Hm(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:n=!1,suppressSeconds:i=!1,includeOffset:o=!0,includePrefix:c=!1,extendedZone:p=!1,format:x="extended"}={}){if(!this.isValid)return null;return(c?"T":"")+r1(this,x==="extended",i,n,o,p)}toRFC2822(){return Hm(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Hm(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){if(!this.isValid)return null;return Cf(this,!0)}toSQLTime({includeOffset:n=!0,includeZone:i=!1,includeOffsetSpace:o=!0}={}){let c="HH:mm:ss.SSS";if(i||n){if(o)c+=" ";if(i)c+="z";else if(n)c+="ZZ"}return Hm(this,c,!0)}toSQL(n={}){if(!this.isValid)return null;return`${this.toSQLDate()} ${this.toSQLTime(n)}`}toString(){return this.isValid?this.toISO():Lf}[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(n={}){if(!this.isValid)return{};let i={...this.c};if(n.includeConfig)i.outputCalendar=this.outputCalendar,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale;return i}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(n,i="milliseconds",o={}){if(!this.isValid||!n.isValid)return An.invalid("created by diffing an invalid DateTime");let c={locale:this.locale,numberingSystem:this.numberingSystem,...o},p=j3(i).map(An.normalizeUnit),x=n.valueOf()>this.valueOf(),m=x?this:n,a=x?n:this,f=h7(m,a,p,c);return x?f.negate():f}diffNow(n="milliseconds",i={}){return this.diff(e.now(),n,i)}until(n){return this.isValid?hn.fromDateTimes(this,n):this}hasSame(n,i,o){if(!this.isValid)return!1;let c=n.valueOf(),p=this.setZone(n.zone,{keepLocalTime:!0});return p.startOf(i,o)<=c&&c<=p.endOf(i,o)}equals(n){return this.isValid&&n.isValid&&this.valueOf()===n.valueOf()&&this.zone.equals(n.zone)&&this.loc.equals(n.loc)}toRelative(n={}){if(!this.isValid)return null;let i=n.base||e.fromObject({},{zone:this.zone}),o=n.padding?this<i?-n.padding:n.padding:0,c=["years","months","days","hours","minutes","seconds"],p=n.unit;if(Array.isArray(n.unit))c=n.unit,p=void 0;return e1(i,this.plus(o),{...n,numeric:"always",units:c,unit:p})}toRelativeCalendar(n={}){if(!this.isValid)return null;return e1(n.base||e.fromObject({},{zone:this.zone}),this,{...n,numeric:"auto",units:["years","months","days"],calendary:!0})}static min(...n){if(!n.every(e.isDateTime))throw new wi("min requires all arguments be DateTimes");return N1(n,(i)=>i.valueOf(),Math.min)}static max(...n){if(!n.every(e.isDateTime))throw new wi("max requires all arguments be DateTimes");return N1(n,(i)=>i.valueOf(),Math.max)}static fromFormatExplain(n,i,o={}){let{locale:c=null,numberingSystem:p=null}=o,x=ln.fromOpts({locale:c,numberingSystem:p,defaultToEN:!0});return iJ(x,n,i)}static fromStringExplain(n,i,o={}){return e.fromFormatExplain(n,i,o)}static buildFormatParser(n,i={}){let{locale:o=null,numberingSystem:c=null}=i,p=ln.fromOpts({locale:o,numberingSystem:c,defaultToEN:!0});return new pv(p,n)}static fromFormatParser(n,i,o={}){if(nn(n)||nn(i))throw new wi("fromFormatParser requires an input string and a format parser");let{locale:c=null,numberingSystem:p=null}=o,x=ln.fromOpts({locale:c,numberingSystem:p,defaultToEN:!0});if(!x.equals(i.locale))throw new wi(`fromFormatParser called with a locale of ${x}, but the format parser was created for ${i.locale}`);let{result:m,zone:a,specificOffset:f,invalidReason:v}=i.explainFromTokens(n);if(v)return e.invalid(v);else return mp(m,a,o,`format ${i.format}`,n,f)}static get DATE_SHORT(){return Um}static get DATE_MED(){return pw}static get DATE_MED_WITH_WEEKDAY(){return J3}static get DATE_FULL(){return xw}static get DATE_HUGE(){return mw}static get TIME_SIMPLE(){return aw}static get TIME_WITH_SECONDS(){return fw}static get TIME_WITH_SHORT_OFFSET(){return vw}static get TIME_WITH_LONG_OFFSET(){return $w}static get TIME_24_SIMPLE(){return ww}static get TIME_24_WITH_SECONDS(){return Jw}static get TIME_24_WITH_SHORT_OFFSET(){return Aw}static get TIME_24_WITH_LONG_OFFSET(){return Fw}static get DATETIME_SHORT(){return Tw}static get DATETIME_SHORT_WITH_SECONDS(){return Rw}static get DATETIME_MED(){return Sw}static get DATETIME_MED_WITH_SECONDS(){return Xw}static get DATETIME_MED_WITH_WEEKDAY(){return A3}static get DATETIME_FULL(){return Ww}static get DATETIME_FULL_WITH_SECONDS(){return Kw}static get DATETIME_HUGE(){return lw}static get DATETIME_HUGE_WITH_SECONDS(){return Gw}}function Ax(n){if(e.isDateTime(n))return n;else if(n&&n.valueOf&&to(n.valueOf()))return e.fromJSDate(n);else if(n&&typeof n==="object")return e.fromObject(n);else throw new wi(`Unknown datetime argument: ${n}, of type ${typeof n}`)}var mX="3.6.0";mJ.DateTime=e;mJ.Duration=An;mJ.FixedOffsetZone=Ki;mJ.IANAZone=Go;mJ.Info=fp;mJ.Interval=hn;mJ.InvalidZone=tf;mJ.Settings=Ln;mJ.SystemZone=Wx;mJ.VERSION=mX;mJ.Zone=Qc});var JJ=C((fJ)=>{Object.defineProperty(fJ,"__esModule",{value:!0});fJ.RE_RANGE=fJ.RE_WILDCARDS=fJ.PRESETS=fJ.TIME_UNITS_LEN=fJ.TIME_UNITS=fJ.TIME_UNITS_MAP=fJ.ALIASES=fJ.PARSE_DEFAULTS=fJ.CONSTRAINTS=void 0;fJ.CONSTRAINTS=Object.freeze({second:[0,59],minute:[0,59],hour:[0,23],dayOfMonth:[1,31],month:[1,12],dayOfWeek:[0,7]});fJ.PARSE_DEFAULTS=Object.freeze({second:"0",minute:"*",hour:"*",dayOfMonth:"*",month:"*",dayOfWeek:"*"});fJ.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});fJ.TIME_UNITS_MAP=Object.freeze({SECOND:"second",MINUTE:"minute",HOUR:"hour",DAY_OF_MONTH:"dayOfMonth",MONTH:"month",DAY_OF_WEEK:"dayOfWeek"});fJ.TIME_UNITS=Object.freeze(Object.values(fJ.TIME_UNITS_MAP));fJ.TIME_UNITS_LEN=fJ.TIME_UNITS.length;fJ.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"});fJ.RE_WILDCARDS=/\*/g;fJ.RE_RANGE=/^(\d+)(?:-(\d+))?(?:\/(\d+))?$/g});var mv=C((FJ)=>{Object.defineProperty(FJ,"__esModule",{value:!0});FJ.ExclusiveParametersError=FJ.CronError=void 0;class xv extends Error{}FJ.CronError=xv;class AJ extends xv{constructor(n,i){super(`You can't specify both ${n} and ${i}`)}}FJ.ExclusiveParametersError=AJ});var Lm=C((RJ)=>{Object.defineProperty(RJ,"__esModule",{value:!0});RJ.CronTime=void 0;var Di=aJ(),li=JJ(),_i=mv();class av{constructor(n,i,o){if(this.realDate=!1,this.second={},this.minute={},this.hour={},this.dayOfMonth={},this.month={},this.dayOfWeek={},i!=null&&o!=null)throw new _i.ExclusiveParametersError("timeZone","utcOffset");if(i){if(!Di.DateTime.fromObject({},{zone:i}).isValid)throw new _i.CronError("Invalid timezone.");this.timeZone=i}if(o!=null)this.utcOffset=o;if(i==null&&o==null){let c=Intl.DateTimeFormat().resolvedOptions().timeZone;this.timeZone=c}if(n instanceof Date||n instanceof Di.DateTime)this.source=n instanceof Date?Di.DateTime.fromJSDate(n):n,this.realDate=!0;else this.source=n,this._parse(this.source)}static validateCronExpression(n){try{return new av(n),{valid:!0}}catch(i){return{valid:!1,error:i}}}_getWeekDay(n){return n.weekday===7?0:n.weekday}sendAt(n){let i=this.realDate&&this.source instanceof Di.DateTime?this.source:Di.DateTime.utc();if(this.timeZone)i=i.setZone(this.timeZone);if(this.utcOffset!==void 0){let o=this.utcOffset<0?"-":"+",c=Math.trunc(this.utcOffset/60),p=String(Math.abs(c)).padStart(2,"0"),x=Math.abs(this.utcOffset-c*60),m=String(x).padStart(2,"0"),a=`UTC${o}${p}:${m}`;if(i=i.setZone(a),!i.isValid)throw new _i.CronError("ERROR: You specified an invalid UTC offset.")}if(this.realDate){if(Di.DateTime.local()>i)throw new _i.CronError("WARNING: Date in past. Will never be fired.");return i}if(n===void 0||isNaN(n)||n<0)return this.getNextDateFrom(i);else{let o=[];for(;n>0;n--)i=this.getNextDateFrom(i),o.push(i);return o}}getTimeout(){return Math.max(-1,this.sendAt().toMillis()-Di.DateTime.utc().toMillis())}toString(){return this.toJSON().join(" ")}toJSON(){return li.TIME_UNITS.map((n)=>{return this._wcOrAll(n)})}getNextDateFrom(n,i){var o,c;if(n instanceof Date)n=Di.DateTime.fromJSDate(n);if(i)n=n.setZone(i);else i=(o=n.zone.zoneName)!==null&&o!==void 0?o:n.zone.fixed;let p=Di.DateTime.fromFormat(`${n.year}-${n.month}-${n.day} ${n.hour}:${n.minute}:${n.second}`,"yyyy-M-d H:m:s",{zone:"UTC"}),x=p.toMillis();if(!this.realDate){if(p.millisecond>0)p=p.set({millisecond:0,second:p.second+1})}if(!p.isValid)throw new _i.CronError("ERROR: You specified an invalid date.");let m=Di.DateTime.now().plus({years:8});while(!0){if(p>m)throw new _i.CronError(`Something went wrong. No execution date was found in the next 8 years.
3
+ var OG=Object.create;var{getPrototypeOf:_G,defineProperty:L1,getOwnPropertyNames:yG}=Object;var LG=Object.prototype.hasOwnProperty;var C1=(i,o,n)=>{n=i!=null?OG(_G(i)):{};let p=o||!i||!i.__esModule?L1(n,"default",{value:i,enumerable:!0}):n;for(let c of yG(i))if(!LG.call(p,c))L1(p,c,{get:()=>i[c],enumerable:!0});return p};var a=(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=a((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 Jc extends Dp{}class b$ extends Dp{constructor(i){super(`Invalid unit ${i}`)}}class Uo extends Dp{}class Fp extends Dp{constructor(){super("Zone is an abstract class")}}var D="numeric",Cn="short",cn="long",Tf={year:D,month:D,day:D},g8={year:D,month:Cn,day:D},_U={year:D,month:Cn,day:D,weekday:Cn},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:Cn},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:Cn},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:Cn,day:D,hour:D,minute:D},f6={year:D,month:Cn,day:D,hour:D,minute:D,second:D},yU={year:D,month:Cn,day:D,weekday:Cn,hour:D,minute:D},$6={year:D,month:cn,day:D,hour:D,minute:D,timeZoneName:Cn},J6={year:D,month:cn,day:D,hour:D,minute:D,second:D,timeZoneName:Cn},F6={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 Fp}get name(){throw new Fp}get ianaName(){return this.name}get isUniversal(){throw new Fp}offsetName(i,o){throw new Fp}formatOffset(i,o){throw new Fp}offset(i){throw new Fp}equals(i){throw new Fp}get isValid(){throw new Fp}}var K$=null;class OT extends Ac{static get instance(){if(K$===null)K$=new OT;return K$}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(i,{format:o,locale:n}){return M6(i,o,n)}formatOffset(i,o){return VT(this.offset(i),o)}offset(i){return-new Date(i).getTimezoneOffset()}equals(i){return i.type==="system"}get isValid(){return!0}}var V$=new Map;function LU(i){let o=V$.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"}),V$.set(i,o);return o}var CU={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function DU(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,$,J]=p;return[T,c,x,m,f,$,J]}function BU(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 H$=new Map;class sn extends Ac{static create(i){let o=H$.get(i);if(o===void 0)H$.set(i,o=new sn(i));return o}static resetCache(){H$.clear(),V$.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 M6(i,o,n,this.name)}formatOffset(i,o){return VT(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,$]=n.formatToParts?BU(n,o):DU(n,o);if(T==="BC")p=-Math.abs(p)+1;let F=Ff({year:p,month:c,day:x,hour:m===24?0:m,minute:f,second:$,millisecond:0}),A=+o,X=A%1000;return A-=X>=0?X:1000+X,(F-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 E$=new Map;function O$(i,o={}){let n=JSON.stringify([i,o]),p=E$.get(n);if(p===void 0)p=new Intl.DateTimeFormat(i,o),E$.set(n,p);return p}var _$=new Map;function NU(i,o={}){let n=JSON.stringify([i,o]),p=_$.get(n);if(p===void 0)p=new Intl.NumberFormat(i,o),_$.set(n,p);return p}var y$=new Map;function bU(i,o={}){let{base:n,...p}=o,c=JSON.stringify([i,p]),x=y$.get(c);if(x===void 0)x=new Intl.RelativeTimeFormat(i,o),y$.set(c,x);return x}var MT=null;function jU(){if(MT)return MT;else return MT=new Intl.DateTimeFormat().resolvedOptions().locale,MT}var L$=new Map;function v6(i){let o=L$.get(i);if(o===void 0)o=new Intl.DateTimeFormat(i).resolvedOptions(),L$.set(i,o);return o}var C$=new Map;function aU(i){let o=C$.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};C$.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=O$(i).resolvedOptions(),c=i}catch(m){let f=i.substring(0,n);p=O$(f).resolvedOptions(),c=f}let{numberingSystem:x,calendar:T}=p;return[c,x,T]}}function lU(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 qU(i){let o=[];for(let n=1;n<=12;n++){let p=r.utc(2009,n,1);o.push(i(p))}return o}function kU(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 of(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 hU(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=NU(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):k$(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=O$(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&&u6())this.rtf=bU(i,n)}format(i,o){if(this.rtf)return this.rtf.format(i,o);else return wz(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":jU()),m=o||li.defaultNumberingSystem,f=n||li.defaultOutputCalendar,$=B$(p)||li.defaultWeekSettings;return new Ui(T,m,f,$,x)}static resetCache(){MT=null,E$.clear(),_$.clear(),y$.clear(),L$.clear(),C$.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=lU(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=hU(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,B$(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 of(this,i,V6,()=>{let n=o?{month:i,day:"numeric"}:{month:i},p=o?"format":"standalone";if(!this.monthsCache[p][i])this.monthsCache[p][i]=qU((c)=>this.extract(c,n,"month"));return this.monthsCache[p][i]})}weekdays(i,o=!1){return of(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]=kU((c)=>this.extract(c,n,"weekday"));return this.weekdaysCache[p][i]})}meridiems(){return of(this,void 0,()=>y6,()=>{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 of(this,i,L6,()=>{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 aU(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 U$=null;class yo extends Ac{static get utcInstance(){if(U$===null)U$=new yo(0);return U$}static instance(i){return i===0?yo.utcInstance:new yo(i)}static parseSpecifier(i){if(i){let o=i.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(o)return new yo(Af(o[1],o[2]))}return null}constructor(i){super();this.fixed=i}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${VT(this.fixed,"narrow")}`}get ianaName(){if(this.fixed===0)return"Etc/UTC";else return`Etc/GMT${VT(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(i,o){return VT(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 j$ 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 Lp(i,o){if(e(i)||i===null)return o;else if(i instanceof Ac)return i;else if(eU(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 yo.utcInstance;else return yo.parseSpecifier(n)||sn.create(i)}else if(Cp(i))return yo.instance(i);else if(typeof i==="object"&&"offset"in i&&typeof i.offset==="function")return i;else return new j$(i)}var a$={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]},gU=a$.hanidec.replace(/[\[|\]]/g,"").split("");function sU(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(a$.hanidec)!==-1)o+=gU.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 D$=new Map;function tU(){D$.clear()}function yn({numberingSystem:i},o=""){let n=i||"latn",p=D$.get(n);if(p===void 0)p=new Map,D$.set(n,p);let c=p.get(o);if(c===void 0)c=new RegExp(`${a$[n]}${o}`),p.set(o,c);return c}var Y8=()=>Date.now(),G8="system",K8=null,H8=null,U8=null,z8=60,u8,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 Lp(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=B$(i)}static get twoDigitCutoffYear(){return z8}static set twoDigitCutoffYear(i){z8=i%100}static get throwOnInvalid(){return u8}static set throwOnInvalid(i){u8=i}static resetCaches(){Ui.resetCache(),sn.resetCache(),r.resetCache(),tU()}}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 P$(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 l$(i,o){return(i-o+7)%7+1}function mf(i,o=4,n=1){let{year:p,month:c,day:x}=i,T=K6(p,c,x),m=l$(P$(p,c,x),n),f=Math.floor((T-m+14-o)/7),$;if(f<1)$=p-1,f=ET($,o,n);else if(f>ET(p,o,n))$=p+1,f=1;else $=p;return{weekYear:$,weekNumber:f,weekday:m,...vf(i)}}function M8(i,o=4,n=1){let{weekYear:p,weekNumber:c,weekday:x}=i,T=l$(P$(p,1,o),n),m=mx(p),f=c*7+x-T-7+o,$;if(f<1)$=p-1,f+=mx($);else if(f>m)$=p+1,f-=mx(p);else $=p;let{month:J,day:F}=H6($,f);return{year:$,month:J,day:F,...vf(i)}}function z$(i){let{year:o,month:n,day:p}=i,c=K6(o,n,p);return{year:o,ordinal:c,...vf(i)}}function Q8(i){let{year:o,ordinal:n}=i,{month:p,day:c}=H6(o,n);return{year:o,month:p,day:c,...vf(i)}}function S8(i,o){if(!e(i.localWeekday)||!e(i.localWeekNumber)||!e(i.localWeekYear)){if(!e(i.weekday)||!e(i.weekNumber)||!e(i.weekYear))throw new Jc("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 dU(i,o=4,n=1){let p=Jf(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 rU(i){let o=Jf(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=Jf(i.year),n=Hn(i.month,1,12),p=Hn(i.day,1,ff(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 Cp(i){return typeof i==="number"}function Jf(i){return typeof i==="number"&&i%1===0}function eU(i){return typeof i==="string"}function iz(i){return Object.prototype.toString.call(i)==="[object Date]"}function u6(){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 oz(i){return Array.isArray(i)?i:[i]}function V8(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 nz(i,o){return o.reduce((n,p)=>{return n[p]=i[p],n},{})}function $x(i,o){return Object.prototype.hasOwnProperty.call(i,o)}function B$(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 Jf(i)&&i>=o&&i<=n}function pz(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 yp(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 q$(i){if(e(i)||i===null||i==="")return;else{let o=parseFloat("0."+i)*1000;return Math.floor(o)}}function k$(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 ff(i,o){let n=pz(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 Ff(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-l$(P$(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 I$(i){if(i>99)return i;else return i>li.twoDigitCutoffYear?1900+i:2000+i}function M6(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 Af(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 $f(i,o){let n={};for(let p in i)if($x(i,p)){let c=i[p];if(c===void 0||c===null)continue;n[o(p)]=Q6(c)}return n}function VT(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 vf(i){return nz(i,["hour","minute","second","millisecond"])}var cz=["January","February","March","April","May","June","July","August","September","October","November","December"],S6=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],xz=["J","F","M","A","M","J","J","A","S","O","N","D"];function V6(i){switch(i){case"narrow":return[...xz];case"short":return[...S6];case"long":return[...cz];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"],Tz=["M","T","W","T","F","S","S"];function _6(i){switch(i){case"narrow":return[...Tz];case"short":return[...O6];case"long":return[...E6];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var y6=["AM","PM"],mz=["Before Christ","Anno Domini"],fz=["BC","AD"],$z=["B","A"];function L6(i){switch(i){case"narrow":return[...$z];case"short":return[...fz];case"long":return[...mz];default:return null}}function Jz(i){return y6[i.hour<12?0:1]}function Fz(i,o){return _6(o)[i.weekday-1]}function Az(i,o){return V6(o)[i.month-1]}function vz(i,o){return L6(o)[i.year<0?0:1]}function wz(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 F=i==="days";switch(o){case 1:return F?"tomorrow":`next ${c[i][0]}`;case-1:return F?"yesterday":`last ${c[i][0]}`;case 0:return F?"today":`this ${c[i][0]}`}}let T=Object.is(o,-0)||o<0,m=Math.abs(o),f=m===1,$=c[i],J=p?f?$[1]:$[2]||$[1]:f?c[i][0]:i;return T?`${m} ${J} ago`:`in ${m} ${J}`}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 Xz={D:Tf,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:$6,ffff:F6,F:T6,FF:f6,FFF:J6,FFFF:A6};class _o{static create(i,o={}){return new _o(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 Xz[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?Jz(i):c({hour:"numeric",hourCycle:"h12"},"dayperiod"),m=(A,X)=>n?Az(i,A):c(X?{month:A}:{month:A,day:"numeric"},"month"),f=(A,X)=>n?Fz(i,A):c(X?{weekday:A}:{weekday:A,month:"long",day:"numeric"},"weekday"),$=(A)=>{let X=_o.macroTokenToFormatOpts(A);if(X)return this.formatWithSystemDefault(i,X);else return A},J=(A)=>n?vz(i,A):c({era:A},"era"),F=(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 J("short");case"GG":return J("long");case"GGGGG":return J("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 $(A)}};return O8(_o.parseFormat(o),F)}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 $=n(f);if($)return this.num(m.get($),f.length);else return f},c=_o.parseFormat(o),x=c.reduce((m,{literal:f,val:$})=>f?m:m.concat($),[]),T=i.shiftTo(...x.map(n).filter((m)=>m));return O8(c,p(T))}}var C6=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Jx(...i){let o=i.reduce((n,p)=>n+p.source,"");return RegExp(`^${o}$`)}function Fx(...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]]=yp(o[n+c]);return[p,null,n+c]}}var B6=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Wz=`(?:${B6.source}?(?:\\[(${C6.source})\\])?)?`,h$=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,I6=RegExp(`${h$.source}${Wz}`),g$=RegExp(`(?:T${I6.source})?`),Rz=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Yz=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Gz=/(\d{4})-?(\d{3})/,Kz=D6("weekYear","weekNumber","weekDay"),Hz=D6("year","ordinal"),Uz=/(\d{4})-(\d\d)-(\d\d)/,N6=RegExp(`${h$.source} ?(?:${B6.source}|(${C6.source}))?`),zz=RegExp(`(?: ${N6.source})?`);function fx(i,o,n){let p=i[o];return e(p)?n:yp(p)}function uz(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:q$(i[o+3])},null,o+4]}function yT(i,o){let n=!i[o]&&!i[o+1],p=Af(i[o+1],i[o+2]),c=n?null:yo.instance(p);return[{},c,o+3]}function LT(i,o){let n=i[o]?sn.create(i[o]):null;return[{},n,o+1]}var Zz=RegExp(`^T?${h$.source}$`),Mz=/^-?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 Qz(i){let[o,n,p,c,x,T,m,f,$]=i,J=o[0]==="-",F=f&&f[0]==="-",A=(X,Y=!1)=>X!==void 0&&(Y||X&&J)?-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(q$($),F)}]}var Sz={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function s$(i,o,n,p,c,x,T){let m={year:o.length===2?I$(yp(o)):yp(o),month:S6.indexOf(n)+1,day:yp(p),hour:yp(c),minute:yp(x)};if(T)m.second=yp(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 Ez(i){let[,o,n,p,c,x,T,m,f,$,J,F]=i,A=s$(o,c,p,n,x,T,m),X;if(f)X=Sz[f];else if($)X=0;else X=Af(J,F);return[A,new yo(X)]}function Oz(i){return i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var _z=/^(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$/,yz=/^(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[s$(o,c,p,n,x,T,m),yo.utcInstance]}function Cz(i){let[,o,n,p,c,x,T,m]=i;return[s$(o,m,n,p,c,x,T),yo.utcInstance]}var Dz=Jx(Rz,g$),Bz=Jx(Yz,g$),Iz=Jx(Gz,g$),Nz=Jx(I6),b6=Fx(uz,vx,yT,LT),bz=Fx(Kz,vx,yT,LT),jz=Fx(Hz,vx,yT,LT),az=Fx(vx,yT,LT);function Pz(i){return Ax(i,[Dz,b6],[Bz,bz],[Iz,jz],[Nz,az])}function lz(i){return Ax(Oz(i),[Vz,Ez])}function qz(i){return Ax(i,[_z,_8],[yz,_8],[Lz,Cz])}function kz(i){return Ax(i,[Mz,Qz])}var hz=Fx(vx);function gz(i){return Ax(i,[Zz,hz])}var sz=Jx(Uz,zz),tz=Jx(N6),dz=Fx(vx,yT,LT);function rz(i){return Ax(i,[sz,b6],[tz,dz])}var y8="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}},ez={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,iu={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},Fc=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],ou=Fc.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 a6(i,o){var n;let p=(n=o.milliseconds)!=null?n:0;for(let c of ou.slice(1))if(o[c])p+=o[c]*i[c].milliseconds;return p}function L8(i,o){let n=a6(i,o)<0?-1:1;Fc.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),Fc.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 nu(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?iu:ez;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:$f(i,wi.normalizeUnit),loc:Ui.fromObject(o),conversionAccuracy:o.conversionAccuracy,matrix:o.matrix})}static fromDurationLike(i){if(Cp(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]=kz(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]=gz(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 b$(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?_o.create(this.loc,n).formatDurationFromString(this,i):y8}toHuman(i={}){if(!this.isValid)return y8;let o=Fc.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+=k$(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 a6(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 Fc)if($x(o.values,p)||$x(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,...$f(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 L8(this.matrix,i),_p(this,{values:i},!0)}rescale(){if(!this.isValid)return this;let i=nu(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 Fc)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(Cp(p[x]))T+=p[x];let m=Math.trunc(T);o[x]=m,n[x]=(T*1000-m*1000)/1000}else if(Cp(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 L8(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 Fc)if(!o(this.values[n],i.values[n]))return!1;return!0}}var cx="Invalid Interval";function pu(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=pu(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=Tf,o={}){return this.isValid?_o.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 Lp(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:u6(),localeWeek:Z6()}}}function C8(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 cu(i,o,n){let p=[["years",(f,$)=>$.year-f.year],["quarters",(f,$)=>$.quarter-f.quarter+($.year-f.year)*4],["months",(f,$)=>$.month-f.month+($.year-f.year)*12],["weeks",(f,$)=>{let J=C8(f,$);return(J-J%7)/7}],["days",C8]],c={},x=i,T,m;for(let[f,$]of p)if(n.indexOf(f)>=0)if(T=f,c[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 xu(i,o,n,p){let[c,x,T,m]=cu(i,o,n),f=o-c,$=n.filter((F)=>["hours","minutes","seconds","milliseconds"].indexOf(F)>=0);if($.length===0){if(T<o)T=c.plus({[m]:1});if(T!==c)x[m]=(x[m]||0)+f/(T-c)}let J=wi.fromObject(x,p);if($.length>0)return wi.fromMillis(f,p).shiftTo(...$).plus(J);else return J}var Tu="missing Intl.DateTimeFormat.formatToParts support";function Ki(i,o=(n)=>n){return{regex:i,deser:([n])=>o(sU(n))}}var mu=String.fromCharCode(160),P6=`[ ${mu}]`,l6=new RegExp(P6,"g");function fu(i){return i.replace(/\./g,"\\.?").replace(l6,P6)}function D8(i){return i.replace(/\./g,"").replace(l6," ").toLowerCase()}function Ln(i,o){if(i===null)return null;else return{regex:RegExp(i.map(fu).join("|")),deser:([n])=>i.findIndex((p)=>D8(n)===D8(p))+o}}function B8(i,o){return{regex:i,deser:([,n,p])=>Af(n,p),groups:o}}function nf(i){return{regex:i,deser:([o])=>o}}function $u(i){return i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ju(i,o){let n=yn(o),p=yn(o,"{2}"),c=yn(o,"{3}"),x=yn(o,"{4}"),T=yn(o,"{6}"),m=yn(o,"{1,2}"),f=yn(o,"{1,3}"),$=yn(o,"{1,6}"),J=yn(o,"{1,9}"),F=yn(o,"{2,4}"),A=yn(o,"{4,6}"),X=(K)=>({regex:RegExp($u(K.val)),deser:([H])=>H,literal:!0}),R=((K)=>{if(i.literal)return X(K);switch(K.val){case"G":return Ln(o.eras("short"),0);case"GG":return Ln(o.eras("long"),0);case"y":return Ki($);case"yy":return Ki(F,I$);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 Ln(o.months("short",!0),1);case"MMMM":return Ln(o.months("long",!0),1);case"L":return Ki(m);case"LL":return Ki(p);case"LLL":return Ln(o.months("short",!1),1);case"LLLL":return Ln(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 nf(J);case"uu":return nf(m);case"uuu":return Ki(n);case"a":return Ln(o.meridiems(),0);case"kkkk":return Ki(x);case"kk":return Ki(F,I$);case"W":return Ki(m);case"WW":return Ki(p);case"E":case"c":return Ki(n);case"EEE":return Ln(o.weekdays("short",!1),1);case"EEEE":return Ln(o.weekdays("long",!1),1);case"ccc":return Ln(o.weekdays("short",!0),1);case"cccc":return Ln(o.weekdays("long",!0),1);case"Z":case"ZZ":return B8(new RegExp(`([+-]${m.source})(?::(${p.source}))?`),2);case"ZZZ":return B8(new RegExp(`([+-]${m.source})(${p.source})?`),2);case"z":return nf(/[a-z_+-/]{1,256}?/i);case" ":return nf(/[^\S\n\r]/);default:return X(K)}})(i)||{invalidReason:Tu};return R.token=i,R}var Fu={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 Au(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=Fu[T];if(typeof m==="object")m=m[x];if(m)return{literal:!1,val:m};return}function vu(i){return[`^${i.map((n)=>n.regex).reduce((n,p)=>`${n}(${p.source})`,"")}$`,i]}function wu(i,o,n){let p=i.match(o);if(p){let c={},x=1;for(let T in n)if($x(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 Xu(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 yo(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=q$(i.u);return[Object.keys(i).reduce((x,T)=>{let m=o(T);if(m)x[m]=i[T];return x},{}),n,p]}var u$=null;function Wu(){if(!u$)u$=r.fromMillis(1555555555555);return u$}function Ru(i,o){if(i.literal)return i;let n=_o.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)=>Ru(n,o)))}class t${constructor(i,o){if(this.locale=i,this.format=o,this.tokens=q6(_o.parseFormat(o),i),this.units=this.tokens.map((n)=>Ju(n,i)),this.disqualifyingUnit=this.units.find((n)=>n.invalidReason),!this.disqualifyingUnit){let[n,p]=vu(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]=wu(i,this.regex,this.handlers),[p,c,x]=n?Xu(n):[null,null,void 0];if($x(n,"a")&&$x(n,"H"))throw new Jc("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 t$(i,n).explainFromTokens(o)}function Yu(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=_o.create(o,i).dtFormatter(Wu()),c=p.formatToParts(),x=p.resolvedOptions();return c.map((T)=>Au(T,i,x))}var Z$="Invalid DateTime",I8=8640000000000000;function QT(i){return new Gn("unsupported zone",`the zone "${i.name}" is not supported`)}function M$(i){if(i.weekData===null)i.weekData=mf(i.c);return i.weekData}function Q$(i){if(i.localWeekData===null)i.localWeekData=mf(i.c,i.loc.getMinDaysInFirstWeek(),i.loc.getStartOfWeek());return i.localWeekData}function $c(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 pf(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 xf(i,o,n){return g6(Ff(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,ff(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=Ff(x),[f,$]=g6(m,n,i.zone);if(T!==0)f+=T,$=i.zone.offset(f);return{ts:f,o:$}}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,$=r.fromObject(i,{...n,zone:f,specificOffset:x});return T?$:$.setZone(m)}else return r.invalid(new Gn("unparsable",`the input "${c}" can't be parsed as ${p}`))}function cf(i,o,n=!0){return i.isValid?_o.create(Ui.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(i,o):null}function S$(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},Gu={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ku={ordinal:1,hour:0,minute:0,second:0,millisecond:0},t6=["year","month","day","hour","minute","second","millisecond"],Hu=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Uu=["year","ordinal","hour","minute","second","millisecond"];function zu(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 b$(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 zu(i)}}function uu(i){if(ST===void 0)ST=li.now();if(i.type!=="iana")return i.offset(ST);let o=i.name,n=N$.get(o);if(n===void 0)n=i.offset(ST),N$.set(o,n);return n}function a8(i,o){let n=Lp(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=uu(n);[c,x]=xf(i,m,n)}else c=li.now();return new r({ts:c,zone:n,loc:p,o:x})}function P8(i,o,n){let p=e(n.round)?!0:n.round,c=(T,m)=>{return T=k$(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 ST,N$=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=Cp(i.o)&&!i.old?i.o:o.offset(this.ts);p=pf(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 a8({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=yo.utcInstance,a8({year:n,month:p,day:c,hour:x,minute:T,second:m,millisecond:f},i)}static fromJSDate(i,o={}){let n=iz(i)?i.valueOf():NaN;if(Number.isNaN(n))return r.invalid("invalid input");let p=Lp(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(!Cp(i))throw new Uo(`fromMillis requires a numerical input, but received a ${typeof i} with value ${i}`);else if(i<-I8||i>I8)return r.invalid("Timestamp out of range");else return new r({ts:i,zone:Lp(o.zone,li.defaultZone),loc:Ui.fromObject(o)})}static fromSeconds(i,o={}){if(!Cp(i))throw new Uo("fromSeconds requires a numerical input");else return new r({ts:i*1000,zone:Lp(o.zone,li.defaultZone),loc:Ui.fromObject(o)})}static fromObject(i,o={}){i=i||{};let n=Lp(o.zone,li.defaultZone);if(!n.isValid)return r.invalid(QT(n));let p=Ui.fromObject(o),c=$f(i,j8),{minDaysInFirstWeek:x,startOfWeek:T}=S8(c,p),m=li.now(),f=!e(o.specificOffset)?o.specificOffset:n.offset(m),$=!e(c.ordinal),J=!e(c.year),F=!e(c.month)||!e(c.day),A=J||F,X=c.weekYear||c.weekNumber;if((A||$)&&X)throw new Jc("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(F&&$)throw new Jc("Can't mix ordinal dates with month/day");let Y=X||c.weekday&&!A,R,K,H=pf(m,f);if(Y)R=Hu,K=Gu,H=mf(H,x,T);else if($)R=Uu,K=Ku,H=z$(H);else R=t6,K=s6;let Z=!1;for(let l of R){let Q=c[l];if(!e(Q))Z=!0;else if(Z)c[l]=K[l];else c[l]=H[l]}let b=Y?dU(c,x,T):$?rU(c):U6(c),u=b||z6(c);if(u)return r.invalid(u);let M=Y?M8(c,x,T):$?Q8(c):c,[E,V]=xf(M,f,n),C=new r({ts:E,zone:n,o:V,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]=lz(i);return xx(n,p,o,"RFC 2822",i)}static fromHTTP(i,o={}){let[n,p]=qz(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,$]=Yu(x,i,o);if($)return r.invalid($);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]=rz(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(_o.parseFormat(i),Ui.fromObject(o)).map((p)=>p.val).join("")}static resetCache(){ST=void 0,N$.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?M$(this).weekYear:NaN}get weekNumber(){return this.isValid?M$(this).weekNumber:NaN}get weekday(){return this.isValid?M$(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Q$(this).weekday:NaN}get localWeekNumber(){return this.isValid?Q$(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Q$(this).weekYear:NaN}get ordinal(){return this.isValid?z$(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=Ff(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,$=pf(m,x),J=pf(f,T);if($.hour===J.hour&&$.minute===J.minute&&$.second===J.second&&$.millisecond===J.millisecond)return[$c(this,{ts:m}),$c(this,{ts:f})];return[this]}get isInLeapYear(){return _T(this.year)}get daysInMonth(){return ff(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}=_o.create(this.loc.clone(i),i).resolvedOptions(this);return{locale:o,numberingSystem:n,outputCalendar:p}}toUTC(i=0,o={}){return this.setZone(yo.instance(i),o)}toLocal(){return this.setZone(li.defaultZone)}setZone(i,{keepLocalTime:o=!1,keepCalendarTime:n=!1}={}){if(i=Lp(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]=xf(x,c,i)}return $c(this,{ts:p,zone:i})}}reconfigure({locale:i,numberingSystem:o,outputCalendar:n}={}){let p=this.loc.clone({locale:i,numberingSystem:o,outputCalendar:n});return $c(this,{loc:p})}setLocale(i){return this.reconfigure({locale:i})}set(i){if(!this.isValid)return this;let o=$f(i,j8),{minDaysInFirstWeek:n,startOfWeek:p}=S8(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,$=o.weekYear||o.weekNumber;if((f||x)&&$)throw new Jc("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(m&&x)throw new Jc("Can't mix ordinal dates with month/day");let J;if(c)J=M8({...mf(this.c,n,p),...o},n,p);else if(!e(o.ordinal))J=Q8({...z$(this.c),...o});else if(J={...this.toObject(),...o},e(o.day))J.day=Math.min(ff(J.year,J.month),J.day);let[F,A]=xf(J,this.o,this.zone);return $c(this,{ts:F,o:A})}plus(i){if(!this.isValid)return this;let o=wi.fromDurationLike(i);return $c(this,N8(this,o))}minus(i){if(!this.isValid)return this;let o=wi.fromDurationLike(i).negate();return $c(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?_o.create(this.loc.redefaultToEN(o)).formatDateTimeFromString(this,i):Z$}toLocaleString(i=Tf,o={}){return this.isValid?_o.create(this.loc.clone(o),i).formatDateTime(this):Z$}toLocaleParts(i={}){return this.isValid?_o.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=S$(this,x);return T+="T",T+=b8(this,x,o,n,p,c),T}toISODate({format:i="extended"}={}){if(!this.isValid)return null;return S$(this,i==="extended")}toISOWeekDate(){return cf(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 cf(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return cf(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){if(!this.isValid)return null;return S$(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 cf(this,p,!0)}toSQL(i={}){if(!this.isValid)return null;return`${this.toSQLDate()} ${this.toSQLTime(i)}`}toString(){return this.isValid?this.toISO():Z$}[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=oz(o).map(wi.normalizeUnit),x=i.valueOf()>this.valueOf(),T=x?this:i,m=x?i:this,f=xu(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 P8(o,this.plus(n),{...i,numeric:"always",units:p,unit:c})}toRelativeCalendar(i={}){if(!this.isValid)return null;return P8(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 V8(i,(o)=>o.valueOf(),Math.min)}static max(...i){if(!i.every(r.isDateTime))throw new Uo("max requires all arguments be DateTimes");return V8(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 t$(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:$}=o.explainFromTokens(i);if($)return r.invalid($);else return xx(T,m,n,`format ${o.format}`,i,f)}static get DATE_SHORT(){return Tf}static get DATE_MED(){return g8}static get DATE_MED_WITH_WEEKDAY(){return _U}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 yU}static get DATETIME_FULL(){return $6}static get DATETIME_FULL_WITH_SECONDS(){return J6}static get DATETIME_HUGE(){return F6}static get DATETIME_HUGE_WITH_SECONDS(){return A6}}function ZT(i){if(r.isDateTime(i))return i;else if(i&&i.valueOf&&Cp(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 Zu="3.6.1";d6.DateTime=r;d6.Duration=wi;d6.FixedOffsetZone=yo;d6.IANAZone=sn;d6.Info=Tx;d6.Interval=hi;d6.InvalidZone=j$;d6.Settings=li;d6.SystemZone=OT;d6.VERSION=Zu;d6.Zone=Ac});var p3=a((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 r$=a((x3)=>{Object.defineProperty(x3,"__esModule",{value:!0});x3.ExclusiveParametersError=x3.CronError=void 0;class d$ extends Error{}x3.CronError=d$;class c3 extends d${constructor(i,o){super(`You can't specify both ${i} and ${o}`)}}x3.ExclusiveParametersError=c3});var wf=a((m3)=>{Object.defineProperty(m3,"__esModule",{value:!0});m3.CronTime=void 0;var xn=r6(),Lo=p3(),to=r$();class e${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 e$(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: ${(c=i===null||i===void 0?void 0:i.toString())!==null&&c!==void 0?c:'""'} - Cron String: ${this.source.toString()} - UTC offset: ${p.offset} - current Date: ${Di.DateTime.local().toString()}`);if(!(p.month in this.month)&&Object.keys(this.month).length!==12){p=p.plus({month:1}),p=p.set({day:1,hour:0,minute:0,second:0});continue}if(!(p.day in this.dayOfMonth)&&Object.keys(this.dayOfMonth).length!==31&&!((this._getWeekDay(p)in this.dayOfWeek)&&Object.keys(this.dayOfWeek).length!==7)||!(this._getWeekDay(p)in this.dayOfWeek)&&Object.keys(this.dayOfWeek).length!==7&&!((p.day in this.dayOfMonth)&&Object.keys(this.dayOfMonth).length!==31)){p=p.plus({days:1}),p=p.set({hour:0,minute:0,second:0});continue}if(!(p.hour in this.hour)&&Object.keys(this.hour).length!==24){p=p.plus({hour:1}),p=p.set({minute:0,second:0});continue}if(!(p.minute in this.minute)&&Object.keys(this.minute).length!==60){p=p.plus({minute:1}),p=p.set({second:0});continue}if(p.toMillis()===x||!(p.second in this.second)&&Object.keys(this.second).length!==60){p=p.plus({second:1});continue}break}let{hour:a,minute:f}=p;p=Di.DateTime.fromFormat(`${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}:${p.second}`,"yyyy-M-d H:m:s",{zone:i});let v=Di.DateTime.fromFormat(`${p.year}-1-1 0:0:0`,"yyyy-M-d H:m:s",{zone:i});if((a!==p.hour||f!==p.minute)&&v.offset!==p.offset){while(p.minus({minute:1}).offset!==v.offset)p=p.minus({minute:1});return p}let $=p.minus({hour:1}),w=p.minus({hour:2});if(($.hour===p.hour||w.hour===$.hour)&&$>n)p=$;let J=p.minus({minute:30});if((J.minute===p.minute||$.minute===J.minute)&&J>n)p=J;return p}_wcOrAll(n){if(this._hasAll(n))return"*";let i=[];for(let o in this[n])i.push(o);return i.join(",")}_hasAll(n){let i=li.CONSTRAINTS[n],o=i[0],c=n===li.TIME_UNITS_MAP.DAY_OF_WEEK?i[1]-1:i[1];for(let p=o,x=c;p<x;p++)if(!(p in this[n]))return!1;return!0}_parse(n){var i;if(n=n.toLowerCase(),Object.keys(li.PRESETS).includes(n))n=li.PRESETS[n];n=n.replace(/[a-z]{1,3}/gi,(p)=>{if(Object.keys(li.ALIASES).includes(p))return li.ALIASES[p].toString();throw new _i.CronError(`Unknown alias: ${p}`)});let o=n.trim().split(/\s+/);if(o.length<li.TIME_UNITS_LEN-1)throw new _i.CronError("Too few fields");if(o.length>li.TIME_UNITS_LEN)throw new _i.CronError("Too many fields");let c=o.length;for(let p of li.TIME_UNITS){let x=li.TIME_UNITS.indexOf(p),m=(i=o[x-(li.TIME_UNITS_LEN-c)])!==null&&i!==void 0?i:li.PARSE_DEFAULTS[p];this._parseField(m,p)}}_parseField(n,i){let o=this[i],c,p=li.CONSTRAINTS[i],x=p[0],m=p[1];n.split(",").forEach((v)=>{let $=v.indexOf("*");if($!==-1&&$!==0)throw new _i.CronError(`Field (${v}) has an invalid wildcard expression`)}),n=n.replace(li.RE_WILDCARDS,`${x}-${m}`);let f=n.split(",");for(let v of f){let $=[...v.matchAll(li.RE_RANGE)][0];if(($===null||$===void 0?void 0:$[1])!==void 0){let[,w,J,S]=$,X=parseInt(w,10),R=J!==void 0?parseInt(J,10):void 0,K=S!==void 0,M=parseInt(S!==null&&S!==void 0?S:"1",10);if(M===0)throw new _i.CronError(`Field (${i}) has a step of zero`);if(R!==void 0&&X>R)throw new _i.CronError(`Field (${i}) has an invalid range`);if(X<x||R!==void 0&&R>m||R===void 0&&X>m)throw new _i.CronError(`Field value (${n}) is out of range`);if(X=Math.min(Math.max(x,~~Math.abs(X)),m),R!==void 0)R=Math.min(m,~~Math.abs(R));else R=K?m:X;c=X;do o[c]=!0,c+=M;while(c<=R);if(i==="dayOfWeek"){if(!o[0]&&!!o[7])o[0]=o[7];delete o[7]}}else throw new _i.CronError(`Field (${i}) cannot be parsed`)}}}RJ.CronTime=av});var WJ=C((Rp)=>{var Nm=Rp&&Rp.__awaiter||function(n,i,o,c){function p(x){return x instanceof o?x:new o(function(m){m(x)})}return new(o||(o=Promise))(function(x,m){function a($){try{v(c.next($))}catch(w){m(w)}}function f($){try{v(c.throw($))}catch(w){m(w)}}function v($){$.done?x($.value):p($.value).then(a,f)}v((c=c.apply(n,i||[])).next())})};Object.defineProperty(Rp,"__esModule",{value:!0});Rp.CronJob=void 0;var XJ=Kn("node:child_process"),fv=mv(),hm=Lm();class Mx{get isActive(){return this._isActive}get isCallbackRunning(){return this._isCallbackRunning}constructor(n,i,o,c,p,x,m,a,f,v,$){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(v),this.errorHandler=$,p!=null&&a!=null)throw new fv.ExclusiveParametersError("timeZone","utcOffset");if(p!=null)this.cronTime=new hm.CronTime(n,p,null);else if(a!=null)this.cronTime=new hm.CronTime(n,null,a);else this.cronTime=new hm.CronTime(n,p,a);if(f!=null)this.unrefTimeout=f;if(o!=null)this.onComplete=this._fnWrap(o);if(this.cronTime.realDate)this.runOnce=!0;if(this.addCallback(this._fnWrap(i)),m)this.lastExecution=new Date,this.fireOnTick();if(c)this.start()}static from(n){if(n.timeZone!=null&&n.utcOffset!=null)throw new fv.ExclusiveParametersError("timeZone","utcOffset");if(n.timeZone!=null)return new Mx(n.cronTime,n.onTick,n.onComplete,n.start,n.timeZone,n.context,n.runOnInit,n.utcOffset,n.unrefTimeout,n.waitForCompletion,n.errorHandler);else if(n.utcOffset!=null)return new Mx(n.cronTime,n.onTick,n.onComplete,n.start,null,n.context,n.runOnInit,n.utcOffset,n.unrefTimeout,n.waitForCompletion,n.errorHandler);else return new Mx(n.cronTime,n.onTick,n.onComplete,n.start,n.timeZone,n.context,n.runOnInit,n.utcOffset,n.unrefTimeout,n.waitForCompletion,n.errorHandler)}_fnWrap(n){var i,o;switch(typeof n){case"function":return n;case"string":{let[c,...p]=n.split(" ");return XJ.spawn.bind(void 0,c!==null&&c!==void 0?c:n,p,{})}case"object":return XJ.spawn.bind(void 0,n.command,(i=n.args)!==null&&i!==void 0?i:[],(o=n.options)!==null&&o!==void 0?o:{})}}addCallback(n){if(typeof n==="function")this._callbacks.push(n)}setTime(n){if(!(n instanceof hm.CronTime))throw new fv.CronError("time must be an instance of CronTime.");let i=this._isActive;if(this.stop(),this.cronTime=n,n.realDate)this.runOnce=!0;if(i)this.start()}nextDate(){return this.cronTime.sendAt()}fireOnTick(){return Nm(this,void 0,void 0,function*(){if(this.waitForCompletion&&this._isCallbackRunning)return;this._isCallbackRunning=!0;try{for(let n of this._callbacks){let i=n.call(this.context,this.onComplete);if(this.waitForCompletion)yield i}}catch(n){if(this.errorHandler!=null)this.errorHandler(n);else console.error("[Cron] error in callback",n)}finally{this._isCallbackRunning=!1}})}nextDates(n){return this.cronTime.sendAt(n!==null&&n!==void 0?n:0)}start(){if(this._isActive)return;let n=2147483647,i=this.cronTime.getTimeout(),o=0,c,p=(m)=>{if(c=Date.now(),this._timeout=setTimeout(x,m),this.unrefTimeout&&typeof this._timeout.unref==="function")this._timeout.unref()},x=()=>{let m=c+i-Date.now();if(m>0){let a=this.cronTime.getTimeout();if(a>m)a=m;o+=a}if(o){if(o>n)o-=n,i=n;else i=o,o=0;p(i)}else{if(this.lastExecution=new Date,this._isActive=!1,!this.runOnce)this.start();this.fireOnTick()}};if(i>=0){if(this._isActive=!0,i>n)o=i-n,i=n;p(i)}else this.stop()}lastDate(){return this.lastExecution}_executeOnComplete(){return Nm(this,void 0,void 0,function*(){if(typeof this.onComplete!=="function")return;try{yield this.onComplete.call(this.context)}catch(n){console.error("[Cron] error in onComplete callback:",n)}})}_waitForJobCompletion(){return Nm(this,void 0,void 0,function*(){while(this._isCallbackRunning)yield new Promise((n)=>setTimeout(n,100))})}stop(){if(this._timeout)clearTimeout(this._timeout);if(this._isActive=!1,!this.waitForCompletion){this._executeOnComplete();return}Promise.resolve().then(()=>Nm(this,void 0,void 0,function*(){yield this._waitForJobCompletion(),yield this._executeOnComplete()}))}}Rp.CronJob=Mx});var $v=C((Cm)=>{Object.defineProperty(Cm,"__esModule",{value:!0});Cm.validateCronExpression=Cm.timeout=Cm.sendAt=Cm.CronTime=Cm.CronJob=void 0;var vv=Lm(),HX=WJ();Object.defineProperty(Cm,"CronJob",{enumerable:!0,get:function(){return HX.CronJob}});var zX=Lm();Object.defineProperty(Cm,"CronTime",{enumerable:!0,get:function(){return zX.CronTime}});var QX=(n)=>new vv.CronTime(n).sendAt();Cm.sendAt=QX;var EX=(n)=>new vv.CronTime(n).getTimeout();Cm.timeout=EX;Cm.validateCronExpression=vv.CronTime.validateCronExpression});var FT=C((DD,Ov)=>{Ov.exports=AT;Ov.exports.preferredCharsets=AT;var NX=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function hX(n){var i=n.split(",");for(var o=0,c=0;o<i.length;o++){var p=CX(i[o].trim(),o);if(p)i[c++]=p}return i.length=c,i}function CX(n,i){var o=NX.exec(n);if(!o)return null;var c=o[1],p=1;if(o[2]){var x=o[2].split(";");for(var m=0;m<x.length;m++){var a=x[m].trim().split("=");if(a[0]==="q"){p=parseFloat(a[1]);break}}}return{charset:c,q:p,i}}function IX(n,i,o){var c={o:-1,q:0,s:0};for(var p=0;p<i.length;p++){var x=yX(n,i[p],o);if(x&&(c.s-x.s||c.q-x.q||c.o-x.o)<0)c=x}return c}function yX(n,i,o){var c=0;if(i.charset.toLowerCase()===n.toLowerCase())c|=1;else if(i.charset!=="*")return null;return{i:o,o:i.i,q:i.q,s:c}}function AT(n,i){var o=hX(n===void 0?"*":n||"");if(!i)return o.filter(JT).sort(wT).map(kX);var c=i.map(function p(x,m){return IX(x,o,m)});return c.filter(JT).sort(wT).map(function p(x){return i[c.indexOf(x)]})}function wT(n,i){return i.q-n.q||i.s-n.s||n.o-i.o||n.i-i.i||0}function kX(n){return n.charset}function JT(n){return n.q>0}});var WT=C((LD,Uv)=>{Uv.exports=XT;Uv.exports.preferredEncodings=XT;var ZX=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function qX(n){var i=n.split(","),o=!1,c=1;for(var p=0,x=0;p<i.length;p++){var m=sX(i[p].trim(),p);if(m)i[x++]=m,o=o||ST("identity",m),c=Math.min(c,m.q||1)}if(!o)i[x++]={encoding:"identity",q:c,i:p};return i.length=x,i}function sX(n,i){var o=ZX.exec(n);if(!o)return null;var c=o[1],p=1;if(o[2]){var x=o[2].split(";");for(var m=0;m<x.length;m++){var a=x[m].trim().split("=");if(a[0]==="q"){p=parseFloat(a[1]);break}}}return{encoding:c,q:p,i}}function PX(n,i,o){var c={o:-1,q:0,s:0};for(var p=0;p<i.length;p++){var x=ST(n,i[p],o);if(x&&(c.s-x.s||c.q-x.q||c.o-x.o)<0)c=x}return c}function ST(n,i,o){var c=0;if(i.encoding.toLowerCase()===n.toLowerCase())c|=1;else if(i.encoding!=="*")return null;return{i:o,o:i.i,q:i.q,s:c}}function XT(n,i){var o=qX(n||"");if(!i)return o.filter(RT).sort(TT).map(tX);var c=i.map(function p(x,m){return PX(x,o,m)});return c.filter(RT).sort(TT).map(function p(x){return i[c.indexOf(x)]})}function TT(n,i){return i.q-n.q||i.s-n.s||n.o-i.o||n.i-i.i||0}function tX(n){return n.encoding}function RT(n){return n.q>0}});var YT=C((ND,Vv)=>{Vv.exports=MT;Vv.exports.preferredLanguages=MT;var rX=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function dX(n){var i=n.split(",");for(var o=0,c=0;o<i.length;o++){var p=GT(i[o].trim(),o);if(p)i[c++]=p}return i.length=c,i}function GT(n,i){var o=rX.exec(n);if(!o)return null;var c=o[1],p=o[2],x=c;if(p)x+="-"+p;var m=1;if(o[3]){var a=o[3].split(";");for(var f=0;f<a.length;f++){var v=a[f].split("=");if(v[0]==="q")m=parseFloat(v[1])}}return{prefix:c,suffix:p,q:m,i,full:x}}function gX(n,i,o){var c={o:-1,q:0,s:0};for(var p=0;p<i.length;p++){var x=eX(n,i[p],o);if(x&&(c.s-x.s||c.q-x.q||c.o-x.o)<0)c=x}return c}function eX(n,i,o){var c=GT(n);if(!c)return null;var p=0;if(i.full.toLowerCase()===c.full.toLowerCase())p|=4;else if(i.prefix.toLowerCase()===c.full.toLowerCase())p|=2;else if(i.full.toLowerCase()===c.prefix.toLowerCase())p|=1;else if(i.full!=="*")return null;return{i:o,o:i.i,q:i.q,s:p}}function MT(n,i){var o=dX(n===void 0?"*":n||"");if(!i)return o.filter(lT).sort(KT).map(nW);var c=i.map(function p(x,m){return gX(x,o,m)});return c.filter(lT).sort(KT).map(function p(x){return i[c.indexOf(x)]})}function KT(n,i){return i.q-n.q||i.s-n.s||n.o-i.o||n.i-i.i||0}function nW(n){return n.full}function lT(n){return n.q>0}});var UT=C((hD,_v)=>{_v.exports=ET;_v.exports.preferredMediaTypes=ET;var iW=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function oW(n){var i=aW(n);for(var o=0,c=0;o<i.length;o++){var p=QT(i[o].trim(),o);if(p)i[c++]=p}return i.length=c,i}function QT(n,i){var o=iW.exec(n);if(!o)return null;var c=Object.create(null),p=1,x=o[2],m=o[1];if(o[3]){var a=fW(o[3]).map(mW);for(var f=0;f<a.length;f++){var v=a[f],$=v[0].toLowerCase(),w=v[1],J=w&&w[0]==='"'&&w[w.length-1]==='"'?w.substr(1,w.length-2):w;if($==="q"){p=parseFloat(J);break}c[$]=J}}return{type:m,subtype:x,params:c,q:p,i}}function cW(n,i,o){var c={o:-1,q:0,s:0};for(var p=0;p<i.length;p++){var x=pW(n,i[p],o);if(x&&(c.s-x.s||c.q-x.q||c.o-x.o)<0)c=x}return c}function pW(n,i,o){var c=QT(n),p=0;if(!c)return null;if(i.type.toLowerCase()==c.type.toLowerCase())p|=4;else if(i.type!="*")return null;if(i.subtype.toLowerCase()==c.subtype.toLowerCase())p|=2;else if(i.subtype!="*")return null;var x=Object.keys(i.params);if(x.length>0)if(x.every(function(m){return i.params[m]=="*"||(i.params[m]||"").toLowerCase()==(c.params[m]||"").toLowerCase()}))p|=1;else return null;return{i:o,o:i.i,q:i.q,s:p}}function ET(n,i){var o=oW(n===void 0?"*/*":n||"");if(!i)return o.filter(zT).sort(HT).map(xW);var c=i.map(function p(x,m){return cW(x,o,m)});return c.filter(zT).sort(HT).map(function p(x){return i[c.indexOf(x)]})}function HT(n,i){return i.q-n.q||i.s-n.s||n.o-i.o||n.i-i.i||0}function xW(n){return n.type+"/"+n.subtype}function zT(n){return n.q>0}function OT(n){var i=0,o=0;while((o=n.indexOf('"',o))!==-1)i++,o++;return i}function mW(n){var i=n.indexOf("="),o,c;if(i===-1)o=n;else o=n.substr(0,i),c=n.substr(i+1);return[o,c]}function aW(n){var i=n.split(",");for(var o=1,c=0;o<i.length;o++)if(OT(i[c])%2==0)i[++c]=i[o];else i[c]+=","+i[o];return i.length=c+1,i}function fW(n){var i=n.split(";");for(var o=1,c=0;o<i.length;o++)if(OT(i[c])%2==0)i[++c]=i[o];else i[c]+=";"+i[o];i.length=c+1;for(var o=0;o<i.length;o++)i[o]=i[o].trim();return i}});var VT=C((CD,bv)=>{/*!
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 $=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)&&$.offset!==c.offset){while(c.minus({minute:1}).offset!==$.offset)c=c.minus({minute:1});return c}let J=c.minus({hour:1}),F=c.minus({hour:2});if((J.hour===c.hour||F.hour===J.hour)&&J>i)c=J;let A=c.minus({minute:30});if((A.minute===c.minute||J.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(($)=>{let J=$.indexOf("*");if(J!==-1&&J!==0)throw new to.CronError(`Field (${$}) has an invalid wildcard expression`)}),i=i.replace(Lo.RE_WILDCARDS,`${x}-${T}`);let f=i.split(",");for(let $ of f){let J=[...$.matchAll(Lo.RE_RANGE)][0];if((J===null||J===void 0?void 0:J[1])!==void 0){let[,F,A,X]=J,Y=parseInt(F,10),R=A!==void 0?parseInt(A,10):void 0,K=X!==void 0,H=parseInt(X!==null&&X!==void 0?X:"1",10);if(H===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+=H;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=e$});var J3=a((wx)=>{var Xf=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(J){try{$(p.next(J))}catch(F){T(F)}}function f(J){try{$(p.throw(J))}catch(F){T(F)}}function $(J){J.done?x(J.value):c(J.value).then(m,f)}$((p=p.apply(i,o||[])).next())})};Object.defineProperty(wx,"__esModule",{value:!0});wx.CronJob=void 0;var $3=Hi("child_process"),iJ=r$(),Wf=wf();class CT{get isActive(){return this._isActive}get isCallbackRunning(){return this._isCallbackRunning}constructor(i,o,n,p,c,x,T,m,f,$,J){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($),this.errorHandler=J,c!=null&&m!=null)throw new iJ.ExclusiveParametersError("timeZone","utcOffset");if(c!=null)this.cronTime=new Wf.CronTime(i,c,null);else if(m!=null)this.cronTime=new Wf.CronTime(i,null,m);else this.cronTime=new Wf.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 iJ.ExclusiveParametersError("timeZone","utcOffset");if(i.timeZone!=null)return new CT(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 CT(i.cronTime,i.onTick,i.onComplete,i.start,null,i.context,i.runOnInit,i.utcOffset,i.unrefTimeout,i.waitForCompletion,i.errorHandler);else return new CT(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 $3.spawn.bind(void 0,p!==null&&p!==void 0?p:i,c,{})}case"object":return $3.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 Wf.CronTime))throw new iJ.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 Xf(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 Xf(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 Xf(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}Promise.resolve().then(()=>Xf(this,void 0,void 0,function*(){yield this._waitForJobCompletion(),yield this._executeOnComplete()}))}}wx.CronJob=CT});var nJ=a((Rf)=>{Object.defineProperty(Rf,"__esModule",{value:!0});Rf.validateCronExpression=Rf.timeout=Rf.sendAt=Rf.CronTime=Rf.CronJob=void 0;var oJ=wf(),lu=J3();Object.defineProperty(Rf,"CronJob",{enumerable:!0,get:function(){return lu.CronJob}});var qu=wf();Object.defineProperty(Rf,"CronTime",{enumerable:!0,get:function(){return qu.CronTime}});var ku=(i)=>new oJ.CronTime(i).sendAt();Rf.sendAt=ku;var hu=(i)=>new oJ.CronTime(i).getTimeout();Rf.timeout=hu;Rf.validateCronExpression=oJ.CronTime.validateCronExpression});var xW=a((Eni,HJ)=>{HJ.exports=cW;HJ.exports.preferredCharsets=cW;var cZ=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function xZ(i){var o=i.split(",");for(var n=0,p=0;n<o.length;n++){var c=TZ(o[n].trim(),n);if(c)o[p++]=c}return o.length=p,o}function TZ(i,o){var n=cZ.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 mZ(i,o,n){var p={o:-1,q:0,s:0};for(var c=0;c<o.length;c++){var x=fZ(i,o[c],n);if(x&&(p.s-x.s||p.q-x.q||p.o-x.o)<0)p=x}return p}function fZ(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=xZ(i===void 0?"*":i||"");if(!o)return n.filter(pW).sort(nW).map($Z);var p=o.map(function c(x,T){return mZ(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 $Z(i){return i.charset}function pW(i){return i.q>0}});var JW=a((Oni,UJ)=>{UJ.exports=$W;UJ.exports.preferredEncodings=$W;var JZ=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function FZ(i){var o=i.split(","),n=!1,p=1;for(var c=0,x=0;c<o.length;c++){var T=AZ(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 AZ(i,o){var n=JZ.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 vZ(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 $W(i,o){var n=FZ(i||"");if(!o)return n.filter(mW).sort(TW).map(wZ);var p=o.map(function c(x,T){return vZ(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 wZ(i){return i.encoding}function mW(i){return i.q>0}});var XW=a((_ni,zJ)=>{zJ.exports=wW;zJ.exports.preferredLanguages=wW;var XZ=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function WZ(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=XZ.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 $=m[f].split("=");if($[0]==="q")T=parseFloat($[1])}}return{prefix:p,suffix:c,q:T,i:o,full:x}}function RZ(i,o,n){var p={o:-1,q:0,s:0};for(var c=0;c<o.length;c++){var x=YZ(i,o[c],n);if(x&&(p.s-x.s||p.q-x.q||p.o-x.o)<0)p=x}return p}function YZ(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=WZ(i===void 0?"*":i||"");if(!o)return n.filter(AW).sort(FW).map(GZ);var p=o.map(function c(x,T){return RZ(x,n,T)});return p.filter(AW).sort(FW).map(function c(x){return o[p.indexOf(x)]})}function FW(i,o){return o.q-i.q||o.s-i.s||i.o-o.o||i.i-o.i||0}function GZ(i){return i.full}function AW(i){return i.q>0}});var HW=a((yni,uJ)=>{uJ.exports=GW;uJ.exports.preferredMediaTypes=GW;var KZ=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function HZ(i){var o=MZ(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=KZ.exec(i);if(!n)return null;var p=Object.create(null),c=1,x=n[2],T=n[1];if(n[3]){var m=QZ(n[3]).map(ZZ);for(var f=0;f<m.length;f++){var $=m[f],J=$[0].toLowerCase(),F=$[1],A=F&&F[0]==='"'&&F[F.length-1]==='"'?F.substr(1,F.length-2):F;if(J==="q"){c=parseFloat(A);break}p[J]=A}}return{type:T,subtype:x,params:p,q:c,i:o}}function UZ(i,o,n){var p={o:-1,q:0,s:0};for(var c=0;c<o.length;c++){var x=zZ(i,o[c],n);if(x&&(p.s-x.s||p.q-x.q||p.o-x.o)<0)p=x}return p}function zZ(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=HZ(i===void 0?"*/*":i||"");if(!o)return n.filter(RW).sort(WW).map(uZ);var p=o.map(function c(x,T){return UZ(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 uZ(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 ZZ(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 MZ(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 QZ(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=a((Lni,ZJ)=>{/*!
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 vW=FT(),$W=WT(),wW=YT(),JW=UT();bv.exports=Hn;bv.exports.Negotiator=Hn;function Hn(n){if(!(this instanceof Hn))return new Hn(n);this.request=n}Hn.prototype.charset=function n(i){var o=this.charsets(i);return o&&o[0]};Hn.prototype.charsets=function n(i){return vW(this.request.headers["accept-charset"],i)};Hn.prototype.encoding=function n(i){var o=this.encodings(i);return o&&o[0]};Hn.prototype.encodings=function n(i){return $W(this.request.headers["accept-encoding"],i)};Hn.prototype.language=function n(i){var o=this.languages(i);return o&&o[0]};Hn.prototype.languages=function n(i){return wW(this.request.headers["accept-language"],i)};Hn.prototype.mediaType=function n(i){var o=this.mediaTypes(i);return o&&o[0]};Hn.prototype.mediaTypes=function n(i){return JW(this.request.headers.accept,i)};Hn.prototype.preferredCharset=Hn.prototype.charset;Hn.prototype.preferredCharsets=Hn.prototype.charsets;Hn.prototype.preferredEncoding=Hn.prototype.encoding;Hn.prototype.preferredEncodings=Hn.prototype.encodings;Hn.prototype.preferredLanguage=Hn.prototype.language;Hn.prototype.preferredLanguages=Hn.prototype.languages;Hn.prototype.preferredMediaType=Hn.prototype.mediaType;Hn.prototype.preferredMediaTypes=Hn.prototype.mediaTypes});var _T=C((ID,AW)=>{AW.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 uT=C((yD,bT)=>{/*!
11
+ */var SZ=xW(),VZ=JW(),EZ=XW(),OZ=HW();ZJ.exports=Qi;ZJ.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 SZ(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 EZ(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 OZ(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=a((Cni,_Z)=>{_Z.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=a((Dni,uW)=>{/*!
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
- */bT.exports=_T()});var NT=C((KW)=>{/*!
16
+ */uW.exports=zW()});var EW=a((NZ)=>{/*!
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 fa=uT(),FW=Kn("node:path").extname,BT=/^\s*([^;\s]*)(?:;|\s|$)/,TW=/^text\//i;KW.charset=jT;KW.charsets={lookup:jT};KW.contentType=RW;KW.extension=SW;KW.extensions=Object.create(null);KW.lookup=XW;KW.types=Object.create(null);WW(KW.extensions,KW.types);function jT(n){if(!n||typeof n!=="string")return!1;var i=BT.exec(n),o=i&&fa[i[1].toLowerCase()];if(o&&o.charset)return o.charset;if(i&&TW.test(i[1]))return"UTF-8";return!1}function RW(n){if(!n||typeof n!=="string")return!1;var i=n.indexOf("/")===-1?KW.lookup(n):n;if(!i)return!1;if(i.indexOf("charset")===-1){var o=KW.charset(i);if(o)i+="; charset="+o.toLowerCase()}return i}function SW(n){if(!n||typeof n!=="string")return!1;var i=BT.exec(n),o=i&&KW.extensions[i[1].toLowerCase()];if(!o||!o.length)return!1;return o[0]}function XW(n){if(!n||typeof n!=="string")return!1;var i=FW("x."+n).toLowerCase().substr(1);if(!i)return!1;return KW.types[i]||!1}function WW(n,i){var o=["nginx","apache",void 0,"iana"];Object.keys(fa).forEach(function c(p){var x=fa[p],m=x.extensions;if(!m||!m.length)return;n[p]=m;for(var a=0;a<m.length;a++){var f=m[a];if(i[f]){var v=o.indexOf(fa[i[f]].source),$=o.indexOf(x.source);if(i[f]!=="application/octet-stream"&&(v>$||v===$&&i[f].substr(0,12)==="application/"))continue}i[f]=p}})}});var va=C((ZD,hT)=>{/*!
21
+ */var If=ZW(),yZ=Hi("path").extname,MW=/^\s*([^;\s]*)(?:;|\s|$)/,LZ=/^text\//i;NZ.charset=QW;NZ.charsets={lookup:QW};NZ.contentType=CZ;NZ.extension=DZ;NZ.extensions=Object.create(null);NZ.lookup=BZ;NZ.types=Object.create(null);IZ(NZ.extensions,NZ.types);function QW(i){if(!i||typeof i!=="string")return!1;var o=MW.exec(i),n=o&&If[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?NZ.lookup(i):i;if(!o)return!1;if(o.indexOf("charset")===-1){var n=NZ.charset(o);if(n)o+="; charset="+n.toLowerCase()}return o}function DZ(i){if(!i||typeof i!=="string")return!1;var o=MW.exec(i),n=o&&NZ.extensions[o[1].toLowerCase()];if(!n||!n.length)return!1;return n[0]}function BZ(i){if(!i||typeof i!=="string")return!1;var o=yZ("x."+i).toLowerCase().substr(1);if(!o)return!1;return NZ.types[o]||!1}function IZ(i,o){var n=["nginx","apache",void 0,"iana"];Object.keys(If).forEach(function p(c){var x=If[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 $=n.indexOf(If[o[f]].source),J=n.indexOf(x.source);if(o[f]!=="application/octet-stream"&&($>J||$===J&&o[f].substr(0,12)==="application/"))continue}o[f]=c}})}});var Nf=a((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 YW=VT(),HW=NT();hT.exports=hi;function hi(n){if(!(this instanceof hi))return new hi(n);this.headers=n.headers,this.negotiator=new YW(n)}hi.prototype.type=hi.prototype.types=function(n){var i=n;if(i&&!Array.isArray(i)){i=new Array(arguments.length);for(var o=0;o<i.length;o++)i[o]=arguments[o]}if(!i||i.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return i[0];var c=i.map(zW),p=this.negotiator.mediaTypes(c.filter(QW)),x=p[0];return x?i[c.indexOf(x)]:!1};hi.prototype.encoding=hi.prototype.encodings=function(n){var i=n;if(i&&!Array.isArray(i)){i=new Array(arguments.length);for(var o=0;o<i.length;o++)i[o]=arguments[o]}if(!i||i.length===0)return this.negotiator.encodings();return this.negotiator.encodings(i)[0]||!1};hi.prototype.charset=hi.prototype.charsets=function(n){var i=n;if(i&&!Array.isArray(i)){i=new Array(arguments.length);for(var o=0;o<i.length;o++)i[o]=arguments[o]}if(!i||i.length===0)return this.negotiator.charsets();return this.negotiator.charsets(i)[0]||!1};hi.prototype.lang=hi.prototype.langs=hi.prototype.language=hi.prototype.languages=function(n){var i=n;if(i&&!Array.isArray(i)){i=new Array(arguments.length);for(var o=0;o<i.length;o++)i[o]=arguments[o]}if(!i||i.length===0)return this.negotiator.languages();return this.negotiator.languages(i)[0]||!1};function zW(n){return n.indexOf("/")===-1?HW.lookup(n):n}function QW(n){return typeof n==="string"}});var Dv=C((CT,IT)=>{/*!
26
+ */var PZ=UW(),lZ=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(qZ),c=this.negotiator.mediaTypes(p.filter(kZ)),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 qZ(i){return i.indexOf("/")===-1?lZ.lookup(i):i}function kZ(i){return typeof i==="string"}});var VJ=a((_W,yW)=>{/*!
27
27
  * base64id v0.1.0
28
- */var bx=Kn("node:crypto"),jv=function(){};jv.prototype.getRandomBytes=function(n){var i=4096,o=this;if(n=n||12,n>i)return bx.randomBytes(n);var c=parseInt(i/n),p=parseInt(c*0.85);if(!p)return bx.randomBytes(n);if(this.bytesBufferIndex==null)this.bytesBufferIndex=-1;if(this.bytesBufferIndex==c)this.bytesBuffer=null,this.bytesBufferIndex=-1;if(this.bytesBufferIndex==-1||this.bytesBufferIndex>p){if(!this.isGeneratingBytes)this.isGeneratingBytes=!0,bx.randomBytes(i,function(m,a){o.bytesBuffer=a,o.bytesBufferIndex=0,o.isGeneratingBytes=!1});if(this.bytesBufferIndex==-1)return bx.randomBytes(n)}var x=this.bytesBuffer.slice(n*this.bytesBufferIndex,n*(this.bytesBufferIndex+1));return this.bytesBufferIndex++,x};jv.prototype.generateId=function(){var n=Buffer.alloc(15);if(!n.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,n.writeInt32BE(this.sequenceNumber,11),bx.randomBytes)this.getRandomBytes(12).copy(n);else[0,4,8].forEach(function(i){n.writeInt32BE(Math.random()*Math.pow(2,32)|0,i)});return n.toString("base64").replace(/\//g,"_").replace(/\+/g,"-")};CT=IT.exports=new jv});var $a=C((kT)=>{Object.defineProperty(kT,"__esModule",{value:!0});kT.ERROR_PACKET=kT.PACKET_TYPES_REVERSE=kT.PACKET_TYPES=void 0;var Ho=Object.create(null);kT.PACKET_TYPES=Ho;Ho.open="0";Ho.close="1";Ho.ping="2";Ho.pong="3";Ho.message="4";Ho.upgrade="5";Ho.noop="6";var yT=Object.create(null);kT.PACKET_TYPES_REVERSE=yT;Object.keys(Ho).forEach((n)=>{yT[Ho[n]]=n});var EW={type:"error",data:"parser error"};kT.ERROR_PACKET=EW});var PT=C((sT)=>{Object.defineProperty(sT,"__esModule",{value:!0});sT.encodePacket=void 0;sT.encodePacketToBinary=bW;var VW=$a(),_W=({type:n,data:i},o,c)=>{if(i instanceof ArrayBuffer||ArrayBuffer.isView(i))return c(o?i:"b"+qT(i,!0).toString("base64"));return c(VW.PACKET_TYPES[n]+(i||""))};sT.encodePacket=_W;var qT=(n,i)=>{if(Buffer.isBuffer(n)||n instanceof Uint8Array&&!i)return n;else if(n instanceof ArrayBuffer)return Buffer.from(n);else return Buffer.from(n.buffer,n.byteOffset,n.byteLength)},Lv;function bW(n,i){if(n.data instanceof ArrayBuffer||ArrayBuffer.isView(n.data))return i(qT(n.data,!1));sT.encodePacket(n,!0,(o)=>{if(!Lv)Lv=new TextEncoder;i(Lv.encode(o))})}});var gT=C((rT)=>{Object.defineProperty(rT,"__esModule",{value:!0});rT.decodePacket=void 0;var wa=$a(),BW=(n,i)=>{if(typeof n!=="string")return{type:"message",data:tT(n,i)};let o=n.charAt(0);if(o==="b"){let c=Buffer.from(n.substring(1),"base64");return{type:"message",data:tT(c,i)}}if(!wa.PACKET_TYPES_REVERSE[o])return wa.ERROR_PACKET;return n.length>1?{type:wa.PACKET_TYPES_REVERSE[o],data:n.substring(1)}:{type:wa.PACKET_TYPES_REVERSE[o]}};rT.decodePacket=BW;var tT=(n,i)=>{switch(i){case"arraybuffer":if(n instanceof ArrayBuffer)return n;else if(Buffer.isBuffer(n))return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength);else return n.buffer;case"nodebuffer":default:if(Buffer.isBuffer(n))return n;else return Buffer.from(n)}}});var ux=C((Fa)=>{Object.defineProperty(Fa,"__esModule",{value:!0});Fa.decodePayload=Fa.decodePacket=Fa.encodePayload=Fa.encodePacket=Fa.protocol=void 0;Fa.createPacketEncoderStream=LW;Fa.createPacketDecoderStream=NW;var Cv=PT();Object.defineProperty(Fa,"encodePacket",{enumerable:!0,get:function(){return Cv.encodePacket}});var Iv=gT();Object.defineProperty(Fa,"decodePacket",{enumerable:!0,get:function(){return Iv.decodePacket}});var eT=$a(),n4=String.fromCharCode(30),jW=(n,i)=>{let o=n.length,c=new Array(o),p=0;n.forEach((x,m)=>{Cv.encodePacket(x,!1,(a)=>{if(c[m]=a,++p===o)i(c.join(n4))})})};Fa.encodePayload=jW;var DW=(n,i)=>{let o=n.split(n4),c=[];for(let p=0;p<o.length;p++){let x=Iv.decodePacket(o[p],i);if(c.push(x),x.type==="error")break}return c};Fa.decodePayload=DW;function LW(){return new TransformStream({transform(n,i){Cv.encodePacketToBinary(n,(o)=>{let c=o.length,p;if(c<126)p=new Uint8Array(1),new DataView(p.buffer).setUint8(0,c);else if(c<65536){p=new Uint8Array(3);let x=new DataView(p.buffer);x.setUint8(0,126),x.setUint16(1,c)}else{p=new Uint8Array(9);let x=new DataView(p.buffer);x.setUint8(0,127),x.setBigUint64(1,BigInt(c))}if(n.data&&typeof n.data!=="string")p[0]|=128;i.enqueue(p),i.enqueue(o)})}})}var hv;function Ja(n){return n.reduce((i,o)=>i+o.length,0)}function Aa(n,i){if(n[0].length===i)return n.shift();let o=new Uint8Array(i),c=0;for(let p=0;p<i;p++)if(o[p]=n[0][c++],c===n[0].length)n.shift(),c=0;if(n.length&&c<n[0].length)n[0]=n[0].slice(c);return o}function NW(n,i){if(!hv)hv=new TextDecoder;let o=[],c=0,p=-1,x=!1;return new TransformStream({transform(m,a){o.push(m);while(!0){if(c===0){if(Ja(o)<1)break;let f=Aa(o,1);if(x=(f[0]&128)===128,p=f[0]&127,p<126)c=3;else if(p===126)c=1;else c=2}else if(c===1){if(Ja(o)<2)break;let f=Aa(o,2);p=new DataView(f.buffer,f.byteOffset,f.length).getUint16(0),c=3}else if(c===2){if(Ja(o)<8)break;let f=Aa(o,8),v=new DataView(f.buffer,f.byteOffset,f.length),$=v.getUint32(0);if($>Math.pow(2,21)-1){a.enqueue(eT.ERROR_PACKET);break}p=$*Math.pow(2,32)+v.getUint32(4),c=3}else{if(Ja(o)<p)break;let f=Aa(o,p);a.enqueue(Iv.decodePacket(x?f:hv.decode(f),i)),c=0}if(p===0||p>n){a.enqueue(eT.ERROR_PACKET);break}}}})}Fa.protocol=4});var x4=C((gD,p4)=>{/*! https://mths.be/utf8js v2.1.2 by @mathias */var oc=String.fromCharCode;function o4(n){var i=[],o=0,c=n.length,p,x;while(o<c)if(p=n.charCodeAt(o++),p>=55296&&p<=56319&&o<c)if(x=n.charCodeAt(o++),(x&64512)==56320)i.push(((p&1023)<<10)+(x&1023)+65536);else i.push(p),o--;else i.push(p);return i}function kW(n){var i=n.length,o=-1,c,p="";while(++o<i){if(c=n[o],c>65535)c-=65536,p+=oc(c>>>10&1023|55296),c=56320|c&1023;p+=oc(c)}return p}function c4(n,i){if(n>=55296&&n<=57343){if(i)throw Error("Lone surrogate U+"+n.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function yv(n,i){return oc(n>>i&63|128)}function ZW(n,i){if((n&4294967168)==0)return oc(n);var o="";if((n&4294965248)==0)o=oc(n>>6&31|192);else if((n&4294901760)==0){if(!c4(n,i))n=65533;o=oc(n>>12&15|224),o+=yv(n,6)}else if((n&4292870144)==0)o=oc(n>>18&7|240),o+=yv(n,12),o+=yv(n,6);return o+=oc(n&63|128),o}function qW(n,i){i=i||{};var o=i.strict!==!1,c=o4(n),p=c.length,x=-1,m,a="";while(++x<p)m=c[x],a+=ZW(m,o);return a}function Xp(){if(cc>=Ra)throw Error("Invalid byte index");var n=Ta[cc]&255;if(cc++,(n&192)==128)return n&63;throw Error("Invalid continuation byte")}function sW(n){var i,o,c,p,x;if(cc>Ra)throw Error("Invalid byte index");if(cc==Ra)return!1;if(i=Ta[cc]&255,cc++,(i&128)==0)return i;if((i&224)==192)if(o=Xp(),x=(i&31)<<6|o,x>=128)return x;else throw Error("Invalid continuation byte");if((i&240)==224)if(o=Xp(),c=Xp(),x=(i&15)<<12|o<<6|c,x>=2048)return c4(x,n)?x:65533;else throw Error("Invalid continuation byte");if((i&248)==240){if(o=Xp(),c=Xp(),p=Xp(),x=(i&7)<<18|o<<12|c<<6|p,x>=65536&&x<=1114111)return x}throw Error("Invalid UTF-8 detected")}var Ta,Ra,cc;function PW(n,i){i=i||{};var o=i.strict!==!1;Ta=o4(n),Ra=Ta.length,cc=0;var c=[],p;while((p=sW(o))!==!1)c.push(p);return kW(c)}p4.exports={version:"2.1.2",encode:qW,decode:PW}});var F4=C((A4)=>{Object.defineProperty(A4,"__esModule",{value:!0});A4.packets=A4.protocol=void 0;A4.encodePacket=kv;A4.encodeBase64Packet=f4;A4.decodePacket=Zv;A4.decodeBase64Packet=v4;A4.encodePayload=gW;A4.decodePayload=nK;A4.encodePayloadAsBinary=w4;A4.decodePayloadAsBinary=J4;var a4=x4();A4.protocol=3;var tW=(n)=>{for(let i of n)if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return!0;return!1};A4.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6};var Wp=Object.keys(A4.packets),$o={type:"error",data:"parser error"},rW=Buffer.concat([]);function kv(n,i,o,c){if(typeof i==="function")c=i,i=null;if(typeof o==="function")c=o,o=null;if(Buffer.isBuffer(n.data))return m4(n,i,c);else if(n.data&&(n.data.buffer||n.data)instanceof ArrayBuffer)return m4({type:n.type,data:qv(n.data)},i,c);var p=A4.packets[n.type];if(n.data!==void 0)p+=o?a4.encode(String(n.data),{strict:!1}):String(n.data);return c(""+p)}function m4(n,i,o){if(!i)return f4(n,o);var c=n.data,p=Buffer.allocUnsafe(1);return p[0]=A4.packets[n.type],o(Buffer.concat([p,c]))}function f4(n,i){var o=Buffer.isBuffer(n.data)?n.data:qv(n.data),c="b"+A4.packets[n.type];return c+=o.toString("base64"),i(c)}function Zv(n,i,o){if(n===void 0)return $o;var c;if(typeof n==="string"){if(c=n.charAt(0),c==="b")return v4(n.slice(1),i);if(o){if(n=dW(n),n===!1)return $o}if(Number(c)!=c||!Wp[c])return $o;if(n.length>1)return{type:Wp[c],data:n.slice(1)};else return{type:Wp[c]}}if(i==="arraybuffer"){var p=new Uint8Array(n);return c=p[0],{type:Wp[c],data:p.buffer.slice(1)}}if(n instanceof ArrayBuffer)n=qv(n);return c=n[0],{type:Wp[c],data:n.slice(1)}}function dW(n){try{n=a4.decode(n,{strict:!1})}catch(i){return!1}return n}function v4(n,i){var o=Wp[n.charAt(0)],c=Buffer.from(n.slice(1),"base64");if(i==="arraybuffer"){var p=new Uint8Array(c.length);for(var x=0;x<p.length;x++)p[x]=c[x];c=p.buffer}return{type:o,data:c}}function gW(n,i,o){if(typeof i==="function")o=i,i=null;if(i&&tW(n))return w4(n,o);if(!n.length)return o("0:");function c(p,x){kv(p,i,!1,function(m){x(null,eW(m))})}$4(n,c,function(p,x){return o(x.join(""))})}function eW(n){return n.length+":"+n}function $4(n,i,o){let c=new Array(n.length),p=0;for(let x=0;x<n.length;x++)i(n[x],(m,a)=>{if(c[x]=a,++p===n.length)o(null,c)})}function nK(n,i,o){if(typeof n!=="string")return J4(n,i,o);if(typeof i==="function")o=i,i=null;if(n==="")return o($o,0,1);var c="",p,x,m;for(var a=0,f=n.length;a<f;a++){var v=n.charAt(a);if(v!==":"){c+=v;continue}if(c===""||c!=(p=Number(c)))return o($o,0,1);if(x=n.slice(a+1,a+1+p),c!=x.length)return o($o,0,1);if(x.length){if(m=Zv(x,i,!1),$o.type===m.type&&$o.data===m.data)return o($o,0,1);var $=o(m,a+p,f);if($===!1)return}a+=p,c=""}if(c!=="")return o($o,0,1)}function iK(n){var i="";for(var o=0,c=n.length;o<c;o++)i+=String.fromCharCode(n[o]);return i}function oK(n){var i=Buffer.allocUnsafe(n.length);for(var o=0,c=n.length;o<c;o++)i.writeUInt8(n.charCodeAt(o),o);return i}function qv(n){var i=n.byteLength||n.length,o=n.byteOffset||0;return Buffer.from(n.buffer||n,o,i)}function w4(n,i){if(!n.length)return i(rW);$4(n,cK,function(o,c){return i(Buffer.concat(c))})}function cK(n,i){function o(c){var p=""+c.length,x;if(typeof c==="string"){x=Buffer.allocUnsafe(p.length+2),x[0]=0;for(var m=0;m<p.length;m++)x[m+1]=parseInt(p[m],10);return x[x.length-1]=255,i(null,Buffer.concat([x,oK(c)]))}x=Buffer.allocUnsafe(p.length+2),x[0]=1;for(var m=0;m<p.length;m++)x[m+1]=parseInt(p[m],10);x[x.length-1]=255,i(null,Buffer.concat([x,c]))}kv(n,!0,!0,o)}function J4(n,i,o){if(typeof i==="function")o=i,i=null;var c=n,p=[],x;while(c.length>0){var m="",a=c[0]===0;for(x=1;;x++){if(c[x]===255)break;if(m.length>310)return o($o,0,1);m+=""+c[x]}c=c.slice(m.length+1);var f=parseInt(m,10),v=c.slice(1,f+1);if(a)v=iK(v);p.push(v),c=c.slice(f+1)}var $=p.length;for(x=0;x<$;x++){var w=p[x];o(Zv(w,i,!0),x,$)}}});var R4=C((nL,T4)=>{var lp=1000,Gp=lp*60,Mp=Gp*60,Uc=Mp*24,AK=Uc*7,FK=Uc*365.25;T4.exports=function(n,i){i=i||{};var o=typeof n;if(o==="string"&&n.length>0)return TK(n);else if(o==="number"&&isFinite(n))return i.long?SK(n):RK(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))};function TK(n){if(n=String(n),n.length>100)return;var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(n);if(!i)return;var o=parseFloat(i[1]),c=(i[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return o*FK;case"weeks":case"week":case"w":return o*AK;case"days":case"day":case"d":return o*Uc;case"hours":case"hour":case"hrs":case"hr":case"h":return o*Mp;case"minutes":case"minute":case"mins":case"min":case"m":return o*Gp;case"seconds":case"second":case"secs":case"sec":case"s":return o*lp;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}function RK(n){var i=Math.abs(n);if(i>=Uc)return Math.round(n/Uc)+"d";if(i>=Mp)return Math.round(n/Mp)+"h";if(i>=Gp)return Math.round(n/Gp)+"m";if(i>=lp)return Math.round(n/lp)+"s";return n+"ms"}function SK(n){var i=Math.abs(n);if(i>=Uc)return Sa(n,i,Uc,"day");if(i>=Mp)return Sa(n,i,Mp,"hour");if(i>=Gp)return Sa(n,i,Gp,"minute");if(i>=lp)return Sa(n,i,lp,"second");return n+" ms"}function Sa(n,i,o,c){var p=i>=o*1.5;return Math.round(n/o)+" "+c+(p?"s":"")}});var sv=C((iL,S4)=>{function XK(n){o.debug=o,o.default=o,o.coerce=f,o.disable=x,o.enable=p,o.enabled=m,o.humanize=R4(),o.destroy=v,Object.keys(n).forEach(($)=>{o[$]=n[$]}),o.names=[],o.skips=[],o.formatters={};function i($){let w=0;for(let J=0;J<$.length;J++)w=(w<<5)-w+$.charCodeAt(J),w|=0;return o.colors[Math.abs(w)%o.colors.length]}o.selectColor=i;function o($){let w,J=null,S,X;function R(...K){if(!R.enabled)return;let M=R,Y=Number(new Date),I=Y-(w||Y);if(M.diff=I,M.prev=w,M.curr=Y,w=Y,K[0]=o.coerce(K[0]),typeof K[0]!=="string")K.unshift("%O");let G=0;K[0]=K[0].replace(/%([a-zA-Z%])/g,(E,Q)=>{if(E==="%%")return"%";G++;let b=o.formatters[Q];if(typeof b==="function"){let y=K[G];E=b.call(M,y),K.splice(G,1),G--}return E}),o.formatArgs.call(M,K),(M.log||o.log).apply(M,K)}if(R.namespace=$,R.useColors=o.useColors(),R.color=o.selectColor($),R.extend=c,R.destroy=o.destroy,Object.defineProperty(R,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(J!==null)return J;if(S!==o.namespaces)S=o.namespaces,X=o.enabled($);return X},set:(K)=>{J=K}}),typeof o.init==="function")o.init(R);return R}function c($,w){let J=o(this.namespace+(typeof w==="undefined"?":":w)+$);return J.log=this.log,J}function p($){o.save($),o.namespaces=$,o.names=[],o.skips=[];let w,J=(typeof $==="string"?$:"").split(/[\s,]+/),S=J.length;for(w=0;w<S;w++){if(!J[w])continue;if($=J[w].replace(/\*/g,".*?"),$[0]==="-")o.skips.push(new RegExp("^"+$.slice(1)+"$"));else o.names.push(new RegExp("^"+$+"$"))}}function x(){let $=[...o.names.map(a),...o.skips.map(a).map((w)=>"-"+w)].join(",");return o.enable(""),$}function m($){if($[$.length-1]==="*")return!0;let w,J;for(w=0,J=o.skips.length;w<J;w++)if(o.skips[w].test($))return!1;for(w=0,J=o.names.length;w<J;w++)if(o.names[w].test($))return!0;return!1}function a($){return $.toString().substring(2,$.toString().length-2).replace(/\.\*\?$/,"*")}function f($){if($ instanceof Error)return $.stack||$.message;return $}function v(){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 o.enable(o.load()),o}S4.exports=XK});var W4=C((X4,Wa)=>{X4.formatArgs=KK;X4.save=lK;X4.load=GK;X4.useColors=WK;X4.storage=MK();X4.destroy=(()=>{let n=!1;return()=>{if(!n)n=!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`.")}})();X4.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 WK(){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 n;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&&(n=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(n[1],10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function KK(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+Wa.exports.humanize(this.diff),!this.useColors)return;let i="color: "+this.color;n.splice(1,0,i,"color: inherit");let o=0,c=0;n[0].replace(/%[a-zA-Z%]/g,(p)=>{if(p==="%%")return;if(o++,p==="%c")c=o}),n.splice(c,0,i)}X4.log=console.debug||console.log||(()=>{});function lK(n){try{if(n)X4.storage.setItem("debug",n);else X4.storage.removeItem("debug")}catch(i){}}function GK(){let n;try{n=X4.storage.getItem("debug")}catch(i){}if(!n&&typeof process!=="undefined"&&"env"in process)n=process.env.DEBUG;return n}function MK(){try{return localStorage}catch(n){}}Wa.exports=sv()(X4);var{formatters:YK}=Wa.exports;YK.j=function(n){try{return JSON.stringify(n)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}}});var l4=C((cL,K4)=>{K4.exports=(n,i=process.argv)=>{let o=n.startsWith("-")?"":n.length===1?"-":"--",c=i.indexOf(o+n),p=i.indexOf("--");return c!==-1&&(p===-1||c<p)}});var Y4=C((pL,M4)=>{var _K=Kn("node:os"),G4=Kn("node:tty"),gi=l4(),{env:ai}=process,Ka;if(gi("no-color")||gi("no-colors")||gi("color=false")||gi("color=never"))Ka=0;else if(gi("color")||gi("colors")||gi("color=true")||gi("color=always"))Ka=1;function bK(){if("FORCE_COLOR"in ai){if(ai.FORCE_COLOR==="true")return 1;if(ai.FORCE_COLOR==="false")return 0;return ai.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ai.FORCE_COLOR,10),3)}}function uK(n){if(n===0)return!1;return{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function BK(n,{streamIsTTY:i,sniffFlags:o=!0}={}){let c=bK();if(c!==void 0)Ka=c;let p=o?Ka:c;if(p===0)return 0;if(o){if(gi("color=16m")||gi("color=full")||gi("color=truecolor"))return 3;if(gi("color=256"))return 2}if(n&&!i&&p===void 0)return 0;let x=p||0;if(ai.TERM==="dumb")return x;if(process.platform==="win32"){let m=_K.release().split(".");if(Number(m[0])>=10&&Number(m[2])>=10586)return Number(m[2])>=14931?3:2;return 1}if("CI"in ai){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((m)=>(m in ai))||ai.CI_NAME==="codeship")return 1;return x}if("TEAMCITY_VERSION"in ai)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ai.TEAMCITY_VERSION)?1:0;if(ai.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ai){let m=Number.parseInt((ai.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ai.TERM_PROGRAM){case"iTerm.app":return m>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(ai.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ai.TERM))return 1;if("COLORTERM"in ai)return 1;return x}function Pv(n,i={}){let o=BK(n,{streamIsTTY:n&&n.isTTY,...i});return uK(o)}M4.exports={supportsColor:Pv,stdout:Pv({isTTY:G4.isatty(1)}),stderr:Pv({isTTY:G4.isatty(2)})}});var E4=C((z4,Ga)=>{var jK=Kn("node:tty"),la=Kn("node:util");z4.init=yK;z4.log=hK;z4.formatArgs=LK;z4.save=CK;z4.load=IK;z4.useColors=DK;z4.destroy=la.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");z4.colors=[6,2,3,4,5,1];try{let n=Y4();if(n&&(n.stderr||n).level>=2)z4.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(n){}z4.inspectOpts=Object.keys(process.env).filter((n)=>{return/^debug_/i.test(n)}).reduce((n,i)=>{let o=i.substring(6).toLowerCase().replace(/_([a-z])/g,(p,x)=>{return x.toUpperCase()}),c=process.env[i];if(/^(yes|on|true|enabled)$/i.test(c))c=!0;else if(/^(no|off|false|disabled)$/i.test(c))c=!1;else if(c==="null")c=null;else c=Number(c);return n[o]=c,n},{});function DK(){return"colors"in z4.inspectOpts?Boolean(z4.inspectOpts.colors):jK.isatty(process.stderr.fd)}function LK(n){let{namespace:i,useColors:o}=this;if(o){let c=this.color,p="\x1B[3"+(c<8?c:"8;5;"+c),x=` ${p};1m${i} \x1B[0m`;n[0]=x+n[0].split(`
28
+ */var qT=Hi("crypto"),SJ=function(){};SJ.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};SJ.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=yW.exports=new SJ});var bf=a((CW)=>{Object.defineProperty(CW,"__esModule",{value:!0});CW.ERROR_PACKET=CW.PACKET_TYPES_REVERSE=CW.PACKET_TYPES=void 0;var rn=Object.create(null);CW.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 LW=Object.create(null);CW.PACKET_TYPES_REVERSE=LW;Object.keys(rn).forEach((i)=>{LW[rn[i]]=i});var hZ={type:"error",data:"parser error"};CW.ERROR_PACKET=hZ});var NW=a((IW)=>{Object.defineProperty(IW,"__esModule",{value:!0});IW.encodePacket=void 0;IW.encodePacketToBinary=rZ;var tZ=bf(),dZ=({type:i,data:o},n,p)=>{if(o instanceof ArrayBuffer||ArrayBuffer.isView(o))return p(n?o:"b"+BW(o,!0).toString("base64"));return p(tZ.PACKET_TYPES[i]+(o||""))};IW.encodePacket=dZ;var BW=(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)},EJ;function rZ(i,o){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return o(BW(i.data,!1));IW.encodePacket(i,!0,(n)=>{if(!EJ)EJ=new TextEncoder;o(EJ.encode(n))})}});var PW=a((jW)=>{Object.defineProperty(jW,"__esModule",{value:!0});jW.decodePacket=void 0;var jf=bf(),iM=(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(!jf.PACKET_TYPES_REVERSE[n])return jf.ERROR_PACKET;return i.length>1?{type:jf.PACKET_TYPES_REVERSE[n],data:i.substring(1)}:{type:jf.PACKET_TYPES_REVERSE[n]}};jW.decodePacket=iM;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=a((lf)=>{Object.defineProperty(lf,"__esModule",{value:!0});lf.decodePayload=lf.decodePacket=lf.encodePayload=lf.encodePacket=lf.protocol=void 0;lf.createPacketEncoderStream=pM;lf.createPacketDecoderStream=cM;var yJ=NW();Object.defineProperty(lf,"encodePacket",{enumerable:!0,get:function(){return yJ.encodePacket}});var LJ=PW();Object.defineProperty(lf,"decodePacket",{enumerable:!0,get:function(){return LJ.decodePacket}});var lW=bf(),qW=String.fromCharCode(30),oM=(i,o)=>{let n=i.length,p=new Array(n),c=0;i.forEach((x,T)=>{yJ.encodePacket(x,!1,(m)=>{if(p[T]=m,++c===n)o(p.join(qW))})})};lf.encodePayload=oM;var nM=(i,o)=>{let n=i.split(qW),p=[];for(let c=0;c<n.length;c++){let x=LJ.decodePacket(n[c],o);if(p.push(x),x.type==="error")break}return p};lf.decodePayload=nM;function pM(){return new TransformStream({transform(i,o){yJ.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 _J;function af(i){return i.reduce((o,n)=>o+n.length,0)}function Pf(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 cM(i,o){if(!_J)_J=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(af(n)<1)break;let f=Pf(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(af(n)<2)break;let f=Pf(n,2);c=new DataView(f.buffer,f.byteOffset,f.length).getUint16(0),p=3}else if(p===2){if(af(n)<8)break;let f=Pf(n,8),$=new DataView(f.buffer,f.byteOffset,f.length),J=$.getUint32(0);if(J>Math.pow(2,21)-1){m.enqueue(lW.ERROR_PACKET);break}c=J*Math.pow(2,32)+$.getUint32(4),p=3}else{if(af(n)<c)break;let f=Pf(n,c);m.enqueue(LJ.decodePacket(x?f:_J.decode(f),o)),p=0}if(c===0||c>i){m.enqueue(lW.ERROR_PACKET);break}}}})}lf.protocol=4});var tW=a((qni,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 $M(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 CJ(i,o){return jp(i>>o&63|128)}function JM(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+=CJ(i,6)}else if((i&4292870144)==0)n=jp(i>>18&7|240),n+=CJ(i,12),n+=CJ(i,6);return n+=jp(i&63|128),n}function FM(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+=JM(T,n);return m}function Wx(){if(ap>=kf)throw Error("Invalid byte index");var i=qf[ap]&255;if(ap++,(i&192)==128)return i&63;throw Error("Invalid continuation byte")}function AM(i){var o,n,p,c,x;if(ap>kf)throw Error("Invalid byte index");if(ap==kf)return!1;if(o=qf[ap]&255,ap++,(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 qf,kf,ap;function vM(i,o){o=o||{};var n=o.strict!==!1;qf=hW(i),kf=qf.length,ap=0;var p=[],c;while((c=AM(n))!==!1)p.push(c);return $M(p)}sW.exports={version:"2.1.2",encode:FM,decode:vM}});var x5=a((c5)=>{Object.defineProperty(c5,"__esModule",{value:!0});c5.packets=c5.protocol=void 0;c5.encodePacket=DJ;c5.encodeBase64Packet=eW;c5.decodePacket=BJ;c5.decodeBase64Packet=i5;c5.encodePayload=RM;c5.decodePayload=GM;c5.encodePayloadAsBinary=n5;c5.decodePayloadAsBinary=p5;var rW=tW();c5.protocol=3;var wM=(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),In={type:"error",data:"parser error"},XM=Buffer.concat([]);function DJ(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:IJ(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:IJ(i.data),p="b"+c5.packets[i.type];return p+=n.toString("base64"),o(p)}function BJ(i,o,n){if(i===void 0)return In;var p;if(typeof i==="string"){if(p=i.charAt(0),p==="b")return i5(i.slice(1),o);if(n){if(i=WM(i),i===!1)return In}if(Number(p)!=p||!Rx[p])return In;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=IJ(i);return p=i[0],{type:Rx[p],data:i.slice(1)}}function WM(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 RM(i,o,n){if(typeof o==="function")n=o,o=null;if(o&&wM(i))return n5(i,n);if(!i.length)return n("0:");function p(c,x){DJ(c,o,!1,function(T){x(null,YM(T))})}o5(i,p,function(c,x){return n(x.join(""))})}function YM(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 GM(i,o,n){if(typeof i!=="string")return p5(i,o,n);if(typeof o==="function")n=o,o=null;if(i==="")return n(In,0,1);var p="",c,x,T;for(var m=0,f=i.length;m<f;m++){var $=i.charAt(m);if($!==":"){p+=$;continue}if(p===""||p!=(c=Number(p)))return n(In,0,1);if(x=i.slice(m+1,m+1+c),p!=x.length)return n(In,0,1);if(x.length){if(T=BJ(x,o,!1),In.type===T.type&&In.data===T.data)return n(In,0,1);var J=n(T,m+c,f);if(J===!1)return}m+=c,p=""}if(p!=="")return n(In,0,1)}function KM(i){var o="";for(var n=0,p=i.length;n<p;n++)o+=String.fromCharCode(i[n]);return o}function HM(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 IJ(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(XM);o5(i,UM,function(n,p){return o(Buffer.concat(p))})}function UM(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,HM(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]))}DJ(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(In,0,1);T+=""+p[x]}p=p.slice(T.length+1);var f=parseInt(T,10),$=p.slice(1,f+1);if(m)$=KM($);c.push($),p=p.slice(f+1)}var J=c.length;for(x=0;x<J;x++){var F=c[x];n(BJ(F,o,!0),x,J)}}});var m5=a((hni,T5)=>{var Gx=1000,Kx=Gx*60,Hx=Kx*60,Xc=Hx*24,_M=Xc*7,yM=Xc*365.25;T5.exports=function(i,o){o=o||{};var n=typeof i;if(n==="string"&&i.length>0)return LM(i);else if(n==="number"&&isFinite(i))return o.long?DM(i):CM(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function LM(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*yM;case"weeks":case"week":case"w":return n*_M;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 CM(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 DM(i){var o=Math.abs(i);if(o>=Xc)return hf(i,o,Xc,"day");if(o>=Hx)return hf(i,o,Hx,"hour");if(o>=Kx)return hf(i,o,Kx,"minute");if(o>=Gx)return hf(i,o,Gx,"second");return i+" ms"}function hf(i,o,n,p){var c=o>=n*1.5;return Math.round(i/n)+" "+p+(c?"s":"")}});var NJ=a((gni,f5)=>{function BM(i){n.debug=n,n.default=n,n.coerce=f,n.disable=x,n.enable=c,n.enabled=T,n.humanize=m5(),n.destroy=$,Object.keys(i).forEach((J)=>{n[J]=i[J]}),n.names=[],n.skips=[],n.formatters={};function o(J){let F=0;for(let A=0;A<J.length;A++)F=(F<<5)-F+J.charCodeAt(A),F|=0;return n.colors[Math.abs(F)%n.colors.length]}n.selectColor=o;function n(J){let F,A=null,X,Y;function R(...K){if(!R.enabled)return;let H=R,Z=Number(new Date),b=Z-(F||Z);if(H.diff=b,H.prev=F,H.curr=Z,F=Z,K[0]=n.coerce(K[0]),typeof K[0]!=="string")K.unshift("%O");let u=0;K[0]=K[0].replace(/%([a-zA-Z%])/g,(E,V)=>{if(E==="%%")return"%";u++;let C=n.formatters[V];if(typeof C==="function"){let l=K[u];E=C.call(H,l),K.splice(u,1),u--}return E}),n.formatArgs.call(H,K),(H.log||n.log).apply(H,K)}if(R.namespace=J,R.useColors=n.useColors(),R.color=n.selectColor(J),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(J);return Y},set:(K)=>{A=K}}),typeof n.init==="function")n.init(R);return R}function p(J,F){let A=n(this.namespace+(typeof F==="undefined"?":":F)+J);return A.log=this.log,A}function c(J){n.save(J),n.namespaces=J,n.names=[],n.skips=[];let F,A=(typeof J==="string"?J:"").split(/[\s,]+/),X=A.length;for(F=0;F<X;F++){if(!A[F])continue;if(J=A[F].replace(/\*/g,".*?"),J[0]==="-")n.skips.push(new RegExp("^"+J.slice(1)+"$"));else n.names.push(new RegExp("^"+J+"$"))}}function x(){let J=[...n.names.map(m),...n.skips.map(m).map((F)=>"-"+F)].join(",");return n.enable(""),J}function T(J){if(J[J.length-1]==="*")return!0;let F,A;for(F=0,A=n.skips.length;F<A;F++)if(n.skips[F].test(J))return!1;for(F=0,A=n.names.length;F<A;F++)if(n.names[F].test(J))return!0;return!1}function m(J){return J.toString().substring(2,J.toString().length-2).replace(/\.\*\?$/,"*")}function f(J){if(J instanceof Error)return J.stack||J.message;return J}function $(){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=BM});var J5=a(($5,sf)=>{$5.formatArgs=NM;$5.save=bM;$5.load=jM;$5.useColors=IM;$5.storage=aM();$5.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`.")}})();$5.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 IM(){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 NM(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+sf.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)}$5.log=console.debug||console.log||(()=>{});function bM(i){try{if(i)$5.storage.setItem("debug",i);else $5.storage.removeItem("debug")}catch(o){}}function jM(){let i;try{i=$5.storage.getItem("debug")}catch(o){}if(!i&&typeof process!=="undefined"&&"env"in process)i=process.env.DEBUG;return i}function aM(){try{return localStorage}catch(i){}}sf.exports=NJ()($5);var{formatters:PM}=sf.exports;PM.j=function(i){try{return JSON.stringify(i)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}});var A5=a((tni,F5)=>{F5.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=a((dni,w5)=>{var dM=Hi("os"),v5=Hi("tty"),zn=A5(),{env:Yo}=process,tf;if(zn("no-color")||zn("no-colors")||zn("color=false")||zn("color=never"))tf=0;else if(zn("color")||zn("colors")||zn("color=true")||zn("color=always"))tf=1;function rM(){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 eM(i){if(i===0)return!1;return{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function iQ(i,{streamIsTTY:o,sniffFlags:n=!0}={}){let p=rM();if(p!==void 0)tf=p;let c=n?tf: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=dM.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 bJ(i,o={}){let n=iQ(i,{streamIsTTY:i&&i.isTTY,...o});return eM(n)}w5.exports={supportsColor:bJ,stdout:bJ({isTTY:v5.isatty(1)}),stderr:bJ({isTTY:v5.isatty(2)})}});var G5=a((R5,rf)=>{var oQ=Hi("tty"),df=Hi("util");R5.init=fQ;R5.log=xQ;R5.formatArgs=pQ;R5.save=TQ;R5.load=mQ;R5.useColors=nQ;R5.destroy=df.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 nQ(){return"colors"in R5.inspectOpts?Boolean(R5.inspectOpts.colors):oQ.isatty(process.stderr.fd)}function pQ(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
- `+x),n.push(p+"m+"+Ga.exports.humanize(this.diff)+"\x1B[0m")}else n[0]=NK()+i+" "+n[0]}function NK(){if(z4.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function hK(...n){return process.stderr.write(la.formatWithOptions(z4.inspectOpts,...n)+`
31
- `)}function CK(n){if(n)process.env.DEBUG=n;else delete process.env.DEBUG}function IK(){return process.env.DEBUG}function yK(n){n.inspectOpts={};let i=Object.keys(z4.inspectOpts);for(let o=0;o<i.length;o++)n.inspectOpts[i[o]]=z4.inspectOpts[i[o]]}Ga.exports=sv()(z4);var{formatters:H4}=Ga.exports;H4.o=function(n){return this.inspectOpts.colors=this.useColors,la.inspect(n,this.inspectOpts).split(`
32
- `).map((i)=>i.trim()).join(" ")};H4.O=function(n){return this.inspectOpts.colors=this.useColors,la.inspect(n,this.inspectOpts)}});var fi=C((mL,tv)=>{if(typeof process==="undefined"||process.type==="renderer"||!1||process.__nwjs)tv.exports=W4();else tv.exports=E4()});var _c=C((V4)=>{Object.defineProperty(V4,"__esModule",{value:!0});V4.Transport=void 0;var dK=Kn("node:events"),gK=ux(),eK=F4(),n5=fi(),O4=n5.default("engine:transport");function i5(){}class U4 extends dK.EventEmitter{get readyState(){return this._readyState}set readyState(n){O4("readyState updated from %s to %s (%s)",this._readyState,n,this.name),this._readyState=n}constructor(n){super();this.writable=!1,this._readyState="open",this.discarded=!1,this.protocol=n._query.EIO==="4"?4:3,this.parser=this.protocol===4?gK:eK,this.supportsBinary=!(n._query&&n._query.b64)}discard(){this.discarded=!0}onRequest(n){}close(n){if(this.readyState==="closed"||this.readyState==="closing")return;this.readyState="closing",this.doClose(n||i5)}onError(n,i){if(this.listeners("error").length){let o=new Error(n);o.type="TransportError",o.description=i,this.emit("error",o)}else O4("ignored transport error %s (%s)",n,i)}onPacket(n){this.emit("packet",n)}onData(n){this.onPacket(this.parser.decodePacket(n))}onClose(){this.readyState="closed",this.emit("close")}}V4.Transport=U4});var rv=C((B4)=>{Object.defineProperty(B4,"__esModule",{value:!0});B4.Polling=void 0;var o5=_c(),b4=Kn("node:zlib"),c5=va(),p5=fi(),Ci=p5.default("engine:polling"),x5={gzip:b4.createGzip,deflate:b4.createDeflate};class u4 extends o5.Transport{constructor(n){super(n);this.closeTimeout=30000}get name(){return"polling"}onRequest(n){let i=n.res;if(n.res=null,n.method==="GET")this.onPollRequest(n,i);else if(n.method==="POST")this.onDataRequest(n,i);else i.writeHead(500),i.end()}onPollRequest(n,i){if(this.req){Ci("request overlap"),this.onError("overlap from client"),i.writeHead(400),i.end();return}Ci("setting request"),this.req=n,this.res=i;let o=()=>{this.onError("poll connection closed prematurely")},c=()=>{n.removeListener("close",o),this.req=this.res=null};if(n.cleanup=c,n.on("close",o),this.writable=!0,this.emit("ready"),this.writable&&this.shouldClose)Ci("triggering empty send to append close packet"),this.send([{type:"noop"}])}onDataRequest(n,i){if(this.dataReq){this.onError("data request overlap from client"),i.writeHead(400),i.end();return}let o=n.headers["content-type"]==="application/octet-stream";if(o&&this.protocol===4)return this.onError("invalid content");this.dataReq=n,this.dataRes=i;let c=o?Buffer.concat([]):"",p=()=>{n.removeListener("data",m),n.removeListener("end",a),n.removeListener("close",x),this.dataReq=this.dataRes=c=null},x=()=>{p(),this.onError("data request connection closed prematurely")},m=(f)=>{let v;if(o)c=Buffer.concat([c,f]),v=c.length;else c+=f,v=Buffer.byteLength(c);if(v>this.maxHttpBufferSize)i.writeHead(413).end(),p()},a=()=>{this.onData(c);let f={"Content-Type":"text/html","Content-Length":"2"};i.writeHead(200,this.headers(n,f)),i.end("ok"),p()};if(n.on("close",x),!o)n.setEncoding("utf8");n.on("data",m),n.on("end",a)}onData(n){Ci('received "%s"',n);let i=(o)=>{if(o.type==="close")return Ci("got xhr close packet"),this.onClose(),!1;this.onPacket(o)};if(this.protocol===3)this.parser.decodePayload(n,i);else this.parser.decodePayload(n).forEach(i)}onClose(){if(this.writable)this.send([{type:"noop"}]);super.onClose()}send(n){if(this.writable=!1,this.shouldClose)Ci("appending close packet to payload"),n.push({type:"close"}),this.shouldClose(),this.shouldClose=null;let i=(o)=>{let c=n.some((p)=>{return p.options&&p.options.compress});this.write(o,{compress:c})};if(this.protocol===3)this.parser.encodePayload(n,this.supportsBinary,i);else this.parser.encodePayload(n,i)}write(n,i){Ci('writing "%s"',n),this.doWrite(n,i,()=>{this.req.cleanup(),this.emit("drain")})}doWrite(n,i,o){let c=typeof n==="string",x={"Content-Type":c?"text/plain; charset=UTF-8":"application/octet-stream"},m=(v)=>{x["Content-Length"]=typeof v==="string"?Buffer.byteLength(v):v.length,this.res.writeHead(200,this.headers(this.req,x)),this.res.end(v),o()};if(!this.httpCompression||!i.compress){m(n);return}if((c?Buffer.byteLength(n):n.length)<this.httpCompression.threshold){m(n);return}let f=c5(this.req).encodings(["gzip","deflate"]);if(!f){m(n);return}this.compress(n,f,(v,$)=>{if(v){this.res.writeHead(500),this.res.end(),o(v);return}x["Content-Encoding"]=f,m($)})}compress(n,i,o){Ci("compressing");let c=[],p=0;x5[i](this.httpCompression).on("error",o).on("data",function(x){c.push(x),p+=x.length}).on("end",function(){o(null,Buffer.concat(c,p))}).end(n)}doClose(n){Ci("closing");let i;if(this.dataReq)Ci("aborting ongoing data request"),this.dataReq.destroy();let o=()=>{clearTimeout(i),n(),this.onClose()};if(this.writable)Ci("transport writable - closing right away"),this.send([{type:"close"}]),o();else if(this.discarded)Ci("transport discarded - closing right away"),o();else Ci("transport not writable - buffering orderly close"),this.shouldClose=o,i=setTimeout(o,this.closeTimeout)}headers(n,i={}){let o=n.headers["user-agent"];if(o&&(~o.indexOf(";MSIE")||~o.indexOf("Trident/")))i["X-XSS-Protection"]="0";return i["cache-control"]="no-store",this.emit("headers",i,n),i}}B4.Polling=u4});var h4=C((L4)=>{Object.defineProperty(L4,"__esModule",{value:!0});L4.JSONP=void 0;var m5=rv(),a5=Kn("node:querystring"),f5=/\\\\n/g,v5=/(\\)?\\n/g;class D4 extends m5.Polling{constructor(n){super(n);this.head="___eio["+(n._query.j||"").replace(/[^0-9]/g,"")+"](",this.foot=");"}onData(n){if(n=a5.parse(n).d,typeof n==="string")n=n.replace(v5,function(i,o){return o?i:`
33
- `}),super.onData(n.replace(f5,"\\n"))}doWrite(n,i,o){let c=JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");n=this.head+c+this.foot,super.doWrite(n,i,o)}}L4.JSONP=D4});var Z4=C((y4)=>{Object.defineProperty(y4,"__esModule",{value:!0});y4.WebSocket=void 0;var $5=_c(),w5=fi(),C4=w5.default("engine:ws");class I4 extends $5.Transport{constructor(n){super(n);this._doSend=(i)=>{this.socket.send(i,this._onSent)},this._doSendLast=(i)=>{this.socket.send(i,this._onSentLast)},this._onSent=(i)=>{if(i)this.onError("write error",i.stack)},this._onSentLast=(i)=>{if(i)this.onError("write error",i.stack);else this.emit("drain"),this.writable=!0,this.emit("ready")},this.socket=n.websocket,this.socket.on("message",(i,o)=>{let c=o?i:i.toString();C4('received "%s"',c),super.onData(c)}),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(n){this.writable=!1;for(let i=0;i<n.length;i++){let o=n[i],c=i+1===n.length;if(this._canSendPreEncodedFrame(o))this.socket._sender.sendFrame(o.options.wsPreEncodedFrame,c?this._onSentLast:this._onSent);else this.parser.encodePacket(o,this.supportsBinary,c?this._doSendLast:this._doSend)}}_canSendPreEncodedFrame(n){var i,o,c;return!this.perMessageDeflate&&typeof((o=(i=this.socket)===null||i===void 0?void 0:i._sender)===null||o===void 0?void 0:o.sendFrame)==="function"&&((c=n.options)===null||c===void 0?void 0:c.wsPreEncodedFrame)!==void 0}doClose(n){C4("closing"),this.socket.close(),n&&n()}}y4.WebSocket=I4});var dv=C((s4)=>{Object.defineProperty(s4,"__esModule",{value:!0});s4.WebTransport=void 0;var J5=_c(),A5=fi(),F5=ux(),Yp=A5.default("engine:webtransport");class q4 extends J5.Transport{constructor(n,i,o){super({_query:{EIO:"4"}});this.session=n;let c=F5.createPacketEncoderStream();c.readable.pipeTo(i.writable).catch(()=>{Yp("the stream was closed")}),this.writer=c.writable.getWriter(),(async()=>{try{while(!0){let{value:p,done:x}=await o.read();if(x){Yp("session is closed");break}Yp("received chunk: %o",p),this.onPacket(p)}}catch(p){Yp("error while reading: %s",p.message)}})(),n.closed.then(()=>this.onClose()),this.writable=!0}get name(){return"webtransport"}async send(n){this.writable=!1;try{for(let i=0;i<n.length;i++){let o=n[i];await this.writer.write(o)}}catch(i){Yp("error while writing: %s",i.message)}this.emit("drain"),this.writable=!0,this.emit("ready")}doClose(n){Yp("closing WebTransport session"),this.session.close(),n&&n()}}s4.WebTransport=q4});var gv=C((r4)=>{Object.defineProperty(r4,"__esModule",{value:!0});var T5=rv(),R5=h4(),S5=Z4(),X5=dv();r4.default={polling:t4,websocket:S5.WebSocket,webtransport:X5.WebTransport};function t4(n){if(typeof n._query.j==="string")return new R5.JSONP(n);else return new T5.Polling(n)}t4.upgradesTo=["websocket","webtransport"]});var ev=C((g4)=>{Object.defineProperty(g4,"__esModule",{value:!0});g4.Socket=void 0;var K5=Kn("node:events"),l5=fi(),uo=Kn("node:timers"),Zn=l5.default("engine:socket");class d4 extends K5.EventEmitter{get readyState(){return this._readyState}set readyState(n){Zn("readyState updated from %s to %s",this._readyState,n),this._readyState=n}constructor(n,i,o,c,p){super();if(this._readyState="opening",this.upgrading=!1,this.upgraded=!1,this.writeBuffer=[],this.packetsFn=[],this.sentCallbackFn=[],this.cleanupFn=[],this.id=n,this.server=i,this.request=c,this.protocol=p,c)if(c.websocket&&c.websocket._socket)this.remoteAddress=c.websocket._socket.remoteAddress;else this.remoteAddress=c.connection.remoteAddress;this.pingTimeoutTimer=null,this.pingIntervalTimer=null,this.setTransport(o),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(n){if(this.readyState!=="open")return Zn("packet received with closed socket");switch(Zn(`received packet ${n.type}`),this.emit("packet",n),n.type){case"ping":if(this.transport.protocol!==3){this.onError(new Error("invalid heartbeat direction"));return}Zn("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}Zn("got pong"),uo.clearTimeout(this.pingTimeoutTimer),this.pingIntervalTimer.refresh(),this.emit("heartbeat");break;case"error":this.onClose("parse error");break;case"message":this.emit("data",n.data),this.emit("message",n.data);break}}onError(n){Zn("transport error"),this.onClose("transport error",n)}schedulePing(){this.pingIntervalTimer=uo.setTimeout(()=>{Zn("writing ping packet - expecting pong within %sms",this.server.opts.pingTimeout),this.sendPacket("ping"),this.resetPingTimeout()},this.server.opts.pingInterval)}resetPingTimeout(){uo.clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=uo.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(n){let i=this.onError.bind(this),o=()=>this.flush(),c=this.onPacket.bind(this),p=this.onDrain.bind(this),x=this.onClose.bind(this,"transport close");this.transport=n,this.transport.once("error",i),this.transport.on("ready",o),this.transport.on("packet",c),this.transport.on("drain",p),this.transport.once("close",x),this.cleanupFn.push(function(){n.removeListener("error",i),n.removeListener("ready",o),n.removeListener("packet",c),n.removeListener("drain",p),n.removeListener("close",x)})}onDrain(){if(this.sentCallbackFn.length>0){Zn("executing batch send callback");let n=this.sentCallbackFn.shift();if(n)for(let i=0;i<n.length;i++)n[i](this.transport)}}_maybeUpgrade(n){Zn('might upgrade socket transport from "%s" to "%s"',this.transport.name,n.name),this.upgrading=!0;let i=uo.setTimeout(()=>{if(Zn("client did not complete upgrade - closing transport"),x(),n.readyState==="open")n.close()},this.server.opts.upgradeTimeout),o,c=(v)=>{if(v.type==="ping"&&v.data==="probe")Zn("got probe ping packet, sending pong"),n.send([{type:"pong",data:"probe"}]),this.emit("upgrading",n),clearInterval(o),o=setInterval(p,100);else if(v.type==="upgrade"&&this.readyState!=="closed"){if(Zn("got upgrade packet - upgrading"),x(),this.transport.discard(),this.upgraded=!0,this.clearTransport(),this.setTransport(n),this.emit("upgrade",n),this.flush(),this.readyState==="closing")n.close(()=>{this.onClose("forced close")})}else x(),n.close()},p=()=>{if(this.transport.name==="polling"&&this.transport.writable)Zn("writing a noop packet to polling for fast upgrade"),this.transport.send([{type:"noop"}])},x=()=>{this.upgrading=!1,clearInterval(o),uo.clearTimeout(i),n.removeListener("packet",c),n.removeListener("close",a),n.removeListener("error",m),this.removeListener("close",f)},m=(v)=>{Zn("client did not complete upgrade - %s",v),x(),n.close(),n=null},a=()=>{m("transport closed")},f=()=>{m("socket closed")};n.on("packet",c),n.once("close",a),n.once("error",m),this.once("close",f)}clearTransport(){let n,i=this.cleanupFn.length;for(let o=0;o<i;o++)n=this.cleanupFn.shift(),n();this.transport.on("error",function(){Zn("error triggered by discarded transport")}),this.transport.close(),uo.clearTimeout(this.pingTimeoutTimer)}onClose(n,i){if(this.readyState!=="closed")this.readyState="closed",uo.clearTimeout(this.pingIntervalTimer),uo.clearTimeout(this.pingTimeoutTimer),process.nextTick(()=>{this.writeBuffer=[]}),this.packetsFn=[],this.sentCallbackFn=[],this.clearTransport(),this.emit("close",n,i)}send(n,i,o){return this.sendPacket("message",n,i,o),this}write(n,i,o){return this.sendPacket("message",n,i,o),this}sendPacket(n,i,o={},c){if(typeof o==="function")c=o,o={};if(this.readyState!=="closing"&&this.readyState!=="closed"){Zn('sending packet "%s" (%s)',n,i),o.compress=o.compress!==!1;let p={type:n,options:o};if(i)p.data=i;if(this.emit("packetCreate",p),this.writeBuffer.push(p),typeof c==="function")this.packetsFn.push(c);this.flush()}}flush(){if(this.readyState!=="closed"&&this.transport.writable&&this.writeBuffer.length){Zn("flushing buffer to transport"),this.emit("flush",this.writeBuffer),this.server.emit("flush",this,this.writeBuffer);let n=this.writeBuffer;if(this.writeBuffer=[],this.packetsFn.length)this.sentCallbackFn.push(this.packetsFn),this.packetsFn=[];else this.sentCallbackFn.push(null);this.transport.send(n),this.emit("drain"),this.server.emit("drain",this)}}getAvailableUpgrades(){let n=[],i=this.server.upgrades(this.transport.name);for(let o=0;o<i.length;++o){let c=i[o];if(this.server.opts.transports.indexOf(c)!==-1)n.push(c)}return n}close(n){if(n&&(this.readyState==="open"||this.readyState==="closing"))return this.closeTransport(n);if(this.readyState!=="open")return;if(this.readyState="closing",this.writeBuffer.length){Zn("there are %d remaining packets in the buffer, waiting for the 'drain' event",this.writeBuffer.length),this.once("drain",()=>{Zn("all packets have been sent, closing the transport"),this.closeTransport(n)});return}Zn("the buffer is empty, closing the transport right away"),this.closeTransport(n)}closeTransport(n){if(Zn("closing the transport (discard? %s)",!!n),n)this.transport.discard();this.transport.close(this.onClose.bind(this,"forced close"))}}g4.Socket=d4});var o8=C((b5)=>{/*!
30
+ `+x),i.push(c+"m+"+rf.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=cQ()+o+" "+i[0]}function cQ(){if(R5.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function xQ(...i){return process.stderr.write(df.formatWithOptions(R5.inspectOpts,...i)+`
31
+ `)}function TQ(i){if(i)process.env.DEBUG=i;else delete process.env.DEBUG}function mQ(){return process.env.DEBUG}function fQ(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]]}rf.exports=NJ()(R5);var{formatters:W5}=rf.exports;W5.o=function(i){return this.inspectOpts.colors=this.useColors,df.inspect(i,this.inspectOpts).split(`
32
+ `).map((o)=>o.trim()).join(" ")};W5.O=function(i){return this.inspectOpts.colors=this.useColors,df.inspect(i,this.inspectOpts)}});var Go=a((eni,jJ)=>{if(typeof process==="undefined"||process.type==="renderer"||!1||process.__nwjs)jJ.exports=J5();else jJ.exports=G5()});var Rc=a((U5)=>{Object.defineProperty(U5,"__esModule",{value:!0});U5.Transport=void 0;var WQ=Hi("events"),RQ=kT(),YQ=x5(),GQ=Go(),K5=GQ.default("engine:transport");function KQ(){}class H5 extends WQ.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?RQ:YQ,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||KQ)}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 aJ=a((M5)=>{Object.defineProperty(M5,"__esModule",{value:!0});M5.Polling=void 0;var HQ=Rc(),u5=Hi("zlib"),UQ=Nf(),zQ=Go(),$n=zQ.default("engine:polling"),uQ={gzip:u5.createGzip,deflate:u5.createDeflate};class Z5 extends HQ.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){$n("request overlap"),this.onError("overlap from client"),o.writeHead(400),o.end();return}$n("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)$n("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 $;if(n)p=Buffer.concat([p,f]),$=p.length;else p+=f,$=Buffer.byteLength(p);if($>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){$n('received "%s"',i);let o=(n)=>{if(n.type==="close")return $n("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)$n("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){$n('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=($)=>{x["Content-Length"]=typeof $==="string"?Buffer.byteLength($):$.length,this.res.writeHead(200,this.headers(this.req,x)),this.res.end($),n()};if(!this.httpCompression||!o.compress){T(i);return}if((p?Buffer.byteLength(i):i.length)<this.httpCompression.threshold){T(i);return}let f=UQ(this.req).encodings(["gzip","deflate"]);if(!f){T(i);return}this.compress(i,f,($,J)=>{if($){this.res.writeHead(500),this.res.end(),n($);return}x["Content-Encoding"]=f,T(J)})}compress(i,o,n){$n("compressing");let p=[],c=0;uQ[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){$n("closing");let o;if(this.dataReq)$n("aborting ongoing data request"),this.dataReq.destroy();let n=()=>{clearTimeout(o),i(),this.onClose()};if(this.writable)$n("transport writable - closing right away"),this.send([{type:"close"}]),n();else if(this.discarded)$n("transport discarded - closing right away"),n();else $n("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}}M5.Polling=Z5});var O5=a((V5)=>{Object.defineProperty(V5,"__esModule",{value:!0});V5.JSONP=void 0;var ZQ=aJ(),MQ=Hi("querystring"),QQ=/\\\\n/g,SQ=/(\\)?\\n/g;class S5 extends ZQ.Polling{constructor(i){super(i);this.head="___eio["+(i._query.j||"").replace(/[^0-9]/g,"")+"](",this.foot=");"}onData(i){if(i=MQ.parse(i).d,typeof i==="string")i=i.replace(SQ,function(o,n){return n?o:`
33
+ `}),super.onData(i.replace(QQ,"\\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)}}V5.JSONP=S5});var D5=a((L5)=>{Object.defineProperty(L5,"__esModule",{value:!0});L5.WebSocket=void 0;var VQ=Rc(),EQ=Go(),_5=EQ.default("engine:ws");class y5 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()}}L5.WebSocket=y5});var PJ=a((I5)=>{Object.defineProperty(I5,"__esModule",{value:!0});I5.WebTransport=void 0;var OQ=Rc(),_Q=Go(),yQ=kT(),Ux=_Q.default("engine:webtransport");class B5 extends OQ.Transport{constructor(i,o,n){super({_query:{EIO:"4"}});this.session=i;let p=yQ.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()}}I5.WebTransport=B5});var lJ=a((j5)=>{Object.defineProperty(j5,"__esModule",{value:!0});var LQ=aJ(),CQ=O5(),DQ=D5(),BQ=PJ();j5.default={polling:b5,websocket:DQ.WebSocket,webtransport:BQ.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 qJ=a((P5)=>{Object.defineProperty(P5,"__esModule",{value:!0});P5.Socket=void 0;var NQ=Hi("events"),bQ=Go(),wp=Hi("timers"),ri=bQ.default("engine:socket");class a5 extends NQ.EventEmitter{get readyState(){return this._readyState}set readyState(i){ri("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 ri("packet received with closed socket");switch(ri(`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}ri("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}ri("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){ri("transport error"),this.onClose("transport error",i)}schedulePing(){this.pingIntervalTimer=wp.setTimeout(()=>{ri("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){ri("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){ri('might upgrade socket transport from "%s" to "%s"',this.transport.name,i.name),this.upgrading=!0;let o=wp.setTimeout(()=>{if(ri("client did not complete upgrade - closing transport"),x(),i.readyState==="open")i.close()},this.server.opts.upgradeTimeout),n,p=($)=>{if($.type==="ping"&&$.data==="probe")ri("got probe ping packet, sending pong"),i.send([{type:"pong",data:"probe"}]),this.emit("upgrading",i),clearInterval(n),n=setInterval(c,100);else if($.type==="upgrade"&&this.readyState!=="closed"){if(ri("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)ri("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=($)=>{ri("client did not complete upgrade - %s",$),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(){ri("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"){ri('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){ri("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){ri("there are %d remaining packets in the buffer, waiting for the 'drain' event",this.writeBuffer.length),this.once("drain",()=>{ri("all packets have been sent, closing the transport"),this.closeTransport(i)});return}ri("the buffer is empty, closing the transport right away"),this.closeTransport(i)}closeTransport(i){if(ri("closing the transport (discard? %s)",!!i),i)this.transport.discard();this.transport.close(this.onClose.bind(this,"forced close"))}}P5.Socket=a5});var h5=a((rQ)=>{/*!
34
34
  * cookie
35
35
  * Copyright(c) 2012-2014 Roman Shtylman
36
36
  * Copyright(c) 2015 Douglas Christopher Wilson
37
37
  * MIT Licensed
38
- */b5.parse=E5;b5.serialize=O5;var G5=Object.prototype.toString,M5=Object.prototype.hasOwnProperty,Y5=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,H5=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,z5=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,Q5=/^[\u0020-\u003A\u003D-\u007E]*$/;function E5(n,i){if(typeof n!=="string")throw new TypeError("argument str must be a string");var o={},c=n.length;if(c<2)return o;var p=i&&i.decode||U5,x=0,m=0,a=0;do{if(m=n.indexOf("=",x),m===-1)break;if(a=n.indexOf(";",x),a===-1)a=c;else if(m>a){x=n.lastIndexOf(";",m-1)+1;continue}var f=n8(n,x,m),v=i8(n,m,f),$=n.slice(f,v);if(!M5.call(o,$)){var w=n8(n,m+1,a),J=i8(n,a,w);if(n.charCodeAt(w)===34&&n.charCodeAt(J-1)===34)w++,J--;var S=n.slice(w,J);o[$]=_5(S,p)}x=a+1}while(x<c);return o}function n8(n,i,o){do{var c=n.charCodeAt(i);if(c!==32&&c!==9)return i}while(++i<o);return o}function i8(n,i,o){while(i>o){var c=n.charCodeAt(--i);if(c!==32&&c!==9)return i+1}return o}function O5(n,i,o){var c=o&&o.encode||encodeURIComponent;if(typeof c!=="function")throw new TypeError("option encode is invalid");if(!Y5.test(n))throw new TypeError("argument name is invalid");var p=c(i);if(!H5.test(p))throw new TypeError("argument val is invalid");var x=n+"="+p;if(!o)return x;if(o.maxAge!=null){var m=Math.floor(o.maxAge);if(!isFinite(m))throw new TypeError("option maxAge is invalid");x+="; Max-Age="+m}if(o.domain){if(!z5.test(o.domain))throw new TypeError("option domain is invalid");x+="; Domain="+o.domain}if(o.path){if(!Q5.test(o.path))throw new TypeError("option path is invalid");x+="; Path="+o.path}if(o.expires){var a=o.expires;if(!V5(a)||isNaN(a.valueOf()))throw new TypeError("option expires is invalid");x+="; Expires="+a.toUTCString()}if(o.httpOnly)x+="; HttpOnly";if(o.secure)x+="; Secure";if(o.partitioned)x+="; Partitioned";if(o.priority){var f=typeof o.priority==="string"?o.priority.toLowerCase():o.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(o.sameSite){var v=typeof o.sameSite==="string"?o.sameSite.toLowerCase():o.sameSite;switch(v){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 U5(n){return n.indexOf("%")!==-1?decodeURIComponent(n):n}function V5(n){return G5.call(n)==="[object Date]"}function _5(n,i){try{return i(n)}catch(o){return n}}});var x8=C((TL,p8)=>{var c8=Object.getOwnPropertySymbols,j5=Object.prototype.hasOwnProperty,D5=Object.prototype.propertyIsEnumerable;function L5(n){if(n===null||n===void 0)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function N5(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;var i={};for(var o=0;o<10;o++)i["_"+String.fromCharCode(o)]=o;var c=Object.getOwnPropertyNames(i).map(function(x){return i[x]});if(c.join("")!=="0123456789")return!1;var p={};if("abcdefghijklmnopqrst".split("").forEach(function(x){p[x]=x}),Object.keys(Object.assign({},p)).join("")!=="abcdefghijklmnopqrst")return!1;return!0}catch(x){return!1}}p8.exports=N5()?Object.assign:function(n,i){var o,c=L5(n),p;for(var x=1;x<arguments.length;x++){o=Object(arguments[x]);for(var m in o)if(j5.call(o,m))c[m]=o[m];if(c8){p=c8(o);for(var a=0;a<p.length;a++)if(D5.call(o,p[a]))c[p[a]]=o[p[a]]}}return c}});var f8=C((RL,n$)=>{/*!
38
+ */rQ.parse=hQ;rQ.serialize=gQ;var jQ=Object.prototype.toString,aQ=Object.prototype.hasOwnProperty,PQ=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,lQ=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,qQ=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,kQ=/^[\u0020-\u003A\u003D-\u007E]*$/;function hQ(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||sQ,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),$=k5(i,T,f),J=i.slice(f,$);if(!aQ.call(n,J)){var F=q5(i,T+1,m),A=k5(i,m,F);if(i.charCodeAt(F)===34&&i.charCodeAt(A-1)===34)F++,A--;var X=i.slice(F,A);n[J]=dQ(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 gQ(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(!lQ.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(!qQ.test(n.domain))throw new TypeError("option domain is invalid");x+="; Domain="+n.domain}if(n.path){if(!kQ.test(n.path))throw new TypeError("option path is invalid");x+="; Path="+n.path}if(n.expires){var m=n.expires;if(!tQ(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 $=typeof n.sameSite==="string"?n.sameSite.toLowerCase():n.sameSite;switch($){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 sQ(i){return i.indexOf("%")!==-1?decodeURIComponent(i):i}function tQ(i){return jQ.call(i)==="[object Date]"}function dQ(i,o){try{return o(i)}catch(n){return i}}});var t5=a((fpi,s5)=>{var g5=Object.getOwnPropertySymbols,oS=Object.prototype.hasOwnProperty,nS=Object.prototype.propertyIsEnumerable;function pS(i){if(i===null||i===void 0)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function cS(){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=cS()?Object.assign:function(i,o){var n,p=pS(i),c;for(var x=1;x<arguments.length;x++){n=Object(arguments[x]);for(var T in n)if(oS.call(n,T))p[T]=n[T];if(g5){c=g5(n);for(var m=0;m<c.length;m++)if(nS.call(n,c[m]))p[c[m]]=n[c[m]]}}return p}});var e5=a(($pi,kJ)=>{/*!
39
39
  * vary
40
40
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
41
41
  * MIT Licensed
42
- */n$.exports=C5;n$.exports.append=a8;var h5=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function a8(n,i){if(typeof n!=="string")throw new TypeError("header argument is required");if(!i)throw new TypeError("field argument is required");var o=!Array.isArray(i)?m8(String(i)):i;for(var c=0;c<o.length;c++)if(!h5.test(o[c]))throw new TypeError("field argument contains an invalid header name");if(n==="*")return n;var p=n,x=m8(n.toLowerCase());if(o.indexOf("*")!==-1||x.indexOf("*")!==-1)return"*";for(var m=0;m<o.length;m++){var a=o[m].toLowerCase();if(x.indexOf(a)===-1)x.push(a),p=p?p+", "+o[m]:o[m]}return p}function m8(n){var i=0,o=[],c=0;for(var p=0,x=n.length;p<x;p++)switch(n.charCodeAt(p)){case 32:if(c===i)c=i=p+1;break;case 44:o.push(n.substring(c,i)),c=i=p+1;break;default:i=p+1;break}return o.push(n.substring(c,i)),o}function C5(n,i){if(!n||!n.getHeader||!n.setHeader)throw new TypeError("res argument is required");var o=n.getHeader("Vary")||"",c=Array.isArray(o)?o.join(", "):String(o);if(o=a8(c,i))n.setHeader("Vary",o)}});var i$=C((SL,v8)=>{(function(){var n=x8(),i=f8(),o={origin:"*",methods:"GET,HEAD,PUT,PATCH,POST,DELETE",preflightContinue:!1,optionsSuccessStatus:204};function c(X){return typeof X==="string"||X instanceof String}function p(X,R){if(Array.isArray(R)){for(var K=0;K<R.length;++K)if(p(X,R[K]))return!0;return!1}else if(c(R))return X===R;else if(R instanceof RegExp)return R.test(X);else return!!R}function x(X,R){var K=R.headers.origin,M=[],Y;if(!X.origin||X.origin==="*")M.push([{key:"Access-Control-Allow-Origin",value:"*"}]);else if(c(X.origin))M.push([{key:"Access-Control-Allow-Origin",value:X.origin}]),M.push([{key:"Vary",value:"Origin"}]);else Y=p(K,X.origin),M.push([{key:"Access-Control-Allow-Origin",value:Y?K:!1}]),M.push([{key:"Vary",value:"Origin"}]);return M}function m(X){var R=X.methods;if(R.join)R=X.methods.join(",");return{key:"Access-Control-Allow-Methods",value:R}}function a(X){if(X.credentials===!0)return{key:"Access-Control-Allow-Credentials",value:"true"};return null}function f(X,R){var K=X.allowedHeaders||X.headers,M=[];if(!K)K=R.headers["access-control-request-headers"],M.push([{key:"Vary",value:"Access-Control-Request-Headers"}]);else if(K.join)K=K.join(",");if(K&&K.length)M.push([{key:"Access-Control-Allow-Headers",value:K}]);return M}function v(X){var R=X.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 $(X){var R=(typeof X.maxAge==="number"||X.maxAge)&&X.maxAge.toString();if(R&&R.length)return{key:"Access-Control-Max-Age",value:R};return null}function w(X,R){for(var K=0,M=X.length;K<M;K++){var Y=X[K];if(Y){if(Array.isArray(Y))w(Y,R);else if(Y.key==="Vary"&&Y.value)i(R,Y.value);else if(Y.value)R.setHeader(Y.key,Y.value)}}}function J(X,R,K,M){var Y=[],I=R.method&&R.method.toUpperCase&&R.method.toUpperCase();if(I==="OPTIONS")if(Y.push(x(X,R)),Y.push(a(X,R)),Y.push(m(X,R)),Y.push(f(X,R)),Y.push($(X,R)),Y.push(v(X,R)),w(Y,K),X.preflightContinue)M();else K.statusCode=X.optionsSuccessStatus,K.setHeader("Content-Length","0"),K.end();else Y.push(x(X,R)),Y.push(a(X,R)),Y.push(v(X,R)),w(Y,K),M()}function S(X){var R=null;if(typeof X==="function")R=X;else R=function(K,M){M(null,X)};return function K(M,Y,I){R(M,function(G,z){if(G)I(G);else{var E=n({},o,z),Q=null;if(E.origin&&typeof E.origin==="function")Q=E.origin;else if(E.origin)Q=function(b,y){y(null,E.origin)};if(Q)Q(M.headers.origin,function(b,y){if(b||!y)I(b);else E.origin=y,J(E,M,Y,I)});else I()}})}}v8.exports=S})()});var o$=C((R8)=>{Object.defineProperty(R8,"__esModule",{value:!0});R8.Server=R8.BaseServer=void 0;var I5=Kn("node:querystring"),y5=Kn("node:url"),$8=Dv(),Ma=gv(),k5=Kn("node:events"),w8=ev(),Z5=fi(),q5=o8(),s5=Kn("ws"),J8=dv(),P5=ux(),xn=Z5.default("engine"),Hp=Symbol("responseHeaders");function t5(n){try{let i=JSON.parse(n);if(typeof i.sid==="string")return i.sid}catch(i){}}class jx extends k5.EventEmitter{constructor(n={}){super();if(this.middlewares=[],this.clients={},this.clientsCount=0,this.opts=Object.assign({wsEngine:s5.Server,pingTimeout:20000,pingInterval:25000,upgradeTimeout:1e4,maxHttpBufferSize:1e6,transports:["polling","websocket"],allowUpgrades:!0,httpCompression:{threshold:1024},cors:!1,allowEIO3:!1},n),n.cookie)this.opts.cookie=Object.assign({name:"io",path:"/",httpOnly:n.cookie.path!==!1,sameSite:"lax"},n.cookie);if(this.opts.cors)this.use(i$()(this.opts.cors));if(n.perMessageDeflate)this.opts.perMessageDeflate=Object.assign({threshold:1024},n.perMessageDeflate);this.init()}_computePath(n){let i=(n.path||"/engine.io").replace(/\/$/,"");if(n.addTrailingSlash!==!1)i+="/";return i}upgrades(n){if(!this.opts.allowUpgrades)return[];return Ma.default[n].upgradesTo||[]}verify(n,i,o){let c=n._query.transport;if(!~this.opts.transports.indexOf(c)||c==="webtransport")return xn('unknown transport "%s"',c),o(zn.errors.UNKNOWN_TRANSPORT,{transport:c});if(r5(n.headers.origin)){let m=n.headers.origin;return n.headers.origin=null,xn("origin header invalid"),o(zn.errors.BAD_REQUEST,{name:"INVALID_ORIGIN",origin:m})}let x=n._query.sid;if(x){if(!this.clients.hasOwnProperty(x))return xn('unknown sid "%s"',x),o(zn.errors.UNKNOWN_SID,{sid:x});let m=this.clients[x].transport.name;if(!i&&m!==c)return xn("bad request: unexpected transport without upgrade"),o(zn.errors.BAD_REQUEST,{name:"TRANSPORT_MISMATCH",transport:c,previousTransport:m})}else{if(n.method!=="GET")return o(zn.errors.BAD_HANDSHAKE_METHOD,{method:n.method});if(c==="websocket"&&!i)return xn("invalid transport upgrade"),o(zn.errors.BAD_REQUEST,{name:"TRANSPORT_HANDSHAKE_ERROR"});if(!this.opts.allowRequest)return o();return this.opts.allowRequest(n,(m,a)=>{if(!a)return o(zn.errors.FORBIDDEN,{message:m});o()})}o()}use(n){this.middlewares.push(n)}_applyMiddlewares(n,i,o){if(this.middlewares.length===0)return xn("no middleware to apply, skipping"),o();let c=(p)=>{xn("applying middleware n\xB0%d",p+1),this.middlewares[p](n,i,(x)=>{if(x)return o(x);if(p+1<this.middlewares.length)c(p+1);else o()})};c(0)}close(){xn("closing all open clients");for(let n in this.clients)if(this.clients.hasOwnProperty(n))this.clients[n].close(!0);return this.cleanup(),this}generateId(n){return $8.generateId()}async handshake(n,i,o){let c=i._query.EIO==="4"?4:3;if(c===3&&!this.opts.allowEIO3){xn("unsupported protocol version"),this.emit("connection_error",{req:i,code:zn.errors.UNSUPPORTED_PROTOCOL_VERSION,message:zn.errorMessages[zn.errors.UNSUPPORTED_PROTOCOL_VERSION],context:{protocol:c}}),o(zn.errors.UNSUPPORTED_PROTOCOL_VERSION);return}let p;try{p=await this.generateId(i)}catch(a){xn("error while generating an id"),this.emit("connection_error",{req:i,code:zn.errors.BAD_REQUEST,message:zn.errorMessages[zn.errors.BAD_REQUEST],context:{name:"ID_GENERATION_ERROR",error:a}}),o(zn.errors.BAD_REQUEST);return}xn('handshaking client "%s"',p);try{var x=this.createTransport(n,i);if(n==="polling")x.maxHttpBufferSize=this.opts.maxHttpBufferSize,x.httpCompression=this.opts.httpCompression;else if(n==="websocket")x.perMessageDeflate=this.opts.perMessageDeflate}catch(a){xn('error handshaking to transport "%s"',n),this.emit("connection_error",{req:i,code:zn.errors.BAD_REQUEST,message:zn.errorMessages[zn.errors.BAD_REQUEST],context:{name:"TRANSPORT_HANDSHAKE_ERROR",error:a}}),o(zn.errors.BAD_REQUEST);return}let m=new w8.Socket(p,this,x,i,c);return x.on("headers",(a,f)=>{if(!f._query.sid){if(this.opts.cookie)a["Set-Cookie"]=[q5.serialize(this.opts.cookie.name,p,this.opts.cookie)];this.emit("initial_headers",a,f)}this.emit("headers",a,f)}),x.onRequest(i),this.clients[p]=m,this.clientsCount++,m.once("close",()=>{delete this.clients[p],this.clientsCount--}),this.emit("connection",m),x}async onWebTransportSession(n){let i=setTimeout(()=>{xn("the client failed to establish a bidirectional stream in the given period"),n.close()},this.opts.upgradeTimeout),c=await n.incomingBidirectionalStreams.getReader().read();if(c.done){xn("session is closed");return}let p=c.value,x=P5.createPacketDecoderStream(this.opts.maxHttpBufferSize,"nodebuffer"),m=p.readable.pipeThrough(x).getReader(),{value:a,done:f}=await m.read();if(f){xn("stream is closed");return}if(clearTimeout(i),a.type!=="open")return xn("invalid WebTransport handshake"),n.close();if(a.data===void 0){let w=new J8.WebTransport(n,p,m),J=$8.generateId();xn('handshaking client "%s" (WebTransport)',J);let S=new w8.Socket(J,this,w,null,4);this.clients[J]=S,this.clientsCount++,S.once("close",()=>{delete this.clients[J],this.clientsCount--}),this.emit("connection",S);return}let v=t5(a.data);if(!v)return xn("invalid WebTransport handshake"),n.close();let $=this.clients[v];if(!$)xn("upgrade attempt for closed client"),n.close();else if($.upgrading)xn("transport has already been trying to upgrade"),n.close();else if($.upgraded)xn("transport had already been upgraded"),n.close();else{xn("upgrading existing transport");let w=new J8.WebTransport(n,p,m);$._maybeUpgrade(w)}}}R8.BaseServer=jx;jx.errors={UNKNOWN_TRANSPORT:0,UNKNOWN_SID:1,BAD_HANDSHAKE_METHOD:2,BAD_REQUEST:3,FORBIDDEN:4,UNSUPPORTED_PROTOCOL_VERSION:5};jx.errorMessages={0:"Transport unknown",1:"Session ID unknown",2:"Bad handshake method",3:"Bad request",4:"Forbidden",5:"Unsupported protocol version"};class T8{constructor(n,i){this.req=n,this.socket=i,n[Hp]={}}setHeader(n,i){this.req[Hp][n]=i}getHeader(n){return this.req[Hp][n]}removeHeader(n){delete this.req[Hp][n]}write(){}writeHead(){}end(){this.socket.destroy()}}class zn extends jx{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",(n,i)=>{let o=i[Hp]||{};if(delete i[Hp],!i._query.sid)this.emit("initial_headers",o,i);this.emit("headers",o,i),xn("writing headers: %j",o),Object.keys(o).forEach((p)=>{n.push(`${p}: ${o[p]}`)})})}cleanup(){if(this.ws)xn("closing webSocketServer"),this.ws.close()}prepare(n){if(!n._query)n._query=~n.url.indexOf("?")?I5.parse(y5.parse(n.url).query):{}}createTransport(n,i){return new Ma.default[n](i)}handleRequest(n,i){xn('handling "%s" http request "%s"',n.method,n.url),this.prepare(n),n.res=i;let o=(c,p)=>{if(c!==void 0){this.emit("connection_error",{req:n,code:c,message:zn.errorMessages[c],context:p}),A8(i,c,p);return}if(n._query.sid)xn("setting new request for existing client"),this.clients[n._query.sid].transport.onRequest(n);else{let x=(m,a)=>A8(i,m,a);this.handshake(n._query.transport,n,x)}};this._applyMiddlewares(n,i,(c)=>{if(c)o(zn.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(n,!1,o)})}handleUpgrade(n,i,o){this.prepare(n);let c=new T8(n,i),p=(x,m)=>{if(x!==void 0){this.emit("connection_error",{req:n,code:x,message:zn.errorMessages[x],context:m}),F8(i,x,m);return}let a=Buffer.from(o);o=null,c.writeHead(),this.ws.handleUpgrade(n,i,a,(f)=>{this.onWebSocket(n,i,f)})};this._applyMiddlewares(n,c,(x)=>{if(x)p(zn.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(n,!0,p)})}onWebSocket(n,i,o){if(o.on("error",p),Ma.default[n._query.transport]!==void 0&&!Ma.default[n._query.transport].prototype.handlesUpgrades){xn("transport doesnt handle upgraded requests"),o.close();return}let c=n._query.sid;if(n.websocket=o,c){let x=this.clients[c];if(!x)xn("upgrade attempt for closed client"),o.close();else if(x.upgrading)xn("transport has already been trying to upgrade"),o.close();else if(x.upgraded)xn("transport had already been upgraded"),o.close();else{xn("upgrading existing transport"),o.removeListener("error",p);let m=this.createTransport(n._query.transport,n);m.perMessageDeflate=this.opts.perMessageDeflate,x._maybeUpgrade(m)}}else{let x=(m,a)=>F8(i,m,a);this.handshake(n._query.transport,n,x)}function p(){xn("websocket error before upgrade")}}attach(n,i={}){let o=this._computePath(i),c=i.destroyUpgradeTimeout||1000;function p(m){return o===m.url.slice(0,o.length)}let x=n.listeners("request").slice(0);if(n.removeAllListeners("request"),n.on("close",this.close.bind(this)),n.on("listening",this.init.bind(this)),n.on("request",(m,a)=>{if(p(m))xn('intercepting request for path "%s"',o),this.handleRequest(m,a);else{let f=0,v=x.length;for(;f<v;f++)x[f].call(n,m,a)}}),~this.opts.transports.indexOf("websocket"))n.on("upgrade",(m,a,f)=>{if(p(m))this.handleUpgrade(m,a,f);else if(i.destroyUpgrade!==!1)setTimeout(function(){if(a.writable&&a.bytesWritten<=0)return a.on("error",(v)=>{xn("error while destroying upgrade: %s",v.message)}),a.end()},c)})}}R8.Server=zn;function A8(n,i,o){let c=i===zn.errors.FORBIDDEN?403:400,p=o&&o.message?o.message:zn.errorMessages[i];n.writeHead(c,{"Content-Type":"application/json"}),n.end(JSON.stringify({code:i,message:p}))}function F8(n,i,o={}){if(n.on("error",()=>{xn("ignoring error from closed connection")}),n.writable){let c=o.message||zn.errorMessages[i],p=Buffer.byteLength(c);n.write(`HTTP/1.1 400 Bad Request\r
42
+ */kJ.exports=TS;kJ.exports.append=r5;var xS=/^[!#$%&'*+\-.^_`|~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(!xS.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 TS(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 hJ=a((Jpi,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,H=[],Z;if(!Y.origin||Y.origin==="*")H.push([{key:"Access-Control-Allow-Origin",value:"*"}]);else if(p(Y.origin))H.push([{key:"Access-Control-Allow-Origin",value:Y.origin}]),H.push([{key:"Vary",value:"Origin"}]);else Z=c(K,Y.origin),H.push([{key:"Access-Control-Allow-Origin",value:Z?K:!1}]),H.push([{key:"Vary",value:"Origin"}]);return H}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,H=[];if(!K)K=R.headers["access-control-request-headers"],H.push([{key:"Vary",value:"Access-Control-Request-Headers"}]);else if(K.join)K=K.join(",");if(K&&K.length)H.push([{key:"Access-Control-Allow-Headers",value:K}]);return H}function $(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 J(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 F(Y,R){for(var K=0,H=Y.length;K<H;K++){var Z=Y[K];if(Z){if(Array.isArray(Z))F(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,H){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(J(Y,R)),Z.push($(Y,R)),F(Z,K),Y.preflightContinue)H();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($(Y,R)),F(Z,K),H()}function X(Y){var R=null;if(typeof Y==="function")R=Y;else R=function(K,H){H(null,Y)};return function K(H,Z,b){R(H,function(u,M){if(u)b(u);else{var E=i({},n,M),V=null;if(E.origin&&typeof E.origin==="function")V=E.origin;else if(E.origin)V=function(C,l){l(null,E.origin)};if(V)V(H.headers.origin,function(C,l){if(C||!l)b(C);else E.origin=l,A(E,H,Z,b)});else b()}})}}i9.exports=X})()});var gJ=a((m9)=>{Object.defineProperty(m9,"__esModule",{value:!0});m9.Server=m9.BaseServer=void 0;var mS=Hi("querystring"),fS=Hi("url"),o9=VJ(),ef=lJ(),$S=Hi("events"),n9=qJ(),JS=Go(),FS=h5(),AS=Hi("ws"),p9=PJ(),vS=kT(),ci=JS.default("engine"),zx=Symbol("responseHeaders");function wS(i){try{let o=JSON.parse(i);if(typeof o.sid==="string")return o.sid}catch(o){}}class gT extends $S.EventEmitter{constructor(i={}){super();if(this.middlewares=[],this.clients={},this.clientsCount=0,this.opts=Object.assign({wsEngine:AS.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(hJ()(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 ef.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(Si.errors.UNKNOWN_TRANSPORT,{transport:p});if(XS(i.headers.origin)){let T=i.headers.origin;return i.headers.origin=null,ci("origin header invalid"),n(Si.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(Si.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(Si.errors.BAD_REQUEST,{name:"TRANSPORT_MISMATCH",transport:p,previousTransport:T})}else{if(i.method!=="GET")return n(Si.errors.BAD_HANDSHAKE_METHOD,{method:i.method});if(p==="websocket"&&!o)return ci("invalid transport upgrade"),n(Si.errors.BAD_REQUEST,{name:"TRANSPORT_HANDSHAKE_ERROR"});if(!this.opts.allowRequest)return n();return this.opts.allowRequest(i,(T,m)=>{if(!m)return n(Si.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:Si.errors.UNSUPPORTED_PROTOCOL_VERSION,message:Si.errorMessages[Si.errors.UNSUPPORTED_PROTOCOL_VERSION],context:{protocol:p}}),n(Si.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:Si.errors.BAD_REQUEST,message:Si.errorMessages[Si.errors.BAD_REQUEST],context:{name:"ID_GENERATION_ERROR",error:m}}),n(Si.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:Si.errors.BAD_REQUEST,message:Si.errorMessages[Si.errors.BAD_REQUEST],context:{name:"TRANSPORT_HANDSHAKE_ERROR",error:m}}),n(Si.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"]=[FS.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=vS.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 F=new p9.WebTransport(i,c,T),A=o9.generateId();ci('handshaking client "%s" (WebTransport)',A);let X=new n9.Socket(A,this,F,null,4);this.clients[A]=X,this.clientsCount++,X.once("close",()=>{delete this.clients[A],this.clientsCount--}),this.emit("connection",X);return}let $=wS(m.data);if(!$)return ci("invalid WebTransport handshake"),i.close();let J=this.clients[$];if(!J)ci("upgrade attempt for closed client"),i.close();else if(J.upgrading)ci("transport has already been trying to upgrade"),i.close();else if(J.upgraded)ci("transport had already been upgraded"),i.close();else{ci("upgrading existing transport");let F=new p9.WebTransport(i,c,T);J._maybeUpgrade(F)}}}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 Si 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("?")?mS.parse(fS.parse(i.url).query):{}}createTransport(i,o){return new ef.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:Si.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(Si.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:Si.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(Si.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(i,!0,c)})}onWebSocket(i,o,n){if(n.on("error",c),ef.default[i._query.transport]!==void 0&&!ef.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,$=x.length;for(;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",($)=>{ci("error while destroying upgrade: %s",$.message)}),m.end()},p)})}}m9.Server=Si;function c9(i,o,n){let p=o===Si.errors.FORBIDDEN?403:400,c=n&&n.message?n.message:Si.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||Si.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: `+p+`\r
45
+ Content-Length: `+c+`\r
46
46
  \r
47
- `+c)}n.destroy()}var Bx=[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 r5(n){if(n+="",n.length<1)return!1;if(!Bx[n.charCodeAt(0)])return xn('invalid header, index 0, char "%s"',n.charCodeAt(0)),!0;if(n.length<2)return!1;if(!Bx[n.charCodeAt(1)])return xn('invalid header, index 1, char "%s"',n.charCodeAt(1)),!0;if(n.length<3)return!1;if(!Bx[n.charCodeAt(2)])return xn('invalid header, index 2, char "%s"',n.charCodeAt(2)),!0;if(n.length<4)return!1;if(!Bx[n.charCodeAt(3)])return xn('invalid header, index 3, char "%s"',n.charCodeAt(3)),!0;for(let i=4;i<n.length;++i)if(!Bx[n.charCodeAt(i)])return xn('invalid header, index "%i", char "%s"',i,n.charCodeAt(i)),!0;return!1}});var G8=C((K8)=>{Object.defineProperty(K8,"__esModule",{value:!0});K8.Polling=void 0;var g5=_c(),X8=Kn("node:zlib"),e5=va(),nl=fi(),ei=nl.default("engine:polling"),il={gzip:X8.createGzip,deflate:X8.createDeflate};class W8 extends g5.Transport{constructor(n){super(n);this.closeTimeout=30000}get name(){return"polling"}onRequest(n){let i=n.res;if(n.res=null,n.getMethod()==="get")this.onPollRequest(n,i);else if(n.getMethod()==="post")this.onDataRequest(n,i);else i.writeStatus("500 Internal Server Error"),i.end()}onPollRequest(n,i){if(this.req){ei("request overlap"),this.onError("overlap from client"),i.writeStatus("500 Internal Server Error"),i.end();return}ei("setting request"),this.req=n,this.res=i;let o=()=>{this.writable=!1,this.onError("poll connection closed prematurely")},c=()=>{this.req=this.res=null};if(n.cleanup=c,i.onAborted(o),this.writable=!0,this.emit("ready"),this.writable&&this.shouldClose)ei("triggering empty send to append close packet"),this.send([{type:"noop"}])}onDataRequest(n,i){if(this.dataReq){this.onError("data request overlap from client"),i.writeStatus("500 Internal Server Error"),i.end();return}let o=Number(n.headers["content-length"]);if(!o){this.onError("content-length header required"),i.writeStatus("411 Length Required").end();return}if(o>this.maxHttpBufferSize){this.onError("payload too large"),i.writeStatus("413 Payload Too Large").end();return}if(n.headers["content-type"]==="application/octet-stream"&&this.protocol===4)return this.onError("invalid content");this.dataReq=n,this.dataRes=i;let p,x=0,m={"Content-Type":"text/html"};this.headers(n,m);for(let f in m)i.writeHeader(f,String(m[f]));let a=(f)=>{this.onData(f.toString()),this.onDataRequestCleanup(),i.cork(()=>{i.end("ok")})};i.onAborted(()=>{this.onDataRequestCleanup(),this.onError("data request connection closed prematurely")}),i.onData((f,v)=>{let $=x+f.byteLength;if($>o){this.onError("content-length mismatch"),i.close();return}if(!p){if(v){a(Buffer.from(f));return}p=Buffer.allocUnsafe(o)}if(Buffer.from(f).copy(p,x),v){if($!=o){this.onError("content-length mismatch"),i.writeStatus("400 Content-Length Mismatch").end(),this.onDataRequestCleanup();return}a(p);return}x=$})}onDataRequestCleanup(){this.dataReq=this.dataRes=null}onData(n){ei('received "%s"',n);let i=(o)=>{if(o.type==="close")return ei("got xhr close packet"),this.onClose(),!1;this.onPacket(o)};if(this.protocol===3)this.parser.decodePayload(n,i);else this.parser.decodePayload(n).forEach(i)}onClose(){if(this.writable)this.send([{type:"noop"}]);super.onClose()}send(n){if(this.writable=!1,this.shouldClose)ei("appending close packet to payload"),n.push({type:"close"}),this.shouldClose(),this.shouldClose=null;let i=(o)=>{let c=n.some((p)=>{return p.options&&p.options.compress});this.write(o,{compress:c})};if(this.protocol===3)this.parser.encodePayload(n,this.supportsBinary,i);else this.parser.encodePayload(n,i)}write(n,i){ei('writing "%s"',n),this.doWrite(n,i,()=>{this.req.cleanup(),this.emit("drain")})}doWrite(n,i,o){let c=typeof n==="string",x={"Content-Type":c?"text/plain; charset=UTF-8":"application/octet-stream"},m=(v)=>{this.headers(this.req,x),this.res.cork(()=>{Object.keys(x).forEach(($)=>{this.res.writeHeader($,String(x[$]))}),this.res.end(v)}),o()};if(!this.httpCompression||!i.compress){m(n);return}if((c?Buffer.byteLength(n):n.length)<this.httpCompression.threshold){m(n);return}let f=e5(this.req).encodings(["gzip","deflate"]);if(!f){m(n);return}this.compress(n,f,(v,$)=>{if(v){this.res.writeStatus("500 Internal Server Error"),this.res.end(),o(v);return}x["Content-Encoding"]=f,m($)})}compress(n,i,o){ei("compressing");let c=[],p=0;il[i](this.httpCompression).on("error",o).on("data",function(x){c.push(x),p+=x.length}).on("end",function(){o(null,Buffer.concat(c,p))}).end(n)}doClose(n){ei("closing");let i,o=()=>{clearTimeout(i),n(),this.onClose()};if(this.writable)ei("transport writable - closing right away"),this.send([{type:"close"}]),o();else if(this.discarded)ei("transport discarded - closing right away"),o();else ei("transport not writable - buffering orderly close"),this.shouldClose=o,i=setTimeout(o,this.closeTimeout)}headers(n,i){i=i||{};let o=n.headers["user-agent"];if(o&&(~o.indexOf(";MSIE")||~o.indexOf("Trident/")))i["X-XSS-Protection"]="0";return i["cache-control"]="no-store",this.emit("headers",i,n),i}}K8.Polling=W8});var Q8=C((H8)=>{Object.defineProperty(H8,"__esModule",{value:!0});H8.WebSocket=void 0;var ol=_c(),cl=fi(),M8=cl.default("engine:ws");class Y8 extends ol.Transport{constructor(n){super(n);this.writable=!1,this.perMessageDeflate=null}get name(){return"websocket"}get handlesUpgrades(){return!0}send(n){this.writable=!1;for(let i=0;i<n.length;i++){let o=n[i],c=i+1===n.length,p=(x)=>{let m=typeof x!=="string",a=this.perMessageDeflate&&Buffer.byteLength(x)>this.perMessageDeflate.threshold;if(M8('writing "%s"',x),this.socket.send(x,m,a),c)this.emit("drain"),this.writable=!0,this.emit("ready")};if(o.options&&typeof o.options.wsPreEncoded==="string")p(o.options.wsPreEncoded);else this.parser.encodePacket(o,this.supportsBinary,p)}}doClose(n){M8("closing"),n&&n(),this.socket.end()}}H8.WebSocket=Y8});var O8=C((E8)=>{Object.defineProperty(E8,"__esModule",{value:!0});var pl=G8(),xl=Q8();E8.default={polling:pl.Polling,websocket:xl.WebSocket}});var u8=C((_8)=>{Object.defineProperty(_8,"__esModule",{value:!0});_8.uServer=void 0;var al=fi(),bc=o$(),fl=O8(),pc=al.default("engine:uws");class U8 extends bc.BaseServer{init(){}cleanup(){}prepare(n,i){n.method=n.getMethod().toUpperCase(),n.url=n.getUrl();let o=new URLSearchParams(n.getQuery());n._query=Object.fromEntries(o.entries()),n.headers={},n.forEach((c,p)=>{n.headers[c]=p}),n.connection={remoteAddress:Buffer.from(i.getRemoteAddressAsText()).toString()},i.onAborted(()=>{pc("response has been aborted")})}createTransport(n,i){return new fl.default[n](i)}attach(n,i={}){let o=this._computePath(i);n.any(o,this.handleRequest.bind(this)).ws(o,{compression:i.compression,idleTimeout:i.idleTimeout,maxBackpressure:i.maxBackpressure,maxPayloadLength:this.opts.maxHttpBufferSize,upgrade:this.handleUpgrade.bind(this),open:(c)=>{let p=c.getUserData().transport;p.socket=c,p.writable=!0,p.emit("ready")},message:(c,p,x)=>{c.getUserData().transport.onData(x?p:Buffer.from(p).toString())},close:(c,p,x)=>{c.getUserData().transport.onClose(p,x)}})}_applyMiddlewares(n,i,o){if(this.middlewares.length===0)return o();n.res=new V8(i),super._applyMiddlewares(n,n.res,(c)=>{n.res.writeHead(),o(c)})}handleRequest(n,i){pc('handling "%s" http request "%s"',i.getMethod(),i.getUrl()),this.prepare(i,n),i.res=n;let o=(c,p)=>{if(c!==void 0){this.emit("connection_error",{req:i,code:c,message:bc.Server.errorMessages[c],context:p}),this.abortRequest(i.res,c,p);return}if(i._query.sid)pc("setting new request for existing client"),this.clients[i._query.sid].transport.onRequest(i);else{let x=(m,a)=>this.abortRequest(n,m,a);this.handshake(i._query.transport,i,x)}};this._applyMiddlewares(i,n,(c)=>{if(c)o(bc.Server.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(i,!1,o)})}handleUpgrade(n,i,o){pc("on upgrade"),this.prepare(i,n),i.res=n;let c=async(p,x)=>{if(p!==void 0){this.emit("connection_error",{req:i,code:p,message:bc.Server.errorMessages[p],context:x}),this.abortRequest(n,p,x);return}let m=i._query.sid,a;if(m){let f=this.clients[m];if(!f)return pc("upgrade attempt for closed client"),n.close();else if(f.upgrading)return pc("transport has already been trying to upgrade"),n.close();else if(f.upgraded)return pc("transport had already been upgraded"),n.close();else pc("upgrading existing transport"),a=this.createTransport(i._query.transport,i),f._maybeUpgrade(a)}else if(a=await this.handshake(i._query.transport,i,(f,v)=>this.abortRequest(n,f,v)),!a)return;i.res.writeStatus("101 Switching Protocols"),n.upgrade({transport:a},i.getHeader("sec-websocket-key"),i.getHeader("sec-websocket-protocol"),i.getHeader("sec-websocket-extensions"),o)};this._applyMiddlewares(i,n,(p)=>{if(p)c(bc.Server.errors.BAD_REQUEST,{name:"MIDDLEWARE_FAILURE"});else this.verify(i,!0,c)})}abortRequest(n,i,o){let c=i===bc.Server.errors.FORBIDDEN?"403 Forbidden":"400 Bad Request",p=o&&o.message?o.message:bc.Server.errorMessages[i];n.writeStatus(c),n.writeHeader("Content-Type","application/json"),n.end(JSON.stringify({code:i,message:p}))}}_8.uServer=U8;class V8{constructor(n){this.res=n,this.statusWritten=!1,this.headers=[],this.isAborted=!1}set statusCode(n){if(!n)return;this.writeStatus(n===200?"200 OK":"204 No Content")}writeHead(n){this.statusCode=n}setHeader(n,i){if(Array.isArray(i))i.forEach((o)=>{this.writeHeader(n,o)});else this.writeHeader(n,i)}removeHeader(){}getHeader(){}writeStatus(n){if(this.isAborted)return;return this.res.writeStatus(n),this.statusWritten=!0,this.writeBufferedHeaders(),this}writeHeader(n,i){if(this.isAborted)return;if(n==="Content-Length")return;if(this.statusWritten)this.res.writeHeader(n,i);else this.headers.push([n,i])}writeBufferedHeaders(){this.headers.forEach(([n,i])=>{this.res.writeHeader(n,i)})}end(n){if(this.isAborted)return;this.res.cork(()=>{if(!this.statusWritten)this.writeBufferedHeaders();this.res.end(n)})}onData(n){if(this.isAborted)return;this.res.onData(n)}onAborted(n){if(this.isAborted)return;this.res.onAborted(()=>{this.isAborted=!0,n()})}cork(n){if(this.isAborted)return;this.res.cork(n)}}});var N8=C((zp)=>{Object.defineProperty(zp,"__esModule",{value:!0});zp.protocol=zp.Transport=zp.Socket=zp.uServer=zp.parser=zp.transports=zp.Server=void 0;zp.listen=Fl;zp.attach=D8;var vl=Kn("node:http"),B8=o$();Object.defineProperty(zp,"Server",{enumerable:!0,get:function(){return B8.Server}});var $l=gv();zp.transports=$l.default;var j8=ux();zp.parser=j8;var wl=u8();Object.defineProperty(zp,"uServer",{enumerable:!0,get:function(){return wl.uServer}});var Jl=ev();Object.defineProperty(zp,"Socket",{enumerable:!0,get:function(){return Jl.Socket}});var Al=_c();Object.defineProperty(zp,"Transport",{enumerable:!0,get:function(){return Al.Transport}});zp.protocol=j8.protocol;function Fl(n,i,o){if(typeof i==="function")o=i,i={};let c=vl.createServer(function(x,m){m.writeHead(501),m.end("Not Implemented")}),p=D8(c,i);return p.httpServer=c,c.listen(n,o),p}function D8(n,i){let o=new B8.Server(i);return o.attach(n,i),o}});var h8=C((Kl)=>{Kl.Emitter=Ei;function Ei(n){if(n)return Wl(n)}function Wl(n){for(var i in Ei.prototype)n[i]=Ei.prototype[i];return n}Ei.prototype.on=Ei.prototype.addEventListener=function(n,i){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(i),this};Ei.prototype.once=function(n,i){function o(){this.off(n,o),i.apply(this,arguments)}return o.fn=i,this.on(n,o),this};Ei.prototype.off=Ei.prototype.removeListener=Ei.prototype.removeAllListeners=Ei.prototype.removeEventListener=function(n,i){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var o=this._callbacks["$"+n];if(!o)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;var c;for(var p=0;p<o.length;p++)if(c=o[p],c===i||c.fn===i){o.splice(p,1);break}if(o.length===0)delete this._callbacks["$"+n];return this};Ei.prototype.emit=function(n){this._callbacks=this._callbacks||{};var i=new Array(arguments.length-1),o=this._callbacks["$"+n];for(var c=1;c<arguments.length;c++)i[c-1]=arguments[c];if(o){o=o.slice(0);for(var c=0,p=o.length;c<p;++c)o[c].apply(this,i)}return this};Ei.prototype.emitReserved=Ei.prototype.emit;Ei.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Ei.prototype.hasListeners=function(n){return!!this.listeners(n).length}});var c$=C((y8)=>{Object.defineProperty(y8,"__esModule",{value:!0});y8.hasBinary=y8.isBinary=void 0;var Gl=typeof ArrayBuffer==="function",Ml=(n)=>{return typeof ArrayBuffer.isView==="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer},C8=Object.prototype.toString,Yl=typeof Blob==="function"||typeof Blob!=="undefined"&&C8.call(Blob)==="[object BlobConstructor]",Hl=typeof File==="function"||typeof File!=="undefined"&&C8.call(File)==="[object FileConstructor]";function I8(n){return Gl&&(n instanceof ArrayBuffer||Ml(n))||Yl&&n instanceof Blob||Hl&&n instanceof File}y8.isBinary=I8;function Ya(n,i){if(!n||typeof n!=="object")return!1;if(Array.isArray(n)){for(let o=0,c=n.length;o<c;o++)if(Ya(n[o]))return!0;return!1}if(I8(n))return!0;if(n.toJSON&&typeof n.toJSON==="function"&&arguments.length===1)return Ya(n.toJSON(),!0);for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&Ya(n[o]))return!0;return!1}y8.hasBinary=Ya});var s8=C((Z8)=>{Object.defineProperty(Z8,"__esModule",{value:!0});Z8.reconstructPacket=Z8.deconstructPacket=void 0;var Ql=c$();function El(n){let i=[],o=n.data,c=n;return c.data=p$(o,i),c.attachments=i.length,{packet:c,buffers:i}}Z8.deconstructPacket=El;function p$(n,i){if(!n)return n;if(Ql.isBinary(n)){let o={_placeholder:!0,num:i.length};return i.push(n),o}else if(Array.isArray(n)){let o=new Array(n.length);for(let c=0;c<n.length;c++)o[c]=p$(n[c],i);return o}else if(typeof n==="object"&&!(n instanceof Date)){let o={};for(let c in n)if(Object.prototype.hasOwnProperty.call(n,c))o[c]=p$(n[c],i);return o}return n}function Ol(n,i){return n.data=x$(n.data,i),delete n.attachments,n}Z8.reconstructPacket=Ol;function x$(n,i){if(!n)return n;if(n&&n._placeholder===!0)if(typeof n.num==="number"&&n.num>=0&&n.num<i.length)return i[n.num];else throw new Error("illegal attachments");else if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o]=x$(n[o],i);else if(typeof n==="object"){for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o))n[o]=x$(n[o],i)}return n}});var Dx=C((n6)=>{Object.defineProperty(n6,"__esModule",{value:!0});n6.Decoder=n6.Encoder=n6.PacketType=n6.protocol=void 0;var Vl=h8(),r8=s8(),d8=c$(),_l=fi(),m$=_l.default("socket.io-parser"),bl=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];n6.protocol=5;var yn;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(yn=n6.PacketType||(n6.PacketType={}));class g8{constructor(n){this.replacer=n}encode(n){if(m$("encoding packet %j",n),n.type===yn.EVENT||n.type===yn.ACK){if(d8.hasBinary(n))return this.encodeAsBinary({type:n.type===yn.EVENT?yn.BINARY_EVENT:yn.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id})}return[this.encodeAsString(n)]}encodeAsString(n){let i=""+n.type;if(n.type===yn.BINARY_EVENT||n.type===yn.BINARY_ACK)i+=n.attachments+"-";if(n.nsp&&n.nsp!=="/")i+=n.nsp+",";if(n.id!=null)i+=n.id;if(n.data!=null)i+=JSON.stringify(n.data,this.replacer);return m$("encoded %j as %s",n,i),i}encodeAsBinary(n){let i=r8.deconstructPacket(n),o=this.encodeAsString(i.packet),c=i.buffers;return c.unshift(o),c}}n6.Encoder=g8;function P8(n){return Object.prototype.toString.call(n)==="[object Object]"}class a$ extends Vl.Emitter{constructor(n){super();this.reviver=n}add(n){let i;if(typeof n==="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(n);let o=i.type===yn.BINARY_EVENT;if(o||i.type===yn.BINARY_ACK){if(i.type=o?yn.EVENT:yn.ACK,this.reconstructor=new e8(i),i.attachments===0)super.emitReserved("decoded",i)}else super.emitReserved("decoded",i)}else if(d8.isBinary(n)||n.base64){if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");else if(i=this.reconstructor.takeBinaryData(n),i)this.reconstructor=null,super.emitReserved("decoded",i)}else throw new Error("Unknown type: "+n)}decodeString(n){let i=0,o={type:Number(n.charAt(0))};if(yn[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===yn.BINARY_EVENT||o.type===yn.BINARY_ACK){let p=i+1;while(n.charAt(++i)!=="-"&&i!=n.length);let x=n.substring(p,i);if(x!=Number(x)||n.charAt(i)!=="-")throw new Error("Illegal attachments");o.attachments=Number(x)}if(n.charAt(i+1)==="/"){let p=i+1;while(++i){if(n.charAt(i)===",")break;if(i===n.length)break}o.nsp=n.substring(p,i)}else o.nsp="/";let c=n.charAt(i+1);if(c!==""&&Number(c)==c){let p=i+1;while(++i){let x=n.charAt(i);if(x==null||Number(x)!=x){--i;break}if(i===n.length)break}o.id=Number(n.substring(p,i+1))}if(n.charAt(++i)){let p=this.tryParse(n.substr(i));if(a$.isPayloadValid(o.type,p))o.data=p;else throw new Error("invalid payload")}return m$("decoded %s as %j",n,o),o}tryParse(n){try{return JSON.parse(n,this.reviver)}catch(i){return!1}}static isPayloadValid(n,i){switch(n){case yn.CONNECT:return P8(i);case yn.DISCONNECT:return i===void 0;case yn.CONNECT_ERROR:return typeof i==="string"||P8(i);case yn.EVENT:case yn.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]==="number"||typeof i[0]==="string"&&bl.indexOf(i[0])===-1);case yn.ACK:case yn.BINARY_ACK:return Array.isArray(i)}}destroy(){if(this.reconstructor)this.reconstructor.finishedReconstruction(),this.reconstructor=null}}n6.Decoder=a$;class e8{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){let i=r8.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}});var x6=C((c6)=>{Object.defineProperty(c6,"__esModule",{value:!0});c6.Client=void 0;var Ha=Dx(),jl=fi(),Dl=Kn("node:url"),wo=jl("socket.io:client");class o6{constructor(n,i){this.sockets=new Map,this.nsps=new Map,this.server=n,this.conn=i,this.encoder=n.encoder,this.decoder=new n._parser.Decoder,this.id=i.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)wo("no namespace joined yet, close the client"),this.close();else wo("the client has already joined a namespace, nothing to do")},this.server._connectTimeout)}connect(n,i={}){if(this.server._nsps.has(n))return wo("connecting to namespace %s",n),this.doConnect(n,i);this.server._checkNamespace(n,i,(o)=>{if(o)this.doConnect(n,i);else wo("creation of namespace %s was denied",n),this._packet({type:Ha.PacketType.CONNECT_ERROR,nsp:n,data:{message:"Invalid namespace"}})})}doConnect(n,i){let o=this.server.of(n);o._add(this,i,(c)=>{if(this.sockets.set(c.id,c),this.nsps.set(o.name,c),this.connectTimeout)clearTimeout(this.connectTimeout),this.connectTimeout=void 0})}_disconnect(){for(let n of this.sockets.values())n.disconnect();this.sockets.clear(),this.close()}_remove(n){if(this.sockets.has(n.id)){let i=this.sockets.get(n.id).nsp.name;this.sockets.delete(n.id),this.nsps.delete(i)}else wo("ignoring remove for %s",n.id)}close(){if(this.conn.readyState==="open")wo("forcing transport close"),this.conn.close(),this.onclose("forced server close")}_packet(n,i={}){if(this.conn.readyState!=="open"){wo("ignoring packet write %j",n);return}let o=i.preEncoded?n:this.encoder.encode(n);this.writeToEngine(o,i)}writeToEngine(n,i){if(i.volatile&&!this.conn.transport.writable){wo("volatile packet is discarded since the transport is not currently writable");return}let o=Array.isArray(n)?n:[n];for(let c of o)this.conn.write(c,i)}ondata(n){try{this.decoder.add(n)}catch(i){wo("invalid packet format"),this.onerror(i)}}ondecoded(n){let i,o;if(this.conn.protocol===3){let p=Dl.parse(n.nsp,!0);i=p.pathname,o=p.query}else i=n.nsp,o=n.data;let c=this.nsps.get(i);if(!c&&n.type===Ha.PacketType.CONNECT)this.connect(i,o);else if(c&&n.type!==Ha.PacketType.CONNECT&&n.type!==Ha.PacketType.CONNECT_ERROR)process.nextTick(function(){c._onpacket(n)});else wo("invalid state (packet type: %s)",n.type),this.close()}onerror(n){for(let i of this.sockets.values())i._onerror(n);this.conn.close()}onclose(n,i){wo("client close with reason %s",n),this.destroy();for(let o of this.sockets.values())o._onclose(n,i);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}}c6.Client=o6});var za=C((a6)=>{Object.defineProperty(a6,"__esModule",{value:!0});a6.StrictEventEmitter=void 0;var Ll=Kn("node:events");class m6 extends Ll.EventEmitter{on(n,i){return super.on(n,i)}once(n,i){return super.once(n,i)}emit(n,...i){return super.emit(n,...i)}emitReserved(n,...i){return super.emit(n,...i)}emitUntyped(n,...i){return super.emit(n,...i)}listeners(n){return super.listeners(n)}}a6.StrictEventEmitter=m6});var f$=C((v6)=>{Object.defineProperty(v6,"__esModule",{value:!0});v6.RESERVED_EVENTS=void 0;v6.RESERVED_EVENTS=new Set(["connect","connect_error","disconnect","disconnecting","newListener","removeListener"])});var $$=C((w6)=>{Object.defineProperty(w6,"__esModule",{value:!0});w6.RemoteSocket=w6.BroadcastOperator=void 0;var Nl=f$(),hl=Dx();class Bo{constructor(n,i=new Set,o=new Set,c={}){this.adapter=n,this.rooms=i,this.exceptRooms=o,this.flags=c}to(n){let i=new Set(this.rooms);if(Array.isArray(n))n.forEach((o)=>i.add(o));else i.add(n);return new Bo(this.adapter,i,this.exceptRooms,this.flags)}in(n){return this.to(n)}except(n){let i=new Set(this.exceptRooms);if(Array.isArray(n))n.forEach((o)=>i.add(o));else i.add(n);return new Bo(this.adapter,this.rooms,i,this.flags)}compress(n){let i=Object.assign({},this.flags,{compress:n});return new Bo(this.adapter,this.rooms,this.exceptRooms,i)}get volatile(){let n=Object.assign({},this.flags,{volatile:!0});return new Bo(this.adapter,this.rooms,this.exceptRooms,n)}get local(){let n=Object.assign({},this.flags,{local:!0});return new Bo(this.adapter,this.rooms,this.exceptRooms,n)}timeout(n){let i=Object.assign({},this.flags,{timeout:n});return new Bo(this.adapter,this.rooms,this.exceptRooms,i)}emit(n,...i){if(Nl.RESERVED_EVENTS.has(n))throw new Error(`"${String(n)}" is a reserved event name`);let o=[n,...i],c={type:hl.PacketType.EVENT,data:o};if(typeof o[o.length-1]!=="function")return this.adapter.broadcast(c,{rooms:this.rooms,except:this.exceptRooms,flags:this.flags}),!0;let x=o.pop(),m=!1,a=[],f=setTimeout(()=>{m=!0,x.apply(this,[new Error("operation has timed out"),this.flags.expectSingleResponse?null:a])},this.flags.timeout),v=-1,$=0,w=0,J=()=>{if(!m&&v===$&&a.length===w)clearTimeout(f),x.apply(this,[null,this.flags.expectSingleResponse?a[0]:a])};return this.adapter.broadcastWithAck(c,{rooms:this.rooms,except:this.exceptRooms,flags:this.flags},(S)=>{w+=S,$++,J()},(S)=>{a.push(S),J()}),this.adapter.serverCount().then((S)=>{v=S,J()}),!0}emitWithAck(n,...i){return new Promise((o,c)=>{i.push((p,x)=>{if(p)return p.responses=x,c(p);else return o(x)}),this.emit(n,...i)})}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((n)=>{return n.map((i)=>{if(i.server)return i;else return new v$(this.adapter,i)})})}socketsJoin(n){this.adapter.addSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},Array.isArray(n)?n:[n])}socketsLeave(n){this.adapter.delSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},Array.isArray(n)?n:[n])}disconnectSockets(n=!1){this.adapter.disconnectSockets({rooms:this.rooms,except:this.exceptRooms,flags:this.flags},n)}}w6.BroadcastOperator=Bo;class v${constructor(n,i){this.id=i.id,this.handshake=i.handshake,this.rooms=new Set(i.rooms),this.data=i.data,this.operator=new Bo(n,new Set([this.id]),new Set,{expectSingleResponse:!0})}timeout(n){return this.operator.timeout(n)}emit(n,...i){return this.operator.emit(n,...i)}join(n){return this.operator.socketsJoin(n)}leave(n){return this.operator.socketsLeave(n)}disconnect(n=!1){return this.operator.disconnectSockets(n),this}}w6.RemoteSocket=v$});var w$=C((Qp)=>{var T6=Qp&&Qp.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Qp,"__esModule",{value:!0});Qp.Socket=void 0;var no=Dx(),Il=T6(fi()),yl=za(),A6=T6(Dv()),kl=$$(),Zl=f$(),Gi=Il.default("socket.io:socket"),ql=new Set(["transport error","transport close","forced close","ping timeout","server shutting down","forced server close"]);function F6(){}class R6 extends yl.StrictEventEmitter{constructor(n,i,o,c){super();if(this.nsp=n,this.client=i,this.recovered=!1,this.data={},this.connected=!1,this.acks=new Map,this.fns=[],this.flags={},this.server=n.server,this.adapter=this.nsp.adapter,c)this.id=c.sid,this.pid=c.pid,c.rooms.forEach((p)=>this.join(p)),this.data=c.data,c.missedPackets.forEach((p)=>{this.packet({type:no.PacketType.EVENT,data:p})}),this.recovered=!0;else{if(i.conn.protocol===3)this.id=n.name!=="/"?n.name+"#"+i.id:i.id;else this.id=A6.default.generateId();if(this.server._opts.connectionStateRecovery)this.pid=A6.default.generateId()}this.handshake=this.buildHandshake(o),this.on("error",F6)}buildHandshake(n){var i,o,c,p;return{headers:((i=this.request)===null||i===void 0?void 0:i.headers)||{},time:new Date+"",address:this.conn.remoteAddress,xdomain:!!((o=this.request)===null||o===void 0?void 0:o.headers.origin),secure:!this.request||!!this.request.connection.encrypted,issued:+new Date,url:(c=this.request)===null||c===void 0?void 0:c.url,query:((p=this.request)===null||p===void 0?void 0:p._query)||{},auth:n}}emit(n,...i){if(Zl.RESERVED_EVENTS.has(n))throw new Error(`"${String(n)}" is a reserved event name`);let o=[n,...i],c={type:no.PacketType.EVENT,data:o};if(typeof o[o.length-1]==="function"){let x=this.nsp._ids++;Gi("emitting packet with ack id %d",x),this.registerAckCallback(x,o.pop()),c.id=x}let p=Object.assign({},this.flags);if(this.flags={},this.nsp.server.opts.connectionStateRecovery)this.adapter.broadcast(c,{rooms:new Set([this.id]),except:new Set,flags:p});else this.notifyOutgoingListeners(c),this.packet(c,p);return!0}emitWithAck(n,...i){let o=this.flags.timeout!==void 0;return new Promise((c,p)=>{i.push((x,m)=>{if(o)return x?p(x):c(m);else return c(x)}),this.emit(n,...i)})}registerAckCallback(n,i){let o=this.flags.timeout;if(o===void 0){this.acks.set(n,i);return}let c=setTimeout(()=>{Gi("event with ack id %d has timed out after %d ms",n,o),this.acks.delete(n),i.call(this,new Error("operation has timed out"))},o);this.acks.set(n,(...p)=>{clearTimeout(c),i.apply(this,[null,...p])})}to(n){return this.newBroadcastOperator().to(n)}in(n){return this.newBroadcastOperator().in(n)}except(n){return this.newBroadcastOperator().except(n)}send(...n){return this.emit("message",...n),this}write(...n){return this.emit("message",...n),this}packet(n,i={}){n.nsp=this.nsp.name,i.compress=i.compress!==!1,this.client._packet(n,i)}join(n){return Gi("join room %s",n),this.adapter.addAll(this.id,new Set(Array.isArray(n)?n:[n]))}leave(n){return Gi("leave room %s",n),this.adapter.del(this.id,n)}leaveAll(){this.adapter.delAll(this.id)}_onconnect(){if(Gi("socket connected - writing packet"),this.connected=!0,this.join(this.id),this.conn.protocol===3)this.packet({type:no.PacketType.CONNECT});else this.packet({type:no.PacketType.CONNECT,data:{sid:this.id,pid:this.pid}})}_onpacket(n){switch(Gi("got packet %j",n),n.type){case no.PacketType.EVENT:this.onevent(n);break;case no.PacketType.BINARY_EVENT:this.onevent(n);break;case no.PacketType.ACK:this.onack(n);break;case no.PacketType.BINARY_ACK:this.onack(n);break;case no.PacketType.DISCONNECT:this.ondisconnect();break}}onevent(n){let i=n.data||[];if(Gi("emitting event %j",i),n.id!=null)Gi("attaching ack callback to event"),i.push(this.ack(n.id));if(this._anyListeners&&this._anyListeners.length){let o=this._anyListeners.slice();for(let c of o)c.apply(this,i)}this.dispatch(i)}ack(n){let i=this,o=!1;return function(){if(o)return;let c=Array.prototype.slice.call(arguments);Gi("sending ack %j",c),i.packet({id:n,type:no.PacketType.ACK,data:c}),o=!0}}onack(n){let i=this.acks.get(n.id);if(typeof i=="function")Gi("calling ack %s with %j",n.id,n.data),i.apply(this,n.data),this.acks.delete(n.id);else Gi("bad ack %s",n.id)}ondisconnect(){Gi("got disconnect packet"),this._onclose("client namespace disconnect")}_onerror(n){this.emitReserved("error",n)}_onclose(n,i){if(!this.connected)return this;if(Gi("closing socket - reason %s",n),this.emitReserved("disconnecting",n,i),this.server._opts.connectionStateRecovery&&ql.has(n))Gi("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",n,i);return}_cleanup(){this.leaveAll(),this.nsp._remove(this),this.join=F6}_error(n){this.packet({type:no.PacketType.CONNECT_ERROR,data:n})}disconnect(n=!1){if(!this.connected)return this;if(n)this.client._disconnect();else this.packet({type:no.PacketType.DISCONNECT}),this._onclose("server namespace disconnect");return this}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}get broadcast(){return this.newBroadcastOperator()}get local(){return this.newBroadcastOperator().local}timeout(n){return this.flags.timeout=n,this}dispatch(n){Gi("dispatching an event %j",n),this.run(n,(i)=>{process.nextTick(()=>{if(i)return this._onerror(i);if(this.connected)super.emitUntyped.apply(this,n);else Gi("ignore packet received after disconnection")})})}use(n){return this.fns.push(n),this}run(n,i){if(!this.fns.length)return i();let o=this.fns.slice(0);function c(p){o[p](n,(x)=>{if(x)return i(x);if(!o[p+1])return i();c(p+1)})}c(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(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){let i=this._anyListeners;for(let o=0;o<i.length;o++)if(n===i[o])return i.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){let i=this._anyOutgoingListeners;for(let o=0;o<i.length;o++)if(n===i[o])return i.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let i=this._anyOutgoingListeners.slice();for(let o of i)o.apply(this,n.data)}}newBroadcastOperator(){let n=Object.assign({},this.flags);return this.flags={},new kl.BroadcastOperator(this.adapter,new Set,new Set([this.id]),n)}}Qp.Socket=R6});var J$=C((jo)=>{var sl=jo&&jo.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(jo,"__esModule",{value:!0});jo.Namespace=jo.RESERVED_EVENTS=void 0;var S6=w$(),Pl=za(),tl=sl(fi()),Ii=$$(),Lx=tl.default("socket.io:namespace");jo.RESERVED_EVENTS=new Set(["connect","connection","new_namespace"]);class X6 extends Pl.StrictEventEmitter{constructor(n,i){super();this.sockets=new Map,this._preConnectSockets=new Map,this._fns=[],this._ids=0,this.server=n,this.name=i,this._initAdapter()}_initAdapter(){this.adapter=new(this.server.adapter())(this)}use(n){return this._fns.push(n),this}run(n,i){if(!this._fns.length)return i();let o=this._fns.slice(0);function c(p){o[p](n,(x)=>{if(x)return i(x);if(!o[p+1])return i();c(p+1)})}c(0)}to(n){return new Ii.BroadcastOperator(this.adapter).to(n)}in(n){return new Ii.BroadcastOperator(this.adapter).in(n)}except(n){return new Ii.BroadcastOperator(this.adapter).except(n)}async _add(n,i,o){var c;Lx("adding socket to nsp %s",this.name);let p=await this._createSocket(n,i);if(this._preConnectSockets.set(p.id,p),((c=this.server.opts.connectionStateRecovery)===null||c===void 0?void 0:c.skipMiddlewares)&&p.recovered&&n.conn.readyState==="open")return this._doConnect(p,o);this.run(p,(x)=>{process.nextTick(()=>{if(n.conn.readyState!=="open"){Lx("next called after client was closed - ignoring socket"),p._cleanup();return}if(x)if(Lx("middleware error, sending CONNECT_ERROR packet to the client"),p._cleanup(),n.conn.protocol===3)return p._error(x.data||x.message);else return p._error({message:x.message,data:x.data});this._doConnect(p,o)})})}async _createSocket(n,i){let{pid:o,offset:c}=i;if(this.server.opts.connectionStateRecovery&&typeof o==="string"&&typeof c==="string"){let p;try{p=await this.adapter.restoreSession(o,c)}catch(x){Lx("error while restoring session: %s",x)}if(p)return Lx("connection state recovered for sid %s",p.sid),new S6.Socket(this,n,i,p)}return new S6.Socket(this,n,i)}_doConnect(n,i){if(this._preConnectSockets.delete(n.id),this.sockets.set(n.id,n),n._onconnect(),i)i(n);this.emitReserved("connect",n),this.emitReserved("connection",n)}_remove(n){this.sockets.delete(n.id)||this._preConnectSockets.delete(n.id)}emit(n,...i){return new Ii.BroadcastOperator(this.adapter).emit(n,...i)}send(...n){return this.emit("message",...n),this}write(...n){return this.emit("message",...n),this}serverSideEmit(n,...i){if(jo.RESERVED_EVENTS.has(n))throw new Error(`"${String(n)}" is a reserved event name`);return i.unshift(n),this.adapter.serverSideEmit(i),!0}serverSideEmitWithAck(n,...i){return new Promise((o,c)=>{i.push((p,x)=>{if(p)return p.responses=x,c(p);else return o(x)}),this.serverSideEmit(n,...i)})}_onServerSideEmit(n){super.emitUntyped.apply(this,n)}allSockets(){return new Ii.BroadcastOperator(this.adapter).allSockets()}compress(n){return new Ii.BroadcastOperator(this.adapter).compress(n)}get volatile(){return new Ii.BroadcastOperator(this.adapter).volatile}get local(){return new Ii.BroadcastOperator(this.adapter).local}timeout(n){return new Ii.BroadcastOperator(this.adapter).timeout(n)}fetchSockets(){return new Ii.BroadcastOperator(this.adapter).fetchSockets()}socketsJoin(n){return new Ii.BroadcastOperator(this.adapter).socketsJoin(n)}socketsLeave(n){return new Ii.BroadcastOperator(this.adapter).socketsLeave(n)}disconnectSockets(n=!1){return new Ii.BroadcastOperator(this.adapter).disconnectSockets(n)}}jo.Namespace=X6});var H6=C((M6)=>{Object.defineProperty(M6,"__esModule",{value:!0});M6.yeast=M6.decode=M6.encode=void 0;var l6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Qa=64,G6={},W6=0,xc=0,K6;function A$(n){let i="";do i=l6[n%Qa]+i,n=Math.floor(n/Qa);while(n>0);return i}M6.encode=A$;function rl(n){let i=0;for(xc=0;xc<n.length;xc++)i=i*Qa+G6[n.charAt(xc)];return i}M6.decode=rl;function dl(){let n=A$(+new Date);if(n!==K6)return W6=0,K6=n;return n+"."+A$(W6++)}M6.yeast=dl;for(;xc<Qa;xc++)G6[l6[xc]]=xc});var R$=C((Q6)=>{var F$;Object.defineProperty(Q6,"__esModule",{value:!0});Q6.SessionAwareAdapter=Q6.Adapter=void 0;var n9=Kn("node:events"),i9=H6(),Ea=Kn("ws"),o9=typeof((F$=Ea===null||Ea===void 0?void 0:Ea.Sender)===null||F$===void 0?void 0:F$.frame)==="function";class T$ extends n9.EventEmitter{constructor(n){super();this.nsp=n,this.rooms=new Map,this.sids=new Map,this.encoder=n.server.encoder}init(){}close(){}serverCount(){return Promise.resolve(1)}addAll(n,i){if(!this.sids.has(n))this.sids.set(n,new Set);for(let o of i){if(this.sids.get(n).add(o),!this.rooms.has(o))this.rooms.set(o,new Set),this.emit("create-room",o);if(!this.rooms.get(o).has(n))this.rooms.get(o).add(n),this.emit("join-room",o,n)}}del(n,i){if(this.sids.has(n))this.sids.get(n).delete(i);this._del(i,n)}_del(n,i){let o=this.rooms.get(n);if(o!=null){if(o.delete(i))this.emit("leave-room",n,i);if(o.size===0&&this.rooms.delete(n))this.emit("delete-room",n)}}delAll(n){if(!this.sids.has(n))return;for(let i of this.sids.get(n))this._del(i,n);this.sids.delete(n)}broadcast(n,i){let o=i.flags||{},c={preEncoded:!0,volatile:o.volatile,compress:o.compress};n.nsp=this.nsp.name;let p=this._encode(n,c);this.apply(i,(x)=>{if(typeof x.notifyOutgoingListeners==="function")x.notifyOutgoingListeners(n);x.client.writeToEngine(p,c)})}broadcastWithAck(n,i,o,c){let p=i.flags||{},x={preEncoded:!0,volatile:p.volatile,compress:p.compress};n.nsp=this.nsp.name,n.id=this.nsp._ids++;let m=this._encode(n,x),a=0;this.apply(i,(f)=>{if(a++,f.acks.set(n.id,c),typeof f.notifyOutgoingListeners==="function")f.notifyOutgoingListeners(n);f.client.writeToEngine(m,x)}),o(a)}_encode(n,i){let o=this.encoder.encode(n);if(o9&&o.length===1&&typeof o[0]==="string"){let c=Buffer.from("4"+o[0]);i.wsPreEncodedFrame=Ea.Sender.frame(c,{readOnly:!1,mask:!1,rsv1:!1,opcode:1,fin:!0})}return o}sockets(n){let i=new Set;return this.apply({rooms:n},(o)=>{i.add(o.id)}),Promise.resolve(i)}socketRooms(n){return this.sids.get(n)}fetchSockets(n){let i=[];return this.apply(n,(o)=>{i.push(o)}),Promise.resolve(i)}addSockets(n,i){this.apply(n,(o)=>{o.join(i)})}delSockets(n,i){this.apply(n,(o)=>{i.forEach((c)=>o.leave(c))})}disconnectSockets(n,i){this.apply(n,(o)=>{o.disconnect(i)})}apply(n,i){let o=n.rooms,c=this.computeExceptSids(n.except);if(o.size){let p=new Set;for(let x of o){if(!this.rooms.has(x))continue;for(let m of this.rooms.get(x)){if(p.has(m)||c.has(m))continue;let a=this.nsp.sockets.get(m);if(a)i(a),p.add(m)}}}else for(let[p]of this.sids){if(c.has(p))continue;let x=this.nsp.sockets.get(p);if(x)i(x)}}computeExceptSids(n){let i=new Set;if(n&&n.size>0){for(let o of n)if(this.rooms.has(o))this.rooms.get(o).forEach((c)=>i.add(c))}return i}serverSideEmit(n){console.warn("this adapter does not support the serverSideEmit() functionality")}persistSession(n){}restoreSession(n,i){return null}}Q6.Adapter=T$;class z6 extends T${constructor(n){super(n);this.nsp=n,this.sessions=new Map,this.packets=[],this.maxDisconnectionDuration=n.server.opts.connectionStateRecovery.maxDisconnectionDuration,setInterval(()=>{let o=Date.now()-this.maxDisconnectionDuration;this.sessions.forEach((c,p)=>{if(c.disconnectedAt<o)this.sessions.delete(p)});for(let c=this.packets.length-1;c>=0;c--)if(this.packets[c].emittedAt<o){this.packets.splice(0,c+1);break}},60000).unref()}persistSession(n){n.disconnectedAt=Date.now(),this.sessions.set(n.pid,n)}restoreSession(n,i){let o=this.sessions.get(n);if(!o)return null;if(o.disconnectedAt+this.maxDisconnectionDuration<Date.now())return this.sessions.delete(n),null;let p=this.packets.findIndex((m)=>m.id===i);if(p===-1)return null;let x=[];for(let m=p+1;m<this.packets.length;m++){let a=this.packets[m];if(c9(o.rooms,a.opts))x.push(a.data)}return Promise.resolve(Object.assign(Object.assign({},o),{missedPackets:x}))}broadcast(n,i){var o;let c=n.type===2,p=n.id===void 0,x=((o=i.flags)===null||o===void 0?void 0:o.volatile)===void 0;if(c&&p&&x){let m=i9.yeast();n.data.push(m),this.packets.push({id:m,opts:i,data:n.data,emittedAt:Date.now()})}super.broadcast(n,i)}}Q6.SessionAwareAdapter=z6;function c9(n,i){let o=i.rooms.size===0||n.some((p)=>i.rooms.has(p)),c=n.every((p)=>!i.except.has(p));return o&&c}});var U6=C((Jo)=>{var x9=Jo&&Jo.__rest||function(n,i){var o={};for(var c in n)if(Object.prototype.hasOwnProperty.call(n,c)&&i.indexOf(c)<0)o[c]=n[c];if(n!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var p=0,c=Object.getOwnPropertySymbols(n);p<c.length;p++)if(i.indexOf(c[p])<0&&Object.prototype.propertyIsEnumerable.call(n,c[p]))o[c[p]]=n[c[p]]}return o};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.ClusterAdapterWithHeartbeat=Jo.ClusterAdapter=Jo.MessageType=void 0;var m9=R$(),a9=fi(),f9=Kn("node:crypto"),qn=a9.debug("socket.io-adapter"),v9="emitter",Oa=5000;function Op(){return f9.randomBytes(8).toString("hex")}var on;(function(n){n[n.INITIAL_HEARTBEAT=1]="INITIAL_HEARTBEAT",n[n.HEARTBEAT=2]="HEARTBEAT",n[n.BROADCAST=3]="BROADCAST",n[n.SOCKETS_JOIN=4]="SOCKETS_JOIN",n[n.SOCKETS_LEAVE=5]="SOCKETS_LEAVE",n[n.DISCONNECT_SOCKETS=6]="DISCONNECT_SOCKETS",n[n.FETCH_SOCKETS=7]="FETCH_SOCKETS",n[n.FETCH_SOCKETS_RESPONSE=8]="FETCH_SOCKETS_RESPONSE",n[n.SERVER_SIDE_EMIT=9]="SERVER_SIDE_EMIT",n[n.SERVER_SIDE_EMIT_RESPONSE=10]="SERVER_SIDE_EMIT_RESPONSE",n[n.BROADCAST_CLIENT_COUNT=11]="BROADCAST_CLIENT_COUNT",n[n.BROADCAST_ACK=12]="BROADCAST_ACK",n[n.ADAPTER_CLOSE=13]="ADAPTER_CLOSE"})(on=Jo.MessageType||(Jo.MessageType={}));function uc(n){return{rooms:[...n.rooms],except:[...n.except],flags:n.flags}}function Ep(n){return{rooms:new Set(n.rooms),except:new Set(n.except),flags:n.flags}}class S$ extends m9.Adapter{constructor(n){super(n);this.requests=new Map,this.ackRequests=new Map,this.uid=Op()}onMessage(n,i){if(n.uid===this.uid)return qn("[%s] ignore message from self",this.uid);switch(qn("[%s] new event of type %d from %s",this.uid,n.type,n.uid),n.type){case on.BROADCAST:{if(n.data.requestId!==void 0)super.broadcastWithAck(n.data.packet,Ep(n.data.opts),(c)=>{qn("[%s] waiting for %d client acknowledgements",this.uid,c),this.publishResponse(n.uid,{type:on.BROADCAST_CLIENT_COUNT,data:{requestId:n.data.requestId,clientCount:c}})},(c)=>{qn("[%s] received acknowledgement with value %j",this.uid,c),this.publishResponse(n.uid,{type:on.BROADCAST_ACK,data:{requestId:n.data.requestId,packet:c}})});else{let c=n.data.packet,p=Ep(n.data.opts);this.addOffsetIfNecessary(c,p,i),super.broadcast(c,p)}break}case on.SOCKETS_JOIN:super.addSockets(Ep(n.data.opts),n.data.rooms);break;case on.SOCKETS_LEAVE:super.delSockets(Ep(n.data.opts),n.data.rooms);break;case on.DISCONNECT_SOCKETS:super.disconnectSockets(Ep(n.data.opts),n.data.close);break;case on.FETCH_SOCKETS:{qn("[%s] calling fetchSockets with opts %j",this.uid,n.data.opts),super.fetchSockets(Ep(n.data.opts)).then((o)=>{this.publishResponse(n.uid,{type:on.FETCH_SOCKETS_RESPONSE,data:{requestId:n.data.requestId,sockets:o.map((c)=>{let p=c.handshake,{sessionStore:x}=p,m=x9(p,["sessionStore"]);return{id:c.id,handshake:m,rooms:[...c.rooms],data:c.data}})}})});break}case on.SERVER_SIDE_EMIT:{let o=n.data.packet;if(n.data.requestId===void 0){this.nsp._onServerSideEmit(o);return}let p=!1,x=(m)=>{if(p)return;p=!0,qn("[%s] calling acknowledgement with %j",this.uid,m),this.publishResponse(n.uid,{type:on.SERVER_SIDE_EMIT_RESPONSE,data:{requestId:n.data.requestId,packet:m}})};this.nsp._onServerSideEmit([...o,x]);break}case on.BROADCAST_CLIENT_COUNT:case on.BROADCAST_ACK:case on.FETCH_SOCKETS_RESPONSE:case on.SERVER_SIDE_EMIT_RESPONSE:this.onResponse(n);break;default:qn("[%s] unknown message type: %s",this.uid,n.type)}}onResponse(n){var i,o;let c=n.data.requestId;switch(qn("[%s] received response %s to request %s",this.uid,n.type,c),n.type){case on.BROADCAST_CLIENT_COUNT:{(i=this.ackRequests.get(c))===null||i===void 0||i.clientCountCallback(n.data.clientCount);break}case on.BROADCAST_ACK:{(o=this.ackRequests.get(c))===null||o===void 0||o.ack(n.data.packet);break}case on.FETCH_SOCKETS_RESPONSE:{let p=this.requests.get(c);if(!p)return;if(p.current++,n.data.sockets.forEach((x)=>p.responses.push(x)),p.current===p.expected)clearTimeout(p.timeout),p.resolve(p.responses),this.requests.delete(c);break}case on.SERVER_SIDE_EMIT_RESPONSE:{let p=this.requests.get(c);if(!p)return;if(p.current++,p.responses.push(n.data.packet),p.current===p.expected)clearTimeout(p.timeout),p.resolve(null,p.responses),this.requests.delete(c);break}default:qn("[%s] unknown response type: %s",this.uid,n.type)}}async broadcast(n,i){var o;if(!((o=i.flags)===null||o===void 0?void 0:o.local))try{let p=await this.publishAndReturnOffset({type:on.BROADCAST,data:{packet:n,opts:uc(i)}});this.addOffsetIfNecessary(n,i,p)}catch(p){return qn("[%s] error while broadcasting message: %s",this.uid,p.message)}super.broadcast(n,i)}addOffsetIfNecessary(n,i,o){var c;if(!this.nsp.server.opts.connectionStateRecovery)return;let p=n.type===2,x=n.id===void 0,m=((c=i.flags)===null||c===void 0?void 0:c.volatile)===void 0;if(p&&x&&m)n.data.push(o)}broadcastWithAck(n,i,o,c){var p;if(!((p=i===null||i===void 0?void 0:i.flags)===null||p===void 0?void 0:p.local)){let m=Op();this.ackRequests.set(m,{clientCountCallback:o,ack:c}),this.publish({type:on.BROADCAST,data:{packet:n,requestId:m,opts:uc(i)}}),setTimeout(()=>{this.ackRequests.delete(m)},i.flags.timeout)}super.broadcastWithAck(n,i,o,c)}async addSockets(n,i){var o;if(!((o=n.flags)===null||o===void 0?void 0:o.local))try{await this.publishAndReturnOffset({type:on.SOCKETS_JOIN,data:{opts:uc(n),rooms:i}})}catch(p){qn("[%s] error while publishing message: %s",this.uid,p.message)}super.addSockets(n,i)}async delSockets(n,i){var o;if(!((o=n.flags)===null||o===void 0?void 0:o.local))try{await this.publishAndReturnOffset({type:on.SOCKETS_LEAVE,data:{opts:uc(n),rooms:i}})}catch(p){qn("[%s] error while publishing message: %s",this.uid,p.message)}super.delSockets(n,i)}async disconnectSockets(n,i){var o;if(!((o=n.flags)===null||o===void 0?void 0:o.local))try{await this.publishAndReturnOffset({type:on.DISCONNECT_SOCKETS,data:{opts:uc(n),close:i}})}catch(p){qn("[%s] error while publishing message: %s",this.uid,p.message)}super.disconnectSockets(n,i)}async fetchSockets(n){var i;let[o,c]=await Promise.all([super.fetchSockets(n),this.serverCount()]),p=c-1;if(((i=n.flags)===null||i===void 0?void 0:i.local)||p<=0)return o;let x=Op();return new Promise((m,a)=>{let f=setTimeout(()=>{let $=this.requests.get(x);if($)a(new Error(`timeout reached: only ${$.current} responses received out of ${$.expected}`)),this.requests.delete(x)},n.flags.timeout||Oa),v={type:on.FETCH_SOCKETS,resolve:m,timeout:f,current:0,expected:p,responses:o};this.requests.set(x,v),this.publish({type:on.FETCH_SOCKETS,data:{opts:uc(n),requestId:x}})})}async serverSideEmit(n){if(typeof n[n.length-1]!=="function")return this.publish({type:on.SERVER_SIDE_EMIT,data:{packet:n}});let o=n.pop(),c=await this.serverCount()-1;if(qn('[%s] waiting for %d responses to "serverSideEmit" request',this.uid,c),c<=0)return o(null,[]);let p=Op(),x=setTimeout(()=>{let a=this.requests.get(p);if(a)o(new Error(`timeout reached: only ${a.current} responses received out of ${a.expected}`),a.responses),this.requests.delete(p)},Oa),m={type:on.SERVER_SIDE_EMIT,resolve:o,timeout:x,current:0,expected:c,responses:[]};this.requests.set(p,m),this.publish({type:on.SERVER_SIDE_EMIT,data:{requestId:p,packet:n}})}publish(n){this.publishAndReturnOffset(n).catch((i)=>{qn("[%s] error while publishing message: %s",this.uid,i)})}publishAndReturnOffset(n){return n.uid=this.uid,n.nsp=this.nsp.name,this.doPublish(n)}publishResponse(n,i){i.uid=this.uid,i.nsp=this.nsp.name,this.doPublishResponse(n,i).catch((o)=>{qn("[%s] error while publishing response: %s",this.uid,o)})}}Jo.ClusterAdapter=S$;class O6 extends S${constructor(n,i){super(n);this.nodesMap=new Map,this.customRequests=new Map,this._opts=Object.assign({heartbeatInterval:5000,heartbeatTimeout:1e4},i),this.cleanupTimer=setInterval(()=>{let o=Date.now();this.nodesMap.forEach((c,p)=>{if(o-c>this._opts.heartbeatTimeout)qn("[%s] node %s seems down",this.uid,p),this.removeNode(p)})},1000)}init(){this.publish({type:on.INITIAL_HEARTBEAT})}scheduleHeartbeat(){if(this.heartbeatTimer)this.heartbeatTimer.refresh();else this.heartbeatTimer=setTimeout(()=>{this.publish({type:on.HEARTBEAT})},this._opts.heartbeatInterval)}close(){if(this.publish({type:on.ADAPTER_CLOSE}),clearTimeout(this.heartbeatTimer),this.cleanupTimer)clearInterval(this.cleanupTimer)}onMessage(n,i){if(n.uid===this.uid)return qn("[%s] ignore message from self",this.uid);if(n.uid&&n.uid!==v9)this.nodesMap.set(n.uid,Date.now());switch(qn("[%s] new event of type %d from %s",this.uid,n.type,n.uid),n.type){case on.INITIAL_HEARTBEAT:this.publish({type:on.HEARTBEAT});break;case on.HEARTBEAT:break;case on.ADAPTER_CLOSE:this.removeNode(n.uid);break;default:super.onMessage(n,i)}}serverCount(){return Promise.resolve(1+this.nodesMap.size)}publish(n){return this.scheduleHeartbeat(),super.publish(n)}async serverSideEmit(n){if(typeof n[n.length-1]!=="function")return this.publish({type:on.SERVER_SIDE_EMIT,data:{packet:n}});let o=n.pop(),c=this.nodesMap.size;if(qn('[%s] waiting for %d responses to "serverSideEmit" request',this.uid,c),c<=0)return o(null,[]);let p=Op(),x=setTimeout(()=>{let a=this.customRequests.get(p);if(a)o(new Error(`timeout reached: missing ${a.missingUids.size} responses`),a.responses),this.customRequests.delete(p)},Oa),m={type:on.SERVER_SIDE_EMIT,resolve:o,timeout:x,missingUids:new Set([...this.nodesMap.keys()]),responses:[]};this.customRequests.set(p,m),this.publish({type:on.SERVER_SIDE_EMIT,data:{requestId:p,packet:n}})}async fetchSockets(n){var i;let[o,c]=await Promise.all([super.fetchSockets({rooms:n.rooms,except:n.except,flags:{local:!0}}),this.serverCount()]),p=c-1;if(((i=n.flags)===null||i===void 0?void 0:i.local)||p<=0)return o;let x=Op();return new Promise((m,a)=>{let f=setTimeout(()=>{let $=this.customRequests.get(x);if($)a(new Error(`timeout reached: missing ${$.missingUids.size} responses`)),this.customRequests.delete(x)},n.flags.timeout||Oa),v={type:on.FETCH_SOCKETS,resolve:m,timeout:f,missingUids:new Set([...this.nodesMap.keys()]),responses:o};this.customRequests.set(x,v),this.publish({type:on.FETCH_SOCKETS,data:{opts:uc(n),requestId:x}})})}onResponse(n){let i=n.data.requestId;switch(qn("[%s] received response %s to request %s",this.uid,n.type,i),n.type){case on.FETCH_SOCKETS_RESPONSE:{let o=this.customRequests.get(i);if(!o)return;if(n.data.sockets.forEach((c)=>o.responses.push(c)),o.missingUids.delete(n.uid),o.missingUids.size===0)clearTimeout(o.timeout),o.resolve(o.responses),this.customRequests.delete(i);break}case on.SERVER_SIDE_EMIT_RESPONSE:{let o=this.customRequests.get(i);if(!o)return;if(o.responses.push(n.data.packet),o.missingUids.delete(n.uid),o.missingUids.size===0)clearTimeout(o.timeout),o.resolve(null,o.responses),this.customRequests.delete(i);break}default:super.onResponse(n)}}removeNode(n){this.customRequests.forEach((i,o)=>{if(i.missingUids.delete(n),i.missingUids.size===0){if(clearTimeout(i.timeout),i.type===on.FETCH_SOCKETS)i.resolve(i.responses);else if(i.type===on.SERVER_SIDE_EMIT)i.resolve(null,i.responses);this.customRequests.delete(o)}}),this.nodesMap.delete(n)}}Jo.ClusterAdapterWithHeartbeat=O6});var Ua=C((Bc)=>{Object.defineProperty(Bc,"__esModule",{value:!0});Bc.MessageType=Bc.ClusterAdapterWithHeartbeat=Bc.ClusterAdapter=Bc.SessionAwareAdapter=Bc.Adapter=void 0;var V6=R$();Object.defineProperty(Bc,"Adapter",{enumerable:!0,get:function(){return V6.Adapter}});Object.defineProperty(Bc,"SessionAwareAdapter",{enumerable:!0,get:function(){return V6.SessionAwareAdapter}});var X$=U6();Object.defineProperty(Bc,"ClusterAdapter",{enumerable:!0,get:function(){return X$.ClusterAdapter}});Object.defineProperty(Bc,"ClusterAdapterWithHeartbeat",{enumerable:!0,get:function(){return X$.ClusterAdapterWithHeartbeat}});Object.defineProperty(Bc,"MessageType",{enumerable:!0,get:function(){return X$.MessageType}})});var B6=C((Up)=>{var w9=Up&&Up.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Up,"__esModule",{value:!0});Up.ParentNamespace=void 0;var _6=J$(),J9=Ua(),A9=w9(fi()),b6=A9.default("socket.io:parent-namespace");class Va extends _6.Namespace{constructor(n){super(n,"/_"+Va.count++);this.children=new Set}_initAdapter(){this.adapter=new u6(this)}emit(n,...i){return this.children.forEach((o)=>{o.emit(n,...i)}),!0}createChild(n){b6("creating child namespace %s",n);let i=new _6.Namespace(this.server,n);if(this._fns.forEach((o)=>i.use(o)),this.listeners("connect").forEach((o)=>i.on("connect",o)),this.listeners("connection").forEach((o)=>i.on("connection",o)),this.children.add(i),this.server._opts.cleanupEmptyChildNamespaces){let o=i._remove;i._remove=(c)=>{if(o.call(i,c),i.sockets.size===0)b6("closing child namespace %s",n),i.adapter.close(),this.server._nsps.delete(i.name),this.children.delete(i)}}return this.server._nsps.set(n,i),this.server.sockets.emitReserved("new_namespace",i),i}fetchSockets(){throw new Error("fetchSockets() is not supported on parent namespaces")}}Up.ParentNamespace=Va;Va.count=0;class u6 extends J9.Adapter{broadcast(n,i){this.nsp.children.forEach((o)=>{o.adapter.broadcast(n,i)})}}});var C6=C((Dc)=>{var F9=Dc&&Dc.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Dc,"__esModule",{value:!0});Dc.patchAdapter=R9;Dc.restoreAdapter=S9;Dc.serveFile=W9;var jc=Ua(),j6=Kn("node:fs"),T9=F9(fi()),_a=T9.default("socket.io:adapter-uws"),W$="\x1F",{addAll:L6,del:N6,broadcast:h6}=jc.Adapter.prototype;function R9(n){jc.Adapter.prototype.addAll=function(i,o){let c=!this.sids.has(i);L6.call(this,i,o);let p=this.nsp.sockets.get(i)||this.nsp._preConnectSockets.get(i);if(!p)return;if(p.conn.transport.name==="websocket"){D6(this.nsp.name,p,c,o);return}if(c)p.conn.on("upgrade",()=>{let x=this.sids.get(i);if(x)D6(this.nsp.name,p,c,x)})},jc.Adapter.prototype.del=function(i,o){N6.call(this,i,o);let c=this.nsp.sockets.get(i)||this.nsp._preConnectSockets.get(i);if(c&&c.conn.transport.name==="websocket"){let p=c.conn.id,x=c.conn.transport.socket,m=`${this.nsp.name}${W$}${o}`;_a("unsubscribe connection %s from topic %s",p,m),x.unsubscribe(m)}},jc.Adapter.prototype.broadcast=function(i,o){if(!(o.rooms.size<=1&&o.except.size===0)){h6.call(this,i,o);return}let p=o.flags||{},x={preEncoded:!0,volatile:p.volatile,compress:p.compress};i.nsp=this.nsp.name;let m=this.encoder.encode(i),a=o.rooms.size===0?this.nsp.name:`${this.nsp.name}${W$}${o.rooms.keys().next().value}`;_a("fast publish to %s",a),m.forEach((f)=>{let v=typeof f!=="string";n.publish(a,v?f:"4"+f,v)}),this.apply(o,(f)=>{if(f.conn.transport.name!=="websocket")f.client.writeToEngine(m,x)})}}function D6(n,i,o,c){let p=i.conn.id,x=i.conn.transport.socket;if(o)_a("subscribe connection %s to topic %s",p,n),x.subscribe(n);c.forEach((m)=>{let a=`${n}${W$}${m}`;_a("subscribe connection %s to topic %s",p,a),x.subscribe(a)})}function S9(){jc.Adapter.prototype.addAll=L6,jc.Adapter.prototype.del=N6,jc.Adapter.prototype.broadcast=h6}var X9=(n)=>{let{buffer:i,byteOffset:o,byteLength:c}=n;return i.slice(o,o+c)};function W9(n,i){let{size:o}=j6.statSync(i),c=j6.createReadStream(i),p=()=>!c.destroyed&&c.destroy(),x=(a)=>{throw p(),a},m=(a)=>{let f=X9(a);n.cork(()=>{let v=n.getWriteOffset(),[$,w]=n.tryEnd(f,o);if(!w&&!$)c.pause(),n.onWritable((J)=>{let[S,X]=n.tryEnd(f.slice(J-v),o);if(!X&&S)c.resume();return S})})};n.onAborted(p),c.on("data",m).on("error",x).on("end",p)}});var I6=C((PL,K9)=>{K9.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 d6=C((Mi,Nx)=>{var __dirname="/home/runner/work/wayforge/wayforge/node_modules/.pnpm/socket.io@4.8.1/node_modules/socket.io/dist",l9=Mi&&Mi.__createBinding||(Object.create?function(n,i,o,c){if(c===void 0)c=o;var p=Object.getOwnPropertyDescriptor(i,o);if(!p||("get"in p?!i.__esModule:p.writable||p.configurable))p={enumerable:!0,get:function(){return i[o]}};Object.defineProperty(n,c,p)}:function(n,i,o,c){if(c===void 0)c=o;n[c]=i[o]}),G9=Mi&&Mi.__setModuleDefault||(Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i}),M9=Mi&&Mi.__importStar||function(n){if(n&&n.__esModule)return n;var i={};if(n!=null){for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o))l9(i,n,o)}return G9(i,n),i},t6=Mi&&Mi.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.Namespace=Mi.Socket=Mi.Server=void 0;var Y9=Kn("node:http"),H9=Kn("node:fs"),K$=Kn("node:zlib"),z9=va(),ba=Kn("node:stream"),y6=Kn("node:path"),k6=N8(),Q9=x6(),Z6=Kn("node:events"),G$=J$();Object.defineProperty(Mi,"Namespace",{enumerable:!0,get:function(){return G$.Namespace}});var E9=B6(),q6=Ua(),O9=M9(Dx()),U9=t6(fi()),r6=w$();Object.defineProperty(Mi,"Socket",{enumerable:!0,get:function(){return r6.Socket}});var V9=za(),l$=C6(),_9=t6(i$()),Bi=U9.default("socket.io:server"),s6=I6().version,P6=/\.map/;class Vp extends V9.StrictEventEmitter{constructor(n,i={}){super();if(this._nsps=new Map,this.parentNsps=new Map,this.parentNamespacesFromRegExp=new Map,typeof n==="object"&&n instanceof Object&&!n.listen)i=n,n=void 0;if(this.path(i.path||"/socket.io"),this.connectTimeout(i.connectTimeout||45000),this.serveClient(i.serveClient!==!1),this._parser=i.parser||O9,this.encoder=new this._parser.Encoder,this.opts=i,i.connectionStateRecovery)i.connectionStateRecovery=Object.assign({maxDisconnectionDuration:120000,skipMiddlewares:!0},i.connectionStateRecovery),this.adapter(i.adapter||q6.SessionAwareAdapter);else this.adapter(i.adapter||q6.Adapter);if(i.cleanupEmptyChildNamespaces=!!i.cleanupEmptyChildNamespaces,this.sockets=this.of("/"),n||typeof n=="number")this.attach(n);if(this.opts.cors)this._corsMiddleware=_9.default(this.opts.cors)}get _opts(){return this.opts}serveClient(n){if(!arguments.length)return this._serveClient;return this._serveClient=n,this}_checkNamespace(n,i,o){if(this.parentNsps.size===0)return o(!1);let c=this.parentNsps.keys(),p=()=>{let x=c.next();if(x.done)return o(!1);x.value(n,i,(m,a)=>{if(m||!a)return p();if(this._nsps.has(n))return Bi("dynamic namespace %s already exists",n),o(this._nsps.get(n));let f=this.parentNsps.get(x.value).createChild(n);Bi("dynamic namespace %s was created",n),o(f)})};p()}path(n){if(!arguments.length)return this._path;this._path=n.replace(/\/$/,"");let i=this._path.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");return this.clientPathRegex=new RegExp("^"+i+"/socket\\.io(\\.msgpack|\\.esm)?(\\.min)?\\.js(\\.map)?(?:\\?|$)"),this}connectTimeout(n){if(n===void 0)return this._connectTimeout;return this._connectTimeout=n,this}adapter(n){if(!arguments.length)return this._adapter;this._adapter=n;for(let i of this._nsps.values())i._initAdapter();return this}listen(n,i={}){return this.attach(n,i)}attach(n,i={}){if(typeof n=="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(n)==n)n=Number(n);if(typeof n=="number"){Bi("creating http server and binding to %d",n);let o=n;n=Y9.createServer((c,p)=>{p.writeHead(404),p.end()}),n.listen(o)}return Object.assign(i,this.opts),i.path=i.path||this._path,this.initEngine(n,i),this}attachApp(n,i={}){Object.assign(i,this.opts),i.path=i.path||this._path,Bi("creating uWebSockets.js-based engine with opts %j",i);let o=new k6.uServer(i);if(o.attach(n,i),this.bind(o),this._serveClient)n.get(`${this._path}/*`,(c,p)=>{if(!this.clientPathRegex.test(p.getUrl())){p.setYield(!0);return}let x=p.getUrl().replace(this._path,"").replace(/\?.*$/,"").replace(/^\//,""),m=P6.test(x),a=m?"map":"source",f='"'+s6+'"',v="W/"+f,$=p.getHeader("if-none-match");if($){if(f===$||v===$){Bi("serve client %s 304",a),c.writeStatus("304 Not Modified"),c.end();return}}Bi("serve client %s",a),c.writeHeader("cache-control","public, max-age=0"),c.writeHeader("content-type","application/"+(m?"json":"javascript")+"; charset=utf-8"),c.writeHeader("etag",f);let w=y6.join(__dirname,"../client-dist/",x);l$.serveFile(c,w)});l$.patchAdapter(n)}initEngine(n,i){if(Bi("creating engine.io instance with opts %j",i),this.eio=k6.attach(n,i),this._serveClient)this.attachServe(n);this.httpServer=n,this.bind(this.eio)}attachServe(n){Bi("attaching client serving req handler");let i=n.listeners("request").slice(0);n.removeAllListeners("request"),n.on("request",(o,c)=>{if(this.clientPathRegex.test(o.url))if(this._corsMiddleware)this._corsMiddleware(o,c,()=>{this.serve(o,c)});else this.serve(o,c);else for(let p=0;p<i.length;p++)i[p].call(n,o,c)})}serve(n,i){let o=n.url.replace(this._path,"").replace(/\?.*$/,""),c=P6.test(o),p=c?"map":"source",x='"'+s6+'"',m="W/"+x,a=n.headers["if-none-match"];if(a){if(x===a||m===a){Bi("serve client %s 304",p),i.writeHead(304),i.end();return}}Bi("serve client %s",p),i.setHeader("Cache-Control","public, max-age=0"),i.setHeader("Content-Type","application/"+(c?"json":"javascript")+"; charset=utf-8"),i.setHeader("ETag",x),Vp.sendFile(o,n,i)}static sendFile(n,i,o){let c=H9.createReadStream(y6.join(__dirname,"../client-dist/",n)),p=z9(i).encodings(["br","gzip","deflate"]),x=(m)=>{if(m)o.end()};switch(p){case"br":o.writeHead(200,{"content-encoding":"br"}),ba.pipeline(c,K$.createBrotliCompress(),o,x);break;case"gzip":o.writeHead(200,{"content-encoding":"gzip"}),ba.pipeline(c,K$.createGzip(),o,x);break;case"deflate":o.writeHead(200,{"content-encoding":"deflate"}),ba.pipeline(c,K$.createDeflate(),o,x);break;default:o.writeHead(200),ba.pipeline(c,o,x)}}bind(n){return this.engine=n,this.engine.on("connection",this.onconnection.bind(this)),this}onconnection(n){Bi("incoming connection with id %s",n.id);let i=new Q9.Client(this,n);if(n.protocol===3)i.connect("/");return this}of(n,i){if(typeof n==="function"||n instanceof RegExp){let c=new E9.ParentNamespace(this);if(Bi("initializing parent namespace %s",c.name),typeof n==="function")this.parentNsps.set(n,c);else this.parentNsps.set((p,x,m)=>m(null,n.test(p)),c),this.parentNamespacesFromRegExp.set(n,c);if(i)c.on("connect",i);return c}if(String(n)[0]!=="/")n="/"+n;let o=this._nsps.get(n);if(!o){for(let[c,p]of this.parentNamespacesFromRegExp)if(c.test(n))return Bi("attaching namespace %s to parent namespace %s",n,c),p.createChild(n);if(Bi("initializing namespace %s",n),o=new G$.Namespace(this,n),this._nsps.set(n,o),n!=="/")this.sockets.emitReserved("new_namespace",o)}if(i)o.on("connect",i);return o}async close(n){if(await Promise.allSettled([...this._nsps.values()].map(async(i)=>{i.sockets.forEach((o)=>{o._onclose("server shutting down")}),await i.adapter.close()})),this.engine.close(),l$.restoreAdapter(),this.httpServer)this.httpServer.close(n);else n&&n()}use(n){return this.sockets.use(n),this}to(n){return this.sockets.to(n)}in(n){return this.sockets.in(n)}except(n){return this.sockets.except(n)}send(...n){return this.sockets.emit("message",...n),this}write(...n){return this.sockets.emit("message",...n),this}serverSideEmit(n,...i){return this.sockets.serverSideEmit(n,...i)}serverSideEmitWithAck(n,...i){return this.sockets.serverSideEmitWithAck(n,...i)}allSockets(){return this.sockets.allSockets()}compress(n){return this.sockets.compress(n)}get volatile(){return this.sockets.volatile}get local(){return this.sockets.local}timeout(n){return this.sockets.timeout(n)}fetchSockets(){return this.sockets.fetchSockets()}socketsJoin(n){return this.sockets.socketsJoin(n)}socketsLeave(n){return this.sockets.socketsLeave(n)}disconnectSockets(n=!1){return this.sockets.disconnectSockets(n)}}Mi.Server=Vp;var b9=Object.keys(Z6.EventEmitter.prototype).filter(function(n){return typeof Z6.EventEmitter.prototype[n]==="function"});b9.forEach(function(n){Vp.prototype[n]=function(){return this.sockets[n].apply(this.sockets,arguments)}});Nx.exports=(n,i)=>new Vp(n,i);Nx.exports.Server=Vp;Nx.exports.Namespace=G$.Namespace;Nx.exports.Socket=r6.Socket});import{createHash as pS}from"node:crypto";import{createServer as dM}from"node:http";import{createServer as gM}from"node:https";function am(n=Math.random){return n().toString(36).slice(2)}class cx extends Promise{fate;resolve;reject;done=!1;constructor(n){let i,o;super((c,p)=>{i=c,o=p});this.resolve=i,this.reject=o,this.use(n instanceof Promise?n:new Promise(n))}pass(n,i){if(n===this.fate)this.resolve(i),this.done=!0}fail(n,i){if(n===this.fate)this.reject(i),this.done=!0}use(n){if(n instanceof Promise){let i=n;this.fate=i,i.then((o)=>{this.pass(i,o)},(o)=>{this.fail(i,o)})}else this.resolve(n),this.fate=void 0}}function Y0(n){return Object.entries(n)}var H0=(n,i,o=g.STORE)=>{return Jf(o,{key:`${n.key}:JSON`,get:({get:c})=>i.toJson(c(n)),set:({set:c},p)=>{c(n,i.fromJson(p))}})};function j(n){while(n.child!==null)n=n.child;return n}class $n{Subscriber;subscribers=new Map;subscribe(n,i){return this.subscribers.set(n,i),()=>{this.unsubscribe(n)}}unsubscribe(n){this.subscribers.delete(n)}next(n){let i=this.subscribers.values();for(let o of i)o(n)}}class Af extends $n{state;constructor(n){super();this.state=n}next(n){this.state=n,super.next(n)}}function Jc(n,i,o){let c={key:i.key,type:"atom_family"},p=n.families.get(i.key);if(p)n.logger.error("\u2757","atom_family",i.key,`Overwriting an existing ${Ko(p)} "${p.key}" in store "${n.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let x=new $n,a=Object.assign((f)=>{let v=wn(f),$={key:i.key,subKey:v},w=`${i.key}(${v})`,J=j(n),S=i.default,X={key:w,default:S instanceof Function?S(f):S};if(i.effects)X.effects=i.effects(f);let R=Ac(J,X,$);return x.next({type:"state_creation",token:R}),R},c,{subject:x,install:(f)=>Jc(f,i),internalRoles:o});return n.families.set(i.key,a),n.defaults.set(i.key,i.default),c}function z0(n,i){if("mutable"in i)return px(n,i);return Jc(n,i)}function Io(n,i,o){let c={key:i.key,type:"readonly_selector_family"},p=n.families.get(i.key);if(p)n.logger.error("\u2757","readonly_selector_family",i.key,`Overwriting an existing ${Ko(p)} "${p.key}" in store "${n.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let x=new $n,a=Object.assign((f)=>{let v=wn(f),$={key:i.key,subKey:v},w=`${i.key}(${v})`,J=j(n),S=xx(J,{key:w,get:i.get(f)},$);return x.next({type:"state_creation",token:S}),S},c,{internalRoles:o,subject:x,install:(f)=>Io(f,i),default:(f)=>{return i.get(f)({get:(...$)=>Gn(n,...$),find:(...$)=>t(n,...$),json:($)=>ni(n,$)})}});return n.families.set(i.key,a),c}function Q0(n,i){if("set"in i)return mx(n,i);return Io(n,i)}class fm{_buffer;_index=0;constructor(n){let i;if(typeof n==="number")i=n;else i=n.length;this._buffer=Array.from({length:i})}get buffer(){return this._buffer}get index(){return this._index}add(n){this._buffer[this._index]=n,this._index=(this._index+1)%this._buffer.length}copy(){let n=new fm([...this._buffer]);return n._index=this._index,n}}var x3={atom_family:"atom",mutable_atom_family:"mutable_atom",selector_family:"selector",readonly_selector_family:"readonly_selector",molecule_family:"molecule"};function E0(n,i){let o=wn(i),c=`${n.key}(${o})`,p=x3[n.type],x={key:c,type:p};return Object.assign(x,{family:{key:n.key,subKey:o}}),Object.assign(x,{counterfeit:!0}),x}function lo(n){let i={key:n.key,type:n.type};if("family"in n)i.family=n.family;return i}class ii{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(n,i)=>`${n}:${i}`;warn;getRelatedKeys(n){return this.relations.get(n)}addRelation(n,i){let o=this.relations.get(n),c=this.relations.get(i);if(o)o.add(i);else o=new Set([i]),this.relations.set(n,o);if(c)c.add(n);else c=new Set([n]),this.relations.set(i,c)}deleteRelation(n,i){let o=this.relations.get(n);if(o){if(o.delete(i),o.size===0)this.relations.delete(n);let c=this.relations.get(i);if(c){if(c.delete(n),c.size===0)this.relations.delete(i)}}}replaceRelationsUnsafely(n,i){this.relations.set(n,new Set(i));for(let o of i){let c=new Set().add(n);this.relations.set(o,c)}}replaceRelationsSafely(n,i){let o=this.relations.get(n),c=this.isAType?.(n)?n:void 0,p=c===void 0?n:void 0;if(o)for(let x of o){c??=x,p??=x;let m=this.relations.get(x);if(m){if(m.size===1)this.relations.delete(x);else m.delete(n);this.contents.delete(this.makeContentKey(c,p))}}this.relations.set(n,new Set(i));for(let x of i){let m=this.relations.get(x);if(m)m.add(n);else m=new Set().add(n),this.relations.set(x,m)}}getContentInternal(n){return this.contents.get(n)}setContent(n,i){this.contents.set(n,i)}deleteContent(n){this.contents.delete(n)}constructor(n,i){if(this.a=n.between[0],this.b=n.between[1],this.cardinality=n.cardinality,!i?.externalStore)this.relations=new Map(n.relations?.map(([o,c])=>[o,new Set(c)])),this.contents=new Map(n.contents);if(this.isAType=i?.isAType??null,this.isBType=i?.isBType??null,this.isContent=i?.isContent??null,i?.makeContentKey)this.makeContentKey=i.makeContentKey;if(i?.externalStore){let o=i.externalStore;if(this.has=(c,p)=>o.has(c,p),this.addRelation=(c,p)=>{o.addRelation(c,p)},this.deleteRelation=(c,p)=>{o.deleteRelation(c,p)},this.replaceRelationsSafely=(c,p)=>{o.replaceRelationsSafely(c,p)},this.replaceRelationsUnsafely=(c,p)=>{o.replaceRelationsUnsafely(c,p)},this.getRelatedKeys=(c)=>o.getRelatedKeys(c),o.getContent)this.getContentInternal=(c)=>{return o.getContent(c)},this.setContent=(c,p)=>{o.setContent(c,p)},this.deleteContent=(c)=>{o.deleteContent(c)};for(let[c,p]of n.relations??[]){let x=this.isAType?.(c)?c:void 0,m=x===void 0?c:void 0;for(let a of p)x??=a,m??=a,this.addRelation(x,m)}for(let[c,p]of n.contents??[])this.setContent(c,p)}if(i?.warn)this.warn=i.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([n,i])=>[n,[...i]]),contents:[...this.contents.entries()]}}set(...n){let i,o,c;switch(n.length){case 1:{let p=n[0];i=p[this.a],o=p[this.b],c=void 0;break}case 2:{let p=n[0];if(typeof p==="string")[i,o]=n;else i=p[this.a],o=p[this.b],c=n[1];break}default:{i=n[0],o=n[1],c=n[2];break}}switch(this.cardinality){case"1:1":{let p=this.getRelatedKey(i);if(p&&p!==o)this.delete(i,p)}case"1:n":{let p=this.getRelatedKey(o);if(p&&p!==i)this.delete(p,o)}break;case"n:n":}if(c){let p=this.makeContentKey(i,o);this.setContent(p,c)}return this.addRelation(i,o),this}delete(n,i){i=typeof i==="string"?i:n[this.b];let o=typeof n==="string"?n:n[this.a];if(o===void 0&&typeof i==="string"){let c=this.getRelatedKeys(i);if(c)for(let p of c)this.delete(p,i)}if(typeof o==="string"&&i===void 0){let c=this.getRelatedKeys(o);if(c)for(let p of c)this.delete(o,p)}if(typeof o==="string"&&typeof i==="string"){this.deleteRelation(o,i);let c=this.makeContentKey(o,i);this.deleteContent(c)}return this}getRelatedKey(n){let i=this.getRelatedKeys(n);if(i){if(i.size>1)this.warn?.(`${i.size} related keys were found for key "${n}": (${[...i].map((c)=>`"${c}"`).join(", ")}). Only one related key was expected.`);let o;for(let c of i){o=c;break}return o}}replaceRelations(n,i,o){let c=!Array.isArray(i),p=c?Object.keys(i):i;if(o?.reckless)this.replaceRelationsUnsafely(n,p);else this.replaceRelationsSafely(n,p);if(c)for(let x of p){let m=this.makeContentKey(n,x),a=i[x];this.setContent(m,a)}return this}getContent(n,i){let o=this.makeContentKey(n,i);return this.getContentInternal(o)}getRelationEntries(n){let i=n[this.a],o=n[this.b];if(i!==void 0&&o===void 0){let c=this.getRelatedKeys(i);if(c)return[...c].map((p)=>{return[p,this.getContent(i,p)]})}if(i===void 0&&o!==void 0){let c=this.getRelatedKeys(o);if(c)return[...c].map((p)=>{return[p,this.getContent(p,o)]})}return[]}has(n,i){if(i)return this.getRelatedKeys(n)?.has(i)??!1;return this.relations.has(n)}}function $i(n){return"epoch"in n.transactionMeta}function Mn(n){return"phase"in n.transactionMeta}var O0=(n)=>{let i=j(n);if(!Mn(i)){n.logger.warn("\uD83D\uDC1E","transaction","???","abortTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}n.logger.info("\uD83E\uDE82","transaction",i.transactionMeta.update.key,"Aborting transaction"),i.parent.child=null};function Yn(n){return n[0].toUpperCase()+n.slice(1)}function Ko(n){return n.type.split("_").map(Yn).join(" ")}class Fc extends Error{constructor(n,i){super(`${Ko(n)} ${wn(n.key)} not found in store "${i.config.name}".`)}}function dc(n,i,o){return(...c)=>{let p=Tn(n,i);if(p)return p.run(c,o);throw new Fc(i,n)}}var vm=(n)=>(i)=>n instanceof Function?n(i):n;var yo=(n,i)=>{if(n.valueMap.has(i.key))return n.logger.info("\uD83D\uDCD6",i.type,i.key,"reading cached value"),U0(i,n);switch(i.type){case"selector":case"readonly_selector":return n.logger.info("\uD83E\uDDEE",i.type,i.key,"computing value"),i.get();case"atom":case"mutable_atom":{let o=i.default,c;if(o instanceof Function)c=o();else c=o;return n.logger.info("\uD83D\uDC81","atom",i.key,"could not find cached value; using default",c),c}}};var V0=(n,i)=>{if(n.operation.open){let o=performance.now();return n.logger.info("\u2757",i.type,i.key,`deferring setState at T-${o} until setState for "${n.operation.token.key}" is done`),o}n.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:i},n.logger.info("\u2B55",i.type,i.key,`operation start in store "${n.config.name}"${!Mn(n)?"":` ${n.transactionMeta.phase} "${n.transactionMeta.update.key}"`}`)},_0=(n)=>{if(n.operation.open)n.logger.info("\uD83D\uDD34",n.operation.token.type,n.operation.token.key,`operation done in store "${n.config.name}"`);n.operation={open:!1},n.on.operationClose.next(n.operation)},b0=(n,i)=>{if(!n.operation.open)return n.logger.error("\uD83D\uDC1E","unknown",i,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0;return n.operation.done.has(i)},gc=(n,i)=>{if(!n.operation.open){n.logger.error("\uD83D\uDC1E","unknown",i,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}n.operation.done.add(i)};var u0=(n,i,o)=>{switch(i.type){case"mutable_atom":n.logger.info("\uD83D\uDCE2",i.type,i.key,"is now (",o.newValue,") subscribers:",i.subject.subscribers);break;case"atom":case"selector":case"readonly_selector":n.logger.info("\uD83D\uDCE2",i.type,i.key,"went (",o.oldValue,"->",o.newValue,") subscribers:",i.subject.subscribers)}i.subject.next(o)};var Ff=(n,i)=>{let o=j(n),c=o.selectorAtoms.getRelatedKeys(i.key);if(o.logger.info("\uD83E\uDDF9",i.type,i.key,c?`evicting ${c.size} states downstream:`:"no downstream states",c??"to evict"),c){if(o.operation.open)o.logger.info("\uD83E\uDDF9",i.type,i.key,`[ ${[...o.operation.done].join(", ")} ] already done`);for(let p of c){if(b0(o,p))continue;B0(p,o),gc(o,p)}}};var j0=(n,i,o)=>{let c=yo(n,i),p=c;if(i.type==="mutable_atom"&&Mn(n)){let{parent:m}=n;p=ax(n,i,m)}if(p=vm(o)(p),n.logger.info("\uD83D\uDCDD","atom",i.key,"set to",p),p=Zi(n,i.key,p,i.subject),L0(n,i.key))N0(n,i.key);gc(n,i.key),Ff(n,i);let x={oldValue:c,newValue:p};if(!Mn(n)){u0(n,i,x);return}if(n.on.transactionApplying.state===null){let{key:m}=i;if(D0(x.newValue))return;let a={type:"atom_update",key:m,...x};if(i.family)a.family=i.family;n.transactionMeta.update.updates.push(a),n.logger.info("\uD83D\uDCC1","atom",m,"stowed (",x.oldValue,"->",x.newValue,")")}else if(i.key.startsWith("*")){let m=i.key.slice(1),a=n.atoms.get(m),f=n.valueMap.get(m);if(a.type==="mutable_atom"&&Mn(n)){let{parent:$}=n;f=ax(n,a,$)}if(f.do(x.newValue)===null)Ff(n,a)}};var $m=(n,i,o)=>{switch(i.type){case"atom":case"mutable_atom":j0(n,i,o);break;case"selector":i.set(o);break}};function h0(n,i){if(i.family){let o=n.families.get(i.family.key);if(o)return o}}function On(n,...i){let o,c,p,x;if(i.length===2){if(o=i[0],x=i[1],c=h0(n,o)??null,c)p=o.family?xi(o.family.subKey):null,o=t(n,c,p)}else c=i[0],p=i[1],x=i[2],o=t(n,c,p);if("counterfeit"in o&&"family"in o){let f=o.family.subKey,v=n.disposalTraces.buffer.find(($)=>$?.key===f);n.logger.error("\u274C",o.type,o.key,`could not be set because it was not found in the store "${n.config.name}".`,v?`This state was previously disposed:
48
- ${v.trace}`:"No previous disposal trace was found.");return}let m=V0(n,o);if(m){let f=n.on.operationClose.subscribe(`waiting to set "${o.key}" at T-${m}`,()=>{f(),n.logger.info("\uD83D\uDFE2",o.type,o.key,`resuming deferred setState from T-${m}`),On(n,o,x)});return}let a=Tn(n,o);$m(n,a,x),_0(n)}function wm(n,i,o){let{key:c,newValue:p,oldValue:x}=i,m=n==="newValue"?p:x,a={key:c,type:"atom"};if(i.family)Object.assign(a,{family:i.family});On(o,a,m)}function C0(n){let{stack:i}=n;if(i)return`
49
- `+i.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 XS(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=a((F9)=>{Object.defineProperty(F9,"__esModule",{value:!0});F9.Polling=void 0;var RS=Rc(),$9=Hi("zlib"),YS=Nf(),GS=Go(),un=GS.default("engine:polling"),KS={gzip:$9.createGzip,deflate:$9.createDeflate};class J9 extends RS.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){un("request overlap"),this.onError("overlap from client"),o.writeStatus("500 Internal Server Error"),o.end();return}un("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)un("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,$)=>{let J=x+f.byteLength;if(J>n){this.onError("content-length mismatch"),o.close();return}if(!c){if($){m(Buffer.from(f));return}c=Buffer.allocUnsafe(n)}if(Buffer.from(f).copy(c,x),$){if(J!=n){this.onError("content-length mismatch"),o.writeStatus("400 Content-Length Mismatch").end(),this.onDataRequestCleanup();return}m(c);return}x=J})}onDataRequestCleanup(){this.dataReq=this.dataRes=null}onData(i){un('received "%s"',i);let o=(n)=>{if(n.type==="close")return un("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)un("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){un('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=($)=>{this.headers(this.req,x),this.res.cork(()=>{Object.keys(x).forEach((J)=>{this.res.writeHeader(J,String(x[J]))}),this.res.end($)}),n()};if(!this.httpCompression||!o.compress){T(i);return}if((p?Buffer.byteLength(i):i.length)<this.httpCompression.threshold){T(i);return}let f=YS(this.req).encodings(["gzip","deflate"]);if(!f){T(i);return}this.compress(i,f,($,J)=>{if($){this.res.writeStatus("500 Internal Server Error"),this.res.end(),n($);return}x["Content-Encoding"]=f,T(J)})}compress(i,o,n){un("compressing");let p=[],c=0;KS[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){un("closing");let o,n=()=>{clearTimeout(o),i(),this.onClose()};if(this.writable)un("transport writable - closing right away"),this.send([{type:"close"}]),n();else if(this.discarded)un("transport discarded - closing right away"),n();else un("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}}F9.Polling=J9});var Y9=a((W9)=>{Object.defineProperty(W9,"__esModule",{value:!0});W9.WebSocket=void 0;var HS=Rc(),US=Go(),w9=US.default("engine:ws");class X9 extends HS.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=a((G9)=>{Object.defineProperty(G9,"__esModule",{value:!0});var zS=v9(),uS=Y9();G9.default={polling:zS.Polling,websocket:uS.WebSocket}});var Z9=a((z9)=>{Object.defineProperty(z9,"__esModule",{value:!0});z9.uServer=void 0;var MS=Go(),Yc=gJ(),QS=K9(),Pp=MS.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(()=>{Pp("response has been aborted")})}createTransport(i,o){return new QS.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){Pp('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)Pp("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){Pp("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 Pp("upgrade attempt for closed client"),i.close();else if(f.upgrading)return Pp("transport has already been trying to upgrade"),i.close();else if(f.upgraded)return Pp("transport had already been upgraded"),i.close();else Pp("upgrading existing transport"),m=this.createTransport(o._query.transport,o),f._maybeUpgrade(m)}else if(m=await this.handshake(o._query.transport,o,(f,$)=>this.abortRequest(i,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=a((ux)=>{Object.defineProperty(ux,"__esModule",{value:!0});ux.protocol=ux.Transport=ux.Socket=ux.uServer=ux.parser=ux.transports=ux.Server=void 0;ux.listen=yS;ux.attach=S9;var SS=Hi("http"),M9=gJ();Object.defineProperty(ux,"Server",{enumerable:!0,get:function(){return M9.Server}});var VS=lJ();ux.transports=VS.default;var Q9=kT();ux.parser=Q9;var ES=Z9();Object.defineProperty(ux,"uServer",{enumerable:!0,get:function(){return ES.uServer}});var OS=qJ();Object.defineProperty(ux,"Socket",{enumerable:!0,get:function(){return OS.Socket}});var _S=Rc();Object.defineProperty(ux,"Transport",{enumerable:!0,get:function(){return _S.Transport}});ux.protocol=Q9.protocol;function yS(i,o,n){if(typeof o==="function")n=o,o={};let p=SS.createServer(function(x,T){T.writeHead(501),T.end("Not Implemented")}),c=S9(p,o);return c.httpServer=p,p.listen(i,n),c}function S9(i,o){let n=new M9.Server(o);return n.attach(i,o),n}});var O9=a((NS)=>{NS.Emitter=ao;function ao(i){if(i)return IS(i)}function IS(i){for(var o in ao.prototype)i[o]=ao.prototype[o];return i}ao.prototype.on=ao.prototype.addEventListener=function(i,o){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(o),this};ao.prototype.once=function(i,o){function n(){this.off(i,n),o.apply(this,arguments)}return n.fn=o,this.on(i,n),this};ao.prototype.off=ao.prototype.removeListener=ao.prototype.removeAllListeners=ao.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};ao.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};ao.prototype.emitReserved=ao.prototype.emit;ao.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};ao.prototype.hasListeners=function(i){return!!this.listeners(i).length}});var sJ=a((L9)=>{Object.defineProperty(L9,"__esModule",{value:!0});L9.hasBinary=L9.isBinary=void 0;var jS=typeof ArrayBuffer==="function",aS=(i)=>{return typeof ArrayBuffer.isView==="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer},_9=Object.prototype.toString,PS=typeof Blob==="function"||typeof Blob!=="undefined"&&_9.call(Blob)==="[object BlobConstructor]",lS=typeof File==="function"||typeof File!=="undefined"&&_9.call(File)==="[object FileConstructor]";function y9(i){return jS&&(i instanceof ArrayBuffer||aS(i))||PS&&i instanceof Blob||lS&&i instanceof File}L9.isBinary=y9;function i1(i,o){if(!i||typeof i!=="object")return!1;if(Array.isArray(i)){for(let n=0,p=i.length;n<p;n++)if(i1(i[n]))return!0;return!1}if(y9(i))return!0;if(i.toJSON&&typeof i.toJSON==="function"&&arguments.length===1)return i1(i.toJSON(),!0);for(let n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i1(i[n]))return!0;return!1}L9.hasBinary=i1});var I9=a((D9)=>{Object.defineProperty(D9,"__esModule",{value:!0});D9.reconstructPacket=D9.deconstructPacket=void 0;var kS=sJ();function hS(i){let o=[],n=i.data,p=i;return p.data=tJ(n,o),p.attachments=o.length,{packet:p,buffers:o}}D9.deconstructPacket=hS;function tJ(i,o){if(!i)return i;if(kS.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]=tJ(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]=tJ(i[p],o);return n}return i}function gS(i,o){return i.data=dJ(i.data,o),delete i.attachments,i}D9.reconstructPacket=gS;function dJ(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]=dJ(i[n],o);else if(typeof i==="object"){for(let n in i)if(Object.prototype.hasOwnProperty.call(i,n))i[n]=dJ(i[n],o)}return i}});var sT=a((q9)=>{Object.defineProperty(q9,"__esModule",{value:!0});q9.Decoder=q9.Encoder=q9.PacketType=q9.protocol=void 0;var tS=O9(),j9=I9(),a9=sJ(),dS=Go(),rJ=dS.default("socket.io-parser"),rS=["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 P9{constructor(i){this.replacer=i}encode(i){if(rJ("encoding packet %j",i),i.type===si.EVENT||i.type===si.ACK){if(a9.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 rJ("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=P9;function N9(i){return Object.prototype.toString.call(i)==="[object Object]"}class eJ extends tS.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(a9.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(eJ.isPayloadValid(n.type,c))n.data=c;else throw new Error("invalid payload")}return rJ("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"&&rS.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=eJ;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=a((g9)=>{Object.defineProperty(g9,"__esModule",{value:!0});g9.Client=void 0;var o1=sT(),oV=Go(),nV=Hi("url"),Nn=oV("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:o1.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=nV.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===o1.PacketType.CONNECT)this.connect(o,n);else if(p&&i.type!==o1.PacketType.CONNECT&&i.type!==o1.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 n1=a((r9)=>{Object.defineProperty(r9,"__esModule",{value:!0});r9.StrictEventEmitter=void 0;var pV=Hi("events");class d9 extends pV.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 iF=a((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 nF=a((nR)=>{Object.defineProperty(nR,"__esModule",{value:!0});nR.RemoteSocket=nR.BroadcastOperator=void 0;var cV=iF(),xV=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(cV.RESERVED_EVENTS.has(i))throw new Error(`"${String(i)}" is a reserved event name`);let n=[i,...o],p={type:xV.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),$=-1,J=0,F=0,A=()=>{if(!T&&$===J&&m.length===F)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)=>{F+=X,J++,A()},(X)=>{m.push(X),A()}),this.adapter.serverCount().then((X)=>{$=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 oF(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 oF{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=oF});var pF=a((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(),mV=TR(Go()),fV=n1(),cR=TR(VJ()),$V=nF(),JV=iF(),Co=mV.default("socket.io:socket"),FV=new Set(["transport error","transport close","forced close","ping timeout","server shutting down","forced server close"]);function xR(){}class mR extends fV.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(JV.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++;Co("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(()=>{Co("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 Co("join room %s",i),this.adapter.addAll(this.id,new Set(Array.isArray(i)?i:[i]))}leave(i){return Co("leave room %s",i),this.adapter.del(this.id,i)}leaveAll(){this.adapter.delAll(this.id)}_onconnect(){if(Co("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(Co("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(Co("emitting event %j",o),i.id!=null)Co("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);Co("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")Co("calling ack %s with %j",i.id,i.data),o.apply(this,i.data),this.acks.delete(i.id);else Co("bad ack %s",i.id)}ondisconnect(){Co("got disconnect packet"),this._onclose("client namespace disconnect")}_onerror(i){this.emitReserved("error",i)}_onclose(i,o){if(!this.connected)return this;if(Co("closing socket - reason %s",i),this.emitReserved("disconnecting",i,o),this.server._opts.connectionStateRecovery&&FV.has(i))Co("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){Co("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 Co("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 $V.BroadcastOperator(this.adapter,new Set,new Set([this.id]),i)}}Zx.Socket=mR});var cF=a((Wp)=>{var AV=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=pF(),vV=n1(),wV=AV(Go()),Jn=nF(),tT=wV.default("socket.io:namespace");Wp.RESERVED_EVENTS=new Set(["connect","connection","new_namespace"]);class $R extends vV.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 Jn.BroadcastOperator(this.adapter).to(i)}in(i){return new Jn.BroadcastOperator(this.adapter).in(i)}except(i){return new Jn.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 Jn.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 Jn.BroadcastOperator(this.adapter).allSockets()}compress(i){return new Jn.BroadcastOperator(this.adapter).compress(i)}get volatile(){return new Jn.BroadcastOperator(this.adapter).volatile}get local(){return new Jn.BroadcastOperator(this.adapter).local}timeout(i){return new Jn.BroadcastOperator(this.adapter).timeout(i)}fetchSockets(){return new Jn.BroadcastOperator(this.adapter).fetchSockets()}socketsJoin(i){return new Jn.BroadcastOperator(this.adapter).socketsJoin(i)}socketsLeave(i){return new Jn.BroadcastOperator(this.adapter).socketsLeave(i)}disconnectSockets(i=!1){return new Jn.BroadcastOperator(this.adapter).disconnectSockets(i)}}Wp.Namespace=$R});var WR=a((wR)=>{Object.defineProperty(wR,"__esModule",{value:!0});wR.yeast=wR.decode=wR.encode=void 0;var AR="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),p1=64,vR={},JR=0,lp=0,FR;function xF(i){let o="";do o=AR[i%p1]+o,i=Math.floor(i/p1);while(i>0);return o}wR.encode=xF;function XV(i){let o=0;for(lp=0;lp<i.length;lp++)o=o*p1+vR[i.charAt(lp)];return o}wR.decode=XV;function WV(){let i=xF(+new Date);if(i!==FR)return JR=0,FR=i;return i+"."+xF(JR++)}wR.yeast=WV;for(;lp<p1;lp++)vR[AR[lp]]=lp});var fF=a((YR)=>{var TF;Object.defineProperty(YR,"__esModule",{value:!0});YR.SessionAwareAdapter=YR.Adapter=void 0;var GV=Hi("events"),KV=WR(),c1=Hi("ws"),HV=typeof((TF=c1===null||c1===void 0?void 0:c1.Sender)===null||TF===void 0?void 0:TF.frame)==="function";class mF extends GV.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(HV&&n.length===1&&typeof n[0]==="string"){let p=Buffer.from("4"+n[0]);o.wsPreEncodedFrame=c1.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=mF;class RR extends mF{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(UV(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=KV.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 UV(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=a((bn)=>{var uV=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 ZV=fF(),MV=Go(),QV=Hi("crypto"),ei=MV.debug("socket.io-adapter"),SV="emitter",x1=5000;function Qx(){return QV.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 Mx(i){return{rooms:new Set(i.rooms),except:new Set(i.except),flags:i.flags}}class $F extends ZV.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 ei("[%s] ignore message from self",this.uid);switch(ei("[%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,Mx(i.data.opts),(p)=>{ei("[%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)=>{ei("[%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=Mx(i.data.opts);this.addOffsetIfNecessary(p,c,o),super.broadcast(p,c)}break}case ii.SOCKETS_JOIN:super.addSockets(Mx(i.data.opts),i.data.rooms);break;case ii.SOCKETS_LEAVE:super.delSockets(Mx(i.data.opts),i.data.rooms);break;case ii.DISCONNECT_SOCKETS:super.disconnectSockets(Mx(i.data.opts),i.data.close);break;case ii.FETCH_SOCKETS:{ei("[%s] calling fetchSockets with opts %j",this.uid,i.data.opts),super.fetchSockets(Mx(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=uV(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,ei("[%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:ei("[%s] unknown message type: %s",this.uid,i.type)}}onResponse(i){var o,n;let p=i.data.requestId;switch(ei("[%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:ei("[%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 ei("[%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){ei("[%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){ei("[%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){ei("[%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 J=this.requests.get(x);if(J)m(new Error(`timeout reached: only ${J.current} responses received out of ${J.expected}`)),this.requests.delete(x)},i.flags.timeout||x1),$={type:ii.FETCH_SOCKETS,resolve:T,timeout:f,current:0,expected:c,responses:n};this.requests.set(x,$),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(ei('[%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)},x1),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)=>{ei("[%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)=>{ei("[%s] error while publishing response: %s",this.uid,n)})}}bn.ClusterAdapter=$F;class KR extends $F{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)ei("[%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 ei("[%s] ignore message from self",this.uid);if(i.uid&&i.uid!==SV)this.nodesMap.set(i.uid,Date.now());switch(ei("[%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(ei('[%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)},x1),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 J=this.customRequests.get(x);if(J)m(new Error(`timeout reached: missing ${J.missingUids.size} responses`)),this.customRequests.delete(x)},i.flags.timeout||x1),$={type:ii.FETCH_SOCKETS,resolve:T,timeout:f,missingUids:new Set([...this.nodesMap.keys()]),responses:n};this.customRequests.set(x,$),this.publish({type:ii.FETCH_SOCKETS,data:{opts:Gc(i),requestId:x}})})}onResponse(i){let o=i.data.requestId;switch(ei("[%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 T1=a((Kc)=>{Object.defineProperty(Kc,"__esModule",{value:!0});Kc.MessageType=Kc.ClusterAdapterWithHeartbeat=Kc.ClusterAdapter=Kc.SessionAwareAdapter=Kc.Adapter=void 0;var UR=fF();Object.defineProperty(Kc,"Adapter",{enumerable:!0,get:function(){return UR.Adapter}});Object.defineProperty(Kc,"SessionAwareAdapter",{enumerable:!0,get:function(){return UR.SessionAwareAdapter}});var JF=HR();Object.defineProperty(Kc,"ClusterAdapter",{enumerable:!0,get:function(){return JF.ClusterAdapter}});Object.defineProperty(Kc,"ClusterAdapterWithHeartbeat",{enumerable:!0,get:function(){return JF.ClusterAdapterWithHeartbeat}});Object.defineProperty(Kc,"MessageType",{enumerable:!0,get:function(){return JF.MessageType}})});var MR=a((Sx)=>{var EV=Sx&&Sx.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Sx,"__esModule",{value:!0});Sx.ParentNamespace=void 0;var zR=cF(),OV=T1(),_V=EV(Go()),uR=_V.default("socket.io:parent-namespace");class m1 extends zR.Namespace{constructor(i){super(i,"/_"+m1.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){uR("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)uR("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")}}Sx.ParentNamespace=m1;m1.count=0;class ZR extends OV.Adapter{broadcast(i,o){this.nsp.children.forEach((n)=>{n.adapter.broadcast(i,o)})}}});var _R=a((Uc)=>{var yV=Uc&&Uc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Uc,"__esModule",{value:!0});Uc.patchAdapter=CV;Uc.restoreAdapter=DV;Uc.serveFile=IV;var Hc=T1(),QR=Hi("fs"),LV=yV(Go()),f1=LV.default("socket.io:adapter-uws"),FF="\x1F",{addAll:VR,del:ER,broadcast:OR}=Hc.Adapter.prototype;function CV(i){Hc.Adapter.prototype.addAll=function(o,n){let p=!this.sids.has(o);VR.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"){SR(this.nsp.name,c,p,n);return}if(p)c.conn.on("upgrade",()=>{let x=this.sids.get(o);if(x)SR(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}${FF}${n}`;f1("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}${FF}${n.rooms.keys().next().value}`;f1("fast publish to %s",m),T.forEach((f)=>{let $=typeof f!=="string";i.publish(m,$?f:"4"+f,$)}),this.apply(n,(f)=>{if(f.conn.transport.name!=="websocket")f.client.writeToEngine(T,x)})}}function SR(i,o,n,p){let c=o.conn.id,x=o.conn.transport.socket;if(n)f1("subscribe connection %s to topic %s",c,i),x.subscribe(i);p.forEach((T)=>{let m=`${i}${FF}${T}`;f1("subscribe connection %s to topic %s",c,m),x.subscribe(m)})}function DV(){Hc.Adapter.prototype.addAll=VR,Hc.Adapter.prototype.del=ER,Hc.Adapter.prototype.broadcast=OR}var BV=(i)=>{let{buffer:o,byteOffset:n,byteLength:p}=i;return o.slice(n,n+p)};function IV(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=BV(m);i.cork(()=>{let $=i.getWriteOffset(),[J,F]=i.tryEnd(f,n);if(!F&&!J)p.pause(),i.onWritable((A)=>{let[X,Y]=i.tryEnd(f.slice(A-$),n);if(!Y&&X)p.resume();return X})})};i.onAborted(c),p.on("data",T).on("error",x).on("end",c)}});var yR=a((jpi,NV)=>{NV.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 aR=a((Do,dT)=>{var __dirname="/home/runner/work/wayforge/wayforge/node_modules/.pnpm/socket.io@4.8.1/node_modules/socket.io/dist",bV=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]}),jV=Do&&Do.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),aV=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))bV(o,i,n)}return jV(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 PV=Hi("http"),lV=Hi("fs"),AF=Hi("zlib"),qV=Nf(),$1=Hi("stream"),LR=Hi("path"),CR=E9(),kV=t9(),DR=Hi("events"),wF=cF();Object.defineProperty(Do,"Namespace",{enumerable:!0,get:function(){return wF.Namespace}});var hV=MR(),BR=T1(),gV=aV(sT()),sV=bR(Go()),jR=pF();Object.defineProperty(Do,"Socket",{enumerable:!0,get:function(){return jR.Socket}});var tV=n1(),vF=_R(),dV=bR(hJ()),on=sV.default("socket.io:server"),IR=yR().version,NR=/\.map/;class Vx extends tV.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||gV,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||BR.SessionAwareAdapter);else this.adapter(o.adapter||BR.Adapter);if(o.cleanupEmptyChildNamespaces=!!o.cleanupEmptyChildNamespaces,this.sockets=this.of("/"),i||typeof i=="number")this.attach(i);if(this.opts.cors)this._corsMiddleware=dV.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=PV.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 CR.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='"'+IR+'"',$="W/"+f,J=c.getHeader("if-none-match");if(J){if(f===J||$===J){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 F=LR.join(__dirname,"../client-dist/",x);vF.serveFile(p,F)});vF.patchAdapter(i)}initEngine(i,o){if(on("creating engine.io instance with opts %j",o),this.eio=CR.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='"'+IR+'"',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),Vx.sendFile(n,i,o)}static sendFile(i,o,n){let p=lV.createReadStream(LR.join(__dirname,"../client-dist/",i)),c=qV(o).encodings(["br","gzip","deflate"]),x=(T)=>{if(T)n.end()};switch(c){case"br":n.writeHead(200,{"content-encoding":"br"}),$1.pipeline(p,AF.createBrotliCompress(),n,x);break;case"gzip":n.writeHead(200,{"content-encoding":"gzip"}),$1.pipeline(p,AF.createGzip(),n,x);break;case"deflate":n.writeHead(200,{"content-encoding":"deflate"}),$1.pipeline(p,AF.createDeflate(),n,x);break;default:n.writeHead(200),$1.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 kV.Client(this,i);if(i.protocol===3)o.connect("/");return this}of(i,o){if(typeof i==="function"||i instanceof RegExp){let p=new hV.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 wF.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(),vF.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=Vx;var rV=Object.keys(DR.EventEmitter.prototype).filter(function(i){return typeof DR.EventEmitter.prototype[i]==="function"});rV.forEach(function(i){Vx.prototype[i]=function(){return this.sockets[i].apply(this.sockets,arguments)}});dT.exports=(i,o)=>new Vx(i,o);dT.exports.Server=Vx;dT.exports.Namespace=wF.Namespace;dT.exports.Socket=jR.Socket});import{createHash as CY}from"crypto";import{createServer as $O}from"http";import{createServer as JO}from"https";var Kp=(i)=>Array.isArray(i)?i:[i],JA=(i,o)=>{let n=[[],[]];for(let p of i)if(o(p))n[0].push(p);else n[1].push(p);return n},Jm=Array,op=(i,o)=>i.includes(o),FA=(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)=>$o(i)===o,$o=(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 U=(i)=>cp(i,bx),Vn=(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(([$,J])=>{if(typeof $==="object")n[$.group]=Ai(n[$.group],J);else n[$]=J})}),c?Object.values(n):n};var D1=Object.entries;var di=(i,o)=>(i in o),Oc=(i,o)=>(o in i);class B1{constructor(i){Object.assign(this,i)}}var WA=class{};class jx extends WA{}var DG=(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)=>DG(i,o)[1],qn=(i)=>Object.keys(i).length===0,ax=(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=Vn("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},N1=globalThis.File??Blob,b1={ArrayBuffer,Blob,File:N1,FormData,Headers,Request,Response,URL},BG={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},hp={...I1,...b1,...BG,String,Number,Boolean},Px=(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?Px(i)??"object":$o(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"},NG={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"},bG={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,...NG,...bG},qx=(i)=>{let o=Object(i).name??null;return o&&di(o,hp)&&hp[o]===i?o:null};var j1=(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 jG=(i)=>{let o=nn;return()=>o===nn?o=i():o},Hp=(i)=>typeof i==="function"&&i.length===0;var uA=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=jG(()=>{try{return new Function("return false")()}catch{return!0}});var yO=Vn("brand");var MA=Vn("arkInferred");var DO=Vn("args");class Vo{constructor(){}}var aG=()=>{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:aG,env:PG};var SA=(i)=>i[0].toUpperCase()+i.slice(1);var a1=(i)=>new RegExp(lG(i),typeof i==="string"?"":i.flags);var lG=(i)=>{return`^(?:${typeof i==="string"?i:i.source})$`};var xp={negativeLookahead:(i)=>`(?!${i})`,nonCapturingGroup:(i)=>`(?:${i})`},kx="\\",Up={" ":1,"\n":1,"\t":1};var qG=/^-0\.?0*$/.source,EA=/[1-9]\d*/.source,kG=/\.\d+/.source,hG=/\.\d*[1-9]/.source,OA=(i)=>a1(xp.negativeLookahead(qG)+xp.nonCapturingGroup("-?"+xp.nonCapturingGroup(xp.nonCapturingGroup("0|"+EA)+xp.nonCapturingGroup(i.decimalPattern)+"?")+(i.allowDecimalOnly?"|"+i.decimalPattern:"")+"?")),VA=OA({decimalPattern:hG,allowDecimalOnly:!1}),gG=VA.test.bind(VA),Fm=OA({decimalPattern:kG,allowDecimalOnly:!0}),PO=Fm.test.bind(Fm),sG=/^-?\d*\.?\d*$/,tG=(i)=>i.length!==0&&sG.test(i),hx=a1(xp.negativeLookahead("^-0$")+"-?"+xp.nonCapturingGroup(xp.nonCapturingGroup("0|"+EA))),dG=hx.test.bind(hx),P1=/^-?\d+$/,rG=P1.test.bind(P1),_A={number:"a number",bigint:"a bigint",integer:"an integer"},yA=(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`,eG=(i,o)=>o==="number"?gG(i):dG(i),i2=(i,o)=>o==="number"?Number(i):Number.parseInt(i),o2=(i,o)=>o==="number"?tG(i):rG(i),LA=(i,o)=>l1(i,"number",o),CA=(i,o)=>l1(i,"number",{...o,strict:!0}),DA=(i,o)=>l1(i,"integer",o),l1=(i,o,n)=>{let p=i2(i,o);if(!Number.isNaN(p)){if(o2(i,o)){if(n?.strict)return eG(i,o)?p:U(yA(i,o));return p}}return n?.errorOnFail?U(n?.errorOnFail===!0?`Failed to parse ${_A[o]} from '${i}'`:n?.errorOnFail):void 0},BA=(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 U(yA(i,"bigint"))};var n2="0.45.9",p2={version:n2,filename:QA.fileName(),FileConstructor:N1},gp=p2,IA=new WeakMap,q1=Object.create(null),gx=(i)=>{let o=IA.get(i);if(o)return o;let n=c2(i);if(q1[n])n=`${n}${q1[n]++}`;else q1[n]=1;return gp[n]=i,IA.set(i,n),n},_c=(i)=>/^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(i),c2=(i)=>{switch(typeof i){case"object":{if(i===null)break;let o=Px(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 ${$o(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($o(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($o(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=`${x2[n]} ${p}, ${o}`;if(c===0&&x===0&&T===0&&m===0)return f;let $=i.toLocaleTimeString(),J=$.endsWith(" AM")||$.endsWith(" PM")?$.slice(-3):"";if(J)$=$.slice(0,-J.length);if(m)$+=`.${m2(m,3)}`;else if(T2.test($))$=$.slice(0,-3);return`${$+J}, ${f}`},x2=["January","February","March","April","May","June","July","August","September","October","November","December"],T2=/:\d\d:00$/,m2=(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 U(`${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 Jm{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 k1{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 v_=Vn("implementedTraits");var h1="$ark",f2=2;while(h1 in globalThis)h1=`$ark${f2++}`;var jA=h1;globalThis[jA]=gp;var S=gp,$2=(i)=>`${jA}.${i}`,ki=(i)=>$2(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 g1(i,o)}index(i,o=!1){return aA(`${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 uA(...this.argNames,this.body)}}var mp=(i)=>qo(i,"object")||typeof i==="symbol"?ki(i):Am(i),g1=(i,o=!1)=>{if(typeof i==="string"&&_c(i))return`${o?"?":""}.${i}`;return aA(J2(i),o)},J2=(i)=>typeof i==="symbol"?ki(i):JSON.stringify(i),aA=(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=Vn("arkKind"),P=(i,o)=>i?.[No]===o,Bi=(i)=>P(i,"root")||P(i,"constraint");var PA=["unit","proto","domain"],yc=["required","optional","index","sequence"],s1=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],Wm=[...s1,...yc,"structure","predicate"],Lc=["alias","union","morph","unit","intersection","proto","domain"],F2=[...Lc,...Wm],Rm=pi(Wm,(i,o)=>[o,1]),lA=pi([...yc,"undeclared"],(i,o)=>[o,1]),qA=pi(F2,(i,o)=>[o,i]),Cc=(i)=>typeof i==="string"&&(i in qA);var Dc=(i)=>qA[i],Ym=(i)=>Lc.slice(Dc(i)+1),t_=[...Ym("union"),"alias"],d_=[...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};S.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]=Cc(p)?{...i[p],...o[p]}:o[p]}return n};class up 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(($)=>({...$,path:AA(i,$.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 up(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 Jm{[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 t1(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 up({...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 up({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 t1 extends Error{name="TraversalError";constructor(i){if(i.length===1)super(i.summary);else super(`
57
+ `+i.map((o)=>` \u2022 ${A2(o)}`).join(`
58
+ `));Object.defineProperty(this,"arkErrors",{value:i,enumerable:!1})}}var A2=(i)=>i.toString().split(`
59
+ `).join(`
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 up(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=Bi(c),T=c(p===void 0?this.root:p[n],this);if(T instanceof up){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)=>W2(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=X2(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=Bi(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(PA,this.kind)}isConstraint(){return op(Wm,this.kind)}isStructural(){return op(yc,this.kind)}isRefinement(){return op(s1,this.kind)}isRoot(){return op(Lc,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,($,J)=>{if(!this.impl.keys[$].child)return[$,J];let F=J;if(!Oi(F)){let X=F._transform(i,o);return X?[$,X]:[]}if(F.length===0)return[$,J];let A=F.flatMap((X)=>{return X._transform(i,o)??[]});return A.length?[$,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(Bi(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:S.intrinsic.unknown}:null;if(this.kind==="morph")T.in??=S.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)}.`,v2=(i)=>Tp(i,{stringifyNonKey:(o)=>o.expression}),w2=/"(\$ark\.[^"]+)"/g,X2=(i)=>JSON.stringify(i).replaceAll(w2,"$1"),_n=(i,o)=>({path:i,node:o,propString:v2(i)}),hA=(i,o)=>i.propString===o.propString&&i.node.equals(o.node),d1=(i,o)=>ln(i,o,{isEqual:hA}),W2=(i,o)=>ln(i,o,{isEqual:(n,p)=>n.equals(p)});class y extends Array{static init(i,o,n,p){return new y({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 e1(`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 U(this.describeReasons())}invert(){let i=this.map((o)=>({...o,l:o.r,r:o.l}));if(!(i instanceof y))return new y(...i);return i}withPrefixKey(i,o){return this.map((n)=>({...n,path:[i,...n.path],optional:n.optional||o==="optional"}))}toNeverIfDisjoint(){return S.intrinsic.never}}var gA=(i,o)=>`${r1(i)} and ${r1(o)}`,r1=(i)=>Bi(i)?i.expression:Oi(i)?i.map(r1).join(" | ")||"never":String(i),e1=(i)=>`${i} results in an unsatisfiable type`;var Bc={},so=(i,o,n)=>Ii(i,o,{$:n,invert:!1,pipe:!1}),oT=(i,o,n)=>Ii(i,o,{$:n,invert:!1,pipe:!0}),Ii=(i,o,n)=>{let p=n.pipe?"|>":"&",c=`${i.hash}${p}${o.hash}`;if(Bc[c]!==void 0)return Bc[c];if(!n.pipe){let m=`${o.hash}${p}${i.hash}`;if(Bc[m]!==void 0){let f=Bc[m],$=f instanceof y?f.invert():f;return Bc[c]=$,$}}let x=!n.pipe||!i.includesTransform&&!o.includesTransform;if(x&&i.equals(o))return i;let T=x?i0(i,o,n):i.hasKindIn(...Lc)?R2(i,o,n):i0(i,o,n);if(Bi(T)){if(i.equals(T))T=i;else if(o.equals(T))T=o}return Bc[c]=T,T},i0=(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 y)x=x.invert();return x}},R2=(i,o,n)=>i.includesTransform||o.includesTransform?n.invert?sA(o,i,n):sA(i,o,n):i0(i,o,n),sA=(i,o,n)=>i.distribute((p)=>Y2(p,o,n),(p)=>{let c=p.filter(Bi);if(c.length===0)return y.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)}),Y2=(i,o,n)=>{if(i.hasKind("morph")){let c=[...i.morphs];if(i.lastMorphIfNode){let x=Ii(i.lastMorphIfNode,o,n);if(x instanceof y)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=Ii(i,o.in,n);if(c instanceof y)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 Eo=(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},Ic=(i)=>{let o=i.r.shift();if(!o){let p=i.l.length===0&&i.kind==="structure"?S.intrinsic.unknown.internal:i.ctx.$.node(i.kind,Object.assign(i.baseInner,G2(i.l)),{prereduced:!0});for(let c of i.roots){if(p instanceof y)return p;p=Ii(c,p,i.ctx)}return p}let n=!1;for(let p=0;p<i.l.length;p++){let c=Ii(i.l[p],o,i.ctx);if(c===null)continue;if(c instanceof y)return c;if(!n){if(c.isRoot())return i.roots.push(c),i.l.splice(p),Ic(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 Ic(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)},G2=(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)=>U(dA(...i)),dA=(i,o,n)=>{let p=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(o).defaultShortDescription;return`${SA(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 $=this.arg$.parse(x[m]);if(!$.extends(this.constraints[m]))U(K2(f,this.constraints[m].expression,$.expression));return[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,S.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 K2=(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 H2=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 o0={implementation:H2,Node:ov};var U2=ni({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:(i)=>Number.isInteger(i)?i:U(z2(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/u2(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=S.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(i){if(i.type="integer",this.rule===1)return i;return i.multipleOf=this.rule,i}}var n0={implementation:U2,Node:nv};var z2=(i)=>`divisor must be an integer (was ${i})`,u2=(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=S2[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} ${Z2[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?E2(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 Z2={"<":">=","<=":">",">":"<=",">=":"<"},M2={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,Q2=(i,o)=>`${i} bound must be a positive integer (was ${o})`,bc=(i)=>(o)=>{if(!Number.isInteger(o)||o<0)U(Q2(i,o));return o},S2={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},V2=(i,o)=>`${di(i,M2)?">":"<"}${o?"":"="}`,E2=(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 O2=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=S.intrinsic.Date.internal;collapsibleLimitString=sp(this.rule);traverseAllows=(i)=>i>=this.rule;reduceJsonSchema(){return Wi.throwUnjsonifiableError("Date instance")}}var p0={implementation:O2,Node:cv};var _2=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:y.init("range",i,o)}});class xv extends pn{collapsibleLimitString=sp(this.rule);traverseAllows=(i)=>i<=this.rule;impliedBasis=S.intrinsic.Date.internal;reduceJsonSchema(){return Wi.throwUnjsonifiableError("Date instance")}}var c0={implementation:_2,Node:xv};var y2=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)=>y.init("unit",n.$.node("unit",{unit:i.rule}),n.$.node("unit",{unit:o.rule}),{path:["length"]}),minLength:(i,o)=>i.rule>=o.rule?i:y.init("range",i,o),maxLength:(i,o)=>i.rule<=o.rule?i:y.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=S.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 x0={implementation:y2,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:y.init("range",i,o)},obviatesBasisDescription:!0});class mv extends pn{impliedBasis=S.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 T0={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:y.init("range",i,o)}});class fv extends pn{impliedBasis=S.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 m0={implementation:C2,Node:fv};var D2=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 $v extends pn{impliedBasis=S.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 f0={implementation:D2,Node:$v};var B2=ni({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:bc("minLength")}},reduce:(i)=>i.rule===0?S.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 Jv extends pn{impliedBasis=S.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 $0={implementation:B2,Node:Jv};var Fv={min:f0.implementation,max:T0.implementation,minLength:$0.implementation,maxLength:m0.implementation,exactLength:x0.implementation,after:p0.implementation,before:c0.implementation},Av={min:f0.Node,max:T0.Node,minLength:$0.Node,maxLength:m0.Node,exactLength:x0.Node,after:p0.Node,before:c0.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=S.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 J0={implementation:I2,Node:vv};var nT=(i,o)=>{let n=N2(i);if(o&&!o.includes(n))return U(`Root of kind ${n} should be one of ${o}`);return n},N2=(i)=>{if(P(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 U(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 U(wv(i))},wv=(i)=>`${oi(i)} is not a valid type schema`,Xv={},b2=(i)=>Oi(i)?i.map((o)=>o.collapsibleJson):i.collapsibleJson,bo={};S.nodesByRegisteredId=bo;var F0=(i)=>{return Xv[i]??=0,`${i}${++Xv[i]}`},A0=(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=D1(x).sort(([$],[J])=>Cc($)?Cc(J)?Dc($)-Dc(J):1:Cc(J)?-1:$<J?-1:1).filter(([$,J])=>{if($.startsWith("meta.")){let F=$.slice(5);return T[F]=J,!1}return!0});for(let $ of m){let J=$[0],F=o.keys[J];if(!F)return U(`Key ${J} is not valid on ${i.kind} schema`);let A=F.parse?F.parse($[1],i):$[1];if(A!==nn&&(A!==void 0||F.preserveUndefined))p[J]=A}if(o.reduce&&!i.prereduced){let $=o.reduce(p,i.$);if($){if($ instanceof y)return $.throw();return j2($,T)}}return v0({id:i.id,kind:i.kind,inner:p,meta:T,$:i.$})},v0=({id:i,kind:o,inner:n,meta:p,$:c,ignoreCache:x})=>{let T=jc[o],m=D1(n),f=[],$={};if(m.forEach(([H,Z])=>{let b=T.keys[H],u=b.serialize??(b.child?b2:An);if($[H]=u(Z),b.child===!0){let M=Z;if(Oi(M))f.push(...M);else f.push(M)}else if(typeof b.child==="function")f.push(...b.child(Z))}),T.finalizeInnerJson)$=T.finalizeInnerJson($);let J={...$},F={};if(!qn(p))F=pi(p,(H,Z)=>[H,H==="examples"?Z:An(Z)]),J.meta=um(F,"description",!0);$=um($,T.collapsibleKey,!1);let A=JSON.stringify({kind:o,...$});J=um(J,T.collapsibleKey,!1);let X=um(J,T.collapsibleKey,!0),Y=JSON.stringify({kind:o,...J});if(c.nodesByHash[Y]&&!x)return c.nodesByHash[Y];let R={id:i,kind:o,impl:T,inner:n,innerEntries:m,innerJson:$,innerHash:A,meta:p,metaJson:F,json:J,hash:Y,collapsibleJson:X,children:f};if(o!=="intersection"){for(let H in n)if(H!=="in"&&H!=="out")R[H]=n[H]}let K=new Rv[o](R,c);return c.nodesByHash[Y]=K},Wv=(i,o)=>{if(i.id===o)return i;if(Bi(bo[o]))Xi(`Unexpected attempt to overwrite node id ${o}`);return v0({id:o,kind:i.kind,inner:i.inner,meta:i.meta,$:i.$,ignoreCache:!0})},j2=(i,o,n)=>{if(n&&Bi(bo[n]))Xi(`Unexpected attempt to overwrite node id ${n}`);return v0({id:n??F0(o.alias??i.kind),kind:i.kind,inner:i.inner,meta:o,$:i.$})},um=(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=Ii(i.value,o.value,n),x=i.required||o.required?"required":"optional";if(c instanceof y)if(x==="optional")c=S.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:U(w0(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=S.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 w0=(i,o)=>`Invalid intersection of default values ${oi(i)} & ${oi(o)}`;var a2=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=l2(this);defaultValueMorphRef=this.defaultValueMorph&&ki(this.defaultValueMorph)}var xT={implementation:a2,Node:Yv},P2={},l2=(i)=>{if(!i.hasDefault())return;let o=`{${i.compiledKey}: ${i.value.id} = ${An(i.default)}}`;return P2[o]??=X0(i.key,i.value,i.default)},X0=(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)U(q2(n));let c=i.in(p?o():o);if(c instanceof ho){if(n===null)U(`Default ${c.summary}`);let x=c.transform((T)=>T.transform((m)=>({...m,prefixPath:[n]})));U(`Default for ${x.summary}`)}return o},q2=(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 U(k2);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 y)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 y?o.throw():o}rawAnd(i){let o=this.rawIntersect(i);return o instanceof y?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(),S.intrinsic.unknown.internal);if(i.branches.length===0)U(e1(`keyof ${this.expression}`));return this._keyof=this.$.finalize(i)}get props(){if(this.branches.length!==1)return U(h2(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)??U(Kv("merge",n.expression))])))}applyStructuralOperation(i,o){return this.distribute((n)=>{if(n.equals(S.intrinsic.object)&&i!=="merge")return n;let p=Gv(n);if(!p)U(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 y)}extends(i){let o=this.intersect(i);return!(o instanceof y)&&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(P(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 y)return o.throw();return o}rawPipeOnce(i){if(P(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 y)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(yc,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",ac(i))}lessThan(i){return this.constrain("max",ac(i))}atLeastLength(i){return this.constrain("minLength",i)}atMostLength(i){return this.constrain("maxLength",i)}moreThanLength(i){return this.constrain("minLength",ac(i))}lessThanLength(i){return this.constrain("maxLength",ac(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",ac(i))}earlierThan(i){return this.constrain("before",ac(i))}}var k2="Expected a non-empty brand name after #",ac=(i)=>typeof i==="object"&&!(i instanceof Date)?{...i,exclusive:!0}:{rule:i,exclusive:!0},mT=(i,o)=>P(o,"root")?P(i,"root")?i.extends(o):o.allows(i):P(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(S.intrinsic.emptyStructure):null);if(i.isBasis()&&i.domain==="object")return i.$.bindReference(S.intrinsic.emptyStructure);return null},h2=(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 g2=(i)=>typeof i==="string"?{reference:i}:i,Hv=(i)=>i instanceof y?S.intrinsic.never.internal:i,s2=ni({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:(i)=>i.startsWith("$")?i:`$ark.${i}`},resolve:{}},normalize:g2,defaults:{description:(i)=>i.reference},intersections:{alias:(i,o,n)=>n.$.lazilyResolve(()=>Hv(Ii(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(S.intrinsic.object))return y.init("assignability",S.intrinsic.object,o);return n.$.lazilyResolve(()=>Hv(Ii(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(P(o,"context")){if(n.includes(o.id))return U(t2(o.id,n));n.push(o.id),o=bo[o.id]}if(!P(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(P(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 t2=(i,o)=>`Alias '${i}' has a shallow resolution cycle: ${[...o,i].join("->")}`,fT={implementation:s2,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 d2=ni({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:(i)=>typeof i==="string"?{domain:i}:Oc(i,"numberAllowsNaN")&&i.domain!=="number"?U(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[$o(i)]},intersections:{domain:(i,o)=>i.domain==="number"&&o.domain==="number"?i.numberAllowsNaN?o:i:y.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)=>$o(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:d2,Node:zv,writeBadAllowNanMessage:(i)=>`numberAllowsNaN may only be specified with domain "number" (was ${i})`};var r2=ni({kind:"intersection",hasAssociatedError:!0,normalize:(i)=>{if(Bi(i))return i;let{structure:o,...n}=i,p=!!o,c=o??{},x=pi(n,(T,m)=>{if(di(T,lA)){if(p)U(`Flattened structure key ${T} cannot be specified alongside a root 'structure' key.`);return c[T]=m,[]}return[T,m]});if(P(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:Eo("divisor")},max:{child:!0,parse:Eo("max")},min:{child:!0,parse:Eo("min")},maxLength:{child:!0,parse:Eo("maxLength")},minLength:{child:!0,parse:Eo("minLength")},exactLength:{child:!0,parse:Eo("exactLength")},before:{child:!0,parse:Eo("before")},after:{child:!0,parse:Eo("after")},pattern:{child:!0,parse:Eo("pattern")},predicate:{child:!0,parse:Eo("predicate")}},reduce:(i,o)=>uv({},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)=>uv(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?Ii(T,o,n):o;return m instanceof y?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=e2(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 W0={implementation:r2,Node:Zv},e2=(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},uv=(i,o,n)=>{let p={},c=i.proto??i.domain,x=o.proto??o.domain,T=c?x?Ii(c,x,n):c:x;if(T instanceof y)return T;if(T)p[T.kind]=T;return Ic({kind:"intersection",baseInner:p,l:Nc(i),r:Nc(o),roots:[],ctx:n})};var iK=ni({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(i,o)=>o.$.parseSchema(i)},morphs:{parse:Kp,serialize:(i)=>i.map((o)=>P(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 U(oK(i.expression,o.expression));let p=Ii(i.in,o.in,n);if(p instanceof y)return p;let c={morphs:i.morphs};if(i.declaredIn||o.declaredIn){let x=Ii(i.in,o.in,n);if(x instanceof y)return x.throw();else c.declaredIn=x}if(i.declaredOut||o.declaredOut){let x=Ii(i.out,o.out,n);if(x instanceof y)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?Ii(i.inner.in,o,n):o;return p instanceof y?p:p.equals(i.inner.in)?i:n.$.node("morph",{...i.inner,in:p})})}});class Mv extends wn{serializedMorphs=this.morphs.map(ki);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=P(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(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||P(o,"root")&&P(n,"root")&&o.equals(n)})}}var R0={implementation:iK,Node:Mv},oK=(i,o)=>`The intersection of distinct morphs at a single path is indeterminate:
70
+ Left: ${i}
71
+ Right: ${o}`;var nK=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"?Bi(i)?i:{proto:i}:typeof i.proto==="string"?{...i,proto:hp[i.proto]}:i;if(typeof o.proto!=="function")U($T.writeInvalidSchemaMessage(o.proto));if(Oc(o,"dateAllowsInvalid")&&o.proto!==Date)U($T.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:j1(i.proto,o.proto)?i:j1(o.proto,i.proto)?o:y.init("proto",i,o),domain:(i,o)=>o.domain==="object"?i:y.init("domain",S.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 $T={implementation:nK,Node:Qv,writeBadInvalidDateMessage:(i)=>`dateAllowsInvalid may only be specified with constructor Date (was ${i.name})`,writeInvalidSchemaMessage:(i)=>`instanceOf operand must be a function (was ${$o(i)})`};var pK=ni({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(i,o)=>{let n=[];if(i.forEach((p)=>{(P(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=vK(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,Pc),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=Pc(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 Pc(n)},problem:(i)=>i.expected,message:(i)=>i.problem},intersections:{union:(i,o,n)=>{if(i.isNever!==o.isNever)return y.init("presence",i,o);let p;if(i.ordered){if(o.ordered)U(XK(i.expression,o.expression));if(p=Y0(o.branches,i.branches,n),p instanceof y)p.invert()}else p=Y0(i.branches,o.branches,n);if(p instanceof y)return p;return n.$.parseSchema(i.ordered||o.ordered?{branches:p,ordered:!0}:{branches:p})},...kn("union",(i,o,n)=>{let p=Y0(i.branches,[o],n);if(p instanceof y)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]=S.intrinsic.boolean;return}i.push(n)}),i}unitBranches=this.branches.filter((i)=>i.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?JK(this.discriminant):null;expression=this.distribute((i)=>i.nestableExpression,AK);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,Pc)}innerToJsonSchema(i){if(this.branchGroups.length===1&&this.branchGroups[0].equals(S.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 $ in n){let J=n[$],F=$==="default"?$:`case ${$}`;i.line(`${F}: return ${J===!0?c?i.data:J:c?`${i.invoke(J)} ? ${J.contextFreeMorph?`${ki(J.contextFreeMorph)}(${i.data})`:i.data} : "${nn}"`:i.invoke(J)}`)}return i}),i.traversalKind==="Allows"){i.return(c?`"${nn}"`:!1);return}let x=Pc(this.discriminant.kind==="domain"?p.map(($)=>{let J=$.slice(1,-1);return J==="function"?ko.object:ko[J]}):p),T=this.discriminant.path.map(($)=>typeof $==="symbol"?ki($):JSON.stringify($)),m=JSON.stringify(x),f=this.discriminant.kind==="domain"?`${fK}[${o}]`:`${$K}(${o})`;i.line(`ctx.errorFromNodeContext({
72
+ code: "predicate",
73
+ expected: ${m},
74
+ actual: ${f},
75
+ relativePath: [${T}],
76
+ meta: ${this.compiledMeta}
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 y))continue;for(let $ of f){if(!$.kind||$.optional)continue;let J,F;if($.kind==="domain"){let{l:X,r:Y}=$;J=`"${typeof X==="string"?X:X.domain}"`,F=`"${typeof Y==="string"?Y:Y.domain}"`}else if($.kind==="unit")J=$.l.serializedValue,F=$.r.serializedValue;else continue;let A=i.find((X)=>pp(X.path,$.path)&&X.kind===$.kind);if(!A)i.push({kind:$.kind,cases:{[J]:{branchIndices:[c],condition:$.l},[F]:{branchIndices:[T],condition:$.r}},path:$.path});else{if(A.cases[J])A.cases[J].branchIndices=ln(A.cases[J].branchIndices,c);else A.cases[J]??={branchIndices:[c],condition:$.l};if(A.cases[F])A.cases[F].branchIndices=ln(A.cases[F].branchIndices,T);else A.cases[F]??={branchIndices:[T],condition:$.r}}}}}let o=this.ordered?TK(i,this.branches):i;if(!o.length)return null;let n=cK(o,this),p={};for(let c in n.best.cases){let x=xK(n,c);if(x===null){p[c]=!0;continue}if(x.length===this.branches.length)return null;if(this.ordered)x.sort((f,$)=>f.originalIndex-$.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 cK=(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}},xK=(i,o)=>{let n=i.best.cases[o],p=mK(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=Sv(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=Sv(m.branch,i.location);c?.push({originalIndex:m.originalIndex,branch:f})}x.push(m)}}return i.defaultEntries=x,c},TK=(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 $ of T)for(let J of f)if($>J){if(o[$].overlaps(o[J]))return!1}}}return!0})},mK=(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:[...FA(x).map((T)=>({})),p]}:{domain:"object",required:[{key:x,value:p}]})}return p},Ov=(i)=>i.reduce((o,n)=>o+g1(n,!0),"data"),fK=ki(wA),$K=ki(oi),G0={implementation:pK,Node:Ev},JK=(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])}),FK={delimiter:" | ",finalDelimiter:" | "},AK=(i)=>Pc(i,FK),Pc=(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}`},Y0=(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=Ii(i[x],o[m],n);if(f instanceof y)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?y.init("union",i,o):c},vK=({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 y)continue;if(!o)wK(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])},wK=(i,o)=>{if(!i.includesTransform&&!o.includesTransform)return;if(!pp(i.shallowMorphs,o.shallowMorphs))U(Vv(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)}))U(Vv(i.expression,o.expression))},Sv=(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"}}),Vv=(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}`,XK=(i,o)=>`The intersection of two ordered unions is indeterminate:
80
+ Left: ${i}
81
+ Right: ${o}`;var WK=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)=>y.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:S.intrinsic.object;if(i.domain!==p.domain){let c=i.domain==="undefined"||i.domain==="null"||i.domain==="boolean"?i.domain:S.intrinsic[i.domain];return y.init("domain",c,p)}}return y.init("assignability",i,o.hasKind("intersection")?o.children.find((p)=>!p.allows(i.unit)):o)})}});class yv 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=$o(this.unit);get defaultShortDescription(){return this.domain==="object"?ko.object:this.description}innerToJsonSchema(i){return this.unit===null?{type:"null"}:S.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 K0={implementation:WK,Node:yv},_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 RK=ni({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(i,o)=>{let n=o.$.parseSchema(i);if(!n.extends(S.intrinsic.key))return U(GK(n.expression));let p=n.branches.filter((c)=>c.hasKind("unit"));if(p.length)return U(YK(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=Ii(i.value,o.value,n),c=p instanceof y?S.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 Lv extends vn{impliedBasis=S.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)=>ax(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)=>ax(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 H0={implementation:RK,Node:Lv},YK=(i)=>`Index keys ${i.join(", ")} should be specified as named props.`,GK=(i)=>`Indexed key definition '${i}' must be a string or symbol`;var KK=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 Cv 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 U0={implementation:KK,Node:Cv};var HK=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 U(ZK);if(i.optionals?.length||i.defaultables?.length)return U(u0)}if(i.minVariadicLength&&!i.variadic)return U("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=JT({l:i.tuple,r:o.tuple,disjoint:new y,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 Bv extends vn{impliedBasis=S.intrinsic.Array.internal;tuple=uK(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 d1(this.flatRefs,this.prevariadic.flatMap((i,o)=>Ai(i.node.flatRefs.map((n)=>_n([`${o}`,...n.path],n.node)),_n([`${o}`],i.node)))),d1(this.flatRefs,this.variadicOrPostfix.flatMap((i)=>Ai(i.flatRefs.map((o)=>_n([S.intrinsic.nonNegativeIntegerString.internal,...o.path],o.node)),_n([S.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=zK(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(S.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 UK={},zK=(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(X0(c,x,T)),n+=`${c}: ${x.id} = ${An(T)}, `}return n+="]",UK[n]??=o},z0={implementation:HK,Node:Bv},uK=(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},{}),u0="A postfix required element cannot follow an optional or defaultable element",ZK="A postfix element requires a variadic element",JT=(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 F=JT({...i,fixedVariants:[],r:c.map((A)=>({...A,kind:"prefix"}))});if(F.disjoint.length===0)i.fixedVariants.push(F)}else if(p.kind==="prefix"&&o.kind==="variadic"&&x){let F=JT({...i,fixedVariants:[],l:n.map((A)=>({...A,kind:"prefix"}))});if(F.disjoint.length===0)i.fixedVariants.push(F)}let f=Ii(o.node,p.node,i.ctx);if(f instanceof y)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:S.intrinsic.never.internal}];else if(m==="optionals"||m==="defaultables")return i;else return JT({...i,fixedVariants:[],l:n.map((F)=>({...F,kind:"prefix"})),r:n.map((F)=>({...F,kind:"prefix"}))});else if(m==="defaultables"){if(o.kind==="defaultables"&&p.kind==="defaultables"&&o.default!==p.default)U(w0(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 $=i.l.length,J=i.r.length;if(o.kind!=="variadic"||$>=J&&(p.kind==="variadic"||J===1))i.l=n;if(p.kind!=="variadic"||J>=$&&(o.kind==="variadic"||$===1))i.r=c;return JT(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??"{}"},MK=bv("description"),QK=bv("expression"),Iv=(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 y)if(p==="optional")return n.node("optional",{key:i.key,value:S.intrinsic.never.internal});else return c.withPrefixKey(i.key,i.kind);return null},SK=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:Eo("required"),reduceIo:(i,o,n)=>{o.required=Ai(o.required,n.map((p)=>p[i]));return}},optional:{child:!0,parse:Eo("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:Eo("index")},sequence:{child:!0,parse:Eo("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:MK},intersections:{structure:(i,o,n)=>{let p={...i.inner},c={...o.inner},x=new y;if(i.undeclared){let f=i.keyof();if(o.requiredKeys.forEach(($)=>{if(!f.allows($))x.add("presence",S.intrinsic.never.internal,o.propsByKey[$].value,{path:[$]})}),c.optional)c.optional=c.optional.filter(($)=>f.allows($.key));if(c.index)c.index=c.index.flatMap(($)=>{if($.signature.extends(f))return $;let J=so(f,$.signature,n.$);if(J instanceof y)return[];let F=Mm(J,$.value,n.$);if(F.required)c.required=np(c.required,F.required);if(F.optional)c.optional=np(c.optional,F.optional);return F.index??[]})}if(o.undeclared){let f=o.keyof();if(i.requiredKeys.forEach(($)=>{if(!f.allows($))x.add("presence",i.propsByKey[$].value,S.intrinsic.never.internal,{path:[$]})}),p.optional)p.optional=p.optional.filter(($)=>f.allows($.key));if(p.index)p.index=p.index.flatMap(($)=>{if($.signature.extends(f))return $;let J=so(f,$.signature,n.$);if(J instanceof y)return[];let F=Mm(J,$.value,n.$);if(F.required)p.required=np(p.required,F.required);if(F.optional)p.optional=np(p.optional,F.optional);return F.index??[]})}let T={};if(i.undeclared||o.undeclared)T.undeclared=i.undeclared==="reject"||o.undeclared==="reject"?"reject":"delete";let m=Ic({kind:"structure",baseInner:T,l:Nc(p),r:Nc(c),roots:[],ctx:n});if(m instanceof y)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=Iv(m,T,o);if(f instanceof y)return f}for(let[m,f]of c.entries()){let $=Iv(f,T,o);if($ instanceof y)return $;if($===null)continue;x[m]=$,n=!0}}if(n)return o.node("structure",{...i,optional:x},{prereduced:!0})}}});class jv extends vn{impliedBasis=S.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=QK(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(Bi(n)){if(n.kind!=="required"&&n.kind!=="optional")return U(`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 U(Nv(this.expression,o))}get(i,...o){let n,p=!1,c=_K(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,S.intrinsic.nonNegativeIntegerString))if(P(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&&P(c,"root")&&c.extends(S.intrinsic.number))return U(yK(c.expression,this.sequence.expression));return U(Nv(this.expression,[c]))}let x=n.get(...o);return p?x:x.or(S.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&&S.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",EK(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(["),OK(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(S.intrinsic.string))return i.additionalProperties=n.value.toJsonSchemaRecurse(o);if(!n.signature.extends(S.intrinsic.string))return Wi.throwUnjsonifiableError(`Symbolic index signature ${n.signature.exclude(S.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 Z0={},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},EK=(i)=>{let o=VK(i);if(!o)return;if(Z0[o])return Z0[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 Z0[o]=n},OK=(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")})},M0={implementation:SK,Node:jv},_K=(i)=>{if(P(i,"root")&&i.hasKind("unit"))i=i.unit;if(typeof i==="number")i=`${i}`;return i},yK=(i,o)=>`${i} is not allowed as an array index on ${o}. Use the 'nonNegativeIntegerString' keyword instead.`,Mm=(i,o,n)=>{let[p,c]=JA(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)=>P(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={...Fv,alias:fT.implementation,domain:Zm.implementation,unit:K0.implementation,proto:$T.implementation,union:G0.implementation,morph:R0.implementation,intersection:W0.implementation,divisor:n0.implementation,pattern:J0.implementation,predicate:o0.implementation,required:U0.implementation,optional:xT.implementation,index:H0.implementation,sequence:z0.implementation,structure:M0.implementation};S.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:{}}));S.resolvedConfig=rx(S.defaultConfig,S.config);var Rv={...Av,alias:fT.Node,domain:Zm.Node,unit:K0.Node,proto:$T.Node,union:G0.Node,morph:R0.Node,intersection:W0.Node,divisor:n0.Node,pattern:J0.Node,predicate:o0.Node,required:U0.Node,optional:xT.Node,index:H0.Node,sequence:z0.Node,structure:M0.Node};class lc extends B1{get[No](){return"module"}}var Q0=(i,o)=>new lc(pi(i,(n,p)=>[n,P(p,"module")?Q0(p,o):o.bindReference(p)]));var CK=(i)=>Oi(i)?i:("branches"in i)&&Oi(i.branches)?i.branches:void 0,DK=(i,o)=>U(`Node of kind ${o} is not valid as a ${i} definition`),av=(i)=>`#${i} duplicates public alias ${i}`,S0={};S.ambient??={};var Pv,qv="function $",BK=(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.write(`${n.id}Optimistic`);return`${m}${$},
84
+ `},`{
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(S.config,o),this.resolvedConfig=rx(S.resolvedConfig,o),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(S0).length}`,this.name in S0)U(`A Scope already named ${this.name} already exists`);S0[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)U(av(x));this.aliases[x]=c}else{if(x in this.aliases)U(av(p));this.aliases[x]=c,this.exportedNames.push(x)}if(!P(c,"module")&&!P(c,"generic")&&!Hp(c)){let T=this.preparseOwnDefinitionFormat(c,{alias:x});if(P(T,"root"))this.resolutions[x]=this.bindReference(T);else this.resolutions[x]=this.createParseContext(T).id}}),Pv??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[Pv.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=S.intrinsic?pi(S.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(Bi(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(Bi(o)&&o.kind===p)return o;let x=jc[p].normalize?.(o,this)??o;if(Bi(x))return x.kind===p?x:DK(p,x.kind);return{...n,$:this,kind:p,def:x,prefix:n.alias??p}}bindReference(i){let o;if(Bi(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)??U(O0(i))}maybeResolveRoot(i){let o=this.maybeResolve(i);if(P(o,"generic"))return;return o}maybeResolveSubalias(i){return V0(this.aliases,i)??V0(this.ambient,i)}get ambient(){return S.ambient}maybeResolve(i){let o=this.resolutions[i];if(o){if(typeof o!=="string")return this.bindReference(o);let p=bo[o];if(P(p,"root"))return this.resolutions[i]=p;if(P(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),P(n,"generic"))return this.resolutions[i]=this.bindReference(n);if(P(n,"module"))if(n.root)return this.resolutions[i]=this.bindReference(n.root);else return U(tv(i));return this.resolutions[i]=this.parse(n,{alias:i})}createParseContext(i){let o=i.id??F0(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]=P(p,"module")?Q0(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(Bi(p))return this.bindReference(p);let c=this.createParseContext(p),x=A0(c),T=this.bindReference(x);return bo[c.id]=T};parse=(i,o={})=>this.finalize(this.parseDefinition(i,o));parseDefinition(i,o={}){if(P(i,"root"))return this.bindReference(i);let n=this.preparseOwnDefinitionFormat(i,o);if(P(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)BK(i.references);return i}}class E0 extends Qm{parseOwnDefinitionFormat(i,o){return A0(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,P(n,"root")||P(n,"generic")?n.json:P(n,"module")?gv(n):Xi(`Unexpected resolution ${oi(n)}`)]),V0=(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(!P(c,"module"))return U(IK(p));let x=o.slice(n+1),T=c[x];if(T===void 0)return V0(c,x);if(P(T,"root")||P(T,"generic"))return T;if(P(T,"module"))return T.root??U(tv(o));Xi(`Unexpected resolution for alias '${o}': ${oi(T)}`)},Sm=(i,o)=>new E0(i,o),FT=new E0({});var sv=(i,o)=>{let n={};for(let p in o){let c=o[p];if(P(c,"module")){let x=sv(i,c),T=pi(x,(m,f)=>[`${p}.${m}`,f]);Object.assign(n,T)}else if(P(c,"root")||P(c,"generic"))n[p]=c;else Xi(`Unexpected scope resolution ${oi(c)}`)}return n},O0=(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`;FT.export();var{schema:zi,node:qc,defineSchema:$I,generic:Xn}=FT;var _0="^(?:0|[1-9]\\d*)$",NK=new RegExp(_0),AI=ki(NK);var dv=Sm({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={...dv};var rv=Sm({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:_0}},{prereducedAliases:!0}).export();Object.assign(S.intrinsic,rv);var bK=Sm({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,...bK,emptyStructure:qc("structure",{},{prereduced:!0})};S.intrinsic={...h};var iw=(i)=>typeof i==="string"&&i[0]==="d"&&(i[1]==="'"||i[1]==='"')&&i.at(-1)===i[1],ev=(i)=>i.toString()!=="Invalid Date",ow=(i)=>i.slice(2,-1),y0=(i)=>`'${i}' could not be parsed by the Date constructor`,nw=(i,o)=>jK(i,o),jK=(i,o)=>{let n=new Date(i);if(ev(n))return n;let p=LA(i);if(p!==void 0){let c=new Date(p);if(ev(c))return c}return o?U(o===!0?y0(i):o):void 0};var L0=(i,o)=>{let n=i.scanner.shiftUntil(aK[cw[o]]);if(i.scanner.lookahead==="")return i.error(lK(n,o));if(i.scanner.shift(),o==="/"){try{new RegExp(n)}catch(p){U(String(p))}i.root=i.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(di(o,C0))i.root=i.ctx.$.node("unit",{unit:n});else{let p=nw(n,y0(n));i.root=i.ctx.$.node("unit",{meta:n,unit:p})}},C0={"'":1,'"':1},pw={"/":1,"'":1,'"':1},cw={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},aK={"'":(i)=>i.lookahead==="'",'"':(i)=>i.lookahead==='"',"/":(i)=>i.lookahead==="/"},PK={'"':"double-quote","'":"single-quote","/":"forward slash"},lK=(i,o)=>`${o}${i} requires a closing ${PK[cw[o]]}`;var xw=(i)=>`Private type references should not include '#'. Use '${i}' instead.`,Vm="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 Tw={">":!0,">=":!0},mw={"<":!0,"<=":!0};var kc={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},fw=(i)=>`Unmatched )${i===""?"":` before ${i}`}`,Om=(i)=>`Missing ${i}`,$w=(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})`,Jw=(i,o,n,p)=>`An expression may have at most one left bound (parsed ${i}${kc[o]}, ${n}${kc[p]})`;var Fw=(i,o,n)=>Aw(i,o,n,[]),Aw=(i,o,n,p)=>{let c=n.parseUntilFinalizer();if(p.push(c.root),c.finalizer===">"){if(p.length!==o.params.length)return n.error(D0(i,o.names,p.map((x)=>x.expression)));return p}if(c.finalizer===",")return Aw(i,o,n,p);return c.error(Om(">"))},D0=(i,o,n)=>`${i}<${o.join(", ")}> requires exactly ${o.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`;var B0=(i)=>{let o=i.scanner.shiftUntilNextTerminator();if(o==="keyof")i.addPrefix("keyof");else i.root=kK(i,o)},qK=(i,o,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(D0(i,o.names,[]));let c=Fw(i,o,n);return o(...c)},kK=(i,o)=>hK(i,o)??gK(i,o)??i.error(o===""?i.scanner.lookahead==="#"?xw(i.shiftedByOne().scanner.shiftUntilNextTerminator()):I0(i):O0(o)),hK=(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(P(n,"root"))return n;if(n===void 0)return;if(P(n,"generic"))return qK(o,n,i);return U(`Unexpected resolution ${oi(n)}`)},gK=(i,o)=>{let n=CA(o);if(n!==void 0)return i.ctx.$.node("unit",{unit:n});let p=BA(o);if(p!==void 0)return i.ctx.$.node("unit",{unit:p})},I0=(i)=>{let o=i.previousOperator();return o?N0(o,i.scanner.unscanned):sK(i.scanner.unscanned)},N0=(i,o="")=>`Token '${i}' requires a right operand${o?` before '${o}'`:""}`,sK=(i)=>`Expected an expression${i?` before '${i}'`:""}`;var b0=(i)=>i.scanner.lookahead===""?i.error(I0(i)):i.scanner.lookahead==="("?i.shiftedByOne().reduceGroupOpen():i.scanner.lookaheadIsIn(pw)?L0(i,i.scanner.shift()):i.scanner.lookaheadIsIn(Up)?b0(i.shiftedByOne()):i.scanner.lookahead==="d"?i.scanner.nextLookahead in C0?L0(i,`${i.scanner.shift()}${i.scanner.shift()}`):B0(i):B0(i);class $p extends k1{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in $p.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],$p.terminatingChars):i==="="?o[0]!=="=":i===","||i==="?"}var ww=(i,o)=>{let n=tK(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 rK(i,n)},Xw={"<":1,">":1,"=":1},tK=(i,o)=>i.scanner.lookaheadIs("=")?`${o}${i.scanner.shift()}`:o;var vw=(i,o,n,p)=>{if(n.extends(S.intrinsic.number)){if(typeof o!=="number")return U(j0(i,o,p));return i==="=="?["min","max"]:i[0]===">"?["min"]:["max"]}if(n.extends(S.intrinsic.lengthBoundable)){if(typeof o!=="number")return U(j0(i,o,p));return i==="=="?["exactLength"]:i[0]===">"?["minLength"]:["maxLength"]}if(n.extends(S.intrinsic.Date))return i==="=="?["after","before"]:i[0]===">"?["after"]:["before"];return U(pv(n.expression))},dK=(i)=>({rule:iw(i.limit)?ow(i.limit):i.limit,exclusive:i.comparator.length===1}),rK=(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(j0(o,x,"right"));let T=c.unit,m=o.length===1,f=vw(o,typeof T==="number"?T:x,n,"right");for(let J of f)i.constrainRoot(J,o==="=="?{rule:T}:{rule:T,exclusive:m});if(!i.branches.leftBound)return;if(!di(o,mw))return i.error(_m(o));let $=vw(i.branches.leftBound.comparator,i.branches.leftBound.limit,n,"left");i.constrainRoot($[0],dK(i.branches.leftBound)),i.branches.leftBound=null},j0=(i,o,n)=>`Comparator ${n==="left"?kc[i]:i} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${o})`;var Ww=(i)=>{i.scanner.shiftUntilNonWhitespace();let o=i.scanner.shiftUntilNextTerminator();i.root=i.root.brand(o)};var Yw=(i)=>{let o=i.scanner.shiftUntilNextTerminator(),n=DA(o,{errorOnFail:Rw(o)});if(n===0)i.error(Rw(0));i.root=i.root.constrain("divisor",n)},Rw=(i)=>`% operator must be followed by a non-zero integer literal (was ${i})`;var a0=(i)=>{let o=i.scanner.shift();return o===""?i.finalize(""):o==="["?i.scanner.shift()==="]"?i.setRoot(i.root.array()):i.error(eK):o==="|"?i.scanner.lookahead===">"?i.shiftedByOne().pushRootToBranch("|>"):i.pushRootToBranch(o):o==="&"?i.pushRootToBranch(o):o===")"?i.finalizeGroup():$p.lookaheadIsFinalizing(o,i.scanner.unscanned)?i.finalize(o):di(o,Xw)?ww(i,o):o==="%"?Yw(i):o==="#"?Ww(i):(o in Up)?a0(i):i.error(ym(o))},ym=(i,o="")=>`'${i}' is not allowed here${o&&` (should be ${o})`}`,eK="Missing expected ']'";var Gw=(i)=>{let o=i.unsetRoot();i.parseOperand();let n=i.unsetRoot();if(!n.hasKind("unit"))return i.error(iH(n.expression));let p=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[o,"=",p]},iH=(i)=>`Default value '${i}' must a literal value`;var P0=(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 $p(i),o),c=oH(p);if(p.finalizer===">")U(ym(">"));return c},oH=(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=Gw(i);else if(i.finalizer==="?")o=[o,"?"];if(i.scanner.shiftUntilNonWhitespace(),i.scanner.lookahead)U(ym(i.scanner.lookahead));return o},AT=(i)=>{while(i.finalizer===void 0)nH(i);return i},nH=(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 U(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,Tw))return this.error(_m(o));if(this.branches.leftBound)return this.error(Jw(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(fw(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 a0(this)}parseOperand(){return b0(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error($w(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 pH="An empty string is not a valid generic parameter name",Lm=(i,o,n)=>{i.shiftUntilNonWhitespace();let p=i.shiftUntilNextTerminator();if(p===""){if(i.lookahead===""&&o.length)return o;return U(pH)}return i.shiftUntilNonWhitespace(),cH(i,p,o,n)},Kw="extends ",cH=(i,o,n,p)=>{if(i.shiftUntilNonWhitespace(),i.unscanned.startsWith(Kw))i.jumpForward(Kw.length);else{if(i.lookahead===",")i.shift();return n.push(o),Lm(i,n,p)}let c=AT(new hc(i,p));return n.push([o,c.root]),Lm(i,n,p)};class l0 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)U(TH);if(this.branches.length)U(xH);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)U("default may only be specified as the last key of a switch definition");return this.default(p)}if(typeof p!=="function")return U(`Value for case "${n}" must be a function (was ${$o(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:Hw};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:Hw},"self");return this.$.finalize(p)}}var Hw=(i)=>i.throw(),xH="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",TH="At most one key matcher may be specified per expression";var Cm=(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)},Uw="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",zw="Only required keys may specify default values, e.g. { value: 'number = 0' }";var uw=(i,o)=>{let n,p={},c=ax(i);for(let[T,m]of c){let f=$H(T);if(f.kind==="spread"){if(!qn(p))return U(fH);let X=o.$.parseOwnDefinitionFormat(m,o);if(X.equals(h.object))continue;if(!X.hasKind("intersection")||!X.basis?.equals(h.object))return U(JH(X.expression));n=X.structure;continue}if(f.kind==="undeclared"){if(m!=="reject"&&m!=="delete"&&m!=="ignore")U(mH(m));p.undeclared=m;continue}let $=Cm(m,o),J=f;if(f.kind==="required"){if(!Oi($))q0(p,"required",{key:f.normalized,value:$},o);else q0(p,"optional",$[1]==="="?{key:f.normalized,value:$[0],default:$[2]}:{key:f.normalized,value:$[0]},o);continue}if(Oi($)){if($[1]==="?")U(Uw);if($[1]==="=")U(zw)}if(f.kind==="optional"){q0(p,"optional",{key:f.normalized,value:$},o);continue}let F=o.$.parseOwnDefinitionFormat(J.normalized,o),A=Mm(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})},q0=(i,o,n,p)=>{i[o]=Ai(i[o],p.$.node(o,n))},mH=(i)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${oi(i)})`,fH="Spread operator may only be used as the first key in an object",$H=(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},JH=(i)=>`Spread operand must resolve to an object literal type (was ${i})`;var Mw=(i,o)=>KH(i)?Ew[i[0]](i,o):YH(i)?Vw[i[1]](i,o):null,FH=(i,o)=>o.$.parseOwnDefinitionFormat(i[1],o).keyof(),k0=(i,o)=>{if(i[2]===void 0)return U(N0(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 y)return c.throw();return c},AH=(i,o)=>o.$.parseOwnDefinitionFormat(i[0],o).array(),vH=(i,o)=>{if(typeof i[2]!=="function")return U(Qw("=>",i[2]));return o.$.parseOwnDefinitionFormat(i[0],o).pipe(i[2])},Qw=(i,o)=>`${i===":"?"Narrow":"Morph"} expression requires a function following '${i}' (was ${typeof o})`,wH=(i,o)=>{if(typeof i[2]!=="function")return U(Qw(":",i[2]));return o.$.parseOwnDefinitionFormat(i[0],o).constrain("predicate",i[2])},XH=(i,o)=>o.$.parseOwnDefinitionFormat(i[0],o).configureReferences(i[2],"shallow"),Sw=(i)=>i,WH=Sw({"[]":AH,"?":()=>U(Vm)}),RH=Sw({"|":k0,"&":k0,":":wH,"=>":vH,"|>":k0,"@":XH,"=":()=>U(Em)}),Vw={...WH,...RH},YH=(i)=>Vw[i[1]]!==void 0,GH=(i)=>i,Ew=GH({keyof:FH,instanceof:(i,o)=>{if(typeof i[1]!=="function")return U(Zw(lx(i[1])));let n=i.slice(1).map((p)=>typeof p==="function"?o.$.node("proto",{proto:p}):U(Zw(lx(p))));return n.length===1?n[0]:o.$.node("union",{branches:n})},"===":(i,o)=>o.$.units(i.slice(1))}),KH=(i)=>Ew[i[0]]!==void 0,Zw=(i)=>`Expected a constructor following 'instanceof' operator (was ${i})`;var yw=(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=Cm(i[p],o),[T,m,f]=!Oi(x)?[x]:x;if(p++,c){if(!T.extends(S.intrinsic.Array))return U(zH(T.expression));n=n.flatMap(($)=>T.distribute((J)=>UH(Xm($),J)))}else n=n.map(($)=>{if(m==="?")return Lw($,T);if(m==="=")return HH($,T,f);return h0($,T)})}return o.$.parseSchema(n.map((c)=>qn(c)?{proto:Array,exactLength:0}:{proto:Array,sequence:c}))},h0=(i,o)=>{if(i.defaultables||i.optionals)return U(i.variadic?u0:uH);if(i.variadic)i.postfix=Ai(i.postfix,o);else i.prefix=Ai(i.prefix,o);return i},Lw=(i,o)=>{if(i.variadic)return U(Cw);return i.optionals=Ai(i.optionals,o),i},HH=(i,o,n)=>{if(i.variadic)return U(Cw);if(i.optionals)return U(ZH);return i.defaultables=Ai(i.defaultables,[[o,n]]),i},Ow=(i,o)=>{if(i.postfix)U(_w);if(i.variadic){if(!i.variadic.equals(o))U(_w)}else i.variadic=o.internal;return i},UH=(i,o)=>{let n=o.select({method:"find",kind:"sequence"});if(!n)return Ow(i,S.intrinsic.unknown);if(n.prefix?.forEach((p)=>h0(i,p)),n.optionals?.forEach((p)=>Lw(i,p)),n.variadic)Ow(i,n.variadic);return n.postfix?.forEach((p)=>h0(i,p)),i},zH=(i)=>`Spread element must be an array (was ${i})`,_w="A tuple may have at most one variadic element",uH="A required element may not follow an optional element",Cw="An optional element may not follow a variadic element";var ZH="A defaultable element may not follow an optional element without a default";var MH={},Dm=(i,o)=>{if(typeof i==="string"){if(o.args&&Object.keys(o.args).some((p)=>i.includes(p)))return P0(i,o);let n=MH[o.$.name]??={};return n[i]??=P0(i,o)}return qo(i,"object")?QH(i,o):U(g0($o(i)))},QH=(i,o)=>{let n=Px(i);switch(n){case void 0:if(P(i,"root"))return i;return uw(i,o);case"Array":return SH(i,o);case"RegExp":return o.$.node("intersection",{domain:"string",pattern:i},{prereduced:!0});case"Function":{let p=Hp(i)?i():i;if(P(p,"root"))return p;return U(g0("Function"))}default:return U(g0(n??oi(i)))}},SH=(i,o)=>Mw(i,o)??yw(i,o),g0=(i)=>`Type definitions must be strings or objects (was ${i})`;class s0 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=S;class Bm 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(P(o,"module")||P(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)!==">")U("'>' 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 Lm(new $p(i),[],this.createParseContext({...o,def:i,prefix:"generic"}))}normalizeRootScopeValue(i){if(Hp(i)&&!P(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 U(Em);if(p[1]==="?")return U(Vm)}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 l0(this);declare=()=>({type:this.type});define(i){return i}type=new s0(this);static scope=(i,o={})=>new Bm(i,o);static module=(i,o={})=>this.scope(i,o).export()}var t0=Object.assign(Bm.scope,{define:(i)=>i}),fi=Bm;class Dw 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),Dw),Bw=fi.module({Key:h.key,Merge:VH});class Iw extends Vo{}var EH=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)},Iw),Nw=fi.module({root:h.Array,readonly:"root",index:h.nonNegativeIntegerString,liftFrom:EH},{name:"Array"});var d0=zi(["string",gp.FileConstructor]),OH=d0.rawOr(d0.array()),bw=zi({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:OH}}),jw=fi.module({root:["instanceof",FormData],value:d0,parsed:bw,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:bw})},{name:"FormData"});var aw=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 _H={Boolean:1,Number:1,String:1},Pw=fi.module({...pi({...I1,...b1},(i,o)=>(i in _H)?[]:[i,["instanceof",o]]),Array:Nw,TypedArray:aw,FormData:jw});var yH=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}),Im=fi.module({root:h.number,integer:LH,epoch:yH,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 ai=(i,o)=>qc("intersection",{domain:"string",pattern:{rule:i.source,flags:i.flags,meta:o}}),lw=ai(hx,"a well-formed integer string"),o4=fi.module({root:lw,parse:zi({in:lw,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=ai(/^[0-9a-fA-F]+$/,"hex characters only"),DH=fi.module({root:ai(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,"base64-encoded"),url:ai(/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==|%3D%3D)?|[A-Za-z0-9_-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),qw=ai(/^[A-Z].*$/,"capitalized"),BH=fi.module({root:zi({in:"string",morphs:(i)=>i.charAt(0).toUpperCase()+i.slice(1),declaredOut:qw}),preformatted:qw},{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)},NH=/^(?: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}))$/,bH=zi({domain:"string",pattern:{meta:"a credit card number",rule:NH.source},predicate:{meta:"a credit card number",predicate:IH}});var jH=/^([+-]?\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 aH=(i)=>!Number.isNaN(new Date(i).valueOf()),kw=zi({domain:"string",predicate:{meta:"a parsable date",predicate:aH}}).assertHasKind("intersection"),hw=o4.root.internal.narrow((i,o)=>{let n=Number.parseInt(i),p=Im.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:hw,parse:zi({in:hw,morphs:(i)=>new Date(i),declaredOut:h.Date})},{name:"string.date.epoch"}),gw=ai(jH,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),lH=fi.module({root:gw,parse:zi({in:gw,morphs:(i)=>new Date(i),declaredOut:h.Date})},{name:"string.date.iso"}),qH=fi.module({root:kw,parse:zi({declaredIn:kw,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:lH,epoch:PH},{name:"string.date"}),kH=ai(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,"an email address"),sw="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",Mp=`(${sw}[.]){3}${sw}`,hH=new RegExp(`^${Mp}$`),no="(?:[0-9a-fA-F]{1,4})",gH=new RegExp(`^((?:${no}:){7}(?:${no}|:)|(?:${no}:){6}(?:${Mp}|:${no}|:)|(?:${no}:){5}(?::${Mp}|(:${no}){1,2}|:)|(?:${no}:){4}(?:(:${no}){0,1}:${Mp}|(:${no}){1,3}|:)|(?:${no}:){3}(?:(:${no}){0,2}:${Mp}|(:${no}){1,4}|:)|(?:${no}:){2}(?:(:${no}){0,3}:${Mp}|(:${no}){1,5}|:)|(?:${no}:){1}(?:(:${no}){0,4}:${Mp}|(:${no}){1,6}|:)|(?::((?::${no}){0,5}:${Mp}|(?::${no}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),sH=fi.module({root:["v4 | v6","@","an IP address"],v4:ai(hH,"an IPv4 address"),v6:ai(gH,"an IPv6 address")},{name:"string.ip"}),sc="a JSON string",n4=(i)=>{if(!(i instanceof SyntaxError))throw i;return`must be ${sc} (${i})`},tH=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:n4(n)})}}}}),dH=(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:n4(n)})}},rH=fi.module({root:tH,parse:zi({meta:"safe JSON string parser",in:"string",morphs:dH,declaredOut:h.jsonObject})},{name:"string.json"}),tw=ai(/^[a-z]*$/,"only lowercase letters"),eH=fi.module({root:zi({in:"string",morphs:(i)=>i.toLowerCase(),declaredOut:tw}),preformatted:tw},{name:"string.lower"}),p4=["NFC","NFD","NFKC","NFKD"],wT=pi(p4,(i,o)=>[o,zi({domain:"string",predicate:(n)=>n.normalize(o)===n,meta:`${o}-normalized unicode`})]),Nm=pi(p4,(i,o)=>[o,zi({in:"string",morphs:(n)=>n.normalize(o),declaredOut:wT[o]})]),iU=fi.module({root:Nm.NFC,preformatted:wT.NFC},{name:"string.normalize.NFC"}),oU=fi.module({root:Nm.NFD,preformatted:wT.NFD},{name:"string.normalize.NFD"}),nU=fi.module({root:Nm.NFKC,preformatted:wT.NFKC},{name:"string.normalize.NFKC"}),pU=fi.module({root:Nm.NFKD,preformatted:wT.NFKD},{name:"string.normalize.NFKD"}),cU=fi.module({root:"NFC",NFC:iU,NFD:oU,NFKC:nU,NFKD:pU},{name:"string.normalize"}),dw=ai(Fm,"a well-formed numeric string"),xU=fi.module({root:dw,parse:zi({in:dw,morphs:(i)=>Number.parseFloat(i),declaredOut:h.number})},{name:"string.numeric"}),TU=/^(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-]+)*))?$/,mU=ai(TU,"a semantic version (see https://semver.org/)"),rw=ai(/^\S.*\S$|^\S?$/,"trimmed"),fU=fi.module({root:zi({in:"string",morphs:(i)=>i.trim(),declaredOut:rw}),preformatted:rw},{name:"string.trim"}),ew=ai(/^[A-Z]*$/,"only uppercase letters"),$U=fi.module({root:zi({in:"string",morphs:(i)=>i.toUpperCase(),declaredOut:ew}),preformatted:ew},{name:"string.upper"}),JU=(i)=>{if(URL.canParse)return URL.canParse(i);try{return new URL(i),!0}catch{return!1}},i4=zi({domain:"string",predicate:{meta:"a URL string",predicate:JU}}),FU=fi.module({root:i4,parse:zi({declaredIn:i4,in:"string",morphs:(i,o)=>{try{return new URL(i)}catch{return o.error("a URL string")}},declaredOut:zi(URL)})},{name:"string.url"}),AU=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:ai(/^[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:ai(/^[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:ai(/^[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:ai(/^[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:ai(/^[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:ai(/^[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:ai(/^[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:ai(/^[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"}),c4=fi.module({root:h.string,alpha:ai(/^[A-Za-z]*$/,"only letters"),alphanumeric:ai(/^[A-Za-z\d]*$/,"only letters and digits 0-9"),hex:CH,base64:DH,capitalize:BH,creditCard:bH,date:qH,digits:ai(/^\d*$/,"only digits 0-9"),email:kH,integer:o4,ip:sH,json:rH,lower:eH,normalize:cU,numeric:xU,semver:mU,trim:fU,upper:$U,url:FU,uuid:AU},{name:"string"});var x4=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}),T4=fi.module({root:h.unknown,any:h.unknown},{name:"unknown"}),vU=fi.module({root:h.jsonObject,stringify:qc("morph",{in:h.jsonObject,morphs:(i)=>JSON.stringify(i),declaredOut:h.string})},{name:"object.json"}),m4=fi.module({root:h.object,json:vU},{name:"object"});class f4 extends Vo{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var wU=Xn(["K",h.key],"V")((i)=>({domain:"object",index:{signature:i.K,value:i.V}}),f4);class $4 extends Vo{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var XU=Xn(["T",h.object],["K",h.key])((i)=>i.T.pick(i.K),$4);class J4 extends Vo{description='omit a set of properties from an object like `Omit(User, "age")`'}var WU=Xn(["T",h.object],["K",h.key])((i)=>i.T.omit(i.K),J4);class F4 extends Vo{description="make all named properties of an object optional like `Partial(User)`"}var RU=Xn(["T",h.object])((i)=>i.T.partial(),F4);class A4 extends Vo{description="make all named properties of an object required like `Required(User)`"}var YU=Xn(["T",h.object])((i)=>i.T.required(),A4);class v4 extends Vo{description='exclude branches of a union like `Exclude("boolean", "true")`'}var GU=Xn("T","U")((i)=>i.T.exclude(i.U),v4);class w4 extends Vo{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var KU=Xn("T","U")((i)=>i.T.extract(i.U),w4),X4=fi.module({Exclude:GU,Extract:KU,Omit:WU,Partial:RU,Pick:XU,Record:wU,Required:YU});var Qp=t0({...x4,...X4,...Pw,...Bw,string:c4,number:Im,object:m4,unknown:T4},{prereducedAliases:!0,name:"ark"}),Jo=Qp.export();Object.assign(gc.ambient,Jo);gc.typeAttachments={string:Jo.string.root,number:Jo.number.root,bigint:Jo.bigint,boolean:Jo.boolean,symbol:Jo.symbol,undefined:Jo.undefined,null:Jo.null,object:Jo.object.root,unknown:Jo.unknown.root,false:Jo.false,true:Jo.true,never:Jo.never,arrayIndex:Jo.Array.index,Key:Jo.Key,Record:Jo.Record,Array:Jo.Array.root,Date:Jo.Date};var po=Object.assign(Qp.type,gc.typeAttachments),HU=Qp.match,UU=Qp.generic,yj=Qp.schema,zU=Qp.define,uU=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 W4=(i,o,n=d.STORE)=>{return r0(n,{key:`${i.key}:JSON`,get:({get:p})=>o.toJson(p(i)),set:({set:p},c)=>{p(i,o.fromJson(c))}})};function B(i){while(i.child!==null)i=i.child;return i}class Ji{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 e0 extends Ji{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 Ji,m=Object.assign((f)=>{let $=Fi(f),J={key:o.key,subKey:$},F=`${o.key}(${$})`,A=B(i),X=o.default,Y={key:F,default:X instanceof Function?X(f):X};if(o.effects)Y.effects=o.effects(f);let R=rp(A,Y,J);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 R4(i,o){if("mutable"in o)return WT(i,o);return dp(i,o)}function Sp(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 Ji,m=Object.assign((f)=>{let $=Fi(f),J={key:o.key,subKey:$},F=`${o.key}(${$})`,A=B(i),X=RT(A,{key:F,get:o.get(f)},J);return x.next({type:"state_creation",token:X}),X},p,{internalRoles:n,subject:x,install:(f)=>Sp(f,o),default:(f)=>{return o.get(f)({get:(...J)=>ui(i,...J),find:(...J)=>t(i,...J),json:(J)=>Fo(i,J)})}});return i.families.set(o.key,m),p}function Y4(i,o){if("set"in o)return YT(i,o);return Sp(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 ZU={atom_family:"atom",mutable_atom_family:"mutable_atom",selector_family:"selector",readonly_selector_family:"readonly_selector",molecule_family:"molecule"};function G4(i,o){let n=Fi(o),p=`${i.key}(${n})`,c=ZU[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 K4=(i)=>{let o=B(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 Mi(i){return i[0].toUpperCase()+i.slice(1)}function hn(i){return i.type.split("_").map(Mi).join(" ")}class ep extends Error{constructor(i,o){super(`${hn(i)} ${Fi(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 am=(i)=>(o)=>i instanceof Function?i(o):i;var Vp=(i,o)=>{if(i.valueMap.has(o.key))return i.logger.info("\uD83D\uDCD6",o.type,o.key,"reading cached value"),H4(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 U4=(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}"`}`)},z4=(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)},u4=(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 Z4=(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 i$=(i,o)=>{let n=B(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(u4(n,c))continue;M4(c,n),dc(n,c)}}};var Q4=(i,o,n)=>{let p=Vp(i,o),c=p;if(o.type==="mutable_atom"&&Zi(i)){let{parent:T}=i;c=GT(i,o,T)}if(c=am(n)(c),i.logger.info("\uD83D\uDCDD","atom",o.key,"set to",c),c=Wn(i,o.key,c,o.subject),V4(i,o.key))E4(i,o.key);dc(i,o.key),i$(i,o);let x={oldValue:p,newValue:c};if(!Zi(i)){Z4(i,o,x);return}if(i.on.transactionApplying.state===null){let{key:T}=o;if(S4(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:J}=i;f=GT(i,m,J)}if(f.do(x.newValue)===null)i$(i,m)}};var Pm=(i,o,n)=>{switch(o.type){case"atom":case"mutable_atom":Q4(i,o,n);break;case"selector":o.set(n);break}};function O4(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=O4(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,$=i.disposalTraces.buffer.find((J)=>J?.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}".`,$?`This state was previously disposed:
86
+ ${$.trace}`:"No previous disposal trace was found.");return}let T=U4(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);Pm(i,m,x),z4(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 _4(i){let{stack:o}=i;if(o)return`
87
+ `+o.split(`
50
88
  `)?.slice(1)?.join(`
51
- `);return""}function I0(n,i=g.STORE){let o={key:n,stringKey:wn(n),dependsOn:"any"};return i.molecules.set(wn(n),o),n}function Tc(n,i,o,c="any"){let p=i,x=wn(o),m=[],a=j(n);if(Array.isArray(p))for(let $ of p){let w=wn($);if(a.molecules.get(w))n.moleculeGraph.set(w,x,{source:w});else m.push(w)}else{let $=wn(p);if(a.molecules.get($))n.moleculeGraph.set($,x,{source:$});else m.push($)}if(m.length===0)a.molecules.set(x,{key:o,stringKey:x,dependsOn:c});let f={type:"molecule_creation",key:o,provenance:p};if(Mn(a)&&a.transactionMeta.phase==="building")a.transactionMeta.update.updates.push(f);else a.on.moleculeCreation.next(f);for(let $ of m){let w=n.disposalTraces.buffer.find((J)=>J?.key===$);n.logger.error("\u274C","molecule",o,"allocation failed:",`Could not allocate to ${$} in store "${n.config.name}".`,w?`
52
- ${$} was most recently disposed
53
- ${w.trace}`:`No previous disposal trace for ${$} was found.`)}return o}function y0(n,i,o,c){let p=`T$--${i}==${o}++${c}`;return Tc(n,[o,c],p,"all"),p}function Rc(n,i){let o=wn(i),c=n.molecules.get(o);if(!c){let S=n.disposalTraces.buffer.find((X)=>X?.key===o);n.logger.error("\u274C","molecule",i,"deallocation failed:",`Could not find allocation for ${o} in store "${n.config.name}".`,S?`
89
+ `);return""}function y4(i,o=d.STORE){let n={key:i,stringKey:Fi(i),dependsOn:"any"};return o.molecules.set(Fi(i),n),i}function ic(i,o,n,p="any"){let c=o,x=Fi(n),T=[],m=B(i);if(Array.isArray(c))for(let J of c){let F=Fi(J);if(m.molecules.get(F))i.moleculeGraph.set(F,x,{source:F});else T.push(F)}else{let J=Fi(c);if(m.molecules.get(J))i.moleculeGraph.set(J,x,{source:J});else T.push(J)}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 J of T){let F=i.disposalTraces.buffer.find((A)=>A?.key===J);i.logger.error("\u274C","molecule",n,"allocation failed:",`Could not allocate to ${J} in store "${i.config.name}".`,F?`
90
+ ${J} was most recently disposed
91
+ ${F.trace}`:`No previous disposal trace for ${J} was found.`)}return n}function L4(i,o,n,p){let c=`T$--${o}==${n}++${p}`;return ic(i,[n,p],c,"all"),c}function oc(i,o){let n=Fi(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?`
54
92
  This state was most recently deallocated
55
- ${S.trace}`:`No previous disposal trace for ${o} was found.`);return}let p=n.moleculeJoins.getRelatedKeys(c.key);if(p)for(let S of p){let X=n.joins.get(S);if(X)X.relations.delete(c.key),X.molecules.delete(c.stringKey)}n.moleculeJoins.delete(c.stringKey);let x=[],m=[],a={type:"molecule_disposal",key:c.key,values:m,provenance:x},f=j(n);f.molecules.delete(o);let v=Mn(f)&&f.transactionMeta.phase==="building";if(v)f.transactionMeta.update.updates.push(a);let $=n.moleculeGraph.getRelationEntries({downstreamMoleculeKey:c.stringKey});if($)for(let[S,{source:X}]of $)if(X===c.stringKey){let R=xi(S);Rc(n,R)}else x.push(X);let w=f.moleculeData.getRelatedKeys(c.stringKey);if(w)for(let S of w){let X=f.families.get(S),R=t(n,X,c.key);m.push([X.key,R]),Sc(n,R)}if(f.moleculeGraph.delete(c.stringKey),f.moleculeJoins.delete(c.stringKey),f.moleculeData.delete(c.stringKey),!v)f.on.moleculeDisposal.next(a);f.molecules.delete(c.stringKey);let J=C0(new Error);n.disposalTraces.add({key:o,trace:J})}function ec(n,i,o,c){let p=wn(o),x=j(n),m=x.molecules.get(p);if(!m){let J=n.disposalTraces.buffer.find((S)=>S?.key===p);return n.logger.error("\u274C","molecule",o,"claim failed:",`Could not allocate to ${p} in store "${n.config.name}".`,J?`
56
- ${p} was most recently disposed
57
- ${J.trace}`:`No previous disposal trace for ${p} was found.`),o}let a=wn(i),f=x.molecules.get(a);if(!f){let J=n.disposalTraces.buffer.find((S)=>S?.key===a);return n.logger.error("\u274C","molecule",o,"claim failed:",`Could not allocate to ${a} in store "${n.config.name}".`,J?`
58
- ${a} was most recently disposed
59
- ${J.trace}`:`No previous disposal trace for ${a} was found.`),o}let v=n.moleculeGraph.getRelationEntries({downstreamMoleculeKey:m.stringKey}).filter(([,{source:J}])=>J!==p).map(([J])=>xi(J));if(c)x.moleculeGraph.delete(p);x.moleculeGraph.set({upstreamMoleculeKey:f.stringKey,downstreamMoleculeKey:m.stringKey},{source:f.stringKey});let $={type:"molecule_transfer",key:m.key,from:v,to:[f.key]};if(Mn(x)&&x.transactionMeta.phase==="building")x.transactionMeta.update.updates.push($);return o}function Tf(n,i,o){switch(i){case"newValue":{k0(n,o);break}case"oldValue":{Sc(o,n.token);break}}}function Rf(n,i,o){switch(i){case"newValue":{Sc(o,n.token);break}case"oldValue":{if(k0(n,o),n.subType==="atom")o.valueMap.set(n.token.key,n.value);break}}}function k0(n,i){let{family:o}=n.token;if(o){let c=i.families.get(o.key);if(c)t(i,c,xi(o.subKey))}}function Z0(n,i,o){switch(i){case"newValue":Tc(o,n.provenance,n.key);break;case"oldValue":Rc(o,n.key);break}}function q0(n,i,o){switch(i){case"newValue":Rc(o,n.key);break;case"oldValue":{let c=n.provenance.map(xi);Tc(o,c,n.key);for(let[p,x]of n.values){let m=o.families.get(p);if(m){t(o,m,n.key);let a=`${p}(${wn(n.key)})`;o.valueMap.set(a,x)}}}break}}function s0(n,i,o){switch(i){case"newValue":{let c=n.to.length===1?n.to[0]:n.to;ec(o,c,n.key,"exclusive")}break;case"oldValue":{let c=n.from.length===1?n.from[0]:n.from;ec(o,c,n.key,"exclusive")}break}}function Jm(n,i,o){let c=n==="newValue"?i.updates:[...i.updates].reverse();for(let p of c)switch(p.type){case"atom_update":case"selector_update":wm(n,p,o);break;case"state_creation":Tf(p,n,o);break;case"state_disposal":Rf(p,n,o);break;case"molecule_creation":Z0(p,n,o);break;case"molecule_disposal":q0(p,n,o);break;case"molecule_transfer":s0(p,n,o);break;case"transaction_update":Jm(n,p,o);break}}function Sf(n,i){return n.transactionMeta.actionContinuities.getRelatedKey(i)}function m3(n,i){return n.transactionMeta.epoch.get(i)}function P0(n,i){if(!$i(n))return;let c=Sf(n,i);if(c===void 0)return;return m3(n,c)}function t0(n,i,o){if($i(n)&&i)n.transactionMeta.epoch.set(i,o)}function r0(n,i,o){if(!$i(n))return;let p=Sf(n,i);if(p!==void 0)n.transactionMeta.epoch.set(p,o)}var d0=(n,i)=>{let o=j(i),{parent:c}=o;if(c===null||!Mn(o)||o.transactionMeta?.phase!=="building"){i.logger.warn("\uD83D\uDC1E","transaction","???","applyTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}o.transactionMeta.phase="applying",o.transactionMeta.update.output=n,c.child=null,c.on.transactionApplying.next(o.transactionMeta);let{updates:p}=o.transactionMeta.update;if(i.logger.info("\uD83D\uDEC4","transaction",o.transactionMeta.update.key,`Applying transaction with ${p.length} updates:`,p),Jm("newValue",o.transactionMeta.update,c),$i(c))r0(c,o.transactionMeta.update.key,o.transactionMeta.update.epoch),Tn(i,{key:o.transactionMeta.update.key,type:"transaction"})?.subject.next(o.transactionMeta.update),i.logger.info("\uD83D\uDEEC","transaction",o.transactionMeta.update.key,"Finished applying transaction.");else if(Mn(c))c.transactionMeta.update.updates.push(o.transactionMeta.update);c.on.transactionApplying.next(null)};function g0(n,i,o){if(!$i(n))return;let{epoch:p,actionContinuities:x}=n.transactionMeta;if(x.set(i,o),!p.has(i))p.set(i,-1)}function e0(n){return{store:n}}function Gn(n,...i){let o,c,p;if(i.length===1)o=i[0];else c=i[0],p=i[1],o=t(n,c,p);if("counterfeit"in o&&"family"in o){c=n.families.get(o.family.key);let x=o.family.subKey,m=n.disposalTraces.buffer.find((a)=>a?.key===x);switch(n.logger.error("\u274C",o.type,o.key,`could not be retrieved because it was not found in the store "${n.config.name}".`,m?`This state was previously disposed:
60
- ${m.trace}`:"No previous disposal trace was found."),c.type){case"atom_family":case"mutable_atom_family":return n.defaults.get(c.key);case"selector_family":case"readonly_selector_family":{if(n.defaults.has(c.key))return n.defaults.get(o.family.key);let a=Tn(n,c).default(x);return n.defaults.set(c.key,a),a}}}return yo(n,Tn(n,o))}class qi extends Map{deleted=new Set;source;constructor(n){super();this.source=n}get(n){if(super.has(n))return super.get(n);if(!this.deleted.has(n)&&this.source.has(n))return this.source.get(n);return}set(n,i){return this.deleted.delete(n),super.set(n,i)}hasOwn(n){return super.has(n)}has(n){return!this.deleted.has(n)&&(super.has(n)||this.source.has(n))}delete(n){return this.deleted.add(n),super.delete(n)}}var n1=(n,i,o,c)=>{let p=j(n),x={parent:p,child:null,on:p.on,loggers:p.loggers,logger:p.logger,config:p.config,atoms:new qi(p.atoms),atomsThatAreDefault:new Set(p.atomsThatAreDefault),families:new qi(p.families),joins:new qi(p.joins),operation:{open:!1},readonlySelectors:new qi(p.readonlySelectors),timelines:new qi(p.timelines),timelineTopics:new ii(p.timelineTopics.toJSON()),trackers:new Map,transactions:new qi(p.transactions),selectorAtoms:new ii(p.selectorAtoms.toJSON()),selectorGraph:new ii(p.selectorGraph.toJSON(),{makeContentKey:(...v)=>v.sort().join(":")}),selectors:new qi(p.selectors),valueMap:new qi(p.valueMap),defaults:p.defaults,disposalTraces:n.disposalTraces.copy(),molecules:new qi(p.molecules),moleculeGraph:new ii(p.moleculeGraph.toJSON(),{makeContentKey:p.moleculeGraph.makeContentKey}),moleculeData:new ii(p.moleculeData.toJSON(),{makeContentKey:p.moleculeData.makeContentKey}),moleculeJoins:new ii(p.moleculeJoins.toJSON(),{makeContentKey:p.moleculeJoins.makeContentKey}),miscResources:new qi(p.miscResources)},m=P0(n,i),a={phase:"building",update:{type:"transaction_update",key:i,id:c,epoch:m===void 0?Number.NaN:m+1,updates:[],params:o,output:void 0},toolkit:{get:(...v)=>Gn(f,...v),set:(...v)=>{On(f,...v)},run:(v,$=am())=>dc(f,v,$),find:(v,$)=>t(f,v,$),json:(v)=>ni(f,v),dispose:(...v)=>{Sc(f,...v)},env:()=>e0(f)}},f=Object.assign(x,{transactionMeta:a});return p.child=f,n.logger.info("\uD83D\uDEEB","transaction",i,"Building transaction with params:",o),f};function Xf(n,i){let o={key:i.key,type:"transaction",run:(x,m)=>{let a=n1(n,i.key,x,m);try{let f=j(n),{toolkit:v}=a.transactionMeta,$=i.do(v,...x);return d0($,f),$}catch(f){throw O0(c),n.logger.warn("\uD83D\uDCA5","transaction",i.key,"caught:",f),f}},install:(x)=>Xf(x,i),subject:new $n},c=j(n);c.transactions.set(o.key,o);let p=lo(o);return n.on.transactionCreation.next(p),p}class i1{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;selectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new ii({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new ii({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...n)=>n.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new ii({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new ii({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new fm(100);molecules=new Map;moleculeJoins=new ii({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...n)=>n.sort().join(":")});moleculeGraph=new ii({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...n)=>n.sort().join(":")});moleculeData=new ii({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...n)=>n.sort().join(":")});miscResources=new Map;on={atomCreation:new $n,atomDisposal:new $n,selectorCreation:new $n,selectorDisposal:new $n,timelineCreation:new $n,transactionCreation:new $n,transactionApplying:new Af(null),operationClose:new $n,moleculeCreation:new $n,moleculeDisposal:new $n};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new Xc("warn",(n,i,o)=>!o1(o))];logger={error:(...n)=>{for(let i of this.loggers)i.error(...n)},info:(...n)=>{for(let i of this.loggers)i.info(...n)},warn:(...n)=>{for(let i of this.loggers)i.warn(...n)}};constructor(n,i=null){if(this.config={...i?.config,...n},i!==null){if(this.valueMap=new Map(i?.valueMap),this.operation={...i?.operation},$i(i))this.transactionMeta={epoch:new Map(i?.transactionMeta.epoch),actionContinuities:new ii(i?.transactionMeta.actionContinuities.toJSON())};for(let[,c]of i.families){if(c.internalRoles?.includes("mutable")||c.internalRoles?.includes("join"))continue;c.install(this)}let o=new Set;for(let[,c]of i.atoms){if(o.has(c.key))continue;if(c.install(this),c.type==="mutable_atom"){let p=ni(i,c),x=Uo(c);o.add(p.key),o.add(x.key)}}for(let[,c]of i.readonlySelectors)c.install(this);for(let[,c]of i.selectors){if(o.has(c.key))continue;c.install(this)}for(let[,c]of i.transactions)c.install(this);for(let[,c]of i.timelines)c.install(this)}}}var g={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new i1({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function Tn(n,i){let o,c=n;while(c!==null){switch(i.type){case"atom":case"mutable_atom":o=c.atoms.get(i.key);break;case"selector":o=c.selectors.get(i.key);break;case"readonly_selector":o=c.readonlySelectors.get(i.key);break;case"atom_family":case"mutable_atom_family":case"selector_family":case"readonly_selector_family":o=c.families.get(i.key);break;case"timeline":o=c.timelines.get(i.key);break;case"transaction":o=c.transactions.get(i.key);break}if(o)return o;c=c.child}throw new Fc(i,n)}function c1(n,i,o){let c=n.families.get(i.key);if(c===void 0)throw new Fc(i,n);let p=c(o),x=j(n);if(p.family){if($i(x))switch(p.type){case"atom":case"mutable_atom":n.on.atomCreation.next(p);break;case"selector":case"readonly_selector":n.on.selectorCreation.next(p);break}else if(Mn(x)&&x.on.transactionApplying.state===null)x.transactionMeta.update.updates.push({type:"state_creation",token:p})}return p}function p1(n,i,o){let c=wn(o),p=`${i.key}(${c})`,x=j(n),m;switch(i.type){case"atom_family":case"mutable_atom_family":m=x.atoms.get(p);break;case"selector_family":m=x.selectors.get(p);break;case"readonly_selector_family":m=x.readonlySelectors.get(p);break}if(m)return lo(m);return m}function t(n,i,o){let c=p1(n,i,o);if(c)return c;let p=wn(o),x=n.molecules.get(p);if(!x&&n.config.lifespan==="immortal"){let m=E0(i,o);return n.logger.error("\u274C",m.type,m.key,`was not found in store "${n.config.name}"; returned a counterfeit token.`),m}if(c=c1(n,i,o),x)j(n).moleculeData.set(p,i.key);return c}function Sc(n,...i){let o;if(i.length===1)o=i[0];else{let c=i[0],p=i[1];o=t(n,c,p)}try{Tn(n,o)}catch(c){n.logger.error("\u274C",o.type,o.key,`could not be disposed because it was not found in the store "${n.config.name}".`);return}switch(o.type){case"atom":case"mutable_atom":Wf(n,o);break;case"selector":case"readonly_selector":x1(n,o);break}}var Am=(n,i)=>j(n).atoms.has(i),a3=(n,i)=>j(n).selectors.has(i),f3=(n,i)=>j(n).readonlySelectors.has(i),m1=(n,i)=>Am(n,i)||a3(n,i)||f3(n,i);var Fm=(n,i)=>{return j(i).selectorGraph.getRelationEntries({downstreamSelectorKey:n}).filter(([c,{source:p}])=>p!==n).map(([c,{source:p}])=>p).filter((c)=>m1(i,c))};var Kf=(n,i,o)=>{let c=[],p=Fm(n,o);while(p.length>0){let x=p.shift();if(i.has(x))continue;if(i.add(x),!Am(o,x))p.push(...Fm(x,o));else if(!c.includes(x))c.push(x)}return c},a1=(n,i)=>{let o=n.key,c=Fm(o,i),p=new Set;return c.flatMap((x)=>Am(i,x)?x:Kf(x,p,i))};var f1=(n,i,o,c)=>{let p=j(c);if(i.type==="atom"||i.type==="mutable_atom")p.selectorAtoms.set({selectorKey:n,atomKey:i.key}),c.logger.info("\uD83D\uDD0D","selector",n,`discovers root atom "${i.key}"`);else{let x=Kf(i.key,o,c);c.logger.info("\uD83D\uDD0D","selector",n,`discovers root atoms: [ ${x.map((m)=>`"${m}"`).join(", ")} ]`);for(let m of x)p.selectorAtoms=p.selectorAtoms.set({selectorKey:n,atomKey:m})}o.add(i.key)};var Tm=(n,i,o)=>({get:(...c)=>{let p=j(o),x;if(c.length===2){let[f,v]=c;x=t(o,f,v)}else[x]=c;let m=Tn(o,x),a=yo(o,m);return o.logger.info("\uD83D\uDD0C","selector",n,`registers dependency ( "${x.key}" =`,a,")"),p.selectorGraph.set({upstreamSelectorKey:x.key,downstreamSelectorKey:n},{source:x.key}),f1(n,x,i,o),a},set:(...c)=>{let p,x;if(c.length===2)p=c[0],x=c[1];else{let f=c[0],v=c[1];x=c[2],p=t(o,f,v)}let m=j(o),a=Tn(m,p);$m(m,a,x)},find:(c,p)=>t(o,c,p),json:(c)=>ni(o,c)});var xx=(n,i,o)=>{let c=j(n),p=new $n,x=new Set,{get:m,find:a,json:f}=Tm(i.key,x,c),v=()=>{let S=i.get({get:m,find:a,json:f});return Zi(j(n),i.key,S,p),x.clear(),S},$={...i,subject:p,install:(S)=>xx(S,i,o),get:v,type:"readonly_selector",...o&&{family:o}};c.readonlySelectors.set(i.key,$);let w=v();n.logger.info("\u2728",$.type,$.key,"=",w);let J={key:i.key,type:"readonly_selector"};if(o)J.family=o;return J};var fx=(n,i,o)=>{let c=j(n),p=new $n,x=new Set,m=Tm(i.key,x,c),{find:a,get:f,json:v}=m,$={find:a,get:f,json:v},w=(K=i.get,M=j(n))=>{let Y=K($);return Zi(M,i.key,Y,p),x.clear(),Y},S={...i,subject:p,install:(K)=>fx(K,i,o),get:w,set:(K)=>{let M=j(n),Y=w(i.get,M),I=vm(K)(Y);if(n.logger.info("\uD83D\uDCDD","selector",i.key,"set (",Y,"->",I,")"),Zi(M,i.key,I,p),gc(M,i.key),$i(M))p.next({newValue:I,oldValue:Y});i.set(m,I)},type:"selector",...o&&{family:o}};c.selectors.set(i.key,S);let X=w();n.logger.info("\u2728",S.type,S.key,"=",X);let R={key:i.key,type:"selector"};if(o)R.family=o;return R};function Jf(n,i){if("set"in i){let p=fx(n,i,void 0);return n.on.selectorCreation.next(p),p}let c=xx(n,i,void 0);return n.on.selectorCreation.next(c),c}function x1(n,i){let o=j(n),{key:c}=i,p=Tn(o,i);if(!p.family)n.logger.error("\u274C","selector",c,"Standalone selectors cannot be disposed.");else{if(o.molecules.get(p.family.subKey))o.moleculeData.delete(p.family.subKey,p.family.key);let m;switch(i.type){case"selector":o.selectors.delete(c),m={key:p.family.key,type:"selector_family"},Tn(n,m).subject.next({type:"state_disposal",subType:"selector",token:i});break;case"readonly_selector":o.readonlySelectors.delete(c),m={key:p.family.key,type:"readonly_selector_family"},Tn(n,m).subject.next({type:"state_disposal",subType:"selector",token:i});break}if(o.valueMap.delete(c),o.selectorAtoms.delete(c),o.selectorGraph.delete(c),n.logger.info("\uD83D\uDD25",i.type,c,"deleted"),Mn(o)&&o.transactionMeta.phase==="building")o.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:i});else n.on.selectorDisposal.next(i)}}function mx(n,i,o){let c={key:i.key,type:"selector_family"},p=n.families.get(i.key);if(p)n.logger.error("\u2757","selector_family",i.key,`Overwriting an existing ${Ko(p)} "${p.key}" in store "${n.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let x=new $n,a=Object.assign((f)=>{let v=wn(f),$={key:i.key,subKey:v},w=`${i.key}(${v})`,J=j(n),S=fx(J,{key:w,get:i.get(f),set:i.set(f)},$);return x.next({type:"state_creation",token:S}),S},c,{internalRoles:o,subject:x,install:(f)=>mx(f,i),default:(f)=>{return i.get(f)({get:(...$)=>Gn(n,...$),find:($,w)=>t(n,$,w),json:($)=>ni(n,$)})}});return n.families.set(i.key,a),c}function v1(n,i,o){return mx(n,{key:`${i.key}:JSON`,get:(p)=>({get:x})=>{let m=x(i,p);return o.toJson(m)},set:(p)=>({set:x},m)=>{x(i,p,o.fromJson(m))}},["mutable","json"])}var xi=(n)=>JSON.parse(n),wn=(n)=>JSON.stringify(n),DQ=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];var $1=(n,i)=>{let o=j(n);if(o.operation.open)return o.operation.prev.get(i.key);return o.valueMap.get(i.key)};var Mf=(n,i)=>{let o=j(n);return a1(i,n).map((p)=>{let x=o.atoms.get(p);if(x===void 0)throw new Error(`Atom "${p}", a dependency of selector "${i.key}", not found in store "${n.config.name}".`);return x.subject.subscribe(`${i.type}:${i.key}`,(m)=>{n.logger.info("\uD83D\uDCE2",i.type,i.key,"root",p,"went",m.oldValue,"->",m.newValue);let a=$1(o,i),f=yo(o,i);n.logger.info("\u2728",i.type,i.key,"went",a,"->",f),i.subject.next({newValue:f,oldValue:a})})})};function Xi(n,i,o,c){function p(w){if(n.operation.open){let J=n.on.operationClose.subscribe(`state subscription ${o}`,()=>{J(),c(w)})}else c(w)}let x=Tn(n,i);n.logger.info("\uD83D\uDC40",x.type,x.key,`Adding subscription "${o}"`);let m=x.type==="selector"||x.type==="readonly_selector",a=null,f=p;if(m)a=Mf(n,x),f=(w)=>{if(a)a.length=0,a.push(...Mf(n,x));p(w)};let v=x.subject.subscribe(o,f);return()=>{if(n.logger.info("\uD83D\uDE48",x.type,x.key,`Removing subscription "${o}"`),v(),a)for(let w of a)w()}}var lf=(n,i,o,c)=>{let p=Tn(n,i);n.logger.info("\uD83D\uDC40","timeline",i.key,`Adding subscription "${o}"`);let x=p.subject.subscribe(o,c);return()=>{n.logger.info("\uD83D\uDE48","timeline",i.key,`Removing subscription "${o}" from timeline`),x()}};var Gf=(n,i,o,c)=>{let p=Tn(n,i);n.logger.info("\uD83D\uDC40","transaction",i.key,`Adding subscription "${o}"`);let x=p.subject.subscribe(o,c);return()=>{n.logger.info("\uD83D\uDE48","transaction",i.key,`Removing subscription "${o}"`),x()}};class Wc{Update;initializeState(n,i){let o=`*${n.key}`;i.atoms.delete(o),i.valueMap.delete(o);let c=n.family?{key:`*${n.family.key}`,subKey:n.family.subKey}:void 0,p=Ac(i,{key:o,default:null},c);if(i.parent?.valueMap.has(o)){let x=i.parent.valueMap.get(o);i.valueMap.set(o,x)}return p}unsubscribeFromInnerValue;unsubscribeFromState;observeCore(n,i,o){let c=`tracker:${o.config.name}:${Mn(o)?o.transactionMeta.update.key:"main"}:${n.key}`,p=Gn(o,n);this.unsubscribeFromInnerValue=p.subscribe(c,(x)=>{On(o,i,x)}),this.unsubscribeFromState=Xi(o,n,c,(x)=>{if(x.newValue!==x.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=x.newValue.subscribe(c,(m)=>{On(o,i,m)})})}updateCore(n,i,o){let c=`tracker:${o.config.name}:${Mn(o)?o.transactionMeta.update.key:"main"}:${n.key}`;Xi(o,i,c,({newValue:p,oldValue:x})=>{let m=o.timelineTopics.getRelatedKey(i.key);if(m){if(o.timelines.get(m)?.timeTraveling){let v=lf(o,{key:m,type:"timeline"},c,($)=>{v(),On(o,n,(w)=>{if($==="redo"&&p)w.do(p);else if($==="undo"&&x)w.undo(x);return w})});return}}let a=o.on.operationClose.subscribe(c,()=>{a();let f=Gn(o,n),v=p===null?-1:f.getUpdateNumber(p),$=v-f.cacheUpdateNumber;if(p&&$===1)On(o,n,(w)=>(w.do(p),w));else o.logger.info("\u274C","mutable_atom",n.key,`could not be updated. Expected update number ${f.cacheUpdateNumber+1}, but got ${v}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor(n,i){this.mutableState=n;let o=j(i);this.latestUpdateState=this.initializeState(n,o),this.observeCore(n,this.latestUpdateState,o),this.updateCore(n,this.latestUpdateState,o),o.trackers.set(n.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),o.trackers.delete(n.key)}}}function vx(n,i,o){n.logger.info("\uD83D\uDD28","atom",i.key,`creating in store "${n.config.name}"`);let c=j(n),p=c.atoms.get(i.key);if(p&&p.type==="mutable_atom")return n.logger.error("\u274C","atom",i.key,"Tried to create atom, but it already exists in the store."),lo(p);let x=new $n,m={...i,type:"mutable_atom",install:(v)=>{return v.logger.info("\uD83D\uDEE0\uFE0F","atom",i.key,`installing in store "${v.config.name}"`),vx(v,i,o)},subject:x};if(o)m.family=o;let a=i.default();c.atoms.set(m.key,m),Rm(n,i.key),Zi(c,i.key,a,x);let f=lo(m);if(i.effects){let v=0,$=[];for(let w of i.effects){let J=w({setSelf:(S)=>{On(n,f,S)},onSet:(S)=>Xi(n,f,`effect[${v}]`,S)});if(J)$.push(J);++v}m.cleanup=()=>{for(let w of $)w()}}if(new Wc(f,n),!o)H0(f,i,n);return f}class Yf{trackers=new Map;Update;latestUpdateAtoms;mutableAtoms;constructor(n,i){let o=Jc(i,{key:`*${n.key}`,default:null},["mutable","updates"]);this.latestUpdateAtoms=Tn(i,o),this.mutableAtoms=n,this.mutableAtoms.subject.subscribe(`store=${i.config.name}::tracker-atom-family`,(c)=>{let{type:p,token:x}=c;if(x.family){let m=xi(x.family.subKey);switch(p){case"state_creation":this.trackers.set(m,new Wc(x,i));break;case"state_disposal":{let a=this.trackers.get(m);if(a)a[Symbol.dispose](),this.trackers.delete(m)}break}}})}}function px(n,i,o){let c={key:i.key,type:"mutable_atom_family"},p=n.families.get(i.key);if(p)n.logger.error("\u2757","mutable_atom_family",i.key,`Overwriting an existing ${Ko(p)} "${p.key}" in store "${n.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let x=new $n,a=Object.assign((f)=>{let v=wn(f),$={key:i.key,subKey:v},w=`${i.key}(${v})`,J=j(n),S={key:w,default:()=>i.default(f),toJson:i.toJson,fromJson:i.fromJson,mutable:!0};if(i.effects)S.effects=i.effects(f);let X=vx(J,S,$);return x.next({type:"state_creation",token:X}),X},c,{subject:x,install:(f)=>px(f,i),toJson:i.toJson,fromJson:i.fromJson,internalRoles:o});return n.families.set(i.key,a),v1(n,a,i),new Yf(a,n),c}var Hf=(n,i)=>{let o=j(i),c=`${n.key}:JSON`;return o.families.get(c)};var ni=(n,i)=>{if(i.family){let c=j(n),x={key:`${i.family.key}:JSON`,type:"selector_family"},m=Tn(c,x),a=JSON.parse(i.family.subKey);return t(n,m,a)}return{type:"selector",key:`${i.key}:JSON`}};var Uo=(n)=>{let o={type:"atom",key:`*${n.key}`};if(n.family)o.family={key:`*${n.family.key}`,subKey:n.family.subKey};return o};function D0(n){return typeof n==="object"&&n!==null&&"do"in n&&"undo"in n&&"subscribe"in n}function ax(n,i,o){let c=o.valueMap.get(i.key),p=n.valueMap.get(i.key);if(c!==p)return p;if(c===void 0)return i.default();o.logger.info("\uD83D\uDCC3","atom",i.key,"copying");let x=i.toJson(c),m=i.fromJson(x);return n.valueMap.set(i.key,m),new Wc(i,o),m}function Zi(n,i,o,c){let p=n.valueMap.get(i);if(p instanceof cx)p.use(o);if(o instanceof Promise){let x=new cx(o);return n.valueMap.set(i,x),x.then((m)=>{Zi(n,i,m,c),c.next({newValue:m,oldValue:x})}).catch((m)=>{n.logger.error("\uD83D\uDCA5","state",i,"rejected:",m)}),x}return n.valueMap.set(i,o),o}var U0=(n,i)=>{let o=i.valueMap.get(n.key);if(n.type==="mutable_atom"&&Mn(i)){let{parent:c}=i;o=ax(i,n,c)}return o},B0=(n,i)=>{let o=i.valueMap.get(n);if(o instanceof cx){let c=o,p=i.selectors.get(n)??i.readonlySelectors.get(n);if(p)c.use(p.get());return}if(i.operation.open)i.operation.prev.set(n,o);i.valueMap.delete(n),i.logger.info("\uD83D\uDDD1","state",n,"evicted")};var L0=(n,i)=>{return j(n).atomsThatAreDefault.has(i)},Rm=(n,i)=>{let o=j(n);o.atomsThatAreDefault=new Set(o.atomsThatAreDefault).add(i)},N0=(n,i)=>{let o=j(n);o.atomsThatAreDefault=new Set(j(n).atomsThatAreDefault),o.atomsThatAreDefault.delete(i)};function Ac(n,i,o){n.logger.info("\uD83D\uDD28","atom",i.key,`creating in store "${n.config.name}"`);let c=j(n),p=c.atoms.get(i.key);if(p&&p.type==="atom")return n.logger.error("\u274C","atom",i.key,"Tried to create atom, but it already exists in the store."),lo(p);let x=new $n,m={...i,type:"atom",install:(v)=>{return v.logger.info("\uD83D\uDEE0\uFE0F","atom",i.key,`installing in store "${v.config.name}"`),Ac(v,i,o)},subject:x};if(o)m.family=o;let a=i.default;if(i.default instanceof Function)a=i.default();c.atoms.set(m.key,m),Rm(n,i.key),Zi(c,i.key,a,x);let f=lo(m);if(i.effects){let v=0,$=[];for(let w of i.effects){let J=w({setSelf:(S)=>{On(n,f,S)},onSet:(S)=>Xi(n,f,`effect[${v}]`,S)});if(J)$.push(J);++v}m.cleanup=()=>{for(let w of $)w()}}return f}function w1(n,i){if("mutable"in i){let p=vx(n,i,void 0);return n.on.atomCreation.next(p),p}let c=Ac(n,i,void 0);return n.on.atomCreation.next(c),c}function Wf(n,i){let o=j(n),{key:c,family:p}=i,x=Tn(o,i);if(!p)n.logger.error("\u274C","atom",c,"Standalone atoms cannot be disposed.");else{x.cleanup?.();let m=n.valueMap.get(x.key),a=Tn(n,{key:p.key,type:"atom_family"}),f={type:"state_disposal",subType:"atom",token:i,value:m};a.subject.next(f);let v=Mn(o);if(o.atoms.delete(c),o.valueMap.delete(c),o.selectorAtoms.delete(c),o.atomsThatAreDefault.delete(c),n.timelineTopics.delete(c),i.type==="mutable_atom"){let $=Uo(i);Wf(n,$),n.trackers.delete(c)}if(n.logger.info("\uD83D\uDD25","atom",c,"deleted"),v&&o.transactionMeta.phase==="building"){let $=o.transactionMeta.update.updates.at(-1);if(!($?.type==="molecule_disposal"&&$.values.some(([S])=>S===x.family?.key)))o.transactionMeta.update.updates.push(f)}else n.on.atomDisposal.next(i)}}class oi extends Set{mode="record";subject=new $n;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(n,i=0){super(n);if(n instanceof oi)this.parent=n,this.cacheUpdateNumber=n.cacheUpdateNumber;if(i)this.cacheLimit=i,this.cache=new Array(i),this.subscribe("auto cache",(o)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=o})}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(n){let i=new oi(n.members,n.cacheLimit);return i.cache=n.cache,i.cacheIdx=n.cacheIdx,i.cacheUpdateNumber=n.cacheUpdateNumber,i}add(n){let i=super.add(n);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${wn(n)}`);return i}clear(){let n=this.mode==="record"?[...this]:null;if(super.clear(),n)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify(n)}`)}delete(n){let i=super.delete(n);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${wn(n)}`);return i}parent;child=null;transactionUpdates=null;transaction(n){this.mode="transaction",this.transactionUpdates=[],this.child=new oi(this);let i=this.child._subscribe("transaction",(o)=>{this.transactionUpdates?.push(o)});try{if(n(this.child)){for(let c of this.transactionUpdates)this.doStep(c);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(o){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",o),o}finally{i(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe(n,i){return this.subject.subscribe(n,i)}subscribe(n,i){return this.subject.subscribe(n,(o)=>{i(`${this.cacheUpdateNumber}=${o}`)})}emit(n){this.subject.next(n)}doStep(n){let i=n.indexOf(":"),o=n.substring(0,i),c=n.substring(i+1);switch(o){case"add":this.add(JSON.parse(c));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(c));break;case"tx":for(let p of c.split(";"))this.doStep(p)}}getUpdateNumber(n){let i=n.indexOf("=");return Number(n.substring(0,i))}do(n){let i=n.indexOf("="),o=Number(n.substring(0,i)),c=o-this.cacheUpdateNumber;if(c>0){if(c===1){this.mode="playback";let x=n.substring(i+1);return this.doStep(x),this.mode="record",this.cacheUpdateNumber=o,null}return this.cacheUpdateNumber+1}if(Math.abs(c)<this.cacheLimit){let x=this.cacheIdx+c;if(this.cache[x]===n)return null;this.mode="playback";let a=!1;while(!a){this.cacheIdx%=this.cacheLimit;let v=this.cache[this.cacheIdx];if(this.cacheIdx--,!v)return"OUT_OF_RANGE";this.undo(v),a=this.cacheIdx===x-1}let f=n.substring(i+1);return this.doStep(f),this.mode="record",this.cacheUpdateNumber=o,null}return"OUT_OF_RANGE"}undoStep(n){let i=n.indexOf(":"),o=n.substring(0,i),c=n.substring(i+1);switch(o){case"add":this.delete(JSON.parse(c));break;case"del":this.add(JSON.parse(c));break;case"clear":{let p=JSON.parse(c);for(let x of p)this.add(x);break}case"tx":{let p=c.split(";");for(let x=p.length-1;x>=0;x--)this.undoStep(p[x])}}}undo(n){let i=n.indexOf("=");if(Number(n.substring(0,i))===this.cacheUpdateNumber){this.mode="playback";let c=n.substring(i+1);return this.undoStep(c),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}}class $x{toolkit;options;defaultContent;molecules=new Map;relations;states;core;transact(n,i){let o=this.toolkit;this.toolkit=n,i(this),this.toolkit=o}store;realm;[Symbol.dispose](){}constructor(n,i,o=g.STORE){this.store=o,this.realm=new zf(o),this.options=n,this.defaultContent=i,this.store.miscResources.set(`join:${n.key}`,this),this.realm.allocate("root",n.key),this.toolkit={get:(...G)=>Gn(o,...G),set:(...G)=>{On(o,...G)},find:(...G)=>t(o,...G),json:(G)=>ni(o,G)};let c=n.between[0],p=n.between[1],x=px(o,{key:`${n.key}/relatedKeys`,default:()=>new oi,mutable:!0,fromJson:(G)=>oi.fromJSON(G),toJson:(G)=>G.toJSON()},["join","relations"]);this.core={relatedKeysAtoms:x};let m=({get:G},z)=>G(x,z),a=({set:G},z,E)=>{if(!this.store.molecules.has(wn(z)))this.realm.allocate(n.key,z);G(x,z,(Q)=>Q.add(E)),G(x,E,(Q)=>Q.add(z))},f=({set:G},z,E)=>{G(x,z,(Q)=>{return Q.delete(E),Q}),G(x,E,(Q)=>{return Q.delete(z),Q})},v=(G,z,E)=>{let{find:Q,get:b,set:y}=G,H=Q(x,z),an=b(H);for(let Z of an){if(E.includes(Z))continue;y(x,Z,(En)=>{return En.delete(z),En})}y(H,(Z)=>{return Z.transaction((fn)=>{fn.clear();for(let En of E){let dn=m(G,En),Vi=dn.has(z);if(this.relations.cardinality==="1:n"){let Oo=[];for(let O of dn){if(O===z)continue;let q=m(G,O);if(q.delete(En),q.size===0)Oo.push(O)}if(!Vi&&dn.size>0)dn.clear();for(let O of Oo){let q=[En,O].sort(),Rn=`"${q[0]}:${q[1]}"`;this.molecules.delete(Rn)}}if(!Vi)dn.add(z);fn.add(En)}return!0}),Z})},$=(G,z,E)=>{let{set:Q}=G;Q(x,z,(b)=>{return b.transaction((y)=>{for(let H of E)y.add(H);return!0}),b});for(let b of E)Q(x,b,(y)=>{return y.add(z),y});return!0},w=(G,z,E)=>{let Q=m(G,z);return E?Q.has(E):Q.size>0},J={getRelatedKeys:(G)=>m(this.toolkit,G),addRelation:(G,z)=>{this.store.moleculeJoins.set(G,n.key),this.store.moleculeJoins.set(z,n.key),a(this.toolkit,G,z)},deleteRelation:(G,z)=>{f(this.toolkit,G,z)},replaceRelationsSafely:(G,z)=>{v(this.toolkit,G,z)},replaceRelationsUnsafely:(G,z)=>{$(this.toolkit,G,z)},has:(G,z)=>w(this.toolkit,G,z)},S,X;if(i){X=Jc(o,{key:`${n.key}/content`,default:i},["join","content"]);let G=({get:Q},b)=>Q(X,b),z=({set:Q},b,y)=>{Q(X,b,y)};S=Object.assign(J,{getContent:(Q)=>{return G(this.toolkit,Q)},setContent:(Q,b)=>{z(this.toolkit,Q,b)},deleteContent:(Q)=>{this.realm.deallocate(Q)}})}else S=J;let R=new ii(n,{externalStore:S,isAType:n.isAType,isBType:n.isBType,makeContentKey:(...G)=>{let[z,E]=G,Q=G.sort(),b=`${Q[0]}:${Q[1]}`,y=o.molecules.get(wn(z)),H=o.molecules.get(wn(E));if(!y)this.realm.allocate(n.key,z);if(!H)this.realm.allocate(n.key,E);return this.realm.allocate(z,b,"all"),this.realm.claim(E,b),this.store.moleculeJoins.set(b,n.key),b}}),K=()=>Io(o,{key:`${n.key}/singleRelatedKey`,get:(G)=>({get:z})=>{let E=z(x,G);for(let Q of E)return Q;return null}},["join","keys"]),M=()=>{return Io(o,{key:`${n.key}/multipleRelatedKeys`,get:(G)=>({get:z})=>{let E=Hf(x,o);return z(E,G).members}},["join","keys"])},Y=()=>Io(o,{key:`${n.key}/singleRelatedEntry`,get:(G)=>({get:z})=>{let E=z(x,G);for(let Q of E){let b=R.isAType?.(G)?G:void 0,y=b===void 0?G:void 0;b??=Q,y??=Q;let H=R.makeContentKey(b,y),an=z(X,H);return[Q,an]}return null}},["join","entries"]),I=()=>Io(o,{key:`${n.key}/multipleRelatedEntries`,get:(G)=>({get:z})=>{let E=Hf(x,o);return z(E,G).members.map((b)=>{let y=R.isAType?.(G)?G:void 0,H=y===void 0?G:void 0;y??=b,H??=b;let an=R.makeContentKey(y,H),Z=z(X,an);return[b,Z]})}},["join","entries"]);switch(n.cardinality){case"1:1":{let G=K(),z=`${c}KeyOf${Yn(p)}`,E=`${p}KeyOf${Yn(c)}`,Q={[z]:G,[E]:G},b;if(i){let y=Y(),H=`${c}EntryOf${Yn(p)}`,an=`${p}EntryOf${Yn(c)}`,Z={[H]:y,[an]:y};b=Object.assign(Q,Z)}else b=Q;this.relations=R,this.states=b;break}case"1:n":{let G=K(),z=M(),E=`${c}KeyOf${Yn(p)}`,Q=`${p}KeysOf${Yn(c)}`,b={[E]:G,[Q]:z},y;if(i){let H=Y(),an=I(),Z=`${c}EntryOf${Yn(p)}`,fn=`${p}EntriesOf${Yn(c)}`,En={[Z]:H,[fn]:an};y=Object.assign(b,En)}else y=b;this.relations=R,this.states=y;break}case"n:n":{let G=M(),z=`${c}KeysOf${Yn(p)}`,E=`${p}KeysOf${Yn(c)}`,Q={[z]:G,[E]:G},b;if(i){let y=I(),H=`${c}EntriesOf${Yn(p)}`,an=`${p}EntriesOf${Yn(c)}`,Z={[H]:y,[an]:y};b=Object.assign(Q,Z)}else b=Q;this.relations=R,this.states=b}}}}function np(n,i){let o=i.joins.get(n.key);if(o===void 0){let p=g.STORE.joins.get(n.key);if(p===void 0)throw new Error(`Join "${n.key}" not found in store "${i.config.name}"`);o=new $x(p.options,p.defaultContent,i),i.joins.set(n.key,o)}return o}function ko(n,i,o){let c=np(n,o),p=j(o);if(Mn(p)){let{toolkit:x}=p.transactionMeta;c.transact(x,({relations:m})=>{i(m)})}else i(c.relations)}function ip(n,i,o){let c=np(n,o),p;switch(n.cardinality){case"1:1":{let x=`${n.a}KeyOf${Yn(n.b)}`,m=`${n.b}KeyOf${Yn(n.a)}`;p={get[x](){let f=c.states[x];return t(o,f,i)},get[m](){let f=c.states[m];return t(o,f,i)}};let a=`${n.a}EntryOf${Yn(n.b)}`;if(a in c.states){let f=`${n.b}EntryOf${Yn(n.a)}`;Object.assign(p,{get[a](){let v=c.states[a];return t(o,v,i)},get[f](){let v=c.states[f];return t(o,v,i)}})}break}case"1:n":{let x=`${n.a}KeyOf${Yn(n.b)}`,m=`${n.b}KeysOf${Yn(n.a)}`;p={get[x](){let f=c.states[x];return t(o,f,i)},get[m](){let f=c.states[m];return t(o,f,i)}};let a=`${n.a}EntryOf${Yn(n.b)}`;if(a in c.states){let f=`${n.b}EntriesOf${Yn(n.a)}`;Object.assign(p,{get[a](){let v=c.states[a];return t(o,v,i)},get[f](){let v=c.states[f];return t(o,v,i)}})}break}case"n:n":{let x=`${n.a}KeysOf${Yn(n.b)}`,m=`${n.b}KeysOf${Yn(n.a)}`;p={get[x](){let f=c.states[x];return t(o,f,i)},get[m](){let f=c.states[m];return t(o,f,i)}};let a=`${n.a}EntriesOf${Yn(n.b)}`;if(a in c.states){let f=`${n.b}EntriesOf${Yn(n.a)}`;Object.assign(p,{get[a](){let v=c.states[a];return t(o,v,i)},get[f](){let v=c.states[f];return t(o,v,i)}})}}}return p}function J1(n,i){return np(n,i).core.relatedKeysAtoms}function o1(n){return n.startsWith("\uD83D\uDD0D ")}function Zo(n){return w1(g.STORE,n)}function Kc(n){return z0(g.STORE,n)}function Sm(n,i,o=g.STORE){return o.joins.set(n.key,new $x(n,i,o)),{key:n.key,type:"join",a:n.between[0],b:n.between[1],cardinality:n.cardinality}}function A1(n){return J1(n,g.STORE)}var Qf=(n)=>(i,o,c,p,...x)=>{console[n](`${i} ${o} "${c}" ${p}`,...x)},v3={error:Qf("error"),info:Qf("info"),warn:Qf("warn")};class Xc{logLevel;filter;logger;constructor(n,i,o=v3){this.logLevel=n,this.filter=i,this.logger=o}error=(...n)=>{if((this.filter?.(...n)??!0)&&this.logLevel!==null)this.logger.error(...n)};info=(...n)=>{if((this.filter?.(...n)??!0)&&this.logLevel==="info")this.logger.info(...n)};warn=(...n)=>{if((this.filter?.(...n)??!0)&&this.logLevel!=="error"&&this.logLevel!==null)this.logger.warn(...n)}}var xV=Symbol("claim");class F1{store;constructor(n=g.STORE){this.store=n,I0("root",n)}allocate(n,i,o){return Tc(this.store,n,i,o)}fuse(n,i,o){return y0(this.store,n,i,o)}deallocate(n){Rc(this.store,n)}claim(n,i,o){return ec(this.store,n,i,o)}}class zf{store;realm;constructor(n=g.STORE){this.store=n,this.realm=new F1(n)}allocate(n,i,o){Tc(this.store,n,i,o)}deallocate(n){Rc(this.store,n)}claim(n,i,o){ec(this.store,n,i,o)}}function Xm(n){return Q0(g.STORE,n)}function lc(n){return Xf(g.STORE,n)}class T1 extends Map{set(n,i){if(this.has(n))return console.warn("Tried to set a key that already exists in an InvariantMap",{key:n,value:i}),this;return super.set(n,i)}clear(){throw new Error("Cannot clear an InvariantMap")}}class Wm{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(n){this.key=n}static existing=new T1;static create(n,i){let o=new Wm(n),{type:c,globals:p,actions:x,perspectives:m}=i(o),a={type:c,key:n,globals:p,actions:x,perspectives:m};return Wm.existing.set(n,a),a}add(...n){switch(n[0].type){case"atom":case"mutable_atom":this.globals.push(...n);break;case"transaction":this.actions.push(...n);break;case"atom_family":case"mutable_atom_family":{let[o,c]=n;this.perspectives.push({type:"realtime_perspective",resourceAtoms:o,viewAtoms:c})}break}return this}}function R1(n){let{key:i,config:o}=n,c=Wm.create(i,o),{actions:p}=c;for(let x of p)g0(g.STORE,i,x.key);return t0(g.STORE,i,-1),c}var TV=Zo({key:"usersInRoomIndex",mutable:!0,default:()=>new oi,toJson:(n)=>n.toJSON(),fromJson:(n)=>oi.fromJSON(n)}),Ef=Zo({key:"roomIndex",default:()=>new oi,mutable:!0,toJson:(n)=>n.toJSON(),fromJson:(n)=>oi.fromJSON(n)}),$3={enteredAtEpoch:0},wx=Sm({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:(n)=>typeof n==="string",isBType:(n)=>typeof n==="string"},$3),RV=Xm({key:"usersInMyRoomView",get:(n)=>({find:i})=>{let o=A1(wx);return[i(o,n)]}});import{spawn as w3}from"node:child_process";class op{listeners;globalListeners;handleEvent(n,...i){for(let c of this.globalListeners)c(n,...i);let o=this.listeners.get(n);if(o)for(let c of o)c(...i)}id="no_id_retrieved";emit;constructor(n){this.emit=n,this.listeners=new Map,this.globalListeners=new Set}on(n,i){let o=this.listeners.get(n);if(o)o.add(i);else this.listeners.set(n,new Set([i]));return this}onAny(n){return this.globalListeners.add(n),this}off(n,i){let o=this.listeners.get(n);if(o)if(i)o.delete(i);else this.listeners.delete(n);return this}offAny(n){return this.globalListeners.delete(n),this}}class Jx extends op{incompleteData="";unprocessedEvents=[];incompleteLog="";unprocessedLogs=[];id="#####";process;key;logger;handleLog(n){if(Array.isArray(n)){let[i,...o]=n;switch(i){case"i":this.logger.info(...o);break;case"w":this.logger.warn(...o);break;case"e":this.logger.error(...o);break;default:return}}}constructor(n,i,o){super((c,...p)=>{let x=JSON.stringify([c,...p])+"\x03",m=(a)=>{if(a.code==="EPIPE")console.error("EPIPE error during write",this.process.stdin);this.process.stdin.removeListener("error",m)};return this.process.stdin.once("error",m),this.process.stdin.write(x),this});if(this.process=n,this.key=i,this.logger=o??{info:(...c)=>{console.info(this.id,this.key,...c)},warn:(...c)=>{console.warn(this.id,this.key,...c)},error:(...c)=>{console.error(this.id,this.key,...c)}},this.process.stdout.on("data",(c)=>{let p=c.toString();if(p==="ALIVE")return;this.unprocessedEvents.push(...p.split("\x03"));let x=this.unprocessedEvents.shift();this.incompleteData+=x??"";try{if(this.incompleteData.startsWith("error"))console.log("\u2757",this.incompleteData);let m=xi(this.incompleteData);this.handleEvent(...m);while(this.unprocessedEvents.length>0){let a=this.unprocessedEvents.shift();if(a){if(this.unprocessedEvents.length===0)this.incompleteData=a;m=xi(a),this.handleEvent(...m)}}this.incompleteData=""}catch(m){console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.warn(this.incompleteData),console.warn("\u26A0\uFE0F----------------\u26A0\uFE0F"),console.error(m)}}),this.process.stderr.on("data",(c)=>{let p=c.toString();this.unprocessedLogs.push(...p.split("\x03"));let x=this.unprocessedLogs.shift();this.incompleteLog+=x??"";try{let m=xi(this.incompleteLog);this.handleLog(m);while(this.unprocessedLogs.length>0)if(this.incompleteLog=this.unprocessedLogs.shift()??"",this.incompleteLog)m=xi(this.incompleteLog),this.handleLog(m)}catch(m){console.error("\u274C\u274C\u274C"),console.error(this.incompleteLog),console.error(m),console.error("\u274C\u274C\u274C\uFE0F")}}),n.pid)this.id=n.pid.toString()}}class S1 extends op{in;out;id="no_id_retrieved";disposalFunctions=[];constructor(n){super((...i)=>{return this.out.next(i),this});this.id=n,this.in=new $n,this.out=new $n,this.in.subscribe("socket",(i)=>{this.handleEvent(...i)})}dispose(){for(let n of this.disposalFunctions)n()}}class Of extends op{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...n){this.process.stderr.write(wn(n.map((i)=>i instanceof oi?`{ ${i.toJSON().members.join(" | ")} }`:i))+"\x03")}logger={info:(...n)=>{this.log("i",...n)},warn:(...n)=>{this.log("w",...n)},error:(...n)=>{this.log("e",...n)}};constructor(){super((n,...i)=>{let o=JSON.stringify([n,...i]);return this.process.stdout.write(o+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",(n)=>{let i=n.toString();this.unprocessedEvents.push(...i.split("\x03"));let o=this.unprocessedEvents.shift();this.incompleteData+=o??"";try{let c=xi(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",c),this.handleEvent(...c);while(this.unprocessedEvents.length>0){let p=this.unprocessedEvents.shift();if(p){if(this.unprocessedEvents.length===0)this.incompleteData=p;let x=xi(p);this.handleEvent(...x)}}this.incompleteData=""}catch(c){if(c instanceof Error)this.logger.error("\u2757",c.message,c.cause,c.stack)}}),this.on("exit",()=>{this.logger.info("\uD83D\uDD25",this.id,'received "exit"'),process.exit(0)}),process.on("exit",(n)=>{this.logger.info("\uD83D\uDD25",this.id,`exited with code ${n}`)}),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",(n)=>{this.logger.info("\uD83D\uDC64","user",n,"joined");let i=new S1(`user:${n}`);this.relays.set(n,i),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let o of this.relayServices){let c=o(i);if(c)i.disposalFunctions.push(c)}this.on(`user:${n}`,(...o)=>{i.in.next(o)}),i.out.subscribe("socket",(o)=>{this.emit(...o)})}),this.on("user-leaves",(n)=>{let i=this.relays.get(n);if(this.off(`relay:${n}`),i)i.dispose(),this.relays.delete(n)}),process.stdout.write("ALIVE")}relay(n){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push(n)}}var Uf=Kc({key:"roomArguments",default:["echo",["Hello World!"]]}),X1=Xm({key:"room",get:(n)=>async({get:i,find:o})=>{let c=o(Uf,n),p=i(c),[x,m]=p,a=await new Promise((f)=>{let v=w3(x,m,{env:process.env}),$=(w)=>{if(w.toString()==="ALIVE")v.stdout.off("data",$),f(v)};v.stdout.on("data",$)});return new Jx(a,n)}});var yV=lc({key:"createRoom",do:({get:n,set:i,find:o},c,p,x)=>{let m=x?[p,x]:[p],a=o(Uf,c);i(a,m),i(Ef,($)=>$.add(c));let f=o(X1,c);return n(f)}}),kV=lc({key:"joinRoom",do:(n,i,o,c)=>{let p={enteredAtEpoch:c};return ko(wx,(x)=>{x.set({room:i,user:o},p)},n.env().store),p}}),ZV=lc({key:"leaveRoom",do:(n,i,o)=>{ko(wx,(c)=>{c.delete({room:i,user:o})},n.env().store)}}),qV=lc({key:"destroyRoom",do:(n,i)=>{ko(wx,(o)=>{o.delete({room:i})},n.env().store),n.set(Ef,(o)=>(o.delete(i),o))}});function Vf(n,i){return i.map((o)=>{switch(o.type){case"transaction_update":{let c=Vf(n,o.updates);return{...o,updates:c}}case"atom_update":case"selector_update":case"molecule_creation":case"molecule_disposal":case"molecule_transfer":case"state_creation":case"state_disposal":return o}}).filter((o)=>{switch(o.type){case"atom_update":case"selector_update":return n.includes(o.key);case"state_creation":case"state_disposal":return n.includes(o.token.key);case"molecule_creation":case"transaction_update":case"molecule_disposal":case"molecule_transfer":return!0}})}var tV=Kc({key:"redactor",default:{occlude:(n)=>n}}),cp=Kc({key:"unacknowledgedUpdates",default:()=>[]});var Km=Kc({key:"sockets",default:null}),_f=Zo({key:"socketsIndex",mutable:!0,default:()=>new oi,toJson:(n)=>n.toJSON(),fromJson:(n)=>oi.fromJSON(n)}),bf=Zo({key:"usersIndex",mutable:!0,default:()=>new oi,toJson:(n)=>n.toJSON(),fromJson:(n)=>oi.fromJSON(n)}),Gc=Sm({key:"usersOfSockets",between:["user","socket"],cardinality:"1:1",isAType:(n)=>n.startsWith("user::"),isBType:(n)=>n.startsWith("socket::")});function W1(n,i,o,c){let p=i.key;return function x(){let m=[];for(let f of i.globals){let v=f.type==="mutable_atom"?ni(n,f):f,$=Gn(n,v);m.push(v,$)}for(let f of i.perspectives){let{viewAtoms:v,resourceAtoms:$}=f,w=t(n,v,o),J=Gn(n,w);n.logger.info("\uD83D\uDC41","atom",$.key,`${o} can see`,{viewAtoms:v,resourceAtoms:$,userView:J});for(let S of J){let X=S.type==="mutable_atom"?ni(n,S):S,R=Gn(n,X);m.push(X,R)}}let a=$i(n)?n.transactionMeta.epoch.get(p)??null:null;c?.emit(`continuity-init:${p}`,a,m)}}function K1(n,i,o){let c=i.key;return function p(x){n.logger.info("\uD83D\uDECE\uFE0F","continuity",c,"received",x);let{key:m,id:a}=x,f=`tx-run:${m}:${a}`,v=`${f}:start`,$=`${f}:end`;performance.mark(v);try{dc(n,{type:"transaction",key:m},a)(...x.params)}catch(J){if(J instanceof Error)n.logger.error("\u274C","continuity",c,`failed to run transaction ${m} from ${o} with update ${a}`,J.message)}performance.mark($);let w=performance.measure(f,v,$);n?.logger.info("\uD83D\uDE80","transaction",m,a,o,w.duration)}}function l1(n,i,o,c){let p=i.key;return function x(m){if(n.logger.info("\uD83D\uDC4D","continuity",p,`${o} acknowledged epoch ${m}`),c[0]?.epoch===m)On(n,cp,o,(f)=>{return f.shift(),n.logger.info("\uD83D\uDC4D","continuity",p,`${o} unacknowledged update queue now has`,f.length,"items"),f})}}function G1(n,i,o,c){let p=i.key,x=[];for(let m of i.actions){let a=Gf(n,m,`sync-continuity:${p}:${o}`,(f)=>{try{let v=i.globals.map((J)=>{if(J.type==="atom")return J.key;return Uo(J).key}).concat(i.perspectives.flatMap((J)=>{let{viewAtoms:S}=J,X=t(n,S,o);return Gn(n,X).map((K)=>{return K.type==="mutable_atom"?"*"+K.key:K.key})})),$=Vf(v,f.updates),w={...f,updates:$};On(n,cp,o,(J)=>{if(w)J.push(w),J.sort((S,X)=>S.epoch-X.epoch),n.logger.info("\uD83D\uDC4D","continuity",p,`${o} unacknowledged update queue now has`,J.length,"items");return J}),c?.emit(`tx-new:${p}`,w)}catch(v){if(v instanceof Error)n.logger.error("\u274C","continuity",p,`${o} failed to send update from transaction ${m.key} to ${o}`,v.message)}});x.push(a)}return x}function M1(n,i,o,c){let p=i.key,x=[];for(let m of i.perspectives){let{viewAtoms:a}=m,f=t(n,a,o),v=Xi(n,f,`sync-continuity:${p}:${o}:perspective:${m.resourceAtoms.key}`,({oldValue:$,newValue:w})=>{let J=$.map((K)=>K.key),S=w.map((K)=>K.key),X=$.filter((K)=>!S.includes(K.key)),R=w.filter((K)=>!J.includes(K.key)).flatMap((K)=>{let M=K.type==="mutable_atom"?ni(n,K):K,Y=Gn(n,M);return[M,Y]});if(n.logger.info("\uD83D\uDC41","atom",m.resourceAtoms.key,`${o} has a new perspective`,{oldKeys:J,newKeys:S,revealed:R,concealed:X}),R.length>0)c?.emit(`reveal:${p}`,R);if(X.length>0)c?.emit(`conceal:${p}`,X)});x.push(v)}return x}function Y1({socket:n,store:i=g.STORE}){return function o(c){let p=n,x=c.key,m=ip(Gc,`socket::${p.id}`,i).userKeyOfSocket,a=Gn(i,m);if(!a)return i.logger.error("\u274C","continuity",x,`Tried to create a synchronizer for a socket (${p.id}) that is not connected to a user.`),()=>{};let f=ip(Gc,a,i).socketKeyOfUser,v=Xi(i,f,`sync-continuity:${x}:${a}`,({newValue:M})=>{if(i.logger.info("\uD83D\uDC4B","continuity",x,`seeing ${a} on new socket ${M}`),M===null){i.logger.warn("\u274C","continuity",x,`User (${a}) is not connected to a socket, waiting for them to reappear.`);return}let Y=t(i,Km,M);p=Gn(i,Y);for(let G of $)p?.emit(`tx-new:${x}`,G)}),$=Gn(i,cp,a),w=[],J=M1(i,c,a,p),S=G1(i,c,a,p);w.push(...J,...S);let X=W1(i,c,a,n);p.off(`get:${x}`,X),p.on(`get:${x}`,X);let R=K1(i,c,a);p.off(`tx-run:${x}`,R),p.on(`tx-run:${x}`,R);let K=l1(i,c,a,$);return p?.on(`ack:${x}`,K),()=>{for(let M of w)M();p?.off(`ack:${x}`,K),p?.off(`get:${x}`,X),p?.off(`tx-run:${x}`,R)}}}var mS=wf($v(),1);var F=Symbol.for("drizzle:entityKind"),mb=Symbol.for("drizzle:hasOwnEntityKind");function l(n,i){if(!n||typeof n!=="object")return!1;if(n instanceof i)return!0;if(!Object.prototype.hasOwnProperty.call(i,F))throw new Error(`Class "${i.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 o=Object.getPrototypeOf(n).constructor;if(o)while(o){if(F in o&&o[F]===i[F])return!0;o=Object.getPrototypeOf(o)}return!1}class Un{constructor(n,i){this.table=n,this.config=i,this.name=i.name,this.keyAsName=i.keyAsName,this.notNull=i.notNull,this.default=i.default,this.defaultFn=i.defaultFn,this.onUpdateFn=i.onUpdateFn,this.hasDefault=i.hasDefault,this.primary=i.primaryKey,this.isUnique=i.isUnique,this.uniqueName=i.uniqueName,this.uniqueType=i.uniqueType,this.dataType=i.dataType,this.columnType=i.columnType,this.generated=i.generated,this.generatedIdentity=i.generatedIdentity}static[F]="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(n){return n}mapToDriverValue(n){return n}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class wv{static[F]="ColumnBuilder";config;constructor(n,i,o){this.config={name:n,keyAsName:n==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:i,columnType:o,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(n){return this.config.default=n,this.config.hasDefault=!0,this}$defaultFn(n){return this.config.defaultFn=n,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(n){return this.config.onUpdateFn=n,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(n){if(this.config.name!=="")return;this.config.name=n}}var fo=Symbol.for("drizzle:Name");class Jv{static[F]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(n,i){if(this.reference=()=>{let{name:o,columns:c,foreignColumns:p}=n();return{name:o,columns:c,foreignTable:p[0].table,foreignColumns:p}},i)this._onUpdate=i.onUpdate,this._onDelete=i.onDelete}onUpdate(n){return this._onUpdate=n===void 0?"no action":n,this}onDelete(n){return this._onDelete=n===void 0?"no action":n,this}build(n){return new lJ(n,this)}}class lJ{constructor(n,i){this.table=n,this.reference=i.reference,this.onUpdate=i._onUpdate,this.onDelete=i._onDelete}static[F]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:n,columns:i,foreignColumns:o}=this.reference(),c=i.map((m)=>m.name),p=o.map((m)=>m.name),x=[this.table[fo],...c,o[0].table[fo],...p];return n??`${x.join("_")}_fk`}}function Im(n,...i){return n(...i)}function GJ(n,i){return`${n[fo]}_${i.join("_")}_unique`}function MJ(n,i,o){for(let c=i;c<n.length;c++){let p=n[c];if(p==="\\"){c++;continue}if(p==='"')return[n.slice(i,c).replace(/\\/g,""),c+1];if(o)continue;if(p===","||p==="}")return[n.slice(i,c).replace(/\\/g,""),c]}return[n.slice(i).replace(/\\/g,""),n.length]}function YJ(n,i=0){let o=[],c=i,p=!1;while(c<n.length){let x=n[c];if(x===","){if(p||c===i)o.push("");p=!0,c++;continue}if(p=!1,x==="\\"){c+=2;continue}if(x==='"'){let[f,v]=MJ(n,c+1,!0);o.push(f),c=v;continue}if(x==="}")return[o,c+1];if(x==="{"){let[f,v]=YJ(n,c+1);o.push(f),c=v;continue}let[m,a]=MJ(n,c,!1);o.push(m),c=a}return[o,c]}function HJ(n){let[i]=YJ(n,1);return i}function Av(n){return`{${n.map((i)=>{if(Array.isArray(i))return Av(i);if(typeof i==="string")return`"${i.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${i}`}).join(",")}}`}class h extends wv{foreignKeyConfigs=[];static[F]="PgColumnBuilder";array(n){return new QJ(this.config.name,this,n)}references(n,i={}){return this.foreignKeyConfigs.push({ref:n,actions:i}),this}unique(n,i){return this.config.isUnique=!0,this.config.uniqueName=n,this.config.uniqueType=i?.nulls,this}generatedAlwaysAs(n){return this.config.generated={as:n,type:"always",mode:"stored"},this}buildForeignKeys(n,i){return this.foreignKeyConfigs.map(({ref:o,actions:c})=>{return Im((p,x)=>{let m=new Jv(()=>{let a=p();return{columns:[n],foreignColumns:[a]}});if(x.onUpdate)m.onUpdate(x.onUpdate);if(x.onDelete)m.onDelete(x.onDelete);return m.build(i)},o,c)})}buildExtraConfigColumn(n){return new zJ(n,this.config)}}class V extends Un{constructor(n,i){if(!i.uniqueName)i.uniqueName=GJ(n,[i.name]);super(n,i);this.table=n}static[F]="PgColumn"}class zJ extends V{static[F]="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(n){return this.indexConfig.opClass=n,this}}class Yx{static[F]="IndexedColumn";constructor(n,i,o,c){this.name=n,this.keyAsName=i,this.type=o,this.indexConfig=c}name;keyAsName;type;indexConfig}class QJ extends h{static[F]="PgArrayBuilder";constructor(n,i,o){super(n,"array","PgArray");this.config.baseBuilder=i,this.config.size=o}build(n){let i=this.config.baseBuilder.build(n);return new Fv(n,this.config,i)}}class Fv extends V{constructor(n,i,o,c){super(n,i);this.baseColumn=o,this.range=c,this.size=i.size}size;static[F]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue(n){if(typeof n==="string")n=HJ(n);return n.map((i)=>this.baseColumn.mapFromDriverValue(i))}mapToDriverValue(n,i=!1){let o=n.map((c)=>c===null?null:l(this.baseColumn,Fv)?this.baseColumn.mapToDriverValue(c,!0):this.baseColumn.mapToDriverValue(c));if(i)return o;return Av(o)}}var Tv=Symbol.for("drizzle:isPgEnum");function EJ(n){return!!n&&typeof n==="function"&&Tv in n&&n[Tv]===!0}class OJ extends h{static[F]="PgEnumColumnBuilder";constructor(n,i){super(n,"string","PgEnumColumn");this.config.enum=i}build(n){return new UJ(n,this.config)}}class UJ extends V{static[F]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(n,i){super(n,i);this.enum=i.enum}getSQLType(){return this.enum.enumName}}function ym(n,i){return VX(n,i,void 0)}function VX(n,i,o){let c=Object.assign((p)=>new OJ(p??"",c),{enumName:n,enumValues:i,schema:o,[Tv]:!0});return c}class ci{static[F]="Subquery";constructor(n,i,o,c=!1){this._={brand:"Subquery",sql:n,selectedFields:i,alias:o,isWith:c}}}class Hx extends ci{static[F]="WithSubquery"}var VJ="0.41.0";var Rv,Sv,Vn={startActiveSpan(n,i){if(!Rv)return i();if(!Sv)Sv=Rv.trace.getTracer("drizzle-orm",VJ);return Im((o,c)=>c.startActiveSpan(n,(p)=>{try{return i(p)}catch(x){throw p.setStatus({code:o.SpanStatusCode.ERROR,message:x instanceof Error?x.message:"Unknown error"}),x}finally{p.end()}}),Rv,Sv)}};var un=Symbol.for("drizzle:ViewBaseConfig");var km=Symbol.for("drizzle:Schema"),Zm=Symbol.for("drizzle:Columns"),_J=Symbol.for("drizzle:ExtraConfigColumns"),Xv=Symbol.for("drizzle:OriginalName"),Wv=Symbol.for("drizzle:BaseName"),zx=Symbol.for("drizzle:IsAlias"),bJ=Symbol.for("drizzle:ExtraConfigBuilder"),_X=Symbol.for("drizzle:IsDrizzleTable");class D{static[F]="Table";static Symbol={Name:fo,Schema:km,OriginalName:Xv,Columns:Zm,ExtraConfigColumns:_J,BaseName:Wv,IsAlias:zx,ExtraConfigBuilder:bJ};[fo];[Xv];[km];[Zm];[_J];[Wv];[zx]=!1;[_X]=!0;[bJ]=void 0;constructor(n,i,o){this[fo]=this[Xv]=n,this[km]=i,this[Wv]=o}}function mi(n){return n[fo]}function Ec(n){return`${n[km]??"public"}.${n[fo]}`}function Kv(n){return n!==null&&n!==void 0&&typeof n.getSQL==="function"}function bX(n){let i={sql:"",params:[]};for(let o of n)if(i.sql+=o.sql,i.params.push(...o.params),o.typings?.length){if(!i.typings)i.typings=[];i.typings.push(...o.typings)}return i}class pi{static[F]="StringChunk";value;constructor(n){this.value=Array.isArray(n)?n:[n]}getSQL(){return new L([this])}}class L{constructor(n){this.queryChunks=n}static[F]="SQL";decoder=BJ;shouldInlineParams=!1;append(n){return this.queryChunks.push(...n.queryChunks),this}toQuery(n){return Vn.startActiveSpan("drizzle.buildSQL",(i)=>{let o=this.buildQueryFromSourceParams(this.queryChunks,n);return i?.setAttributes({"drizzle.query.text":o.sql,"drizzle.query.params":JSON.stringify(o.params)}),o})}buildQueryFromSourceParams(n,i){let o=Object.assign({},i,{inlineParams:i.inlineParams||this.shouldInlineParams,paramStartIndex:i.paramStartIndex||{value:0}}),{casing:c,escapeName:p,escapeParam:x,prepareTyping:m,inlineParams:a,paramStartIndex:f}=o;return bX(n.map((v)=>{if(l(v,pi))return{sql:v.value.join(""),params:[]};if(l(v,qm))return{sql:p(v.value),params:[]};if(v===void 0)return{sql:"",params:[]};if(Array.isArray(v)){let $=[new pi("(")];for(let[w,J]of v.entries())if($.push(J),w<v.length-1)$.push(new pi(", "));return $.push(new pi(")")),this.buildQueryFromSourceParams($,o)}if(l(v,L))return this.buildQueryFromSourceParams(v.queryChunks,{...o,inlineParams:a||v.shouldInlineParams});if(l(v,D)){let $=v[D.Symbol.Schema],w=v[D.Symbol.Name];return{sql:$===void 0||v[zx]?p(w):p($)+"."+p(w),params:[]}}if(l(v,Un)){let $=c.getColumnCasing(v);if(i.invokeSource==="indexes")return{sql:p($),params:[]};let w=v.table[D.Symbol.Schema];return{sql:v.table[zx]||w===void 0?p(v.table[D.Symbol.Name])+"."+p($):p(w)+"."+p(v.table[D.Symbol.Name])+"."+p($),params:[]}}if(l(v,bi)){let $=v[un].schema,w=v[un].name;return{sql:$===void 0||v[un].isAlias?p(w):p($)+"."+p(w),params:[]}}if(l(v,Li)){if(l(v.value,go))return{sql:x(f.value++,v),params:[v],typings:["none"]};let $=v.value===null?null:v.encoder.mapToDriverValue(v.value);if(l($,L))return this.buildQueryFromSourceParams([$],o);if(a)return{sql:this.mapInlineParam($,o),params:[]};let w=["none"];if(m)w=[m(v.encoder)];return{sql:x(f.value++,$),params:[$],typings:w}}if(l(v,go))return{sql:x(f.value++,v),params:[v],typings:["none"]};if(l(v,L.Aliased)&&v.fieldAlias!==void 0)return{sql:p(v.fieldAlias),params:[]};if(l(v,ci)){if(v._.isWith)return{sql:p(v._.alias),params:[]};return this.buildQueryFromSourceParams([new pi("("),v._.sql,new pi(") "),new qm(v._.alias)],o)}if(EJ(v)){if(v.schema)return{sql:p(v.schema)+"."+p(v.enumName),params:[]};return{sql:p(v.enumName),params:[]}}if(Kv(v)){if(v.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([v.getSQL()],o);return this.buildQueryFromSourceParams([new pi("("),v.getSQL(),new pi(")")],o)}if(a)return{sql:this.mapInlineParam(v,o),params:[]};return{sql:x(f.value++,v),params:[v],typings:["none"]}}))}mapInlineParam(n,{escapeString:i}){if(n===null)return"null";if(typeof n==="number"||typeof n==="boolean")return n.toString();if(typeof n==="string")return i(n);if(typeof n==="object"){let o=n.toString();if(o==="[object Object]")return i(JSON.stringify(n));return i(o)}throw new Error("Unexpected param value: "+n)}getSQL(){return this}as(n){if(n===void 0)return this;return new L.Aliased(this,n)}mapWith(n){return this.decoder=typeof n==="function"?{mapFromDriverValue:n}:n,this}inlineParams(){return this.shouldInlineParams=!0,this}if(n){return n?this:void 0}}class qm{constructor(n){this.value=n}static[F]="Name";brand;getSQL(){return new L([this])}}function uJ(n){return typeof n==="object"&&n!==null&&"mapToDriverValue"in n&&typeof n.mapToDriverValue==="function"}var BJ={mapFromDriverValue:(n)=>n},jJ={mapToDriverValue:(n)=>n},Pb={...BJ,...jJ};class Li{constructor(n,i=jJ){this.value=n,this.encoder=i}static[F]="Param";brand;getSQL(){return new L([this])}}function T(n,...i){let o=[];if(i.length>0||n.length>0&&n[0]!=="")o.push(new pi(n[0]));for(let[c,p]of i.entries())o.push(p,new pi(n[c+1]));return new L(o)}((n)=>{function i(){return new L([])}n.empty=i;function o(f){return new L(f)}n.fromList=o;function c(f){return new L([new pi(f)])}n.raw=c;function p(f,v){let $=[];for(let[w,J]of f.entries()){if(w>0&&v!==void 0)$.push(v);$.push(J)}return new L($)}n.join=p;function x(f){return new qm(f)}n.identifier=x;function m(f){return new go(f)}n.placeholder=m;function a(f,v){return new Li(f,v)}n.param=a})(T||(T={}));((n)=>{class i{constructor(o,c){this.sql=o,this.fieldAlias=c}static[F]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new i(this.sql,this.fieldAlias)}}n.Aliased=i})(L||(L={}));class go{constructor(n){this.name=n}static[F]="Placeholder";getSQL(){return new L([this])}}function lv(n,i){return n.map((o)=>{if(l(o,go)){if(!(o.name in i))throw new Error(`No value for placeholder "${o.name}" was provided`);return i[o.name]}if(l(o,Li)&&l(o.value,go)){if(!(o.value.name in i))throw new Error(`No value for placeholder "${o.value.name}" was provided`);return o.encoder.mapToDriverValue(i[o.value.name])}return o})}var uX=Symbol.for("drizzle:IsDrizzleView");class bi{static[F]="View";[un];[uX]=!0;constructor({name:n,schema:i,selectedFields:o,query:c}){this[un]={name:n,originalName:n,schema:i,selectedFields:o,query:c,isExisting:!c,isAlias:!1}}getSQL(){return new L([this])}}Un.prototype.getSQL=function(){return new L([this])};D.prototype.getSQL=function(){return new L([this])};ci.prototype.getSQL=function(){return new L([this])};class Sp{constructor(n){this.table=n}static[F]="ColumnAliasProxyHandler";get(n,i){if(i==="table")return this.table;return n[i]}}class Qx{constructor(n,i){this.alias=n,this.replaceOriginalName=i}static[F]="TableAliasProxyHandler";get(n,i){if(i===D.Symbol.IsAlias)return!0;if(i===D.Symbol.Name)return this.alias;if(this.replaceOriginalName&&i===D.Symbol.OriginalName)return this.alias;if(i===un)return{...n[un],name:this.alias,isAlias:!0};if(i===D.Symbol.Columns){let c=n[D.Symbol.Columns];if(!c)return c;let p={};return Object.keys(c).map((x)=>{p[x]=new Proxy(c[x],new Sp(new Proxy(n,this)))}),p}let o=n[i];if(l(o,Un))return new Proxy(o,new Sp(new Proxy(n,this)));return o}}function sm(n,i){return new Proxy(n,new Qx(i,!1))}function Mo(n,i){return new Proxy(n,new Sp(new Proxy(n.table,new Qx(i,!1))))}function Gv(n,i){return new L.Aliased(Ex(n.sql,i),n.fieldAlias)}function Ex(n,i){return T.join(n.queryChunks.map((o)=>{if(l(o,Un))return Mo(o,i);if(l(o,L))return Ex(o,i);if(l(o,L.Aliased))return Gv(o,i);return o}))}class Pm extends Error{static[F]="DrizzleError";constructor({message:n,cause:i}){super(n);this.name="DrizzleError",this.cause=i}}class Mv extends Pm{static[F]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}function ui(n,i){if(uJ(i)&&!Kv(n)&&!l(n,Li)&&!l(n,go)&&!l(n,Un)&&!l(n,D)&&!l(n,bi))return new Li(n,i);return n}var Yo=(n,i)=>{return T`${n} = ${ui(i,n)}`},DJ=(n,i)=>{return T`${n} <> ${ui(i,n)}`};function Oc(...n){let i=n.filter((o)=>o!==void 0);if(i.length===0)return;if(i.length===1)return new L(i);return new L([new pi("("),T.join(i,new pi(" and ")),new pi(")")])}function LJ(...n){let i=n.filter((o)=>o!==void 0);if(i.length===0)return;if(i.length===1)return new L(i);return new L([new pi("("),T.join(i,new pi(" or ")),new pi(")")])}function NJ(n){return T`not ${n}`}var tm=(n,i)=>{return T`${n} > ${ui(i,n)}`},hJ=(n,i)=>{return T`${n} >= ${ui(i,n)}`},CJ=(n,i)=>{return T`${n} < ${ui(i,n)}`},IJ=(n,i)=>{return T`${n} <= ${ui(i,n)}`};function yJ(n,i){if(Array.isArray(i)){if(i.length===0)return T`false`;return T`${n} in ${i.map((o)=>ui(o,n))}`}return T`${n} in ${ui(i,n)}`}function kJ(n,i){if(Array.isArray(i)){if(i.length===0)return T`true`;return T`${n} not in ${i.map((o)=>ui(o,n))}`}return T`${n} not in ${ui(i,n)}`}function ZJ(n){return T`${n} is null`}function qJ(n){return T`${n} is not null`}function sJ(n){return T`exists ${n}`}function PJ(n){return T`not exists ${n}`}function tJ(n,i,o){return T`${n} between ${ui(i,n)} and ${ui(o,n)}`}function rJ(n,i,o){return T`${n} not between ${ui(i,n)} and ${ui(o,n)}`}function dJ(n,i){return T`${n} like ${i}`}function gJ(n,i){return T`${n} not like ${i}`}function eJ(n,i){return T`${n} ilike ${i}`}function nA(n,i){return T`${n} not ilike ${i}`}function iA(n){return T`${n} asc`}function oA(n){return T`${n} desc`}class cA{static[F]="ConsoleLogWriter";write(n){console.log(n)}}class Yv{static[F]="DefaultLogger";writer;constructor(n){this.writer=n?.writer??new cA}logQuery(n,i){let o=i.map((p)=>{try{return JSON.stringify(p)}catch{return String(p)}}),c=o.length?` -- params: [${o.join(", ")}]`:"";this.writer.write(`Query: ${n}${c}`)}}class Hv{static[F]="NoopLogger";logQuery(){}}class Qi{static[F]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(n){return this.then(void 0,n)}finally(n){return this.then((i)=>{return n?.(),i},(i)=>{throw n?.(),i})}then(n,i){return this.execute().then(n,i)}}function pA(n,i,o){let c={},p=n.reduce((x,{path:m,field:a},f)=>{let v;if(l(a,Un))v=a;else if(l(a,L))v=a.decoder;else v=a.sql.decoder;let $=x;for(let[w,J]of m.entries())if(w<m.length-1){if(!(J in $))$[J]={};$=$[J]}else{let S=i[f],X=$[J]=S===null?null:v.mapFromDriverValue(S);if(o&&l(a,Un)&&m.length===2){let R=m[0];if(!(R in c))c[R]=X===null?mi(a.table):!1;else if(typeof c[R]==="string"&&c[R]!==mi(a.table))c[R]=!1}}return x},{});if(o&&Object.keys(c).length>0){for(let[x,m]of Object.entries(c))if(typeof m==="string"&&!o[m])p[x]=null}return p}function di(n,i){return Object.entries(n).reduce((o,[c,p])=>{if(typeof c!=="string")return o;let x=i?[...i,c]:[c];if(l(p,Un)||l(p,L)||l(p,L.Aliased))o.push({path:x,field:p});else if(l(p,D))o.push(...di(p[D.Symbol.Columns],x));else o.push(...di(p,x));return o},[])}function Ox(n,i){let o=Object.keys(n),c=Object.keys(i);if(o.length!==c.length)return!1;for(let[p,x]of o.entries())if(x!==c[p])return!1;return!0}function rm(n,i){let o=Object.entries(i).filter(([,c])=>c!==void 0).map(([c,p])=>{if(l(p,L)||l(p,Un))return[c,p];else return[c,new Li(p,n[D.Symbol.Columns][c])]});if(o.length===0)throw new Error("No values to set");return Object.fromEntries(o)}function xA(n,i){for(let o of i)for(let c of Object.getOwnPropertyNames(o.prototype)){if(c==="constructor")continue;Object.defineProperty(n.prototype,c,Object.getOwnPropertyDescriptor(o.prototype,c)||Object.create(null))}}function mA(n){return n[D.Symbol.Columns]}function _o(n){return l(n,ci)?n._.alias:l(n,bi)?n[un].name:l(n,L)?void 0:n[D.Symbol.IsAlias]?n[D.Symbol.Name]:n[D.Symbol.BaseName]}function Jn(n,i){return{name:typeof n==="string"&&n.length>0?n:"",config:typeof n==="object"?n:i}}function aA(n){if(typeof n!=="object"||n===null)return!1;if(n.constructor.name!=="Object")return!1;if("logger"in n){let i=typeof n.logger;if(i!=="boolean"&&(i!=="object"||typeof n.logger.logQuery!=="function")&&i!=="undefined")return!1;return!0}if("schema"in n){let i=typeof n.schema;if(i!=="object"&&i!=="undefined")return!1;return!0}if("casing"in n){let i=typeof n.casing;if(i!=="string"&&i!=="undefined")return!1;return!0}if("mode"in n){if(n.mode!=="default"||n.mode!=="planetscale"||n.mode!==void 0)return!1;return!0}if("connection"in n){let i=typeof n.connection;if(i!=="string"&&i!=="object"&&i!=="undefined")return!1;return!0}if("client"in n){let i=typeof n.client;if(i!=="object"&&i!=="function"&&i!=="undefined")return!1;return!0}if(Object.keys(n).length===0)return!0;return!1}class eo extends h{static[F]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(n){if(n){let{name:i,...o}=n;this.config.generatedIdentity={type:"always",sequenceName:i,sequenceOptions:o}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(n){if(n){let{name:i,...o}=n;this.config.generatedIdentity={type:"byDefault",sequenceName:i,sequenceOptions:o}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class fA extends eo{static[F]="PgBigInt53Builder";constructor(n){super(n,"number","PgBigInt53")}build(n){return new vA(n,this.config)}}class vA extends V{static[F]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(n){if(typeof n==="number")return n;return Number(n)}}class $A extends eo{static[F]="PgBigInt64Builder";constructor(n){super(n,"bigint","PgBigInt64")}build(n){return new wA(n,this.config)}}class wA extends V{static[F]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(n){return BigInt(n)}}function JA(n,i){let{name:o,config:c}=Jn(n,i);if(c.mode==="number")return new fA(o);return new $A(o)}class AA extends h{static[F]="PgBigSerial53Builder";constructor(n){super(n,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build(n){return new FA(n,this.config)}}class FA extends V{static[F]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(n){if(typeof n==="number")return n;return Number(n)}}class TA extends h{static[F]="PgBigSerial64Builder";constructor(n){super(n,"bigint","PgBigSerial64");this.config.hasDefault=!0}build(n){return new RA(n,this.config)}}class RA extends V{static[F]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(n){return BigInt(n)}}function SA(n,i){let{name:o,config:c}=Jn(n,i);if(c.mode==="number")return new AA(o);return new TA(o)}class XA extends h{static[F]="PgBooleanBuilder";constructor(n){super(n,"boolean","PgBoolean")}build(n){return new WA(n,this.config)}}class WA extends V{static[F]="PgBoolean";getSQLType(){return"boolean"}}function Ux(n){return new XA(n??"")}class KA extends h{static[F]="PgCharBuilder";constructor(n,i){super(n,"string","PgChar");this.config.length=i.length,this.config.enumValues=i.enum}build(n){return new lA(n,this.config)}}class lA extends V{static[F]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function GA(n,i={}){let{name:o,config:c}=Jn(n,i);return new KA(o,c)}class MA extends h{static[F]="PgCidrBuilder";constructor(n){super(n,"string","PgCidr")}build(n){return new YA(n,this.config)}}class YA extends V{static[F]="PgCidr";getSQLType(){return"cidr"}}function HA(n){return new MA(n??"")}class zA extends h{static[F]="PgCustomColumnBuilder";constructor(n,i,o){super(n,"custom","PgCustomColumn");this.config.fieldConfig=i,this.config.customTypeParams=o}build(n){return new QA(n,this.config)}}class QA extends V{static[F]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(n,i){super(n,i);this.sqlName=i.customTypeParams.dataType(i.fieldConfig),this.mapTo=i.customTypeParams.toDriver,this.mapFrom=i.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(n){return typeof this.mapFrom==="function"?this.mapFrom(n):n}mapToDriverValue(n){return typeof this.mapTo==="function"?this.mapTo(n):n}}function EA(n){return(i,o)=>{let{name:c,config:p}=Jn(i,o);return new zA(c,p,n)}}class bo extends h{static[F]="PgDateColumnBaseBuilder";defaultNow(){return this.default(T`now()`)}}class OA extends bo{static[F]="PgDateBuilder";constructor(n){super(n,"date","PgDate")}build(n){return new dm(n,this.config)}}class dm extends V{static[F]="PgDate";getSQLType(){return"date"}mapFromDriverValue(n){return new Date(n)}mapToDriverValue(n){return n.toISOString()}}class UA extends bo{static[F]="PgDateStringBuilder";constructor(n){super(n,"string","PgDateString")}build(n){return new gm(n,this.config)}}class gm extends V{static[F]="PgDateString";getSQLType(){return"date"}}function VA(n,i){let{name:o,config:c}=Jn(n,i);if(c?.mode==="date")return new OA(o);return new UA(o)}class _A extends h{static[F]="PgDoublePrecisionBuilder";constructor(n){super(n,"number","PgDoublePrecision")}build(n){return new bA(n,this.config)}}class bA extends V{static[F]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(n){if(typeof n==="string")return Number.parseFloat(n);return n}}function uA(n){return new _A(n??"")}class BA extends h{static[F]="PgInetBuilder";constructor(n){super(n,"string","PgInet")}build(n){return new jA(n,this.config)}}class jA extends V{static[F]="PgInet";getSQLType(){return"inet"}}function DA(n){return new BA(n??"")}class LA extends eo{static[F]="PgIntegerBuilder";constructor(n){super(n,"number","PgInteger")}build(n){return new NA(n,this.config)}}class NA extends V{static[F]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(n){if(typeof n==="string")return Number.parseInt(n);return n}}function em(n){return new LA(n??"")}class hA extends h{static[F]="PgIntervalBuilder";constructor(n,i){super(n,"string","PgInterval");this.config.intervalConfig=i}build(n){return new CA(n,this.config)}}class CA extends V{static[F]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let n=this.fields?` ${this.fields}`:"",i=this.precision?`(${this.precision})`:"";return`interval${n}${i}`}}function IA(n,i={}){let{name:o,config:c}=Jn(n,i);return new hA(o,c)}class yA extends h{static[F]="PgJsonBuilder";constructor(n){super(n,"json","PgJson")}build(n){return new na(n,this.config)}}class na extends V{static[F]="PgJson";constructor(n,i){super(n,i)}getSQLType(){return"json"}mapToDriverValue(n){return JSON.stringify(n)}mapFromDriverValue(n){if(typeof n==="string")try{return JSON.parse(n)}catch{return n}return n}}function kA(n){return new yA(n??"")}class ZA extends h{static[F]="PgJsonbBuilder";constructor(n){super(n,"json","PgJsonb")}build(n){return new ia(n,this.config)}}class ia extends V{static[F]="PgJsonb";constructor(n,i){super(n,i)}getSQLType(){return"jsonb"}mapToDriverValue(n){return JSON.stringify(n)}mapFromDriverValue(n){if(typeof n==="string")try{return JSON.parse(n)}catch{return n}return n}}function qA(n){return new ZA(n??"")}class sA extends h{static[F]="PgLineBuilder";constructor(n){super(n,"array","PgLine")}build(n){return new PA(n,this.config)}}class PA extends V{static[F]="PgLine";getSQLType(){return"line"}mapFromDriverValue(n){let[i,o,c]=n.slice(1,-1).split(",");return[Number.parseFloat(i),Number.parseFloat(o),Number.parseFloat(c)]}mapToDriverValue(n){return`{${n[0]},${n[1]},${n[2]}}`}}class tA extends h{static[F]="PgLineABCBuilder";constructor(n){super(n,"json","PgLineABC")}build(n){return new rA(n,this.config)}}class rA extends V{static[F]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(n){let[i,o,c]=n.slice(1,-1).split(",");return{a:Number.parseFloat(i),b:Number.parseFloat(o),c:Number.parseFloat(c)}}mapToDriverValue(n){return`{${n.a},${n.b},${n.c}}`}}function dA(n,i){let{name:o,config:c}=Jn(n,i);if(!c?.mode||c.mode==="tuple")return new sA(o);return new tA(o)}class gA extends h{static[F]="PgMacaddrBuilder";constructor(n){super(n,"string","PgMacaddr")}build(n){return new eA(n,this.config)}}class eA extends V{static[F]="PgMacaddr";getSQLType(){return"macaddr"}}function nF(n){return new gA(n??"")}class iF extends h{static[F]="PgMacaddr8Builder";constructor(n){super(n,"string","PgMacaddr8")}build(n){return new oF(n,this.config)}}class oF extends V{static[F]="PgMacaddr8";getSQLType(){return"macaddr8"}}function cF(n){return new iF(n??"")}class pF extends h{static[F]="PgNumericBuilder";constructor(n,i,o){super(n,"string","PgNumeric");this.config.precision=i,this.config.scale=o}build(n){return new oa(n,this.config)}}class oa extends V{static[F]="PgNumeric";precision;scale;constructor(n,i){super(n,i);this.precision=i.precision,this.scale=i.scale}mapFromDriverValue(n){if(typeof n==="string")return n;return String(n)}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 xF extends h{static[F]="PgNumericNumberBuilder";constructor(n,i,o){super(n,"number","PgNumericNumber");this.config.precision=i,this.config.scale=o}build(n){return new mF(n,this.config)}}class mF extends V{static[F]="PgNumericNumber";precision;scale;constructor(n,i){super(n,i);this.precision=i.precision,this.scale=i.scale}mapFromDriverValue(n){if(typeof n==="number")return n;return Number(n)}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 aF extends h{static[F]="PgNumericBigIntBuilder";constructor(n,i,o){super(n,"bigint","PgNumericBigInt");this.config.precision=i,this.config.scale=o}build(n){return new fF(n,this.config)}}class fF extends V{static[F]="PgNumericBigInt";precision;scale;constructor(n,i){super(n,i);this.precision=i.precision,this.scale=i.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 vF(n,i){let{name:o,config:c}=Jn(n,i),p=c?.mode;return p==="number"?new xF(o,c?.precision,c?.scale):p==="bigint"?new aF(o,c?.precision,c?.scale):new pF(o,c?.precision,c?.scale)}class $F extends h{static[F]="PgPointTupleBuilder";constructor(n){super(n,"array","PgPointTuple")}build(n){return new wF(n,this.config)}}class wF extends V{static[F]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(n){if(typeof n==="string"){let[i,o]=n.slice(1,-1).split(",");return[Number.parseFloat(i),Number.parseFloat(o)]}return[n.x,n.y]}mapToDriverValue(n){return`(${n[0]},${n[1]})`}}class JF extends h{static[F]="PgPointObjectBuilder";constructor(n){super(n,"json","PgPointObject")}build(n){return new AF(n,this.config)}}class AF extends V{static[F]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(n){if(typeof n==="string"){let[i,o]=n.slice(1,-1).split(",");return{x:Number.parseFloat(i),y:Number.parseFloat(o)}}return n}mapToDriverValue(n){return`(${n.x},${n.y})`}}function FF(n,i){let{name:o,config:c}=Jn(n,i);if(!c?.mode||c.mode==="tuple")return new $F(o);return new JF(o)}function BX(n){let i=[];for(let o=0;o<n.length;o+=2)i.push(Number.parseInt(n.slice(o,o+2),16));return new Uint8Array(i)}function TF(n,i){let o=new ArrayBuffer(8),c=new DataView(o);for(let p=0;p<8;p++)c.setUint8(p,n[i+p]);return c.getFloat64(0,!0)}function zv(n){let i=BX(n),o=0,c=i[o];o+=1;let p=new DataView(i.buffer),x=p.getUint32(o,c===1);o+=4;let m;if(x&536870912)m=p.getUint32(o,c===1),o+=4;if((x&65535)===1){let a=TF(i,o);o+=8;let f=TF(i,o);return o+=8,[a,f]}throw new Error("Unsupported geometry type")}class RF extends h{static[F]="PgGeometryBuilder";constructor(n){super(n,"array","PgGeometry")}build(n){return new SF(n,this.config)}}class SF extends V{static[F]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(n){return zv(n)}mapToDriverValue(n){return`point(${n[0]} ${n[1]})`}}class XF extends h{static[F]="PgGeometryObjectBuilder";constructor(n){super(n,"json","PgGeometryObject")}build(n){return new WF(n,this.config)}}class WF extends V{static[F]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(n){let i=zv(n);return{x:i[0],y:i[1]}}mapToDriverValue(n){return`point(${n.x} ${n.y})`}}function KF(n,i){let{name:o,config:c}=Jn(n,i);if(!c?.mode||c.mode==="tuple")return new RF(o);return new XF(o)}class lF extends h{static[F]="PgRealBuilder";constructor(n,i){super(n,"number","PgReal");this.config.length=i}build(n){return new GF(n,this.config)}}class GF extends V{static[F]="PgReal";constructor(n,i){super(n,i)}getSQLType(){return"real"}mapFromDriverValue=(n)=>{if(typeof n==="string")return Number.parseFloat(n);return n}}function MF(n){return new lF(n??"")}class YF extends h{static[F]="PgSerialBuilder";constructor(n){super(n,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(n){return new HF(n,this.config)}}class HF extends V{static[F]="PgSerial";getSQLType(){return"serial"}}function zF(n){return new YF(n??"")}class QF extends eo{static[F]="PgSmallIntBuilder";constructor(n){super(n,"number","PgSmallInt")}build(n){return new EF(n,this.config)}}class EF extends V{static[F]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=(n)=>{if(typeof n==="string")return Number(n);return n}}function OF(n){return new QF(n??"")}class UF extends h{static[F]="PgSmallSerialBuilder";constructor(n){super(n,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(n){return new VF(n,this.config)}}class VF extends V{static[F]="PgSmallSerial";getSQLType(){return"smallserial"}}function _F(n){return new UF(n??"")}class bF extends h{static[F]="PgTextBuilder";constructor(n,i){super(n,"string","PgText");this.config.enumValues=i.enum}build(n){return new uF(n,this.config)}}class uF extends V{static[F]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function BF(n,i={}){let{name:o,config:c}=Jn(n,i);return new bF(o,c)}class jF extends bo{constructor(n,i,o){super(n,"string","PgTime");this.withTimezone=i,this.precision=o,this.config.withTimezone=i,this.config.precision=o}static[F]="PgTimeBuilder";build(n){return new ca(n,this.config)}}class ca extends V{static[F]="PgTime";withTimezone;precision;constructor(n,i){super(n,i);this.withTimezone=i.withTimezone,this.precision=i.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function DF(n,i={}){let{name:o,config:c}=Jn(n,i);return new jF(o,c.withTimezone??!1,c.precision)}class LF extends bo{static[F]="PgTimestampBuilder";constructor(n,i,o){super(n,"date","PgTimestamp");this.config.withTimezone=i,this.config.precision=o}build(n){return new pa(n,this.config)}}class pa extends V{static[F]="PgTimestamp";withTimezone;precision;constructor(n,i){super(n,i);this.withTimezone=i.withTimezone,this.precision=i.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=(n)=>{return new Date(this.withTimezone?n:n+"+0000")};mapToDriverValue=(n)=>{return n.toISOString()}}class NF extends bo{static[F]="PgTimestampStringBuilder";constructor(n,i,o){super(n,"string","PgTimestampString");this.config.withTimezone=i,this.config.precision=o}build(n){return new xa(n,this.config)}}class xa extends V{static[F]="PgTimestampString";withTimezone;precision;constructor(n,i){super(n,i);this.withTimezone=i.withTimezone,this.precision=i.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function vo(n,i={}){let{name:o,config:c}=Jn(n,i);if(c?.mode==="string")return new NF(o,c.withTimezone??!1,c.precision);return new LF(o,c?.withTimezone??!1,c?.precision)}class hF extends h{static[F]="PgUUIDBuilder";constructor(n){super(n,"string","PgUUID")}defaultRandom(){return this.default(T`gen_random_uuid()`)}build(n){return new ma(n,this.config)}}class ma extends V{static[F]="PgUUID";getSQLType(){return"uuid"}}function Ni(n){return new hF(n??"")}class CF extends h{static[F]="PgVarcharBuilder";constructor(n,i){super(n,"string","PgVarchar");this.config.length=i.length,this.config.enumValues=i.enum}build(n){return new IF(n,this.config)}}class IF extends V{static[F]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function Ji(n,i={}){let{name:o,config:c}=Jn(n,i);return new CF(o,c)}class yF extends h{static[F]="PgBinaryVectorBuilder";constructor(n,i){super(n,"string","PgBinaryVector");this.config.dimensions=i.dimensions}build(n){return new kF(n,this.config)}}class kF extends V{static[F]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function ZF(n,i){let{name:o,config:c}=Jn(n,i);return new yF(o,c)}class qF extends h{static[F]="PgHalfVectorBuilder";constructor(n,i){super(n,"array","PgHalfVector");this.config.dimensions=i.dimensions}build(n){return new sF(n,this.config)}}class sF extends V{static[F]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(n){return JSON.stringify(n)}mapFromDriverValue(n){return n.slice(1,-1).split(",").map((i)=>Number.parseFloat(i))}}function PF(n,i){let{name:o,config:c}=Jn(n,i);return new qF(o,c)}class tF extends h{static[F]="PgSparseVectorBuilder";constructor(n,i){super(n,"string","PgSparseVector");this.config.dimensions=i.dimensions}build(n){return new rF(n,this.config)}}class rF extends V{static[F]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function dF(n,i){let{name:o,config:c}=Jn(n,i);return new tF(o,c)}class gF extends h{static[F]="PgVectorBuilder";constructor(n,i){super(n,"array","PgVector");this.config.dimensions=i.dimensions}build(n){return new eF(n,this.config)}}class eF extends V{static[F]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(n){return JSON.stringify(n)}mapFromDriverValue(n){return n.slice(1,-1).split(",").map((i)=>Number.parseFloat(i))}}function nT(n,i){let{name:o,config:c}=Jn(n,i);return new gF(o,c)}function iT(){return{bigint:JA,bigserial:SA,boolean:Ux,char:GA,cidr:HA,customType:EA,date:VA,doublePrecision:uA,inet:DA,integer:em,interval:IA,json:kA,jsonb:qA,line:dA,macaddr:nF,macaddr8:cF,numeric:vF,point:FF,geometry:KF,real:MF,serial:zF,smallint:OF,smallserial:_F,text:BF,time:DF,timestamp:vo,uuid:Ni,varchar:Ji,bit:ZF,halfvec:PF,sparsevec:dF,vector:nT}}var Qv=Symbol.for("drizzle:PgInlineForeignKeys"),oT=Symbol.for("drizzle:EnableRLS");class Ai extends D{static[F]="PgTable";static Symbol=Object.assign({},D.Symbol,{InlineForeignKeys:Qv,EnableRLS:oT});[Qv]=[];[oT]=!1;[D.Symbol.ExtraConfigBuilder]=void 0;[D.Symbol.ExtraConfigColumns]={}}function jX(n,i,o,c,p=n){let x=new Ai(n,c,p),m=typeof i==="function"?i(iT()):i,a=Object.fromEntries(Object.entries(m).map(([$,w])=>{let J=w;J.setName($);let S=J.build(x);return x[Qv].push(...J.buildForeignKeys(S,x)),[$,S]})),f=Object.fromEntries(Object.entries(m).map(([$,w])=>{let J=w;J.setName($);let S=J.buildExtraConfigColumn(x);return[$,S]})),v=Object.assign(x,a);if(v[D.Symbol.Columns]=a,v[D.Symbol.ExtraConfigColumns]=f,o)v[Ai.Symbol.ExtraConfigBuilder]=o;return Object.assign(v,{enableRLS:()=>{return v[Ai.Symbol.EnableRLS]=!0,v}})}var nc=(n,i,o)=>{return jX(n,i,o,void 0)};function cT(...n){if(n[0].columns)return new Vx(n[0].columns,n[0].name);return new Vx(n)}class Vx{static[F]="PgPrimaryKeyBuilder";columns;name;constructor(n,i){this.columns=n,this.name=i}build(n){return new pT(n,this.columns,this.name)}}class pT{constructor(n,i,o){this.table=n,this.columns=i,this.name=o}static[F]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[Ai.Symbol.Name]}_${this.columns.map((n)=>n.name).join("_")}_pk`}}class Ev{constructor(n,i,o){this.sourceTable=n,this.referencedTable=i,this.relationName=o,this.referencedTableName=i[D.Symbol.Name]}static[F]="Relation";referencedTableName;fieldName}class xT{constructor(n,i){this.table=n,this.config=i}static[F]="Relations"}class ic extends Ev{constructor(n,i,o,c){super(n,i,o?.relationName);this.config=o,this.isNullable=c}static[F]="One";withFieldName(n){let i=new ic(this.sourceTable,this.referencedTable,this.config,this.isNullable);return i.fieldName=n,i}}class _x extends Ev{constructor(n,i,o){super(n,i,o?.relationName);this.config=o}static[F]="Many";withFieldName(n){let i=new _x(this.sourceTable,this.referencedTable,this.config);return i.fieldName=n,i}}function mT(){return{and:Oc,between:tJ,eq:Yo,exists:sJ,gt:tm,gte:hJ,ilike:eJ,inArray:yJ,isNull:ZJ,isNotNull:qJ,like:dJ,lt:CJ,lte:IJ,ne:DJ,not:NJ,notBetween:rJ,notExists:PJ,notLike:gJ,notIlike:nA,notInArray:kJ,or:LJ,sql:T}}function aT(){return{sql:T,asc:iA,desc:oA}}function fT(n,i){if(Object.keys(n).length===1&&"default"in n&&!l(n.default,D))n=n.default;let o={},c={},p={};for(let[x,m]of Object.entries(n))if(l(m,D)){let a=Ec(m),f=c[a];o[a]=x,p[x]={tsName:x,dbName:m[D.Symbol.Name],schema:m[D.Symbol.Schema],columns:m[D.Symbol.Columns],relations:f?.relations??{},primaryKey:f?.primaryKey??[]};for(let $ of Object.values(m[D.Symbol.Columns]))if($.primary)p[x].primaryKey.push($);let v=m[D.Symbol.ExtraConfigBuilder]?.(m[D.Symbol.ExtraConfigColumns]);if(v){for(let $ of Object.values(v))if(l($,Vx))p[x].primaryKey.push(...$.columns)}}else if(l(m,xT)){let a=Ec(m.table),f=o[a],v=m.config(i(m.table)),$;for(let[w,J]of Object.entries(v))if(f){let S=p[f];if(S.relations[w]=J,$)S.primaryKey.push(...$)}else{if(!(a in c))c[a]={relations:{},primaryKey:$};c[a].relations[w]=J}}return{tables:p,tableNamesMap:o}}function DX(n){return function i(o,c){return new ic(n,o,c,c?.fields.reduce((p,x)=>p&&x.notNull,!0)??!1)}}function LX(n){return function i(o,c){return new _x(n,o,c)}}function vT(n,i,o){if(l(o,ic)&&o.config)return{fields:o.config.fields,references:o.config.references};let c=i[Ec(o.referencedTable)];if(!c)throw new Error(`Table "${o.referencedTable[D.Symbol.Name]}" not found in schema`);let p=n[c];if(!p)throw new Error(`Table "${c}" not found in schema`);let x=o.sourceTable,m=i[Ec(x)];if(!m)throw new Error(`Table "${x[D.Symbol.Name]}" not found in schema`);let a=[];for(let f of Object.values(p.relations))if(o.relationName&&o!==f&&f.relationName===o.relationName||!o.relationName&&f.referencedTable===o.sourceTable)a.push(f);if(a.length>1)throw o.relationName?new Error(`There are multiple relations with name "${o.relationName}" in table "${c}"`):new Error(`There are multiple relations between "${c}" and "${o.sourceTable[D.Symbol.Name]}". Please specify relation name`);if(a[0]&&l(a[0],ic)&&a[0].config)return{fields:a[0].config.references,references:a[0].config.fields};throw new Error(`There is not enough information to infer relation "${m}.${o.fieldName}"`)}function $T(n){return{one:DX(n),many:LX(n)}}function aa(n,i,o,c,p=(x)=>x){let x={};for(let[m,a]of c.entries())if(a.isJson){let f=i.relations[a.tsKey],v=o[m],$=typeof v==="string"?JSON.parse(v):v;x[a.tsKey]=l(f,ic)?$&&aa(n,n[a.relationTableTsKey],$,a.selection,p):$.map((w)=>aa(n,n[a.relationTableTsKey],w,a.selection,p))}else{let f=p(o[m]),v=a.field,$;if(l(v,Un))$=v;else if(l(v,L))$=v.decoder;else $=v.sql.decoder;x[a.tsKey]=f===null?null:$.mapFromDriverValue(f)}return x}var g6=wf(d6(),1),{Server:e6,Namespace:tL,Socket:rL}=g6.default;import{readFileSync as FR}from"node:fs";import{resolve as E$}from"node:path";function u9(n,i){let o={},c=[];for(let p in n){let x=n[p],m=i[p],a=x["~standard"].validate(m);if(a instanceof Promise)throw new Error(`Validation must be synchronous, but ${p} returned a Promise.`);if(a.issues){c.push(...a.issues.map((f)=>({...f,path:[p,...f.path??[]]})));continue}o[p]=a.value}if(c.length)return{issues:c};return{value:o}}function nR(n){let i=n.runtimeEnvStrict??n.runtimeEnv??process.env;if(n.emptyStringAsUndefined??!1){for(let[Y,I]of Object.entries(i))if(I==="")delete i[Y]}if(!!n.skipValidation)return i;let p=typeof n.client==="object"?n.client:{},x=typeof n.server==="object"?n.server:{},m=typeof n.shared==="object"?n.shared:{},a=n.isServer??(typeof window==="undefined"||("Deno"in window)),f=a?{...x,...m,...p}:{...p,...m},v=u9(f,i),$=n.onValidationError??((Y)=>{throw console.error("\u274C Invalid environment variables:",Y),new Error("Invalid environment variables")}),w=n.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(v.issues)return $(v.issues);let J=(Y)=>{if(!n.clientPrefix)return!0;return!Y.startsWith(n.clientPrefix)&&!(Y in m)},S=(Y)=>{return a||!J(Y)},X=(Y)=>{return Y==="__esModule"||Y==="$$typeof"},R=(n.extends??[]).reduce((Y,I)=>{return Object.assign(Y,I)},{}),K=Object.assign(v.value,R);return new Proxy(K,{get(Y,I){if(typeof I!=="string")return;if(X(I))return;if(!S(I))return w(I);return Reflect.get(Y,I)}})}var Fn;(function(n){n.assertEqual=(p)=>p;function i(p){}n.assertIs=i;function o(p){throw new Error}n.assertNever=o,n.arrayToEnum=(p)=>{let x={};for(let m of p)x[m]=m;return x},n.getValidEnumValues=(p)=>{let x=n.objectKeys(p).filter((a)=>typeof p[p[a]]!=="number"),m={};for(let a of x)m[a]=p[a];return n.objectValues(m)},n.objectValues=(p)=>{return n.objectKeys(p).map(function(x){return p[x]})},n.objectKeys=typeof Object.keys==="function"?(p)=>Object.keys(p):(p)=>{let x=[];for(let m in p)if(Object.prototype.hasOwnProperty.call(p,m))x.push(m);return x},n.find=(p,x)=>{for(let m of p)if(x(m))return m;return},n.isInteger=typeof Number.isInteger==="function"?(p)=>Number.isInteger(p):(p)=>typeof p==="number"&&isFinite(p)&&Math.floor(p)===p;function c(p,x=" | "){return p.map((m)=>typeof m==="string"?`'${m}'`:m).join(x)}n.joinValues=c,n.jsonStringifyReplacer=(p,x)=>{if(typeof x==="bigint")return x.toString();return x}})(Fn||(Fn={}));var Y$;(function(n){n.mergeShapes=(i,o)=>{return{...i,...o}}})(Y$||(Y$={}));var N=Fn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lo=(n)=>{switch(typeof n){case"undefined":return N.undefined;case"string":return N.string;case"number":return isNaN(n)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":if(Array.isArray(n))return N.array;if(n===null)return N.null;if(n.then&&typeof n.then==="function"&&n.catch&&typeof n.catch==="function")return N.promise;if(typeof Map!=="undefined"&&n instanceof Map)return N.map;if(typeof Set!=="undefined"&&n instanceof Set)return N.set;if(typeof Date!=="undefined"&&n instanceof Date)return N.date;return N.object;default:return N.unknown}},U=Fn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),B9=(n)=>{return JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:")};class yi extends Error{get errors(){return this.issues}constructor(n){super();this.issues=[],this.addIssue=(o)=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};let i=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,i);else this.__proto__=i;this.name="ZodError",this.issues=n}format(n){let i=n||function(p){return p.message},o={_errors:[]},c=(p)=>{for(let x of p.issues)if(x.code==="invalid_union")x.unionErrors.map(c);else if(x.code==="invalid_return_type")c(x.returnTypeError);else if(x.code==="invalid_arguments")c(x.argumentsError);else if(x.path.length===0)o._errors.push(i(x));else{let m=o,a=0;while(a<x.path.length){let f=x.path[a];if(a!==x.path.length-1)m[f]=m[f]||{_errors:[]};else m[f]=m[f]||{_errors:[]},m[f]._errors.push(i(x));m=m[f],a++}}};return c(this),o}static assert(n){if(!(n instanceof yi))throw new Error(`Not a ZodError: ${n}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(n=(i)=>i.message){let i={},o=[];for(let c of this.issues)if(c.path.length>0)i[c.path[0]]=i[c.path[0]]||[],i[c.path[0]].push(n(c));else o.push(n(c));return{formErrors:o,fieldErrors:i}}get formErrors(){return this.flatten()}}yi.create=(n)=>{return new yi(n)};var Bp=(n,i)=>{let o;switch(n.code){case U.invalid_type:if(n.received===N.undefined)o="Required";else o=`Expected ${n.expected}, received ${n.received}`;break;case U.invalid_literal:o=`Invalid literal value, expected ${JSON.stringify(n.expected,Fn.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:o=`Unrecognized key(s) in object: ${Fn.joinValues(n.keys,", ")}`;break;case U.invalid_union:o="Invalid input";break;case U.invalid_union_discriminator:o=`Invalid discriminator value. Expected ${Fn.joinValues(n.options)}`;break;case U.invalid_enum_value:o=`Invalid enum value. Expected ${Fn.joinValues(n.options)}, received '${n.received}'`;break;case U.invalid_arguments:o="Invalid function arguments";break;case U.invalid_return_type:o="Invalid function return type";break;case U.invalid_date:o="Invalid date";break;case U.invalid_string:if(typeof n.validation==="object")if("includes"in n.validation){if(o=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position==="number")o=`${o} at one or more positions greater than or equal to ${n.validation.position}`}else if("startsWith"in n.validation)o=`Invalid input: must start with "${n.validation.startsWith}"`;else if("endsWith"in n.validation)o=`Invalid input: must end with "${n.validation.endsWith}"`;else Fn.assertNever(n.validation);else if(n.validation!=="regex")o=`Invalid ${n.validation}`;else o="Invalid";break;case U.too_small:if(n.type==="array")o=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`;else if(n.type==="string")o=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`;else if(n.type==="number")o=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`;else if(n.type==="date")o=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`;else o="Invalid input";break;case U.too_big:if(n.type==="array")o=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`;else if(n.type==="string")o=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`;else if(n.type==="number")o=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`;else if(n.type==="bigint")o=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`;else if(n.type==="date")o=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`;else o="Invalid input";break;case U.custom:o="Invalid input";break;case U.invalid_intersection_types:o="Intersection results could not be merged";break;case U.not_multiple_of:o=`Number must be a multiple of ${n.multipleOf}`;break;case U.not_finite:o="Number must be finite";break;default:o=i.defaultError,Fn.assertNever(n)}return{message:o}},pR=Bp;function j9(n){pR=n}function ua(){return pR}var Ba=(n)=>{let{data:i,path:o,errorMaps:c,issueData:p}=n,x=[...o,...p.path||[]],m={...p,path:x};if(p.message!==void 0)return{...p,path:x,message:p.message};let a="",f=c.filter((v)=>!!v).slice().reverse();for(let v of f)a=v(m,{data:i,defaultError:a}).message;return{...p,path:x,message:a}},D9=[];function B(n,i){let o=ua(),c=Ba({issueData:i,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,o,o===Bp?void 0:Bp].filter((p)=>!!p)});n.common.issues.push(c)}class Yi{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(n,i){let o=[];for(let c of i){if(c.status==="aborted")return d;if(c.status==="dirty")n.dirty();o.push(c.value)}return{status:n.value,value:o}}static async mergeObjectAsync(n,i){let o=[];for(let c of i){let p=await c.key,x=await c.value;o.push({key:p,value:x})}return Yi.mergeObjectSync(n,o)}static mergeObjectSync(n,i){let o={};for(let c of i){let{key:p,value:x}=c;if(p.status==="aborted")return d;if(x.status==="aborted")return d;if(p.status==="dirty")n.dirty();if(x.status==="dirty")n.dirty();if(p.value!=="__proto__"&&(typeof x.value!=="undefined"||c.alwaysSet))o[p.value]=x.value}return{status:n.value,value:o}}}var d=Object.freeze({status:"aborted"}),bp=(n)=>({status:"dirty",value:n}),Oi=(n)=>({status:"valid",value:n}),H$=(n)=>n.status==="aborted",z$=(n)=>n.status==="dirty",Lc=(n)=>n.status==="valid",Ix=(n)=>typeof Promise!=="undefined"&&n instanceof Promise;function ja(n,i,o,c){if(o==="a"&&!c)throw new TypeError("Private accessor was defined without a getter");if(typeof i==="function"?n!==i||!c:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return o==="m"?c:o==="a"?c.call(n):c?c.value:i.get(n)}function xR(n,i,o,c,p){if(c==="m")throw new TypeError("Private method is not writable");if(c==="a"&&!p)throw new TypeError("Private accessor was defined without a setter");if(typeof i==="function"?n!==i||!p:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return c==="a"?p.call(n,o):p?p.value=o:i.set(n,o),o}var k;(function(n){n.errToObj=(i)=>typeof i==="string"?{message:i}:i||{},n.toString=(i)=>typeof i==="string"?i:i===null||i===void 0?void 0:i.message})(k||(k={}));var hx,Cx;class Ro{constructor(n,i,o,c){this._cachedPath=[],this.parent=n,this.data=i,this._path=o,this._key=c}get path(){if(!this._cachedPath.length)if(this._key instanceof Array)this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var iR=(n,i)=>{if(Lc(i))return{success:!0,data:i.value};else{if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let o=new yi(n.common.issues);return this._error=o,this._error}}}};function cn(n){if(!n)return{};let{errorMap:i,invalid_type_error:o,required_error:c,description:p}=n;if(i&&(o||c))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(i)return{errorMap:i,description:p};return{errorMap:(m,a)=>{var f,v;let{message:$}=n;if(m.code==="invalid_enum_value")return{message:$!==null&&$!==void 0?$:a.defaultError};if(typeof a.data==="undefined")return{message:(f=$!==null&&$!==void 0?$:c)!==null&&f!==void 0?f:a.defaultError};if(m.code!=="invalid_type")return{message:a.defaultError};return{message:(v=$!==null&&$!==void 0?$:o)!==null&&v!==void 0?v:a.defaultError}},description:p}}class pn{get description(){return this._def.description}_getType(n){return Lo(n.data)}_getOrReturnCtx(n,i){return i||{common:n.parent.common,data:n.data,parsedType:Lo(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new Yi,ctx:{common:n.parent.common,data:n.data,parsedType:Lo(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){let i=this._parse(n);if(Ix(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(n){let i=this._parse(n);return Promise.resolve(i)}parse(n,i){let o=this.safeParse(n,i);if(o.success)return o.data;throw o.error}safeParse(n,i){var o;let c={common:{issues:[],async:(o=i===null||i===void 0?void 0:i.async)!==null&&o!==void 0?o:!1,contextualErrorMap:i===null||i===void 0?void 0:i.errorMap},path:(i===null||i===void 0?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:Lo(n)},p=this._parseSync({data:n,path:c.path,parent:c});return iR(c,p)}"~validate"(n){var i,o;let c={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:Lo(n)};if(!this["~standard"].async)try{let p=this._parseSync({data:n,path:[],parent:c});return Lc(p)?{value:p.value}:{issues:c.common.issues}}catch(p){if((o=(i=p===null||p===void 0?void 0:p.message)===null||i===void 0?void 0:i.toLowerCase())===null||o===void 0?void 0:o.includes("encountered"))this["~standard"].async=!0;c.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:c}).then((p)=>Lc(p)?{value:p.value}:{issues:c.common.issues})}async parseAsync(n,i){let o=await this.safeParseAsync(n,i);if(o.success)return o.data;throw o.error}async safeParseAsync(n,i){let o={common:{issues:[],contextualErrorMap:i===null||i===void 0?void 0:i.errorMap,async:!0},path:(i===null||i===void 0?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:Lo(n)},c=this._parse({data:n,path:o.path,parent:o}),p=await(Ix(c)?c:Promise.resolve(c));return iR(o,p)}refine(n,i){let o=(c)=>{if(typeof i==="string"||typeof i==="undefined")return{message:i};else if(typeof i==="function")return i(c);else return i};return this._refinement((c,p)=>{let x=n(c),m=()=>p.addIssue({code:U.custom,...o(c)});if(typeof Promise!=="undefined"&&x instanceof Promise)return x.then((a)=>{if(!a)return m(),!1;else return!0});if(!x)return m(),!1;else return!0})}refinement(n,i){return this._refinement((o,c)=>{if(!n(o))return c.addIssue(typeof i==="function"?i(o,c):i),!1;else return!0})}_refinement(n){return new io({schema:this,typeName:r.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(i)=>this["~validate"](i)}}optional(){return To.create(this,this._def)}nullable(){return No.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fo.create(this)}promise(){return Ic.create(this,this._def)}or(n){return Np.create([this,n],this._def)}and(n){return hp.create(this,n,this._def)}transform(n){return new io({...cn(this._def),schema:this,typeName:r.ZodEffects,effect:{type:"transform",transform:n}})}default(n){let i=typeof n==="function"?n:()=>n;return new kp({...cn(this._def),innerType:this,defaultValue:i,typeName:r.ZodDefault})}brand(){return new La({typeName:r.ZodBranded,type:this,...cn(this._def)})}catch(n){let i=typeof n==="function"?n:()=>n;return new Zp({...cn(this._def),innerType:this,catchValue:i,typeName:r.ZodCatch})}describe(n){return new this.constructor({...this._def,description:n})}pipe(n){return Px.create(this,n)}readonly(){return qp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var L9=/^c[^\s-]{8,}$/i,N9=/^[0-9a-z]+$/,h9=/^[0-9A-HJKMNP-TV-Z]{26}$/i,C9=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,I9=/^[a-z0-9_-]{21}$/i,y9=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,k9=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Z9=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,q9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",M$,s9=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,P9=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,t9=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,r9=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,d9=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,g9=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mR="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",e9=new RegExp(`^${mR}$`);function aR(n){let i="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if(n.precision)i=`${i}\\.\\d{${n.precision}}`;else if(n.precision==null)i=`${i}(\\.\\d+)?`;return i}function nG(n){return new RegExp(`^${aR(n)}$`)}function fR(n){let i=`${mR}T${aR(n)}`,o=[];if(o.push(n.local?"Z?":"Z"),n.offset)o.push("([+-]\\d{2}:?\\d{2})");return i=`${i}(${o.join("|")})`,new RegExp(`^${i}$`)}function iG(n,i){if((i==="v4"||!i)&&s9.test(n))return!0;if((i==="v6"||!i)&&t9.test(n))return!0;return!1}function oG(n,i){if(!y9.test(n))return!1;try{let[o]=n.split("."),c=o.replace(/-/g,"+").replace(/_/g,"/").padEnd(o.length+(4-o.length%4)%4,"="),p=JSON.parse(atob(c));if(typeof p!=="object"||p===null)return!1;if(!p.typ||!p.alg)return!1;if(i&&p.alg!==i)return!1;return!0}catch(o){return!1}}function cG(n,i){if((i==="v4"||!i)&&P9.test(n))return!0;if((i==="v6"||!i)&&r9.test(n))return!0;return!1}class Ao extends pn{_parse(n){if(this._def.coerce)n.data=String(n.data);if(this._getType(n)!==N.string){let p=this._getOrReturnCtx(n);return B(p,{code:U.invalid_type,expected:N.string,received:p.parsedType}),d}let o=new Yi,c=void 0;for(let p of this._def.checks)if(p.kind==="min"){if(n.data.length<p.value)c=this._getOrReturnCtx(n,c),B(c,{code:U.too_small,minimum:p.value,type:"string",inclusive:!0,exact:!1,message:p.message}),o.dirty()}else if(p.kind==="max"){if(n.data.length>p.value)c=this._getOrReturnCtx(n,c),B(c,{code:U.too_big,maximum:p.value,type:"string",inclusive:!0,exact:!1,message:p.message}),o.dirty()}else if(p.kind==="length"){let x=n.data.length>p.value,m=n.data.length<p.value;if(x||m){if(c=this._getOrReturnCtx(n,c),x)B(c,{code:U.too_big,maximum:p.value,type:"string",inclusive:!0,exact:!0,message:p.message});else if(m)B(c,{code:U.too_small,minimum:p.value,type:"string",inclusive:!0,exact:!0,message:p.message});o.dirty()}}else if(p.kind==="email"){if(!Z9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"email",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="emoji"){if(!M$)M$=new RegExp(q9,"u");if(!M$.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"emoji",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="uuid"){if(!C9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"uuid",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="nanoid"){if(!I9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"nanoid",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="cuid"){if(!L9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"cuid",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="cuid2"){if(!N9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"cuid2",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="ulid"){if(!h9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"ulid",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="url")try{new URL(n.data)}catch(x){c=this._getOrReturnCtx(n,c),B(c,{validation:"url",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="regex"){if(p.regex.lastIndex=0,!p.regex.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"regex",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="trim")n.data=n.data.trim();else if(p.kind==="includes"){if(!n.data.includes(p.value,p.position))c=this._getOrReturnCtx(n,c),B(c,{code:U.invalid_string,validation:{includes:p.value,position:p.position},message:p.message}),o.dirty()}else if(p.kind==="toLowerCase")n.data=n.data.toLowerCase();else if(p.kind==="toUpperCase")n.data=n.data.toUpperCase();else if(p.kind==="startsWith"){if(!n.data.startsWith(p.value))c=this._getOrReturnCtx(n,c),B(c,{code:U.invalid_string,validation:{startsWith:p.value},message:p.message}),o.dirty()}else if(p.kind==="endsWith"){if(!n.data.endsWith(p.value))c=this._getOrReturnCtx(n,c),B(c,{code:U.invalid_string,validation:{endsWith:p.value},message:p.message}),o.dirty()}else if(p.kind==="datetime"){if(!fR(p).test(n.data))c=this._getOrReturnCtx(n,c),B(c,{code:U.invalid_string,validation:"datetime",message:p.message}),o.dirty()}else if(p.kind==="date"){if(!e9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{code:U.invalid_string,validation:"date",message:p.message}),o.dirty()}else if(p.kind==="time"){if(!nG(p).test(n.data))c=this._getOrReturnCtx(n,c),B(c,{code:U.invalid_string,validation:"time",message:p.message}),o.dirty()}else if(p.kind==="duration"){if(!k9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"duration",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="ip"){if(!iG(n.data,p.version))c=this._getOrReturnCtx(n,c),B(c,{validation:"ip",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="jwt"){if(!oG(n.data,p.alg))c=this._getOrReturnCtx(n,c),B(c,{validation:"jwt",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="cidr"){if(!cG(n.data,p.version))c=this._getOrReturnCtx(n,c),B(c,{validation:"cidr",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="base64"){if(!d9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"base64",code:U.invalid_string,message:p.message}),o.dirty()}else if(p.kind==="base64url"){if(!g9.test(n.data))c=this._getOrReturnCtx(n,c),B(c,{validation:"base64url",code:U.invalid_string,message:p.message}),o.dirty()}else Fn.assertNever(p);return{status:o.value,value:n.data}}_regex(n,i,o){return this.refinement((c)=>n.test(c),{validation:i,code:U.invalid_string,...k.errToObj(o)})}_addCheck(n){return new Ao({...this._def,checks:[...this._def.checks,n]})}email(n){return this._addCheck({kind:"email",...k.errToObj(n)})}url(n){return this._addCheck({kind:"url",...k.errToObj(n)})}emoji(n){return this._addCheck({kind:"emoji",...k.errToObj(n)})}uuid(n){return this._addCheck({kind:"uuid",...k.errToObj(n)})}nanoid(n){return this._addCheck({kind:"nanoid",...k.errToObj(n)})}cuid(n){return this._addCheck({kind:"cuid",...k.errToObj(n)})}cuid2(n){return this._addCheck({kind:"cuid2",...k.errToObj(n)})}ulid(n){return this._addCheck({kind:"ulid",...k.errToObj(n)})}base64(n){return this._addCheck({kind:"base64",...k.errToObj(n)})}base64url(n){return this._addCheck({kind:"base64url",...k.errToObj(n)})}jwt(n){return this._addCheck({kind:"jwt",...k.errToObj(n)})}ip(n){return this._addCheck({kind:"ip",...k.errToObj(n)})}cidr(n){return this._addCheck({kind:"cidr",...k.errToObj(n)})}datetime(n){var i,o;if(typeof n==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:n});return this._addCheck({kind:"datetime",precision:typeof(n===null||n===void 0?void 0:n.precision)==="undefined"?null:n===null||n===void 0?void 0:n.precision,offset:(i=n===null||n===void 0?void 0:n.offset)!==null&&i!==void 0?i:!1,local:(o=n===null||n===void 0?void 0:n.local)!==null&&o!==void 0?o:!1,...k.errToObj(n===null||n===void 0?void 0:n.message)})}date(n){return this._addCheck({kind:"date",message:n})}time(n){if(typeof n==="string")return this._addCheck({kind:"time",precision:null,message:n});return this._addCheck({kind:"time",precision:typeof(n===null||n===void 0?void 0:n.precision)==="undefined"?null:n===null||n===void 0?void 0:n.precision,...k.errToObj(n===null||n===void 0?void 0:n.message)})}duration(n){return this._addCheck({kind:"duration",...k.errToObj(n)})}regex(n,i){return this._addCheck({kind:"regex",regex:n,...k.errToObj(i)})}includes(n,i){return this._addCheck({kind:"includes",value:n,position:i===null||i===void 0?void 0:i.position,...k.errToObj(i===null||i===void 0?void 0:i.message)})}startsWith(n,i){return this._addCheck({kind:"startsWith",value:n,...k.errToObj(i)})}endsWith(n,i){return this._addCheck({kind:"endsWith",value:n,...k.errToObj(i)})}min(n,i){return this._addCheck({kind:"min",value:n,...k.errToObj(i)})}max(n,i){return this._addCheck({kind:"max",value:n,...k.errToObj(i)})}length(n,i){return this._addCheck({kind:"length",value:n,...k.errToObj(i)})}nonempty(n){return this.min(1,k.errToObj(n))}trim(){return new Ao({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ao({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ao({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((n)=>n.kind==="datetime")}get isDate(){return!!this._def.checks.find((n)=>n.kind==="date")}get isTime(){return!!this._def.checks.find((n)=>n.kind==="time")}get isDuration(){return!!this._def.checks.find((n)=>n.kind==="duration")}get isEmail(){return!!this._def.checks.find((n)=>n.kind==="email")}get isURL(){return!!this._def.checks.find((n)=>n.kind==="url")}get isEmoji(){return!!this._def.checks.find((n)=>n.kind==="emoji")}get isUUID(){return!!this._def.checks.find((n)=>n.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((n)=>n.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((n)=>n.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((n)=>n.kind==="cuid2")}get isULID(){return!!this._def.checks.find((n)=>n.kind==="ulid")}get isIP(){return!!this._def.checks.find((n)=>n.kind==="ip")}get isCIDR(){return!!this._def.checks.find((n)=>n.kind==="cidr")}get isBase64(){return!!this._def.checks.find((n)=>n.kind==="base64")}get isBase64url(){return!!this._def.checks.find((n)=>n.kind==="base64url")}get minLength(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxLength(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}}Ao.create=(n)=>{var i;return new Ao({checks:[],typeName:r.ZodString,coerce:(i=n===null||n===void 0?void 0:n.coerce)!==null&&i!==void 0?i:!1,...cn(n)})};function pG(n,i){let o=(n.toString().split(".")[1]||"").length,c=(i.toString().split(".")[1]||"").length,p=o>c?o:c,x=parseInt(n.toFixed(p).replace(".","")),m=parseInt(i.toFixed(p).replace(".",""));return x%m/Math.pow(10,p)}class ac extends pn{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(n){if(this._def.coerce)n.data=Number(n.data);if(this._getType(n)!==N.number){let p=this._getOrReturnCtx(n);return B(p,{code:U.invalid_type,expected:N.number,received:p.parsedType}),d}let o=void 0,c=new Yi;for(let p of this._def.checks)if(p.kind==="int"){if(!Fn.isInteger(n.data))o=this._getOrReturnCtx(n,o),B(o,{code:U.invalid_type,expected:"integer",received:"float",message:p.message}),c.dirty()}else if(p.kind==="min"){if(p.inclusive?n.data<p.value:n.data<=p.value)o=this._getOrReturnCtx(n,o),B(o,{code:U.too_small,minimum:p.value,type:"number",inclusive:p.inclusive,exact:!1,message:p.message}),c.dirty()}else if(p.kind==="max"){if(p.inclusive?n.data>p.value:n.data>=p.value)o=this._getOrReturnCtx(n,o),B(o,{code:U.too_big,maximum:p.value,type:"number",inclusive:p.inclusive,exact:!1,message:p.message}),c.dirty()}else if(p.kind==="multipleOf"){if(pG(n.data,p.value)!==0)o=this._getOrReturnCtx(n,o),B(o,{code:U.not_multiple_of,multipleOf:p.value,message:p.message}),c.dirty()}else if(p.kind==="finite"){if(!Number.isFinite(n.data))o=this._getOrReturnCtx(n,o),B(o,{code:U.not_finite,message:p.message}),c.dirty()}else Fn.assertNever(p);return{status:c.value,value:n.data}}gte(n,i){return this.setLimit("min",n,!0,k.toString(i))}gt(n,i){return this.setLimit("min",n,!1,k.toString(i))}lte(n,i){return this.setLimit("max",n,!0,k.toString(i))}lt(n,i){return this.setLimit("max",n,!1,k.toString(i))}setLimit(n,i,o,c){return new ac({...this._def,checks:[...this._def.checks,{kind:n,value:i,inclusive:o,message:k.toString(c)}]})}_addCheck(n){return new ac({...this._def,checks:[...this._def.checks,n]})}int(n){return this._addCheck({kind:"int",message:k.toString(n)})}positive(n){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k.toString(n)})}negative(n){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k.toString(n)})}multipleOf(n,i){return this._addCheck({kind:"multipleOf",value:n,message:k.toString(i)})}finite(n){return this._addCheck({kind:"finite",message:k.toString(n)})}safe(n){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k.toString(n)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k.toString(n)})}get minValue(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxValue(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}get isInt(){return!!this._def.checks.find((n)=>n.kind==="int"||n.kind==="multipleOf"&&Fn.isInteger(n.value))}get isFinite(){let n=null,i=null;for(let o of this._def.checks)if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;else if(o.kind==="min"){if(i===null||o.value>i)i=o.value}else if(o.kind==="max"){if(n===null||o.value<n)n=o.value}return Number.isFinite(i)&&Number.isFinite(n)}}ac.create=(n)=>{return new ac({checks:[],typeName:r.ZodNumber,coerce:(n===null||n===void 0?void 0:n.coerce)||!1,...cn(n)})};class fc extends pn{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(n){if(this._def.coerce)try{n.data=BigInt(n.data)}catch(p){return this._getInvalidInput(n)}if(this._getType(n)!==N.bigint)return this._getInvalidInput(n);let o=void 0,c=new Yi;for(let p of this._def.checks)if(p.kind==="min"){if(p.inclusive?n.data<p.value:n.data<=p.value)o=this._getOrReturnCtx(n,o),B(o,{code:U.too_small,type:"bigint",minimum:p.value,inclusive:p.inclusive,message:p.message}),c.dirty()}else if(p.kind==="max"){if(p.inclusive?n.data>p.value:n.data>=p.value)o=this._getOrReturnCtx(n,o),B(o,{code:U.too_big,type:"bigint",maximum:p.value,inclusive:p.inclusive,message:p.message}),c.dirty()}else if(p.kind==="multipleOf"){if(n.data%p.value!==BigInt(0))o=this._getOrReturnCtx(n,o),B(o,{code:U.not_multiple_of,multipleOf:p.value,message:p.message}),c.dirty()}else Fn.assertNever(p);return{status:c.value,value:n.data}}_getInvalidInput(n){let i=this._getOrReturnCtx(n);return B(i,{code:U.invalid_type,expected:N.bigint,received:i.parsedType}),d}gte(n,i){return this.setLimit("min",n,!0,k.toString(i))}gt(n,i){return this.setLimit("min",n,!1,k.toString(i))}lte(n,i){return this.setLimit("max",n,!0,k.toString(i))}lt(n,i){return this.setLimit("max",n,!1,k.toString(i))}setLimit(n,i,o,c){return new fc({...this._def,checks:[...this._def.checks,{kind:n,value:i,inclusive:o,message:k.toString(c)}]})}_addCheck(n){return new fc({...this._def,checks:[...this._def.checks,n]})}positive(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k.toString(n)})}negative(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k.toString(n)})}multipleOf(n,i){return this._addCheck({kind:"multipleOf",value:n,message:k.toString(i)})}get minValue(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n}get maxValue(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n}}fc.create=(n)=>{var i;return new fc({checks:[],typeName:r.ZodBigInt,coerce:(i=n===null||n===void 0?void 0:n.coerce)!==null&&i!==void 0?i:!1,...cn(n)})};class jp extends pn{_parse(n){if(this._def.coerce)n.data=Boolean(n.data);if(this._getType(n)!==N.boolean){let o=this._getOrReturnCtx(n);return B(o,{code:U.invalid_type,expected:N.boolean,received:o.parsedType}),d}return Oi(n.data)}}jp.create=(n)=>{return new jp({typeName:r.ZodBoolean,coerce:(n===null||n===void 0?void 0:n.coerce)||!1,...cn(n)})};class Nc extends pn{_parse(n){if(this._def.coerce)n.data=new Date(n.data);if(this._getType(n)!==N.date){let p=this._getOrReturnCtx(n);return B(p,{code:U.invalid_type,expected:N.date,received:p.parsedType}),d}if(isNaN(n.data.getTime())){let p=this._getOrReturnCtx(n);return B(p,{code:U.invalid_date}),d}let o=new Yi,c=void 0;for(let p of this._def.checks)if(p.kind==="min"){if(n.data.getTime()<p.value)c=this._getOrReturnCtx(n,c),B(c,{code:U.too_small,message:p.message,inclusive:!0,exact:!1,minimum:p.value,type:"date"}),o.dirty()}else if(p.kind==="max"){if(n.data.getTime()>p.value)c=this._getOrReturnCtx(n,c),B(c,{code:U.too_big,message:p.message,inclusive:!0,exact:!1,maximum:p.value,type:"date"}),o.dirty()}else Fn.assertNever(p);return{status:o.value,value:new Date(n.data.getTime())}}_addCheck(n){return new Nc({...this._def,checks:[...this._def.checks,n]})}min(n,i){return this._addCheck({kind:"min",value:n.getTime(),message:k.toString(i)})}max(n,i){return this._addCheck({kind:"max",value:n.getTime(),message:k.toString(i)})}get minDate(){let n=null;for(let i of this._def.checks)if(i.kind==="min"){if(n===null||i.value>n)n=i.value}return n!=null?new Date(n):null}get maxDate(){let n=null;for(let i of this._def.checks)if(i.kind==="max"){if(n===null||i.value<n)n=i.value}return n!=null?new Date(n):null}}Nc.create=(n)=>{return new Nc({checks:[],coerce:(n===null||n===void 0?void 0:n.coerce)||!1,typeName:r.ZodDate,...cn(n)})};class yx extends pn{_parse(n){if(this._getType(n)!==N.symbol){let o=this._getOrReturnCtx(n);return B(o,{code:U.invalid_type,expected:N.symbol,received:o.parsedType}),d}return Oi(n.data)}}yx.create=(n)=>{return new yx({typeName:r.ZodSymbol,...cn(n)})};class Dp extends pn{_parse(n){if(this._getType(n)!==N.undefined){let o=this._getOrReturnCtx(n);return B(o,{code:U.invalid_type,expected:N.undefined,received:o.parsedType}),d}return Oi(n.data)}}Dp.create=(n)=>{return new Dp({typeName:r.ZodUndefined,...cn(n)})};class Lp extends pn{_parse(n){if(this._getType(n)!==N.null){let o=this._getOrReturnCtx(n);return B(o,{code:U.invalid_type,expected:N.null,received:o.parsedType}),d}return Oi(n.data)}}Lp.create=(n)=>{return new Lp({typeName:r.ZodNull,...cn(n)})};class hc extends pn{constructor(){super(...arguments);this._any=!0}_parse(n){return Oi(n.data)}}hc.create=(n)=>{return new hc({typeName:r.ZodAny,...cn(n)})};class mc extends pn{constructor(){super(...arguments);this._unknown=!0}_parse(n){return Oi(n.data)}}mc.create=(n)=>{return new mc({typeName:r.ZodUnknown,...cn(n)})};class zo extends pn{_parse(n){let i=this._getOrReturnCtx(n);return B(i,{code:U.invalid_type,expected:N.never,received:i.parsedType}),d}}zo.create=(n)=>{return new zo({typeName:r.ZodNever,...cn(n)})};class kx extends pn{_parse(n){if(this._getType(n)!==N.undefined){let o=this._getOrReturnCtx(n);return B(o,{code:U.invalid_type,expected:N.void,received:o.parsedType}),d}return Oi(n.data)}}kx.create=(n)=>{return new kx({typeName:r.ZodVoid,...cn(n)})};class Fo extends pn{_parse(n){let{ctx:i,status:o}=this._processInputParams(n),c=this._def;if(i.parsedType!==N.array)return B(i,{code:U.invalid_type,expected:N.array,received:i.parsedType}),d;if(c.exactLength!==null){let x=i.data.length>c.exactLength.value,m=i.data.length<c.exactLength.value;if(x||m)B(i,{code:x?U.too_big:U.too_small,minimum:m?c.exactLength.value:void 0,maximum:x?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),o.dirty()}if(c.minLength!==null){if(i.data.length<c.minLength.value)B(i,{code:U.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),o.dirty()}if(c.maxLength!==null){if(i.data.length>c.maxLength.value)B(i,{code:U.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),o.dirty()}if(i.common.async)return Promise.all([...i.data].map((x,m)=>{return c.type._parseAsync(new Ro(i,x,i.path,m))})).then((x)=>{return Yi.mergeArray(o,x)});let p=[...i.data].map((x,m)=>{return c.type._parseSync(new Ro(i,x,i.path,m))});return Yi.mergeArray(o,p)}get element(){return this._def.type}min(n,i){return new Fo({...this._def,minLength:{value:n,message:k.toString(i)}})}max(n,i){return new Fo({...this._def,maxLength:{value:n,message:k.toString(i)}})}length(n,i){return new Fo({...this._def,exactLength:{value:n,message:k.toString(i)}})}nonempty(n){return this.min(1,n)}}Fo.create=(n,i)=>{return new Fo({type:n,minLength:null,maxLength:null,exactLength:null,typeName:r.ZodArray,...cn(i)})};function _p(n){if(n instanceof Cn){let i={};for(let o in n.shape){let c=n.shape[o];i[o]=To.create(_p(c))}return new Cn({...n._def,shape:()=>i})}else if(n instanceof Fo)return new Fo({...n._def,type:_p(n.element)});else if(n instanceof To)return To.create(_p(n.unwrap()));else if(n instanceof No)return No.create(_p(n.unwrap()));else if(n instanceof Qo)return Qo.create(n.items.map((i)=>_p(i)));else return n}class Cn extends pn{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let n=this._def.shape(),i=Fn.objectKeys(n);return this._cached={shape:n,keys:i}}_parse(n){if(this._getType(n)!==N.object){let f=this._getOrReturnCtx(n);return B(f,{code:U.invalid_type,expected:N.object,received:f.parsedType}),d}let{status:o,ctx:c}=this._processInputParams(n),{shape:p,keys:x}=this._getCached(),m=[];if(!(this._def.catchall instanceof zo&&this._def.unknownKeys==="strip")){for(let f in c.data)if(!x.includes(f))m.push(f)}let a=[];for(let f of x){let v=p[f],$=c.data[f];a.push({key:{status:"valid",value:f},value:v._parse(new Ro(c,$,c.path,f)),alwaysSet:f in c.data})}if(this._def.catchall instanceof zo){let f=this._def.unknownKeys;if(f==="passthrough")for(let v of m)a.push({key:{status:"valid",value:v},value:{status:"valid",value:c.data[v]}});else if(f==="strict"){if(m.length>0)B(c,{code:U.unrecognized_keys,keys:m}),o.dirty()}else if(f==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let v of m){let $=c.data[v];a.push({key:{status:"valid",value:v},value:f._parse(new Ro(c,$,c.path,v)),alwaysSet:v in c.data})}}if(c.common.async)return Promise.resolve().then(async()=>{let f=[];for(let v of a){let $=await v.key,w=await v.value;f.push({key:$,value:w,alwaysSet:v.alwaysSet})}return f}).then((f)=>{return Yi.mergeObjectSync(o,f)});else return Yi.mergeObjectSync(o,a)}get shape(){return this._def.shape()}strict(n){return k.errToObj,new Cn({...this._def,unknownKeys:"strict",...n!==void 0?{errorMap:(i,o)=>{var c,p,x,m;let a=(x=(p=(c=this._def).errorMap)===null||p===void 0?void 0:p.call(c,i,o).message)!==null&&x!==void 0?x:o.defaultError;if(i.code==="unrecognized_keys")return{message:(m=k.errToObj(n).message)!==null&&m!==void 0?m:a};return{message:a}}}:{}})}strip(){return new Cn({...this._def,unknownKeys:"strip"})}passthrough(){return new Cn({...this._def,unknownKeys:"passthrough"})}extend(n){return new Cn({...this._def,shape:()=>({...this._def.shape(),...n})})}merge(n){return new Cn({unknownKeys:n._def.unknownKeys,catchall:n._def.catchall,shape:()=>({...this._def.shape(),...n._def.shape()}),typeName:r.ZodObject})}setKey(n,i){return this.augment({[n]:i})}catchall(n){return new Cn({...this._def,catchall:n})}pick(n){let i={};return Fn.objectKeys(n).forEach((o)=>{if(n[o]&&this.shape[o])i[o]=this.shape[o]}),new Cn({...this._def,shape:()=>i})}omit(n){let i={};return Fn.objectKeys(this.shape).forEach((o)=>{if(!n[o])i[o]=this.shape[o]}),new Cn({...this._def,shape:()=>i})}deepPartial(){return _p(this)}partial(n){let i={};return Fn.objectKeys(this.shape).forEach((o)=>{let c=this.shape[o];if(n&&!n[o])i[o]=c;else i[o]=c.optional()}),new Cn({...this._def,shape:()=>i})}required(n){let i={};return Fn.objectKeys(this.shape).forEach((o)=>{if(n&&!n[o])i[o]=this.shape[o];else{let p=this.shape[o];while(p instanceof To)p=p._def.innerType;i[o]=p}}),new Cn({...this._def,shape:()=>i})}keyof(){return vR(Fn.objectKeys(this.shape))}}Cn.create=(n,i)=>{return new Cn({shape:()=>n,unknownKeys:"strip",catchall:zo.create(),typeName:r.ZodObject,...cn(i)})};Cn.strictCreate=(n,i)=>{return new Cn({shape:()=>n,unknownKeys:"strict",catchall:zo.create(),typeName:r.ZodObject,...cn(i)})};Cn.lazycreate=(n,i)=>{return new Cn({shape:n,unknownKeys:"strip",catchall:zo.create(),typeName:r.ZodObject,...cn(i)})};class Np extends pn{_parse(n){let{ctx:i}=this._processInputParams(n),o=this._def.options;function c(p){for(let m of p)if(m.result.status==="valid")return m.result;for(let m of p)if(m.result.status==="dirty")return i.common.issues.push(...m.ctx.common.issues),m.result;let x=p.map((m)=>new yi(m.ctx.common.issues));return B(i,{code:U.invalid_union,unionErrors:x}),d}if(i.common.async)return Promise.all(o.map(async(p)=>{let x={...i,common:{...i.common,issues:[]},parent:null};return{result:await p._parseAsync({data:i.data,path:i.path,parent:x}),ctx:x}})).then(c);else{let p=void 0,x=[];for(let a of o){let f={...i,common:{...i.common,issues:[]},parent:null},v=a._parseSync({data:i.data,path:i.path,parent:f});if(v.status==="valid")return v;else if(v.status==="dirty"&&!p)p={result:v,ctx:f};if(f.common.issues.length)x.push(f.common.issues)}if(p)return i.common.issues.push(...p.ctx.common.issues),p.result;let m=x.map((a)=>new yi(a));return B(i,{code:U.invalid_union,unionErrors:m}),d}}get options(){return this._def.options}}Np.create=(n,i)=>{return new Np({options:n,typeName:r.ZodUnion,...cn(i)})};var Do=(n)=>{if(n instanceof Cp)return Do(n.schema);else if(n instanceof io)return Do(n.innerType());else if(n instanceof Ip)return[n.value];else if(n instanceof vc)return n.options;else if(n instanceof yp)return Fn.objectValues(n.enum);else if(n instanceof kp)return Do(n._def.innerType);else if(n instanceof Dp)return[void 0];else if(n instanceof Lp)return[null];else if(n instanceof To)return[void 0,...Do(n.unwrap())];else if(n instanceof No)return[null,...Do(n.unwrap())];else if(n instanceof La)return Do(n.unwrap());else if(n instanceof qp)return Do(n.unwrap());else if(n instanceof Zp)return Do(n._def.innerType);else return[]};class Da extends pn{_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==N.object)return B(i,{code:U.invalid_type,expected:N.object,received:i.parsedType}),d;let o=this.discriminator,c=i.data[o],p=this.optionsMap.get(c);if(!p)return B(i,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),d;if(i.common.async)return p._parseAsync({data:i.data,path:i.path,parent:i});else return p._parseSync({data:i.data,path:i.path,parent:i})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(n,i,o){let c=new Map;for(let p of i){let x=Do(p.shape[n]);if(!x.length)throw new Error(`A discriminator value for key \`${n}\` could not be extracted from all schema options`);for(let m of x){if(c.has(m))throw new Error(`Discriminator property ${String(n)} has duplicate value ${String(m)}`);c.set(m,p)}}return new Da({typeName:r.ZodDiscriminatedUnion,discriminator:n,options:i,optionsMap:c,...cn(o)})}}function Q$(n,i){let o=Lo(n),c=Lo(i);if(n===i)return{valid:!0,data:n};else if(o===N.object&&c===N.object){let p=Fn.objectKeys(i),x=Fn.objectKeys(n).filter((a)=>p.indexOf(a)!==-1),m={...n,...i};for(let a of x){let f=Q$(n[a],i[a]);if(!f.valid)return{valid:!1};m[a]=f.data}return{valid:!0,data:m}}else if(o===N.array&&c===N.array){if(n.length!==i.length)return{valid:!1};let p=[];for(let x=0;x<n.length;x++){let m=n[x],a=i[x],f=Q$(m,a);if(!f.valid)return{valid:!1};p.push(f.data)}return{valid:!0,data:p}}else if(o===N.date&&c===N.date&&+n===+i)return{valid:!0,data:n};else return{valid:!1}}class hp extends pn{_parse(n){let{status:i,ctx:o}=this._processInputParams(n),c=(p,x)=>{if(H$(p)||H$(x))return d;let m=Q$(p.value,x.value);if(!m.valid)return B(o,{code:U.invalid_intersection_types}),d;if(z$(p)||z$(x))i.dirty();return{status:i.value,value:m.data}};if(o.common.async)return Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([p,x])=>c(p,x));else return c(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}hp.create=(n,i,o)=>{return new hp({left:n,right:i,typeName:r.ZodIntersection,...cn(o)})};class Qo extends pn{_parse(n){let{status:i,ctx:o}=this._processInputParams(n);if(o.parsedType!==N.array)return B(o,{code:U.invalid_type,expected:N.array,received:o.parsedType}),d;if(o.data.length<this._def.items.length)return B(o,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d;if(!this._def.rest&&o.data.length>this._def.items.length)B(o,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty();let p=[...o.data].map((x,m)=>{let a=this._def.items[m]||this._def.rest;if(!a)return null;return a._parse(new Ro(o,x,o.path,m))}).filter((x)=>!!x);if(o.common.async)return Promise.all(p).then((x)=>{return Yi.mergeArray(i,x)});else return Yi.mergeArray(i,p)}get items(){return this._def.items}rest(n){return new Qo({...this._def,rest:n})}}Qo.create=(n,i)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qo({items:n,typeName:r.ZodTuple,rest:null,...cn(i)})};class Zx extends pn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){let{status:i,ctx:o}=this._processInputParams(n);if(o.parsedType!==N.object)return B(o,{code:U.invalid_type,expected:N.object,received:o.parsedType}),d;let c=[],p=this._def.keyType,x=this._def.valueType;for(let m in o.data)c.push({key:p._parse(new Ro(o,m,o.path,m)),value:x._parse(new Ro(o,o.data[m],o.path,m)),alwaysSet:m in o.data});if(o.common.async)return Yi.mergeObjectAsync(i,c);else return Yi.mergeObjectSync(i,c)}get element(){return this._def.valueType}static create(n,i,o){if(i instanceof pn)return new Zx({keyType:n,valueType:i,typeName:r.ZodRecord,...cn(o)});return new Zx({keyType:Ao.create(),valueType:n,typeName:r.ZodRecord,...cn(i)})}}class qx extends pn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){let{status:i,ctx:o}=this._processInputParams(n);if(o.parsedType!==N.map)return B(o,{code:U.invalid_type,expected:N.map,received:o.parsedType}),d;let c=this._def.keyType,p=this._def.valueType,x=[...o.data.entries()].map(([m,a],f)=>{return{key:c._parse(new Ro(o,m,o.path,[f,"key"])),value:p._parse(new Ro(o,a,o.path,[f,"value"]))}});if(o.common.async){let m=new Map;return Promise.resolve().then(async()=>{for(let a of x){let f=await a.key,v=await a.value;if(f.status==="aborted"||v.status==="aborted")return d;if(f.status==="dirty"||v.status==="dirty")i.dirty();m.set(f.value,v.value)}return{status:i.value,value:m}})}else{let m=new Map;for(let a of x){let{key:f,value:v}=a;if(f.status==="aborted"||v.status==="aborted")return d;if(f.status==="dirty"||v.status==="dirty")i.dirty();m.set(f.value,v.value)}return{status:i.value,value:m}}}}qx.create=(n,i,o)=>{return new qx({valueType:i,keyType:n,typeName:r.ZodMap,...cn(o)})};class Cc extends pn{_parse(n){let{status:i,ctx:o}=this._processInputParams(n);if(o.parsedType!==N.set)return B(o,{code:U.invalid_type,expected:N.set,received:o.parsedType}),d;let c=this._def;if(c.minSize!==null){if(o.data.size<c.minSize.value)B(o,{code:U.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),i.dirty()}if(c.maxSize!==null){if(o.data.size>c.maxSize.value)B(o,{code:U.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),i.dirty()}let p=this._def.valueType;function x(a){let f=new Set;for(let v of a){if(v.status==="aborted")return d;if(v.status==="dirty")i.dirty();f.add(v.value)}return{status:i.value,value:f}}let m=[...o.data.values()].map((a,f)=>p._parse(new Ro(o,a,o.path,f)));if(o.common.async)return Promise.all(m).then((a)=>x(a));else return x(m)}min(n,i){return new Cc({...this._def,minSize:{value:n,message:k.toString(i)}})}max(n,i){return new Cc({...this._def,maxSize:{value:n,message:k.toString(i)}})}size(n,i){return this.min(n,i).max(n,i)}nonempty(n){return this.min(1,n)}}Cc.create=(n,i)=>{return new Cc({valueType:n,minSize:null,maxSize:null,typeName:r.ZodSet,...cn(i)})};class up extends pn{constructor(){super(...arguments);this.validate=this.implement}_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==N.function)return B(i,{code:U.invalid_type,expected:N.function,received:i.parsedType}),d;function o(m,a){return Ba({data:m,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,ua(),Bp].filter((f)=>!!f),issueData:{code:U.invalid_arguments,argumentsError:a}})}function c(m,a){return Ba({data:m,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,ua(),Bp].filter((f)=>!!f),issueData:{code:U.invalid_return_type,returnTypeError:a}})}let p={errorMap:i.common.contextualErrorMap},x=i.data;if(this._def.returns instanceof Ic){let m=this;return Oi(async function(...a){let f=new yi([]),v=await m._def.args.parseAsync(a,p).catch((J)=>{throw f.addIssue(o(a,J)),f}),$=await Reflect.apply(x,this,v);return await m._def.returns._def.type.parseAsync($,p).catch((J)=>{throw f.addIssue(c($,J)),f})})}else{let m=this;return Oi(function(...a){let f=m._def.args.safeParse(a,p);if(!f.success)throw new yi([o(a,f.error)]);let v=Reflect.apply(x,this,f.data),$=m._def.returns.safeParse(v,p);if(!$.success)throw new yi([c(v,$.error)]);return $.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...n){return new up({...this._def,args:Qo.create(n).rest(mc.create())})}returns(n){return new up({...this._def,returns:n})}implement(n){return this.parse(n)}strictImplement(n){return this.parse(n)}static create(n,i,o){return new up({args:n?n:Qo.create([]).rest(mc.create()),returns:i||mc.create(),typeName:r.ZodFunction,...cn(o)})}}class Cp extends pn{get schema(){return this._def.getter()}_parse(n){let{ctx:i}=this._processInputParams(n);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}Cp.create=(n,i)=>{return new Cp({getter:n,typeName:r.ZodLazy,...cn(i)})};class Ip extends pn{_parse(n){if(n.data!==this._def.value){let i=this._getOrReturnCtx(n);return B(i,{received:i.data,code:U.invalid_literal,expected:this._def.value}),d}return{status:"valid",value:n.data}}get value(){return this._def.value}}Ip.create=(n,i)=>{return new Ip({value:n,typeName:r.ZodLiteral,...cn(i)})};function vR(n,i){return new vc({values:n,typeName:r.ZodEnum,...cn(i)})}class vc extends pn{constructor(){super(...arguments);hx.set(this,void 0)}_parse(n){if(typeof n.data!=="string"){let i=this._getOrReturnCtx(n),o=this._def.values;return B(i,{expected:Fn.joinValues(o),received:i.parsedType,code:U.invalid_type}),d}if(!ja(this,hx,"f"))xR(this,hx,new Set(this._def.values),"f");if(!ja(this,hx,"f").has(n.data)){let i=this._getOrReturnCtx(n),o=this._def.values;return B(i,{received:i.data,code:U.invalid_enum_value,options:o}),d}return Oi(n.data)}get options(){return this._def.values}get enum(){let n={};for(let i of this._def.values)n[i]=i;return n}get Values(){let n={};for(let i of this._def.values)n[i]=i;return n}get Enum(){let n={};for(let i of this._def.values)n[i]=i;return n}extract(n,i=this._def){return vc.create(n,{...this._def,...i})}exclude(n,i=this._def){return vc.create(this.options.filter((o)=>!n.includes(o)),{...this._def,...i})}}hx=new WeakMap;vc.create=vR;class yp extends pn{constructor(){super(...arguments);Cx.set(this,void 0)}_parse(n){let i=Fn.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(n);if(o.parsedType!==N.string&&o.parsedType!==N.number){let c=Fn.objectValues(i);return B(o,{expected:Fn.joinValues(c),received:o.parsedType,code:U.invalid_type}),d}if(!ja(this,Cx,"f"))xR(this,Cx,new Set(Fn.getValidEnumValues(this._def.values)),"f");if(!ja(this,Cx,"f").has(n.data)){let c=Fn.objectValues(i);return B(o,{received:o.data,code:U.invalid_enum_value,options:c}),d}return Oi(n.data)}get enum(){return this._def.values}}Cx=new WeakMap;yp.create=(n,i)=>{return new yp({values:n,typeName:r.ZodNativeEnum,...cn(i)})};class Ic extends pn{unwrap(){return this._def.type}_parse(n){let{ctx:i}=this._processInputParams(n);if(i.parsedType!==N.promise&&i.common.async===!1)return B(i,{code:U.invalid_type,expected:N.promise,received:i.parsedType}),d;let o=i.parsedType===N.promise?i.data:Promise.resolve(i.data);return Oi(o.then((c)=>{return this._def.type.parseAsync(c,{path:i.path,errorMap:i.common.contextualErrorMap})}))}}Ic.create=(n,i)=>{return new Ic({type:n,typeName:r.ZodPromise,...cn(i)})};class io extends pn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===r.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){let{status:i,ctx:o}=this._processInputParams(n),c=this._def.effect||null,p={addIssue:(x)=>{if(B(o,x),x.fatal)i.abort();else i.dirty()},get path(){return o.path}};if(p.addIssue=p.addIssue.bind(p),c.type==="preprocess"){let x=c.transform(o.data,p);if(o.common.async)return Promise.resolve(x).then(async(m)=>{if(i.value==="aborted")return d;let a=await this._def.schema._parseAsync({data:m,path:o.path,parent:o});if(a.status==="aborted")return d;if(a.status==="dirty")return bp(a.value);if(i.value==="dirty")return bp(a.value);return a});else{if(i.value==="aborted")return d;let m=this._def.schema._parseSync({data:x,path:o.path,parent:o});if(m.status==="aborted")return d;if(m.status==="dirty")return bp(m.value);if(i.value==="dirty")return bp(m.value);return m}}if(c.type==="refinement"){let x=(m)=>{let a=c.refinement(m,p);if(o.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return m};if(o.common.async===!1){let m=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(m.status==="aborted")return d;if(m.status==="dirty")i.dirty();return x(m.value),{status:i.value,value:m.value}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then((m)=>{if(m.status==="aborted")return d;if(m.status==="dirty")i.dirty();return x(m.value).then(()=>{return{status:i.value,value:m.value}})})}if(c.type==="transform")if(o.common.async===!1){let x=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!Lc(x))return x;let m=c.transform(x.value,p);if(m instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:m}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then((x)=>{if(!Lc(x))return x;return Promise.resolve(c.transform(x.value,p)).then((m)=>({status:i.value,value:m}))});Fn.assertNever(c)}}io.create=(n,i,o)=>{return new io({schema:n,typeName:r.ZodEffects,effect:i,...cn(o)})};io.createWithPreprocess=(n,i,o)=>{return new io({schema:i,effect:{type:"preprocess",transform:n},typeName:r.ZodEffects,...cn(o)})};class To extends pn{_parse(n){if(this._getType(n)===N.undefined)return Oi(void 0);return this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}To.create=(n,i)=>{return new To({innerType:n,typeName:r.ZodOptional,...cn(i)})};class No extends pn{_parse(n){if(this._getType(n)===N.null)return Oi(null);return this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}No.create=(n,i)=>{return new No({innerType:n,typeName:r.ZodNullable,...cn(i)})};class kp extends pn{_parse(n){let{ctx:i}=this._processInputParams(n),o=i.data;if(i.parsedType===N.undefined)o=this._def.defaultValue();return this._def.innerType._parse({data:o,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}kp.create=(n,i)=>{return new kp({innerType:n,typeName:r.ZodDefault,defaultValue:typeof i.default==="function"?i.default:()=>i.default,...cn(i)})};class Zp extends pn{_parse(n){let{ctx:i}=this._processInputParams(n),o={...i,common:{...i.common,issues:[]}},c=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});if(Ix(c))return c.then((p)=>{return{status:"valid",value:p.status==="valid"?p.value:this._def.catchValue({get error(){return new yi(o.common.issues)},input:o.data})}});else return{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new yi(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}Zp.create=(n,i)=>{return new Zp({innerType:n,typeName:r.ZodCatch,catchValue:typeof i.catch==="function"?i.catch:()=>i.catch,...cn(i)})};class sx extends pn{_parse(n){if(this._getType(n)!==N.nan){let o=this._getOrReturnCtx(n);return B(o,{code:U.invalid_type,expected:N.nan,received:o.parsedType}),d}return{status:"valid",value:n.data}}}sx.create=(n)=>{return new sx({typeName:r.ZodNaN,...cn(n)})};var xG=Symbol("zod_brand");class La extends pn{_parse(n){let{ctx:i}=this._processInputParams(n),o=i.data;return this._def.type._parse({data:o,path:i.path,parent:i})}unwrap(){return this._def.type}}class Px extends pn{_parse(n){let{status:i,ctx:o}=this._processInputParams(n);if(o.common.async)return(async()=>{let p=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});if(p.status==="aborted")return d;if(p.status==="dirty")return i.dirty(),bp(p.value);else return this._def.out._parseAsync({data:p.value,path:o.path,parent:o})})();else{let c=this._def.in._parseSync({data:o.data,path:o.path,parent:o});if(c.status==="aborted")return d;if(c.status==="dirty")return i.dirty(),{status:"dirty",value:c.value};else return this._def.out._parseSync({data:c.value,path:o.path,parent:o})}}static create(n,i){return new Px({in:n,out:i,typeName:r.ZodPipeline})}}class qp extends pn{_parse(n){let i=this._def.innerType._parse(n),o=(c)=>{if(Lc(c))c.value=Object.freeze(c.value);return c};return Ix(i)?i.then((c)=>o(c)):o(i)}unwrap(){return this._def.innerType}}qp.create=(n,i)=>{return new qp({innerType:n,typeName:r.ZodReadonly,...cn(i)})};function oR(n,i){let o=typeof n==="function"?n(i):typeof n==="string"?{message:n}:n;return typeof o==="string"?{message:o}:o}function $R(n,i={},o){if(n)return hc.create().superRefine((c,p)=>{var x,m;let a=n(c);if(a instanceof Promise)return a.then((f)=>{var v,$;if(!f){let w=oR(i,c),J=($=(v=w.fatal)!==null&&v!==void 0?v:o)!==null&&$!==void 0?$:!0;p.addIssue({code:"custom",...w,fatal:J})}});if(!a){let f=oR(i,c),v=(m=(x=f.fatal)!==null&&x!==void 0?x:o)!==null&&m!==void 0?m:!0;p.addIssue({code:"custom",...f,fatal:v})}return});return hc.create()}var mG={object:Cn.lazycreate},r;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(r||(r={}));var aG=(n,i={message:`Input not instance of ${n.name}`})=>$R((o)=>o instanceof n,i),wR=Ao.create,JR=ac.create,fG=sx.create,vG=fc.create,AR=jp.create,$G=Nc.create,wG=yx.create,JG=Dp.create,AG=Lp.create,FG=hc.create,TG=mc.create,RG=zo.create,SG=kx.create,XG=Fo.create,WG=Cn.create,KG=Cn.strictCreate,lG=Np.create,GG=Da.create,MG=hp.create,YG=Qo.create,HG=Zx.create,zG=qx.create,QG=Cc.create,EG=up.create,OG=Cp.create,UG=Ip.create,VG=vc.create,_G=yp.create,bG=Ic.create,cR=io.create,uG=To.create,BG=No.create,jG=io.createWithPreprocess,DG=Px.create,LG=()=>wR().optional(),NG=()=>JR().optional(),hG=()=>AR().optional(),CG={string:(n)=>Ao.create({...n,coerce:!0}),number:(n)=>ac.create({...n,coerce:!0}),boolean:(n)=>jp.create({...n,coerce:!0}),bigint:(n)=>fc.create({...n,coerce:!0}),date:(n)=>Nc.create({...n,coerce:!0})},IG=d,Wn=Object.freeze({__proto__:null,defaultErrorMap:Bp,setErrorMap:j9,getErrorMap:ua,makeIssue:Ba,EMPTY_PATH:D9,addIssueToContext:B,ParseStatus:Yi,INVALID:d,DIRTY:bp,OK:Oi,isAborted:H$,isDirty:z$,isValid:Lc,isAsync:Ix,get util(){return Fn},get objectUtil(){return Y$},ZodParsedType:N,getParsedType:Lo,ZodType:pn,datetimeRegex:fR,ZodString:Ao,ZodNumber:ac,ZodBigInt:fc,ZodBoolean:jp,ZodDate:Nc,ZodSymbol:yx,ZodUndefined:Dp,ZodNull:Lp,ZodAny:hc,ZodUnknown:mc,ZodNever:zo,ZodVoid:kx,ZodArray:Fo,ZodObject:Cn,ZodUnion:Np,ZodDiscriminatedUnion:Da,ZodIntersection:hp,ZodTuple:Qo,ZodRecord:Zx,ZodMap:qx,ZodSet:Cc,ZodFunction:up,ZodLazy:Cp,ZodLiteral:Ip,ZodEnum:vc,ZodNativeEnum:yp,ZodPromise:Ic,ZodEffects:io,ZodTransformer:io,ZodOptional:To,ZodNullable:No,ZodDefault:kp,ZodCatch:Zp,ZodNaN:sx,BRAND:xG,ZodBranded:La,ZodPipeline:Px,ZodReadonly:qp,custom:$R,Schema:pn,ZodSchema:pn,late:mG,get ZodFirstPartyTypeKind(){return r},coerce:CG,any:FG,array:XG,bigint:vG,boolean:AR,date:$G,discriminatedUnion:GG,effect:cR,enum:VG,function:EG,instanceof:aG,intersection:MG,lazy:OG,literal:UG,map:zG,nan:fG,nativeEnum:_G,never:RG,null:AG,nullable:BG,number:JR,object:WG,oboolean:hG,onumber:NG,optional:uG,ostring:LG,pipeline:DG,preprocess:jG,promise:bG,record:HG,set:QG,strictObject:KG,string:wR,symbol:wG,transformer:cR,tuple:YG,undefined:JG,union:lG,unknown:TG,void:SG,NEVER:IG,ZodIssueCode:U,quotelessJson:B9,ZodError:yi});var yG="__vite_start_time"in globalThis,kG=typeof window!=="undefined",oN="vitest"in globalThis,sn=nR({isServer:!yG&&!kG,server:{CI:Wn.string().transform((n)=>!0).optional(),POSTGRES_USER:Wn.string(),POSTGRES_PASSWORD:Wn.string(),POSTGRES_DATABASE:Wn.string(),POSTGRES_HOST:Wn.string(),POSTGRES_PORT:Wn.string().transform((n)=>Number.parseInt(n,10)),BACKEND_PORT:Wn.string().transform((n)=>Number.parseInt(n,10)),RUN_WORKERS_FROM_SOURCE:Wn.union([Wn.literal("true"),Wn.literal("false")]).optional().transform((n)=>n==="true"),FRONTEND_PORT:Wn.string().transform((n)=>Number.parseInt(n,10)),FRONTEND_ORIGINS:Wn.string().transform((n)=>JSON.parse(n)).pipe(Wn.array(Wn.string())),OPENAI_API_KEY:Wn.string().optional()},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Wn.string(),VITE_USE_SELF_SIGNED_CERTIFICATE:Wn.union([Wn.literal("true"),Wn.literal("false")]).optional().transform((n)=>n==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var TR=E$(import.meta.dirname,"../dev"),O$=sn.VITE_USE_SELF_SIGNED_CERTIFICATE?{cert:FR(E$(TR,"./cert.pem"),"utf-8"),key:FR(E$(TR,"./key.pem"),"utf-8")}:void 0;var $c=new Of,mn=sn.VITE_USE_SELF_SIGNED_CERTIFICATE?console:$c.logger;g.STORE.loggers[0]=new Xc("warn",void 0,mn);if(mn!==console)Object.assign(console,mn,{log:mn.info});import{spawn as ZG}from"node:child_process";import{resolve as qG}from"node:path";function U$(n,i,o=n.logger){let c=sn.RUN_WORKERS_FROM_SOURCE?"ts":"js",p=i.endsWith(".bun")?"bun":"node",m=[qG(import.meta.dir,`${i}.${c}`)];if(p==="node"&&c==="ts")m.push("--experimental-strip-types");let a=ZG(p,m);return new Jx(a,i,o)}var RR=wf($v(),1);var sG=604800000,Na=(()=>{let{__userSessionMap:n}=globalThis;if(!n){n=globalThis.__userSessionMap=new Map;let i=new RR.CronJob("00 00 03 * * *",()=>{for(let[o,c]of n.entries()){let p=Date.now();for(let[x,m]of c.entries())if(p-m>sG)c.delete(x);if(c.size===0)n.delete(o)}});i.start(),process.on("exit",()=>{i.stop(),mn.info("\uD83D\uDEEC autoExpiry stopped")})}return n})();import NM from"node:path";import SM from"node:os";import XM from"node:fs";var ha=new Map,V$=new Map,_$=Symbol("OriginError"),sp={};class oo extends Promise{constructor(n,i,o,c,p={}){let x,m;super((a,f)=>{x=a,m=f});this.tagged=Array.isArray(n.raw),this.strings=n,this.args=i,this.handler=o,this.canceller=c,this.options=p,this.state=null,this.statement=null,this.resolve=(a)=>(this.active=!1,x(a)),this.reject=(a)=>(this.active=!1,m(a)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[_$]=this.handler.debug?new Error:this.tagged&&PG(this.strings)}get origin(){return(this.handler.debug?this[_$].stack:this.tagged&&V$.has(this.strings)?V$.get(this.strings):V$.set(this.strings,this[_$].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(n=1,i){if(this.options.simple=!1,typeof n==="function")i=n,n=1;if(this.cursorRows=n,typeof i==="function")return this.cursorFn=i,this;let o;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};o&&o();let c=new Promise((p,x)=>{this.cursorFn=(m)=>{return p({value:m,done:!1}),new Promise((a)=>o=a)},this.resolve=()=>(this.active=!1,p({done:!0})),this.reject=(m)=>(this.active=!1,x(m))});return this.execute(),c},return(){return o&&o(sp),{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(n){return this.forEachFn=n,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 PG(n){if(ha.has(n))return ha.get(n);let i=Error.stackTraceLimit;return Error.stackTraceLimit=4,ha.set(n,new Error),Error.stackTraceLimit=i,ha.get(n)}class Pp extends Error{constructor(n){super(n.message);this.name=this.constructor.name,Object.assign(this,n)}}var rn={connection:SR,postgres:XR,generic:WR,notSupported:KR};function SR(n,i,o){let{host:c,port:p}=o||i,x=Object.assign(new Error("write "+n+" "+(i.path||c+":"+p)),{code:n,errno:n,address:i.path||c},i.path?{}:{port:p});return Error.captureStackTrace(x,SR),x}function XR(n){let i=new Pp(n);return Error.captureStackTrace(i,XR),i}function WR(n,i){let o=Object.assign(new Error(n+": "+i),{code:n});return Error.captureStackTrace(o,WR),o}function KR(n){let i=Object.assign(new Error(n+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:n});return Error.captureStackTrace(i,KR),i}var tG={string:{to:25,from:null,serialize:(n)=>""+n},number:{to:0,from:[21,23,26,700,701],serialize:(n)=>""+n,parse:(n)=>+n},json:{to:114,from:[114,3802],serialize:(n)=>JSON.stringify(n),parse:(n)=>JSON.parse(n)},boolean:{to:16,from:16,serialize:(n)=>n===!0?"t":"f",parse:(n)=>n==="t"},date:{to:1184,from:[1082,1114,1184],serialize:(n)=>(n instanceof Date?n:new Date(n)).toISOString(),parse:(n)=>new Date(n)},bytea:{to:17,from:17,serialize:(n)=>"\\x"+Buffer.from(n).toString("hex"),parse:(n)=>Buffer.from(n.slice(2),"hex")}};class ya{then(){b$()}catch(){b$()}finally(){b$()}}class gx extends ya{constructor(n){super();this.value=qa(n)}}class Eo extends ya{constructor(n,i,o){super();this.value=n,this.type=i,this.array=o}}class ka extends ya{constructor(n,i){super();this.first=n,this.rest=i}build(n,i,o,c){let p=rG.map(([x,m])=>({fn:m,i:n.search(x)})).sort((x,m)=>x.i-m.i).pop();return p.i===-1?L$(this.first,c):p.fn(this.first,this.rest,i,o,c)}}function Za(n,i,o,c){let p=n instanceof Eo?n.value:n;if(p===void 0){if(n instanceof Eo?n.value=c.transform.undefined:p=n=c.transform.undefined,p===void 0)throw rn.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+o.push(n instanceof Eo?(i.push(n.value),n.array?n.array[n.type||Ia(n.value)]||n.type||YR(n.value):n.type):(i.push(n),Ia(n)))}var GR=zR(tG);function j$(n,i,o,c,p,x){for(let m=1;m<n.strings.length;m++)i+=D$(i,o,c,p,x)+n.strings[m],o=n.args[m];return i}function D$(n,i,o,c,p){return i instanceof ka?i.build(n,o,c,p):i instanceof oo?B$(i,o,c,p):i instanceof gx?i.value:i&&i[0]instanceof oo?i.reduce((x,m)=>x+" "+B$(m,o,c,p),""):Za(i,o,c,p)}function B$(n,i,o,c){return n.fragment=!0,j$(n,n.strings[0],n.args[0],i,o,c)}function MR(n,i,o,c,p){return n.map((x)=>"("+c.map((m)=>D$("values",x[m],i,o,p)).join(",")+")").join(",")}function lR(n,i,o,c,p){let x=Array.isArray(n[0]),m=i.length?i.flat():Object.keys(x?n[0]:n);return MR(x?n:[n],o,c,m,p)}function Ca(n,i,o,c,p){if(typeof n==="string"&&(n=[n].concat(i)),Array.isArray(n))return L$(n,p);let x;return(i.length?i.flat():Object.keys(n)).map((a)=>{return x=n[a],(x instanceof oo?B$(x,o,c,p):x instanceof gx?x.value:Za(x,o,c,p))+" as "+qa(p.transform.column.to?p.transform.column.to(a):a)}).join(",")}var rG=Object.entries({values:lR,in:(...n)=>{let i=lR(...n);return i==="()"?"(null)":i},select:Ca,as:Ca,returning:Ca,"\\(":Ca,update(n,i,o,c,p){return(i.length?i.flat():Object.keys(n)).map((x)=>qa(p.transform.column.to?p.transform.column.to(x):x)+"="+D$("values",n[x],o,c,p))},insert(n,i,o,c,p){let x=i.length?i.flat():Object.keys(Array.isArray(n)?n[0]:n);return"("+L$(x,p)+")values"+MR(Array.isArray(n)?n:[n],o,c,x,p)}}).map(([n,i])=>[new RegExp("((?:^|[\\s(])"+n+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),i]);function b$(){throw rn.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:dG,parsers:gG}=GR;function YR(n){if(Array.isArray(n))return YR(n[0]);return typeof n==="string"?1009:0}var HR=function(n){let i=zR(n||{});return{serializers:Object.assign({},dG,i.serializers),parsers:Object.assign({},gG,i.parsers)}};function zR(n){return Object.keys(n).reduce((i,o)=>{if(n[o].from&&[].concat(n[o].from).forEach((c)=>i.parsers[c]=n[o].parse),n[o].serialize)i.serializers[n[o].to]=n[o].serialize,n[o].from&&[].concat(n[o].from).forEach((c)=>i.serializers[c]=n[o].serialize);return i},{parsers:{},serializers:{}})}function L$(n,{transform:{column:i}}){return n.map((o)=>qa(i.to?i.to(o):o)).join(",")}var qa=function n(i){return'"'+i.replace(/"/g,'""').replace(/\./g,'"."')+'"'},Ia=function n(i){return i instanceof Eo?i.type:i instanceof Date?1184:i instanceof Uint8Array?17:i===!0||i===!1?16:typeof i==="bigint"?20:Array.isArray(i)?n(i[0]):0},eG=/\\/g,nM=/"/g;function iM(n){return n.replace(eG,"\\\\").replace(nM,"\\\"")}var QR=function n(i,o,c,p){if(Array.isArray(i)===!1)return i;if(!i.length)return"{}";let x=i[0],m=p===1020?";":",";if(Array.isArray(x)&&!x.type)return"{"+i.map((a)=>n(a,o,c,p)).join(m)+"}";return"{"+i.map((a)=>{if(a===void 0){if(a=c.transform.undefined,a===void 0)throw rn.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return a===null?"null":'"'+iM(o?o(a.type?a.value:a):""+a)+'"'}).join(m)+"}"},u$={i:0,char:null,str:"",quoted:!1,last:0},ER=function n(i,o,c){return u$.i=u$.last=0,OR(u$,i,o,c)};function OR(n,i,o,c){let p=[],x=c===1020?";":",";for(;n.i<i.length;n.i++){if(n.char=i[n.i],n.quoted)if(n.char==="\\")n.str+=i[++n.i];else if(n.char==='"')p.push(o?o(n.str):n.str),n.str="",n.quoted=i[n.i+1]==='"',n.last=n.i+2;else n.str+=n.char;else if(n.char==='"')n.quoted=!0;else if(n.char==="{")n.last=++n.i,p.push(OR(n,i,o,c));else if(n.char==="}"){n.quoted=!1,n.last<n.i&&p.push(o?o(i.slice(n.last,n.i)):i.slice(n.last,n.i)),n.last=n.i+1;break}else if(n.char===x&&n.p!=="}"&&n.p!=='"')p.push(o?o(i.slice(n.last,n.i)):i.slice(n.last,n.i)),n.last=n.i+1;n.p=n.char}return n.last<n.i&&p.push(o?o(i.slice(n.last,n.i+1)):i.slice(n.last,n.i+1)),p}var yc=(n)=>{let i=n[0];for(let o=1;o<n.length;o++)i+=n[o]==="_"?n[++o].toUpperCase():n[o];return i},kc=(n)=>{let i=n[0].toUpperCase();for(let o=1;o<n.length;o++)i+=n[o]==="_"?n[++o].toUpperCase():n[o];return i},Zc=(n)=>n.replace(/_/g,"-"),tx=(n)=>n.replace(/([A-Z])/g,"_$1").toLowerCase(),rx=(n)=>(n.slice(0,1)+n.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),dx=(n)=>n.replace(/-/g,"_");function N$(n){return function i(o,c){return typeof o==="object"&&o!==null&&(c.type===114||c.type===3802)?Array.isArray(o)?o.map((p)=>i(p,c)):Object.entries(o).reduce((p,[x,m])=>Object.assign(p,{[n(x)]:i(m,c)}),{}):o}}yc.column={from:yc};yc.value={from:N$(yc)};tx.column={to:tx};var h$={...yc};h$.column.to=tx;kc.column={from:kc};kc.value={from:N$(kc)};rx.column={to:rx};var C$={...kc};C$.column.to=rx;Zc.column={from:Zc};Zc.value={from:N$(Zc)};dx.column={to:dx};var I$={...Zc};I$.column.to=dx;import UR from"node:net";import xM from"node:tls";import ex from"node:crypto";import y$ from"node:stream";import{performance as VR}from"node:perf_hooks";class qc 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 ki=oM;function oM(n=[]){let i=n.slice(),o=0;return{get length(){return i.length-o},remove:(c)=>{let p=i.indexOf(c);return p===-1?null:(i.splice(p,1),c)},push:(c)=>(i.push(c),c),shift:()=>{let c=i[o++];if(o===i.length)o=0,i=[];else i[o-1]=void 0;return c}}}var Hi=Buffer.allocUnsafe(256),cM="BCcDdEFfHPpQSX".split("").reduce((n,i)=>{let o=i.charCodeAt(0);return n[i]=()=>{return Hi[0]=o,Qn.i=5,Qn},n},{}),Qn=Object.assign(pM,cM,{N:String.fromCharCode(0),i:0,inc(n){return Qn.i+=n,Qn},str(n){let i=Buffer.byteLength(n);return sa(i),Qn.i+=Hi.write(n,Qn.i,i,"utf8"),Qn},i16(n){return sa(2),Hi.writeUInt16BE(n,Qn.i),Qn.i+=2,Qn},i32(n,i){if(i||i===0)return Hi.writeUInt32BE(n,i),Qn;return sa(4),Hi.writeUInt32BE(n,Qn.i),Qn.i+=4,Qn},z(n){return sa(n),Hi.fill(0,Qn.i,Qn.i+n),Qn.i+=n,Qn},raw(n){return Hi=Buffer.concat([Hi.subarray(0,Qn.i),n]),Qn.i=Hi.length,Qn},end(n=1){Hi.writeUInt32BE(Qn.i-n,n);let i=Hi.subarray(0,Qn.i);return Qn.i=0,Hi=Buffer.allocUnsafe(256),i}}),s=Qn;function sa(n){if(Hi.length-Qn.i<n){let i=Hi,o=i.length;Hi=Buffer.allocUnsafe(o+(o>>1)+n),i.copy(Hi)}}function pM(){return Qn.i=0,Qn}var q$=uR,mM=1,wc=s().S().end(),_R=s().H().end(),aM=s().i32(8).i32(80877103).end(8),fM=Buffer.concat([s().E().str(s.N).i32(0).end(),wc]),vM=s().D().str("S").str(s.N).end(),tp=()=>{},$M=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),wM={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 uR(n,i={},{onopen:o=tp,onend:c=tp,onclose:p=tp}={}){let{ssl:x,max:m,user:a,host:f,port:v,database:$,parsers:w,transform:J,onnotice:S,onnotify:X,onparameter:R,max_pipeline:K,keep_alive:M,backoff:Y,target_session_attrs:I}=n,G=ki(),z=mM++,E={pid:null,secret:null},Q=Z$(ff,n.idle_timeout),b=Z$(ff,n.max_lifetime),y=Z$(AS,n.connect_timeout),H=null,an,Z=new qc,fn=Buffer.alloc(0),En=n.fetch_types,dn={},Vi={},Oo=Math.random().toString(36).slice(2),O=1,q=0,Rn=0,Dn=0,gn=0,vn=0,_n=0,Pn=0,Nn=null,Bn=null,Fi=!1,bn=null,co=null,Ti=null,ho=null,en=null,jn=null,po=null,Xo=null,_=null,nx=null,Ri={queue:i.closed,idleTimer:Q,connect(A){Ti=A||!0,W0()},terminate:ox,execute:ix,cancel:vS,end:ff,count:0,id:z};return i.closed&&i.closed.push(Ri),Ri;async function fS(){let A;try{A=n.socket?await Promise.resolve(n.socket(n)):new UR.Socket}catch(W){rc(W);return}return A.on("error",rc),A.on("close",K0),A.on("drain",S0),A}async function vS({pid:A,secret:W},P,Sn){try{an=s().i32(16).i32(80877102).i32(A).i32(W).end(16),await X0(),H.once("error",Sn),H.once("close",P)}catch(In){Sn(In)}}function ix(A){if(Fi)return mm(A,rn.connection("CONNECTION_DESTROYED",n));if(A.cancelled)return;try{return A.state=E,_?G.push(A):(_=A,_.active=!0),JS(A),vi($S(A))&&!A.describeFirst&&!A.cursorFn&&G.length<K&&(!A.options.onexecute||A.options.onexecute(Ri))}catch(W){return G.length===0&&vi(wc),Wo(W),!0}}function $S(A){if(A.parameters.length>=65534)throw rn.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return A.options.simple?s().Q().str(A.statement.string+s.N).end():A.describeFirst?Buffer.concat([F0(A),_R]):A.prepare?A.prepared?xm(A):Buffer.concat([F0(A),xm(A)]):wS(A)}function F0(A){return Buffer.concat([G0(A.statement.string,A.parameters,A.statement.types,A.statement.name),dS("S",A.statement.name)])}function xm(A){return Buffer.concat([rS(A.parameters,A.statement.types,A.statement.name,A.cursorName),A.cursorFn?M0("",A.cursorRows):fM])}function wS(A){return Buffer.concat([G0(A.statement.string,A.parameters,A.statement.types),vM,xm(A)])}function JS(A){let W=[],P=[],Sn=j$(A,A.strings[0],A.args[0],W,P,n);!A.tagged&&A.args.forEach((In)=>Za(In,W,P,n)),A.prepare=n.prepare&&("prepare"in A.options?A.options.prepare:!0),A.string=Sn,A.signature=A.prepare&&P+Sn,A.onlyDescribe&&delete Vi[A.signature],A.parameters=A.parameters||W,A.prepared=A.prepare&&A.signature in Vi,A.describeFirst=A.onlyDescribe||W.length&&!A.prepared,A.statement=A.prepared?Vi[A.signature]:{string:Sn,types:P,name:A.prepare?Oo+O++:""},typeof n.debug==="function"&&n.debug(z,Sn,W,P)}function vi(A,W){if(jn=jn?Buffer.concat([jn,A]):Buffer.from(A),W||jn.length>=1024)return T0(W);return Bn===null&&(Bn=setImmediate(T0)),!0}function T0(A){let W=H.write(jn,A);return Bn!==null&&clearImmediate(Bn),jn=Bn=null,W}function AS(){Wo(rn.connection("CONNECT_TIMEOUT",n,H)),H.destroy()}async function R0(){if(vi(aM),!await new Promise((W)=>H.once("data",(P)=>W(P[0]===83)))&&x==="prefer")return tc();H.removeAllListeners(),H=xM.connect({socket:H,servername:UR.isIP(H.host)?void 0:H.host,...x==="require"||x==="allow"||x==="prefer"?{rejectUnauthorized:!1}:x==="verify-full"?{}:typeof x==="object"?x:{}}),H.on("secureConnect",tc),H.on("error",rc),H.on("close",K0),H.on("drain",S0)}function S0(){!_&&o(Ri)}function af(A){if(bn){if(bn.push(A),Rn-=A.length,Rn>=0)return}fn=bn?Buffer.concat(bn,vn-Rn):fn.length===0?A:Buffer.concat([fn,A],fn.length+A.length);while(fn.length>4){if(vn=fn.readUInt32BE(1),vn>=fn.length){Rn=vn-fn.length,bn=[fn];break}try{FS(fn.subarray(0,vn+1))}catch(W){_&&(_.cursorFn||_.describeFirst)&&vi(wc),Wo(W)}fn=fn.subarray(vn+1),Rn=0,bn=null}}async function X0(){if(Fi=!1,dn={},H||(H=await fS()),!H)return;if(y.start(),n.socket)return x?R0():tc();if(H.on("connect",x?R0:tc),n.path)return H.connect(n.path);H.ssl=x,H.connect(v[Dn],f[Dn]),H.host=f[Dn],H.port=v[Dn],Dn=(Dn+1)%v.length}function W0(){setTimeout(X0,q?q+_n-VR.now():0)}function tc(){try{Vi={},En=n.fetch_types,Oo=Math.random().toString(36).slice(2),O=1,b.start(),H.on("data",af),M&&H.setKeepAlive&&H.setKeepAlive(!0,1000*M);let A=eS();vi(A)}catch(A){rc(A)}}function rc(A){if(Ri.queue===i.connecting&&n.host[gn+1])return;Wo(A);while(G.length)mm(G.shift(),A)}function Wo(A){en&&(en.destroy(A),en=null),_&&mm(_,A),Ti&&(mm(Ti,A),Ti=null)}function mm(A,W){"query"in W||"parameters"in W||Object.defineProperties(W,{stack:{value:W.stack+A.origin.replace(/.*\n/,`
61
- `),enumerable:n.debug},query:{value:A.string,enumerable:n.debug},parameters:{value:A.parameters,enumerable:n.debug},args:{value:A.args,enumerable:n.debug},types:{value:A.statement&&A.statement.types,enumerable:n.debug}}),A.reject(W)}function ff(){return ho||(!Ri.reserved&&c(Ri),!Ri.reserved&&!Ti&&!_&&G.length===0?(ox(),new Promise((A)=>H&&H.readyState!=="closed"?H.once("close",A):A())):ho=new Promise((A)=>po=A))}function ox(){if(Fi=!0,en||_||Ti||G.length)rc(rn.connection("CONNECTION_DESTROYED",n));if(clearImmediate(Bn),H)H.removeListener("data",af),H.removeListener("connect",tc),H.readyState==="open"&&H.end(s().X().end());po&&(po(),ho=po=null)}async function K0(A){if(fn=Buffer.alloc(0),Rn=0,bn=null,clearImmediate(Bn),H.removeListener("data",af),H.removeListener("connect",tc),Q.cancel(),b.cancel(),y.cancel(),H.removeAllListeners(),H=null,Ti)return W0();!A&&(_||G.length)&&rc(rn.connection("CONNECTION_CLOSED",n,H)),q=VR.now(),A&&n.shared.retries++,_n=(typeof Y==="function"?Y(n.shared.retries):Y)*1000,p(Ri,rn.connection("CONNECTION_CLOSED",n,H))}function FS(A,W=A[0]){(W===68?TS:W===100?IS:W===65?jS:W===83?RS:W===90?SS:W===67?XS:W===50?l0:W===49?WS:W===116?KS:W===84?lS:W===82?GS:W===110?ES:W===75?OS:W===69?uS:W===115?DS:W===51?LS:W===71?NS:W===78?kS:W===72?hS:W===99?yS:W===73?ZS:W===86?qS:W===118?sS:W===87?CS:PS)(A)}function TS(A){let W=7,P,Sn,In,Si=_.isRaw?new Array(_.statement.columns.length):{};for(let zi=0;zi<_.statement.columns.length;zi++)Sn=_.statement.columns[zi],P=A.readInt32BE(W),W+=4,In=P===-1?null:_.isRaw===!0?A.subarray(W,W+=P):Sn.parser===void 0?A.toString("utf8",W,W+=P):Sn.parser.array===!0?Sn.parser(A.toString("utf8",W+1,W+=P)):Sn.parser(A.toString("utf8",W,W+=P)),_.isRaw?Si[zi]=_.isRaw===!0?In:J.value.from?J.value.from(In,Sn):In:Si[Sn.name]=J.value.from?J.value.from(In,Sn):In;_.forEachFn?_.forEachFn(J.row.from?J.row.from(Si):Si,Z):Z[Pn++]=J.row.from?J.row.from(Si):Si}function RS(A){let[W,P]=A.toString("utf8",5,A.length-1).split(s.N);if(dn[W]=P,n.parameters[W]!==P)n.parameters[W]=P,R&&R(W,P)}function SS(A){if(_&&_.options.simple&&_.resolve(co||Z),_=co=null,Z=new qc,y.cancel(),Ti){if(I){if(!dn.in_hot_standby||!dn.default_transaction_read_only)return bS();else if(_S(I,dn))return ox()}if(En)return Ti===!0&&(Ti=null),US();Ti!==!0&&ix(Ti),n.shared.retries=gn=0,Ti=null;return}while(G.length&&(_=G.shift())&&(_.active=!0,_.cancelled))uR(n).cancel(_.state,_.cancelled.resolve,_.cancelled.reject);if(_)return;Ri.reserved?!Ri.reserved.release&&A[5]===73?ho?ox():(Ri.reserved=null,o(Ri)):Ri.reserved():ho?ox():o(Ri)}function XS(A){Pn=0;for(let W=A.length-1;W>0;W--){if(A[W]===32&&A[W+1]<58&&Z.count===null)Z.count=+A.toString("utf8",W+1,A.length-1);if(A[W-1]>=65){Z.command=A.toString("utf8",5,W),Z.state=E;break}}if(nx&&(nx(),nx=null),Z.command==="BEGIN"&&m!==1&&!Ri.reserved)return Wo(rn.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(_.options.simple)return l0();if(_.cursorFn)Z.count&&_.cursorFn(Z),vi(wc);_.resolve(Z)}function WS(){_.parsing=!1}function l0(){!Z.statement&&(Z.statement=_.statement),Z.columns=_.statement.columns}function KS(A){let W=A.readUInt16BE(5);for(let P=0;P<W;++P)!_.statement.types[P]&&(_.statement.types[P]=A.readUInt32BE(7+P*4));_.prepare&&(Vi[_.signature]=_.statement),_.describeFirst&&!_.onlyDescribe&&(vi(xm(_)),_.describeFirst=!1)}function lS(A){if(Z.command)co=co||[Z],co.push(Z=new qc),Z.count=null,_.statement.columns=null;let W=A.readUInt16BE(5),P=7,Sn;_.statement.columns=Array(W);for(let In=0;In<W;++In){Sn=P;while(A[P++]!==0);let Si=A.readUInt32BE(P),zi=A.readUInt16BE(P+4),Co=A.readUInt32BE(P+6);_.statement.columns[In]={name:J.column.from?J.column.from(A.toString("utf8",Sn,P-1)):A.toString("utf8",Sn,P-1),parser:w[Co],table:Si,number:zi,type:Co},P+=18}if(Z.statement=_.statement,_.onlyDescribe)return _.resolve(_.statement),vi(wc)}async function GS(A,W=A.readUInt32BE(5)){(W===3?MS:W===5?YS:W===10?HS:W===11?zS:W===12?QS:W!==0?tS:tp)(A,W)}async function MS(){let A=await vf();vi(s().p().str(A).z(1).end())}async function YS(A){let W="md5"+await bR(Buffer.concat([Buffer.from(await bR(await vf()+a)),A.subarray(9)]));vi(s().p().str(W).z(1).end())}async function HS(){Xo=(await ex.randomBytes(18)).toString("base64"),s().p().str("SCRAM-SHA-256"+s.N);let A=s.i;vi(s.inc(4).str("n,,n=*,r="+Xo).i32(s.i-A-4,A).end())}async function zS(A){let W=A.toString("utf8",9).split(",").reduce((zi,Co)=>(zi[Co[0]]=Co.slice(2),zi),{}),P=await ex.pbkdf2Sync(await vf(),Buffer.from(W.s,"base64"),parseInt(W.i),32,"sha256"),Sn=await Pa(P,"Client Key"),In="n=*,r="+Xo+",r="+W.r+",s="+W.s+",i="+W.i+",c=biws,r="+W.r;Nn=(await Pa(await Pa(P,"Server Key"),In)).toString("base64");let Si="c=biws,r="+W.r+",p="+AM(Sn,Buffer.from(await Pa(await JM(Sn),In))).toString("base64");vi(s().p().str(Si).end())}function QS(A){if(A.toString("utf8",9).split(s.N,1)[0].slice(2)===Nn)return;Wo(rn.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),H.destroy()}function vf(){return Promise.resolve(typeof n.pass==="function"?n.pass():n.pass)}function ES(){if(Z.statement=_.statement,Z.statement.columns=[],_.onlyDescribe)return _.resolve(_.statement),vi(wc)}function OS(A){E.pid=A.readUInt32BE(5),E.secret=A.readUInt32BE(9)}async function US(){En=!1,(await new oo([`
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=B(i);f.molecules.delete(n);let $=Zi(f)&&f.transactionMeta.phase==="building";if($)f.transactionMeta.update.updates.push(m);let J=i.moleculeGraph.getRelationEntries({downstreamMoleculeKey:p.stringKey});if(J)for(let[X,{source:Y}]of J)if(Y===p.stringKey){let R=Wo(X);oc(i,R)}else x.push(Y);let F=f.moleculeData.getRelatedKeys(p.stringKey);if(F)for(let X of F){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.on.moleculeDisposal.next(m);f.molecules.delete(p.stringKey);let A=_4(new Error);i.disposalTraces.add({key:n,trace:A})}function rc(i,o,n,p){let c=Fi(n),x=B(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=Fi(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 $=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 J={type:"molecule_transfer",key:T.key,from:$,to:[f.key]};if(Zi(x)&&x.transactionMeta.phase==="building")x.transactionMeta.update.updates.push(J);return n}function o$(i,o,n){switch(o){case"newValue":{C4(i,n);break}case"oldValue":{nc(n,i.token);break}}}function n$(i,o,n){switch(o){case"newValue":{nc(n,i.token);break}case"oldValue":{if(C4(i,n),i.subType==="atom")n.valueMap.set(i.token.key,i.value);break}}}function C4(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 D4(i,o,n){switch(o){case"newValue":ic(n,i.provenance,i.key);break;case"oldValue":oc(n,i.key);break}}function B4(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}(${Fi(i.key)})`;n.valueMap.set(m,x)}}}break}}function I4(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":o$(c,i,n);break;case"state_disposal":n$(c,i,n);break;case"molecule_creation":D4(c,i,n);break;case"molecule_disposal":B4(c,i,n);break;case"molecule_transfer":I4(c,i,n);break;case"transaction_update":qm(i,c,n);break}}function p$(i,o){return i.transactionMeta.actionContinuities.getRelatedKey(o)}function MU(i,o){return i.transactionMeta.epoch.get(o)}function N4(i,o){if(!Ho(i))return;let p=p$(i,o);if(p===void 0)return;return MU(i,p)}function b4(i,o,n){if(Ho(i)&&o)i.transactionMeta.epoch.set(o,n)}function j4(i,o,n){if(!Ho(i))return;let c=p$(i,o);if(c!==void 0)i.transactionMeta.epoch.set(c,n)}var a4=(i,o)=>{let n=B(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))j4(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 P4(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 l4(i){return{store:i}}function ui(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 Vp(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 q4=(i,o,n,p)=>{let c=B(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:(...$)=>$.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=N4(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:(...$)=>ui(f,...$),set:(...$)=>{_i(f,...$)},run:($,J=bm())=>tc(f,$,J),find:($,J)=>t(f,$,J),json:($)=>Fo(f,$),dispose:(...$)=>{nc(f,...$)},env:()=>l4(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 c$(i,o){let n={key:o.key,type:"transaction",run:(x,T)=>{let m=q4(i,o.key,x,T);try{let f=B(i),{toolkit:$}=m.transactionMeta,J=o.do($,...x);return a4(J,f),J}catch(f){throw K4(p),i.logger.warn("\uD83D\uDCA5","transaction",o.key,"caught:",f),f}},install:(x)=>c$(x,o),subject:new Ji},p=B(i);p.transactions.set(n.key,n);let c=gn(n);return i.on.transactionCreation.next(c),c}class k4{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 Ji,atomDisposal:new Ji,selectorCreation:new Ji,selectorDisposal:new Ji,timelineCreation:new Ji,transactionCreation:new Ji,transactionApplying:new e0(null),operationClose:new Ji,moleculeCreation:new Ji,moleculeDisposal:new Ji};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new pc("warn",(i,o,n)=>!h4(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=Fo(o,p),x=Jp(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 k4({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 g4(i,o,n){let p=i.families.get(o.key);if(p===void 0)throw new ep(o,i);let c=p(n),x=B(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 s4(i,o,n){let p=Fi(n),c=`${o.key}(${p})`,x=B(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=s4(i,o,n);if(p)return p;let c=Fi(n),x=i.molecules.get(c);if(!x&&i.config.lifespan==="immortal"){let T=G4(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=g4(i,o,n),x)B(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":x$(i,n);break;case"selector":case"readonly_selector":t4(i,n);break}}var km=(i,o)=>B(i).atoms.has(o),QU=(i,o)=>B(i).selectors.has(o),SU=(i,o)=>B(i).readonlySelectors.has(o),d4=(i,o)=>km(i,o)||QU(i,o)||SU(i,o);var hm=(i,o)=>{return B(o).selectorGraph.getRelationEntries({downstreamSelectorKey:i}).filter(([p,{source:c}])=>c!==i).map(([p,{source:c}])=>c).filter((p)=>d4(o,p))};var T$=(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},r4=(i,o)=>{let n=i.key,p=hm(n,o),c=new Set;return p.flatMap((x)=>km(o,x)?x:T$(x,c,o))};var e4=(i,o,n,p)=>{let c=B(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=T$(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=B(n),x;if(p.length===2){let[f,$]=p;x=t(n,f,$)}else[x]=p;let T=Ri(n,x),m=Vp(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}),e4(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],$=p[1];x=p[2],c=t(n,f,$)}let T=B(n),m=Ri(T,c);Pm(T,m,x)},find:(p,c)=>t(n,p,c),json:(p)=>Fo(n,p)});var RT=(i,o,n)=>{let p=B(i),c=new Ji,x=new Set,{get:T,find:m,json:f}=gm(o.key,x,p),$=()=>{let X=o.get({get:T,find:m,json:f});return Wn(B(i),o.key,X,c),x.clear(),X},J={...o,subject:c,install:(X)=>RT(X,o,n),get:$,type:"readonly_selector",...n&&{family:n}};p.readonlySelectors.set(o.key,J);let F=$();i.logger.info("\u2728",J.type,J.key,"=",F);let A={key:o.key,type:"readonly_selector"};if(n)A.family=n;return A};var KT=(i,o,n)=>{let p=B(i),c=new Ji,x=new Set,T=gm(o.key,x,p),{find:m,get:f,json:$}=T,J={find:m,get:f,json:$},F=(K=o.get,H=B(i))=>{let Z=K(J);return Wn(H,o.key,Z,c),x.clear(),Z},X={...o,subject:c,install:(K)=>KT(K,o,n),get:F,set:(K)=>{let H=B(i),Z=F(o.get,H),b=am(K)(Z);if(i.logger.info("\uD83D\uDCDD","selector",o.key,"set (",Z,"->",b,")"),Wn(H,o.key,b,c),dc(H,o.key),Ho(H))c.next({newValue:b,oldValue:Z});o.set(T,b)},type:"selector",...n&&{family:n}};p.selectors.set(o.key,X);let Y=F();i.logger.info("\u2728",X.type,X.key,"=",Y);let R={key:o.key,type:"selector"};if(n)R.family=n;return R};function r0(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 t4(i,o){let n=B(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 Ji,m=Object.assign((f)=>{let $=Fi(f),J={key:o.key,subKey:$},F=`${o.key}(${$})`,A=B(i),X=KT(A,{key:F,get:o.get(f),set:o.set(f)},J);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:(...J)=>ui(i,...J),find:(J,F)=>t(i,J,F),json:(J)=>Fo(i,J)})}});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),Fi=(i)=>JSON.stringify(i),Ek=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];var o8=(i,o)=>{let n=B(i);if(n.operation.open)return n.operation.prev.get(o.key);return n.valueMap.get(o.key)};var $$=(i,o)=>{let n=B(i);return r4(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=Vp(n,o);i.logger.info("\u2728",o.type,o.key,"went",m,"->",f),o.subject.next({newValue:f,oldValue:m})})})};function Oo(i,o,n,p){function c(F){if(i.operation.open){let A=i.on.operationClose.subscribe(`state subscription ${n}`,()=>{A(),p(F)})}else p(F)}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=$$(i,x),f=(F)=>{if(m)m.length=0,m.push(...$$(i,x));c(F)};let $=x.subject.subscribe(n,f);return()=>{if(i.logger.info("\uD83D\uDE48",x.type,x.key,`Removing subscription "${n}"`),$(),m)for(let F of m)F()}}var m$=(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 f$=(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=ui(n,i);this.unsubscribeFromInnerValue=c.subscribe(p,(x)=>{_i(n,o,x)}),this.unsubscribeFromState=Oo(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}`;Oo(n,o,p,({newValue:c,oldValue:x})=>{let T=n.timelineTopics.getRelatedKey(o.key);if(T){if(n.timelines.get(T)?.timeTraveling){let $=m$(n,{key:T,type:"timeline"},p,(J)=>{$(),_i(n,i,(F)=>{if(J==="redo"&&c)F.do(c);else if(J==="undo"&&x)F.undo(x);return F})});return}}let m=n.on.operationClose.subscribe(p,()=>{m();let f=ui(n,i),$=c===null?-1:f.getUpdateNumber(c),J=$-f.cacheUpdateNumber;if(c&&J===1)_i(n,i,(F)=>(F.do(c),F));else n.logger.info("\u274C","mutable_atom",i.key,`could not be updated. Expected update number ${f.cacheUpdateNumber+1}, but got ${$}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor(i,o){this.mutableState=i;let n=B(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=B(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 Ji,T={...o,type:"mutable_atom",install:($)=>{return $.logger.info("\uD83D\uDEE0\uFE0F","atom",o.key,`installing in store "${$.config.name}"`),HT($,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 $=0,J=[];for(let F of o.effects){let A=F({setSelf:(X)=>{_i(i,f,X)},onSet:(X)=>Oo(i,f,`effect[${$}]`,X)});if(A)J.push(A);++$}T.cleanup=()=>{for(let F of J)F()}}if(new cc(f,i),!n)W4(f,o,i);return f}class J${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 Ji,m=Object.assign((f)=>{let $=Fi(f),J={key:o.key,subKey:$},F=`${o.key}(${$})`,A=B(i),X={key:F,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,J);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 J$(m,i),p}var F$=(i,o)=>{let n=B(o),p=`${i.key}:JSON`;return n.families.get(p)};var Fo=(i,o)=>{if(o.family){let p=B(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 Jp=(i)=>{let n={type:"atom",key:`*${i.key}`};if(i.family)n.family={key:`*${i.family.key}`,subKey:i.family.subKey};return n};function S4(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 H4=(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},M4=(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 V4=(i,o)=>{return B(i).atomsThatAreDefault.has(o)},sm=(i,o)=>{let n=B(i);n.atomsThatAreDefault=new Set(n.atomsThatAreDefault).add(o)},E4=(i,o)=>{let n=B(i);n.atomsThatAreDefault=new Set(B(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=B(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 Ji,T={...o,type:"atom",install:($)=>{return $.logger.info("\uD83D\uDEE0\uFE0F","atom",o.key,`installing in store "${$.config.name}"`),rp($,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 $=0,J=[];for(let F of o.effects){let A=F({setSelf:(X)=>{_i(i,f,X)},onSet:(X)=>Oo(i,f,`effect[${$}]`,X)});if(A)J.push(A);++$}T.cleanup=()=>{for(let F of J)F()}}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 x$(i,o){let n=B(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 $=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 J=Jp(o);x$(i,J),i.trackers.delete(p)}if(i.logger.info("\uD83D\uDD25","atom",p,"deleted"),$&&n.transactionMeta.phase==="building"){let J=n.transactionMeta.update.updates.at(-1);if(!(J?.type==="molecule_disposal"&&J.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 Ji;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:${Fi(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:${Fi(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 $=this.cache[this.cacheIdx];if(this.cacheIdx--,!$)return"OUT_OF_RANGE";this.undo($),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 A$(n),this.options=i,this.defaultContent=o,this.store.miscResources.set(`join:${i.key}`,this),this.realm.allocate("root",i.key),this.toolkit={get:(...u)=>ui(n,...u),set:(...u)=>{_i(n,...u)},find:(...u)=>t(n,...u),json:(u)=>Fo(n,u)};let p=i.between[0],c=i.between[1],x=WT(n,{key:`${i.key}/relatedKeys`,default:()=>new vo,mutable:!0,fromJson:(u)=>vo.fromJSON(u),toJson:(u)=>u.toJSON()},["join","relations"]);this.core={relatedKeysAtoms:x};let T=({get:u},M)=>u(x,M),m=({set:u},M,E)=>{if(!this.store.molecules.has(Fi(M)))this.realm.allocate(i.key,M);u(x,M,(V)=>V.add(E)),u(x,E,(V)=>V.add(M))},f=({set:u},M,E)=>{u(x,M,(V)=>{return V.delete(E),V}),u(x,E,(V)=>{return V.delete(M),V})},$=(u,M,E)=>{let{find:V,get:C,set:l}=u,Q=V(x,M),Ti=C(Q);for(let q of Ti){if(E.includes(q))continue;l(x,q,(Ei)=>{return Ei.delete(M),Ei})}l(Q,(q)=>{return q.transaction((mi)=>{mi.clear();for(let Ei of E){let To=T(u,Ei),lo=To.has(M);if(this.relations.cardinality==="1:n"){let ip=[];for(let O of To){if(O===M)continue;let k=T(u,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(M);mi.add(Ei)}return!0}),q})},J=(u,M,E)=>{let{set:V}=u;V(x,M,(C)=>{return C.transaction((l)=>{for(let Q of E)l.add(Q);return!0}),C});for(let C of E)V(x,C,(l)=>{return l.add(M),l});return!0},F=(u,M,E)=>{let V=T(u,M);return E?V.has(E):V.size>0},A={getRelatedKeys:(u)=>T(this.toolkit,u),addRelation:(u,M)=>{this.store.moleculeJoins.set(u,i.key),this.store.moleculeJoins.set(M,i.key),m(this.toolkit,u,M)},deleteRelation:(u,M)=>{f(this.toolkit,u,M)},replaceRelationsSafely:(u,M)=>{$(this.toolkit,u,M)},replaceRelationsUnsafely:(u,M)=>{J(this.toolkit,u,M)},has:(u,M)=>F(this.toolkit,u,M)},X,Y;if(o){Y=dp(n,{key:`${i.key}/content`,default:o},["join","content"]);let u=({get:V},C)=>V(Y,C),M=({set:V},C,l)=>{V(Y,C,l)};X=Object.assign(A,{getContent:(V)=>{return u(this.toolkit,V)},setContent:(V,C)=>{M(this.toolkit,V,C)},deleteContent:(V)=>{this.realm.deallocate(V)}})}else X=A;let R=new Ao(i,{externalStore:X,isAType:i.isAType,isBType:i.isBType,makeContentKey:(...u)=>{let[M,E]=u,V=u.sort(),C=`${V[0]}:${V[1]}`,l=n.molecules.get(Fi(M)),Q=n.molecules.get(Fi(E));if(!l)this.realm.allocate(i.key,M);if(!Q)this.realm.allocate(i.key,E);return this.realm.allocate(M,C,"all"),this.realm.claim(E,C),this.store.moleculeJoins.set(C,i.key),C}}),K=()=>Sp(n,{key:`${i.key}/singleRelatedKey`,get:(u)=>({get:M})=>{let E=M(x,u);for(let V of E)return V;return null}},["join","keys"]),H=()=>{return Sp(n,{key:`${i.key}/multipleRelatedKeys`,get:(u)=>({get:M})=>{let E=F$(x,n);return M(E,u).members}},["join","keys"])},Z=()=>Sp(n,{key:`${i.key}/singleRelatedEntry`,get:(u)=>({get:M})=>{let E=M(x,u);for(let V of E){let C=R.isAType?.(u)?u:void 0,l=C===void 0?u:void 0;C??=V,l??=V;let Q=R.makeContentKey(C,l),Ti=M(Y,Q);return[V,Ti]}return null}},["join","entries"]),b=()=>Sp(n,{key:`${i.key}/multipleRelatedEntries`,get:(u)=>({get:M})=>{let E=F$(x,n);return M(E,u).members.map((C)=>{let l=R.isAType?.(u)?u:void 0,Q=l===void 0?u:void 0;l??=C,Q??=C;let Ti=R.makeContentKey(l,Q),q=M(Y,Ti);return[C,q]})}},["join","entries"]);switch(i.cardinality){case"1:1":{let u=K(),M=`${p}KeyOf${Mi(c)}`,E=`${c}KeyOf${Mi(p)}`,V={[M]:u,[E]:u},C;if(o){let l=Z(),Q=`${p}EntryOf${Mi(c)}`,Ti=`${c}EntryOf${Mi(p)}`,q={[Q]:l,[Ti]:l};C=Object.assign(V,q)}else C=V;this.relations=R,this.states=C;break}case"1:n":{let u=K(),M=H(),E=`${p}KeyOf${Mi(c)}`,V=`${c}KeysOf${Mi(p)}`,C={[E]:u,[V]:M},l;if(o){let Q=Z(),Ti=b(),q=`${p}EntryOf${Mi(c)}`,mi=`${c}EntriesOf${Mi(p)}`,Ei={[q]:Q,[mi]:Ti};l=Object.assign(C,Ei)}else l=C;this.relations=R,this.states=l;break}case"n:n":{let u=H(),M=`${p}KeysOf${Mi(c)}`,E=`${c}KeysOf${Mi(p)}`,V={[M]:u,[E]:u},C;if(o){let l=b(),Q=`${p}EntriesOf${Mi(c)}`,Ti=`${c}EntriesOf${Mi(p)}`,q={[Q]:l,[Ti]:l};C=Object.assign(V,q)}else C=V;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=B(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${Mi(i.b)}`,T=`${i.b}KeyOf${Mi(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${Mi(i.b)}`;if(m in p.states){let f=`${i.b}EntryOf${Mi(i.a)}`;Object.assign(c,{get[m](){let $=p.states[m];return t(n,$,o)},get[f](){let $=p.states[f];return t(n,$,o)}})}break}case"1:n":{let x=`${i.a}KeyOf${Mi(i.b)}`,T=`${i.b}KeysOf${Mi(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${Mi(i.b)}`;if(m in p.states){let f=`${i.b}EntriesOf${Mi(i.a)}`;Object.assign(c,{get[m](){let $=p.states[m];return t(n,$,o)},get[f](){let $=p.states[f];return t(n,$,o)}})}break}case"n:n":{let x=`${i.a}KeysOf${Mi(i.b)}`,T=`${i.b}KeysOf${Mi(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${Mi(i.b)}`;if(m in p.states){let f=`${i.b}EntriesOf${Mi(i.a)}`;Object.assign(c,{get[m](){let $=p.states[m];return t(n,$,o)},get[f](){let $=p.states[f];return t(n,$,o)}})}}}return c}function p8(i,o){return ec(i,o).core.relatedKeysAtoms}function h4(i){return i.startsWith("\uD83D\uDD0D ")}function Op(i){return n8(d.STORE,i)}function xc(i){return R4(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 v$=(i)=>(o,n,p,c,...x)=>{console[i](`${o} ${n} "${p}" ${c}`,...x)},VU={error:v$("error"),info:v$("info"),warn:v$("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 rs=Symbol("claim");class x8{store;constructor(i=d.STORE){this.store=i,y4("root",i)}allocate(i,o,n){return ic(this.store,i,o,n)}fuse(i,o,n){return L4(this.store,i,o,n)}deallocate(i){oc(this.store,i)}claim(i,o,n){return rc(this.store,i,o,n)}}class A${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 Y4(d.STORE,i)}function Tc(i){return c$(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)P4(d.STORE,o,x.key);return b4(d.STORE,o,-1),p}var ft=Op({key:"usersInRoomIndex",mutable:!0,default:()=>new vo,toJson:(i)=>i.toJSON(),fromJson:(i)=>vo.fromJSON(i)}),w$=Op({key:"roomIndex",default:()=>new vo,mutable:!0,toJson:(i)=>i.toJSON(),fromJson:(i)=>vo.fromJSON(i)}),EU={enteredAtEpoch:0},zT=tm({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:(i)=>typeof i==="string",isBType:(i)=>typeof i==="string"},EU),$t=dm({key:"usersInMyRoomView",get:(i)=>({find:o})=>{let n=c8(zT);return[o(n,i)]}});import{spawn as OU}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 uT 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 Ji,this.out=new Ji,this.in.subscribe("socket",(o)=>{this.handleEvent(...o)})}dispose(){for(let i of this.disposalFunctions)i()}}class X$ extends ox{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...i){this.process.stderr.write(Fi(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 W$=xc({key:"roomArguments",default:["echo",["Hello World!"]]}),$8=dm({key:"room",get:(i)=>async({get:o,find:n})=>{let p=n(W$,i),c=o(p),[x,T]=c,m=await new Promise((f)=>{let $=OU(x,T,{env:process.env}),J=(F)=>{if(F.toString()==="ALIVE")$.stdout.off("data",J),f($)};$.stdout.on("data",J)});return new uT(m,i)}});var Dt=Tc({key:"createRoom",do:({get:i,set:o,find:n},p,c,x)=>{let T=x?[c,x]:[c],m=n(W$,p);o(m,T),o(w$,(J)=>J.add(p));let f=n($8,p);return i(f)}}),Bt=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)}}),Nt=Tc({key:"destroyRoom",do:(i,o)=>{Ep(zT,(n)=>{n.delete({room:o})},i.env().store),i.set(w$,(n)=>(n.delete(o),n))}});function R$(i,o){return o.map((n)=>{switch(n.type){case"transaction_update":{let p=R$(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 at=xc({key:"redactor",default:{occlude:(i)=>i}}),nx=xc({key:"unacknowledgedUpdates",default:()=>[]});var em=xc({key:"sockets",default:null}),Y$=Op({key:"socketsIndex",mutable:!0,default:()=>new vo,toJson:(i)=>i.toJSON(),fromJson:(i)=>vo.fromJSON(i)}),G$=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 J8(i,o,n,p){let c=o.key;return function x(){let T=[];for(let f of o.globals){let $=f.type==="mutable_atom"?Fo(i,f):f,J=ui(i,$);T.push($,J)}for(let f of o.perspectives){let{viewAtoms:$,resourceAtoms:J}=f,F=t(i,$,n),A=ui(i,F);i.logger.info("\uD83D\uDC41","atom",J.key,`${n} can see`,{viewAtoms:$,resourceAtoms:J,userView:A});for(let X of A){let Y=X.type==="mutable_atom"?Fo(i,X):X,R=ui(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 F8(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}:start`,J=`${f}:end`;performance.mark($);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(J);let F=performance.measure(f,$,J);i?.logger.info("\uD83D\uDE80","transaction",T,m,n,F.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=f$(i,T,`sync-continuity:${c}:${n}`,(f)=>{try{let $=o.globals.map((A)=>{if(A.type==="atom")return A.key;return Jp(A).key}).concat(o.perspectives.flatMap((A)=>{let{viewAtoms:X}=A,Y=t(i,X,n);return ui(i,Y).map((K)=>{return K.type==="mutable_atom"?"*"+K.key:K.key})})),J=R$($,f.updates),F={...f,updates:J};_i(i,nx,n,(A)=>{if(F)A.push(F),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}`,F)}catch($){if($ instanceof Error)i.logger.error("\u274C","continuity",c,`${n} failed to send update from transaction ${T.key} to ${n}`,$.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),$=Oo(i,f,`sync-continuity:${c}:${n}:perspective:${T.resourceAtoms.key}`,({oldValue:J,newValue:F})=>{let A=J.map((K)=>K.key),X=F.map((K)=>K.key),Y=J.filter((K)=>!X.includes(K.key)),R=F.filter((K)=>!A.includes(K.key)).flatMap((K)=>{let H=K.type==="mutable_atom"?Fo(i,K):K,Z=ui(i,H);return[H,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($)}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=ui(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,$=Oo(o,f,`sync-continuity:${x}:${m}`,({newValue:H})=>{if(o.logger.info("\uD83D\uDC4B","continuity",x,`seeing ${m} on new socket ${H}`),H===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,H);c=ui(o,Z);for(let u of J)c?.emit(`tx-new:${x}`,u)}),J=ui(o,nx,m),F=[],A=w8(o,p,m,c),X=v8(o,p,m,c);F.push(...A,...X);let Y=J8(o,p,m,i);c.off(`get:${x}`,Y),c.on(`get:${x}`,Y);let R=F8(o,p,m);c.off(`tx-run:${x}`,R),c.on(`tx-run:${x}`,R);let K=A8(o,p,m,J);return c?.on(`ack:${x}`,K),()=>{for(let H of F)H();c?.off(`ack:${x}`,K),c?.off(`get:${x}`,Y),c?.off(`tx-run:${x}`,R)}}}var BY=C1(nJ(),1);var w=Symbol.for("drizzle:entityKind"),ed=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 yi{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 pJ{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 cJ{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 Yf(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,$]=w3(i,p+1,!0);n.push(f),p=$;continue}if(x==="}")return[n,p+1];if(x==="{"){let[f,$]=X3(i,p+1);n.push(f),p=$;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 xJ(i){return`{${i.map((o)=>{if(Array.isArray(o))return xJ(o);if(typeof o==="string")return`"${o.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${o}`}).join(",")}}`}class j extends pJ{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 Yf((c,x)=>{let T=new cJ(()=>{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 yi{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 TJ(i,this.config,o)}}class TJ 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,TJ)?this.baseColumn.mapToDriverValue(p,!0):this.baseColumn.mapToDriverValue(p));if(o)return n;return xJ(n)}}var mJ=Symbol.for("drizzle:isPgEnum");function G3(i){return!!i&&typeof i==="function"&&mJ in i&&i[mJ]===!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 Gf(i,o){return tu(i,o,void 0)}function tu(i,o,n){let p=Object.assign((c)=>new K3(c??"",p),{enumName:i,enumValues:o,schema:n,[mJ]:!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 BT extends wo{static[w]="WithSubquery"}var U3="0.41.0";var fJ,$J,Li={startActiveSpan(i,o){if(!fJ)return o();if(!$J)$J=fJ.trace.getTracer("drizzle-orm",U3);return Yf((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()}}),fJ,$J)}};var Ni=Symbol.for("drizzle:ViewBaseConfig");var Kf=Symbol.for("drizzle:Schema"),Hf=Symbol.for("drizzle:Columns"),z3=Symbol.for("drizzle:ExtraConfigColumns"),JJ=Symbol.for("drizzle:OriginalName"),FJ=Symbol.for("drizzle:BaseName"),IT=Symbol.for("drizzle:IsAlias"),u3=Symbol.for("drizzle:ExtraConfigBuilder"),du=Symbol.for("drizzle:IsDrizzleTable");class I{static[w]="Table";static Symbol={Name:Dn,Schema:Kf,OriginalName:JJ,Columns:Hf,ExtraConfigColumns:z3,BaseName:FJ,IsAlias:IT,ExtraConfigBuilder:u3};[Dn];[JJ];[Kf];[Hf];[z3];[FJ];[IT]=!1;[du]=!0;[u3]=void 0;constructor(i,o,n){this[Dn]=this[JJ]=i,this[Kf]=o,this[FJ]=n}}function Ro(i){return i[Dn]}function vc(i){return`${i[Kf]??"public"}.${i[Dn]}`}function AJ(i){return i!==null&&i!==void 0&&typeof i.getSQL==="function"}function ru(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=M3;shouldInlineParams=!1;append(i){return this.queryChunks.push(...i.queryChunks),this}toQuery(i){return Li.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 ru(i.map(($)=>{if(z($,Xo))return{sql:$.value.join(""),params:[]};if(z($,Uf))return{sql:c($.value),params:[]};if($===void 0)return{sql:"",params:[]};if(Array.isArray($)){let J=[new Xo("(")];for(let[F,A]of $.entries())if(J.push(A),F<$.length-1)J.push(new Xo(", "));return J.push(new Xo(")")),this.buildQueryFromSourceParams(J,n)}if(z($,N))return this.buildQueryFromSourceParams($.queryChunks,{...n,inlineParams:m||$.shouldInlineParams});if(z($,I)){let J=$[I.Symbol.Schema],F=$[I.Symbol.Name];return{sql:J===void 0||$[IT]?c(F):c(J)+"."+c(F),params:[]}}if(z($,yi)){let J=p.getColumnCasing($);if(o.invokeSource==="indexes")return{sql:c(J),params:[]};let F=$.table[I.Symbol.Schema];return{sql:$.table[IT]||F===void 0?c($.table[I.Symbol.Name])+"."+c(J):c(F)+"."+c($.table[I.Symbol.Name])+"."+c(J),params:[]}}if(z($,ro)){let J=$[Ni].schema,F=$[Ni].name;return{sql:J===void 0||$[Ni].isAlias?c(F):c(J)+"."+c(F),params:[]}}if(z($,Tn)){if(z($.value,Bp))return{sql:x(f.value++,$),params:[$],typings:["none"]};let J=$.value===null?null:$.encoder.mapToDriverValue($.value);if(z(J,N))return this.buildQueryFromSourceParams([J],n);if(m)return{sql:this.mapInlineParam(J,n),params:[]};let F=["none"];if(T)F=[T($.encoder)];return{sql:x(f.value++,J),params:[J],typings:F}}if(z($,Bp))return{sql:x(f.value++,$),params:[$],typings:["none"]};if(z($,N.Aliased)&&$.fieldAlias!==void 0)return{sql:c($.fieldAlias),params:[]};if(z($,wo)){if($._.isWith)return{sql:c($._.alias),params:[]};return this.buildQueryFromSourceParams([new Xo("("),$._.sql,new Xo(") "),new Uf($._.alias)],n)}if(G3($)){if($.schema)return{sql:c($.schema)+"."+c($.enumName),params:[]};return{sql:c($.enumName),params:[]}}if(AJ($)){if($.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([$.getSQL()],n);return this.buildQueryFromSourceParams([new Xo("("),$.getSQL(),new Xo(")")],n)}if(m)return{sql:this.mapInlineParam($,n),params:[]};return{sql:x(f.value++,$),params:[$],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 Uf{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 M3={mapFromDriverValue:(i)=>i},Q3={mapToDriverValue:(i)=>i},jr={...M3,...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,$){let J=[];for(let[F,A]of f.entries()){if(F>0&&$!==void 0)J.push($);J.push(A)}return new N(J)}i.join=c;function x(f){return new Uf(f)}i.identifier=x;function T(f){return new Bp(f)}i.placeholder=T;function m(f,$){return new Tn(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 Bp{constructor(i){this.name=i}static[w]="Placeholder";getSQL(){return new N([this])}}function vJ(i,o){return i.map((n)=>{if(z(n,Bp)){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,Bp)){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 eu=Symbol.for("drizzle:IsDrizzleView");class ro{static[w]="View";[Ni];[eu]=!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])}}yi.prototype.getSQL=function(){return new N([this])};I.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===I.Symbol.IsAlias)return!0;if(o===I.Symbol.Name)return this.alias;if(this.replaceOriginalName&&o===I.Symbol.OriginalName)return this.alias;if(o===Ni)return{...i[Ni],name:this.alias,isAlias:!0};if(o===I.Symbol.Columns){let p=i[I.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,yi))return new Proxy(n,new Xx(new Proxy(i,this)));return n}}function zf(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 wJ(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,yi))return tn(n,o);if(z(n,N))return bT(n,o);if(z(n,N.Aliased))return wJ(n,o);return n}))}class uf extends Error{static[w]="DrizzleError";constructor({message:i,cause:o}){super(i);this.name="DrizzleError",this.cause=o}}class XJ extends uf{static[w]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}function eo(i,o){if(Z3(o)&&!AJ(i)&&!z(i,Tn)&&!z(i,Bp)&&!z(i,yi)&&!z(i,I)&&!z(i,ro))return new Tn(i,o);return i}var dn=(i,o)=>{return W`${i} = ${eo(o,i)}`},S3=(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 V3(...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 Zf=(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)}`},y3=(i,o)=>{return W`${i} <= ${eo(o,i)}`};function L3(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 C3(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 B3(i){return W`${i} is not null`}function I3(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 a3(i,o){return W`${i} like ${o}`}function P3(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 WJ{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 RJ{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 $;if(z(m,yi))$=m;else if(z(m,N))$=m.decoder;else $=m.sql.decoder;let J=x;for(let[F,A]of T.entries())if(F<T.length-1){if(!(A in J))J[A]={};J=J[A]}else{let X=o[f],Y=J[A]=X===null?null:$.mapFromDriverValue(X);if(n&&z(m,yi)&&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,yi)||z(c,N)||z(c,N.Aliased))n.push({path:x,field:c});else if(z(c,I))n.push(...Un(c[I.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 Mf(i,o){let n=Object.entries(o).filter(([,p])=>p!==void 0).map(([p,c])=>{if(z(c,N)||z(c,yi))return[p,c];else return[p,new Tn(c,i[I.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[I.Symbol.Columns]}function Ap(i){return z(i,wo)?i._.alias:z(i,ro)?i[Ni].name:z(i,N)?void 0:i[I.Symbol.IsAlias]?i[I.Symbol.Name]:i[I.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 Ip 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 Ip{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 Ip{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 $X extends j{static[w]="PgBooleanBuilder";constructor(i){super(i,"boolean","PgBoolean")}build(i){return new JX(i,this.config)}}class JX extends _{static[w]="PgBoolean";getSQLType(){return"boolean"}}function aT(i){return new $X(i??"")}class FX 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 FX(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 Qf(i,this.config)}}class Qf 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 Sf(i,this.config)}}class Sf 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 uX(i,this.config)}}class uX 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 MX 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 SX(i){return new MX(i??"")}class VX extends Ip{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 Vf(i){return new VX(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 yX(i,o={}){let{name:n,config:p}=vi(i,o);return new OX(n,p)}class LX extends j{static[w]="PgJsonBuilder";constructor(i){super(i,"json","PgJson")}build(i){return new Ef(i,this.config)}}class Ef 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 CX(i){return new LX(i??"")}class DX extends j{static[w]="PgJsonbBuilder";constructor(i){super(i,"json","PgJsonb")}build(i){return new Of(i,this.config)}}class Of 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 BX(i){return new DX(i??"")}class IX 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 aX(i,o){let{name:n,config:p}=vi(i,o);if(!p?.mode||p.mode==="tuple")return new IX(n);return new bX(n)}class PX 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 PX(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 _f(i,this.config)}}class _f 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 iZ(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 YJ(i){let o=iZ(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 YJ(i)}mapToDriverValue(i){return`point(${i[0]} ${i[1]})`}}class $7 extends j{static[w]="PgGeometryObjectBuilder";constructor(i){super(i,"json","PgGeometryObject")}build(i){return new J7(i,this.config)}}class J7 extends _{static[w]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(i){let o=YJ(i);return{x:o[0],y:o[1]}}mapToDriverValue(i){return`point(${i.x} ${i.y})`}}function F7(i,o){let{name:n,config:p}=vi(i,o);if(!p?.mode||p.mode==="tuple")return new m7(n);return new $7(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 Ip{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 u7 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 M7(i,o={}){let{name:n,config:p}=vi(i,o);return new u7(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 yf(i,this.config)}}class yf 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 S7(i,o={}){let{name:n,config:p}=vi(i,o);return new Q7(n,p.withTimezone??!1,p.precision)}class V7 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 Lf(i,this.config)}}class Lf 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 Cf(i,this.config)}}class Cf 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 Bn(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 V7(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 Df(i,this.config)}}class Df 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 y7(i,this.config)}}class y7 extends _{static[w]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function zo(i,o={}){let{name:n,config:p}=vi(i,o);return new _7(n,p)}class L7 extends j{static[w]="PgBinaryVectorBuilder";constructor(i,o){super(i,"string","PgBinaryVector");this.config.dimensions=o.dimensions}build(i){return new C7(i,this.config)}}class C7 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 L7(n,p)}class B7 extends j{static[w]="PgHalfVectorBuilder";constructor(i,o){super(i,"array","PgHalfVector");this.config.dimensions=o.dimensions}build(i){return new I7(i,this.config)}}class I7 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 B7(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 a7(i,o){let{name:n,config:p}=vi(i,o);return new b7(n,p)}class P7 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 P7(n,p)}function k7(){return{bigint:pX,bigserial:fX,boolean:aT,char:vX,cidr:WX,customType:GX,date:UX,doublePrecision:ZX,inet:SX,integer:Vf,interval:yX,json:CX,jsonb:BX,line:aX,macaddr:qX,macaddr8:gX,numeric:i7,point:x7,geometry:F7,real:w7,serial:R7,smallint:K7,smallserial:z7,text:M7,time:S7,timestamp:Bn,uuid:mn,varchar:zo,bit:D7,halfvec:N7,sparsevec:a7,vector:q7}}var GJ=Symbol.for("drizzle:PgInlineForeignKeys"),h7=Symbol.for("drizzle:EnableRLS");class uo extends I{static[w]="PgTable";static Symbol=Object.assign({},I.Symbol,{InlineForeignKeys:GJ,EnableRLS:h7});[GJ]=[];[h7]=!1;[I.Symbol.ExtraConfigBuilder]=void 0;[I.Symbol.ExtraConfigColumns]={}}function oZ(i,o,n,p,c=i){let x=new uo(i,p,c),T=typeof o==="function"?o(k7()):o,m=Object.fromEntries(Object.entries(T).map(([J,F])=>{let A=F;A.setName(J);let X=A.build(x);return x[GJ].push(...A.buildForeignKeys(X,x)),[J,X]})),f=Object.fromEntries(Object.entries(T).map(([J,F])=>{let A=F;A.setName(J);let X=A.buildExtraConfigColumn(x);return[J,X]})),$=Object.assign(x,m);if($[I.Symbol.Columns]=m,$[I.Symbol.ExtraConfigColumns]=f,n)$[uo.Symbol.ExtraConfigBuilder]=n;return Object.assign($,{enableRLS:()=>{return $[uo.Symbol.EnableRLS]=!0,$}})}var Np=(i,o,n)=>{return oZ(i,o,n,void 0)};function g7(...i){if(i[0].columns)return new PT(i[0].columns,i[0].name);return new PT(i)}class PT{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[uo.Symbol.Name]}_${this.columns.map((i)=>i.name).join("_")}_pk`}}class KJ{constructor(i,o,n){this.sourceTable=i,this.referencedTable=o,this.relationName=n,this.referencedTableName=o[I.Symbol.Name]}static[w]="Relation";referencedTableName;fieldName}class t7{constructor(i,o){this.table=i,this.config=o}static[w]="Relations"}class bp extends KJ{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 KJ{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:I3,gt:Zf,gte:O3,ilike:l3,inArray:L3,isNull:D3,isNotNull:B3,like:a3,lt:_3,lte:y3,ne:S3,not:E3,notBetween:j3,notExists:N3,notLike:P3,notIlike:q3,notInArray:C3,or:V3,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,I))i=i.default;let n={},p={},c={};for(let[x,T]of Object.entries(i))if(z(T,I)){let m=vc(T),f=p[m];n[m]=x,c[x]={tsName:x,dbName:T[I.Symbol.Name],schema:T[I.Symbol.Schema],columns:T[I.Symbol.Columns],relations:f?.relations??{},primaryKey:f?.primaryKey??[]};for(let J of Object.values(T[I.Symbol.Columns]))if(J.primary)c[x].primaryKey.push(J);let $=T[I.Symbol.ExtraConfigBuilder]?.(T[I.Symbol.ExtraConfigColumns]);if($){for(let J of Object.values($))if(z(J,PT))c[x].primaryKey.push(...J.columns)}}else if(z(T,t7)){let m=vc(T.table),f=n[m],$=T.config(o(T.table)),J;for(let[F,A]of Object.entries($))if(f){let X=c[f];if(X.relations[F]=A,J)X.primaryKey.push(...J)}else{if(!(m in p))p[m]={relations:{},primaryKey:J};p[m].relations[F]=A}}return{tables:c,tableNamesMap:n}}function nZ(i){return function o(n,p){return new bp(i,n,p,p?.fields.reduce((c,x)=>c&&x.notNull,!0)??!1)}}function pZ(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[I.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[I.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[I.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:nZ(i),many:pZ(i)}}function Bf(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],$=n[T],J=typeof $==="string"?JSON.parse($):$;x[m.tsKey]=z(f,bp)?J&&Bf(i,i[m.relationTableTsKey],J,m.selection,c):J.map((F)=>Bf(i,i[m.relationTableTsKey],F,m.selection,c))}else{let f=c(n[T]),$=m.field,J;if(z($,yi))J=$;else if(z($,N))J=$.decoder;else J=$.sql.decoder;x[m.tsKey]=f===null?null:J.mapFromDriverValue(f)}return x}var PR=C1(aR(),1),{Server:lR,Namespace:api,Socket:Ppi}=PR.default;import{readFileSync as hR}from"fs";import{resolve as XF}from"path";function eV(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},$=eV(f,o),J=i.onValidationError??((Z)=>{throw console.error("\u274C Invalid environment variables:",Z),new Error("Invalid environment variables")}),F=i.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if($.issues)return J($.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($.value,R);return new Proxy(K,{get(Z,b){if(typeof b!=="string")return;if(Y(b))return;if(!X(b))return F(b);return Reflect.get(Z,b)}})}var iE="__vite_start_time"in globalThis,oE=typeof window!=="undefined",gpi="vitest"in globalThis,Rp=po("string"),kR=po('"true" | "false" | undefined'),io=qR({isServer:!iE&&!oE,server:{CI:po("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),po("string[]")),OPENAI_API_KEY:po("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=XF(import.meta.dirname,"../dev"),WF=io.VITE_USE_SELF_SIGNED_CERTIFICATE?{cert:hR(XF(gR,"./cert.pem"),"utf-8"),key:hR(XF(gR,"./key.pem"),"utf-8")}:void 0;var qp=new X$,xi=io.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 nE}from"child_process";import{resolve as pE}from"path";function RF(i,o,n=i.logger){let p=io.RUN_WORKERS_FROM_SOURCE?"ts":"js",c=o.endsWith(".bun")?"bun":"node",T=[pE(import.meta.dir,`${o}.${p}`)];if(c==="node"&&p==="ts")T.push("--experimental-strip-types");let m=nE(c,T);return new uT(m,o,n)}var sR=C1(nJ(),1);var cE=604800000,J1=(()=>{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>cE)p.delete(x);if(p.size===0)i.delete(n)}});o.start(),process.on("exit",()=>{o.stop(),xi.info("\uD83D\uDEEC autoExpiry stopped")})}return i})();import tE from"path";import SE from"os";import VE from"fs";var F1=new Map,YF=new Map,GF=Symbol("OriginError"),Ex={};class Mn 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[GF]=this.handler.debug?new Error:this.tagged&&xE(this.strings)}get origin(){return(this.handler.debug?this[GF].stack:this.tagged&&YF.has(this.strings)?YF.get(this.strings):YF.set(this.strings,this[GF].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 xE(i){if(F1.has(i))return F1.get(i);let o=Error.stackTraceLimit;return Error.stackTraceLimit=4,F1.set(i,new Error),Error.stackTraceLimit=o,F1.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 TE={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 w1{then(){KF()}catch(){KF()}finally(){KF()}}class om extends w1{constructor(i){super();this.value=R1(i)}}class en extends w1{constructor(i,o,n){super();this.value=i,this.type=o,this.array=n}}class X1 extends w1{constructor(i,o){super();this.first=i,this.rest=o}build(i,o,n,p){let c=mE.map(([x,T])=>({fn:T,i:i.search(x)})).sort((x,T)=>x.i-T.i).pop();return c.i===-1?ZF(this.first,p):c.fn(this.first,this.rest,o,n,p)}}function W1(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||v1(i.value)]||i.type||pY(i.value):i.type):(o.push(i),v1(i)))}var oY=xY(TE);function zF(i,o,n,p,c,x){for(let T=1;T<i.strings.length;T++)o+=uF(o,n,p,c,x)+i.strings[T],n=i.args[T];return o}function uF(i,o,n,p,c){return o instanceof X1?o.build(i,n,p,c):o instanceof Mn?UF(o,n,p,c):o instanceof om?o.value:o&&o[0]instanceof Mn?o.reduce((x,T)=>x+" "+UF(T,n,p,c),""):W1(o,n,p,c)}function UF(i,o,n,p){return i.fragment=!0,zF(i,i.strings[0],i.args[0],o,n,p)}function nY(i,o,n,p,c){return i.map((x)=>"("+p.map((T)=>uF("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 A1(i,o,n,p,c){if(typeof i==="string"&&(i=[i].concat(o)),Array.isArray(i))return ZF(i,c);let x;return(o.length?o.flat():Object.keys(i)).map((m)=>{return x=i[m],(x instanceof Mn?UF(x,n,p,c):x instanceof om?x.value:W1(x,n,p,c))+" as "+R1(c.transform.column.to?c.transform.column.to(m):m)}).join(",")}var mE=Object.entries({values:iY,in:(...i)=>{let o=iY(...i);return o==="()"?"(null)":o},select:A1,as:A1,returning:A1,"\\(":A1,update(i,o,n,p,c){return(o.length?o.flat():Object.keys(i)).map((x)=>R1(c.transform.column.to?c.transform.column.to(x):x)+"="+uF("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"("+ZF(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 KF(){throw xo.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:fE,parsers:$E}=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({},fE,o.serializers),parsers:Object.assign({},$E,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 ZF(i,{transform:{column:o}}){return i.map((n)=>R1(o.to?o.to(n):n)).join(",")}var R1=function i(o){return'"'+o.replace(/"/g,'""').replace(/\./g,'"."')+'"'},v1=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},JE=/\\/g,FE=/"/g;function AE(i){return i.replace(JE,"\\\\").replace(FE,"\\\"")}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":'"'+AE(n?n(m.type?m.value:m):""+m)+'"'}).join(T)+"}"},HF={i:0,char:null,str:"",quoted:!1,last:0},mY=function i(o,n,p){return HF.i=HF.last=0,fY(HF,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},uc=(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 MF(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:MF(zc)};rT.column={to:rT};var QF={...zc};QF.column.to=rT;uc.column={from:uc};uc.value={from:MF(uc)};eT.column={to:eT};var SF={...uc};SF.column.to=eT;Zc.column={from:Zc};Zc.value={from:MF(Zc)};im.column={to:im};var VF={...Zc};VF.column.to=im;import $Y from"net";import WE from"tls";import nm from"crypto";import EF from"stream";import{performance as JY}from"perf_hooks";class Mc 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 Fn=vE;function vE(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 Bo=Buffer.allocUnsafe(256),wE="BCcDdEFfHPpQSX".split("").reduce((i,o)=>{let n=o.charCodeAt(0);return i[o]=()=>{return Bo[0]=n,Vi.i=5,Vi},i},{}),Vi=Object.assign(XE,wE,{N:String.fromCharCode(0),i:0,inc(i){return Vi.i+=i,Vi},str(i){let o=Buffer.byteLength(i);return Y1(o),Vi.i+=Bo.write(i,Vi.i,o,"utf8"),Vi},i16(i){return Y1(2),Bo.writeUInt16BE(i,Vi.i),Vi.i+=2,Vi},i32(i,o){if(o||o===0)return Bo.writeUInt32BE(i,o),Vi;return Y1(4),Bo.writeUInt32BE(i,Vi.i),Vi.i+=4,Vi},z(i){return Y1(i),Bo.fill(0,Vi.i,Vi.i+i),Vi.i+=i,Vi},raw(i){return Bo=Buffer.concat([Bo.subarray(0,Vi.i),i]),Vi.i=Bo.length,Vi},end(i=1){Bo.writeUInt32BE(Vi.i-i,i);let o=Bo.subarray(0,Vi.i);return Vi.i=0,Bo=Buffer.allocUnsafe(256),o}}),g=Vi;function Y1(i){if(Bo.length-Vi.i<i){let o=Bo,n=o.length;Bo=Buffer.allocUnsafe(n+(n>>1)+i),o.copy(Bo)}}function XE(){return Vi.i=0,Vi}var yF=vY,RE=1,kp=g().S().end(),FY=g().H().end(),YE=g().i32(8).i32(80877103).end(8),GE=Buffer.concat([g().E().str(g.N).i32(0).end(),kp]),KE=g().D().str("S").str(g.N).end(),_x=()=>{},HE=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),UE={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:$,database:J,parsers:F,transform:A,onnotice:X,onnotify:Y,onparameter:R,max_pipeline:K,keep_alive:H,backoff:Z,target_session_attrs:b}=i,u=Fn(),M=RE++,E={pid:null,secret:null},V=_F(_1,i.idle_timeout),C=_F(_1,i.max_lifetime),l=_F(lY,i.connect_timeout),Q=null,Ti,q=new Mc,mi=Buffer.alloc(0),Ei=i.fetch_types,To={},lo={},ip=Math.random().toString(36).slice(2),O=1,k=0,Yi=0,Pi=0,mo=0,$i=0,Ci=0,oo=0,qi=null,bi=null,Zo=!1,Di=null,Qn=null,Mo=null,Yp=null,fo=null,ji=null,Sn=null,an=null,L=null,Bx=null,Qo={queue:o.closed,idleTimer:V,connect(v){Mo=v||!0,xA()},terminate:Nx,execute:Ix,cancel:bY,end:_1,count:0,id:M};return o.closed&&o.closed.push(Qo),Qo;async function NY(){let v;try{v=i.socket?await Promise.resolve(i.socket(i)):new $Y.Socket}catch(G){Ec(G);return}return v.on("error",Ec),v.on("close",TA),v.on("drain",pA),v}async function bY({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 Ix(v){if(Zo)return $m(v,xo.connection("CONNECTION_DESTROYED",i));if(v.cancelled)return;try{return v.state=E,L?u.push(v):(L=v,L.active=!0),PY(v),Ko(jY(v))&&!v.describeFirst&&!v.cursorFn&&u.length<K&&(!v.options.onexecute||v.options.onexecute(Qo))}catch(G){return u.length===0&&Ko(kp),Pn(G),!0}}function jY(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),FY]):v.prepare?v.prepared?fm(v):Buffer.concat([iA(v),fm(v)]):aY(v)}function iA(v){return Buffer.concat([fA(v.statement.string,v.parameters,v.statement.types,v.statement.name),SG("S",v.statement.name)])}function fm(v){return Buffer.concat([QG(v.parameters,v.statement.types,v.statement.name,v.cursorName),v.cursorFn?$A("",v.cursorRows):GE])}function aY(v){return Buffer.concat([fA(v.statement.string,v.parameters,v.statement.types),KE,fm(v)])}function PY(v){let G=[],s=[],Gi=zF(v,v.strings[0],v.args[0],G,s,i);!v.tagged&&v.args.forEach((gi)=>W1(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(M,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 lY(){Pn(xo.connection("CONNECT_TIMEOUT",i,Q)),Q.destroy()}async function nA(){if(Ko(YE),!await new Promise((G)=>Q.once("data",(s)=>G(s[0]===83)))&&x==="prefer")return Vc();Q.removeAllListeners(),Q=WE.connect({socket:Q,servername:$Y.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",Vc),Q.on("error",Ec),Q.on("close",TA),Q.on("drain",pA)}function pA(){!L&&n(Qo)}function O1(v){if(Di){if(Di.push(v),Yi-=v.length,Yi>=0)return}mi=Di?Buffer.concat(Di,$i-Yi):mi.length===0?v:Buffer.concat([mi,v],mi.length+v.length);while(mi.length>4){if($i=mi.readUInt32BE(1),$i>=mi.length){Yi=$i-mi.length,Di=[mi];break}try{qY(mi.subarray(0,$i+1))}catch(G){L&&(L.cursorFn||L.describeFirst)&&Ko(kp),Pn(G)}mi=mi.subarray($i+1),Yi=0,Di=null}}async function cA(){if(Zo=!1,To={},Q||(Q=await NY()),!Q)return;if(l.start(),i.socket)return x?nA():Vc();if(Q.on("connect",x?nA:Vc),i.path)return Q.connect(i.path);Q.ssl=x,Q.connect($[Pi],f[Pi]),Q.host=f[Pi],Q.port=$[Pi],Pi=(Pi+1)%$.length}function xA(){setTimeout(cA,k?k+Ci-JY.now():0)}function Vc(){try{lo={},Ei=i.fetch_types,ip=Math.random().toString(36).slice(2),O=1,C.start(),Q.on("data",O1),H&&Q.setKeepAlive&&Q.setKeepAlive(!0,1000*H);let v=EG();Ko(v)}catch(v){Ec(v)}}function Ec(v){if(Qo.queue===o.connecting&&i.host[mo+1])return;Pn(v);while(u.length)$m(u.shift(),v)}function Pn(v){fo&&(fo.destroy(v),fo=null),L&&$m(L,v),Mo&&($m(Mo,v),Mo=null)}function $m(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 _1(){return Yp||(!Qo.reserved&&p(Qo),!Qo.reserved&&!Mo&&!L&&u.length===0?(Nx(),new Promise((v)=>Q&&Q.readyState!=="closed"?Q.once("close",v):v())):Yp=new Promise((v)=>Sn=v))}function Nx(){if(Zo=!0,fo||L||Mo||u.length)Ec(xo.connection("CONNECTION_DESTROYED",i));if(clearImmediate(bi),Q)Q.removeListener("data",O1),Q.removeListener("connect",Vc),Q.readyState==="open"&&Q.end(g().X().end());Sn&&(Sn(),Yp=Sn=null)}async function TA(v){if(mi=Buffer.alloc(0),Yi=0,Di=null,clearImmediate(bi),Q.removeListener("data",O1),Q.removeListener("connect",Vc),V.cancel(),C.cancel(),l.cancel(),Q.removeAllListeners(),Q=null,Mo)return xA();!v&&(L||u.length)&&Ec(xo.connection("CONNECTION_CLOSED",i,Q)),k=JY.now(),v&&i.shared.retries++,Ci=(typeof Z==="function"?Z(i.shared.retries):Z)*1000,c(Qo,xo.connection("CONNECTION_CLOSED",i,Q))}function qY(v,G=v[0]){(G===68?kY:G===100?GG:G===65?vG:G===83?hY:G===90?gY:G===67?sY:G===50?mA:G===49?tY:G===116?dY:G===84?rY:G===82?eY:G===110?xG:G===75?TG:G===69?FG:G===115?wG:G===51?XG:G===71?WG:G===78?HG:G===72?RG:G===99?KG:G===73?UG:G===86?zG:G===118?uG:G===87?YG:ZG)(v)}function kY(v){let G=7,s,Gi,gi,So=L.isRaw?new Array(L.statement.columns.length):{};for(let Io=0;Io<L.statement.columns.length;Io++)Gi=L.statement.columns[Io],s=v.readInt32BE(G),G+=4,gi=s===-1?null:L.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)),L.isRaw?So[Io]=L.isRaw===!0?gi:A.value.from?A.value.from(gi,Gi):gi:So[Gi.name]=A.value.from?A.value.from(gi,Gi):gi;L.forEachFn?L.forEachFn(A.row.from?A.row.from(So):So,q):q[oo++]=A.row.from?A.row.from(So):So}function hY(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 gY(v){if(L&&L.options.simple&&L.resolve(Qn||q),L=Qn=null,q=new Mc,l.cancel(),Mo){if(b){if(!To.in_hot_standby||!To.default_transaction_read_only)return JG();else if($G(b,To))return Nx()}if(Ei)return Mo===!0&&(Mo=null),mG();Mo!==!0&&Ix(Mo),i.shared.retries=mo=0,Mo=null;return}while(u.length&&(L=u.shift())&&(L.active=!0,L.cancelled))vY(i).cancel(L.state,L.cancelled.resolve,L.cancelled.reject);if(L)return;Qo.reserved?!Qo.reserved.release&&v[5]===73?Yp?Nx():(Qo.reserved=null,n(Qo)):Qo.reserved():Yp?Nx():n(Qo)}function sY(v){oo=0;for(let G=v.length-1;G>0;G--){if(v[G]===32&&v[G+1]<58&&q.count===null)q.count=+v.toString("utf8",G+1,v.length-1);if(v[G-1]>=65){q.command=v.toString("utf8",5,G),q.state=E;break}}if(Bx&&(Bx(),Bx=null),q.command==="BEGIN"&&T!==1&&!Qo.reserved)return Pn(xo.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(L.options.simple)return mA();if(L.cursorFn)q.count&&L.cursorFn(q),Ko(kp);L.resolve(q)}function tY(){L.parsing=!1}function mA(){!q.statement&&(q.statement=L.statement),q.columns=L.statement.columns}function dY(v){let G=v.readUInt16BE(5);for(let s=0;s<G;++s)!L.statement.types[s]&&(L.statement.types[s]=v.readUInt32BE(7+s*4));L.prepare&&(lo[L.signature]=L.statement),L.describeFirst&&!L.onlyDescribe&&(Ko(fm(L)),L.describeFirst=!1)}function rY(v){if(q.command)Qn=Qn||[q],Qn.push(q=new Mc),q.count=null,L.statement.columns=null;let G=v.readUInt16BE(5),s=7,Gi;L.statement.columns=Array(G);for(let gi=0;gi<G;++gi){Gi=s;while(v[s++]!==0);let So=v.readUInt32BE(s),Io=v.readUInt16BE(s+4),Gp=v.readUInt32BE(s+6);L.statement.columns[gi]={name:A.column.from?A.column.from(v.toString("utf8",Gi,s-1)):v.toString("utf8",Gi,s-1),parser:F[Gp],table:So,number:Io,type:Gp},s+=18}if(q.statement=L.statement,L.onlyDescribe)return L.resolve(L.statement),Ko(kp)}async function eY(v,G=v.readUInt32BE(5)){(G===3?iG:G===5?oG:G===10?nG:G===11?pG:G===12?cG:G!==0?MG:_x)(v,G)}async function iG(){let v=await y1();Ko(g().p().str(v).z(1).end())}async function oG(v){let G="md5"+await AY(Buffer.concat([Buffer.from(await AY(await y1()+m)),v.subarray(9)]));Ko(g().p().str(G).z(1).end())}async function nG(){an=(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="+an).i32(g.i-v-4,v).end())}async function pG(v){let G=v.toString("utf8",9).split(",").reduce((Io,Gp)=>(Io[Gp[0]]=Gp.slice(2),Io),{}),s=await nm.pbkdf2Sync(await y1(),Buffer.from(G.s,"base64"),parseInt(G.i),32,"sha256"),Gi=await G1(s,"Client Key"),gi="n=*,r="+an+",r="+G.r+",s="+G.s+",i="+G.i+",c=biws,r="+G.r;qi=(await G1(await G1(s,"Server Key"),gi)).toString("base64");let So="c=biws,r="+G.r+",p="+uE(Gi,Buffer.from(await G1(await zE(Gi),gi))).toString("base64");Ko(g().p().str(So).end())}function cG(v){if(v.toString("utf8",9).split(g.N,1)[0].slice(2)===qi)return;Pn(xo.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),Q.destroy()}function y1(){return Promise.resolve(typeof i.pass==="function"?i.pass():i.pass)}function xG(){if(q.statement=L.statement,q.statement.columns=[],L.onlyDescribe)return L.resolve(L.statement),Ko(kp)}function TG(v){E.pid=v.readUInt32BE(5),E.secret=v.readUInt32BE(9)}async function mG(){Ei=!1,(await new Mn([`
62
100
  select b.oid, b.typarray
63
101
  from pg_catalog.pg_type a
64
102
  left join pg_catalog.pg_type b on b.oid = a.typelem
65
103
  where a.typcategory = 'A'
66
104
  group by b.oid, b.typarray
67
105
  order by b.oid
68
- `],[],ix)).forEach(({oid:W,typarray:P})=>VS(W,P))}function VS(A,W){if(!!n.parsers[W]&&!!n.serializers[W])return;let P=n.parsers[A];n.shared.typeArrayMap[A]=W,n.parsers[W]=(Sn)=>ER(Sn,P,W),n.parsers[W].array=!0,n.serializers[W]=(Sn)=>QR(Sn,n.serializers[A],n,W)}function _S(A,W){return A==="read-write"&&W.default_transaction_read_only==="on"||A==="read-only"&&W.default_transaction_read_only==="off"||A==="primary"&&W.in_hot_standby==="on"||A==="standby"&&W.in_hot_standby==="off"||A==="prefer-standby"&&W.in_hot_standby==="off"&&n.host[gn]}function bS(){let A=new oo([`
106
+ `],[],Ix)).forEach(({oid:G,typarray:s})=>fG(G,s))}function fG(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 $G(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 JG(){let v=new Mn([`
69
107
  show transaction_read_only;
70
108
  select pg_catalog.pg_is_in_recovery()
71
- `],[],ix,null,{simple:!0});A.resolve=([[W],[P]])=>{dn.default_transaction_read_only=W.transaction_read_only,dn.in_hot_standby=P.pg_is_in_recovery?"on":"off"},A.execute()}function uS(A){_&&(_.cursorFn||_.describeFirst)&&vi(wc);let W=rn.postgres(k$(A));_&&_.retried?Wo(_.retried):_&&_.prepared&&$M.has(W.routine)?BS(_,W):Wo(W)}function BS(A,W){delete Vi[A.signature],A.retried=W,ix(A)}function jS(A){if(!X)return;let W=9;while(A[W++]!==0);X(A.toString("utf8",9,W-1),A.toString("utf8",W,A.length-1))}async function DS(){try{let A=await Promise.resolve(_.cursorFn(Z));Pn=0,A===sp?vi(gS(_.portal)):(Z=new qc,vi(M0("",_.cursorRows)))}catch(A){vi(wc),_.reject(A)}}function LS(){Z.count&&_.cursorFn(Z),_.resolve(Z)}function NS(){en=new y$.Writable({autoDestroy:!0,write(A,W,P){H.write(s().d().raw(A).end(),P)},destroy(A,W){W(A),H.write(s().f().str(A+s.N).end()),en=null},final(A){H.write(s().c().end()),nx=A}}),_.resolve(en)}function hS(){en=new y$.Readable({read(){H.resume()}}),_.resolve(en)}function CS(){en=new y$.Duplex({autoDestroy:!0,read(){H.resume()},write(A,W,P){H.write(s().d().raw(A).end(),P)},destroy(A,W){W(A),H.write(s().f().str(A+s.N).end()),en=null},final(A){H.write(s().c().end()),nx=A}}),_.resolve(en)}function IS(A){en&&(en.push(A.subarray(5))||H.pause())}function yS(){en&&en.push(null),en=null}function kS(A){S?S(k$(A)):console.log(k$(A))}function ZS(){}function qS(){Wo(rn.notSupported("FunctionCallResponse"))}function sS(){Wo(rn.notSupported("NegotiateProtocolVersion"))}function PS(A){console.error("Postgres.js : Unknown Message:",A[0])}function tS(A,W){console.error("Postgres.js : Unknown Auth:",W)}function rS(A,W,P="",Sn=""){let In,Si;return s().B().str(Sn+s.N).str(P+s.N).i16(0).i16(A.length),A.forEach((zi,Co)=>{if(zi===null)return s.i32(4294967295);Si=W[Co],A[Co]=zi=Si in n.serializers?n.serializers[Si](zi):""+zi,In=s.i,s.inc(4).str(zi).i32(s.i-In-4,In)}),s.i16(0),s.end()}function G0(A,W,P,Sn=""){return s().P().str(Sn+s.N).str(A+s.N).i16(W.length),W.forEach((In,Si)=>s.i32(P[Si]||0)),s.end()}function dS(A,W=""){return s().D().str(A).str(W+s.N).end()}function M0(A="",W=0){return Buffer.concat([s().E().str(A+s.N).i32(W).end(),_R])}function gS(A=""){return Buffer.concat([s().C().str("P").str(A+s.N).end(),s().S().end()])}function eS(){return an||s().inc(4).i16(3).z(2).str(Object.entries(Object.assign({user:a,database:$,client_encoding:"UTF8"},n.connection)).filter(([,A])=>A).map(([A,W])=>A+s.N+W).join(s.N)).z(2).end(0)}}function k$(n){let i={},o=5;for(let c=5;c<n.length-1;c++)if(n[c]===0)i[wM[n[o]]]=n.toString("utf8",o+1,c),o=c+1;return i}function bR(n){return ex.createHash("md5").update(n).digest("hex")}function Pa(n,i){return ex.createHmac("sha256",n).update(i).digest()}function JM(n){return ex.createHash("sha256").update(n).digest()}function AM(n,i){let o=Math.max(n.length,i.length),c=Buffer.allocUnsafe(o);for(let p=0;p<o;p++)c[p]=n[p]^i[p];return c}function Z$(n,i){if(i=typeof i==="function"?i():i,!i)return{cancel:tp,start:tp};let o;return{cancel(){o&&(clearTimeout(o),o=null)},start(){o&&clearTimeout(o),o=setTimeout(c,i*1000,arguments)}};function c(p){n.apply(null,p),o=null}}var BR=()=>{};function s$(n,i){let o=new Map,c="postgresjs_"+Math.random().toString(36).slice(2),p={},x,m,a=!1,f=w.sql=n({...i,transform:{column:{},value:{},row:{}},max:1,fetch_types:!1,idle_timeout:null,max_lifetime:null,connection:{...i.connection,replication:"database"},onclose:async function(){if(a)return;m=null,p.pid=p.secret=void 0,J(await S(f,c,i.publications)),o.forEach((R)=>R.forEach(({onsubscribe:K})=>K()))},no_subscribe:!0}),v=f.end,$=f.close;return f.end=async()=>{return a=!0,m&&await new Promise((R)=>(m.once("close",R),m.end())),v()},f.close=async()=>{return m&&await new Promise((R)=>(m.once("close",R),m.end())),$()},w;async function w(R,K,M=BR,Y=BR){if(R=RM(R),!x)x=S(f,c,i.publications);let I={fn:K,onsubscribe:M},G=o.has(R)?o.get(R).add(I):o.set(R,new Set([I])).get(R),z=()=>{G.delete(I),G.size===0&&o.delete(R)};return x.then((E)=>{return J(E),M(),m&&m.on("error",Y),{unsubscribe:z,state:p,sql:f}})}function J(R){m=R.stream,p.pid=R.state.pid,p.secret=R.state.secret}async function S(R,K,M){if(!M)throw new Error("Missing publication names");let Y=await R.unsafe(`CREATE_REPLICATION_SLOT ${K} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`),[I]=Y,G=await R.unsafe(`START_REPLICATION SLOT ${K} LOGICAL ${I.consistent_point} (proto_version '1', publication_names '${M}')`).writable(),z={lsn:Buffer.concat(I.consistent_point.split("/").map((H)=>Buffer.from(("00000000"+H).slice(-8),"hex")))};return G.on("data",Q),G.on("error",E),G.on("close",R.close),{stream:G,state:Y.state};function E(H){console.error("Unexpected error during logical streaming - reconnecting",H)}function Q(H){if(H[0]===119)TM(H.subarray(25),z,R.options.parsers,b,i.transform);else if(H[0]===107&&H[17])z.lsn=H.subarray(1,9),y()}function b(H,an){let Z=an.relation.schema+"."+an.relation.table;X("*",H,an),X("*:"+Z,H,an),an.relation.keys.length&&X("*:"+Z+"="+an.relation.keys.map((fn)=>H[fn.name]),H,an),X(an.command,H,an),X(an.command+":"+Z,H,an),an.relation.keys.length&&X(an.command+":"+Z+"="+an.relation.keys.map((fn)=>H[fn.name]),H,an)}function y(){let H=Buffer.alloc(34);H[0]=114,H.fill(z.lsn,1),H.writeBigInt64BE(BigInt(Date.now()-Date.UTC(2000,0,1))*BigInt(1000),25),G.write(H)}}function X(R,K,M){o.has(R)&&o.get(R).forEach(({fn:Y})=>Y(K,M,R))}}function FM(n){return new Date(Date.UTC(2000,0,1)+Number(n/BigInt(1000)))}function TM(n,i,o,c,p){let x=(m,[a,f])=>(m[a.charCodeAt(0)]=f,m);Object.entries({R:(m)=>{let a=1,f=i[m.readUInt32BE(a)]={schema:m.toString("utf8",a+=4,a=m.indexOf(0,a))||"pg_catalog",table:m.toString("utf8",a+1,a=m.indexOf(0,a+1)),columns:Array(m.readUInt16BE(a+=2)),keys:[]};a+=2;let v=0,$;while(a<m.length)$=f.columns[v++]={key:m[a++],name:p.column.from?p.column.from(m.toString("utf8",a,a=m.indexOf(0,a))):m.toString("utf8",a,a=m.indexOf(0,a)),type:m.readUInt32BE(a+=1),parser:o[m.readUInt32BE(a)],atttypmod:m.readUInt32BE(a+=4)},$.key&&f.keys.push($),a+=4},Y:()=>{},O:()=>{},B:(m)=>{i.date=FM(m.readBigInt64BE(9)),i.lsn=m.subarray(1,9)},I:(m)=>{let a=1,f=i[m.readUInt32BE(a)],{row:v}=ta(m,f.columns,a+=7,p);c(v,{command:"insert",relation:f})},D:(m)=>{let a=1,f=i[m.readUInt32BE(a)];a+=4;let v=m[a]===75;c(v||m[a]===79?ta(m,f.columns,a+=3,p).row:null,{command:"delete",relation:f,key:v})},U:(m)=>{let a=1,f=i[m.readUInt32BE(a)];a+=4;let v=m[a]===75,$=v||m[a]===79?ta(m,f.columns,a+=3,p):null;$&&(a=$.i);let{row:w}=ta(m,f.columns,a+3,p);c(w,{command:"update",relation:f,key:v,old:$&&$.row})},T:()=>{},C:()=>{}}).reduce(x,{})[n[0]](n)}function ta(n,i,o,c){let p,x,m,a=c.raw?new Array(i.length):{};for(let f=0;f<i.length;f++)p=n[o++],x=i[f],m=p===110?null:p===117?void 0:x.parser===void 0?n.toString("utf8",o+4,o+=4+n.readUInt32BE(o)):x.parser.array===!0?x.parser(n.toString("utf8",o+5,o+=4+n.readUInt32BE(o))):x.parser(n.toString("utf8",o+4,o+=4+n.readUInt32BE(o))),c.raw?a[f]=c.raw===!0?m:c.value.from?c.value.from(m,x):m:a[x.name]=c.value.from?c.value.from(m,x):m;return{i:o,row:c.row.from?c.row.from(a):a}}function RM(n){let i=n.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i)||[];if(!i)throw new Error("Malformed subscribe pattern: "+n);let[,o,c,p]=i;return(o||"*")+(c?":"+(c.indexOf(".")===-1?"public."+c:c):"")+(p?"="+p:"")}import jR from"node:stream";function P$(n,i,o=393216){return new Promise(async(c,p)=>{await n.begin(async(x)=>{let m;!i&&([{oid:i}]=await x`select lo_creat(-1) as oid`);let[{fd:a}]=await x`select lo_open(${i}, ${o}) as fd`,f={writable:$,readable:v,close:()=>x`select lo_close(${a})`.then(m),tell:()=>x`select lo_tell64(${a})`,read:(w)=>x`select loread(${a}, ${w}) as data`,write:(w)=>x`select lowrite(${a}, ${w})`,truncate:(w)=>x`select lo_truncate64(${a}, ${w})`,seek:(w,J=0)=>x`select lo_lseek64(${a}, ${w}, ${J})`,size:()=>x`
109
+ `],[],Ix,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 FG(v){L&&(L.cursorFn||L.describeFirst)&&Ko(kp);let G=xo.postgres(OF(v));L&&L.retried?Pn(L.retried):L&&L.prepared&&HE.has(G.routine)?AG(L,G):Pn(G)}function AG(v,G){delete lo[v.signature],v.retried=G,Ix(v)}function vG(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 wG(){try{let v=await Promise.resolve(L.cursorFn(q));oo=0,v===Ex?Ko(VG(L.portal)):(q=new Mc,Ko($A("",L.cursorRows)))}catch(v){Ko(kp),L.reject(v)}}function XG(){q.count&&L.cursorFn(q),L.resolve(q)}function WG(){fo=new EF.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()),Bx=v}}),L.resolve(fo)}function RG(){fo=new EF.Readable({read(){Q.resume()}}),L.resolve(fo)}function YG(){fo=new EF.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()),Bx=v}}),L.resolve(fo)}function GG(v){fo&&(fo.push(v.subarray(5))||Q.pause())}function KG(){fo&&fo.push(null),fo=null}function HG(v){X?X(OF(v)):console.log(OF(v))}function UG(){}function zG(){Pn(xo.notSupported("FunctionCallResponse"))}function uG(){Pn(xo.notSupported("NegotiateProtocolVersion"))}function ZG(v){console.error("Postgres.js : Unknown Message:",v[0])}function MG(v,G){console.error("Postgres.js : Unknown Auth:",G)}function QG(v,G,s="",Gi=""){let gi,So;return g().B().str(Gi+g.N).str(s+g.N).i16(0).i16(v.length),v.forEach((Io,Gp)=>{if(Io===null)return g.i32(4294967295);So=G[Gp],v[Gp]=Io=So in i.serializers?i.serializers[So](Io):""+Io,gi=g.i,g.inc(4).str(Io).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,So)=>g.i32(s[So]||0)),g.end()}function SG(v,G=""){return g().D().str(v).str(G+g.N).end()}function $A(v="",G=0){return Buffer.concat([g().E().str(v+g.N).i32(G).end(),FY])}function VG(v=""){return Buffer.concat([g().C().str("P").str(v+g.N).end(),g().S().end()])}function EG(){return Ti||g().inc(4).i16(3).z(2).str(Object.entries(Object.assign({user:m,database:J,client_encoding:"UTF8"},i.connection)).filter(([,v])=>v).map(([v,G])=>v+g.N+G).join(g.N)).z(2).end(0)}}function OF(i){let o={},n=5;for(let p=5;p<i.length-1;p++)if(i[p]===0)o[UE[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 G1(i,o){return nm.createHmac("sha256",i).update(o).digest()}function zE(i){return nm.createHash("sha256").update(i).digest()}function uE(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 _F(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 LF(i,o){let n=new Map,p="postgresjs_"+Math.random().toString(36).slice(2),c={},x,T,m=!1,f=F.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.end,J=f.close;return f.end=async()=>{return m=!0,T&&await new Promise((R)=>(T.once("close",R),T.end())),$()},f.close=async()=>{return T&&await new Promise((R)=>(T.once("close",R),T.end())),J()},F;async function F(R,K,H=wY,Z=wY){if(R=QE(R),!x)x=X(f,p,o.publications);let b={fn:K,onsubscribe:H},u=n.has(R)?n.get(R).add(b):n.set(R,new Set([b])).get(R),M=()=>{u.delete(b),u.size===0&&n.delete(R)};return x.then((E)=>{return A(E),H(),T&&T.on("error",Z),{unsubscribe:M,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,H){if(!H)throw new Error("Missing publication names");let Z=await R.unsafe(`CREATE_REPLICATION_SLOT ${K} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`),[b]=Z,u=await R.unsafe(`START_REPLICATION SLOT ${K} LOGICAL ${b.consistent_point} (proto_version '1', publication_names '${H}')`).writable(),M={lsn:Buffer.concat(b.consistent_point.split("/").map((Q)=>Buffer.from(("00000000"+Q).slice(-8),"hex")))};return u.on("data",V),u.on("error",E),u.on("close",R.close),{stream:u,state:Z.state};function E(Q){console.error("Unexpected error during logical streaming - reconnecting",Q)}function V(Q){if(Q[0]===119)ME(Q.subarray(25),M,R.options.parsers,C,o.transform);else if(Q[0]===107&&Q[17])M.lsn=Q.subarray(1,9),l()}function C(Q,Ti){let q=Ti.relation.schema+"."+Ti.relation.table;Y("*",Q,Ti),Y("*:"+q,Q,Ti),Ti.relation.keys.length&&Y("*:"+q+"="+Ti.relation.keys.map((mi)=>Q[mi.name]),Q,Ti),Y(Ti.command,Q,Ti),Y(Ti.command+":"+q,Q,Ti),Ti.relation.keys.length&&Y(Ti.command+":"+q+"="+Ti.relation.keys.map((mi)=>Q[mi.name]),Q,Ti)}function l(){let Q=Buffer.alloc(34);Q[0]=114,Q.fill(M.lsn,1),Q.writeBigInt64BE(BigInt(Date.now()-Date.UTC(2000,0,1))*BigInt(1000),25),u.write(Q)}}function Y(R,K,H){n.has(R)&&n.get(R).forEach(({fn:Z})=>Z(K,H,R))}}function ZE(i){return new Date(Date.UTC(2000,0,1)+Number(i/BigInt(1000)))}function ME(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 $=0,J;while(m<T.length)J=f.columns[$++]={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)},J.key&&f.keys.push(J),m+=4},Y:()=>{},O:()=>{},B:(T)=>{o.date=ZE(T.readBigInt64BE(9)),o.lsn=T.subarray(1,9)},I:(T)=>{let m=1,f=o[T.readUInt32BE(m)],{row:$}=K1(T,f.columns,m+=7,c);p($,{command:"insert",relation:f})},D:(T)=>{let m=1,f=o[T.readUInt32BE(m)];m+=4;let $=T[m]===75;p($||T[m]===79?K1(T,f.columns,m+=3,c).row:null,{command:"delete",relation:f,key:$})},U:(T)=>{let m=1,f=o[T.readUInt32BE(m)];m+=4;let $=T[m]===75,J=$||T[m]===79?K1(T,f.columns,m+=3,c):null;J&&(m=J.i);let{row:F}=K1(T,f.columns,m+3,c);p(F,{command:"update",relation:f,key:$,old:J&&J.row})},T:()=>{},C:()=>{}}).reduce(x,{})[i[0]](i)}function K1(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 QE(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 CF(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:J,readable:$,close:()=>x`select lo_close(${m})`.then(T),tell:()=>x`select lo_tell64(${m})`,read:(F)=>x`select loread(${m}, ${F}) as data`,write:(F)=>x`select lowrite(${m}, ${F})`,truncate:(F)=>x`select lo_truncate64(${m}, ${F})`,seek:(F,A=0)=>x`select lo_lseek64(${m}, ${F}, ${A})`,size:()=>x`
72
110
  select
73
- lo_lseek64(${a}, location, 0) as position,
111
+ lo_lseek64(${m}, location, 0) as position,
74
112
  seek.size
75
113
  from (
76
114
  select
@@ -78,10 +116,10 @@ ${m.trace}`:"No previous disposal trace was found."),c.type){case"atom_family":c
78
116
  tell.location
79
117
  from (select lo_tell64($1) as location) tell
80
118
  ) seek
81
- `};return c(f),new Promise(async(w)=>m=w);async function v({highWaterMark:w=16384,start:J=0,end:S=1/0}={}){let X=S-J;return J&&await f.seek(J),new jR.Readable({highWaterMark:w,async read(R){let K=R>X?R-X:R;X-=R;let[{data:M}]=await f.read(K);if(this.push(M),M.length<R)this.push(null)}})}async function $({highWaterMark:w=16384,start:J=0}={}){return J&&await f.seek(J),new jR.Writable({highWaterMark:w,write(S,X,R){f.write(S).then(()=>R(),R)}})}}).catch(p)})}Object.assign(ra,{PostgresError:Pp,toPascal:kc,pascal:C$,toCamel:yc,camel:h$,toKebab:Zc,kebab:I$,fromPascal:rx,fromCamel:tx,fromKebab:dx,BigInt:{to:20,from:[20],parse:(n)=>BigInt(n),serialize:(n)=>n.toString()}});var rp=ra;function ra(n,i){let o=WM(n,i),c=o.no_subscribe||s$(ra,{...o}),p=!1,x=ki(),m=ki(),a=ki(),f=ki(),v=ki(),$=ki(),w=ki(),J=ki(),S={connecting:m,reserved:a,closed:f,ended:v,open:$,busy:w,full:J},X=[...Array(o.max)].map(()=>q$(o,S,{onopen:Vi,onend:dn,onclose:Oo})),R=K(b);return Object.assign(R,{get parameters(){return o.parameters},largeObject:P$.bind(null,R),subscribe:c,CLOSE:sp,END:sp,PostgresError:Pp,options:o,reserve:I,listen:M,begin:G,close:Z,end:an}),R;function K(O){return O.debug=o.debug,Object.entries(o.types).reduce((vn,[_n,Pn])=>{return vn[_n]=(Nn)=>new Eo(Nn,Pn.to),vn},q),Object.assign(Rn,{types:q,typed:q,unsafe:Dn,notify:Y,array:Q,json:E,file:gn}),Rn;function q(vn,_n){return new Eo(vn,_n)}function Rn(vn,..._n){return vn&&Array.isArray(vn.raw)?new oo(vn,_n,O,H):typeof vn==="string"&&!_n.length?new gx(o.transform.column.to?o.transform.column.to(vn):vn):new ka(vn,_n)}function Dn(vn,_n=[],Pn={}){return arguments.length===2&&!Array.isArray(_n)&&(Pn=_n,_n=[]),new oo([vn],_n,O,H,{prepare:!1,...Pn,simple:"simple"in Pn?Pn.simple:_n.length===0})}function gn(vn,_n=[],Pn={}){return arguments.length===2&&!Array.isArray(_n)&&(Pn=_n,_n=[]),new oo([],_n,(Bn)=>{XM.readFile(vn,"utf8",(Fi,bn)=>{if(Fi)return Bn.reject(Fi);Bn.strings=[bn],O(Bn)})},H,{...Pn,simple:"simple"in Pn?Pn.simple:_n.length===0})}}async function M(O,q,Rn){let Dn={fn:q,onlisten:Rn},gn=M.sql||(M.sql=ra({...o,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(M.channels).forEach(([Bn,{listeners:Fi}])=>{delete M.channels[Bn],Promise.all(Fi.map((bn)=>M(Bn,bn.fn,bn.onlisten).catch(()=>{})))})},onnotify(Bn,Fi){Bn in M.channels&&M.channels[Bn].listeners.forEach((bn)=>bn.fn(Fi))}})),vn=M.channels||(M.channels={});if(O in vn){vn[O].listeners.push(Dn);let Bn=await vn[O].result;return Dn.onlisten&&Dn.onlisten(),{state:Bn.state,unlisten:Nn}}vn[O]={result:gn`listen ${gn.unsafe('"'+O.replace(/"/g,'""')+'"')}`,listeners:[Dn]};let Pn=await vn[O].result;return Dn.onlisten&&Dn.onlisten(),{state:Pn.state,unlisten:Nn};async function Nn(){if(O in vn===!1)return;if(vn[O].listeners=vn[O].listeners.filter((Bn)=>Bn!==Dn),vn[O].listeners.length)return;return delete vn[O],gn`unlisten ${gn.unsafe('"'+O.replace(/"/g,'""')+'"')}`}}async function Y(O,q){return await R`select pg_notify(${O}, ${""+q})`}async function I(){let O=ki(),q=$.length?$.shift():await new Promise((gn)=>{x.push({reserve:gn}),f.length&&En(f.shift())});z(q,a),q.reserved=()=>O.length?q.execute(O.shift()):z(q,a),q.reserved.release=!0;let Rn=K(Dn);return Rn.release=()=>{q.reserved=null,Vi(q)},Rn;function Dn(gn){q.queue===J?O.push(gn):q.execute(gn)||z(q,J)}}async function G(O,q){!q&&(q=O,O="");let Rn=ki(),Dn=0,gn,vn=null;try{return await R.unsafe("begin "+O.replace(/[^a-z ]/ig,""),[],{onexecute:Pn}).execute(),await Promise.race([_n(gn,q),new Promise((Nn,Bn)=>gn.onclose=Bn)])}catch(Nn){throw Nn}async function _n(Nn,Bn,Fi){let bn=K(en);bn.savepoint=ho,bn.prepare=(jn)=>vn=jn.replace(/[^a-z0-9$-_. ]/gi);let co,Ti;Fi&&await bn`savepoint ${bn(Fi)}`;try{if(Ti=await new Promise((jn,po)=>{let Xo=Bn(bn);Promise.resolve(Array.isArray(Xo)?Promise.all(Xo):Xo).then(jn,po)}),co)throw co}catch(jn){throw await(Fi?bn`rollback to ${bn(Fi)}`:bn`rollback`),jn instanceof Pp&&jn.code==="25P02"&&co||jn}if(!Fi)vn?await bn`prepare transaction '${bn.unsafe(vn)}'`:await bn`commit`;return Ti;function ho(jn,po){if(jn&&Array.isArray(jn.raw))return ho((Xo)=>Xo.apply(Xo,arguments));return arguments.length===1&&(po=jn,jn=null),_n(Nn,po,"s"+Dn+++(jn?"_"+jn:""))}function en(jn){jn.catch((po)=>co||(co=po)),Nn.queue===J?Rn.push(jn):Nn.execute(jn)||z(Nn,J)}}function Pn(Nn){gn=Nn,z(Nn,a),Nn.reserved=()=>Rn.length?Nn.execute(Rn.shift()):z(Nn,a)}}function z(O,q){return O.queue.remove(O),q.push(O),O.queue=q,q===$?O.idleTimer.start():O.idleTimer.cancel(),O}function E(O){return new Eo(O,3802)}function Q(O,q){if(!Array.isArray(O))return Q(Array.from(arguments));return new Eo(O,q||(O.length?Ia(O)||25:0),o.shared.typeArrayMap)}function b(O){if(p)return O.reject(rn.connection("CONNECTION_ENDED",o,o));if($.length)return y($.shift(),O);if(f.length)return En(f.shift(),O);w.length?y(w.shift(),O):x.push(O)}function y(O,q){return O.execute(q)?z(O,w):z(O,J)}function H(O){return new Promise((q,Rn)=>{O.state?O.active?q$(o).cancel(O.state,q,Rn):O.cancelled={resolve:q,reject:Rn}:(x.remove(O),O.cancelled=!0,O.reject(rn.generic("57014","canceling statement due to user request")),q())})}async function an({timeout:O=null}={}){if(p)return p;await 1;let q;return p=Promise.race([new Promise((Rn)=>O!==null&&(q=setTimeout(fn,O*1000,Rn))),Promise.all(X.map((Rn)=>Rn.end()).concat(M.sql?M.sql.end({timeout:0}):[],c.sql?c.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(q))}async function Z(){await Promise.all(X.map((O)=>O.end()))}async function fn(O){await Promise.all(X.map((q)=>q.terminate()));while(x.length)x.shift().reject(rn.connection("CONNECTION_DESTROYED",o));O()}function En(O,q){return z(O,m),O.connect(q),O}function dn(O){z(O,v)}function Vi(O){if(x.length===0)return z(O,$);let q=Math.ceil(x.length/(m.length+1)),Rn=!0;while(Rn&&x.length&&q-- >0){let Dn=x.shift();if(Dn.reserve)return Dn.reserve(O);Rn=O.execute(Dn)}Rn?z(O,w):z(O,J)}function Oo(O,q){z(O,f),O.reserved=null,O.onclose&&(O.onclose(q),O.onclose=null),o.onclose&&o.onclose(O.id),x.length&&En(O,x.shift())}}function WM(n,i){if(n&&n.shared)return n;let o=process.env,c=(!n||typeof n==="string"?i:n)||{},{url:p,multihost:x}=YM(n),m=[...p.searchParams].reduce((J,[S,X])=>(J[S]=X,J),{}),a=c.hostname||c.host||x||p.hostname||o.PGHOST||"localhost",f=c.port||p.port||o.PGPORT||5432,v=c.user||c.username||p.username||o.PGUSERNAME||o.PGUSER||HM();c.no_prepare&&(c.prepare=!1),m.sslmode&&(m.ssl=m.sslmode,delete m.sslmode),"timeout"in c&&(console.log("The timeout option is deprecated, use idle_timeout instead"),c.idle_timeout=c.timeout),m.sslrootcert==="system"&&(m.ssl="verify-full");let $=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],w={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:GM,max_pipeline:100,backoff:lM,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(a)?a:a.split(",").map((J)=>J.split(":")[0]),port:Array.isArray(f)?f:a.split(",").map((J)=>parseInt(J.split(":")[1]||f)),path:c.path||a.indexOf("/")>-1&&a+"/.s.PGSQL."+f,database:c.database||c.db||(p.pathname||"").slice(1)||o.PGDATABASE||v,user:v,pass:c.pass||c.password||p.password||o.PGPASSWORD||"",...Object.entries(w).reduce((J,[S,X])=>{let R=S in c?c[S]:(S in m)?m[S]==="disable"||m[S]==="false"?!1:m[S]:o["PG"+S.toUpperCase()]||X;return J[S]=typeof R==="string"&&$.includes(S)?+R:R,J},{}),connection:{application_name:"postgres.js",...c.connection,...Object.entries(m).reduce((J,[S,X])=>((S in w)||(J[S]=X),J),{})},types:c.types||{},target_session_attrs:KM(c,p,o),onnotice:c.onnotice,onnotify:c.onnotify,onclose:c.onclose,onparameter:c.onparameter,socket:c.socket,transform:MM(c.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...HR(c.types)}}function KM(n,i,o){let c=n.target_session_attrs||i.searchParams.get("target_session_attrs")||o.PGTARGETSESSIONATTRS;if(!c||["read-write","read-only","primary","standby","prefer-standby"].includes(c))return c;throw new Error("target_session_attrs "+c+" is not supported")}function lM(n){return(0.5+Math.random()/2)*Math.min(3**n/100,20)}function GM(){return 60*(30+Math.random()*30)}function MM(n){return{undefined:n.undefined,column:{from:typeof n.column==="function"?n.column:n.column&&n.column.from,to:n.column&&n.column.to},value:{from:typeof n.value==="function"?n.value:n.value&&n.value.from,to:n.value&&n.value.to},row:{from:typeof n.row==="function"?n.row:n.row&&n.row.from,to:n.row&&n.row.to}}}function YM(n){if(!n||typeof n!=="string")return{url:{searchParams:new Map}};let i=n;i=i.slice(i.indexOf("://")+3).split(/[?/]/)[0],i=decodeURIComponent(i.slice(i.indexOf("@")+1));let o=new URL(n.replace(i,i.split(",")[0]));return{url:{username:decodeURIComponent(o.username),password:decodeURIComponent(o.password),host:o.host,hostname:o.hostname,port:o.port,pathname:o.pathname,searchParams:o.searchParams},multihost:i.indexOf(",")>-1&&i}}function HM(){try{return SM.userInfo().username}catch(n){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class kn{static[F]="SelectionProxyHandler";config;constructor(n){this.config={...n}}get(n,i){if(i==="_")return{...n._,selectedFields:new Proxy(n._.selectedFields,this)};if(i===un)return{...n[un],selectedFields:new Proxy(n[un].selectedFields,this)};if(typeof i==="symbol")return n[i];let c=(l(n,ci)?n._.selectedFields:l(n,bi)?n[un].selectedFields:n)[i];if(l(c,L.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!c.isSelectionField)return c.sql;let p=c.clone();return p.isSelectionField=!0,p}if(l(c,L)){if(this.config.sqlBehavior==="sql")return c;throw new Error(`You tried to reference "${i}" 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(l(c,Un)){if(this.config.alias)return new Proxy(c,new Sp(new Proxy(c.table,new Qx(this.config.alias,this.config.replaceOriginalName??!1))));return c}if(typeof c!=="object"||c===null)return c;return new Proxy(c,new kn(this.config))}}class da extends Qi{constructor(n,i,o,c){super();this.session=i,this.dialect=o,this.config={table:n,withList:c}}static[F]="PgDelete";config;where(n){return this.config.where=n,this}returning(n=this.config.table[D.Symbol.Columns]){return this.config.returningFields=n,this.config.returning=di(n),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:n,...i}=this.dialect.sqlToQuery(this.getSQL());return i}_prepare(n){return Vn.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,n,!0)})}prepare(n){return this._prepare(n)}authToken;setToken(n){return this.authToken=n,this}execute=(n)=>{return Vn.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(n,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new kn({alias:mi(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}function zM(n){return(n.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((o)=>o.toLowerCase()).join("_")}function QM(n){return(n.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((o,c,p)=>{let x=p===0?c.toLowerCase():`${c[0].toUpperCase()}${c.slice(1)}`;return o+x},"")}function EM(n){return n}class t${static[F]="CasingCache";cache={};cachedTables={};convert;constructor(n){this.convert=n==="snake_case"?zM:n==="camelCase"?QM:EM}getColumnCasing(n){if(!n.keyAsName)return n.name;let i=n.table[D.Symbol.Schema]??"public",o=n.table[D.Symbol.OriginalName],c=`${i}.${o}.${n.name}`;if(!this.cache[c])this.cacheTable(n.table);return this.cache[c]}cacheTable(n){let i=n[D.Symbol.Schema]??"public",o=n[D.Symbol.OriginalName],c=`${i}.${o}`;if(!this.cachedTables[c]){for(let p of Object.values(n[D.Symbol.Columns])){let x=`${c}.${p.name}`;this.cache[x]=this.convert(p.name)}this.cachedTables[c]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class nm extends bi{static[F]="PgViewBase"}class sc{static[F]="PgDialect";casing;constructor(n){this.casing=new t$(n?.casing)}async migrate(n,i,o){let c=typeof o==="string"?"__drizzle_migrations":o.migrationsTable??"__drizzle_migrations",p=typeof o==="string"?"drizzle":o.migrationsSchema??"drizzle",x=T`
82
- CREATE TABLE IF NOT EXISTS ${T.identifier(p)}.${T.identifier(c)} (
119
+ `};return p(f),new Promise(async(F)=>T=F);async function $({highWaterMark:F=16384,start:A=0,end:X=1/0}={}){let Y=X-A;return A&&await f.seek(A),new XY.Readable({highWaterMark:F,async read(R){let K=R>Y?R-Y:R;Y-=R;let[{data:H}]=await f.read(K);if(this.push(H),H.length<R)this.push(null)}})}async function J({highWaterMark:F=16384,start:A=0}={}){return A&&await f.seek(A),new XY.Writable({highWaterMark:F,write(X,Y,R){f.write(X).then(()=>R(),R)}})}}).catch(c)})}Object.assign(H1,{PostgresError:Ox,toPascal:uc,pascal:SF,toCamel:zc,camel:QF,toKebab:Zc,kebab:VF,fromPascal:eT,fromCamel:rT,fromKebab:im,BigInt:{to:20,from:[20],parse:(i)=>BigInt(i),serialize:(i)=>i.toString()}});var yx=H1;function H1(i,o){let n=EE(i,o),p=n.no_subscribe||LF(H1,{...n}),c=!1,x=Fn(),T=Fn(),m=Fn(),f=Fn(),$=Fn(),J=Fn(),F=Fn(),A=Fn(),X={connecting:T,reserved:m,closed:f,ended:$,open:J,busy:F,full:A},Y=[...Array(n.max)].map(()=>yF(n,X,{onopen:lo,onend:To,onclose:ip})),R=K(C);return Object.assign(R,{get parameters(){return n.parameters},largeObject:CF.bind(null,R),subscribe:p,CLOSE:Ex,END:Ex,PostgresError:Ox,options:n,reserve:b,listen:H,begin:u,close:q,end:Ti}),R;function K(O){return O.debug=n.debug,Object.entries(n.types).reduce(($i,[Ci,oo])=>{return $i[Ci]=(qi)=>new en(qi,oo.to),$i},k),Object.assign(Yi,{types:k,typed:k,unsafe:Pi,notify:Z,array:V,json:E,file:mo}),Yi;function k($i,Ci){return new en($i,Ci)}function Yi($i,...Ci){return $i&&Array.isArray($i.raw)?new Mn($i,Ci,O,Q):typeof $i==="string"&&!Ci.length?new om(n.transform.column.to?n.transform.column.to($i):$i):new X1($i,Ci)}function Pi($i,Ci=[],oo={}){return arguments.length===2&&!Array.isArray(Ci)&&(oo=Ci,Ci=[]),new Mn([$i],Ci,O,Q,{prepare:!1,...oo,simple:"simple"in oo?oo.simple:Ci.length===0})}function mo($i,Ci=[],oo={}){return arguments.length===2&&!Array.isArray(Ci)&&(oo=Ci,Ci=[]),new Mn([],Ci,(bi)=>{VE.readFile($i,"utf8",(Zo,Di)=>{if(Zo)return bi.reject(Zo);bi.strings=[Di],O(bi)})},Q,{...oo,simple:"simple"in oo?oo.simple:Ci.length===0})}}async function H(O,k,Yi){let Pi={fn:k,onlisten:Yi},mo=H.sql||(H.sql=H1({...n,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(H.channels).forEach(([bi,{listeners:Zo}])=>{delete H.channels[bi],Promise.all(Zo.map((Di)=>H(bi,Di.fn,Di.onlisten).catch(()=>{})))})},onnotify(bi,Zo){bi in H.channels&&H.channels[bi].listeners.forEach((Di)=>Di.fn(Zo))}})),$i=H.channels||(H.channels={});if(O in $i){$i[O].listeners.push(Pi);let bi=await $i[O].result;return Pi.onlisten&&Pi.onlisten(),{state:bi.state,unlisten:qi}}$i[O]={result:mo`listen ${mo.unsafe('"'+O.replace(/"/g,'""')+'"')}`,listeners:[Pi]};let oo=await $i[O].result;return Pi.onlisten&&Pi.onlisten(),{state:oo.state,unlisten:qi};async function qi(){if(O in $i===!1)return;if($i[O].listeners=$i[O].listeners.filter((bi)=>bi!==Pi),$i[O].listeners.length)return;return delete $i[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=Fn(),k=J.length?J.shift():await new Promise((mo)=>{x.push({reserve:mo}),f.length&&Ei(f.shift())});M(k,m),k.reserved=()=>O.length?k.execute(O.shift()):M(k,m),k.reserved.release=!0;let Yi=K(Pi);return Yi.release=()=>{k.reserved=null,lo(k)},Yi;function Pi(mo){k.queue===A?O.push(mo):k.execute(mo)||M(k,A)}}async function u(O,k){!k&&(k=O,O="");let Yi=Fn(),Pi=0,mo,$i=null;try{return await R.unsafe("begin "+O.replace(/[^a-z ]/ig,""),[],{onexecute:oo}).execute(),await Promise.race([Ci(mo,k),new Promise((qi,bi)=>mo.onclose=bi)])}catch(qi){throw qi}async function Ci(qi,bi,Zo){let Di=K(fo);Di.savepoint=Yp,Di.prepare=(ji)=>$i=ji.replace(/[^a-z0-9$-_. ]/gi);let Qn,Mo;Zo&&await Di`savepoint ${Di(Zo)}`;try{if(Mo=await new Promise((ji,Sn)=>{let an=bi(Di);Promise.resolve(Array.isArray(an)?Promise.all(an):an).then(ji,Sn)}),Qn)throw Qn}catch(ji){throw await(Zo?Di`rollback to ${Di(Zo)}`:Di`rollback`),ji instanceof Ox&&ji.code==="25P02"&&Qn||ji}if(!Zo)$i?await Di`prepare transaction '${Di.unsafe($i)}'`:await Di`commit`;return Mo;function Yp(ji,Sn){if(ji&&Array.isArray(ji.raw))return Yp((an)=>an.apply(an,arguments));return arguments.length===1&&(Sn=ji,ji=null),Ci(qi,Sn,"s"+Pi+++(ji?"_"+ji:""))}function fo(ji){ji.catch((Sn)=>Qn||(Qn=Sn)),qi.queue===A?Yi.push(ji):qi.execute(ji)||M(qi,A)}}function oo(qi){mo=qi,M(qi,m),qi.reserved=()=>Yi.length?qi.execute(Yi.shift()):M(qi,m)}}function M(O,k){return O.queue.remove(O),k.push(O),O.queue=k,k===J?O.idleTimer.start():O.idleTimer.cancel(),O}function E(O){return new en(O,3802)}function V(O,k){if(!Array.isArray(O))return V(Array.from(arguments));return new en(O,k||(O.length?v1(O)||25:0),n.shared.typeArrayMap)}function C(O){if(c)return O.reject(xo.connection("CONNECTION_ENDED",n,n));if(J.length)return l(J.shift(),O);if(f.length)return Ei(f.shift(),O);F.length?l(F.shift(),O):x.push(O)}function l(O,k){return O.execute(k)?M(O,F):M(O,A)}function Q(O){return new Promise((k,Yi)=>{O.state?O.active?yF(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(H.sql?H.sql.end({timeout:0}):[],p.sql?p.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(k))}async function q(){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 M(O,T),O.connect(k),O}function To(O){M(O,$)}function lo(O){if(x.length===0)return M(O,J);let k=Math.ceil(x.length/(T.length+1)),Yi=!0;while(Yi&&x.length&&k-- >0){let Pi=x.shift();if(Pi.reserve)return Pi.reserve(O);Yi=O.execute(Pi)}Yi?M(O,F):M(O,A)}function ip(O,k){M(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 EE(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,$=p.user||p.username||c.username||n.PGUSERNAME||n.PGUSER||DE();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 J=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],F={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:yE,max_pipeline:100,backoff:_E,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||$,user:$,pass:p.pass||p.password||c.password||n.PGPASSWORD||"",...Object.entries(F).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"&&J.includes(X)?+R:R,A},{}),connection:{application_name:"postgres.js",...p.connection,...Object.entries(T).reduce((A,[X,Y])=>((X in F)||(A[X]=Y),A),{})},types:p.types||{},target_session_attrs:OE(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 OE(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 _E(i){return(0.5+Math.random()/2)*Math.min(3**i/100,20)}function yE(){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 DE(){try{return SE.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,yi)){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 U1 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[I.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 Li.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 Li.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 BE(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 NE(i){return i}class DF{static[w]="CasingCache";cache={};cachedTables={};convert;constructor(i){this.convert=i==="snake_case"?BE:i==="camelCase"?IE:NE}getColumnCasing(i){if(!i.keyAsName)return i.name;let o=i.table[I.Symbol.Schema]??"public",n=i.table[I.Symbol.OriginalName],p=`${o}.${n}.${i.name}`;if(!this.cache[p])this.cacheTable(i.table);return this.cache[p]}cacheTable(i){let o=i[I.Symbol.Schema]??"public",n=i[I.Symbol.OriginalName],p=`${o}.${n}`;if(!this.cachedTables[p]){for(let c of Object.values(i[I.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 DF(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)} (
83
121
  id SERIAL PRIMARY KEY,
84
122
  hash text NOT NULL,
85
123
  created_at bigint
86
124
  )
87
- `;await i.execute(T`CREATE SCHEMA IF NOT EXISTS ${T.identifier(p)}`),await i.execute(x);let a=(await i.all(T`select id, hash, created_at from ${T.identifier(p)}.${T.identifier(c)} order by created_at desc limit 1`))[0];await i.transaction(async(f)=>{for await(let v of n)if(!a||Number(a.created_at)<v.folderMillis){for(let $ of v.sql)await f.execute(T.raw($));await f.execute(T`insert into ${T.identifier(p)}.${T.identifier(c)} ("hash", "created_at") values(${v.hash}, ${v.folderMillis})`)}})}escapeName(n){return`"${n}"`}escapeParam(n){return`$${n+1}`}escapeString(n){return`'${n.replace(/'/g,"''")}'`}buildWithCTE(n){if(!n?.length)return;let i=[T`with `];for(let[o,c]of n.entries())if(i.push(T`${T.identifier(c._.alias)} as (${c._.sql})`),o<n.length-1)i.push(T`, `);return i.push(T` `),T.join(i)}buildDeleteQuery({table:n,where:i,returning:o,withList:c}){let p=this.buildWithCTE(c),x=o?T` returning ${this.buildSelection(o,{isSingleTable:!0})}`:void 0,m=i?T` where ${i}`:void 0;return T`${p}delete from ${n}${m}${x}`}buildUpdateSet(n,i){let o=n[D.Symbol.Columns],c=Object.keys(o).filter((x)=>i[x]!==void 0||o[x]?.onUpdateFn!==void 0),p=c.length;return T.join(c.flatMap((x,m)=>{let a=o[x],f=i[x]??T.param(a.onUpdateFn(),a),v=T`${T.identifier(this.casing.getColumnCasing(a))} = ${f}`;if(m<p-1)return[v,T.raw(", ")];return[v]}))}buildUpdateQuery({table:n,set:i,where:o,returning:c,withList:p,from:x,joins:m}){let a=this.buildWithCTE(p),f=n[Ai.Symbol.Name],v=n[Ai.Symbol.Schema],$=n[Ai.Symbol.OriginalName],w=f===$?void 0:f,J=T`${v?T`${T.identifier(v)}.`:void 0}${T.identifier($)}${w&&T` ${T.identifier(w)}`}`,S=this.buildUpdateSet(n,i),X=x&&T.join([T.raw(" from "),this.buildFromTable(x)]),R=this.buildJoins(m),K=c?T` returning ${this.buildSelection(c,{isSingleTable:!x})}`:void 0,M=o?T` where ${o}`:void 0;return T`${a}update ${J} set ${S}${X}${R}${M}${K}`}buildSelection(n,{isSingleTable:i=!1}={}){let o=n.length,c=n.flatMap(({field:p},x)=>{let m=[];if(l(p,L.Aliased)&&p.isSelectionField)m.push(T.identifier(p.fieldAlias));else if(l(p,L.Aliased)||l(p,L)){let a=l(p,L.Aliased)?p.sql:p;if(i)m.push(new L(a.queryChunks.map((f)=>{if(l(f,V))return T.identifier(this.casing.getColumnCasing(f));return f})));else m.push(a);if(l(p,L.Aliased))m.push(T` as ${T.identifier(p.fieldAlias)}`)}else if(l(p,Un))if(i)m.push(T.identifier(this.casing.getColumnCasing(p)));else m.push(p);if(x<o-1)m.push(T`, `);return m});return T.join(c)}buildJoins(n){if(!n||n.length===0)return;let i=[];for(let[o,c]of n.entries()){if(o===0)i.push(T` `);let p=c.table,x=c.lateral?T` lateral`:void 0;if(l(p,Ai)){let m=p[Ai.Symbol.Name],a=p[Ai.Symbol.Schema],f=p[Ai.Symbol.OriginalName],v=m===f?void 0:c.alias;i.push(T`${T.raw(c.joinType)} join${x} ${a?T`${T.identifier(a)}.`:void 0}${T.identifier(f)}${v&&T` ${T.identifier(v)}`} on ${c.on}`)}else if(l(p,bi)){let m=p[un].name,a=p[un].schema,f=p[un].originalName,v=m===f?void 0:c.alias;i.push(T`${T.raw(c.joinType)} join${x} ${a?T`${T.identifier(a)}.`:void 0}${T.identifier(f)}${v&&T` ${T.identifier(v)}`} on ${c.on}`)}else i.push(T`${T.raw(c.joinType)} join${x} ${p} on ${c.on}`);if(o<n.length-1)i.push(T` `)}return T.join(i)}buildFromTable(n){if(l(n,D)&&n[D.Symbol.IsAlias]){let i=T`${T.identifier(n[D.Symbol.OriginalName])}`;if(n[D.Symbol.Schema])i=T`${T.identifier(n[D.Symbol.Schema])}.${i}`;return T`${i} ${T.identifier(n[D.Symbol.Name])}`}return n}buildSelectQuery({withList:n,fields:i,fieldsFlat:o,where:c,having:p,table:x,joins:m,orderBy:a,groupBy:f,limit:v,offset:$,lockingClause:w,distinct:J,setOperators:S}){let X=o??di(i);for(let fn of X)if(l(fn.field,Un)&&mi(fn.field.table)!==(l(x,ci)?x._.alias:l(x,nm)?x[un].name:l(x,L)?void 0:mi(x))&&!((En)=>m?.some(({alias:dn})=>dn===(En[D.Symbol.IsAlias]?mi(En):En[D.Symbol.BaseName])))(fn.field.table)){let En=mi(fn.field.table);throw new Error(`Your "${fn.path.join("->")}" field references a column "${En}"."${fn.field.name}", but the table "${En}" is not part of the query! Did you forget to join it?`)}let R=!m||m.length===0,K=this.buildWithCTE(n),M;if(J)M=J===!0?T` distinct`:T` distinct on (${T.join(J.on,T`, `)})`;let Y=this.buildSelection(X,{isSingleTable:R}),I=this.buildFromTable(x),G=this.buildJoins(m),z=c?T` where ${c}`:void 0,E=p?T` having ${p}`:void 0,Q;if(a&&a.length>0)Q=T` order by ${T.join(a,T`, `)}`;let b;if(f&&f.length>0)b=T` group by ${T.join(f,T`, `)}`;let y=typeof v==="object"||typeof v==="number"&&v>=0?T` limit ${v}`:void 0,H=$?T` offset ${$}`:void 0,an=T.empty();if(w){let fn=T` for ${T.raw(w.strength)}`;if(w.config.of)fn.append(T` of ${T.join(Array.isArray(w.config.of)?w.config.of:[w.config.of],T`, `)}`);if(w.config.noWait)fn.append(T` no wait`);else if(w.config.skipLocked)fn.append(T` skip locked`);an.append(fn)}let Z=T`${K}select${M} ${Y} from ${I}${G}${z}${b}${E}${Q}${y}${H}${an}`;if(S.length>0)return this.buildSetOperations(Z,S);return Z}buildSetOperations(n,i){let[o,...c]=i;if(!o)throw new Error("Cannot pass undefined values to any set operator");if(c.length===0)return this.buildSetOperationQuery({leftSelect:n,setOperator:o});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:n,setOperator:o}),c)}buildSetOperationQuery({leftSelect:n,setOperator:{type:i,isAll:o,rightSelect:c,limit:p,orderBy:x,offset:m}}){let a=T`(${n.getSQL()}) `,f=T`(${c.getSQL()})`,v;if(x&&x.length>0){let S=[];for(let X of x)if(l(X,V))S.push(T.identifier(X.name));else if(l(X,L)){for(let R=0;R<X.queryChunks.length;R++){let K=X.queryChunks[R];if(l(K,V))X.queryChunks[R]=T.identifier(K.name)}S.push(T`${X}`)}else S.push(T`${X}`);v=T` order by ${T.join(S,T`, `)} `}let $=typeof p==="object"||typeof p==="number"&&p>=0?T` limit ${p}`:void 0,w=T.raw(`${i} ${o?"all ":""}`),J=m?T` offset ${m}`:void 0;return T`${a}${w}${f}${v}${$}${J}`}buildInsertQuery({table:n,values:i,onConflict:o,returning:c,withList:p,select:x,overridingSystemValue_:m}){let a=[],f=n[D.Symbol.Columns],v=Object.entries(f).filter(([K,M])=>!M.shouldDisableInsert()),$=v.map(([,K])=>T.identifier(this.casing.getColumnCasing(K)));if(x){let K=i;if(l(K,L))a.push(K);else a.push(K.getSQL())}else{let K=i;a.push(T.raw("values "));for(let[M,Y]of K.entries()){let I=[];for(let[G,z]of v){let E=Y[G];if(E===void 0||l(E,Li)&&E.value===void 0)if(z.defaultFn!==void 0){let Q=z.defaultFn(),b=l(Q,L)?Q:T.param(Q,z);I.push(b)}else if(!z.default&&z.onUpdateFn!==void 0){let Q=z.onUpdateFn(),b=l(Q,L)?Q:T.param(Q,z);I.push(b)}else I.push(T`default`);else I.push(E)}if(a.push(I),M<K.length-1)a.push(T`, `)}}let w=this.buildWithCTE(p),J=T.join(a),S=c?T` returning ${this.buildSelection(c,{isSingleTable:!0})}`:void 0,X=o?T` on conflict ${o}`:void 0,R=m===!0?T`overriding system value `:void 0;return T`${w}insert into ${n} ${$} ${R}${J}${X}${S}`}buildRefreshMaterializedViewQuery({view:n,concurrently:i,withNoData:o}){let c=i?T` concurrently`:void 0,p=o?T` with no data`:void 0;return T`refresh materialized view${c} ${n}${p}`}prepareTyping(n){if(l(n,ia)||l(n,na))return"json";else if(l(n,oa))return"decimal";else if(l(n,ca))return"time";else if(l(n,pa)||l(n,xa))return"timestamp";else if(l(n,dm)||l(n,gm))return"date";else if(l(n,ma))return"uuid";else return"none"}sqlToQuery(n,i){return n.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:i})}buildRelationalQueryWithoutPK({fullSchema:n,schema:i,tableNamesMap:o,table:c,tableConfig:p,queryConfig:x,tableAlias:m,nestedQueryRelation:a,joinOn:f}){let v=[],$,w,J=[],S,X=[];if(x===!0)v=Object.entries(p.columns).map(([M,Y])=>({dbKey:Y.name,tsKey:M,field:Mo(Y,m),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let K=Object.fromEntries(Object.entries(p.columns).map(([E,Q])=>[E,Mo(Q,m)]));if(x.where){let E=typeof x.where==="function"?x.where(K,mT()):x.where;S=E&&Ex(E,m)}let M=[],Y=[];if(x.columns){let E=!1;for(let[Q,b]of Object.entries(x.columns)){if(b===void 0)continue;if(Q in p.columns){if(!E&&b===!0)E=!0;Y.push(Q)}}if(Y.length>0)Y=E?Y.filter((Q)=>x.columns?.[Q]===!0):Object.keys(p.columns).filter((Q)=>!Y.includes(Q))}else Y=Object.keys(p.columns);for(let E of Y){let Q=p.columns[E];M.push({tsKey:E,value:Q})}let I=[];if(x.with)I=Object.entries(x.with).filter((E)=>!!E[1]).map(([E,Q])=>({tsKey:E,queryConfig:Q,relation:p.relations[E]}));let G;if(x.extras){G=typeof x.extras==="function"?x.extras(K,{sql:T}):x.extras;for(let[E,Q]of Object.entries(G))M.push({tsKey:E,value:Gv(Q,m)})}for(let{tsKey:E,value:Q}of M)v.push({dbKey:l(Q,L.Aliased)?Q.fieldAlias:p.columns[E].name,tsKey:E,field:l(Q,Un)?Mo(Q,m):Q,relationTableTsKey:void 0,isJson:!1,selection:[]});let z=typeof x.orderBy==="function"?x.orderBy(K,aT()):x.orderBy??[];if(!Array.isArray(z))z=[z];J=z.map((E)=>{if(l(E,Un))return Mo(E,m);return Ex(E,m)}),$=x.limit,w=x.offset;for(let{tsKey:E,queryConfig:Q,relation:b}of I){let y=vT(i,o,b),H=Ec(b.referencedTable),an=o[H],Z=`${m}_${E}`,fn=Oc(...y.fields.map((Vi,Oo)=>Yo(Mo(y.references[Oo],Z),Mo(Vi,m)))),En=this.buildRelationalQueryWithoutPK({fullSchema:n,schema:i,tableNamesMap:o,table:n[an],tableConfig:i[an],queryConfig:l(b,ic)?Q===!0?{limit:1}:{...Q,limit:1}:Q,tableAlias:Z,joinOn:fn,nestedQueryRelation:b}),dn=T`${T.identifier(Z)}.${T.identifier("data")}`.as(E);X.push({on:T`true`,table:new ci(En.sql,{},Z),alias:Z,joinType:"left",lateral:!0}),v.push({dbKey:E,tsKey:E,field:dn,relationTableTsKey:an,isJson:!0,selection:En.selection})}}if(v.length===0)throw new Pm({message:`No fields selected for table "${p.tsName}" ("${m}")`});let R;if(S=Oc(f,S),a){let K=T`json_build_array(${T.join(v.map(({field:I,tsKey:G,isJson:z})=>z?T`${T.identifier(`${m}_${G}`)}.${T.identifier("data")}`:l(I,L.Aliased)?I.sql:I),T`, `)})`;if(l(a,_x))K=T`coalesce(json_agg(${K}${J.length>0?T` order by ${T.join(J,T`, `)}`:void 0}), '[]'::json)`;let M=[{dbKey:"data",tsKey:"data",field:K.as("data"),isJson:!0,relationTableTsKey:p.tsName,selection:v}];if($!==void 0||w!==void 0||J.length>0)R=this.buildSelectQuery({table:sm(c,m),fields:{},fieldsFlat:[{path:[],field:T.raw("*")}],where:S,limit:$,offset:w,orderBy:J,setOperators:[]}),S=void 0,$=void 0,w=void 0,J=[];else R=sm(c,m);R=this.buildSelectQuery({table:l(R,Ai)?R:new ci(R,{},m),fields:{},fieldsFlat:M.map(({field:I})=>({path:[],field:l(I,Un)?Mo(I,m):I})),joins:X,where:S,limit:$,offset:w,orderBy:J,setOperators:[]})}else R=this.buildSelectQuery({table:sm(c,m),fields:{},fieldsFlat:v.map(({field:K})=>({path:[],field:l(K,Un)?Mo(K,m):K})),joins:X,where:S,limit:$,offset:w,orderBy:J,setOperators:[]});return{tableTsKey:p.tsName,sql:R,selection:v}}}class r${static[F]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class Ui{static[F]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor(n){if(this.fields=n.fields,this.session=n.session,this.dialect=n.dialect,n.withList)this.withList=n.withList;this.distinct=n.distinct}authToken;setToken(n){return this.authToken=n,this}from(n){let i=!!this.fields,o=n,c;if(this.fields)c=this.fields;else if(l(o,ci))c=Object.fromEntries(Object.keys(o._.selectedFields).map((p)=>[p,o[p]]));else if(l(o,nm))c=o[un].selectedFields;else if(l(o,L))c={};else c=mA(o);return new d$({table:o,fields:c,isPartialSelect:i,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class DR extends r${static[F]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:n,fields:i,isPartialSelect:o,session:c,dialect:p,withList:x,distinct:m}){super();this.config={withList:x,table:n,fields:{...i},distinct:m,setOperators:[]},this.isPartialSelect=o,this.session=c,this.dialect=p,this._={selectedFields:i},this.tableName=_o(n),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}createJoin(n){return(i,o)=>{let c=this.tableName,p=_o(i);if(typeof p==="string"&&this.config.joins?.some((x)=>x.alias===p))throw new Error(`Alias "${p}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof c==="string")this.config.fields={[c]:this.config.fields};if(typeof p==="string"&&!l(i,L)){let x=l(i,ci)?i._.selectedFields:l(i,bi)?i[un].selectedFields:i[D.Symbol.Columns];this.config.fields[p]=x}}if(typeof o==="function")o=o(new Proxy(this.config.fields,new kn({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:o,table:i,joinType:n,alias:p}),typeof p==="string")switch(n){case"left":{this.joinsNotNullableMap[p]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([x])=>[x,!1])),this.joinsNotNullableMap[p]=!0;break}case"inner":{this.joinsNotNullableMap[p]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([x])=>[x,!1])),this.joinsNotNullableMap[p]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(n,i){return(o)=>{let c=typeof o==="function"?o(OM()):o;if(!Ox(this.getSelectedFields(),c.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:n,isAll:i,rightSelect:c}),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(n){return this.config.setOperators.push(...n),this}where(n){if(typeof n==="function")n=n(new Proxy(this.config.fields,new kn({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=n,this}having(n){if(typeof n==="function")n=n(new Proxy(this.config.fields,new kn({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=n,this}groupBy(...n){if(typeof n[0]==="function"){let i=n[0](new Proxy(this.config.fields,new kn({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(i)?i:[i]}else this.config.groupBy=n;return this}orderBy(...n){if(typeof n[0]==="function"){let i=n[0](new Proxy(this.config.fields,new kn({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),o=Array.isArray(i)?i:[i];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=o;else this.config.orderBy=o}else{let i=n;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=i;else this.config.orderBy=i}return this}limit(n){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=n;else this.config.limit=n;return this}offset(n){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=n;else this.config.offset=n;return this}for(n,i={}){return this.config.lockingClause={strength:n,config:i},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:n,...i}=this.dialect.sqlToQuery(this.getSQL());return i}as(n){return new Proxy(new ci(this.getSQL(),this.config.fields,n),new kn({alias:n,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new kn({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class d$ extends DR{static[F]="PgSelect";_prepare(n){let{session:i,config:o,dialect:c,joinsNotNullableMap:p,authToken:x}=this;if(!i)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");return Vn.startActiveSpan("drizzle.prepareQuery",()=>{let m=di(o.fields),a=i.prepareQuery(c.sqlToQuery(this.getSQL()),m,n,!0);return a.joinsNotNullableMap=p,a.setToken(x)})}prepare(n){return this._prepare(n)}authToken;setToken(n){return this.authToken=n,this}execute=(n)=>{return Vn.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(n,this.authToken)})}}xA(d$,[Qi]);function dp(n,i){return(o,c,...p)=>{let x=[c,...p].map((m)=>({type:n,isAll:i,rightSelect:m}));for(let m of x)if(!Ox(o.getSelectedFields(),m.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return o.addSetOperators(x)}}var OM=()=>({union:UM,unionAll:VM,intersect:_M,intersectAll:bM,except:uM,exceptAll:BM}),UM=dp("union",!1),VM=dp("union",!0),_M=dp("intersect",!1),bM=dp("intersect",!0),uM=dp("except",!1),BM=dp("except",!0);class im{static[F]="PgQueryBuilder";dialect;dialectConfig;constructor(n){this.dialect=l(n,sc)?n:void 0,this.dialectConfig=l(n,sc)?void 0:n}$with=(n,i)=>{let o=this;return{as:(p)=>{if(typeof p==="function")p=p(o);return new Proxy(new Hx(p.getSQL(),i??("getSelectedFields"in p?p.getSelectedFields()??{}:{}),n,!0),new kn({alias:n,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...n){let i=this;function o(x){return new Ui({fields:x??void 0,session:void 0,dialect:i.getDialect(),withList:n})}function c(x){return new Ui({fields:x??void 0,session:void 0,dialect:i.getDialect(),distinct:!0})}function p(x,m){return new Ui({fields:m??void 0,session:void 0,dialect:i.getDialect(),distinct:{on:x}})}return{select:o,selectDistinct:c,selectDistinctOn:p}}select(n){return new Ui({fields:n??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(n){return new Ui({fields:n??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(n,i){return new Ui({fields:i??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:n}})}getDialect(){if(!this.dialect)this.dialect=new sc(this.dialectConfig);return this.dialect}}class ga{constructor(n,i,o,c,p){this.table=n,this.session=i,this.dialect=o,this.withList=c,this.overridingSystemValue_=p}static[F]="PgInsertBuilder";authToken;setToken(n){return this.authToken=n,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values(n){if(n=Array.isArray(n)?n:[n],n.length===0)throw new Error("values() must be called with at least one value");let i=n.map((o)=>{let c={},p=this.table[D.Symbol.Columns];for(let x of Object.keys(o)){let m=o[x];c[x]=l(m,L)?m:new Li(m,p[x])}return c});return new g$(this.table,i,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select(n){let i=typeof n==="function"?n(new im):n;if(!l(i,L)&&!Ox(this.table[Zm],i._.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 g$(this.table,i,this.session,this.dialect,this.withList,!0)}}class g$ extends Qi{constructor(n,i,o,c,p,x,m){super();this.session=o,this.dialect=c,this.config={table:n,values:i,withList:p,select:x,overridingSystemValue_:m}}static[F]="PgInsert";config;returning(n=this.config.table[D.Symbol.Columns]){return this.config.returningFields=n,this.config.returning=di(n),this}onConflictDoNothing(n={}){if(n.target===void 0)this.config.onConflict=T`do nothing`;else{let i="";i=Array.isArray(n.target)?n.target.map((c)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(c))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(n.target));let o=n.where?T` where ${n.where}`:void 0;this.config.onConflict=T`(${T.raw(i)})${o} do nothing`}return this}onConflictDoUpdate(n){if(n.where&&(n.targetWhere||n.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 i=n.where?T` where ${n.where}`:void 0,o=n.targetWhere?T` where ${n.targetWhere}`:void 0,c=n.setWhere?T` where ${n.setWhere}`:void 0,p=this.dialect.buildUpdateSet(this.config.table,rm(this.config.table,n.set)),x="";return x=Array.isArray(n.target)?n.target.map((m)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(m))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(n.target)),this.config.onConflict=T`(${T.raw(x)})${o} do update set ${p}${i}${c}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:n,...i}=this.dialect.sqlToQuery(this.getSQL());return i}_prepare(n){return Vn.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,n,!0)})}prepare(n){return this._prepare(n)}authToken;setToken(n){return this.authToken=n,this}execute=(n)=>{return Vn.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(n,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new kn({alias:mi(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class e$ extends Qi{constructor(n,i,o){super();this.session=i,this.dialect=o,this.config={view:n}}static[F]="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:n,...i}=this.dialect.sqlToQuery(this.getSQL());return i}_prepare(n){return Vn.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,n,!0)})}prepare(n){return this._prepare(n)}authToken;setToken(n){return this.authToken=n,this}execute=(n)=>{return Vn.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(n,this.authToken)})}}class ea{constructor(n,i,o,c){this.table=n,this.session=i,this.dialect=o,this.withList=c}static[F]="PgUpdateBuilder";authToken;setToken(n){return this.authToken=n,this}set(n){return new LR(this.table,rm(this.table,n),this.session,this.dialect,this.withList).setToken(this.authToken)}}class LR extends Qi{constructor(n,i,o,c,p){super();this.session=o,this.dialect=c,this.config={set:i,table:n,withList:p,joins:[]},this.tableName=_o(n),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[F]="PgUpdate";config;tableName;joinsNotNullableMap;from(n){let i=n,o=_o(i);if(typeof o==="string")this.joinsNotNullableMap[o]=!0;return this.config.from=i,this}getTableLikeFields(n){if(l(n,Ai))return n[D.Symbol.Columns];else if(l(n,ci))return n._.selectedFields;return n[un].selectedFields}createJoin(n){return(i,o)=>{let c=_o(i);if(typeof c==="string"&&this.config.joins.some((p)=>p.alias===c))throw new Error(`Alias "${c}" is already used in this query`);if(typeof o==="function"){let p=this.config.from&&!l(this.config.from,L)?this.getTableLikeFields(this.config.from):void 0;o=o(new Proxy(this.config.table[D.Symbol.Columns],new kn({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),p&&new Proxy(p,new kn({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:o,table:i,joinType:n,alias:c}),typeof c==="string")switch(n){case"left":{this.joinsNotNullableMap[c]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([p])=>[p,!1])),this.joinsNotNullableMap[c]=!0;break}case"inner":{this.joinsNotNullableMap[c]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([p])=>[p,!1])),this.joinsNotNullableMap[c]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(n){return this.config.where=n,this}returning(n){if(!n){if(n=Object.assign({},this.config.table[D.Symbol.Columns]),this.config.from){let i=_o(this.config.from);if(typeof i==="string"&&this.config.from&&!l(this.config.from,L)){let o=this.getTableLikeFields(this.config.from);n[i]=o}for(let o of this.config.joins){let c=_o(o.table);if(typeof c==="string"&&!l(o.table,L)){let p=this.getTableLikeFields(o.table);n[c]=p}}}}return this.config.returningFields=n,this.config.returning=di(n),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:n,...i}=this.dialect.sqlToQuery(this.getSQL());return i}_prepare(n){let i=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,n,!0);return i.joinsNotNullableMap=this.joinsNotNullableMap,i}prepare(n){return this._prepare(n)}authToken;setToken(n){return this.authToken=n,this}execute=(n)=>{return this._prepare().execute(n,this.authToken)};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new kn({alias:mi(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class om extends L{constructor(n){super(om.buildEmbeddedCount(n.source,n.filters).queryChunks);this.params=n,this.mapWith(Number),this.session=n.session,this.sql=om.buildCount(n.source,n.filters)}sql;token;static[F]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount(n,i){return T`(select count(*) from ${n}${T.raw(" where ").if(i)}${i})`}static buildCount(n,i){return T`select count(*) as count from ${n}${T.raw(" where ").if(i)}${i};`}setToken(n){return this.token=n,this}then(n,i){return Promise.resolve(this.session.count(this.sql,this.token)).then(n,i)}catch(n){return this.then(void 0,n)}finally(n){return this.then((i)=>{return n?.(),i},(i)=>{throw n?.(),i})}}class i0{constructor(n,i,o,c,p,x,m){this.fullSchema=n,this.schema=i,this.tableNamesMap=o,this.table=c,this.tableConfig=p,this.dialect=x,this.session=m}static[F]="PgRelationalQueryBuilder";findMany(n){return new n0(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,n?n:{},"many")}findFirst(n){return new n0(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,n?{...n,limit:1}:{limit:1},"first")}}class n0 extends Qi{constructor(n,i,o,c,p,x,m,a,f){super();this.fullSchema=n,this.schema=i,this.tableNamesMap=o,this.table=c,this.tableConfig=p,this.dialect=x,this.session=m,this.config=a,this.mode=f}static[F]="PgRelationalQuery";_prepare(n){return Vn.startActiveSpan("drizzle.prepareQuery",()=>{let{query:i,builtQuery:o}=this._toSQL();return this.session.prepareQuery(o,void 0,n,!0,(c,p)=>{let x=c.map((m)=>aa(this.schema,this.tableConfig,m,i.selection,p));if(this.mode==="first")return x[0];return x})})}prepare(n){return this._prepare(n)}_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 n=this._getQuery(),i=this.dialect.sqlToQuery(n.sql);return{query:n,builtQuery:i}}toSQL(){return this._toSQL().builtQuery}authToken;setToken(n){return this.authToken=n,this}execute(){return Vn.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class o0 extends Qi{constructor(n,i,o,c){super();this.execute=n,this.sql=i,this.query=o,this.mapBatchResult=c}static[F]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult(n,i){return i?this.mapBatchResult(n):n}_prepare(){return this}isResponseInArrayMode(){return!1}}class cm{constructor(n,i,o){if(this.dialect=n,this.session=i,this._=o?{schema:o.schema,fullSchema:o.fullSchema,tableNamesMap:o.tableNamesMap,session:i}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:i},this.query={},this._.schema)for(let[c,p]of Object.entries(this._.schema))this.query[c]=new i0(o.fullSchema,this._.schema,this._.tableNamesMap,o.fullSchema[c],p,n,i)}static[F]="PgDatabase";query;$with=(n,i)=>{let o=this;return{as:(p)=>{if(typeof p==="function")p=p(new im(o.dialect));return new Proxy(new Hx(p.getSQL(),i??("getSelectedFields"in p?p.getSelectedFields()??{}:{}),n,!0),new kn({alias:n,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count(n,i){return new om({source:n,filters:i,session:this.session})}with(...n){let i=this;function o(f){return new Ui({fields:f??void 0,session:i.session,dialect:i.dialect,withList:n})}function c(f){return new Ui({fields:f??void 0,session:i.session,dialect:i.dialect,withList:n,distinct:!0})}function p(f,v){return new Ui({fields:v??void 0,session:i.session,dialect:i.dialect,withList:n,distinct:{on:f}})}function x(f){return new ea(f,i.session,i.dialect,n)}function m(f){return new ga(f,i.session,i.dialect,n)}function a(f){return new da(f,i.session,i.dialect,n)}return{select:o,selectDistinct:c,selectDistinctOn:p,update:x,insert:m,delete:a}}select(n){return new Ui({fields:n??void 0,session:this.session,dialect:this.dialect})}selectDistinct(n){return new Ui({fields:n??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(n,i){return new Ui({fields:i??void 0,session:this.session,dialect:this.dialect,distinct:{on:n}})}update(n){return new ea(n,this.session,this.dialect)}insert(n){return new ga(n,this.session,this.dialect)}delete(n){return new da(n,this.session,this.dialect)}refreshMaterializedView(n){return new e$(n,this.session,this.dialect)}authToken;execute(n){let i=typeof n==="string"?T.raw(n):n.getSQL(),o=this.dialect.sqlToQuery(i),c=this.session.prepareQuery(o,void 0,void 0,!1);return new o0(()=>c.execute(void 0,this.authToken),i,o,(p)=>c.mapResult(p,!0))}transaction(n,i){return this.session.transaction(n,i)}}class NR{constructor(n,i){this.unique=n,this.name=i}static[F]="PgIndexBuilderOn";on(...n){return new nf(n.map((i)=>{if(l(i,L))return i;i=i;let o=new Yx(i.name,!!i.keyAsName,i.columnType,i.indexConfig);return i.indexConfig=JSON.parse(JSON.stringify(i.defaultConfig)),o}),this.unique,!1,this.name)}onOnly(...n){return new nf(n.map((i)=>{if(l(i,L))return i;i=i;let o=new Yx(i.name,!!i.keyAsName,i.columnType,i.indexConfig);return i.indexConfig=i.defaultConfig,o}),this.unique,!0,this.name)}using(n,...i){return new nf(i.map((o)=>{if(l(o,L))return o;o=o;let c=new Yx(o.name,!!o.keyAsName,o.columnType,o.indexConfig);return o.indexConfig=JSON.parse(JSON.stringify(o.defaultConfig)),c}),this.unique,!0,this.name,n)}}class nf{static[F]="PgIndexBuilder";config;constructor(n,i,o,c,p="btree"){this.config={name:c,columns:n,unique:i,only:o,method:p}}concurrently(){return this.config.concurrently=!0,this}with(n){return this.config.with=n,this}where(n){return this.config.where=n,this}build(n){return new hR(this.config,n)}}class hR{static[F]="PgIndex";config;constructor(n,i){this.config={...n,table:i}}}function c0(n){return new NR(!0,n)}class p0{constructor(n){this.query=n}authToken;getQuery(){return this.query}mapResult(n,i){return n}setToken(n){return this.authToken=n,this}static[F]="PgPreparedQuery";joinsNotNullableMap}class x0{constructor(n){this.dialect=n}static[F]="PgSession";execute(n,i){return Vn.startActiveSpan("drizzle.operation",()=>{return Vn.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery(n),void 0,void 0,!1)}).setToken(i).execute(void 0,i)})}all(n){return this.prepareQuery(this.dialect.sqlToQuery(n),void 0,void 0,!1).all()}async count(n,i){let o=await this.execute(n,i);return Number(o[0].count)}}class m0 extends cm{constructor(n,i,o,c=0){super(n,i,o);this.schema=o,this.nestedIndex=c}static[F]="PgTransaction";rollback(){throw new Mv}getTransactionConfigSQL(n){let i=[];if(n.isolationLevel)i.push(`isolation level ${n.isolationLevel}`);if(n.accessMode)i.push(n.accessMode);if(typeof n.deferrable==="boolean")i.push(n.deferrable?"deferrable":"not deferrable");return T.raw(i.join(" "))}setTransaction(n){return this.session.execute(T`set transaction ${this.getTransactionConfigSQL(n)}`)}}class CR extends p0{constructor(n,i,o,c,p,x,m){super({sql:i,params:o});this.client=n,this.queryString=i,this.params=o,this.logger=c,this.fields=p,this._isResponseInArrayMode=x,this.customResultMapper=m}static[F]="PostgresJsPreparedQuery";async execute(n={}){return Vn.startActiveSpan("drizzle.execute",async(i)=>{let o=lv(this.params,n);i?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(o)}),this.logger.logQuery(this.queryString,o);let{fields:c,queryString:p,client:x,joinsNotNullableMap:m,customResultMapper:a}=this;if(!c&&!a)return Vn.startActiveSpan("drizzle.driver.execute",()=>{return x.unsafe(p,o)});let f=await Vn.startActiveSpan("drizzle.driver.execute",()=>{return i?.setAttributes({"drizzle.query.text":p,"drizzle.query.params":JSON.stringify(o)}),x.unsafe(p,o).values()});return Vn.startActiveSpan("drizzle.mapResponse",()=>{return a?a(f):f.map((v)=>pA(c,v,m))})})}all(n={}){return Vn.startActiveSpan("drizzle.execute",async(i)=>{let o=lv(this.params,n);return i?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(o)}),this.logger.logQuery(this.queryString,o),Vn.startActiveSpan("drizzle.driver.execute",()=>{return i?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(o)}),this.client.unsafe(this.queryString,o)})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class pm extends x0{constructor(n,i,o,c={}){super(i);this.client=n,this.schema=o,this.options=c,this.logger=c.logger??new Hv}static[F]="PostgresJsSession";logger;prepareQuery(n,i,o,c,p){return new CR(this.client,n.sql,n.params,this.logger,i,c,p)}query(n,i){return this.logger.logQuery(n,i),this.client.unsafe(n,i).values()}queryObjects(n,i){return this.client.unsafe(n,i)}transaction(n,i){return this.client.begin(async(o)=>{let c=new pm(o,this.dialect,this.schema,this.options),p=new a0(this.dialect,c,this.schema);if(i)await p.setTransaction(i);return n(p)})}}class a0 extends m0{constructor(n,i,o,c=0){super(n,i,o,c);this.session=i}static[F]="PostgresJsTransaction";transaction(n){return this.session.client.savepoint((i)=>{let o=new pm(i,this.dialect,this.schema,this.session.options),c=new a0(this.dialect,o,this.schema);return n(c)})}}class IR extends cm{static[F]="PostgresJsDatabase"}function gp(n,i={}){let o=(f)=>f;for(let f of["1184","1082","1083","1114","1182","1185","1115","1231"])n.options.parsers[f]=o,n.options.serializers[f]=o;n.options.serializers["114"]=o,n.options.serializers["3802"]=o;let c=new sc({casing:i.casing}),p;if(i.logger===!0)p=new Yv;else if(i.logger!==!1)p=i.logger;let x;if(i.schema){let f=fT(i.schema,$T);x={fullSchema:i.schema,schema:f.tables,tableNamesMap:f.tableNamesMap}}let m=new pm(n,c,x,{logger:p}),a=new IR(c,m,x);return a.$client=n,a}function of(...n){if(typeof n[0]==="string"){let i=rp(n[0]);return gp(i,n[1])}if(aA(n[0])){let{connection:i,client:o,...c}=n[0];if(o)return gp(o,c);if(typeof i==="object"&&i.url!==void 0){let{url:x,...m}=i,a=rp(x,m);return gp(a,c)}let p=rp(i);return gp(p,c)}return gp(n[0],n[1])}((n)=>{function i(o){return gp({options:{parsers:{},serializers:{}}},o)}n.mock=i})(of||(of={}));var v0={};p3(v0,{users:()=>So,userChanges:()=>DM,untrackedUserColumnNames:()=>jM,twoFactorMethod:()=>sR,trackedUserColumnName:()=>qR,trackableUserColumnNames:()=>ZR,role:()=>kR,players:()=>f0,passwordResetAttempts:()=>LM,loginHistory:()=>ep,games:()=>cf,banishedIps:()=>pf});function yR(n){return T`lower(${n})`}var kR=ym("role",["admin","user"]),So=nc("users",{id:Ni().primaryKey().defaultRandom(),username:Ji({length:16}).notNull(),email:Ji({length:254}).notNull(),hash:Ji({length:64}).notNull(),salt:Ji({length:36}).notNull(),createdAt:vo({withTimezone:!0}).notNull().defaultNow(),createdIp:Ji({length:45}).notNull(),isActive:Ux().notNull().default(!1),verifiedAt:vo({withTimezone:!0}),userRole:kR().default("user")},(n)=>[c0("usernameUniqueIndex").on(yR(n.username)),c0("emailUniqueIndex").on(yR(n.email))]),jM=["id","createdAt","createdIp","isActive","salt","verifiedAt"],ZR=["username","email","hash","userRole"],qR=ym("trackedUserColumnName",ZR),DM=nc("userChanges",{id:Ni().primaryKey().defaultRandom(),userId:Ni().notNull().references(()=>So.id),changedAt:vo({withTimezone:!0}).notNull().defaultNow(),changedIp:Ji({length:45}).notNull(),changedColumn:qR().notNull(),oldValue:Ji({length:255}),newValue:Ji({length:255})}),cf=nc("games",{id:Ni().primaryKey().defaultRandom()}),f0=nc("players",{userId:Ni().notNull().references(()=>So.id),gameId:Ni().notNull().references(()=>cf.id),score:em().notNull()},(n)=>[cT({name:"players_userId_gameId_pk",columns:[n.userId,n.gameId]})]),ep=nc("loginHistory",{id:Ni().primaryKey().defaultRandom(),userId:Ni().references(()=>So.id),loginTime:vo({withTimezone:!0}).notNull().defaultNow(),ipAddress:Ji({length:45}).notNull(),userAgent:Ji({length:1024}),successful:Ux().notNull().default(!1)}),sR=ym("twoFactorMethod",["email","phone"]),LM=nc("passwordResetAttempts",{id:Ni().primaryKey().defaultRandom(),userId:Ni().notNull().references(()=>So.id),requestedIp:Ji({length:45}).notNull(),requestedAt:vo({withTimezone:!0}).notNull().defaultNow(),succeededIp:Ji({length:45}),succeededAt:vo({withTimezone:!0}),verificationMethod:sR().notNull()}),pf=nc("banishedIps",{ip:Ji({length:45}).primaryKey(),reason:Ji({length:2048}).notNull(),banishedAt:vo({withTimezone:!0}).notNull().defaultNow(),banishedUntil:vo({withTimezone:!0})});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class $0{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(NM.resolve(__dirname,"notify_update.sql"));let n=[mi(So),mi(cf),mi(f0)];await this.sql`SELECT create_notify_triggers(${this.sql.array(n)})`,await this.sql.listen("table_update",(i)=>{let o=i.split(","),c=o[0],p=o[1],x=`${c}("${p}")`;if(this.observers.has(x))this.observers.get(x).next(x)})}constructor(n=!1,i={host:sn.POSTGRES_HOST,port:sn.POSTGRES_PORT,user:sn.POSTGRES_USER,password:sn.POSTGRES_PASSWORD,database:sn.POSTGRES_DATABASE}){this.options=i,this.sql=rp(i),this.drizzle=of(this.sql,{schema:v0,logger:n})}observe(n,i){if(!this.observers.has(n))this.observers.set(n,new $n);this.observers.get(n).subscribe("SINGLETON",i)}}import{createHash as hM}from"node:crypto";function w0(n){let i=hM("sha256").update(n).digest("hex");return`${i.substring(0,8)}-${i.substring(8,12)}-${i.substring(12,16)}-${i.substring(16,20)}-${i.substring(20,32)}`}var PR=["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 CM=3,IM=15,yM=/^[a-zA-Z0-9_-]+$/,dR=Wn.string().min(CM).max(IM).regex(yM),tR=20,rR={"0":"o","1":"l","3":"e","4":"a","5":"s","7":"t","@":"a",$:"s","!":"i"};function kM(n){let i="";for(let o of n)if(o in rR)i+=rR[o];else i+=o;return i}function ZM(n){let i=n.toLocaleLowerCase(),o=kM(i);for(let c of PR){if(o.includes(c))return!0;if(i.includes(c))return!0}return!1}function qM(n){let i=new Set(n).size;return n.length*Math.log2(i)}function sM(n){let i=0,o=100;if(ZM(n))i-=o;return i+=qM(n)*0.5,Math.max(i,0)}var gR=Wn.string().refine((n)=>{return sM(n)>=tR},{message:`Password does not meet the minimum complexity of ${tR}.`}).brand("password"),eR=Wn.object({username:dR,password:gR}).strict(),PM=Wn.string().email().brand("email"),nS=Wn.object({username:dR,password:gR,email:PM}).strict();var xf={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"},J0=Y0(xf).map(([n])=>Wn.literal(Number(n))),tM=Wn.union([J0[0],J0[1],...J0]),iS=Wn.tuple([tM,Wn.string()]);var oS=Zo({key:"count",default:0}),rM=lc({key:"incrementTX",do:({set:n})=>{n(oS,(i)=>i+1)}}),cS=R1({key:"countContinuity",config:(n)=>n.add(oS).add(rM)});var xS=U$($c,"backend.worker.game.bun",mn),Pc=new $0({logQuery(n,i){mn.info("\uD83D\uDCDD query",n,i)}});g.STORE.loggers[0]=new Xc("info",void 0,mn);var my=(()=>{let{__tribunalDaily:n}=globalThis;if(!n)n=new mS.CronJob("00 15 * * * *",()=>{U$($c,"backend.worker.tribunal.bun",mn)}),n.start(),process.on("exit",()=>{n.stop(),mn.info("\u231B tribunal daily cronjob stopped")}),mn.info("\u23F3 tribunal daily cronjob started");return n})();function eM(n){if(O$)return gM(O$,n);return dM({},n)}var aS=eM((n,i)=>{let o;n.on("data",(c)=>(o??=[]).push(c)).on("end",async()=>{let c=n.headers.authorization;try{if(typeof n.url==="undefined")throw[400,"No URL"];let p=n.socket.remoteAddress;if(!p)throw[400,"No IP address"];let x=new Date,m=new URL(n.url,sn.VITE_BACKEND_ORIGIN);mn.info(x,p,n.method,m.pathname);let a=await Pc.drizzle.query.banishedIps.findFirst({columns:{banishedUntil:!0},where:Yo(pf.ip,p)}),f=a?.banishedUntil===null,v=a?.banishedUntil&&a.banishedUntil>x;if(f||v){mn.info(`\uD83D\uDE45 request from banned ip ${p}`);return}switch(n.method){case"POST":if(!o)throw[400,"No data received"];switch(m.pathname){case`/sign-up-${w0("sign-up")}`:{let $=Buffer.concat(o).toString(),w=JSON.parse($),J=nS.safeParse(w);if(!J.success){mn.warn("signup parsed",J.error.issues);return}let{username:S,password:X,email:R}=J.data;if(mn.info(`\uD83D\uDD11 attempting to sign up: ${S}`),await Pc.drizzle.query.users.findFirst({columns:{id:!0},where:Yo(So.email,R)}))throw[400,"User already exists"];let M=crypto.randomUUID(),Y=pS("sha256").update(X+M).digest("hex");await Pc.drizzle.insert(So).values({username:S,email:R,hash:Y,salt:M,createdIp:p}),mn.info(`\uD83D\uDD11 user created: ${S}`),i.writeHead(201,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${sn.FRONTEND_ORIGINS[0]}`}),i.end(xf[201])}break;case`/login-${w0("login")}`:{let $=!1,w=null;try{let J=new Date(+x-600000);mn.info("\uD83D\uDD11 ten minutes ago",{tenMinutesAgo:J,now:x});let S=await Pc.drizzle.query.loginHistory.findMany({columns:{userId:!0,successful:!0},where:Oc(Yo(ep.ipAddress,p),Yo(ep.successful,!1),tm(ep.loginTime,J)),limit:10});mn.info(`\uD83D\uDD11 ${S.length}/10 recent failed logins from ${p}`);let X=10-S.length;if(X<1)throw mn.info(`\uD83D\uDD11 too many recent failed logins from ${p}`),await Pc.drizzle.insert(pf).values({ip:p,reason:"Too many recent login attempts.",banishedAt:x,banishedUntil:new Date(+x+86400000)}),[429,"Too many recent login attempts."];let R=Buffer.concat(o).toString(),K=JSON.parse(R),M=eR.safeParse(K);if(!M.success)throw mn.warn("login parsed",M.error.issues),[400,`${X} attempts remaining.`];let{username:Y,password:I}=M.data,G=await Pc.drizzle.query.users.findFirst({columns:{id:!0,hash:!0,salt:!0},where:Yo(So.username,Y)});if(mn.info("\uD83D\uDD11 login attempt as user",Y),!G)throw mn.info(`\uD83D\uDD11 user ${Y} does not exist`),[400,`${X} attempts remaining.`];let{hash:z,salt:E}=G;if(w=G.id,pS("sha256").update(I+E).digest("hex")===z){let b=crypto.randomUUID(),y=Na.get(Y);if(!y)y=new Map,Na.set(Y,y);y.set(b,Number(x)),$=!0,mn.info("\uD83D\uDD11 login successful as",Y),i.writeHead(200,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${sn.FRONTEND_ORIGINS[0]}`}),i.end(`${Y} ${b}`)}}finally{await Pc.drizzle.insert(ep).values({userId:w,successful:$,ipAddress:p,userAgent:n.headers["user-agent"]??"Withheld"}),mn.info(`\uD83D\uDD11 recorded login attempt from ${p}`)}}break;default:throw[404,"Not found"]}break;case void 0:throw[400,"No Method"];default:throw[405,"Method not allowed"]}}catch(p){let x=iS.safeParse(p);if(x.success){let[m,a]=x.data,v=`${xf[m]}. ${a}`;mn.info(`\u274C ${m}: ${v}`),i.writeHead(m,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${sn.FRONTEND_ORIGINS[0]}`}),i.end(v)}else mn.error(p),i.writeHead(500,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${sn.FRONTEND_ORIGINS[0]}`}),i.end("Internal Server Error")}})}),A0=aS.listen(sn.BACKEND_PORT).address(),nY=typeof A0==="string"?null:A0===null?null:A0.port;if(nY===null)throw new Error("Could not determine port for test server");new e6(aS,{cors:{origin:sn.FRONTEND_ORIGINS,methods:["GET","POST"]}}).use((n,i)=>{let{username:o,sessionKey:c}=n.handshake.auth;if(!(o&&c)){i(new Error("No auth header provided"));return}let p=`user::${o}`,x=`socket::${n.id}`;if(Na.get(o)?.has(c)){let a=t(g.STORE,Km,x);On(g.STORE,a,n),ko(Gc,(f)=>{f.set(p,x)},g.STORE),On(g.STORE,bf,(f)=>f.add(p)),On(g.STORE,_f,(f)=>f.add(x)),mn.info(`${o} connected on ${n.id}`),i()}else mn.info(`${o} couldn't authenticate`),i(new Error("Authentication error"))}).on("connection",(n)=>{let o=Y1({socket:n,store:g.STORE})(cS);n.on("disconnect",()=>{let c=`socket::${n.id}`,p=ip(Gc,c,g.STORE).userKeyOfSocket,x=Gn(g.STORE,p);if(ko(Gc,(m)=>{m.delete(c)},g.STORE),x)On(g.STORE,bf,(m)=>(m.delete(x),m));On(g.STORE,_f,(m)=>(m.delete(c),m)),mn.info(`${n.id} disconnected`),o()})});async function mf(){mn.info("\uD83E\uDDF9 closing workers");let n=new Promise((i)=>xS.process.once("close",i));xS.emit("timeToStop"),await n,mn.info("\uD83D\uDEEC backend server exiting"),process.exit(0)}process.on("SIGINT",async()=>{mn.info("\u2757 received SIGINT; exiting gracefully"),await mf()});process.on("SIGTERM",async()=>{mn.info("\u2757 received SIGTERM; exiting gracefully"),await mf()});process.on("exit",async()=>{mn.info("\u2757 received exit; exiting gracefully"),await mf()});$c.on("updatesReady",()=>{mn.info('\u2757 backend server received signal "updatesReady"'),$c.emit("readyToUpdate"),mn.info('\u2757 backend server has sent signal "readyToUpdate"; now awaits signal "timeToStop"'),$c.on("timeToStop",async()=>{mn.info('\u2757 backend server received signal "timeToStop"; exiting gracefully'),await mf()})});mn.info(`\uD83D\uDEEB backend server ready on port ${sn.BACKEND_PORT}`);$c.emit("alive");export{my 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 $ of i)if(!m||Number(m.created_at)<$.folderMillis){for(let J of $.sql)await f.execute(W.raw(J));await f.execute(W`insert into ${W.identifier(c)}.${W.identifier(p)} ("hash", "created_at") values(${$.hash}, ${$.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[I.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),$=W`${W.identifier(this.casing.getColumnCasing(m))} = ${f}`;if(T<c-1)return[$,W.raw(", ")];return[$]}))}buildUpdateQuery({table:i,set:o,where:n,returning:p,withList:c,from:x,joins:T}){let m=this.buildWithCTE(c),f=i[uo.Symbol.Name],$=i[uo.Symbol.Schema],J=i[uo.Symbol.OriginalName],F=f===J?void 0:f,A=W`${$?W`${W.identifier($)}.`:void 0}${W.identifier(J)}${F&&W` ${W.identifier(F)}`}`,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,H=n?W` where ${n}`:void 0;return W`${m}update ${A} set ${X}${Y}${R}${H}${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,yi))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,uo)){let T=c[uo.Symbol.Name],m=c[uo.Symbol.Schema],f=c[uo.Symbol.OriginalName],$=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)}${$&&W` ${W.identifier($)}`} on ${p.on}`)}else if(z(c,ro)){let T=c[Ni].name,m=c[Ni].schema,f=c[Ni].originalName,$=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)}${$&&W` ${W.identifier($)}`} 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,I)&&i[I.Symbol.IsAlias]){let o=W`${W.identifier(i[I.Symbol.OriginalName])}`;if(i[I.Symbol.Schema])o=W`${W.identifier(i[I.Symbol.Schema])}.${o}`;return W`${o} ${W.identifier(i[I.Symbol.Name])}`}return i}buildSelectQuery({withList:i,fields:o,fieldsFlat:n,where:p,having:c,table:x,joins:T,orderBy:m,groupBy:f,limit:$,offset:J,lockingClause:F,distinct:A,setOperators:X}){let Y=n??Un(o);for(let mi of Y)if(z(mi.field,yi)&&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[I.Symbol.IsAlias]?Ro(Ei):Ei[I.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),H;if(A)H=A===!0?W` distinct`:W` distinct on (${W.join(A.on,W`, `)})`;let Z=this.buildSelection(Y,{isSingleTable:R}),b=this.buildFromTable(x),u=this.buildJoins(T),M=p?W` where ${p}`:void 0,E=c?W` having ${c}`:void 0,V;if(m&&m.length>0)V=W` order by ${W.join(m,W`, `)}`;let C;if(f&&f.length>0)C=W` group by ${W.join(f,W`, `)}`;let l=typeof $==="object"||typeof $==="number"&&$>=0?W` limit ${$}`:void 0,Q=J?W` offset ${J}`:void 0,Ti=W.empty();if(F){let mi=W` for ${W.raw(F.strength)}`;if(F.config.of)mi.append(W` of ${W.join(Array.isArray(F.config.of)?F.config.of:[F.config.of],W`, `)}`);if(F.config.noWait)mi.append(W` no wait`);else if(F.config.skipLocked)mi.append(W` skip locked`);Ti.append(mi)}let q=W`${K}select${H} ${Z} from ${b}${u}${M}${C}${E}${V}${l}${Q}${Ti}`;if(X.length>0)return this.buildSetOperations(q,X);return q}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()})`,$;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}`);$=W` order by ${W.join(X,W`, `)} `}let J=typeof c==="object"||typeof c==="number"&&c>=0?W` limit ${c}`:void 0,F=W.raw(`${o} ${n?"all ":""}`),A=T?W` offset ${T}`:void 0;return W`${m}${F}${f}${$}${J}${A}`}buildInsertQuery({table:i,values:o,onConflict:n,returning:p,withList:c,select:x,overridingSystemValue_:T}){let m=[],f=i[I.Symbol.Columns],$=Object.entries(f).filter(([K,H])=>!H.shouldDisableInsert()),J=$.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[H,Z]of K.entries()){let b=[];for(let[u,M]of $){let E=Z[u];if(E===void 0||z(E,Tn)&&E.value===void 0)if(M.defaultFn!==void 0){let V=M.defaultFn(),C=z(V,N)?V:W.param(V,M);b.push(C)}else if(!M.default&&M.onUpdateFn!==void 0){let V=M.onUpdateFn(),C=z(V,N)?V:W.param(V,M);b.push(C)}else b.push(W`default`);else b.push(E)}if(m.push(b),H<K.length-1)m.push(W`, `)}}let F=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`${F}insert into ${i} ${J} ${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,Of)||z(i,Ef))return"json";else if(z(i,_f))return"decimal";else if(z(i,yf))return"time";else if(z(i,Lf)||z(i,Cf))return"timestamp";else if(z(i,Qf)||z(i,Sf))return"date";else if(z(i,Df))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 $=[],J,F,A=[],X,Y=[];if(x===!0)$=Object.entries(c.columns).map(([H,Z])=>({dbKey:Z.name,tsKey:H,field:tn(Z,T),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let K=Object.fromEntries(Object.entries(c.columns).map(([E,V])=>[E,tn(V,T)]));if(x.where){let E=typeof x.where==="function"?x.where(K,d7()):x.where;X=E&&bT(E,T)}let H=[],Z=[];if(x.columns){let E=!1;for(let[V,C]of Object.entries(x.columns)){if(C===void 0)continue;if(V in c.columns){if(!E&&C===!0)E=!0;Z.push(V)}}if(Z.length>0)Z=E?Z.filter((V)=>x.columns?.[V]===!0):Object.keys(c.columns).filter((V)=>!Z.includes(V))}else Z=Object.keys(c.columns);for(let E of Z){let V=c.columns[E];H.push({tsKey:E,value:V})}let b=[];if(x.with)b=Object.entries(x.with).filter((E)=>!!E[1]).map(([E,V])=>({tsKey:E,queryConfig:V,relation:c.relations[E]}));let u;if(x.extras){u=typeof x.extras==="function"?x.extras(K,{sql:W}):x.extras;for(let[E,V]of Object.entries(u))H.push({tsKey:E,value:wJ(V,T)})}for(let{tsKey:E,value:V}of H)$.push({dbKey:z(V,N.Aliased)?V.fieldAlias:c.columns[E].name,tsKey:E,field:z(V,yi)?tn(V,T):V,relationTableTsKey:void 0,isJson:!1,selection:[]});let M=typeof x.orderBy==="function"?x.orderBy(K,r7()):x.orderBy??[];if(!Array.isArray(M))M=[M];A=M.map((E)=>{if(z(E,yi))return tn(E,T);return bT(E,T)}),J=x.limit,F=x.offset;for(let{tsKey:E,queryConfig:V,relation:C}of b){let l=iW(o,n,C),Q=vc(C.referencedTable),Ti=n[Q],q=`${T}_${E}`,mi=wc(...l.fields.map((lo,ip)=>dn(tn(l.references[ip],q),tn(lo,T)))),Ei=this.buildRelationalQueryWithoutPK({fullSchema:i,schema:o,tableNamesMap:n,table:i[Ti],tableConfig:o[Ti],queryConfig:z(C,bp)?V===!0?{limit:1}:{...V,limit:1}:V,tableAlias:q,joinOn:mi,nestedQueryRelation:C}),To=W`${W.identifier(q)}.${W.identifier("data")}`.as(E);Y.push({on:W`true`,table:new wo(Ei.sql,{},q),alias:q,joinType:"left",lateral:!0}),$.push({dbKey:E,tsKey:E,field:To,relationTableTsKey:Ti,isJson:!0,selection:Ei.selection})}}if($.length===0)throw new uf({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($.map(({field:b,tsKey:u,isJson:M})=>M?W`${W.identifier(`${T}_${u}`)}.${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 H=[{dbKey:"data",tsKey:"data",field:K.as("data"),isJson:!0,relationTableTsKey:c.tsName,selection:$}];if(J!==void 0||F!==void 0||A.length>0)R=this.buildSelectQuery({table:zf(p,T),fields:{},fieldsFlat:[{path:[],field:W.raw("*")}],where:X,limit:J,offset:F,orderBy:A,setOperators:[]}),X=void 0,J=void 0,F=void 0,A=[];else R=zf(p,T);R=this.buildSelectQuery({table:z(R,uo)?R:new wo(R,{},T),fields:{},fieldsFlat:H.map(({field:b})=>({path:[],field:z(b,yi)?tn(b,T):b})),joins:Y,where:X,limit:J,offset:F,orderBy:A,setOperators:[]})}else R=this.buildSelectQuery({table:zf(p,T),fields:{},fieldsFlat:$.map(({field:K})=>({path:[],field:z(K,yi)?tn(K,T):K})),joins:Y,where:X,limit:J,offset:F,orderBy:A,setOperators:[]});return{tableTsKey:c.tsName,sql:R,selection:$}}}class BF{static[w]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class Po{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 IF({table:n,fields:p,isPartialSelect:o,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class WY extends BF{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[I.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(bE()):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 IF 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 Li.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 Li.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(i,this.authToken)})}}t3(IF,[jo]);function Lx(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 bE=()=>({union:jE,unionAll:aE,intersect:PE,intersectAll:lE,except:qE,exceptAll:kE}),jE=Lx("union",!1),aE=Lx("union",!0),PE=Lx("intersect",!1),lE=Lx("intersect",!0),qE=Lx("except",!1),kE=Lx("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 BT(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 Po({fields:x??void 0,session:void 0,dialect:o.getDialect(),withList:i})}function p(x){return new Po({fields:x??void 0,session:void 0,dialect:o.getDialect(),distinct:!0})}function c(x,T){return new Po({fields:T??void 0,session:void 0,dialect:o.getDialect(),distinct:{on:x}})}return{select:n,selectDistinct:p,selectDistinctOn:c}}select(i){return new Po({fields:i??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(i){return new Po({fields:i??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(i,o){return new Po({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 z1{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[I.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 NF(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[Hf],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 NF(this.table,o,this.session,this.dialect,this.withList,!0)}}class NF 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[I.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,Mf(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 Li.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 Li.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 bF 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 Li.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 Li.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(i,this.authToken)})}}class u1{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,Mf(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,uo))return i[I.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[I.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[I.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 aF{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 jF(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,i?i:{},"many")}findFirst(i){return new jF(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,i?{...i,limit:1}:{limit:1},"first")}}class jF 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 Li.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)=>Bf(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 Li.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class PF 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 aF(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 BT(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 Po({fields:f??void 0,session:o.session,dialect:o.dialect,withList:i})}function p(f){return new Po({fields:f??void 0,session:o.session,dialect:o.dialect,withList:i,distinct:!0})}function c(f,$){return new Po({fields:$??void 0,session:o.session,dialect:o.dialect,withList:i,distinct:{on:f}})}function x(f){return new u1(f,o.session,o.dialect,i)}function T(f){return new z1(f,o.session,o.dialect,i)}function m(f){return new U1(f,o.session,o.dialect,i)}return{select:n,selectDistinct:p,selectDistinctOn:c,update:x,insert:T,delete:m}}select(i){return new Po({fields:i??void 0,session:this.session,dialect:this.dialect})}selectDistinct(i){return new Po({fields:i??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(i,o){return new Po({fields:o??void 0,session:this.session,dialect:this.dialect,distinct:{on:i}})}update(i){return new u1(i,this.session,this.dialect)}insert(i){return new z1(i,this.session,this.dialect)}delete(i){return new U1(i,this.session,this.dialect)}refreshMaterializedView(i){return new bF(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 PF(()=>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 Z1(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 Z1(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 Z1(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 Z1{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 lF(i){return new YY(!0,i)}class qF{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 kF{constructor(i){this.dialect=i}static[w]="PgSession";execute(i,o){return Li.startActiveSpan("drizzle.operation",()=>{return Li.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 hF extends Tm{constructor(i,o,n,p=0){super(i,o,n);this.schema=n,this.nestedIndex=p}static[w]="PgTransaction";rollback(){throw new XJ}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 qF{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 Li.startActiveSpan("drizzle.execute",async(o)=>{let n=vJ(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 Li.startActiveSpan("drizzle.driver.execute",()=>{return x.unsafe(c,n)});let f=await Li.startActiveSpan("drizzle.driver.execute",()=>{return o?.setAttributes({"drizzle.query.text":c,"drizzle.query.params":JSON.stringify(n)}),x.unsafe(c,n).values()});return Li.startActiveSpan("drizzle.mapResponse",()=>{return m?m(f):f.map(($)=>s3(p,$,T))})})}all(i={}){return Li.startActiveSpan("drizzle.execute",async(o)=>{let n=vJ(this.params,i);return o?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(n)}),this.logger.logQuery(this.queryString,n),Li.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 kF{constructor(i,o,n,p={}){super(o);this.client=i,this.schema=n,this.options=p,this.logger=p.logger??new RJ}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 gF(this.dialect,p,this.schema);if(o)await c.setTransaction(o);return i(c)})}}class gF extends hF{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 gF(this.dialect,n,this.schema);return i(p)})}}class HY extends Tm{static[w]="PostgresJsDatabase"}function Cx(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 WJ;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 M1(...i){if(typeof i[0]==="string"){let o=yx(i[0]);return Cx(o,i[1])}if(r3(i[0])){let{connection:o,client:n,...p}=i[0];if(n)return Cx(n,p);if(typeof o==="object"&&o.url!==void 0){let{url:x,...T}=o,m=yx(x,T);return Cx(m,p)}let c=yx(o);return Cx(c,p)}return Cx(i[0],i[1])}((i)=>{function o(n){return Cx({options:{parsers:{},serializers:{}}},n)}i.mock=o})(M1||(M1={}));var tF={};CG(tF,{users:()=>jn,userChanges:()=>gE,untrackedUserColumnNames:()=>hE,twoFactorMethod:()=>MY,trackedUserColumnName:()=>ZY,trackableUserColumnNames:()=>uY,role:()=>zY,players:()=>sF,passwordResetAttempts:()=>sE,loginHistory:()=>Dx,games:()=>Q1,banishedIps:()=>S1});function UY(i){return W`lower(${i})`}var zY=Gf("role",["admin","user"]),jn=Np("users",{id:mn().primaryKey().defaultRandom(),username:zo({length:16}).notNull(),email:zo({length:254}).notNull(),hash:zo({length:64}).notNull(),salt:zo({length:36}).notNull(),createdAt:Bn({withTimezone:!0}).notNull().defaultNow(),createdIp:zo({length:45}).notNull(),isActive:aT().notNull().default(!1),verifiedAt:Bn({withTimezone:!0}),userRole:zY().default("user")},(i)=>[lF("usernameUniqueIndex").on(UY(i.username)),lF("emailUniqueIndex").on(UY(i.email))]),hE=["id","createdAt","createdIp","isActive","salt","verifiedAt"],uY=["username","email","hash","userRole"],ZY=Gf("trackedUserColumnName",uY),gE=Np("userChanges",{id:mn().primaryKey().defaultRandom(),userId:mn().notNull().references(()=>jn.id),changedAt:Bn({withTimezone:!0}).notNull().defaultNow(),changedIp:zo({length:45}).notNull(),changedColumn:ZY().notNull(),oldValue:zo({length:255}),newValue:zo({length:255})}),Q1=Np("games",{id:mn().primaryKey().defaultRandom()}),sF=Np("players",{userId:mn().notNull().references(()=>jn.id),gameId:mn().notNull().references(()=>Q1.id),score:Vf().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),loginTime:Bn({withTimezone:!0}).notNull().defaultNow(),ipAddress:zo({length:45}).notNull(),userAgent:zo({length:1024}),successful:aT().notNull().default(!1)}),MY=Gf("twoFactorMethod",["email","phone"]),sE=Np("passwordResetAttempts",{id:mn().primaryKey().defaultRandom(),userId:mn().notNull().references(()=>jn.id),requestedIp:zo({length:45}).notNull(),requestedAt:Bn({withTimezone:!0}).notNull().defaultNow(),succeededIp:zo({length:45}),succeededAt:Bn({withTimezone:!0}),verificationMethod:MY().notNull()}),S1=Np("banishedIps",{ip:zo({length:45}).primaryKey(),reason:zo({length:2048}).notNull(),banishedAt:Bn({withTimezone:!0}).notNull().defaultNow(),banishedUntil:Bn({withTimezone:!0})});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class dF{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(tE.resolve(__dirname,"notify_update.sql"));let i=[Ro(jn),Ro(Q1),Ro(sF)];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:io.POSTGRES_HOST,port:io.POSTGRES_PORT,user:io.POSTGRES_USER,password:io.POSTGRES_PASSWORD,database:io.POSTGRES_DATABASE}){this.options=o,this.sql=yx(o),this.drizzle=M1(this.sql,{schema:tF,logger:i})}observe(i,o){if(!this.observers.has(i))this.observers.set(i,new Ji);this.observers.get(i).subscribe("SINGLETON",o)}}import{createHash as dE}from"crypto";function rF(i){let o=dE("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 rE=3,eE=15,iO=/^[a-zA-Z0-9_-]+$/,Mmi=po(iO).and(`string > ${rE} & string < ${eE}`).brand("username"),SY=20,VY={"0":"o","1":"l","3":"e","4":"a","5":"s","7":"t","@":"a",$:"s","!":"i"};function oO(i){let o="";for(let n of i)if(n in VY)o+=VY[n];else o+=n;return o}function nO(i){let o=i.toLocaleLowerCase(),n=oO(o);for(let p of QY){if(n.includes(p))return!0;if(o.includes(p))return!0}return!1}function pO(i){let o=new Set(i).size;return i.length*Math.log2(o)}function cO(i){let o=0,n=100;if(nO(i))o-=n;return o+=pO(i)*0.5,Math.max(o,0)}var Qmi=po("string").narrow((i,o)=>{let n=cO(i);return n>=SY?!0:o.mustBe(`Of complexity ${SY} or more. Was ${n}.`)}).brand("password"),EY=po({"+":"delete",username:"string",password:"string"}),Smi=po("string").brand("email"),OY=po({"+":"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 xO(i){return Number.parseInt(i,10)}var TO=po(V1),mO=TO.keyof().pipe((i)=>xO(i)),_Y=po([mO,"string"]);var yY=Op({key:"count",default:0}),fO=Tc({key:"incrementTX",do:({set:i})=>{i(yY,(o)=>o+1)}}),LY=m8({key:"countContinuity",config:(i)=>i.add(yY).add(fO)});var DY=RF(qp,"backend.worker.game.bun",xi),Sc=new dF({logQuery(i,o){xi.info("\uD83D\uDCDD query",i,o)}});d.STORE.loggers[0]=new pc("info",void 0,xi);var ofi=(()=>{let{__tribunalDaily:i}=globalThis;if(!i)i=new BY.CronJob("00 15 * * * *",()=>{RF(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 FO(i){if(WF)return JO(WF,i);return $O({},i)}var IY=FO((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,io.VITE_BACKEND_ORIGIN);xi.info(x,c,i.method,T.pathname);let m=await Sc.drizzle.query.banishedIps.findFirst({columns:{banishedUntil:!0},where:dn(S1.ip,c)}),f=m?.banishedUntil===null,$=m?.banishedUntil&&m.banishedUntil>x;if(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-${rF("sign-up")}`:{let J=Buffer.concat(n).toString(),F=JSON.parse(J),A=OY(F);if(A instanceof po.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 Sc.drizzle.query.users.findFirst({columns:{id:!0},where:dn(jn.email,R)}))throw[400,"User already exists"];let H=crypto.randomUUID(),Z=CY("sha256").update(Y+H).digest("hex");await Sc.drizzle.insert(jn).values({username:X,email:R,hash:Z,salt:H,createdIp:c}),xi.info(`\uD83D\uDD11 user created: ${X}`),o.writeHead(201,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${io.FRONTEND_ORIGINS[0]}`}),o.end(V1[201])}break;case`/login-${rF("login")}`:{let J=!1,F=null;try{let A=new Date(+x-600000);xi.info("\uD83D\uDD11 ten minutes ago",{tenMinutesAgo:A,now:x});let X=await Sc.drizzle.query.loginHistory.findMany({columns:{userId:!0,successful:!0},where:wc(dn(Dx.ipAddress,c),dn(Dx.successful,!1),Zf(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 Sc.drizzle.insert(S1).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),H=EY(K);if(H instanceof po.errors)throw xi.warn("login parsed",H),[400,`${Y} attempts remaining.`];let{username:Z,password:b}=H,u=await Sc.drizzle.query.users.findFirst({columns:{id:!0,hash:!0,salt:!0},where:dn(jn.username,Z)});if(xi.info("\uD83D\uDD11 login attempt as user",Z),!u)throw xi.info(`\uD83D\uDD11 user ${Z} does not exist`),[400,`${Y} attempts remaining.`];let{hash:M,salt:E}=u;if(F=u.id,CY("sha256").update(b+E).digest("hex")===M){let C=crypto.randomUUID(),l=J1.get(Z);if(!l)l=new Map,J1.set(Z,l);l.set(C,Number(x)),J=!0,xi.info("\uD83D\uDD11 login successful as",Z),o.writeHead(200,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${io.FRONTEND_ORIGINS[0]}`}),o.end(`${Z} ${C}`)}}finally{await Sc.drizzle.insert(Dx).values({userId:F,successful:J,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 po.errors)xi.error(c),o.writeHead(500,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${io.FRONTEND_ORIGINS[0]}`}),o.end("Internal Server Error");else{let[T,m]=x,$=`${V1[T]}. ${m}`;xi.info(`\u274C ${T}: ${$}`),o.writeHead(T,{"Content-Type":"text/plain","Access-Control-Allow-Origin":`${io.FRONTEND_ORIGINS[0]}`}),o.end($)}}})}),eF=IY.listen(io.BACKEND_PORT).address(),AO=typeof eF==="string"?null:eF===null?null:eF.port;if(AO===null)throw new Error("Could not determine port for test server");new lR(IY,{cors:{origin:io.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(J1.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,G$,(f)=>f.add(c)),_i(d.STORE,Y$,(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})(LY);i.on("disconnect",()=>{let p=`socket::${i.id}`,c=ix(mc,p,d.STORE).userKeyOfSocket,x=ui(d.STORE,c);if(Ep(mc,(T)=>{T.delete(p)},d.STORE),x)_i(d.STORE,G$,(T)=>(T.delete(x),T));_i(d.STORE,Y$,(T)=>(T.delete(p),T)),xi.info(`${i.id} disconnected`),n()})});async function E1(){xi.info("\uD83E\uDDF9 closing workers");let i=new Promise((o)=>DY.process.once("close",o));DY.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 E1()});process.on("SIGTERM",async()=>{xi.info("\u2757 received SIGTERM; exiting gracefully"),await E1()});process.on("exit",async()=>{xi.info("\u2757 received exit; exiting gracefully"),await E1()});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 E1()})});xi.info(`\uD83D\uDEEB backend server ready on port ${io.BACKEND_PORT}`);qp.emit("alive");export{ofi as tribunalDaily};