tempest.games 0.2.12 → 0.2.13
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.
- package/CHANGELOG.md +7 -0
- package/app/assets/index-DufnWinX.js +109 -0
- package/app/index.html +1 -1
- package/bin/backend.bun.js +161 -161
- package/bin/backend.worker.tribunal.bun.js +83 -81
- package/bin/frontend.bun.js +1 -1
- package/bin/setup-db.bun.js +55 -55
- package/package.json +13 -13
- package/app/assets/index-BG6T8CzE.js +0 -109
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var DP=Object.create;var{getPrototypeOf:VP,defineProperty:iz,getOwnPropertyNames:KP}=Object;var EP=Object.prototype.hasOwnProperty;var AP=($,T,W)=>{W=$!=null?DP(VP($)):{};let U=T||!$||!$.__esModule?iz(W,"default",{value:$,enumerable:!0}):W;for(let X of KP($))if(!EP.call(U,X))iz(U,X,{get:()=>$[X],enumerable:!0});return U};var MP=($,T)=>()=>(T||$((T={exports:{}}).exports,T),T.exports);var wT=($,T)=>{for(var W in T)iz($,W,{get:T[W],enumerable:!0,configurable:!0,set:(U)=>T[W]=()=>U})};var Yc=($,T)=>()=>($&&(T=$($=0)),T);var ID=import.meta.require;var DE=MP((il,ZE)=>{var kX=ID("os"),vX=ID("path");function QE($){let T=process.env.XDG_CACHE_HOME||vX.join(kX.homedir(),".cache");return vX.join(T,$)}function Rx($){return vX.join(kX.homedir(),"Library","Caches",$)}function kx($){let T=process.env.LOCALAPPDATA||vX.join(kX.homedir(),"AppData","Local");return vX.join(T,$,"Cache")}var vx=function(){switch(kX.platform()){case"darwin":return Rx;case"win32":return kx;case"aix":case"android":case"freebsd":case"linux":case"netbsd":case"openbsd":case"sunos":return QE;default:return console.error(`(node:${process.pid}) [cachedir] Warning: the platform "${kX.platform()}" is not currently supported by node-cachedir, falling back to "posix". Please file an issue with your platform here: https://github.com/LinusU/node-cachedir/issues/new`),QE}}();ZE.exports=function $(T){if(typeof T!=="string")throw new TypeError("id is not a string");if(T.length===0)throw new Error("id cannot be empty");if(/[^0-9a-zA-Z-]/.test(T))throw new Error("id cannot contain special characters");return vx(T)}});class bU extends Promise{fate;resolve;reject;done=!1;constructor($){let T,W;super((U,X)=>{T=U,W=X});this.resolve=T,this.reject=W,this.use($ instanceof Promise?$:new Promise($))}pass($,T){if($===this.fate)this.resolve(T),this.done=!0}fail($,T){if($===this.fate)this.reject(T),this.done=!0}use($){if($ instanceof Promise){let T=$;this.fate=T,T.then((W)=>{this.pass(T,W)},(W)=>{this.fail(T,W)})}else this.resolve($),this.fate=void 0}}var Hc=($,T,W=fD.STORE)=>{return bD(W,{key:`${$.key}:JSON`,get:({get:U})=>T.toJson(U($)),set:({set:U},X)=>{U($,T.fromJson(X))}})};function Qc($,T,W){return tz($,{key:`${T.key}:JSON`,get:(X)=>({get:Y})=>{let w=Y(T,X);return W.toJson(w)},set:(X)=>({set:Y},w)=>{Y(T,X,W.fromJson(w))}},["mutable","json"])}var fU=($)=>JSON.parse($),w6=($)=>JSON.stringify($),Dc=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];function H$($){while($.child!==null)$=$.child;return $}class Xw{_buffer;_index=0;constructor($){let T;if(typeof $==="number")T=$;else T=$.length;this._buffer=Array.from({length:T})}get buffer(){return this._buffer}get index(){return this._index}add($){this._buffer[this._index]=$,this._index=(this._index+1)%this._buffer.length}copy(){let $=new Xw([...this._buffer]);return $._index=this._index,$}}var NP={atom_family:"atom",molecule_family:"molecule",mutable_atom_family:"mutable_atom",readonly_held_selector_family:"readonly_held_selector",readonly_pure_selector_family:"readonly_pure_selector",writable_held_selector_family:"writable_held_selector",writable_pure_selector_family:"writable_pure_selector"};function yD($,T){let W=w6(T),U=`${$.key}(${W})`,X=NP[$.type],Y={key:U,type:X};return Object.assign(Y,{family:{key:$.key,subKey:W}}),Object.assign(Y,{counterfeit:!0}),Y}function yU($){let T={key:$.key,type:$.type};if("family"in $)T.family=$.family;return T}var az=($)=>(T,W,U,X,...Y)=>{console[$](`${T} ${W} "${U}" ${X}`,...Y)},LP={error:az("error"),info:az("info"),warn:az("warn")};class sz{logLevel;filter;logger;constructor($,T,W=LP){this.logLevel=$,this.filter=T,this.logger=W}error=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel!==null){if(T===!0)this.logger.error(...$);else if(T!==!1)this.logger.error(...T)}};info=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel==="info"){if(T===!0)this.logger.info(...$);else if(T!==!1)this.logger.info(...T)}};warn=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel!=="error"&&this.logLevel!==null){if(T===!0)this.logger.warn(...$);else if(T!==!1)this.logger.warn(...T)}}}class r1{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=($,T)=>`${$}:${T}`;warn;getRelatedKeys($){return this.relations.get($)}addRelation($,T){let W=this.relations.get($),U=this.relations.get(T);if(W)W.add(T);else W=new Set([T]),this.relations.set($,W);if(U)U.add($);else U=new Set([$]),this.relations.set(T,U)}deleteRelation($,T){let W=this.relations.get($);if(W){if(W.delete(T),W.size===0)this.relations.delete($);let U=this.relations.get(T);if(U){if(U.delete($),U.size===0)this.relations.delete(T)}}}replaceRelationsUnsafely($,T){this.relations.set($,new Set(T));for(let W of T){let U=new Set().add($);this.relations.set(W,U)}}replaceRelationsSafely($,T){let W=this.relations.get($),U=this.isAType?.($)?$:void 0,X=U===void 0?$:void 0;if(W)for(let Y of W){U??=Y,X??=Y;let w=this.relations.get(Y);if(w){if(w.size===1)this.relations.delete(Y);else w.delete($);this.contents.delete(this.makeContentKey(U,X))}}this.relations.set($,new Set(T));for(let Y of T){let w=this.relations.get(Y);if(w)w.add($);else w=new Set().add($),this.relations.set(Y,w)}}getContentInternal($){return this.contents.get($)}setContent($,T){this.contents.set($,T)}deleteContent($){this.contents.delete($)}constructor($,T){if(this.a=$.between[0],this.b=$.between[1],this.cardinality=$.cardinality,!T?.externalStore)this.relations=new Map($.relations?.map(([W,U])=>[W,new Set(U)])),this.contents=new Map($.contents);if(this.isAType=T?.isAType??null,this.isBType=T?.isBType??null,this.isContent=T?.isContent??null,T?.makeContentKey)this.makeContentKey=T.makeContentKey;if(T?.externalStore){let W=T.externalStore;if(this.has=(U,X)=>W.has(U,X),this.addRelation=(U,X)=>{W.addRelation(U,X)},this.deleteRelation=(U,X)=>{W.deleteRelation(U,X)},this.replaceRelationsSafely=(U,X)=>{W.replaceRelationsSafely(U,X)},this.replaceRelationsUnsafely=(U,X)=>{W.replaceRelationsUnsafely(U,X)},this.getRelatedKeys=(U)=>W.getRelatedKeys(U),W.getContent)this.getContentInternal=(U)=>{return W.getContent(U)},this.setContent=(U,X)=>{W.setContent(U,X)},this.deleteContent=(U)=>{W.deleteContent(U)};for(let[U,X]of $.relations??[]){let Y=this.isAType?.(U)?U:void 0,w=Y===void 0?U:void 0;for(let G of X)Y??=G,w??=G,this.addRelation(Y,w)}for(let[U,X]of $.contents??[])this.setContent(U,X)}if(T?.warn)this.warn=T.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([$,T])=>[$,[...T]]),contents:[...this.contents.entries()]}}set(...$){let T,W,U;switch($.length){case 1:{let X=$[0];T=X[this.a],W=X[this.b],U=void 0;break}case 2:{let X=$[0];if(typeof X==="string")[T,W]=$;else T=X[this.a],W=X[this.b],U=$[1];break}default:{T=$[0],W=$[1],U=$[2];break}}switch(this.cardinality){case"1:1":{let X=this.getRelatedKey(T);if(X&&X!==W)this.delete(T,X)}case"1:n":{let X=this.getRelatedKey(W);if(X&&X!==T)this.delete(X,W)}break;case"n:n":}if(U){let X=this.makeContentKey(T,W);this.setContent(X,U)}return this.addRelation(T,W),this}delete($,T){T=typeof T==="string"?T:$[this.b];let W=typeof $==="string"?$:$[this.a];if(W===void 0&&typeof T==="string"){let U=this.getRelatedKeys(T);if(U)for(let X of U)this.delete(X,T)}if(typeof W==="string"&&T===void 0){let U=this.getRelatedKeys(W);if(U)for(let X of U)this.delete(W,X)}if(typeof W==="string"&&typeof T==="string"){this.deleteRelation(W,T);let U=this.makeContentKey(W,T);this.deleteContent(U)}return this}getRelatedKey($){let T=this.getRelatedKeys($);if(T){if(T.size>1)this.warn?.(`${T.size} related keys were found for key "${$}": (${[...T].map((U)=>`"${U}"`).join(", ")}). Only one related key was expected.`);let W;for(let U of T){W=U;break}return W}}replaceRelations($,T,W){let U=!Array.isArray(T),X=U?Object.keys(T):T;if(W?.reckless)this.replaceRelationsUnsafely($,X);else this.replaceRelationsSafely($,X);if(U)for(let Y of X){let w=this.makeContentKey($,Y),G=T[Y];this.setContent(w,G)}return this}getContent($,T){let W=this.makeContentKey($,T);return this.getContentInternal(W)}getRelationEntries($){let T=$[this.a],W=$[this.b];if(T!==void 0&&W===void 0){let U=this.getRelatedKeys(T);if(U)return[...U].map((X)=>{return[X,this.getContent(T,X)]})}if(T===void 0&&W!==void 0){let U=this.getRelatedKeys(W);if(U)return[...U].map((X)=>{return[X,this.getContent(X,W)]})}return[]}has($,T){if(T)return this.getRelatedKeys($)?.has(T)??!1;return this.relations.has($)}}class I${Subscriber;subscribers=new Map;subscribe($,T){return this.subscribers.set($,T),()=>{this.unsubscribe($)}}unsubscribe($){this.subscribers.delete($)}next($){let T=this.subscribers.values();for(let W of T)W($)}}class ez extends I${state;constructor($){super();this.state=$}next($){this.state=$,super.next($)}}function GT($){return"epoch"in $.transactionMeta}function i6($){return"phase"in $.transactionMeta}function hD($){return $[0].toUpperCase()+$.slice(1)}function Yw($){return $.type.split("_").map(hD).join(" ")}class hU extends Error{constructor($,T){super(`${Yw($)} ${w6($.key)} not found in store "${T.config.name}".`)}}var eW=($)=>(T)=>$ instanceof Function?$(T):$;var zT=($,T)=>{if($.valueMap.has(T.key))return $.logger.info("\uD83D\uDCD6",T.type,T.key,"reading cached value"),gD(T,$);switch(T.type){case"readonly_held_selector":case"readonly_pure_selector":case"writable_held_selector":case"writable_pure_selector":return $.logger.info("\uD83E\uDDEE",T.type,T.key,"computing value"),T.get();case"atom":case"mutable_atom":{let W=T.default,U;if(W instanceof Function)U=W();else U=W;return $.logger.info("\uD83D\uDC81","atom",T.key,"could not find cached value; using default",U),U}}};var mD=($,T)=>{if($.operation.open){let W=performance.now();return $.logger.info("\u2757",T.type,T.key,`deferring setState at T-${W} until setState for "${$.operation.token.key}" is done`),W}$.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:T},$.logger.info("\u2B55",T.type,T.key,`operation start in store "${$.config.name}"${!i6($)?"":` ${$.transactionMeta.phase} "${$.transactionMeta.update.key}"`}`)},cD=($)=>{if($.operation.open)$.logger.info("\uD83D\uDD34",$.operation.token.type,$.operation.token.key,`operation done in store "${$.config.name}"`);$.operation={open:!1},$.on.operationClose.next($.operation)},uD=($,T)=>{if(!$.operation.open)return $.logger.error("\uD83D\uDC1E","unknown",T,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0;return $.operation.done.has(T)},HT=($,T)=>{if(!$.operation.open){$.logger.error("\uD83D\uDC1E","unknown",T,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}$.operation.done.add(T)};var pD=($,T,W)=>{switch(T.type){case"mutable_atom":$.logger.info("\uD83D\uDCE2",T.type,T.key,"is now (",W.newValue,") subscribers:",T.subject.subscribers);break;case"atom":case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.logger.info("\uD83D\uDCE2",T.type,T.key,"went (",W.oldValue,"->",W.newValue,") subscribers:",T.subject.subscribers)}T.subject.next(W)};var $5=($,T)=>{let W=H$($),U=W.selectorAtoms.getRelatedKeys(T.key);if(W.logger.info("\uD83E\uDDF9",T.type,T.key,U?`evicting ${U.size} states downstream:`:"no downstream states",U??"to evict"),U){if(W.operation.open)W.logger.info("\uD83E\uDDF9",T.type,T.key,`[ ${[...W.operation.done].join(", ")} ] already done`);for(let X of U){if(uD(W,X))continue;dD(X,W),HT(W,X)}}};var oD=($,T,W)=>{let U=zT($,T),X=U;if(T.type==="mutable_atom"&&i6($)){let{parent:w}=$;X=gU($,T,w)}if(X=eW(W)(X),$.logger.info("\uD83D\uDCDD","atom",T.key,"set to",X),X=G6($,T.key,X,T.subject),rD($,T.key))nD($,T.key);HT($,T.key),$5($,T);let Y={oldValue:U,newValue:X};if(!i6($)){pD($,T,Y);return}if($.on.transactionApplying.state===null){let{key:w}=T;if(lD(Y.newValue))return;let G={type:"atom_update",key:w,...Y};if(T.family)G.family=T.family;$.transactionMeta.update.updates.push(G),$.logger.info("\uD83D\uDCC1","atom",w,"stowed (",Y.oldValue,"->",Y.newValue,")")}else if(T.key.startsWith("*")){let w=T.key.slice(1),G=$.atoms.get(w),H=$.valueMap.get(w);if(G.type==="mutable_atom"&&i6($)){let{parent:F}=$;H=gU($,G,F)}if(H.do(Y.newValue)===null)$5($,G)}};var ww=($,T,W)=>{switch(T.type){case"atom":case"mutable_atom":oD($,T,W);break;case"writable_pure_selector":case"writable_held_selector":T.set(W);break}};var Gw=($,T)=>H$($).atoms.has(T),JP=($,T)=>H$($).writableSelectors.has(T),_P=($,T)=>H$($).readonlySelectors.has(T),iD=($,T)=>Gw($,T)||JP($,T)||_P($,T);var zw=($,T)=>{return H$($).selectorGraph.getRelationEntries({downstreamSelectorKey:T}).filter(([U,{source:X}])=>X!==T).map(([U,{source:X}])=>X).filter((U)=>iD($,U))};var T5=($,T,W)=>{let U=[],X=zw($,T);while(X.length>0){let Y=X.shift();if(W.has(Y))continue;if(W.add(Y),!Gw($,Y))X.push(...zw($,Y));else if(!U.includes(Y))U.push(Y)}return U},tD=($,T)=>{let W=$.key,U=zw(T,W),X=new Set;return U.flatMap((Y)=>Gw(T,Y)?Y:T5(T,Y,X))};var aD=($,T,W,U,X)=>{let Y=H$($),{type:w,key:G}=U;if(w==="atom"||w==="mutable_atom")Y.selectorAtoms.set({selectorKey:W,atomKey:G}),$.logger.info("\uD83D\uDD0D",T,W,`discovers root atom "${G}"`);else{let H=T5($,G,X);$.logger.info("\uD83D\uDD0D",T,W,`discovers root atoms: [ ${H.map((z)=>`"${z}"`).join(", ")} ]`);for(let z of H)Y.selectorAtoms=Y.selectorAtoms.set({selectorKey:W,atomKey:z})}X.add(G)};var FT=($,T,W,U)=>({get:(...X)=>{let Y=H$($),w;if(X.length===2){let[F,O]=X;w=t6($,F,O)}else[w]=X;let G=C6($,w),H=zT($,G),z=w.key;return $.logger.info("\uD83D\uDD0C",T,W,`registers dependency ( "${z}" =`,H,")"),Y.selectorGraph.set({upstreamSelectorKey:z,downstreamSelectorKey:W},{source:w.key}),aD($,T,W,w,U),H},set:(...X)=>{let Y,w;if(X.length===2)Y=X[0],w=X[1];else{let z=X[0],F=X[1];w=X[2],Y=t6($,z,F)}let G=H$($),H=C6(G,Y);ww(G,H,w)},find:(...X)=>t6($,...X),json:(X)=>$2($,X)});var W5=($,T,W)=>{let U=H$($),X=new I$,Y=new Set,{key:w,const:G}=T,H="readonly_held_selector",{get:z,find:F,json:O}=FT(U,"readonly_held_selector",w,Y),Z={...T,type:"readonly_held_selector",subject:X,install:(E)=>W5(E,T,W),get:()=>{return T.get({get:z,find:F,json:O},G),G6(H$($),w,G,X),Y.clear(),G},...W&&{family:W}};U.readonlySelectors.set(w,Z),$.logger.info("\u2728","readonly_held_selector",w,"=",G);let V={key:w,type:"readonly_held_selector"};if(W)V.family=W;return V};var U5=($,T,W)=>{let U=H$($),X=new I$,Y=new Set,w=T.key,G="readonly_pure_selector",{get:H,find:z,json:F}=FT(U,"readonly_pure_selector",w,Y),O=()=>{let E=T.get({get:H,find:z,json:F});return G6(H$($),w,E,X),Y.clear(),E},Q={...T,type:"readonly_pure_selector",subject:X,install:(E)=>U5(E,T,W),get:O,...W&&{family:W}};U.readonlySelectors.set(w,Q);let Z=O();$.logger.info("\u2728","readonly_pure_selector",w,"=",Z);let V={key:w,type:"readonly_pure_selector"};if(W)V.family=W;return V};var X5=($,T,W)=>{let U=H$($),X=new I$,Y=new Set,{key:w,const:G}=T,H="writable_held_selector",z=FT(U,"writable_held_selector",w,Y),{find:F,get:O,json:Q}=z,Z={find:F,get:O,json:Q},V=(R=T.get,P=H$($))=>{return R(Z,G),G6(P,w,G,X),Y.clear(),G},N={...T,type:"writable_held_selector",subject:X,install:(R)=>X5(R,T,W),get:V,set:(R)=>{let P=H$($),x=V(T.get,P),f=eW(R)(x);if($.logger.info("\uD83D\uDCDD","writable_held_selector",w,"set (",x,"->",f,")"),G6(P,w,f,X),HT(P,w),GT(P))X.next({newValue:f,oldValue:x});T.set(z,f)},...W&&{family:W}};U.writableSelectors.set(w,N);let J=V();$.logger.info("\u2728","writable_held_selector",w,"=",J);let _={key:w,type:"writable_held_selector"};if(W)_.family=W;return _};var mU=($,T,W)=>{let U=H$($),X=new I$,Y=new Set,w=T.key,G="writable_pure_selector",H=FT(U,"writable_pure_selector",w,Y),{find:z,get:F,json:O}=H,Q={find:z,get:F,json:O},Z=(_=T.get,R=H$($))=>{let P=_(Q);return G6(R,w,P,X),Y.clear(),P},E={...T,type:"writable_pure_selector",subject:X,install:(_)=>mU(_,T,W),get:Z,set:(_)=>{let R=H$($),P=Z(T.get,R),x=eW(_)(P);if($.logger.info("\uD83D\uDCDD","writable_pure_selector",w,"set (",P,"->",x,")"),G6(R,T.key,x,X),HT(R,T.key),GT(R))X.next({newValue:x,oldValue:P});T.set(H,x)},...W&&{family:W}};U.writableSelectors.set(w,E);let N=Z();$.logger.info("\u2728",E.type,E.key,"=",N);let J={key:w,type:"writable_pure_selector"};if(W)J.family=W;return J};function bD($,T){let W="set"in T,U="const"in T;if(U&&W){let Y=X5($,T,void 0);return $.on.selectorCreation.next(Y),Y}if(U){let Y=W5($,T,void 0);return $.on.selectorCreation.next(Y),Y}if(W){let Y=mU($,T,void 0);return $.on.selectorCreation.next(Y),Y}let X=U5($,T,void 0);return $.on.selectorCreation.next(X),X}function tz($,T,W){let U=T.key,X="writable_pure_selector_family",Y={key:U,type:"writable_pure_selector_family"},w=$.families.get(U);if(w)$.logger.error("\u2757","writable_pure_selector_family",U,`Overwriting an existing ${Yw(w)} "${w.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let G=new I$,z=Object.assign((F)=>{let O=w6(F),Q={key:U,subKey:O},Z=`${U}(${O})`,V=H$($),E=mU(V,{key:Z,get:T.get(F),set:T.set(F)},Q);return G.next({type:"state_creation",token:E}),E},Y,{internalRoles:W,subject:G,install:(F)=>tz(F,T),default:(F)=>{return T.get(F)({get:(...Q)=>cU($,...Q),find:(...Q)=>t6($,...Q),json:(Q)=>$2($,Q)})}});return $.families.set(U,z),Y}function sD($,T,W){let U=$.families.get(T.key);if(U===void 0)throw new hU(T,$);let X=U(W),Y=H$($);if(X.family){if(GT(Y))switch(X.type){case"atom":case"mutable_atom":$.on.atomCreation.next(X);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.on.selectorCreation.next(X);break}else if(i6(Y)&&Y.on.transactionApplying.state===null)Y.transactionMeta.update.updates.push({type:"state_creation",token:X})}return X}function eD($,T,W){let U=w6(W),X=`${T.key}(${U})`,Y=H$($),w;switch(T.type){case"atom_family":case"mutable_atom_family":w=Y.atoms.get(X);break;case"writable_held_selector_family":case"writable_pure_selector_family":w=Y.writableSelectors.get(X);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":w=Y.readonlySelectors.get(X);break}if(w)return yU(w);return w}function t6($,T,W){let U=eD($,T,W);if(U)return U;let X=w6(W),Y=$.molecules.get(X);if(!Y&&$.config.lifespan==="immortal"){let w=yD(T,W);return $.logger.error("\u274C",w.type,w.key,`was not found in store "${$.config.name}"; returned a counterfeit token.`),w}if(U=sD($,T,W),Y)H$($).moleculeData.set(X,T.key);return U}function $V($,T){if(T.family){let W=$.families.get(T.family.key);if(W)return W}}function OT($,...T){let W,U,X,Y;if(T.length===2){if(W=T[0],Y=T[1],U=$V($,W)??null,U)X=W.family?fU(W.family.subKey):null,W=t6($,U,X)}else U=T[0],X=T[1],Y=T[2],W=t6($,U,X);if("counterfeit"in W&&"family"in W){let H=W.family.subKey,z=$.disposalTraces.buffer.find((F)=>F?.key===H);$.logger.error("\u274C",W.type,W.key,`could not be set because it was not found in the store "${$.config.name}".`,z?`This state was previously disposed:
|
|
4
|
-
${z.trace}`:"No previous disposal trace was found.");return}let
|
|
5
|
-
${w.trace}`:"No previous disposal trace was found."),U.type){case"atom_family":case"mutable_atom_family":return $.defaults.get(U.key);case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if($.defaults.has(U.key))return $.defaults.get(W.family.key);let G=C6($,U).default(Y);return $.defaults.set(U.key,G),G}}}return zT($,C6($,W))}class TV{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new r1({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new r1({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new r1({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new r1({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new Xw(100);molecules=new Map;moleculeJoins=new r1({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeGraph=new r1({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeData=new r1({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});miscResources=new Map;on={atomCreation:new I$,atomDisposal:new I$,selectorCreation:new I$,selectorDisposal:new I$,timelineCreation:new I$,transactionCreation:new I$,transactionApplying:new ez(null),operationClose:new I$,moleculeCreation:new I$,moleculeDisposal:new I$};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new sz("warn",($,T,W)=>!UV(W))];logger={error:(...$)=>{for(let T of this.loggers)T.error(...$)},info:(...$)=>{for(let T of this.loggers)T.info(...$)},warn:(...$)=>{for(let T of this.loggers)T.warn(...$)}};constructor($,T=null){if(this.config={...T?.config,...$},T!==null){if(this.valueMap=new Map(T?.valueMap),this.operation={...T?.operation},GT(T))this.transactionMeta={epoch:new Map(T?.transactionMeta.epoch),actionContinuities:new r1(T?.transactionMeta.actionContinuities.toJSON())};for(let[,U]of T.families){if(U.internalRoles?.includes("mutable")||U.internalRoles?.includes("join"))continue;U.install(this)}let W=new Set;for(let[,U]of T.atoms){if(W.has(U.key))continue;if(U.install(this),U.type==="mutable_atom"){let X=$2(T,U),Y=WV(U);W.add(X.key),W.add(Y.key)}}for(let[,U]of T.readonlySelectors)U.install(this);for(let[,U]of T.writableSelectors){if(W.has(U.key))continue;U.install(this)}for(let[,U]of T.transactions)U.install(this);for(let[,U]of T.timelines)U.install(this)}}}var fD={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new TV({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function C6($,T){let W,U=$;while(U!==null){switch(T.type){case"atom":case"mutable_atom":W=U.atoms.get(T.key);break;case"writable_pure_selector":case"writable_held_selector":W=U.writableSelectors.get(T.key);break;case"readonly_pure_selector":case"readonly_held_selector":W=U.readonlySelectors.get(T.key);break;case"atom_family":case"mutable_atom_family":case"writable_pure_selector_family":case"readonly_pure_selector_family":case"writable_held_selector_family":case"readonly_held_selector_family":W=U.families.get(T.key);break;case"timeline":W=U.timelines.get(T.key);break;case"transaction":W=U.transactions.get(T.key);break}if(W)return W;U=U.child}throw new hU(T,$)}var XV=($,T)=>{let W=H$($);if(W.operation.open)return W.operation.prev.get(T.key);return W.valueMap.get(T.key)};var Y5=($,T)=>{let W=H$($);return tD(T,$).map((X)=>{let Y=W.atoms.get(X);if(Y===void 0)throw new Error(`Atom "${X}", a dependency of selector "${T.key}", not found in store "${$.config.name}".`);return Y.subject.subscribe(`${T.type}:${T.key}`,(w)=>{$.logger.info("\uD83D\uDCE2",T.type,T.key,"root",X,"went",w.oldValue,"->",w.newValue);let G=XV(W,T),H=zT(W,T);$.logger.info("\u2728",T.type,T.key,"went",G,"->",H),T.subject.next({newValue:H,oldValue:G})})})};function uU($,T,W,U){function X(O){if($.operation.open){let Q=$.on.operationClose.subscribe(`state subscription ${W}`,()=>{Q(),U(O)})}else U(O)}let Y=C6($,T);$.logger.info("\uD83D\uDC40",Y.type,Y.key,`Adding subscription "${W}"`);let w=Y.type==="writable_pure_selector"||Y.type==="readonly_pure_selector",G=null,H=X;if(w)G=Y5($,Y),H=(O)=>{if(G)G.length=0,G.push(...Y5($,Y));X(O)};let z=Y.subject.subscribe(W,H);return()=>{if($.logger.info("\uD83D\uDE48",Y.type,Y.key,`Removing subscription "${W}"`),z(),G)for(let O of G)O()}}var YV=($,T,W,U)=>{let X=C6($,T);$.logger.info("\uD83D\uDC40","timeline",T.key,`Adding subscription "${W}"`);let Y=X.subject.subscribe(W,U);return()=>{$.logger.info("\uD83D\uDE48","timeline",T.key,`Removing subscription "${W}" from timeline`),Y()}};class w5{initializeState($,T){let W=`*${$.key}`;T.atoms.delete(W),T.valueMap.delete(W);let U=$.family?{key:`*${$.family.key}`,subKey:$.family.subKey}:void 0,X=G5(T,{key:W,default:null},U);if(T.parent?.valueMap.has(W)){let Y=T.parent.valueMap.get(W);T.valueMap.set(W,Y)}return X}unsubscribeFromInnerValue;unsubscribeFromState;observeCore($,T,W){let U=`tracker:${W.config.name}:${i6(W)?W.transactionMeta.update.key:"main"}:${$.key}`,X=cU(W,$);this.unsubscribeFromInnerValue=X.subscribe(U,(Y)=>{OT(W,T,Y)}),this.unsubscribeFromState=uU(W,$,U,(Y)=>{if(Y.newValue!==Y.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=Y.newValue.subscribe(U,(w)=>{OT(W,T,w)})})}updateCore($,T,W){let U=`tracker:${W.config.name}:${i6(W)?W.transactionMeta.update.key:"main"}:${$.key}`;uU(W,T,U,({newValue:X,oldValue:Y})=>{let w=W.timelineTopics.getRelatedKey(T.key);if(w){if(W.timelines.get(w)?.timeTraveling){let z=YV(W,{key:w,type:"timeline"},U,(F)=>{z(),OT(W,$,(O)=>{if(F==="redo"&&X)O.do(X);else if(F==="undo"&&Y)O.undo(Y);return O})});return}}let G=W.on.operationClose.subscribe(U,()=>{G();let H=cU(W,$),z=X===null?-1:H.getUpdateNumber(X),F=z-H.cacheUpdateNumber;if(X&&F===1)OT(W,$,(O)=>(O.do(X),O));else W.logger.info("\u274C","mutable_atom",$.key,`could not be updated. Expected update number ${H.cacheUpdateNumber+1}, but got ${z}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor($,T){this.mutableState=$;let W=H$(T);this.latestUpdateState=this.initializeState($,W),this.observeCore($,this.latestUpdateState,W),this.updateCore($,this.latestUpdateState,W),W.trackers.set($.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),W.trackers.delete($.key)}}}var $2=($,T)=>{if(T.family){let U=H$($),Y={key:`${T.family.key}:JSON`,type:"writable_pure_selector_family"},w=C6(U,Y),G=JSON.parse(T.family.subKey);return t6($,w,G)}return{type:"writable_pure_selector",key:`${T.key}:JSON`}};var WV=($)=>{let W={type:"atom",key:`*${$.key}`};if($.family)W.family={key:`*${$.family.key}`,subKey:$.family.subKey};return W};function lD($){return typeof $==="object"&&$!==null&&"do"in $&&"undo"in $&&"subscribe"in $}function gU($,T,W){let U=W.valueMap.get(T.key),X=$.valueMap.get(T.key);if(U!==X)return X;if(U===void 0)return T.default();W.logger.info("\uD83D\uDCC3","atom",T.key,"copying");let Y=T.toJson(U),w=T.fromJson(Y);return $.valueMap.set(T.key,w),new w5(T,W),w}function G6($,T,W,U){let X=$.valueMap.get(T);if(X instanceof bU)X.use(W);if(W instanceof Promise){let Y=new bU(W);return $.valueMap.set(T,Y),Y.then((w)=>{G6($,T,w,U),U.next({newValue:w,oldValue:Y})}).catch((w)=>{$.logger.error("\uD83D\uDCA5","state",T,"rejected:",w)}),Y}return $.valueMap.set(T,W),W}var gD=($,T)=>{let W=T.valueMap.get($.key);if($.type==="mutable_atom"&&i6(T)){let{parent:U}=T;W=gU(T,$,U)}return W},dD=($,T)=>{let W=T.valueMap.get($);if(W instanceof bU){let U=W,X=T.writableSelectors.get($)??T.readonlySelectors.get($);if(X)U.use(X.get());return}if(T.operation.open)T.operation.prev.set($,W);T.valueMap.delete($),T.logger.info("\uD83D\uDDD1","state",$,"evicted")};var rD=($,T)=>{return H$($).atomsThatAreDefault.has(T)},wV=($,T)=>{let W=H$($);W.atomsThatAreDefault=new Set(W.atomsThatAreDefault).add(T)},nD=($,T)=>{let W=H$($);W.atomsThatAreDefault=new Set(H$($).atomsThatAreDefault),W.atomsThatAreDefault.delete(T)};function G5($,T,W){let{key:X,default:Y}=T;$.logger.info("\uD83D\uDD28","atom",X,`creating in store "${$.config.name}"`);let w=H$($),G=w.atoms.get(X);if(G&&G.type==="atom")return $.logger.error("\u274C","atom",X,"Tried to create atom, but it already exists in the store."),yU(G);let H=new I$,z={...T,type:"atom",install:(Q)=>{return Q.logger.info("\uD83D\uDEE0\uFE0F","atom",X,`installing in store "${Q.config.name}"`),G5(Q,T,W)},subject:H};if(W)z.family=W;let F=Y;if(Y instanceof Function)F=Y();w.atoms.set(X,z),wV($,X),G6(w,X,F,H);let O=yU(z);if(T.effects){let Q=0,Z=[];for(let V of T.effects){let E=V({setSelf:(N)=>{OT($,O,N)},onSet:(N)=>uU($,O,`effect[${Q}]`,N)});if(E)Z.push(E);++Q}z.cleanup=()=>{for(let V of Z)V()}}return O}class T2 extends Set{mode="record";subject=new I$;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor($,T=0){super($);if($ instanceof T2)this.parent=$,this.cacheUpdateNumber=$.cacheUpdateNumber;if(T)this.cacheLimit=T,this.cache=new Array(T),this.subscribe("auto cache",(W)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=W})}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON($){let T=new T2($.members,$.cacheLimit);return T.cache=$.cache,T.cacheIdx=$.cacheIdx,T.cacheUpdateNumber=$.cacheUpdateNumber,T}add($){let T=super.add($);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${w6($)}`);return T}clear(){let $=this.mode==="record"?[...this]:null;if(super.clear(),$)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify($)}`)}delete($){let T=super.delete($);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${w6($)}`);return T}parent=null;child=null;transactionUpdates=null;transaction($){this.mode="transaction",this.transactionUpdates=[],this.child=new T2(this);let T=this.child._subscribe("transaction",(W)=>{this.transactionUpdates?.push(W)});try{if($(this.child)){for(let U of this.transactionUpdates)this.doStep(U);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(W){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",W),W}finally{T(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe($,T){return this.subject.subscribe($,T)}subscribe($,T){return this.subject.subscribe($,(W)=>{T(`${this.cacheUpdateNumber}=${W}`)})}emit($){this.subject.next($)}doStep($){let T=$.indexOf(":"),W=$.substring(0,T),U=$.substring(T+1);switch(W){case"add":this.add(JSON.parse(U));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(U));break;case"tx":for(let X of U.split(";"))this.doStep(X)}}getUpdateNumber($){let T=$.indexOf("=");return Number($.substring(0,T))}do($){let T=$.indexOf("="),W=Number($.substring(0,T)),U=W-this.cacheUpdateNumber;if(U>0){if(U===1){this.mode="playback";let Y=$.substring(T+1);return this.doStep(Y),this.mode="record",this.cacheUpdateNumber=W,null}return this.cacheUpdateNumber+1}if(Math.abs(U)<this.cacheLimit){let Y=this.cacheIdx+U;if(this.cache[Y]===$)return null;this.mode="playback";let G=!1;while(!G){this.cacheIdx%=this.cacheLimit;let z=this.cache[this.cacheIdx];if(this.cacheIdx--,!z)return"OUT_OF_RANGE";this.undo(z),G=this.cacheIdx===Y-1}let H=$.substring(T+1);return this.doStep(H),this.mode="record",this.cacheUpdateNumber=W,null}return"OUT_OF_RANGE"}undoStep($){let T=$.indexOf(":"),W=$.substring(0,T),U=$.substring(T+1);switch(W){case"add":this.delete(JSON.parse(U));break;case"del":this.add(JSON.parse(U));break;case"clear":{let X=JSON.parse(U);for(let Y of X)this.add(Y);break}case"tx":{let X=U.split(";");for(let Y=X.length-1;Y>=0;Y--)this.undoStep(X[Y])}}}undo($){let T=$.indexOf("=");if(Number($.substring(0,T))===this.cacheUpdateNumber){this.mode="playback";let U=$.substring(T+1);return this.undoStep(U),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}}function UV($){return $.startsWith("\uD83D\uDD0D ")}class Hw{listeners;globalListeners;handleEvent($,...T){for(let U of this.globalListeners)U($,...T);let W=this.listeners.get($);if(W)for(let U of W)U(...T)}id="no_id_retrieved";emit;constructor($){this.emit=$,this.listeners=new Map,this.globalListeners=new Set}on($,T){let W=this.listeners.get($);if(W)W.add(T);else this.listeners.set($,new Set([T]));return this}onAny($){return this.globalListeners.add($),this}off($,T){let W=this.listeners.get($);if(W)if(T)W.delete(T);else this.listeners.delete($);return this}offAny($){return this.globalListeners.delete($),this}}class GV extends Hw{in;out;id="no_id_retrieved";disposalFunctions=[];constructor($){super((...T)=>{return this.out.next(T),this});this.id=$,this.in=new I$,this.out=new I$,this.in.subscribe("socket",(T)=>{this.handleEvent(...T)})}dispose(){for(let $ of this.disposalFunctions)$()}}class z5 extends Hw{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...$){this.process.stderr.write(w6($.map((T)=>T instanceof T2?`{ ${T.toJSON().members.join(" | ")} }`:T))+"\x03")}logger={info:(...$)=>{this.log("i",...$)},warn:(...$)=>{this.log("w",...$)},error:(...$)=>{this.log("e",...$)}};constructor(){super(($,...T)=>{let W=JSON.stringify([$,...T]);return this.process.stdout.write(W+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",($)=>{let T=$.toString();this.unprocessedEvents.push(...T.split("\x03"));let W=this.unprocessedEvents.shift();this.incompleteData+=W??"";try{let U=fU(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",U),this.handleEvent(...U);while(this.unprocessedEvents.length>0){let X=this.unprocessedEvents.shift();if(X){if(this.unprocessedEvents.length===0)this.incompleteData=X;let Y=fU(X);this.handleEvent(...Y)}}this.incompleteData=""}catch(U){if(U instanceof Error)this.logger.error("\u2757",U.message,U.cause,U.stack)}}),this.on("exit",()=>{this.logger.info("\uD83D\uDD25",this.id,'received "exit"'),process.exit(0)}),process.on("exit",($)=>{this.logger.info("\uD83D\uDD25",this.id,`exited with code ${$}`)}),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",($)=>{this.logger.info("\uD83D\uDC64","user",$,"joined");let T=new GV(`user:${$}`);this.relays.set($,T),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let W of this.relayServices){let U=W(T);if(U)T.disposalFunctions.push(U)}this.on(`user:${$}`,(...W)=>{T.in.next(W)}),T.out.subscribe("socket",(W)=>{this.emit(...W)})}),this.on("user-leaves",($)=>{let T=this.relays.get($);if(this.off(`relay:${$}`),T)T.dispose(),this.relays.delete($)}),process.stdout.write("ALIVE")}relay($){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push($)}}var FG={};wT(FG,{xid:()=>SB,void:()=>tB,uuidv7:()=>_B,uuidv6:()=>JB,uuidv4:()=>LB,uuid:()=>NB,url:()=>RB,uppercase:()=>OX,unknown:()=>WG,union:()=>zG,undefined:()=>nB,ulid:()=>CB,uint64:()=>lB,uint32:()=>pB,tuple:()=>Ux,trim:()=>EX,treeifyError:()=>N5,transform:()=>RF,toUpperCase:()=>MX,toLowerCase:()=>AX,toJSONSchema:()=>pH,templateLiteral:()=>Qx,symbol:()=>rB,superRefine:()=>HE,success:()=>Fx,stringbool:()=>Kx,string:()=>eH,strictObject:()=>$x,startsWith:()=>ZX,size:()=>zX,setErrorMap:()=>Jx,set:()=>wx,safeParseAsync:()=>aH,safeParse:()=>tH,registry:()=>Cw,regexes:()=>tT,regex:()=>HX,refine:()=>zE,record:()=>yK,readonly:()=>WE,property:()=>yH,promise:()=>Zx,prettifyError:()=>L5,preprocess:()=>Ax,prefault:()=>iK,positive:()=>xH,pipe:()=>YG,partialRecord:()=>Xx,parseAsync:()=>iH,parse:()=>nH,overwrite:()=>E0,optional:()=>UG,object:()=>eB,number:()=>_K,nullish:()=>Hx,nullable:()=>XG,null:()=>PK,normalize:()=>KX,nonpositive:()=>bH,nonoptional:()=>tK,nonnegative:()=>fH,never:()=>wG,negative:()=>IH,nativeEnum:()=>Gx,nanoid:()=>vB,nan:()=>Ox,multipleOf:()=>sT,minSize:()=>eT,minLength:()=>ZT,mime:()=>VX,maxSize:()=>X2,maxLength:()=>Y2,map:()=>Yx,lte:()=>D1,lt:()=>V0,lowercase:()=>FX,looseObject:()=>Tx,locales:()=>YX,literal:()=>uK,length:()=>w2,lazy:()=>YE,ksuid:()=>jB,keyof:()=>sB,jwt:()=>gB,json:()=>Ex,iso:()=>sw,ipv6:()=>xB,ipv4:()=>BB,intersection:()=>bK,int64:()=>oB,int32:()=>uB,int:()=>$F,instanceof:()=>Vx,includes:()=>QX,guid:()=>MB,gte:()=>j6,gt:()=>K0,globalRegistry:()=>n1,getErrorMap:()=>_x,function:()=>uH,formatError:()=>eU,float64:()=>cB,float32:()=>mB,flattenError:()=>sU,file:()=>zx,enum:()=>mK,endsWith:()=>DX,emoji:()=>kB,email:()=>AB,e164:()=>hB,discriminatedUnion:()=>Wx,date:()=>aB,custom:()=>Dx,cuid2:()=>PB,cuid:()=>qB,core:()=>A0,config:()=>N4,coerce:()=>sH,clone:()=>a6,cidrv6:()=>bB,cidrv4:()=>IB,check:()=>GE,catch:()=>eK,boolean:()=>RK,bigint:()=>dB,base64url:()=>yB,base64:()=>fB,array:()=>LF,any:()=>iB,_default:()=>rK,_ZodString:()=>TF,ZodXID:()=>HF,ZodVoid:()=>jK,ZodUnknown:()=>NF,ZodUnion:()=>JF,ZodUndefined:()=>vK,ZodUUID:()=>M0,ZodURL:()=>UF,ZodULID:()=>zF,ZodType:()=>J$,ZodTuple:()=>fK,ZodTransform:()=>dK,ZodTemplateLiteral:()=>UE,ZodSymbol:()=>kK,ZodSuccess:()=>aK,ZodStringFormat:()=>T4,ZodString:()=>ew,ZodSet:()=>gK,ZodRecord:()=>_F,ZodRealError:()=>z2,ZodReadonly:()=>TE,ZodPromise:()=>wE,ZodPrefault:()=>nK,ZodPipe:()=>qF,ZodOptional:()=>kF,ZodObject:()=>GG,ZodNumberFormat:()=>H2,ZodNumber:()=>LX,ZodNullable:()=>oK,ZodNull:()=>qK,ZodNonOptional:()=>vF,ZodNever:()=>SK,ZodNanoID:()=>YF,ZodNaN:()=>$E,ZodMap:()=>hK,ZodLiteral:()=>cK,ZodLazy:()=>XE,ZodKSUID:()=>FF,ZodJWT:()=>AF,ZodIssueCode:()=>Mx,ZodIntersection:()=>IK,ZodIPv6:()=>QF,ZodIPv4:()=>OF,ZodGUID:()=>TG,ZodFile:()=>pK,ZodError:()=>OB,ZodEnum:()=>RX,ZodEmoji:()=>XF,ZodEmail:()=>WF,ZodE164:()=>EF,ZodDiscriminatedUnion:()=>xK,ZodDefault:()=>lK,ZodDate:()=>$G,ZodCustom:()=>HG,ZodCatch:()=>sK,ZodCUID2:()=>GF,ZodCUID:()=>wF,ZodCIDRv6:()=>DF,ZodCIDRv4:()=>ZF,ZodBoolean:()=>JX,ZodBigIntFormat:()=>MF,ZodBigInt:()=>_X,ZodBase64URL:()=>KF,ZodBase64:()=>VF,ZodArray:()=>BK,ZodAny:()=>CK,NEVER:()=>Lx,$output:()=>WH,$input:()=>UH,$brand:()=>H5});var A0={};wT(A0,{version:()=>V7,util:()=>d,treeifyError:()=>N5,toJSONSchema:()=>pH,toDotPath:()=>FV,safeParseAsync:()=>_5,safeParse:()=>J5,registry:()=>Cw,regexes:()=>tT,prettifyError:()=>L5,parseAsync:()=>Vw,parse:()=>Zw,locales:()=>YX,isValidJWT:()=>PV,isValidBase64URL:()=>qV,isValidBase64:()=>f7,globalRegistry:()=>n1,globalConfig:()=>pU,function:()=>uH,formatError:()=>eU,flattenError:()=>sU,config:()=>N4,clone:()=>a6,_xid:()=>cw,_void:()=>CH,_uuidv7:()=>Iw,_uuidv6:()=>xw,_uuidv4:()=>Bw,_uuid:()=>jw,_url:()=>bw,_uppercase:()=>OX,_unknown:()=>qH,_union:()=>cj,_undefined:()=>RH,_ulid:()=>mw,_uint64:()=>JH,_uint32:()=>KH,_tuple:()=>gH,_trim:()=>EX,_transform:()=>tj,_toUpperCase:()=>MX,_toLowerCase:()=>AX,_templateLiteral:()=>YB,_symbol:()=>_H,_success:()=>TB,_stringbool:()=>cH,_string:()=>XH,_startsWith:()=>ZX,_size:()=>zX,_set:()=>lj,_safeParseAsync:()=>Ew,_safeParse:()=>Kw,_regex:()=>HX,_refine:()=>zB,_record:()=>dj,_readonly:()=>XB,_property:()=>yH,_promise:()=>GB,_positive:()=>xH,_pipe:()=>UB,_parseAsync:()=>Dw,_parse:()=>Qw,_overwrite:()=>E0,_optional:()=>aj,_number:()=>FH,_nullable:()=>sj,_null:()=>kH,_normalize:()=>KX,_nonpositive:()=>bH,_nonoptional:()=>$B,_nonnegative:()=>fH,_never:()=>PH,_negative:()=>IH,_nativeEnum:()=>nj,_nanoid:()=>yw,_nan:()=>BH,_multipleOf:()=>sT,_minSize:()=>eT,_minLength:()=>ZT,_min:()=>j6,_mime:()=>VX,_maxSize:()=>X2,_maxLength:()=>Y2,_max:()=>D1,_map:()=>oj,_lte:()=>D1,_lt:()=>V0,_lowercase:()=>FX,_literal:()=>ij,_length:()=>w2,_lazy:()=>wB,_ksuid:()=>uw,_jwt:()=>tw,_isoTime:()=>zH,_isoDuration:()=>HH,_isoDateTime:()=>wH,_isoDate:()=>GH,_ipv6:()=>dw,_ipv4:()=>pw,_intersection:()=>pj,_int64:()=>LH,_int32:()=>VH,_int:()=>QH,_includes:()=>QX,_guid:()=>GX,_gte:()=>j6,_gt:()=>K0,_float64:()=>DH,_float32:()=>ZH,_file:()=>mH,_enum:()=>rj,_endsWith:()=>DX,_emoji:()=>fw,_email:()=>Sw,_e164:()=>iw,_discriminatedUnion:()=>uj,_default:()=>ej,_date:()=>SH,_custom:()=>NX,_cuid2:()=>gw,_cuid:()=>hw,_coercedString:()=>YH,_coercedNumber:()=>OH,_coercedDate:()=>jH,_coercedBoolean:()=>AH,_coercedBigint:()=>NH,_cidrv6:()=>lw,_cidrv4:()=>ow,_catch:()=>WB,_boolean:()=>EH,_bigint:()=>MH,_base64url:()=>nw,_base64:()=>rw,_array:()=>hH,_any:()=>vH,JSONSchemaGenerator:()=>aw,JSONSchema:()=>KK,Doc:()=>_w,$output:()=>WH,$input:()=>UH,$constructor:()=>k,$brand:()=>H5,$ZodXID:()=>v7,$ZodVoid:()=>n7,$ZodUnknown:()=>WX,$ZodUnion:()=>Pw,$ZodUndefined:()=>d7,$ZodUUID:()=>A7,$ZodURL:()=>N7,$ZodULID:()=>k7,$ZodType:()=>Q$,$ZodTuple:()=>aT,$ZodTransform:()=>w3,$ZodTemplateLiteral:()=>K3,$ZodSymbol:()=>p7,$ZodSuccess:()=>Q3,$ZodStringFormat:()=>l$,$ZodString:()=>$X,$ZodSet:()=>W3,$ZodRegistry:()=>wX,$ZodRecord:()=>$3,$ZodRealError:()=>W2,$ZodReadonly:()=>V3,$ZodPromise:()=>E3,$ZodPrefault:()=>F3,$ZodPipe:()=>UX,$ZodOptional:()=>G3,$ZodObject:()=>a7,$ZodNumberFormat:()=>c7,$ZodNumber:()=>vw,$ZodNullable:()=>z3,$ZodNull:()=>o7,$ZodNonOptional:()=>O3,$ZodNever:()=>r7,$ZodNanoID:()=>J7,$ZodNaN:()=>D3,$ZodMap:()=>T3,$ZodLiteral:()=>X3,$ZodLazy:()=>A3,$ZodKSUID:()=>q7,$ZodJWT:()=>m7,$ZodIntersection:()=>e7,$ZodISOTime:()=>S7,$ZodISODuration:()=>j7,$ZodISODateTime:()=>P7,$ZodISODate:()=>C7,$ZodIPv6:()=>x7,$ZodIPv4:()=>B7,$ZodGUID:()=>E7,$ZodFunction:()=>G2,$ZodFile:()=>Y3,$ZodError:()=>aU,$ZodEnum:()=>U3,$ZodEmoji:()=>L7,$ZodEmail:()=>M7,$ZodE164:()=>g7,$ZodDiscriminatedUnion:()=>s7,$ZodDefault:()=>H3,$ZodDate:()=>i7,$ZodCustom:()=>M3,$ZodCheckUpperCase:()=>z7,$ZodCheckStringFormat:()=>U2,$ZodCheckStartsWith:()=>F7,$ZodCheckSizeEquals:()=>W7,$ZodCheckRegex:()=>w7,$ZodCheckProperty:()=>Q7,$ZodCheckOverwrite:()=>D7,$ZodCheckNumberFormat:()=>s5,$ZodCheckMultipleOf:()=>a5,$ZodCheckMinSize:()=>T7,$ZodCheckMinLength:()=>X7,$ZodCheckMimeType:()=>Z7,$ZodCheckMaxSize:()=>$7,$ZodCheckMaxLength:()=>U7,$ZodCheckLowerCase:()=>G7,$ZodCheckLessThan:()=>Lw,$ZodCheckLengthEquals:()=>Y7,$ZodCheckIncludes:()=>H7,$ZodCheckGreaterThan:()=>Jw,$ZodCheckEndsWith:()=>O7,$ZodCheckBigIntFormat:()=>e5,$ZodCheck:()=>G4,$ZodCatch:()=>Z3,$ZodCUID2:()=>R7,$ZodCUID:()=>_7,$ZodCIDRv6:()=>b7,$ZodCIDRv4:()=>I7,$ZodBoolean:()=>TX,$ZodBigIntFormat:()=>u7,$ZodBigInt:()=>qw,$ZodBase64URL:()=>h7,$ZodBase64:()=>y7,$ZodAsyncError:()=>Z0,$ZodArray:()=>t7,$ZodAny:()=>l7});function k($,T,W){function U(G,H){var z;Object.defineProperty(G,"_zod",{value:G._zod??{},enumerable:!1}),(z=G._zod).traits??(z.traits=new Set),G._zod.traits.add($),T(G,H);for(let F in w.prototype)Object.defineProperty(G,F,{value:w.prototype[F].bind(G)});G._zod.constr=w,G._zod.def=H}let X=W?.Parent??Object;class Y extends X{}Object.defineProperty(Y,"name",{value:$});function w(G){var H;let z=W?.Parent?new Y:this;U(z,G),(H=z._zod).deferred??(H.deferred=[]);for(let F of z._zod.deferred)F();return z}return Object.defineProperty(w,"init",{value:U}),Object.defineProperty(w,Symbol.hasInstance,{value:(G)=>{if(W?.Parent&&G instanceof W.Parent)return!0;return G?._zod?.traits?.has($)}}),Object.defineProperty(w,"name",{value:$}),w}var H5=Symbol("zod_brand");class Z0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var pU={};function N4($){if($)Object.assign(pU,$);return pU}var d={};wT(d,{unwrapMessage:()=>dU,stringifyPrimitive:()=>r,required:()=>mP,randomString:()=>Fw,propertyKeyTypes:()=>nU,promiseAllObject:()=>jP,primitiveTypes:()=>V5,prefixIssues:()=>S6,pick:()=>bP,partial:()=>gP,optionalKeys:()=>K5,omit:()=>fP,numKeys:()=>BP,nullish:()=>QT,normalizeParams:()=>c,merge:()=>hP,jsonStringifyReplacer:()=>O5,joinValues:()=>I,issue:()=>M5,isPlainObject:()=>rU,isObject:()=>Ow,getValidEnumValues:()=>CP,getSizableOrigin:()=>iU,getParsedType:()=>xP,getLengthableOrigin:()=>tU,getElementAtPath:()=>SP,floatSafeRemainder:()=>Q5,finalizeIssue:()=>s6,extend:()=>yP,escapeRegex:()=>D0,esc:()=>rT,defineLazy:()=>g$,createTransparentProxy:()=>IP,clone:()=>a6,cleanRegex:()=>lU,cleanEnum:()=>cP,cached:()=>oU,assignProp:()=>Z5,assertNotEqual:()=>kP,assertNever:()=>qP,assertIs:()=>vP,assertEqual:()=>RP,assert:()=>PP,allowsEval:()=>D5,aborted:()=>nT,NUMBER_FORMAT_RANGES:()=>E5,Class:()=>zV,BIGINT_FORMAT_RANGES:()=>A5});function RP($){return $}function kP($){return $}function vP($){}function qP($){throw new Error}function PP($){}function CP($){let T=Object.keys($).filter((U)=>typeof $[$[U]]!=="number"),W={};for(let U of T)W[U]=$[U];return Object.values(W)}function I($,T="|"){return $.map((W)=>r(W)).join(T)}function O5($,T){if(typeof T==="bigint")return T.toString();return T}function oU($){return{get value(){{let W=$();return Object.defineProperty(this,"value",{value:W}),W}throw new Error("cached value already set")}}}function QT($){return $===null||$===void 0}function lU($){let T=$.startsWith("^")?1:0,W=$.endsWith("$")?$.length-1:$.length;return $.slice(T,W)}function Q5($,T){let W=($.toString().split(".")[1]||"").length,U=(T.toString().split(".")[1]||"").length,X=W>U?W:U,Y=Number.parseInt($.toFixed(X).replace(".","")),w=Number.parseInt(T.toFixed(X).replace(".",""));return Y%w/10**X}function g$($,T,W){Object.defineProperty($,T,{get(){{let X=W();return $[T]=X,X}throw new Error("cached value already set")},set(X){Object.defineProperty($,T,{value:X})},configurable:!0})}function Z5($,T,W){Object.defineProperty($,T,{value:W,writable:!0,enumerable:!0,configurable:!0})}function SP($,T){if(!T)return $;return T.reduce((W,U)=>W?.[U],$)}function jP($){let T=Object.keys($),W=T.map((U)=>$[U]);return Promise.all(W).then((U)=>{let X={};for(let Y=0;Y<T.length;Y++)X[T[Y]]=U[Y];return X})}function Fw($=10){let W="";for(let U=0;U<$;U++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function rT($){return JSON.stringify($)}function Ow($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var D5=oU(()=>{try{return new Function(""),!0}catch($){return!1}});function rU($){return typeof $==="object"&&$!==null&&Object.getPrototypeOf($)===Object.prototype}function BP($){let T=0;for(let W in $)if(Object.prototype.hasOwnProperty.call($,W))T++;return T}var xP=($)=>{let T=typeof $;switch(T){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map!=="undefined"&&$ instanceof Map)return"map";if(typeof Set!=="undefined"&&$ instanceof Set)return"set";if(typeof Date!=="undefined"&&$ instanceof Date)return"date";if(typeof File!=="undefined"&&$ instanceof File)return"file";return"object";default:throw new Error(`Unknown data type: ${T}`)}},nU=new Set(["string","number","symbol"]),V5=new Set(["string","number","bigint","boolean","symbol","undefined"]);function D0($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a6($,T,W){let U=new $._zod.constr(T??$._zod.def);if(!T||W?.parent)U._zod.parent=$;return U}function c($){let T=$;if(!T)return{};if(typeof T==="string")return{error:()=>T};if(T?.message!==void 0){if(T?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");T.error=T.message}if(delete T.message,typeof T.error==="string")return{...T,error:()=>T.error};return T}function IP($){let T;return new Proxy({},{get(W,U,X){return T??(T=$()),Reflect.get(T,U,X)},set(W,U,X,Y){return T??(T=$()),Reflect.set(T,U,X,Y)},has(W,U){return T??(T=$()),Reflect.has(T,U)},deleteProperty(W,U){return T??(T=$()),Reflect.deleteProperty(T,U)},ownKeys(W){return T??(T=$()),Reflect.ownKeys(T)},getOwnPropertyDescriptor(W,U){return T??(T=$()),Reflect.getOwnPropertyDescriptor(T,U)},defineProperty(W,U,X){return T??(T=$()),Reflect.defineProperty(T,U,X)}})}function r($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function K5($){return Object.keys($).filter((T)=>{return $[T]._zod.optin==="optional"&&$[T]._zod.optout==="optional"})}var E5={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},A5={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function bP($,T){let W={},U=$._zod.def;for(let X in T){if(!(X in U.shape))throw new Error(`Unrecognized key: "${X}"`);if(!T[X])continue;W[X]=U.shape[X]}return a6($,{...$._zod.def,shape:W,checks:[]})}function fP($,T){let W={...$._zod.def.shape},U=$._zod.def;for(let X in T){if(!(X in U.shape))throw new Error(`Unrecognized key: "${X}"`);if(!T[X])continue;delete W[X]}return a6($,{...$._zod.def,shape:W,checks:[]})}function yP($,T){let W={...$._zod.def,get shape(){let U={...$._zod.def.shape,...T};return Z5(this,"shape",U),U},checks:[]};return a6($,W)}function hP($,T){return a6($,{...$._zod.def,get shape(){let W={...$._zod.def.shape,...T._zod.def.shape};return Z5(this,"shape",W),W},catchall:T._zod.def.catchall,checks:[]})}function gP($,T,W){let U=T._zod.def.shape,X={...U};if(W)for(let Y in W){if(!(Y in U))throw new Error(`Unrecognized key: "${Y}"`);if(!W[Y])continue;X[Y]=$?new $({type:"optional",innerType:U[Y]}):U[Y]}else for(let Y in U)X[Y]=$?new $({type:"optional",innerType:U[Y]}):U[Y];return a6(T,{...T._zod.def,shape:X,checks:[]})}function mP($,T,W){let U=T._zod.def.shape,X={...U};if(W)for(let Y in W){if(!(Y in X))throw new Error(`Unrecognized key: "${Y}"`);if(!W[Y])continue;X[Y]=new $({type:"nonoptional",innerType:U[Y]})}else for(let Y in U)X[Y]=new $({type:"nonoptional",innerType:U[Y]});return a6(T,{...T._zod.def,shape:X,checks:[]})}function nT($,T=0){for(let W=T;W<$.issues.length;W++)if($.issues[W].continue!==!0)return!0;return!1}function S6($,T){return T.map((W)=>{var U;return(U=W).path??(U.path=[]),W.path.unshift($),W})}function dU($){return typeof $==="string"?$:$?.message}function s6($,T,W){let U={...$,path:$.path??[]};if(!$.message){let X=dU($.inst?._zod.def?.error?.($))??dU(T?.error?.($))??dU(W.customError?.($))??dU(W.localeError?.($))??"Invalid input";U.message=X}if(delete U.inst,delete U.continue,!T?.reportInput)delete U.input;return U}function iU($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function tU($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function M5(...$){let[T,W,U]=$;if(typeof T==="string")return{message:T,code:"custom",input:W,inst:U};return{...T}}function cP($){return Object.entries($).filter(([T,W])=>{return Number.isNaN(Number.parseInt(T,10))}).map((T)=>T[1])}class zV{constructor(...$){}}var HV=($,T)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:T,enumerable:!1}),Object.defineProperty($,"message",{get(){return JSON.stringify(T,O5,2)},enumerable:!0})},aU=k("$ZodError",HV),W2=k("$ZodError",HV,{Parent:Error});function sU($,T=(W)=>W.message){let W={},U=[];for(let X of $.issues)if(X.path.length>0)W[X.path[0]]=W[X.path[0]]||[],W[X.path[0]].push(T(X));else U.push(T(X));return{formErrors:U,fieldErrors:W}}function eU($,T){let W=T||function(Y){return Y.message},U={_errors:[]},X=(Y)=>{for(let w of Y.issues)if(w.code==="invalid_union")w.errors.map((G)=>X({issues:G}));else if(w.code==="invalid_key")X({issues:w.issues});else if(w.code==="invalid_element")X({issues:w.issues});else if(w.path.length===0)U._errors.push(W(w));else{let G=U,H=0;while(H<w.path.length){let z=w.path[H];if(H!==w.path.length-1)G[z]=G[z]||{_errors:[]};else G[z]=G[z]||{_errors:[]},G[z]._errors.push(W(w));G=G[z],H++}}};return X($),U}function N5($,T){let W=T||function(Y){return Y.message},U={errors:[]},X=(Y,w=[])=>{var G,H;for(let z of Y.issues)if(z.code==="invalid_union")z.errors.map((F)=>X({issues:F},z.path));else if(z.code==="invalid_key")X({issues:z.issues},z.path);else if(z.code==="invalid_element")X({issues:z.issues},z.path);else{let F=[...w,...z.path];if(F.length===0){U.errors.push(W(z));continue}let O=U,Q=0;while(Q<F.length){let Z=F[Q],V=Q===F.length-1;if(typeof Z==="string")O.properties??(O.properties={}),(G=O.properties)[Z]??(G[Z]={errors:[]}),O=O.properties[Z];else O.items??(O.items=[]),(H=O.items)[Z]??(H[Z]={errors:[]}),O=O.items[Z];if(V)O.errors.push(W(z));Q++}}};return X($),U}function FV($){let T=[];for(let W of $)if(typeof W==="number")T.push(`[${W}]`);else if(typeof W==="symbol")T.push(`[${JSON.stringify(String(W))}]`);else if(/[^\w$]/.test(W))T.push(`[${JSON.stringify(W)}]`);else{if(T.length)T.push(".");T.push(W)}return T.join("")}function L5($){let T=[],W=[...$.issues].sort((U,X)=>U.path.length-X.path.length);for(let U of W)if(T.push(`\u2716 ${U.message}`),U.path?.length)T.push(` \u2192 at ${FV(U.path)}`);return T.join(`
|
|
6
|
-
`)}var Qw=($)=>(T,W,U,X)=>{let Y=U?Object.assign(U,{async:!1}):{async:!1},w=T._zod.run({value:W,issues:[]},Y);if(w instanceof Promise)throw new Z0;if(w.issues.length){let G=new(X?.Err??$)(w.issues.map((H)=>s6(H,Y,N4())));throw Error.captureStackTrace(G,X?.callee),G}return w.value},Zw=Qw(W2),Dw=($)=>async(T,W,U,X)=>{let Y=U?Object.assign(U,{async:!0}):{async:!0},w=T._zod.run({value:W,issues:[]},Y);if(w instanceof Promise)w=await w;if(w.issues.length){let G=new(X?.Err??$)(w.issues.map((H)=>s6(H,Y,N4())));throw Error.captureStackTrace(G,X?.callee),G}return w.value},Vw=Dw(W2),Kw=($)=>(T,W,U)=>{let X=U?{...U,async:!1}:{async:!1},Y=T._zod.run({value:W,issues:[]},X);if(Y instanceof Promise)throw new Z0;return Y.issues.length?{success:!1,error:new($??aU)(Y.issues.map((w)=>s6(w,X,N4())))}:{success:!0,data:Y.value}},J5=Kw(W2),Ew=($)=>async(T,W,U)=>{let X=U?Object.assign(U,{async:!0}):{async:!0},Y=T._zod.run({value:W,issues:[]},X);if(Y instanceof Promise)Y=await Y;return Y.issues.length?{success:!1,error:new $(Y.issues.map((w)=>s6(w,X,N4())))}:{success:!0,data:Y.value}},_5=Ew(W2);var tT={};wT(tT,{xid:()=>q5,uuid7:()=>lP,uuid6:()=>oP,uuid4:()=>dP,uuid:()=>iT,uppercase:()=>t5,unicodeEmail:()=>iP,undefined:()=>n5,ulid:()=>v5,time:()=>m5,string:()=>u5,rfc5322Email:()=>nP,number:()=>o5,null:()=>r5,nanoid:()=>C5,lowercase:()=>i5,ksuid:()=>P5,ipv6:()=>Mw,ipv4:()=>Aw,ip:()=>sP,integer:()=>d5,html5Email:()=>rP,hostname:()=>y5,guid:()=>j5,extendedDuration:()=>pP,emoji:()=>x5,email:()=>B5,e164:()=>h5,duration:()=>S5,domain:()=>eP,datetime:()=>c5,date:()=>g5,cuid2:()=>k5,cuid:()=>R5,cidrv6:()=>b5,cidrv4:()=>I5,browserEmail:()=>tP,boolean:()=>l5,bigint:()=>p5,base64url:()=>Nw,base64:()=>f5,_emoji:()=>aP});var R5=/^[cC][^\s-]{8,}$/,k5=/^[0-9a-z]+$/,v5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,q5=/^[0-9a-vA-V]{20}$/,P5=/^[A-Za-z0-9]{27}$/,C5=/^[a-zA-Z0-9_-]{21}$/,S5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pP=/^[-+]?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)?)??$/,j5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,iT=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},dP=iT(4),oP=iT(6),lP=iT(7),B5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,nP=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,iP=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,tP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,aP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function x5(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var Aw=/^(?:(?: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])$/,Mw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,I5=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,b5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sP=new RegExp(`(${Aw.source})|(${Mw.source})`),f5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Nw=/^[A-Za-z0-9_-]*$/,y5=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,eP=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,h5=/^\+(?:[0-9]){6,14}[0-9]$/,OV="((\\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])))",g5=new RegExp(`^${OV}$`);function QV($){let T="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if($.precision)T=`${T}\\.\\d{${$.precision}}`;else if($.precision==null)T=`${T}(\\.\\d+)?`;return T}function m5($){return new RegExp(`^${QV($)}$`)}function c5($){let T=`${OV}T${QV($)}`,W=[];if(W.push($.local?"Z?":"Z"),$.offset)W.push("([+-]\\d{2}:?\\d{2})");return T=`${T}(${W.join("|")})`,new RegExp(`^${T}$`)}var u5=($)=>{let T=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${T}$`)},p5=/^\d+n?$/,d5=/^\d+$/,o5=/^-?\d+(?:\.\d+)?/i,l5=/true|false/i,r5=/null/i;var n5=/undefined/i;var i5=/^[^A-Z]*$/,t5=/^[^a-z]*$/;var G4=k("$ZodCheck",($,T)=>{var W;$._zod??($._zod={}),$._zod.def=T,(W=$._zod).onattach??(W.onattach=[])}),DV={number:"number",bigint:"bigint",object:"date"},Lw=k("$ZodCheckLessThan",($,T)=>{G4.init($,T);let W=DV[typeof T.value];$._zod.onattach.push((U)=>{let X=U._zod.bag,Y=(T.inclusive?X.maximum:X.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(T.value<Y)if(T.inclusive)X.maximum=T.value;else X.exclusiveMaximum=T.value}),$._zod.check=(U)=>{if(T.inclusive?U.value<=T.value:U.value<T.value)return;U.issues.push({origin:W,code:"too_big",maximum:T.value,input:U.value,inclusive:T.inclusive,inst:$,continue:!T.abort})}}),Jw=k("$ZodCheckGreaterThan",($,T)=>{G4.init($,T);let W=DV[typeof T.value];$._zod.onattach.push((U)=>{let X=U._zod.bag,Y=(T.inclusive?X.minimum:X.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(T.value>Y)if(T.inclusive)X.minimum=T.value;else X.exclusiveMinimum=T.value}),$._zod.check=(U)=>{if(T.inclusive?U.value>=T.value:U.value>T.value)return;U.issues.push({origin:W,code:"too_small",minimum:T.value,input:U.value,inclusive:T.inclusive,inst:$,continue:!T.abort})}}),a5=k("$ZodCheckMultipleOf",($,T)=>{G4.init($,T),$._zod.onattach.push((W)=>{var U;(U=W._zod.bag).multipleOf??(U.multipleOf=T.value)}),$._zod.check=(W)=>{if(typeof W.value!==typeof T.value)throw new Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%T.value===BigInt(0):Q5(W.value,T.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:T.value,input:W.value,inst:$,continue:!T.abort})}}),s5=k("$ZodCheckNumberFormat",($,T)=>{G4.init($,T),T.format=T.format||"float64";let W=T.format?.includes("int"),U=W?"int":"number",[X,Y]=E5[T.format];$._zod.onattach.push((w)=>{let G=w._zod.bag;if(G.format=T.format,G.minimum=X,G.maximum=Y,W)G.pattern=d5}),$._zod.check=(w)=>{let G=w.value;if(W){if(!Number.isInteger(G)){w.issues.push({expected:U,format:T.format,code:"invalid_type",input:G,inst:$});return}if(!Number.isSafeInteger(G)){if(G>0)w.issues.push({input:G,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:U,continue:!T.abort});else w.issues.push({input:G,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:U,continue:!T.abort});return}}if(G<X)w.issues.push({origin:"number",input:G,code:"too_small",minimum:X,inclusive:!0,inst:$,continue:!T.abort});if(G>Y)w.issues.push({origin:"number",input:G,code:"too_big",maximum:Y,inst:$})}}),e5=k("$ZodCheckBigIntFormat",($,T)=>{G4.init($,T);let[W,U]=A5[T.format];$._zod.onattach.push((X)=>{let Y=X._zod.bag;Y.format=T.format,Y.minimum=W,Y.maximum=U}),$._zod.check=(X)=>{let Y=X.value;if(Y<W)X.issues.push({origin:"bigint",input:Y,code:"too_small",minimum:W,inclusive:!0,inst:$,continue:!T.abort});if(Y>U)X.issues.push({origin:"bigint",input:Y,code:"too_big",maximum:U,inst:$})}}),$7=k("$ZodCheckMaxSize",($,T)=>{G4.init($,T),$._zod.when=(W)=>{let U=W.value;return!QT(U)&&U.size!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(T.maximum<U)W._zod.bag.maximum=T.maximum}),$._zod.check=(W)=>{let U=W.value;if(U.size<=T.maximum)return;W.issues.push({origin:iU(U),code:"too_big",maximum:T.maximum,input:U,inst:$,continue:!T.abort})}}),T7=k("$ZodCheckMinSize",($,T)=>{G4.init($,T),$._zod.when=(W)=>{let U=W.value;return!QT(U)&&U.size!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(T.minimum>U)W._zod.bag.minimum=T.minimum}),$._zod.check=(W)=>{let U=W.value;if(U.size>=T.minimum)return;W.issues.push({origin:iU(U),code:"too_small",minimum:T.minimum,input:U,inst:$,continue:!T.abort})}}),W7=k("$ZodCheckSizeEquals",($,T)=>{G4.init($,T),$._zod.when=(W)=>{let U=W.value;return!QT(U)&&U.size!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag;U.minimum=T.size,U.maximum=T.size,U.size=T.size}),$._zod.check=(W)=>{let U=W.value,X=U.size;if(X===T.size)return;let Y=X>T.size;W.issues.push({origin:iU(U),...Y?{code:"too_big",maximum:T.size}:{code:"too_small",minimum:T.size},input:W.value,inst:$,continue:!T.abort})}}),U7=k("$ZodCheckMaxLength",($,T)=>{G4.init($,T),$._zod.when=(W)=>{let U=W.value;return!QT(U)&&U.length!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(T.maximum<U)W._zod.bag.maximum=T.maximum}),$._zod.check=(W)=>{let U=W.value;if(U.length<=T.maximum)return;let Y=tU(U);W.issues.push({origin:Y,code:"too_big",maximum:T.maximum,input:U,inst:$,continue:!T.abort})}}),X7=k("$ZodCheckMinLength",($,T)=>{G4.init($,T),$._zod.when=(W)=>{let U=W.value;return!QT(U)&&U.length!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(T.minimum>U)W._zod.bag.minimum=T.minimum}),$._zod.check=(W)=>{let U=W.value;if(U.length>=T.minimum)return;let Y=tU(U);W.issues.push({origin:Y,code:"too_small",minimum:T.minimum,input:U,inst:$,continue:!T.abort})}}),Y7=k("$ZodCheckLengthEquals",($,T)=>{G4.init($,T),$._zod.when=(W)=>{let U=W.value;return!QT(U)&&U.length!==void 0},$._zod.onattach.push((W)=>{let U=W._zod.bag;U.minimum=T.length,U.maximum=T.length,U.length=T.length}),$._zod.check=(W)=>{let U=W.value,X=U.length;if(X===T.length)return;let Y=tU(U),w=X>T.length;W.issues.push({origin:Y,...w?{code:"too_big",maximum:T.length}:{code:"too_small",minimum:T.length},input:W.value,inst:$,continue:!T.abort})}}),U2=k("$ZodCheckStringFormat",($,T)=>{var W;G4.init($,T),$._zod.onattach.push((U)=>{let X=U._zod.bag;if(X.format=T.format,T.pattern)X.patterns??(X.patterns=new Set),X.patterns.add(T.pattern)}),(W=$._zod).check??(W.check=(U)=>{if(!T.pattern)throw new Error("Not implemented.");if(T.pattern.lastIndex=0,T.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:T.format,input:U.value,...T.pattern?{pattern:T.pattern.toString()}:{},inst:$,continue:!T.abort})})}),w7=k("$ZodCheckRegex",($,T)=>{U2.init($,T),$._zod.check=(W)=>{if(T.pattern.lastIndex=0,T.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:T.pattern.toString(),inst:$,continue:!T.abort})}}),G7=k("$ZodCheckLowerCase",($,T)=>{T.pattern??(T.pattern=i5),U2.init($,T)}),z7=k("$ZodCheckUpperCase",($,T)=>{T.pattern??(T.pattern=t5),U2.init($,T)}),H7=k("$ZodCheckIncludes",($,T)=>{G4.init($,T);let W=new RegExp(D0(T.includes));T.pattern=W,$._zod.onattach.push((U)=>{let X=U._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),$._zod.check=(U)=>{if(U.value.includes(T.includes,T.position))return;U.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:T.includes,input:U.value,inst:$,continue:!T.abort})}}),F7=k("$ZodCheckStartsWith",($,T)=>{G4.init($,T);let W=new RegExp(`^${D0(T.prefix)}.*`);T.pattern??(T.pattern=W),$._zod.onattach.push((U)=>{let X=U._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),$._zod.check=(U)=>{if(U.value.startsWith(T.prefix))return;U.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:T.prefix,input:U.value,inst:$,continue:!T.abort})}}),O7=k("$ZodCheckEndsWith",($,T)=>{G4.init($,T);let W=new RegExp(`.*${D0(T.suffix)}$`);T.pattern??(T.pattern=W),$._zod.onattach.push((U)=>{let X=U._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),$._zod.check=(U)=>{if(U.value.endsWith(T.suffix))return;U.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:T.suffix,input:U.value,inst:$,continue:!T.abort})}});function ZV($,T,W){if($.issues.length)T.issues.push(...S6(W,$.issues))}var Q7=k("$ZodCheckProperty",($,T)=>{G4.init($,T),$._zod.check=(W)=>{let U=T.schema._zod.run({value:W.value[T.property],issues:[]},{});if(U instanceof Promise)return U.then((X)=>ZV(X,W,T.property));ZV(U,W,T.property);return}}),Z7=k("$ZodCheckMimeType",($,T)=>{G4.init($,T);let W=new Set(T.mime);$._zod.onattach.push((U)=>{U._zod.bag.mime=T.mime}),$._zod.check=(U)=>{if(W.has(U.value.type))return;U.issues.push({code:"invalid_value",values:T.mime,input:U.value.type,path:["type"],inst:$})}}),D7=k("$ZodCheckOverwrite",($,T)=>{G4.init($,T),$._zod.check=(W)=>{W.value=T.tx(W.value)}});class _w{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let W=$.split(`
|
|
7
|
-
`).filter((
|
|
8
|
-
`))}}var
|
|
9
|
-
if (${
|
|
10
|
-
if (input[${
|
|
11
|
-
if (${
|
|
12
|
-
newResult[${
|
|
3
|
+
var Uq=Object.create;var{getPrototypeOf:Yq,defineProperty:Iz,getOwnPropertyNames:Gq}=Object;var zq=Object.prototype.hasOwnProperty;var Hq=($,T,W)=>{W=$!=null?Uq(Yq($)):{};let w=T||!$||!$.__esModule?Iz(W,"default",{value:$,enumerable:!0}):W;for(let X of Gq($))if(!zq.call(w,X))Iz(w,X,{get:()=>$[X],enumerable:!0});return w};var Fq=($,T)=>()=>(T||$((T={exports:{}}).exports,T),T.exports);var e0=($,T)=>{for(var W in T)Iz($,W,{get:T[W],enumerable:!0,configurable:!0,set:(w)=>T[W]=()=>w})};var gy=($,T)=>()=>($&&(T=$($=0)),T);var FV=import.meta.require;var WA=Fq((Sp,TA)=>{var O8=FV("os"),Q8=FV("path");function $A($){let T=process.env.XDG_CACHE_HOME||Q8.join(O8.homedir(),".cache");return Q8.join(T,$)}function FS($){return Q8.join(O8.homedir(),"Library","Caches",$)}function OS($){let T=process.env.LOCALAPPDATA||Q8.join(O8.homedir(),"AppData","Local");return Q8.join(T,$,"Cache")}var QS=function(){switch(O8.platform()){case"darwin":return FS;case"win32":return OS;case"aix":case"android":case"freebsd":case"linux":case"netbsd":case"openbsd":case"sunos":return $A;default:return console.error(`(node:${process.pid}) [cachedir] Warning: the platform "${O8.platform()}" is not currently supported by node-cachedir, falling back to "posix". Please file an issue with your platform here: https://github.com/LinusU/node-cachedir/issues/new`),$A}}();TA.exports=function $(T){if(typeof T!=="string")throw new TypeError("id is not a string");if(T.length===0)throw new Error("id cannot be empty");if(/[^0-9a-zA-Z-]/.test(T))throw new Error("id cannot contain special characters");return QS(T)}});class DX extends Promise{fate;resolve;reject;done=!1;constructor($){let T,W;super((w,X)=>{T=w,W=X});this.resolve=T,this.reject=W,this.use($ instanceof Promise?$:new Promise($))}pass($,T){if($===this.fate)this.resolve(T),this.done=!0}fail($,T){if($===this.fate)this.reject(T),this.done=!0}use($){if($ instanceof Promise){let T=$;this.fate=T,T.then((W)=>{this.pass(T,W)},(W)=>{this.fail(T,W)})}else this.resolve($),this.fate=void 0}}var py=($,T,W=QV.STORE)=>{return OV(W,{key:`${$.key}:JSON`,get:({get:w})=>T.toJson(w($)),set:({set:w},X)=>{w($,T.fromJson(X))}})};function ly($,T,W){return Bz($,{key:`${T.key}:JSON`,get:(X)=>({get:U})=>{let Y=U(T,X);return W.toJson(Y)},set:(X)=>({set:U},Y)=>{U(T,X,W.fromJson(Y))}},["mutable","json"])}var NX=($)=>JSON.parse($),G6=($)=>JSON.stringify($),ny=[Array.prototype,Boolean.prototype,Number.prototype,Object.prototype,String.prototype];function Q$($){while($.child!==null)$=$.child;return $}class aU{_buffer;_index=0;constructor($){let T;if(typeof $==="number")T=$;else T=$.length;this._buffer=Array.from({length:T})}get buffer(){return this._buffer}get index(){return this._index}add($){this._buffer[this._index]=$,this._index=(this._index+1)%this._buffer.length}copy(){let $=new aU([...this._buffer]);return $._index=this._index,$}}var Oq={atom_family:"atom",molecule_family:"molecule",mutable_atom_family:"mutable_atom",readonly_held_selector_family:"readonly_held_selector",readonly_pure_selector_family:"readonly_pure_selector",writable_held_selector_family:"writable_held_selector",writable_pure_selector_family:"writable_pure_selector"};function ZV($,T){let W=G6(T),w=`${$.key}(${W})`,X=Oq[$.type],U={key:w,type:X};return Object.assign(U,{family:{key:$.key,subKey:W}}),Object.assign(U,{counterfeit:!0}),U}function LX($){let T={key:$.key,type:$.type};if("family"in $)T.family=$.family;return T}var xz=($)=>(T,W,w,X,...U)=>{console[$](`${T} ${W} "${w}" ${X}`,...U)},Qq={error:xz("error"),info:xz("info"),warn:xz("warn")};class fz{logLevel;filter;logger;constructor($,T,W=Qq){this.logLevel=$,this.filter=T,this.logger=W}error=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel!==null){if(T===!0)this.logger.error(...$);else if(T!==!1)this.logger.error(...T)}};info=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel==="info"){if(T===!0)this.logger.info(...$);else if(T!==!1)this.logger.info(...T)}};warn=(...$)=>{let T=this.filter?.(...$)??!0;if(this.logLevel!=="error"&&this.logLevel!==null){if(T===!0)this.logger.warn(...$);else if(T!==!1)this.logger.warn(...T)}}}class d1{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=($,T)=>`${$}:${T}`;warn;getRelatedKeys($){return this.relations.get($)}addRelation($,T){let W=this.relations.get($),w=this.relations.get(T);if(W)W.add(T);else W=new Set([T]),this.relations.set($,W);if(w)w.add($);else w=new Set([$]),this.relations.set(T,w)}deleteRelation($,T){let W=this.relations.get($);if(W){if(W.delete(T),W.size===0)this.relations.delete($);let w=this.relations.get(T);if(w){if(w.delete($),w.size===0)this.relations.delete(T)}}}replaceRelationsUnsafely($,T){this.relations.set($,new Set(T));for(let W of T){let w=new Set().add($);this.relations.set(W,w)}}replaceRelationsSafely($,T){let W=this.relations.get($),w=this.isAType?.($)?$:void 0,X=w===void 0?$:void 0;if(W)for(let U of W){w??=U,X??=U;let Y=this.relations.get(U);if(Y){if(Y.size===1)this.relations.delete(U);else Y.delete($);this.contents.delete(this.makeContentKey(w,X))}}this.relations.set($,new Set(T));for(let U of T){let Y=this.relations.get(U);if(Y)Y.add($);else Y=new Set().add($),this.relations.set(U,Y)}}getContentInternal($){return this.contents.get($)}setContent($,T){this.contents.set($,T)}deleteContent($){this.contents.delete($)}constructor($,T){if(this.a=$.between[0],this.b=$.between[1],this.cardinality=$.cardinality,!T?.externalStore)this.relations=new Map($.relations?.map(([W,w])=>[W,new Set(w)])),this.contents=new Map($.contents);if(this.isAType=T?.isAType??null,this.isBType=T?.isBType??null,this.isContent=T?.isContent??null,T?.makeContentKey)this.makeContentKey=T.makeContentKey;if(T?.externalStore){let W=T.externalStore;if(this.has=(w,X)=>W.has(w,X),this.addRelation=(w,X)=>{W.addRelation(w,X)},this.deleteRelation=(w,X)=>{W.deleteRelation(w,X)},this.replaceRelationsSafely=(w,X)=>{W.replaceRelationsSafely(w,X)},this.replaceRelationsUnsafely=(w,X)=>{W.replaceRelationsUnsafely(w,X)},this.getRelatedKeys=(w)=>W.getRelatedKeys(w),W.getContent)this.getContentInternal=(w)=>{return W.getContent(w)},this.setContent=(w,X)=>{W.setContent(w,X)},this.deleteContent=(w)=>{W.deleteContent(w)};for(let[w,X]of $.relations??[]){let U=this.isAType?.(w)?w:void 0,Y=U===void 0?w:void 0;for(let G of X)U??=G,Y??=G,this.addRelation(U,Y)}for(let[w,X]of $.contents??[])this.setContent(w,X)}if(T?.warn)this.warn=T.warn}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([$,T])=>[$,[...T]]),contents:[...this.contents.entries()]}}set(...$){let T,W,w;switch($.length){case 1:{let X=$[0];T=X[this.a],W=X[this.b],w=void 0;break}case 2:{let X=$[0];if(typeof X==="string")[T,W]=$;else T=X[this.a],W=X[this.b],w=$[1];break}default:{T=$[0],W=$[1],w=$[2];break}}switch(this.cardinality){case"1:1":{let X=this.getRelatedKey(T);if(X&&X!==W)this.delete(T,X)}case"1:n":{let X=this.getRelatedKey(W);if(X&&X!==T)this.delete(X,W)}break;case"n:n":}if(w){let X=this.makeContentKey(T,W);this.setContent(X,w)}return this.addRelation(T,W),this}delete($,T){T=typeof T==="string"?T:$[this.b];let W=typeof $==="string"?$:$[this.a];if(W===void 0&&typeof T==="string"){let w=this.getRelatedKeys(T);if(w)for(let X of w)this.delete(X,T)}if(typeof W==="string"&&T===void 0){let w=this.getRelatedKeys(W);if(w)for(let X of w)this.delete(W,X)}if(typeof W==="string"&&typeof T==="string"){this.deleteRelation(W,T);let w=this.makeContentKey(W,T);this.deleteContent(w)}return this}getRelatedKey($){let T=this.getRelatedKeys($);if(T){if(T.size>1)this.warn?.(`${T.size} related keys were found for key "${$}": (${[...T].map((w)=>`"${w}"`).join(", ")}). Only one related key was expected.`);let W;for(let w of T){W=w;break}return W}}replaceRelations($,T,W){let w=!Array.isArray(T),X=w?Object.keys(T):T;if(W?.reckless)this.replaceRelationsUnsafely($,X);else this.replaceRelationsSafely($,X);if(w)for(let U of X){let Y=this.makeContentKey($,U),G=T[U];this.setContent(Y,G)}return this}getContent($,T){let W=this.makeContentKey($,T);return this.getContentInternal(W)}getRelationEntries($){let T=$[this.a],W=$[this.b];if(T!==void 0&&W===void 0){let w=this.getRelatedKeys(T);if(w)return[...w].map((X)=>{return[X,this.getContent(T,X)]})}if(T===void 0&&W!==void 0){let w=this.getRelatedKeys(W);if(w)return[...w].map((X)=>{return[X,this.getContent(X,W)]})}return[]}has($,T){if(T)return this.getRelatedKeys($)?.has(T)??!1;return this.relations.has($)}}class b${Subscriber;subscribers=new Map;subscribe($,T){return this.subscribers.set($,T),()=>{this.unsubscribe($)}}unsubscribe($){this.subscribers.delete($)}next($){let T=this.subscribers.values();for(let W of T)W($)}}class bz extends b${state;constructor($){super();this.state=$}next($){this.state=$,super.next($)}}function $T($){return"epoch"in $.transactionMeta}function i6($){return"phase"in $.transactionMeta}function VV($){return $[0].toUpperCase()+$.slice(1)}function sU($){return $.type.split("_").map(VV).join(" ")}class JX extends Error{constructor($,T){super(`${sU($)} ${G6($.key)} not found in store "${T.config.name}".`)}}var mW=($)=>(T)=>$ instanceof Function?$(T):$;var TT=($,T)=>{if($.valueMap.has(T.key))return $.logger.info("\uD83D\uDCD6",T.type,T.key,"reading cached value"),KV(T,$);switch(T.type){case"readonly_held_selector":case"readonly_pure_selector":case"writable_held_selector":case"writable_pure_selector":return $.logger.info("\uD83E\uDDEE",T.type,T.key,"computing value"),T.get();case"atom":case"mutable_atom":{let W=T.default,w;if(W instanceof Function)w=W();else w=W;return $.logger.info("\uD83D\uDC81","atom",T.key,"could not find cached value; using default",w),w}}};var AV=($,T)=>{if($.operation.open){let W=performance.now();return $.logger.info("\u2757",T.type,T.key,`deferring setState at T-${W} until setState for "${$.operation.token.key}" is done`),W}$.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:T},$.logger.info("\u2B55",T.type,T.key,`operation start in store "${$.config.name}"${!i6($)?"":` ${$.transactionMeta.phase} "${$.transactionMeta.update.key}"`}`)},EV=($)=>{if($.operation.open)$.logger.info("\uD83D\uDD34",$.operation.token.type,$.operation.token.key,`operation done in store "${$.config.name}"`);$.operation={open:!1},$.on.operationClose.next($.operation)},MV=($,T)=>{if(!$.operation.open)return $.logger.error("\uD83D\uDC1E","unknown",T,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0;return $.operation.done.has(T)},WT=($,T)=>{if(!$.operation.open){$.logger.error("\uD83D\uDC1E","unknown",T,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}$.operation.done.add(T)};var DV=($,T,W)=>{switch(T.type){case"mutable_atom":$.logger.info("\uD83D\uDCE2",T.type,T.key,"is now (",W.newValue,") subscribers:",T.subject.subscribers);break;case"atom":case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.logger.info("\uD83D\uDCE2",T.type,T.key,"went (",W.oldValue,"->",W.newValue,") subscribers:",T.subject.subscribers)}T.subject.next(W)};var yz=($,T)=>{let W=Q$($),w=W.selectorAtoms.getRelatedKeys(T.key);if(W.logger.info("\uD83E\uDDF9",T.type,T.key,w?`evicting ${w.size} states downstream:`:"no downstream states",w??"to evict"),w){if(W.operation.open)W.logger.info("\uD83E\uDDF9",T.type,T.key,`[ ${[...W.operation.done].join(", ")} ] already done`);for(let X of w){if(MV(W,X))continue;NV(X,W),WT(W,X)}}};var LV=($,T,W)=>{let w=TT($,T),X=w;if(T.type==="mutable_atom"&&i6($)){let{parent:Y}=$;X=RX($,T,Y)}if(X=mW(W)(X),$.logger.info("\uD83D\uDCDD","atom",T.key,"set to",X),X=z6($,T.key,X,T.subject),RV($,T.key))_V($,T.key);WT($,T.key),yz($,T);let U={oldValue:w,newValue:X};if(!i6($)){DV($,T,U);return}if($.on.transactionApplying.state===null){let{key:Y}=T;if(JV(U.newValue))return;let G={type:"atom_update",key:Y,...U};if(T.family)G.family=T.family;$.transactionMeta.update.updates.push(G),$.logger.info("\uD83D\uDCC1","atom",Y,"stowed (",U.oldValue,"->",U.newValue,")")}else if(T.key.startsWith("*")){let Y=T.key.slice(1),G=$.atoms.get(Y),H=$.valueMap.get(Y);if(G.type==="mutable_atom"&&i6($)){let{parent:F}=$;H=RX($,G,F)}if(H.do(U.newValue)===null)yz($,G)}};var eU=($,T,W)=>{switch(T.type){case"atom":case"mutable_atom":LV($,T,W);break;case"writable_pure_selector":case"writable_held_selector":T.set(W);break}};var $Y=($,T)=>Q$($).atoms.has(T),Zq=($,T)=>Q$($).writableSelectors.has(T),Vq=($,T)=>Q$($).readonlySelectors.has(T),kV=($,T)=>$Y($,T)||Zq($,T)||Vq($,T);var TY=($,T)=>{return Q$($).selectorGraph.getRelationEntries({downstreamSelectorKey:T}).filter(([w,{source:X}])=>X!==T).map(([w,{source:X}])=>X).filter((w)=>kV($,w))};var hz=($,T,W)=>{let w=[],X=TY($,T);while(X.length>0){let U=X.shift();if(W.has(U))continue;if(W.add(U),!$Y($,U))X.push(...TY($,U));else if(!w.includes(U))w.push(U)}return w},vV=($,T)=>{let W=$.key,w=TY(T,W),X=new Set;return w.flatMap((U)=>$Y(T,U)?U:hz(T,U,X))};var qV=($,T,W,w,X)=>{let U=Q$($),{type:Y,key:G}=w;if(Y==="atom"||Y==="mutable_atom")U.selectorAtoms.set({selectorKey:W,atomKey:G}),$.logger.info("\uD83D\uDD0D",T,W,`discovers root atom "${G}"`);else{let H=hz($,G,X);$.logger.info("\uD83D\uDD0D",T,W,`discovers root atoms: [ ${H.map((z)=>`"${z}"`).join(", ")} ]`);for(let z of H)U.selectorAtoms=U.selectorAtoms.set({selectorKey:W,atomKey:z})}X.add(G)};var XT=($,T,W,w)=>({get:(...X)=>{let U=Q$($),Y;if(X.length===2){let[F,O]=X;Y=t6($,F,O)}else[Y]=X;let G=j6($,Y),H=TT($,G),z=Y.key;return $.logger.info("\uD83D\uDD0C",T,W,`registers dependency ( "${z}" =`,H,")"),U.selectorGraph.set({upstreamSelectorKey:z,downstreamSelectorKey:W},{source:Y.key}),qV($,T,W,Y,w),H},set:(...X)=>{let U,Y;if(X.length===2)U=X[0],Y=X[1];else{let z=X[0],F=X[1];Y=X[2],U=t6($,z,F)}let G=Q$($),H=j6(G,U);eU(G,H,Y)},find:(...X)=>t6($,...X),json:(X)=>cW($,X)});var gz=($,T,W)=>{let w=Q$($),X=new b$,U=new Set,{key:Y,const:G}=T,H="readonly_held_selector",{get:z,find:F,json:O}=XT(w,"readonly_held_selector",Y,U),Z={...T,type:"readonly_held_selector",subject:X,install:(E)=>gz(E,T,W),get:()=>{return T.get({get:z,find:F,json:O},G),z6(Q$($),Y,G,X),U.clear(),G},...W&&{family:W}};w.readonlySelectors.set(Y,Z),$.logger.info("\u2728","readonly_held_selector",Y,"=",G);let K={key:Y,type:"readonly_held_selector"};if(W)K.family=W;return K};var mz=($,T,W)=>{let w=Q$($),X=new b$,U=new Set,Y=T.key,G="readonly_pure_selector",{get:H,find:z,json:F}=XT(w,"readonly_pure_selector",Y,U),O=()=>{let E=T.get({get:H,find:z,json:F});return z6(Q$($),Y,E,X),U.clear(),E},Q={...T,type:"readonly_pure_selector",subject:X,install:(E)=>mz(E,T,W),get:O,...W&&{family:W}};w.readonlySelectors.set(Y,Q);let Z=O();$.logger.info("\u2728","readonly_pure_selector",Y,"=",Z);let K={key:Y,type:"readonly_pure_selector"};if(W)K.family=W;return K};var cz=($,T,W)=>{let w=Q$($),X=new b$,U=new Set,{key:Y,const:G}=T,H="writable_held_selector",z=XT(w,"writable_held_selector",Y,U),{find:F,get:O,json:Q}=z,Z={find:F,get:O,json:Q},K=(_=T.get,S=Q$($))=>{return _(Z,G),z6(S,Y,G,X),U.clear(),G},M={...T,type:"writable_held_selector",subject:X,install:(_)=>cz(_,T,W),get:K,set:(_)=>{let S=Q$($),x=K(T.get,S),b=mW(_)(x);if($.logger.info("\uD83D\uDCDD","writable_held_selector",Y,"set (",x,"->",b,")"),z6(S,Y,b,X),WT(S,Y),$T(S))X.next({newValue:b,oldValue:x});T.set(z,b)},...W&&{family:W}};w.writableSelectors.set(Y,M);let L=K();$.logger.info("\u2728","writable_held_selector",Y,"=",L);let R={key:Y,type:"writable_held_selector"};if(W)R.family=W;return R};var _X=($,T,W)=>{let w=Q$($),X=new b$,U=new Set,Y=T.key,G="writable_pure_selector",H=XT(w,"writable_pure_selector",Y,U),{find:z,get:F,json:O}=H,Q={find:z,get:F,json:O},Z=(R=T.get,_=Q$($))=>{let S=R(Q);return z6(_,Y,S,X),U.clear(),S},E={...T,type:"writable_pure_selector",subject:X,install:(R)=>_X(R,T,W),get:Z,set:(R)=>{let _=Q$($),S=Z(T.get,_),x=mW(R)(S);if($.logger.info("\uD83D\uDCDD","writable_pure_selector",Y,"set (",S,"->",x,")"),z6(_,T.key,x,X),WT(_,T.key),$T(_))X.next({newValue:x,oldValue:S});T.set(H,x)},...W&&{family:W}};w.writableSelectors.set(Y,E);let M=Z();$.logger.info("\u2728",E.type,E.key,"=",M);let L={key:Y,type:"writable_pure_selector"};if(W)L.family=W;return L};function OV($,T){let W="set"in T,w="const"in T;if(w&&W){let U=cz($,T,void 0);return $.on.selectorCreation.next(U),U}if(w){let U=gz($,T,void 0);return $.on.selectorCreation.next(U),U}if(W){let U=_X($,T,void 0);return $.on.selectorCreation.next(U),U}let X=mz($,T,void 0);return $.on.selectorCreation.next(X),X}function Bz($,T,W){let w=T.key,X="writable_pure_selector_family",U={key:w,type:"writable_pure_selector_family"},Y=$.families.get(w);if(Y)$.logger.error("\u2757","writable_pure_selector_family",w,`Overwriting an existing ${sU(Y)} "${Y.key}" in store "${$.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);let G=new b$,z=Object.assign((F)=>{let O=G6(F),Q={key:w,subKey:O},Z=`${w}(${O})`,K=Q$($),E=_X(K,{key:Z,get:T.get(F),set:T.set(F)},Q);return G.next({type:"state_creation",token:E}),E},U,{internalRoles:W,subject:G,install:(F)=>Bz(F,T),default:(F)=>{return T.get(F)({get:(...Q)=>kX($,...Q),find:(...Q)=>t6($,...Q),json:(Q)=>cW($,Q)})}});return $.families.set(w,z),U}function PV($,T,W){let w=$.families.get(T.key);if(w===void 0)throw new JX(T,$);let X=w(W),U=Q$($);if(X.family){if($T(U))switch(X.type){case"atom":case"mutable_atom":$.on.atomCreation.next(X);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":$.on.selectorCreation.next(X);break}else if(i6(U)&&U.on.transactionApplying.state===null)U.transactionMeta.update.updates.push({type:"state_creation",token:X})}return X}function CV($,T,W){let w=G6(W),X=`${T.key}(${w})`,U=Q$($),Y;switch(T.type){case"atom_family":case"mutable_atom_family":Y=U.atoms.get(X);break;case"writable_held_selector_family":case"writable_pure_selector_family":Y=U.writableSelectors.get(X);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":Y=U.readonlySelectors.get(X);break}if(Y)return LX(Y);return Y}function t6($,T,W){let w=CV($,T,W);if(w)return w;let X=G6(W),U=$.molecules.get(X);if(!U&&$.config.lifespan==="immortal"){let Y=ZV(T,W);return $.logger.error("\u274C",Y.type,Y.key,`was not found in store "${$.config.name}"; returned a counterfeit token.`),Y}if(w=PV($,T,W),U)Q$($).moleculeData.set(X,T.key);return w}function SV($,T){if(T.family){let W=$.families.get(T.family.key);if(W)return W}}function wT($,...T){let W,w,X,U;if(T.length===2){if(W=T[0],U=T[1],w=SV($,W)??null,w)X=W.family?NX(W.family.subKey):null,W=t6($,w,X)}else w=T[0],X=T[1],U=T[2],W=t6($,w,X);if("counterfeit"in W&&"family"in W){let H=W.family.subKey,z=$.disposalTraces.buffer.find((F)=>F?.key===H);$.logger.error("\u274C",W.type,W.key,`could not be set because it was not found in the store "${$.config.name}".`,z?`This state was previously disposed:
|
|
4
|
+
${z.trace}`:"No previous disposal trace was found.");return}let Y=AV($,W);if(Y){let H=$.on.operationClose.subscribe(`waiting to set "${W.key}" at T-${Y}`,()=>{H(),$.logger.info("\uD83D\uDFE2",W.type,W.key,`resuming deferred setState from T-${Y}`),wT($,W,U)});return}let G=j6($,W);eU($,G,U),EV($)}function kX($,...T){let W,w,X;if(T.length===1)W=T[0];else w=T[0],X=T[1],W=t6($,w,X);if("counterfeit"in W&&"family"in W){w=$.families.get(W.family.key);let U=W.family.subKey,Y=$.disposalTraces.buffer.find((G)=>G?.key===U);switch($.logger.error("\u274C",W.type,W.key,`could not be retrieved because it was not found in the store "${$.config.name}".`,Y?`This state was previously disposed:
|
|
5
|
+
${Y.trace}`:"No previous disposal trace was found."),w.type){case"atom_family":case"mutable_atom_family":return $.defaults.get(w.key);case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if($.defaults.has(w.key))return $.defaults.get(W.family.key);let G=j6($,w).default(U);return $.defaults.set(w.key,G),G}}}return TT($,j6($,W))}class jV{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new d1({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new d1({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new d1({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new d1({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new aU(100);molecules=new Map;moleculeJoins=new d1({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeGraph=new d1({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});moleculeData=new d1({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...$)=>$.sort().join(":")});miscResources=new Map;on={atomCreation:new b$,atomDisposal:new b$,selectorCreation:new b$,selectorDisposal:new b$,timelineCreation:new b$,transactionCreation:new b$,transactionApplying:new bz(null),operationClose:new b$,moleculeCreation:new b$,moleculeDisposal:new b$};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new fz("warn",($,T,W)=>!BV(W))];logger={error:(...$)=>{for(let T of this.loggers)T.error(...$)},info:(...$)=>{for(let T of this.loggers)T.info(...$)},warn:(...$)=>{for(let T of this.loggers)T.warn(...$)}};constructor($,T=null){if(this.config={...T?.config,...$},T!==null){if(this.valueMap=new Map(T?.valueMap),this.operation={...T?.operation},$T(T))this.transactionMeta={epoch:new Map(T?.transactionMeta.epoch),actionContinuities:new d1(T?.transactionMeta.actionContinuities.toJSON())};for(let[,w]of T.families){if(w.internalRoles?.includes("mutable")||w.internalRoles?.includes("join"))continue;w.install(this)}let W=new Set;for(let[,w]of T.atoms){if(W.has(w.key))continue;if(w.install(this),w.type==="mutable_atom"){let X=cW(T,w),U=IV(w);W.add(X.key),W.add(U.key)}}for(let[,w]of T.readonlySelectors)w.install(this);for(let[,w]of T.writableSelectors){if(W.has(w.key))continue;w.install(this)}for(let[,w]of T.transactions)w.install(this);for(let[,w]of T.timelines)w.install(this)}}}var QV={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new jV({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function j6($,T){let W,w=$;while(w!==null){switch(T.type){case"atom":case"mutable_atom":W=w.atoms.get(T.key);break;case"writable_pure_selector":case"writable_held_selector":W=w.writableSelectors.get(T.key);break;case"readonly_pure_selector":case"readonly_held_selector":W=w.readonlySelectors.get(T.key);break;case"atom_family":case"mutable_atom_family":case"writable_pure_selector_family":case"readonly_pure_selector_family":case"writable_held_selector_family":case"readonly_held_selector_family":W=w.families.get(T.key);break;case"timeline":W=w.timelines.get(T.key);break;case"transaction":W=w.transactions.get(T.key);break}if(W)return W;w=w.child}throw new JX(T,$)}var xV=($,T)=>{let W=Q$($);if(W.operation.open)return W.operation.prev.get(T.key);return W.valueMap.get(T.key)};var uz=($,T)=>{let W=Q$($);return vV(T,$).map((X)=>{let U=W.atoms.get(X);if(U===void 0)throw new Error(`Atom "${X}", a dependency of selector "${T.key}", not found in store "${$.config.name}".`);return U.subject.subscribe(`${T.type}:${T.key}`,(Y)=>{$.logger.info("\uD83D\uDCE2",T.type,T.key,"root",X,"went",Y.oldValue,"->",Y.newValue);let G=xV(W,T),H=TT(W,T);$.logger.info("\u2728",T.type,T.key,"went",G,"->",H),T.subject.next({newValue:H,oldValue:G})})})};function vX($,T,W,w){function X(O){if($.operation.open){let Q=$.on.operationClose.subscribe(`state subscription ${W}`,()=>{Q(),w(O)})}else w(O)}let U=j6($,T);$.logger.info("\uD83D\uDC40",U.type,U.key,`Adding subscription "${W}"`);let Y=U.type==="writable_pure_selector"||U.type==="readonly_pure_selector",G=null,H=X;if(Y)G=uz($,U),H=(O)=>{if(G)G.length=0,G.push(...uz($,U));X(O)};let z=U.subject.subscribe(W,H);return()=>{if($.logger.info("\uD83D\uDE48",U.type,U.key,`Removing subscription "${W}"`),z(),G)for(let O of G)O()}}var fV=($,T,W,w)=>{let X=j6($,T);$.logger.info("\uD83D\uDC40","timeline",T.key,`Adding subscription "${W}"`);let U=X.subject.subscribe(W,w);return()=>{$.logger.info("\uD83D\uDE48","timeline",T.key,`Removing subscription "${W}" from timeline`),U()}};class pz{initializeState($,T){let W=`*${$.key}`;T.atoms.delete(W),T.valueMap.delete(W);let w=$.family?{key:`*${$.family.key}`,subKey:$.family.subKey}:void 0,X=dz(T,{key:W,default:null},w);if(T.parent?.valueMap.has(W)){let U=T.parent.valueMap.get(W);T.valueMap.set(W,U)}return X}unsubscribeFromInnerValue;unsubscribeFromState;observeCore($,T,W){let w=`tracker:${W.config.name}:${i6(W)?W.transactionMeta.update.key:"main"}:${$.key}`,X=kX(W,$);this.unsubscribeFromInnerValue=X.subscribe(w,(U)=>{wT(W,T,U)}),this.unsubscribeFromState=vX(W,$,w,(U)=>{if(U.newValue!==U.oldValue)this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=U.newValue.subscribe(w,(Y)=>{wT(W,T,Y)})})}updateCore($,T,W){let w=`tracker:${W.config.name}:${i6(W)?W.transactionMeta.update.key:"main"}:${$.key}`;vX(W,T,w,({newValue:X,oldValue:U})=>{let Y=W.timelineTopics.getRelatedKey(T.key);if(Y){if(W.timelines.get(Y)?.timeTraveling){let z=fV(W,{key:Y,type:"timeline"},w,(F)=>{z(),wT(W,$,(O)=>{if(F==="redo"&&X)O.do(X);else if(F==="undo"&&U)O.undo(U);return O})});return}}let G=W.on.operationClose.subscribe(w,()=>{G();let H=kX(W,$),z=X===null?-1:H.getUpdateNumber(X),F=z-H.cacheUpdateNumber;if(X&&F===1)wT(W,$,(O)=>(O.do(X),O));else W.logger.info("\u274C","mutable_atom",$.key,`could not be updated. Expected update number ${H.cacheUpdateNumber+1}, but got ${z}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor($,T){this.mutableState=$;let W=Q$(T);this.latestUpdateState=this.initializeState($,W),this.observeCore($,this.latestUpdateState,W),this.updateCore($,this.latestUpdateState,W),W.trackers.set($.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),W.trackers.delete($.key)}}}var cW=($,T)=>{if(T.family){let w=Q$($),U={key:`${T.family.key}:JSON`,type:"writable_pure_selector_family"},Y=j6(w,U),G=JSON.parse(T.family.subKey);return t6($,Y,G)}return{type:"writable_pure_selector",key:`${T.key}:JSON`}};var IV=($)=>{let W={type:"atom",key:`*${$.key}`};if($.family)W.family={key:`*${$.family.key}`,subKey:$.family.subKey};return W};function JV($){return typeof $==="object"&&$!==null&&"do"in $&&"undo"in $&&"subscribe"in $}function RX($,T,W){let w=W.valueMap.get(T.key),X=$.valueMap.get(T.key);if(w!==X)return X;if(w===void 0)return T.default();W.logger.info("\uD83D\uDCC3","atom",T.key,"copying");let U=T.toJson(w),Y=T.fromJson(U);return $.valueMap.set(T.key,Y),new pz(T,W),Y}function z6($,T,W,w){let X=$.valueMap.get(T);if(X instanceof DX)X.use(W);if(W instanceof Promise){let U=new DX(W);return $.valueMap.set(T,U),U.then((Y)=>{z6($,T,Y,w),w.next({newValue:Y,oldValue:U})}).catch((Y)=>{$.logger.error("\uD83D\uDCA5","state",T,"rejected:",Y)}),U}return $.valueMap.set(T,W),W}var KV=($,T)=>{let W=T.valueMap.get($.key);if($.type==="mutable_atom"&&i6(T)){let{parent:w}=T;W=RX(T,$,w)}return W},NV=($,T)=>{let W=T.valueMap.get($);if(W instanceof DX){let w=W,X=T.writableSelectors.get($)??T.readonlySelectors.get($);if(X)w.use(X.get());return}if(T.operation.open)T.operation.prev.set($,W);T.valueMap.delete($),T.logger.info("\uD83D\uDDD1","state",$,"evicted")};var RV=($,T)=>{return Q$($).atomsThatAreDefault.has(T)},bV=($,T)=>{let W=Q$($);W.atomsThatAreDefault=new Set(W.atomsThatAreDefault).add(T)},_V=($,T)=>{let W=Q$($);W.atomsThatAreDefault=new Set(Q$($).atomsThatAreDefault),W.atomsThatAreDefault.delete(T)};function dz($,T,W){let{key:X,default:U}=T;$.logger.info("\uD83D\uDD28","atom",X,`creating in store "${$.config.name}"`);let Y=Q$($),G=Y.atoms.get(X);if(G&&G.type==="atom")return $.logger.error("\u274C","atom",X,"Tried to create atom, but it already exists in the store."),LX(G);let H=new b$,z={...T,type:"atom",install:(Q)=>{return Q.logger.info("\uD83D\uDEE0\uFE0F","atom",X,`installing in store "${Q.config.name}"`),dz(Q,T,W)},subject:H};if(W)z.family=W;let F=U;if(U instanceof Function)F=U();Y.atoms.set(X,z),bV($,X),z6(Y,X,F,H);let O=LX(z);if(T.effects){let Q=0,Z=[];for(let K of T.effects){let E=K({setSelf:(M)=>{wT($,O,M)},onSet:(M)=>vX($,O,`effect[${Q}]`,M)});if(E)Z.push(E);++Q}z.cleanup=()=>{for(let K of Z)K()}}return O}class uW extends Set{mode="record";subject=new b$;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor($,T=0){super($);if($ instanceof uW)this.parent=$,this.cacheUpdateNumber=$.cacheUpdateNumber;if(T)this.cacheLimit=T,this.cache=new Array(T),this.subscribe("auto cache",(W)=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=W})}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON($){let T=new uW($.members,$.cacheLimit);return T.cache=$.cache,T.cacheIdx=$.cacheIdx,T.cacheUpdateNumber=$.cacheUpdateNumber,T}add($){let T=super.add($);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`add:${G6($)}`);return T}clear(){let $=this.mode==="record"?[...this]:null;if(super.clear(),$)this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify($)}`)}delete($){let T=super.delete($);if(this.mode==="record")this.cacheUpdateNumber++,this.emit(`del:${G6($)}`);return T}parent=null;child=null;transactionUpdates=null;transaction($){this.mode="transaction",this.transactionUpdates=[],this.child=new uW(this);let T=this.child._subscribe("transaction",(W)=>{this.transactionUpdates?.push(W)});try{if($(this.child)){for(let w of this.transactionUpdates)this.doStep(w);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(W){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",W),W}finally{T(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe($,T){return this.subject.subscribe($,T)}subscribe($,T){return this.subject.subscribe($,(W)=>{T(`${this.cacheUpdateNumber}=${W}`)})}emit($){this.subject.next($)}doStep($){let T=$.indexOf(":"),W=$.substring(0,T),w=$.substring(T+1);switch(W){case"add":this.add(JSON.parse(w));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(w));break;case"tx":for(let X of w.split(";"))this.doStep(X)}}getUpdateNumber($){let T=$.indexOf("=");return Number($.substring(0,T))}do($){let T=$.indexOf("="),W=Number($.substring(0,T)),w=W-this.cacheUpdateNumber;if(w>0){if(w===1){this.mode="playback";let U=$.substring(T+1);return this.doStep(U),this.mode="record",this.cacheUpdateNumber=W,null}return this.cacheUpdateNumber+1}if(Math.abs(w)<this.cacheLimit){let U=this.cacheIdx+w;if(this.cache[U]===$)return null;this.mode="playback";let G=!1;while(!G){this.cacheIdx%=this.cacheLimit;let z=this.cache[this.cacheIdx];if(this.cacheIdx--,!z)return"OUT_OF_RANGE";this.undo(z),G=this.cacheIdx===U-1}let H=$.substring(T+1);return this.doStep(H),this.mode="record",this.cacheUpdateNumber=W,null}return"OUT_OF_RANGE"}undoStep($){let T=$.indexOf(":"),W=$.substring(0,T),w=$.substring(T+1);switch(W){case"add":this.delete(JSON.parse(w));break;case"del":this.add(JSON.parse(w));break;case"clear":{let X=JSON.parse(w);for(let U of X)this.add(U);break}case"tx":{let X=w.split(";");for(let U=X.length-1;U>=0;U--)this.undoStep(X[U])}}}undo($){let T=$.indexOf("=");if(Number($.substring(0,T))===this.cacheUpdateNumber){this.mode="playback";let w=$.substring(T+1);return this.undoStep(w),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}}function BV($){return $.startsWith("\uD83D\uDD0D ")}class WY{listeners;globalListeners;handleEvent($,...T){for(let w of this.globalListeners)w($,...T);let W=this.listeners.get($);if(W)for(let w of W)w(...T)}id="no_id_retrieved";emit;constructor($){this.emit=$,this.listeners=new Map,this.globalListeners=new Set}on($,T){let W=this.listeners.get($);if(W)W.add(T);else this.listeners.set($,new Set([T]));return this}onAny($){return this.globalListeners.add($),this}off($,T){let W=this.listeners.get($);if(W)if(T)W.delete(T);else this.listeners.delete($);return this}offAny($){return this.globalListeners.delete($),this}}class yV extends WY{in;out;id="no_id_retrieved";disposalFunctions=[];constructor($){super((...T)=>{return this.out.next(T),this});this.id=$,this.in=new b$,this.out=new b$,this.in.subscribe("socket",(T)=>{this.handleEvent(...T)})}dispose(){for(let $ of this.disposalFunctions)$()}}class oz extends WY{incompleteData="";unprocessedEvents=[];relays;relayServices;process;id="#####";log(...$){this.process.stderr.write(G6($.map((T)=>T instanceof uW?`{ ${T.toJSON().members.join(" | ")} }`:T))+"\x03")}logger={info:(...$)=>{this.log("i",...$)},warn:(...$)=>{this.log("w",...$)},error:(...$)=>{this.log("e",...$)}};constructor(){super(($,...T)=>{let W=JSON.stringify([$,...T]);return this.process.stdout.write(W+"\x03"),this});if(this.process=process,this.process.stdin.resume(),this.relays=new Map,this.relayServices=[],this.process.stdin.on("data",($)=>{let T=$.toString();this.unprocessedEvents.push(...T.split("\x03"));let W=this.unprocessedEvents.shift();this.incompleteData+=W??"";try{let w=NX(this.incompleteData);this.logger.info("\uD83C\uDFB0","received",w),this.handleEvent(...w);while(this.unprocessedEvents.length>0){let X=this.unprocessedEvents.shift();if(X){if(this.unprocessedEvents.length===0)this.incompleteData=X;let U=NX(X);this.handleEvent(...U)}}this.incompleteData=""}catch(w){if(w instanceof Error)this.logger.error("\u2757",w.message,w.cause,w.stack)}}),this.on("exit",()=>{this.logger.info("\uD83D\uDD25",this.id,'received "exit"'),process.exit(0)}),process.on("exit",($)=>{this.logger.info("\uD83D\uDD25",this.id,`exited with code ${$}`)}),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",($)=>{this.logger.info("\uD83D\uDC64","user",$,"joined");let T=new yV(`user:${$}`);this.relays.set($,T),this.logger.info("\uD83D\uDD17","attaching services:",`[${[...this.relayServices.keys()].join(", ")}]`);for(let W of this.relayServices){let w=W(T);if(w)T.disposalFunctions.push(w)}this.on(`user:${$}`,(...W)=>{T.in.next(W)}),T.out.subscribe("socket",(W)=>{this.emit(...W)})}),this.on("user-leaves",($)=>{let T=this.relays.get($);if(this.off(`relay:${$}`),T)T.dispose(),this.relays.delete($)}),process.stdout.write("ALIVE")}relay($){this.logger.info("\uD83D\uDD17","running relay method"),this.relayServices.push($)}}var UG={};e0(UG,{xid:()=>OC,void:()=>jC,uuidv7:()=>wC,uuidv6:()=>XC,uuidv4:()=>WC,uuid:()=>TC,url:()=>UC,uppercase:()=>tX,unknown:()=>iY,union:()=>XG,undefined:()=>CC,ulid:()=>FC,uint64:()=>qC,uint32:()=>_C,tuple:()=>hC,trim:()=>W8,treeifyError:()=>X5,transform:()=>YF,toUpperCase:()=>w8,toLowerCase:()=>X8,toJSONSchema:()=>vH,templateLiteral:()=>rC,symbol:()=>PC,superRefine:()=>aK,success:()=>oC,stringbool:()=>aC,string:()=>fH,strictObject:()=>fC,startsWith:()=>sX,size:()=>rX,setErrorMap:()=>XS,set:()=>cC,safeParseAsync:()=>xH,safeParse:()=>BH,registry:()=>NY,regexes:()=>dT,regex:()=>nX,refine:()=>tK,record:()=>kK,readonly:()=>dK,property:()=>NH,promise:()=>nC,prettifyError:()=>w5,preprocess:()=>eC,prefault:()=>yK,positive:()=>AH,pipe:()=>sY,partialRecord:()=>gC,parseAsync:()=>IH,parse:()=>jH,overwrite:()=>K0,optional:()=>tY,object:()=>xC,number:()=>OK,nullish:()=>dC,nullable:()=>aY,null:()=>AK,normalize:()=>T8,nonpositive:()=>MH,nonoptional:()=>hK,nonnegative:()=>DH,never:()=>$G,negative:()=>EH,nativeEnum:()=>uC,nanoid:()=>GC,nan:()=>lC,multipleOf:()=>lT,minSize:()=>rT,minLength:()=>GT,mime:()=>$8,maxSize:()=>lW,maxLength:()=>rW,map:()=>mC,lte:()=>V1,lt:()=>Z0,lowercase:()=>iX,looseObject:()=>bC,locales:()=>dX,literal:()=>SK,length:()=>nW,lazy:()=>rK,ksuid:()=>QC,keyof:()=>BC,jwt:()=>NC,json:()=>sC,iso:()=>rY,ipv6:()=>VC,ipv4:()=>ZC,intersection:()=>RK,int64:()=>vC,int32:()=>RC,int:()=>bH,instanceof:()=>tC,includes:()=>aX,guid:()=>$C,gte:()=>B6,gt:()=>V0,globalRegistry:()=>o1,getErrorMap:()=>wS,function:()=>kH,formatError:()=>hX,float64:()=>JC,float32:()=>LC,flattenError:()=>yX,file:()=>pC,enum:()=>PK,endsWith:()=>eX,emoji:()=>YC,email:()=>eP,e164:()=>DC,discriminatedUnion:()=>yC,date:()=>IC,custom:()=>iC,cuid2:()=>HC,cuid:()=>zC,core:()=>A0,config:()=>N4,coerce:()=>FF,clone:()=>a6,cidrv6:()=>AC,cidrv4:()=>KC,check:()=>iK,catch:()=>cK,boolean:()=>QK,bigint:()=>kC,base64url:()=>MC,base64:()=>EC,array:()=>XF,any:()=>SC,_default:()=>fK,_ZodString:()=>yH,ZodXID:()=>oH,ZodVoid:()=>DK,ZodUnknown:()=>WF,ZodUnion:()=>wF,ZodUndefined:()=>VK,ZodUUID:()=>E0,ZodURL:()=>gH,ZodULID:()=>dH,ZodType:()=>k$,ZodTuple:()=>_K,ZodTransform:()=>IK,ZodTemplateLiteral:()=>oK,ZodSymbol:()=>ZK,ZodSuccess:()=>gK,ZodStringFormat:()=>W4,ZodString:()=>eY,ZodSet:()=>qK,ZodRecord:()=>UF,ZodRealError:()=>iW,ZodReadonly:()=>pK,ZodPromise:()=>nK,ZodPrefault:()=>bK,ZodPipe:()=>HF,ZodOptional:()=>GF,ZodObject:()=>WG,ZodNumberFormat:()=>tW,ZodNumber:()=>z8,ZodNullable:()=>BK,ZodNull:()=>KK,ZodNonOptional:()=>zF,ZodNever:()=>MK,ZodNanoID:()=>cH,ZodNaN:()=>uK,ZodMap:()=>vK,ZodLiteral:()=>CK,ZodLazy:()=>lK,ZodKSUID:()=>lH,ZodJWT:()=>$F,ZodIssueCode:()=>$S,ZodIntersection:()=>JK,ZodISOTime:()=>oY,ZodISODuration:()=>lY,ZodISODateTime:()=>pY,ZodISODate:()=>dY,ZodIPv6:()=>nH,ZodIPv4:()=>rH,ZodGUID:()=>nY,ZodFile:()=>jK,ZodError:()=>aP,ZodEnum:()=>G8,ZodEmoji:()=>mH,ZodEmail:()=>hH,ZodE164:()=>eH,ZodDiscriminatedUnion:()=>LK,ZodDefault:()=>xK,ZodDate:()=>TG,ZodCustom:()=>wG,ZodCatch:()=>mK,ZodCUID2:()=>pH,ZodCUID:()=>uH,ZodCIDRv6:()=>tH,ZodCIDRv4:()=>iH,ZodBoolean:()=>H8,ZodBigIntFormat:()=>TF,ZodBigInt:()=>F8,ZodBase64URL:()=>sH,ZodBase64:()=>aH,ZodArray:()=>NK,ZodAny:()=>EK,NEVER:()=>WS,$output:()=>m3,$input:()=>c3,$brand:()=>lz});var A0={};e0(A0,{version:()=>$7,util:()=>l,treeifyError:()=>X5,toJSONSchema:()=>vH,toDotPath:()=>mV,safeParseAsync:()=>Y5,safeParse:()=>U5,registry:()=>NY,regexes:()=>dT,prettifyError:()=>w5,parseAsync:()=>zY,parse:()=>YY,locales:()=>dX,isValidJWT:()=>wK,isValidBase64URL:()=>XK,isValidBase64:()=>L7,globalRegistry:()=>o1,globalConfig:()=>qX,function:()=>kH,formatError:()=>hX,flattenError:()=>yX,config:()=>N4,clone:()=>a6,_xid:()=>IY,_void:()=>QH,_uuidv7:()=>kY,_uuidv6:()=>_Y,_uuidv4:()=>RY,_uuid:()=>JY,_url:()=>vY,_uppercase:()=>tX,_unknown:()=>oW,_union:()=>PP,_undefined:()=>zH,_ulid:()=>jY,_uint64:()=>YH,_uint32:()=>$H,_tuple:()=>LH,_trim:()=>W8,_transform:()=>yP,_toUpperCase:()=>w8,_toLowerCase:()=>X8,_templateLiteral:()=>lP,_symbol:()=>GH,_success:()=>uP,_stringbool:()=>RH,_string:()=>u3,_startsWith:()=>sX,_size:()=>rX,_set:()=>BP,_safeParseAsync:()=>FY,_safeParse:()=>HY,_regex:()=>nX,_refine:()=>iP,_record:()=>jP,_readonly:()=>oP,_property:()=>NH,_promise:()=>nP,_positive:()=>AH,_pipe:()=>dP,_parseAsync:()=>GY,_parse:()=>UY,_overwrite:()=>K0,_optional:()=>hP,_number:()=>n3,_nullable:()=>gP,_null:()=>HH,_normalize:()=>T8,_nonpositive:()=>MH,_nonoptional:()=>cP,_nonnegative:()=>DH,_never:()=>OH,_negative:()=>EH,_nativeEnum:()=>fP,_nanoid:()=>PY,_nan:()=>KH,_multipleOf:()=>lT,_minSize:()=>rT,_minLength:()=>GT,_min:()=>B6,_mime:()=>$8,_maxSize:()=>lW,_maxLength:()=>rW,_max:()=>V1,_map:()=>IP,_lte:()=>V1,_lt:()=>Z0,_lowercase:()=>iX,_literal:()=>bP,_length:()=>nW,_lazy:()=>rP,_ksuid:()=>BY,_jwt:()=>cY,_isoTime:()=>l3,_isoDuration:()=>r3,_isoDateTime:()=>d3,_isoDate:()=>o3,_ipv6:()=>fY,_ipv4:()=>xY,_intersection:()=>SP,_int64:()=>UH,_int32:()=>e3,_int:()=>t3,_includes:()=>aX,_guid:()=>lX,_gte:()=>B6,_gt:()=>V0,_float64:()=>s3,_float32:()=>a3,_file:()=>JH,_enum:()=>xP,_endsWith:()=>eX,_emoji:()=>qY,_email:()=>LY,_e164:()=>mY,_discriminatedUnion:()=>CP,_default:()=>mP,_date:()=>ZH,_custom:()=>Y8,_cuid2:()=>SY,_cuid:()=>CY,_coercedString:()=>p3,_coercedNumber:()=>i3,_coercedDate:()=>VH,_coercedBoolean:()=>WH,_coercedBigint:()=>wH,_cidrv6:()=>yY,_cidrv4:()=>bY,_catch:()=>pP,_boolean:()=>TH,_bigint:()=>XH,_base64url:()=>gY,_base64:()=>hY,_array:()=>U8,_any:()=>FH,JSONSchemaGenerator:()=>uY,JSONSchema:()=>zK,Doc:()=>VY,$output:()=>m3,$input:()=>c3,$constructor:()=>k,$brand:()=>lz,$ZodXID:()=>O7,$ZodVoid:()=>B7,$ZodUnknown:()=>YT,$ZodUnion:()=>DY,$ZodUndefined:()=>C7,$ZodUUID:()=>X7,$ZodURL:()=>U7,$ZodULID:()=>F7,$ZodType:()=>K$,$ZodTuple:()=>oT,$ZodTransform:()=>d7,$ZodTemplateLiteral:()=>$3,$ZodSymbol:()=>P7,$ZodSuccess:()=>t7,$ZodStringFormat:()=>r$,$ZodString:()=>gX,$ZodSet:()=>m7,$ZodRegistry:()=>oX,$ZodRecord:()=>h7,$ZodRealError:()=>pW,$ZodReadonly:()=>e7,$ZodPromise:()=>T3,$ZodPrefault:()=>n7,$ZodPipe:()=>uX,$ZodOptional:()=>o7,$ZodObject:()=>f7,$ZodNumberFormat:()=>v7,$ZodNumber:()=>EY,$ZodNullable:()=>l7,$ZodNull:()=>S7,$ZodNonOptional:()=>i7,$ZodNever:()=>I7,$ZodNanoID:()=>G7,$ZodNaN:()=>s7,$ZodMap:()=>g7,$ZodLiteral:()=>u7,$ZodLazy:()=>W3,$ZodKSUID:()=>Q7,$ZodJWT:()=>k7,$ZodIntersection:()=>y7,$ZodISOTime:()=>K7,$ZodISODuration:()=>A7,$ZodISODateTime:()=>Z7,$ZodISODate:()=>V7,$ZodIPv6:()=>M7,$ZodIPv4:()=>E7,$ZodGUID:()=>W7,$ZodFunction:()=>_H,$ZodFile:()=>p7,$ZodError:()=>bX,$ZodEnum:()=>c7,$ZodEmoji:()=>Y7,$ZodEmail:()=>w7,$ZodE164:()=>_7,$ZodDiscriminatedUnion:()=>b7,$ZodDefault:()=>r7,$ZodDate:()=>x7,$ZodCustom:()=>X3,$ZodCheckUpperCase:()=>r5,$ZodCheckStringFormat:()=>dW,$ZodCheckStartsWith:()=>i5,$ZodCheckSizeEquals:()=>c5,$ZodCheckRegex:()=>o5,$ZodCheckProperty:()=>a5,$ZodCheckOverwrite:()=>e5,$ZodCheckNumberFormat:()=>y5,$ZodCheckMultipleOf:()=>b5,$ZodCheckMinSize:()=>m5,$ZodCheckMinLength:()=>p5,$ZodCheckMimeType:()=>s5,$ZodCheckMaxSize:()=>g5,$ZodCheckMaxLength:()=>u5,$ZodCheckLowerCase:()=>l5,$ZodCheckLessThan:()=>QY,$ZodCheckLengthEquals:()=>d5,$ZodCheckIncludes:()=>n5,$ZodCheckGreaterThan:()=>ZY,$ZodCheckEndsWith:()=>t5,$ZodCheckBigIntFormat:()=>h5,$ZodCheck:()=>z4,$ZodCatch:()=>a7,$ZodCUID2:()=>H7,$ZodCUID:()=>z7,$ZodCIDRv6:()=>N7,$ZodCIDRv4:()=>D7,$ZodBoolean:()=>mX,$ZodBigIntFormat:()=>q7,$ZodBigInt:()=>MY,$ZodBase64URL:()=>R7,$ZodBase64:()=>J7,$ZodAsyncError:()=>O0,$ZodArray:()=>cX,$ZodAny:()=>j7});function k($,T,W){function w(G,H){var z;Object.defineProperty(G,"_zod",{value:G._zod??{},enumerable:!1}),(z=G._zod).traits??(z.traits=new Set),G._zod.traits.add($),T(G,H);for(let F in Y.prototype)Object.defineProperty(G,F,{value:Y.prototype[F].bind(G)});G._zod.constr=Y,G._zod.def=H}let X=W?.Parent??Object;class U extends X{}Object.defineProperty(U,"name",{value:$});function Y(G){var H;let z=W?.Parent?new U:this;w(z,G),(H=z._zod).deferred??(H.deferred=[]);for(let F of z._zod.deferred)F();return z}return Object.defineProperty(Y,"init",{value:w}),Object.defineProperty(Y,Symbol.hasInstance,{value:(G)=>{if(W?.Parent&&G instanceof W.Parent)return!0;return G?._zod?.traits?.has($)}}),Object.defineProperty(Y,"name",{value:$}),Y}var lz=Symbol("zod_brand");class O0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var qX={};function N4($){if($)Object.assign(qX,$);return qX}var l={};e0(l,{unwrapMessage:()=>PX,stringifyPrimitive:()=>i,required:()=>Sq,randomString:()=>XY,propertyKeyTypes:()=>BX,promiseAllObject:()=>Lq,primitiveTypes:()=>sz,prefixIssues:()=>I6,pick:()=>kq,partial:()=>Cq,optionalKeys:()=>ez,omit:()=>vq,numKeys:()=>Jq,nullish:()=>UT,normalizeParams:()=>p,merge:()=>Pq,jsonStringifyReplacer:()=>nz,joinValues:()=>f,issue:()=>W5,isPlainObject:()=>IX,isObject:()=>wY,getSizableOrigin:()=>xX,getParsedType:()=>Rq,getLengthableOrigin:()=>fX,getEnumValues:()=>CX,getElementAtPath:()=>Nq,floatSafeRemainder:()=>iz,finalizeIssue:()=>s6,extend:()=>qq,escapeRegex:()=>Q0,esc:()=>cT,defineLazy:()=>c$,createTransparentProxy:()=>_q,clone:()=>a6,cleanRegex:()=>jX,cleanEnum:()=>jq,cached:()=>SX,assignProp:()=>tz,assertNotEqual:()=>Aq,assertNever:()=>Mq,assertIs:()=>Eq,assertEqual:()=>Kq,assert:()=>Dq,allowsEval:()=>az,aborted:()=>uT,NUMBER_FORMAT_RANGES:()=>$5,Class:()=>hV,BIGINT_FORMAT_RANGES:()=>T5});function Kq($){return $}function Aq($){return $}function Eq($){}function Mq($){throw new Error}function Dq($){}function CX($){let T=Object.values($).filter((w)=>typeof w==="number");return Object.entries($).filter(([w,X])=>T.indexOf(+w)===-1).map(([w,X])=>X)}function f($,T="|"){return $.map((W)=>i(W)).join(T)}function nz($,T){if(typeof T==="bigint")return T.toString();return T}function SX($){return{get value(){{let W=$();return Object.defineProperty(this,"value",{value:W}),W}throw new Error("cached value already set")}}}function UT($){return $===null||$===void 0}function jX($){let T=$.startsWith("^")?1:0,W=$.endsWith("$")?$.length-1:$.length;return $.slice(T,W)}function iz($,T){let W=($.toString().split(".")[1]||"").length,w=(T.toString().split(".")[1]||"").length,X=W>w?W:w,U=Number.parseInt($.toFixed(X).replace(".","")),Y=Number.parseInt(T.toFixed(X).replace(".",""));return U%Y/10**X}function c$($,T,W){Object.defineProperty($,T,{get(){{let X=W();return $[T]=X,X}throw new Error("cached value already set")},set(X){Object.defineProperty($,T,{value:X})},configurable:!0})}function tz($,T,W){Object.defineProperty($,T,{value:W,writable:!0,enumerable:!0,configurable:!0})}function Nq($,T){if(!T)return $;return T.reduce((W,w)=>W?.[w],$)}function Lq($){let T=Object.keys($),W=T.map((w)=>$[w]);return Promise.all(W).then((w)=>{let X={};for(let U=0;U<T.length;U++)X[T[U]]=w[U];return X})}function XY($=10){let W="";for(let w=0;w<$;w++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function cT($){return JSON.stringify($)}function wY($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var az=SX(()=>{try{return new Function(""),!0}catch($){return!1}});function IX($){return typeof $==="object"&&$!==null&&(Object.getPrototypeOf($)===Object.prototype||Object.getPrototypeOf($)===null)}function Jq($){let T=0;for(let W in $)if(Object.prototype.hasOwnProperty.call($,W))T++;return T}var Rq=($)=>{let T=typeof $;switch(T){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map!=="undefined"&&$ instanceof Map)return"map";if(typeof Set!=="undefined"&&$ instanceof Set)return"set";if(typeof Date!=="undefined"&&$ instanceof Date)return"date";if(typeof File!=="undefined"&&$ instanceof File)return"file";return"object";default:throw new Error(`Unknown data type: ${T}`)}},BX=new Set(["string","number","symbol"]),sz=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Q0($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a6($,T,W){let w=new $._zod.constr(T??$._zod.def);if(!T||W?.parent)w._zod.parent=$;return w}function p($){let T=$;if(!T)return{};if(typeof T==="string")return{error:()=>T};if(T?.message!==void 0){if(T?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");T.error=T.message}if(delete T.message,typeof T.error==="string")return{...T,error:()=>T.error};return T}function _q($){let T;return new Proxy({},{get(W,w,X){return T??(T=$()),Reflect.get(T,w,X)},set(W,w,X,U){return T??(T=$()),Reflect.set(T,w,X,U)},has(W,w){return T??(T=$()),Reflect.has(T,w)},deleteProperty(W,w){return T??(T=$()),Reflect.deleteProperty(T,w)},ownKeys(W){return T??(T=$()),Reflect.ownKeys(T)},getOwnPropertyDescriptor(W,w){return T??(T=$()),Reflect.getOwnPropertyDescriptor(T,w)},defineProperty(W,w,X){return T??(T=$()),Reflect.defineProperty(T,w,X)}})}function i($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function ez($){return Object.keys($).filter((T)=>{return $[T]._zod.optin==="optional"&&$[T]._zod.optout==="optional"})}var $5={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},T5={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function kq($,T){let W={},w=$._zod.def;for(let X in T){if(!(X in w.shape))throw new Error(`Unrecognized key: "${X}"`);if(!T[X])continue;W[X]=w.shape[X]}return a6($,{...$._zod.def,shape:W,checks:[]})}function vq($,T){let W={...$._zod.def.shape},w=$._zod.def;for(let X in T){if(!(X in w.shape))throw new Error(`Unrecognized key: "${X}"`);if(!T[X])continue;delete W[X]}return a6($,{...$._zod.def,shape:W,checks:[]})}function qq($,T){let W={...$._zod.def,get shape(){let w={...$._zod.def.shape,...T};return tz(this,"shape",w),w},checks:[]};return a6($,W)}function Pq($,T){return a6($,{...$._zod.def,get shape(){let W={...$._zod.def.shape,...T._zod.def.shape};return tz(this,"shape",W),W},catchall:T._zod.def.catchall,checks:[]})}function Cq($,T,W){let w=T._zod.def.shape,X={...w};if(W)for(let U in W){if(!(U in w))throw new Error(`Unrecognized key: "${U}"`);if(!W[U])continue;X[U]=$?new $({type:"optional",innerType:w[U]}):w[U]}else for(let U in w)X[U]=$?new $({type:"optional",innerType:w[U]}):w[U];return a6(T,{...T._zod.def,shape:X,checks:[]})}function Sq($,T,W){let w=T._zod.def.shape,X={...w};if(W)for(let U in W){if(!(U in X))throw new Error(`Unrecognized key: "${U}"`);if(!W[U])continue;X[U]=new $({type:"nonoptional",innerType:w[U]})}else for(let U in w)X[U]=new $({type:"nonoptional",innerType:w[U]});return a6(T,{...T._zod.def,shape:X,checks:[]})}function uT($,T=0){for(let W=T;W<$.issues.length;W++)if($.issues[W].continue!==!0)return!0;return!1}function I6($,T){return T.map((W)=>{var w;return(w=W).path??(w.path=[]),W.path.unshift($),W})}function PX($){return typeof $==="string"?$:$?.message}function s6($,T,W){let w={...$,path:$.path??[]};if(!$.message){let X=PX($.inst?._zod.def?.error?.($))??PX(T?.error?.($))??PX(W.customError?.($))??PX(W.localeError?.($))??"Invalid input";w.message=X}if(delete w.inst,delete w.continue,!T?.reportInput)delete w.input;return w}function xX($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function fX($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function W5(...$){let[T,W,w]=$;if(typeof T==="string")return{message:T,code:"custom",input:W,inst:w};return{...T}}function jq($){return Object.entries($).filter(([T,W])=>{return Number.isNaN(Number.parseInt(T,10))}).map((T)=>T[1])}class hV{constructor(...$){}}var gV=($,T)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:T,enumerable:!1}),Object.defineProperty($,"message",{get(){return JSON.stringify(T,nz,2)},enumerable:!0})},bX=k("$ZodError",gV),pW=k("$ZodError",gV,{Parent:Error});function yX($,T=(W)=>W.message){let W={},w=[];for(let X of $.issues)if(X.path.length>0)W[X.path[0]]=W[X.path[0]]||[],W[X.path[0]].push(T(X));else w.push(T(X));return{formErrors:w,fieldErrors:W}}function hX($,T){let W=T||function(U){return U.message},w={_errors:[]},X=(U)=>{for(let Y of U.issues)if(Y.code==="invalid_union"&&Y.errors.length)Y.errors.map((G)=>X({issues:G}));else if(Y.code==="invalid_key")X({issues:Y.issues});else if(Y.code==="invalid_element")X({issues:Y.issues});else if(Y.path.length===0)w._errors.push(W(Y));else{let G=w,H=0;while(H<Y.path.length){let z=Y.path[H];if(H!==Y.path.length-1)G[z]=G[z]||{_errors:[]};else G[z]=G[z]||{_errors:[]},G[z]._errors.push(W(Y));G=G[z],H++}}};return X($),w}function X5($,T){let W=T||function(U){return U.message},w={errors:[]},X=(U,Y=[])=>{var G,H;for(let z of U.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((F)=>X({issues:F},z.path));else if(z.code==="invalid_key")X({issues:z.issues},z.path);else if(z.code==="invalid_element")X({issues:z.issues},z.path);else{let F=[...Y,...z.path];if(F.length===0){w.errors.push(W(z));continue}let O=w,Q=0;while(Q<F.length){let Z=F[Q],K=Q===F.length-1;if(typeof Z==="string")O.properties??(O.properties={}),(G=O.properties)[Z]??(G[Z]={errors:[]}),O=O.properties[Z];else O.items??(O.items=[]),(H=O.items)[Z]??(H[Z]={errors:[]}),O=O.items[Z];if(K)O.errors.push(W(z));Q++}}};return X($),w}function mV($){let T=[];for(let W of $)if(typeof W==="number")T.push(`[${W}]`);else if(typeof W==="symbol")T.push(`[${JSON.stringify(String(W))}]`);else if(/[^\w$]/.test(W))T.push(`[${JSON.stringify(W)}]`);else{if(T.length)T.push(".");T.push(W)}return T.join("")}function w5($){let T=[],W=[...$.issues].sort((w,X)=>w.path.length-X.path.length);for(let w of W)if(T.push(`\u2716 ${w.message}`),w.path?.length)T.push(` \u2192 at ${mV(w.path)}`);return T.join(`
|
|
6
|
+
`)}var UY=($)=>(T,W,w,X)=>{let U=w?Object.assign(w,{async:!1}):{async:!1},Y=T._zod.run({value:W,issues:[]},U);if(Y instanceof Promise)throw new O0;if(Y.issues.length){let G=new(X?.Err??$)(Y.issues.map((H)=>s6(H,U,N4())));throw Error.captureStackTrace(G,X?.callee),G}return Y.value},YY=UY(pW),GY=($)=>async(T,W,w,X)=>{let U=w?Object.assign(w,{async:!0}):{async:!0},Y=T._zod.run({value:W,issues:[]},U);if(Y instanceof Promise)Y=await Y;if(Y.issues.length){let G=new(X?.Err??$)(Y.issues.map((H)=>s6(H,U,N4())));throw Error.captureStackTrace(G,X?.callee),G}return Y.value},zY=GY(pW),HY=($)=>(T,W,w)=>{let X=w?{...w,async:!1}:{async:!1},U=T._zod.run({value:W,issues:[]},X);if(U instanceof Promise)throw new O0;return U.issues.length?{success:!1,error:new($??bX)(U.issues.map((Y)=>s6(Y,X,N4())))}:{success:!0,data:U.value}},U5=HY(pW),FY=($)=>async(T,W,w)=>{let X=w?Object.assign(w,{async:!0}):{async:!0},U=T._zod.run({value:W,issues:[]},X);if(U instanceof Promise)U=await U;return U.issues.length?{success:!1,error:new $(U.issues.map((Y)=>s6(Y,X,N4())))}:{success:!0,data:U.value}},Y5=FY(pW);var dT={};e0(dT,{xid:()=>F5,uuid7:()=>bq,uuid6:()=>fq,uuid4:()=>xq,uuid:()=>pT,uppercase:()=>f5,unicodeEmail:()=>gq,undefined:()=>B5,ulid:()=>H5,time:()=>k5,string:()=>q5,rfc5322Email:()=>hq,number:()=>S5,null:()=>I5,nanoid:()=>Q5,lowercase:()=>x5,ksuid:()=>O5,ipv6:()=>M5,ipv4:()=>E5,integer:()=>C5,html5Email:()=>yq,hostname:()=>J5,guid:()=>V5,extendedDuration:()=>Bq,emoji:()=>A5,email:()=>K5,e164:()=>R5,duration:()=>Z5,domain:()=>uq,datetime:()=>v5,date:()=>_5,cuid2:()=>z5,cuid:()=>G5,cidrv6:()=>N5,cidrv4:()=>D5,browserEmail:()=>mq,boolean:()=>j5,bigint:()=>P5,base64url:()=>OY,base64:()=>L5,_emoji:()=>cq});var G5=/^[cC][^\s-]{8,}$/,z5=/^[0-9a-z]+$/,H5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,F5=/^[0-9a-vA-V]{20}$/,O5=/^[A-Za-z0-9]{27}$/,Q5=/^[a-zA-Z0-9_-]{21}$/,Z5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Bq=/^[-+]?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)?)??$/,V5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,pT=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},xq=pT(4),fq=pT(6),bq=pT(7),K5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,yq=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,hq=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,gq=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,mq=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,cq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function A5(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var E5=/^(?:(?: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])$/,M5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,D5=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,N5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,L5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,OY=/^[A-Za-z0-9_-]*$/,J5=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,uq=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,R5=/^\+(?:[0-9]){6,14}[0-9]$/,cV="((\\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])))",_5=new RegExp(`^${cV}$`);function uV($){let T="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if($.precision)T=`${T}\\.\\d{${$.precision}}`;else if($.precision==null)T=`${T}(\\.\\d+)?`;return T}function k5($){return new RegExp(`^${uV($)}$`)}function v5($){let T=`${cV}T${uV($)}`,W=[];if(W.push($.local?"Z?":"Z"),$.offset)W.push("([+-]\\d{2}:?\\d{2})");return T=`${T}(${W.join("|")})`,new RegExp(`^${T}$`)}var q5=($)=>{let T=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${T}$`)},P5=/^\d+n?$/,C5=/^\d+$/,S5=/^-?\d+(?:\.\d+)?/i,j5=/true|false/i,I5=/null/i;var B5=/undefined/i;var x5=/^[^A-Z]*$/,f5=/^[^a-z]*$/;var z4=k("$ZodCheck",($,T)=>{var W;$._zod??($._zod={}),$._zod.def=T,(W=$._zod).onattach??(W.onattach=[])}),dV={number:"number",bigint:"bigint",object:"date"},QY=k("$ZodCheckLessThan",($,T)=>{z4.init($,T);let W=dV[typeof T.value];$._zod.onattach.push((w)=>{let X=w._zod.bag,U=(T.inclusive?X.maximum:X.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(T.value<U)if(T.inclusive)X.maximum=T.value;else X.exclusiveMaximum=T.value}),$._zod.check=(w)=>{if(T.inclusive?w.value<=T.value:w.value<T.value)return;w.issues.push({origin:W,code:"too_big",maximum:T.value,input:w.value,inclusive:T.inclusive,inst:$,continue:!T.abort})}}),ZY=k("$ZodCheckGreaterThan",($,T)=>{z4.init($,T);let W=dV[typeof T.value];$._zod.onattach.push((w)=>{let X=w._zod.bag,U=(T.inclusive?X.minimum:X.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(T.value>U)if(T.inclusive)X.minimum=T.value;else X.exclusiveMinimum=T.value}),$._zod.check=(w)=>{if(T.inclusive?w.value>=T.value:w.value>T.value)return;w.issues.push({origin:W,code:"too_small",minimum:T.value,input:w.value,inclusive:T.inclusive,inst:$,continue:!T.abort})}}),b5=k("$ZodCheckMultipleOf",($,T)=>{z4.init($,T),$._zod.onattach.push((W)=>{var w;(w=W._zod.bag).multipleOf??(w.multipleOf=T.value)}),$._zod.check=(W)=>{if(typeof W.value!==typeof T.value)throw new Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%T.value===BigInt(0):iz(W.value,T.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:T.value,input:W.value,inst:$,continue:!T.abort})}}),y5=k("$ZodCheckNumberFormat",($,T)=>{z4.init($,T),T.format=T.format||"float64";let W=T.format?.includes("int"),w=W?"int":"number",[X,U]=$5[T.format];$._zod.onattach.push((Y)=>{let G=Y._zod.bag;if(G.format=T.format,G.minimum=X,G.maximum=U,W)G.pattern=C5}),$._zod.check=(Y)=>{let G=Y.value;if(W){if(!Number.isInteger(G)){Y.issues.push({expected:w,format:T.format,code:"invalid_type",input:G,inst:$});return}if(!Number.isSafeInteger(G)){if(G>0)Y.issues.push({input:G,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:w,continue:!T.abort});else Y.issues.push({input:G,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:w,continue:!T.abort});return}}if(G<X)Y.issues.push({origin:"number",input:G,code:"too_small",minimum:X,inclusive:!0,inst:$,continue:!T.abort});if(G>U)Y.issues.push({origin:"number",input:G,code:"too_big",maximum:U,inst:$})}}),h5=k("$ZodCheckBigIntFormat",($,T)=>{z4.init($,T);let[W,w]=T5[T.format];$._zod.onattach.push((X)=>{let U=X._zod.bag;U.format=T.format,U.minimum=W,U.maximum=w}),$._zod.check=(X)=>{let U=X.value;if(U<W)X.issues.push({origin:"bigint",input:U,code:"too_small",minimum:W,inclusive:!0,inst:$,continue:!T.abort});if(U>w)X.issues.push({origin:"bigint",input:U,code:"too_big",maximum:w,inst:$})}}),g5=k("$ZodCheckMaxSize",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let w=W.value;return!UT(w)&&w.size!==void 0},$._zod.onattach.push((W)=>{let w=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(T.maximum<w)W._zod.bag.maximum=T.maximum}),$._zod.check=(W)=>{let w=W.value;if(w.size<=T.maximum)return;W.issues.push({origin:xX(w),code:"too_big",maximum:T.maximum,input:w,inst:$,continue:!T.abort})}}),m5=k("$ZodCheckMinSize",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let w=W.value;return!UT(w)&&w.size!==void 0},$._zod.onattach.push((W)=>{let w=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(T.minimum>w)W._zod.bag.minimum=T.minimum}),$._zod.check=(W)=>{let w=W.value;if(w.size>=T.minimum)return;W.issues.push({origin:xX(w),code:"too_small",minimum:T.minimum,input:w,inst:$,continue:!T.abort})}}),c5=k("$ZodCheckSizeEquals",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let w=W.value;return!UT(w)&&w.size!==void 0},$._zod.onattach.push((W)=>{let w=W._zod.bag;w.minimum=T.size,w.maximum=T.size,w.size=T.size}),$._zod.check=(W)=>{let w=W.value,X=w.size;if(X===T.size)return;let U=X>T.size;W.issues.push({origin:xX(w),...U?{code:"too_big",maximum:T.size}:{code:"too_small",minimum:T.size},input:W.value,inst:$,continue:!T.abort})}}),u5=k("$ZodCheckMaxLength",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let w=W.value;return!UT(w)&&w.length!==void 0},$._zod.onattach.push((W)=>{let w=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(T.maximum<w)W._zod.bag.maximum=T.maximum}),$._zod.check=(W)=>{let w=W.value;if(w.length<=T.maximum)return;let U=fX(w);W.issues.push({origin:U,code:"too_big",maximum:T.maximum,input:w,inst:$,continue:!T.abort})}}),p5=k("$ZodCheckMinLength",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let w=W.value;return!UT(w)&&w.length!==void 0},$._zod.onattach.push((W)=>{let w=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(T.minimum>w)W._zod.bag.minimum=T.minimum}),$._zod.check=(W)=>{let w=W.value;if(w.length>=T.minimum)return;let U=fX(w);W.issues.push({origin:U,code:"too_small",minimum:T.minimum,input:w,inst:$,continue:!T.abort})}}),d5=k("$ZodCheckLengthEquals",($,T)=>{z4.init($,T),$._zod.when=(W)=>{let w=W.value;return!UT(w)&&w.length!==void 0},$._zod.onattach.push((W)=>{let w=W._zod.bag;w.minimum=T.length,w.maximum=T.length,w.length=T.length}),$._zod.check=(W)=>{let w=W.value,X=w.length;if(X===T.length)return;let U=fX(w),Y=X>T.length;W.issues.push({origin:U,...Y?{code:"too_big",maximum:T.length}:{code:"too_small",minimum:T.length},input:W.value,inst:$,continue:!T.abort})}}),dW=k("$ZodCheckStringFormat",($,T)=>{var W;z4.init($,T),$._zod.onattach.push((w)=>{let X=w._zod.bag;if(X.format=T.format,T.pattern)X.patterns??(X.patterns=new Set),X.patterns.add(T.pattern)}),(W=$._zod).check??(W.check=(w)=>{if(!T.pattern)throw new Error("Not implemented.");if(T.pattern.lastIndex=0,T.pattern.test(w.value))return;w.issues.push({origin:"string",code:"invalid_format",format:T.format,input:w.value,...T.pattern?{pattern:T.pattern.toString()}:{},inst:$,continue:!T.abort})})}),o5=k("$ZodCheckRegex",($,T)=>{dW.init($,T),$._zod.check=(W)=>{if(T.pattern.lastIndex=0,T.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:T.pattern.toString(),inst:$,continue:!T.abort})}}),l5=k("$ZodCheckLowerCase",($,T)=>{T.pattern??(T.pattern=x5),dW.init($,T)}),r5=k("$ZodCheckUpperCase",($,T)=>{T.pattern??(T.pattern=f5),dW.init($,T)}),n5=k("$ZodCheckIncludes",($,T)=>{z4.init($,T);let W=new RegExp(Q0(T.includes));T.pattern=W,$._zod.onattach.push((w)=>{let X=w._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),$._zod.check=(w)=>{if(w.value.includes(T.includes,T.position))return;w.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:T.includes,input:w.value,inst:$,continue:!T.abort})}}),i5=k("$ZodCheckStartsWith",($,T)=>{z4.init($,T);let W=new RegExp(`^${Q0(T.prefix)}.*`);T.pattern??(T.pattern=W),$._zod.onattach.push((w)=>{let X=w._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),$._zod.check=(w)=>{if(w.value.startsWith(T.prefix))return;w.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:T.prefix,input:w.value,inst:$,continue:!T.abort})}}),t5=k("$ZodCheckEndsWith",($,T)=>{z4.init($,T);let W=new RegExp(`.*${Q0(T.suffix)}$`);T.pattern??(T.pattern=W),$._zod.onattach.push((w)=>{let X=w._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),$._zod.check=(w)=>{if(w.value.endsWith(T.suffix))return;w.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:T.suffix,input:w.value,inst:$,continue:!T.abort})}});function pV($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues))}var a5=k("$ZodCheckProperty",($,T)=>{z4.init($,T),$._zod.check=(W)=>{let w=T.schema._zod.run({value:W.value[T.property],issues:[]},{});if(w instanceof Promise)return w.then((X)=>pV(X,W,T.property));pV(w,W,T.property);return}}),s5=k("$ZodCheckMimeType",($,T)=>{z4.init($,T);let W=new Set(T.mime);$._zod.onattach.push((w)=>{w._zod.bag.mime=T.mime}),$._zod.check=(w)=>{if(W.has(w.value.type))return;w.issues.push({code:"invalid_value",values:T.mime,input:w.value.type,path:["type"],inst:$})}}),e5=k("$ZodCheckOverwrite",($,T)=>{z4.init($,T),$._zod.check=(W)=>{W.value=T.tx(W.value)}});class VY{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let W=$.split(`
|
|
7
|
+
`).filter((U)=>U),w=Math.min(...W.map((U)=>U.length-U.trimStart().length)),X=W.map((U)=>U.slice(w)).map((U)=>" ".repeat(this.indent*2)+U);for(let U of X)this.content.push(U)}compile(){let $=Function,T=this?.args,w=[...(this?.content??[""]).map((X)=>` ${X}`)];return new $(...T,w.join(`
|
|
8
|
+
`))}}var $7={major:4,minor:0,patch:0};var K$=k("$ZodType",($,T)=>{var W;$??($={}),$._zod.id=T.type+"_"+XY(10),$._zod.def=T,$._zod.bag=$._zod.bag||{},$._zod.version=$7;let w=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))w.unshift($);for(let X of w)for(let U of X._zod.onattach)U($);if(w.length===0)(W=$._zod).deferred??(W.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let X=(U,Y,G)=>{let H=uT(U),z;for(let F of Y){if(F._zod.when){if(!F._zod.when(U))continue}else if(H)continue;let O=U.issues.length,Q=F._zod.check(U);if(Q instanceof Promise&&G?.async===!1)throw new O0;if(z||Q instanceof Promise)z=(z??Promise.resolve()).then(async()=>{if(await Q,U.issues.length===O)return;if(!H)H=uT(U,O)});else{if(U.issues.length===O)continue;if(!H)H=uT(U,O)}}if(z)return z.then(()=>{return U});return U};$._zod.run=(U,Y)=>{let G=$._zod.parse(U,Y);if(G instanceof Promise){if(Y.async===!1)throw new O0;return G.then((H)=>X(H,w,Y))}return X(G,w,Y)}}$["~standard"]={validate:(X)=>{try{let U=U5($,X);return U.success?{value:U.data}:{issues:U.error?.issues}}catch(U){return Y5($,X).then((Y)=>Y.success?{value:Y.data}:{issues:Y.error?.issues})}},vendor:"zod",version:1}}),gX=k("$ZodString",($,T)=>{K$.init($,T),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??q5($._zod.bag),$._zod.parse=(W,w)=>{if(T.coerce)try{W.value=String(W.value)}catch(X){}if(typeof W.value==="string")return W;return W.issues.push({expected:"string",code:"invalid_type",input:W.value,inst:$}),W}}),r$=k("$ZodStringFormat",($,T)=>{dW.init($,T),gX.init($,T)}),W7=k("$ZodGUID",($,T)=>{T.pattern??(T.pattern=V5),r$.init($,T)}),X7=k("$ZodUUID",($,T)=>{if(T.version){let w={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[T.version];if(w===void 0)throw new Error(`Invalid UUID version: "${T.version}"`);T.pattern??(T.pattern=pT(w))}else T.pattern??(T.pattern=pT());r$.init($,T)}),w7=k("$ZodEmail",($,T)=>{T.pattern??(T.pattern=K5),r$.init($,T)}),U7=k("$ZodURL",($,T)=>{r$.init($,T),$._zod.check=(W)=>{try{let w=new URL(W.value);if(T.hostname){if(T.hostname.lastIndex=0,!T.hostname.test(w.hostname))W.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:J5.source,input:W.value,inst:$})}if(T.protocol){if(T.protocol.lastIndex=0,!T.protocol.test(w.protocol.endsWith(":")?w.protocol.slice(0,-1):w.protocol))W.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:T.protocol.source,input:W.value,inst:$})}return}catch(w){W.issues.push({code:"invalid_format",format:"url",input:W.value,inst:$})}}}),Y7=k("$ZodEmoji",($,T)=>{T.pattern??(T.pattern=A5()),r$.init($,T)}),G7=k("$ZodNanoID",($,T)=>{T.pattern??(T.pattern=Q5),r$.init($,T)}),z7=k("$ZodCUID",($,T)=>{T.pattern??(T.pattern=G5),r$.init($,T)}),H7=k("$ZodCUID2",($,T)=>{T.pattern??(T.pattern=z5),r$.init($,T)}),F7=k("$ZodULID",($,T)=>{T.pattern??(T.pattern=H5),r$.init($,T)}),O7=k("$ZodXID",($,T)=>{T.pattern??(T.pattern=F5),r$.init($,T)}),Q7=k("$ZodKSUID",($,T)=>{T.pattern??(T.pattern=O5),r$.init($,T)}),Z7=k("$ZodISODateTime",($,T)=>{T.pattern??(T.pattern=v5(T)),r$.init($,T)}),V7=k("$ZodISODate",($,T)=>{T.pattern??(T.pattern=_5),r$.init($,T)}),K7=k("$ZodISOTime",($,T)=>{T.pattern??(T.pattern=k5(T)),r$.init($,T)}),A7=k("$ZodISODuration",($,T)=>{T.pattern??(T.pattern=Z5),r$.init($,T)}),E7=k("$ZodIPv4",($,T)=>{T.pattern??(T.pattern=E5),r$.init($,T),$._zod.onattach.push((W)=>{let w=W._zod.bag;w.format="ipv4"})}),M7=k("$ZodIPv6",($,T)=>{T.pattern??(T.pattern=M5),r$.init($,T),$._zod.onattach.push((W)=>{let w=W._zod.bag;w.format="ipv6"}),$._zod.check=(W)=>{try{new URL(`http://[${W.value}]`)}catch{W.issues.push({code:"invalid_format",format:"ipv6",input:W.value,inst:$})}}}),D7=k("$ZodCIDRv4",($,T)=>{T.pattern??(T.pattern=D5),r$.init($,T)}),N7=k("$ZodCIDRv6",($,T)=>{T.pattern??(T.pattern=N5),r$.init($,T),$._zod.check=(W)=>{let[w,X]=W.value.split("/");try{if(!X)throw new Error;let U=Number(X);if(`${U}`!==X)throw new Error;if(U<0||U>128)throw new Error;new URL(`http://[${w}]`)}catch{W.issues.push({code:"invalid_format",format:"cidrv6",input:W.value,inst:$})}}});function L7($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var J7=k("$ZodBase64",($,T)=>{T.pattern??(T.pattern=L5),r$.init($,T),$._zod.onattach.push((W)=>{W._zod.bag.contentEncoding="base64"}),$._zod.check=(W)=>{if(L7(W.value))return;W.issues.push({code:"invalid_format",format:"base64",input:W.value,inst:$})}});function XK($){if(!OY.test($))return!1;let T=$.replace(/[-_]/g,(w)=>w==="-"?"+":"/"),W=T.padEnd(Math.ceil(T.length/4)*4,"=");return L7(W)}var R7=k("$ZodBase64URL",($,T)=>{T.pattern??(T.pattern=OY),r$.init($,T),$._zod.onattach.push((W)=>{W._zod.bag.contentEncoding="base64url"}),$._zod.check=(W)=>{if(XK(W.value))return;W.issues.push({code:"invalid_format",format:"base64url",input:W.value,inst:$})}}),_7=k("$ZodE164",($,T)=>{T.pattern??(T.pattern=R5),r$.init($,T)});function wK($,T=null){try{let W=$.split(".");if(W.length!==3)return!1;let[w]=W,X=JSON.parse(atob(w));if("typ"in X&&X?.typ!=="JWT")return!1;if(!X.alg)return!1;if(T&&(!("alg"in X)||X.alg!==T))return!1;return!0}catch{return!1}}var k7=k("$ZodJWT",($,T)=>{r$.init($,T),$._zod.check=(W)=>{if(wK(W.value,T.alg))return;W.issues.push({code:"invalid_format",format:"jwt",input:W.value,inst:$})}}),EY=k("$ZodNumber",($,T)=>{K$.init($,T),$._zod.pattern=$._zod.bag.pattern??S5,$._zod.parse=(W,w)=>{if(T.coerce)try{W.value=Number(W.value)}catch(Y){}let X=W.value;if(typeof X==="number"&&!Number.isNaN(X)&&Number.isFinite(X))return W;let U=typeof X==="number"?Number.isNaN(X)?"NaN":!Number.isFinite(X)?"Infinity":void 0:void 0;return W.issues.push({expected:"number",code:"invalid_type",input:X,inst:$,...U?{received:U}:{}}),W}}),v7=k("$ZodNumber",($,T)=>{y5.init($,T),EY.init($,T)}),mX=k("$ZodBoolean",($,T)=>{K$.init($,T),$._zod.pattern=j5,$._zod.parse=(W,w)=>{if(T.coerce)try{W.value=Boolean(W.value)}catch(U){}let X=W.value;if(typeof X==="boolean")return W;return W.issues.push({expected:"boolean",code:"invalid_type",input:X,inst:$}),W}}),MY=k("$ZodBigInt",($,T)=>{K$.init($,T),$._zod.pattern=P5,$._zod.parse=(W,w)=>{if(T.coerce)try{W.value=BigInt(W.value)}catch(U){}let{value:X}=W;if(typeof X==="bigint")return W;return W.issues.push({expected:"bigint",code:"invalid_type",input:X,inst:$}),W}}),q7=k("$ZodBigInt",($,T)=>{h5.init($,T),MY.init($,T)}),P7=k("$ZodSymbol",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let{value:X}=W;if(typeof X==="symbol")return W;return W.issues.push({expected:"symbol",code:"invalid_type",input:X,inst:$}),W}}),C7=k("$ZodUndefined",($,T)=>{K$.init($,T),$._zod.pattern=B5,$._zod.values=new Set([void 0]),$._zod.parse=(W,w)=>{let{value:X}=W;if(typeof X==="undefined")return W;return W.issues.push({expected:"undefined",code:"invalid_type",input:X,inst:$}),W}}),S7=k("$ZodNull",($,T)=>{K$.init($,T),$._zod.pattern=I5,$._zod.values=new Set([null]),$._zod.parse=(W,w)=>{let{value:X}=W;if(X===null)return W;return W.issues.push({expected:"null",code:"invalid_type",input:X,inst:$}),W}}),j7=k("$ZodAny",($,T)=>{K$.init($,T),$._zod.parse=(W)=>W}),YT=k("$ZodUnknown",($,T)=>{K$.init($,T),$._zod.parse=(W)=>W}),I7=k("$ZodNever",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{return W.issues.push({expected:"never",code:"invalid_type",input:W.value,inst:$}),W}}),B7=k("$ZodVoid",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let{value:X}=W;if(typeof X==="undefined")return W;return W.issues.push({expected:"void",code:"invalid_type",input:X,inst:$}),W}}),x7=k("$ZodDate",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{if(T.coerce)try{W.value=new Date(W.value)}catch(G){}let X=W.value,U=X instanceof Date;if(U&&!Number.isNaN(X.getTime()))return W;return W.issues.push({expected:"date",code:"invalid_type",input:X,...U?{received:"Invalid Date"}:{},inst:$}),W}});function lV($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues));T.value[W]=$.value}var cX=k("$ZodArray",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let X=W.value;if(!Array.isArray(X))return W.issues.push({expected:"array",code:"invalid_type",input:X,inst:$}),W;W.value=Array(X.length);let U=[];for(let Y=0;Y<X.length;Y++){let G=X[Y],H=T.element._zod.run({value:G,issues:[]},w);if(H instanceof Promise)U.push(H.then((z)=>lV(z,W,Y)));else lV(H,W,Y)}if(U.length)return Promise.all(U).then(()=>W);return W}});function KY($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues));T.value[W]=$.value}function rV($,T,W,w){if($.issues.length)if(w[W]===void 0)if(W in w)T.value[W]=void 0;else T.value[W]=$.value;else T.issues.push(...I6(W,$.issues));else if($.value===void 0){if(W in w)T.value[W]=void 0}else T.value[W]=$.value}var f7=k("$ZodObject",($,T)=>{K$.init($,T);let W=SX(()=>{let O=Object.keys(T.shape);for(let Z of O)if(!(T.shape[Z]instanceof K$))throw new Error(`Invalid element at key "${Z}": expected a Zod schema`);let Q=ez(T.shape);return{shape:T.shape,keys:O,keySet:new Set(O),numKeys:O.length,optionalKeys:new Set(Q)}});c$($._zod,"propValues",()=>{let O=T.shape,Q={};for(let Z in O){let K=O[Z]._zod;if(K.values){Q[Z]??(Q[Z]=new Set);for(let E of K.values)Q[Z].add(E)}}return Q});let w=(O)=>{let Q=new VY(["shape","payload","ctx"]),{keys:Z,optionalKeys:K}=W.value,E=(R)=>{let _=cT(R);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};Q.write("const input = payload.value;");let M=Object.create(null);for(let R of Z)M[R]=XY(15);Q.write("const newResult = {}");for(let R of Z)if(K.has(R)){let _=M[R];Q.write(`const ${_} = ${E(R)};`);let S=cT(R);Q.write(`
|
|
9
|
+
if (${_}.issues.length) {
|
|
10
|
+
if (input[${S}] === undefined) {
|
|
11
|
+
if (${S} in input) {
|
|
12
|
+
newResult[${S}] = undefined;
|
|
13
13
|
}
|
|
14
14
|
} else {
|
|
15
15
|
payload.issues = payload.issues.concat(
|
|
16
|
-
${
|
|
16
|
+
${_}.issues.map((iss) => ({
|
|
17
17
|
...iss,
|
|
18
|
-
path: iss.path ? [${
|
|
18
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}],
|
|
19
19
|
}))
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
|
-
} else if (${
|
|
23
|
-
if (${
|
|
22
|
+
} else if (${_}.value === undefined) {
|
|
23
|
+
if (${S} in input) newResult[${S}] = undefined;
|
|
24
24
|
} else {
|
|
25
|
-
newResult[${
|
|
25
|
+
newResult[${S}] = ${_}.value;
|
|
26
26
|
}
|
|
27
|
-
`)}else{let
|
|
28
|
-
if (${
|
|
27
|
+
`)}else{let _=M[R];Q.write(`const ${_} = ${E(R)};`),Q.write(`
|
|
28
|
+
if (${_}.issues.length) payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
|
29
29
|
...iss,
|
|
30
|
-
path: iss.path ? [${
|
|
31
|
-
})));`),Q.write(`newResult[${rT(_)}] = ${R}.value`)}Q.write("payload.value = newResult;"),Q.write("return payload;");let J=Q.compile();return(_,R)=>J(O,_,R)},X,Y=Ow,w=!pU.jitless,H=w&&D5.value,{catchall:z}=T,F;$._zod.parse=(O,Q)=>{F??(F=W.value);let Z=O.value;if(!Y(Z))return O.issues.push({expected:"object",code:"invalid_type",input:Z,inst:$}),O;let V=[];if(w&&H&&Q?.async===!1&&Q.jitless!==!0){if(!X)X=U(T.shape);O=X(O,Q)}else{O.value={};let R=F.shape;for(let P of F.keys){let x=R[P],f=x._zod.run({value:Z[P],issues:[]},Q),h=x._zod.optin==="optional"&&x._zod.optout==="optional";if(f instanceof Promise)V.push(f.then((a)=>h?EV(a,O,P,Z):Rw(a,O,P)));else if(h)EV(f,O,P,Z);else Rw(f,O,P)}}if(!z)return V.length?Promise.all(V).then(()=>O):O;let E=[],N=F.keySet,J=z._zod,_=J.def.type;for(let R of Object.keys(Z)){if(N.has(R))continue;if(_==="never"){E.push(R);continue}let P=J.run({value:Z[R],issues:[]},Q);if(P instanceof Promise)V.push(P.then((x)=>Rw(x,O,R)));else Rw(P,O,R)}if(E.length)O.issues.push({code:"unrecognized_keys",keys:E,input:Z,inst:$});if(!V.length)return O;return Promise.all(V).then(()=>{return O})}});function AV($,T,W,U){for(let X of $)if(X.issues.length===0)return T.value=X.value,T;return T.issues.push({code:"invalid_union",input:T.value,inst:W,errors:$.map((X)=>X.issues.map((Y)=>s6(Y,U,N4())))}),T}var Pw=k("$ZodUnion",($,T)=>{Q$.init($,T),g$($._zod,"values",()=>{if(T.options.every((W)=>W._zod.values))return new Set(T.options.flatMap((W)=>Array.from(W._zod.values)));return}),g$($._zod,"pattern",()=>{if(T.options.every((W)=>W._zod.pattern)){let W=T.options.map((U)=>U._zod.pattern);return new RegExp(`^(${W.map((U)=>lU(U.source)).join("|")})$`)}return}),$._zod.parse=(W,U)=>{let X=!1,Y=[];for(let w of T.options){let G=w._zod.run({value:W.value,issues:[]},U);if(G instanceof Promise)Y.push(G),X=!0;else{if(G.issues.length===0)return G;Y.push(G)}}if(!X)return AV(Y,W,$,U);return Promise.all(Y).then((w)=>{return AV(w,W,$,U)})}});function CV($,T,W){let U=!0,X=$?.[T];if(W.values.size&&!W.values.has(X))U=!1;if(W.maps.length>0){for(let Y of W.maps)if(!$C(X,Y))U=!1}return U}function $C($,T){let W=!0;for(let[U,X]of T)if(!CV($,U,X))W=!1;return W}var s7=k("$ZodDiscriminatedUnion",($,T)=>{Pw.init($,T);let W=$._zod.parse;g$($._zod,"disc",()=>{let X=new Map;for(let Y of T.options){let w=Y._zod.disc;if(!w)throw new Error(`Invalid discriminated union option at index "${T.options.indexOf(Y)}"`);for(let[G,H]of w){if(!X.has(G))X.set(G,{values:new Set,maps:[]});let z=X.get(G);for(let F of H.values)z.values.add(F);for(let F of H.maps)z.maps.push(F)}}return X});let U=oU(()=>{let X=new Map;for(let Y of T.options){let w=Y._zod.disc?.get(T.discriminator);if(!w)throw new Error("Invalid discriminated union option");X.set(Y,w)}return X});$._zod.parse=(X,Y)=>{let w=X.value;if(!Ow(w))return X.issues.push({code:"invalid_type",expected:"object",input:w,inst:$}),X;let G=[],H=U.value;for(let z of T.options){let F=H.get(z);if(CV(w,T.discriminator,F))G.push(z)}if(G.length===1)return G[0]._zod.run(X,Y);if(T.unionFallback)return W(X,Y);return X.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:w,path:[T.discriminator],inst:$}),X}}),e7=k("$ZodIntersection",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{let{value:X}=W,Y=T.left._zod.run({value:X,issues:[]},U),w=T.right._zod.run({value:X,issues:[]},U);if(Y instanceof Promise||w instanceof Promise)return Promise.all([Y,w]).then(([H,z])=>{return MV(W,H,z)});return MV(W,Y,w)}});function K7($,T){if($===T)return{valid:!0,data:$};if($ instanceof Date&&T instanceof Date&&+$===+T)return{valid:!0,data:$};if(rU($)&&rU(T)){let W=Object.keys(T),U=Object.keys($).filter((Y)=>W.indexOf(Y)!==-1),X={...$,...T};for(let Y of U){let w=K7($[Y],T[Y]);if(!w.valid)return{valid:!1,mergeErrorPath:[Y,...w.mergeErrorPath]};X[Y]=w.data}return{valid:!0,data:X}}if(Array.isArray($)&&Array.isArray(T)){if($.length!==T.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let U=0;U<$.length;U++){let X=$[U],Y=T[U],w=K7(X,Y);if(!w.valid)return{valid:!1,mergeErrorPath:[U,...w.mergeErrorPath]};W.push(w.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function MV($,T,W){if(T.issues.length)$.issues.push(...T.issues);if(W.issues.length)$.issues.push(...W.issues);if(nT($))return $;let U=K7(T.value,W.value);if(!U.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(U.mergeErrorPath)}`);return $.value=U.data,$}var aT=k("$ZodTuple",($,T)=>{Q$.init($,T);let W=T.items,U=W.length-[...W].reverse().findIndex((X)=>X._zod.optin!=="optional");$._zod.parse=(X,Y)=>{let w=X.value;if(!Array.isArray(w))return X.issues.push({input:w,inst:$,expected:"tuple",code:"invalid_type"}),X;X.value=[];let G=[];if(!T.rest){let z=w.length>W.length,F=w.length<U-1;if(z||F)return X.issues.push({input:w,inst:$,origin:"array",...z?{code:"too_big",maximum:W.length}:{code:"too_small",minimum:W.length}}),X}let H=-1;for(let z of W){if(H++,H>=w.length){if(H>=U)continue}let F=z._zod.run({value:w[H],issues:[]},Y);if(F instanceof Promise)G.push(F.then((O)=>kw(O,X,H)));else kw(F,X,H)}if(T.rest){let z=w.slice(W.length);for(let F of z){H++;let O=T.rest._zod.run({value:F,issues:[]},Y);if(O instanceof Promise)G.push(O.then((Q)=>kw(Q,X,H)));else kw(O,X,H)}}if(G.length)return Promise.all(G).then(()=>X);return X}});function kw($,T,W){if($.issues.length)T.issues.push(...S6(W,$.issues));T.value[W]=$.value}var $3=k("$ZodRecord",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(!rU(X))return W.issues.push({expected:"record",code:"invalid_type",input:X,inst:$}),W;let Y=[];if(T.keyType._zod.values){let w=T.keyType._zod.values;W.value={};for(let H of w)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let z=T.valueType._zod.run({value:X[H],issues:[]},U);if(z instanceof Promise)Y.push(z.then((F)=>{if(F.issues.length)W.issues.push(...S6(H,F.issues));W.value[H]=F.value}));else{if(z.issues.length)W.issues.push(...S6(H,z.issues));W.value[H]=z.value}}let G;for(let H in X)if(!w.has(H))G=G??[],G.push(H);if(G&&G.length>0)W.issues.push({code:"unrecognized_keys",input:X,inst:$,keys:G})}else{W.value={};for(let w of Reflect.ownKeys(X)){if(w==="__proto__")continue;let G=T.keyType._zod.run({value:w,issues:[]},U);if(G instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(G.issues.length){W.issues.push({origin:"record",code:"invalid_key",issues:G.issues.map((z)=>s6(z,U,N4())),input:w,path:[w],inst:$}),W.value[G.value]=G.value;continue}let H=T.valueType._zod.run({value:X[w],issues:[]},U);if(H instanceof Promise)Y.push(H.then((z)=>{if(z.issues.length)W.issues.push(...S6(w,z.issues));W.value[G.value]=z.value}));else{if(H.issues.length)W.issues.push(...S6(w,H.issues));W.value[G.value]=H.value}}}if(Y.length)return Promise.all(Y).then(()=>W);return W}}),T3=k("$ZodMap",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(!(X instanceof Map))return W.issues.push({expected:"map",code:"invalid_type",input:X,inst:$}),W;let Y=[];W.value=new Map;for(let[w,G]of X){let H=T.keyType._zod.run({value:w,issues:[]},U),z=T.valueType._zod.run({value:G,issues:[]},U);if(H instanceof Promise||z instanceof Promise)Y.push(Promise.all([H,z]).then(([F,O])=>{NV(F,O,W,w,X,$,U)}));else NV(H,z,W,w,X,$,U)}if(Y.length)return Promise.all(Y).then(()=>W);return W}});function NV($,T,W,U,X,Y,w){if($.issues.length)if(nU.has(typeof U))W.issues.push(...S6(U,$.issues));else W.issues.push({origin:"map",code:"invalid_key",input:X,inst:Y,issues:$.issues.map((G)=>s6(G,w,N4()))});if(T.issues.length)if(nU.has(typeof U))W.issues.push(...S6(U,T.issues));else W.issues.push({origin:"map",code:"invalid_element",input:X,inst:Y,key:U,issues:T.issues.map((G)=>s6(G,w,N4()))});W.value.set($.value,T.value)}var W3=k("$ZodSet",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(!(X instanceof Set))return W.issues.push({input:X,inst:$,expected:"set",code:"invalid_type"}),W;let Y=[];W.value=new Set;for(let w of X){let G=T.valueType._zod.run({value:w,issues:[]},U);if(G instanceof Promise)Y.push(G.then((H)=>LV(H,W)));else LV(G,W)}if(Y.length)return Promise.all(Y).then(()=>W);return W}});function LV($,T){if($.issues.length)T.issues.push(...$.issues);T.value.add($.value)}var U3=k("$ZodEnum",($,T)=>{Q$.init($,T);let W=Object.values(T.entries).filter((X)=>typeof X==="number"),U=Object.entries(T.entries).filter(([X,Y])=>W.indexOf(+X)===-1).map(([X,Y])=>Y);$._zod.values=new Set(U),$._zod.pattern=new RegExp(`^(${U.filter((X)=>nU.has(typeof X)).map((X)=>typeof X==="string"?D0(X):X.toString()).join("|")})$`),$._zod.parse=(X,Y)=>{let w=X.value;if($._zod.values.has(w))return X;return X.issues.push({code:"invalid_value",values:U,input:w,inst:$}),X}}),X3=k("$ZodLiteral",($,T)=>{Q$.init($,T),$._zod.values=new Set(T.values),$._zod.pattern=new RegExp(`^(${T.values.map((W)=>typeof W==="string"?D0(W):W?W.toString():String(W)).join("|")})$`),$._zod.parse=(W,U)=>{let X=W.value;if($._zod.values.has(X))return W;return W.issues.push({code:"invalid_value",values:T.values,input:X,inst:$}),W}}),Y3=k("$ZodFile",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{let X=W.value;if(X instanceof File)return W;return W.issues.push({expected:"file",code:"invalid_type",input:X,inst:$}),W}}),w3=k("$ZodTransform",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{let X=T.transform(W.value,W);if(U.async)return(X instanceof Promise?X:Promise.resolve(X)).then((w)=>{return W.value=w,W});if(X instanceof Promise)throw new Z0;return W.value=X,W}}),G3=k("$ZodOptional",($,T)=>{Q$.init($,T),$._zod.optin="optional",$._zod.optout="optional",g$($._zod,"values",()=>{return T.innerType._zod.values?new Set([...T.innerType._zod.values,void 0]):void 0}),g$($._zod,"pattern",()=>{let W=T.innerType._zod.pattern;return W?new RegExp(`^(${lU(W.source)})?$`):void 0}),$._zod.parse=(W,U)=>{if(W.value===void 0)return W;return T.innerType._zod.run(W,U)}}),z3=k("$ZodNullable",($,T)=>{Q$.init($,T),g$($._zod,"optin",()=>T.innerType._zod.optin),g$($._zod,"optout",()=>T.innerType._zod.optout),g$($._zod,"pattern",()=>{let W=T.innerType._zod.pattern;return W?new RegExp(`^(${lU(W.source)}|null)$`):void 0}),g$($._zod,"values",()=>{return T.innerType._zod.values?new Set([...T.innerType._zod.values,null]):void 0}),$._zod.parse=(W,U)=>{if(W.value===null)return W;return T.innerType._zod.run(W,U)}}),H3=k("$ZodDefault",($,T)=>{Q$.init($,T),$._zod.optin="optional",g$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,U)=>{if(W.value===void 0)return W.value=T.defaultValue,W;let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then((Y)=>JV(Y,T));return JV(X,T)}});function JV($,T){if($.value===void 0)$.value=T.defaultValue;return $}var F3=k("$ZodPrefault",($,T)=>{Q$.init($,T),$._zod.optin="optional",g$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,U)=>{if(W.value===void 0)W.value=T.defaultValue;return T.innerType._zod.run(W,U)}}),O3=k("$ZodNonOptional",($,T)=>{Q$.init($,T),g$($._zod,"values",()=>{let W=T.innerType._zod.values;return W?new Set([...W].filter((U)=>U!==void 0)):void 0}),$._zod.parse=(W,U)=>{let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then((Y)=>_V(Y,$));return _V(X,$)}});function _V($,T){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:T});return $}var Q3=k("$ZodSuccess",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then((Y)=>{return W.value=Y.issues.length===0,W});return W.value=X.issues.length===0,W}}),Z3=k("$ZodCatch",($,T)=>{Q$.init($,T),g$($._zod,"optin",()=>T.innerType._zod.optin),g$($._zod,"optout",()=>T.innerType._zod.optout),g$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,U)=>{let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then((Y)=>{if(W.value=Y.value,Y.issues.length)W.value=T.catchValue({...W,error:{issues:Y.issues.map((w)=>s6(w,U,N4()))},input:W.value}),W.issues=[];return W});if(W.value=X.value,X.issues.length)W.value=T.catchValue({...W,error:{issues:X.issues.map((Y)=>s6(Y,U,N4()))},input:W.value}),W.issues=[];return W}}),D3=k("$ZodNaN",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{if(typeof W.value!=="number"||!Number.isNaN(W.value))return W.issues.push({input:W.value,inst:$,expected:"nan",code:"invalid_type"}),W;return W}}),UX=k("$ZodPipe",($,T)=>{Q$.init($,T),g$($._zod,"values",()=>T.in._zod.values),g$($._zod,"optin",()=>T.in._zod.optin),g$($._zod,"optout",()=>T.out._zod.optout),$._zod.parse=(W,U)=>{let X=T.in._zod.run(W,U);if(X instanceof Promise)return X.then((Y)=>RV(Y,T,U));return RV(X,T,U)}});function RV($,T,W){if(nT($))return $;return T.out._zod.run({value:$.value,issues:$.issues},W)}var V3=k("$ZodReadonly",($,T)=>{Q$.init($,T),g$($._zod,"disc",()=>T.innerType._zod.disc),g$($._zod,"optin",()=>T.innerType._zod.optin),g$($._zod,"optout",()=>T.innerType._zod.optout),$._zod.parse=(W,U)=>{let X=T.innerType._zod.run(W,U);if(X instanceof Promise)return X.then(kV);return kV(X)}});function kV($){return $.value=Object.freeze($.value),$}var K3=k("$ZodTemplateLiteral",($,T)=>{Q$.init($,T);let W=[];for(let U of T.parts)if(U instanceof Q$){if(!U._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...U._zod.traits].shift()}`);let X=U._zod.pattern instanceof RegExp?U._zod.pattern.source:U._zod.pattern;if(!X)throw new Error(`Invalid template literal part: ${U._zod.traits}`);let Y=X.startsWith("^")?1:0,w=X.endsWith("$")?X.length-1:X.length;W.push(X.slice(Y,w))}else if(U===null||V5.has(typeof U))W.push(D0(`${U}`));else throw new Error(`Invalid template literal part: ${U}`);$._zod.pattern=new RegExp(`^${W.join("")}$`),$._zod.parse=(U,X)=>{if(typeof U.value!=="string")return U.issues.push({input:U.value,inst:$,expected:"template_literal",code:"invalid_type"}),U;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(U.value))return U.issues.push({input:U.value,inst:$,code:"invalid_format",format:"template_literal",pattern:$._zod.pattern.source}),U;return U}}),E3=k("$ZodPromise",($,T)=>{Q$.init($,T),$._zod.parse=(W,U)=>{return Promise.resolve(W.value).then((X)=>T.innerType._zod.run({value:X,issues:[]},U))}}),A3=k("$ZodLazy",($,T)=>{Q$.init($,T),g$($._zod,"innerType",()=>T.getter()),g$($._zod,"pattern",()=>$._zod.innerType._zod.pattern),g$($._zod,"disc",()=>$._zod.innerType._zod.disc),g$($._zod,"optin",()=>$._zod.innerType._zod.optin),g$($._zod,"optout",()=>$._zod.innerType._zod.optout),$._zod.parse=(W,U)=>{return $._zod.innerType._zod.run(W,U)}}),M3=k("$ZodCustom",($,T)=>{G4.init($,T),Q$.init($,T),$._zod.parse=(W,U)=>{return W},$._zod.check=(W)=>{let U=W.value,X=T.fn(U);if(X instanceof Promise)return X.then((Y)=>vV(Y,W,U,$));vV(X,W,U,$);return}});function vV($,T,W,U){if(!$){let X={code:"custom",input:W,inst:U,path:[...U._zod.def.path??[]],continue:!U._zod.def.abort};if(U._zod.def.params)X.params=U._zod.def.params;T.issues.push(M5(X))}}var YX={};wT(YX,{zhTW:()=>TH,zhCN:()=>$H,vi:()=>e3,ur:()=>s3,ua:()=>a3,tr:()=>t3,th:()=>i3,ta:()=>n3,sv:()=>r3,sl:()=>l3,ru:()=>o3,pt:()=>d3,pl:()=>p3,ota:()=>u3,no:()=>c3,nl:()=>m3,ms:()=>g3,mk:()=>h3,ko:()=>y3,kh:()=>f3,ja:()=>b3,it:()=>I3,id:()=>x3,hu:()=>B3,he:()=>j3,frCA:()=>S3,fr:()=>C3,fi:()=>P3,fa:()=>q3,es:()=>v3,en:()=>XX,de:()=>k3,cs:()=>R3,ca:()=>_3,be:()=>J3,az:()=>L3,ar:()=>N3});var TC={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function jV($){return TC[$]??null}var WC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},UC={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},XC=($)=>{switch($.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${$.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${WC($.input)}`;case"invalid_value":if($.values.length===1)return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${r($.values[0])}`;return`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=jV($.origin);if(W)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${$.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${T} ${$.maximum.toString()} ${W.unit??"\u0639\u0646\u0635\u0631"}`;return`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${$.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${T} ${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=jV($.origin);if(W)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${$.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${T} ${$.minimum.toString()} ${W.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${$.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${T} ${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${$.prefix}"`;if(T.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${T.suffix}"`;if(T.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${T.includes}"`;if(T.format==="regex")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${T.pattern}`;return`${UC[T.format]??$.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${$.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${$.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${$.keys.length>1?"\u0629":""}: ${I($.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${$.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${$.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}};function N3(){return{localeError:XC}}var YC={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function BV($){return YC[$]??null}var wC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},GC={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},zC=($)=>{switch($.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${$.expected}, daxil olan ${wC($.input)}`;case"invalid_value":if($.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${r($.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=BV($.origin);if(W)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${$.origin??"d\u0259y\u0259r"} ${T}${$.maximum.toString()} ${W.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${$.origin??"d\u0259y\u0259r"} ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=BV($.origin);if(W)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${$.origin} ${T}${$.minimum.toString()} ${W.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${$.origin} ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${T.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(T.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${T.suffix}" il\u0259 bitm\u0259lidir`;if(T.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${T.includes}" daxil olmal\u0131d\u0131r`;if(T.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${T.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${GC[T.format]??$.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${$.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${$.keys.length>1?"lar":""}: ${I($.keys,", ")}`;case"invalid_key":return`${$.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${$.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}};function L3(){return{localeError:zC}}function xV($,T,W,U){let X=Math.abs($),Y=X%10,w=X%100;if(w>=11&&w<=19)return U;if(Y===1)return T;if(Y>=2&&Y<=4)return W;return U}var HC={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function IV($){return HC[$]??null}var FC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray($))return"\u043C\u0430\u0441\u0456\u045E";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},OC={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},QC=($)=>{switch($.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${$.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${FC($.input)}`;case"invalid_value":if($.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${r($.values[0])}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=IV($.origin);if(W){let U=Number($.maximum),X=xV(U,W.unit.one,W.unit.few,W.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${$.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${W.verb} ${T}${$.maximum.toString()} ${X}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${$.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=IV($.origin);if(W){let U=Number($.minimum),X=xV(U,W.unit.one,W.unit.few,W.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${$.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${W.verb} ${T}${$.minimum.toString()} ${X}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${$.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${T.prefix}"`;if(T.format==="ends_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${T.suffix}"`;if(T.format==="includes")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${T.includes}"`;if(T.format==="regex")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${T.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${OC[T.format]??$.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${$.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${$.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${I($.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${$.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${$.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}};function J3(){return{localeError:QC}}var ZC={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function bV($){return ZC[$]??null}var DC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},VC={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},KC=($)=>{switch($.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${$.expected}, s'ha rebut ${DC($.input)}`;case"invalid_value":if($.values.length===1)return`Valor inv\xE0lid: s'esperava ${r($.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${I($.values," o ")}`;case"too_big":{let T=$.inclusive?"com a m\xE0xim":"menys de",W=bV($.origin);if(W)return`Massa gran: s'esperava que ${$.origin??"el valor"} contingu\xE9s ${T} ${$.maximum.toString()} ${W.unit??"elements"}`;return`Massa gran: s'esperava que ${$.origin??"el valor"} fos ${T} ${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?"com a m\xEDnim":"m\xE9s de",W=bV($.origin);if(W)return`Massa petit: s'esperava que ${$.origin} contingu\xE9s ${T} ${$.minimum.toString()} ${W.unit}`;return`Massa petit: s'esperava que ${$.origin} fos ${T} ${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${T.prefix}"`;if(T.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${T.suffix}"`;if(T.format==="includes")return`Format inv\xE0lid: ha d'incloure "${T.includes}"`;if(T.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${T.pattern}`;return`Format inv\xE0lid per a ${VC[T.format]??$.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${$.divisor}`;case"unrecognized_keys":return`Clau${$.keys.length>1?"s":""} no reconeguda${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${$.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${$.origin}`;default:return"Entrada inv\xE0lida"}};function _3(){return{localeError:KC}}var EC={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function fV($){return EC[$]??null}var AC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray($))return"pole";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},MC={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},NC=($)=>{switch($.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${$.expected}, obdr\u017Eeno ${AC($.input)}`;case"invalid_value":if($.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${r($.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=fV($.origin);if(W)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${$.origin??"hodnota"} mus\xED m\xEDt ${T}${$.maximum.toString()} ${W.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${$.origin??"hodnota"} mus\xED b\xFDt ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=fV($.origin);if(W)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${$.origin??"hodnota"} mus\xED m\xEDt ${T}${$.minimum.toString()} ${W.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${$.origin??"hodnota"} mus\xED b\xFDt ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${T.prefix}"`;if(T.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${T.suffix}"`;if(T.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${T.includes}"`;if(T.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${T.pattern}`;return`Neplatn\xFD form\xE1t ${MC[T.format]??$.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${$.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${I($.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${$.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${$.origin}`;default:return"Neplatn\xFD vstup"}};function R3(){return{localeError:NC}}var LC={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function yV($){return LC[$]??null}var JC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"Zahl";case"object":{if(Array.isArray($))return"Array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},_C={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},RC=($)=>{switch($.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${$.expected}, erhalten ${JC($.input)}`;case"invalid_value":if($.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${r($.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=yV($.origin);if(W)return`Zu gro\xDF: erwartet, dass ${$.origin??"Wert"} ${T}${$.maximum.toString()} ${W.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${$.origin??"Wert"} ${T}${$.maximum.toString()} ist`}case"too_small":{let T=$.inclusive?">=":">",W=yV($.origin);if(W)return`Zu klein: erwartet, dass ${$.origin} ${T}${$.minimum.toString()} ${W.unit} hat`;return`Zu klein: erwartet, dass ${$.origin} ${T}${$.minimum.toString()} ist`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Ung\xFCltiger String: muss mit "${T.prefix}" beginnen`;if(T.format==="ends_with")return`Ung\xFCltiger String: muss mit "${T.suffix}" enden`;if(T.format==="includes")return`Ung\xFCltiger String: muss "${T.includes}" enthalten`;if(T.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${T.pattern} entsprechen`;return`Ung\xFCltig: ${_C[T.format]??$.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${$.divisor} sein`;case"unrecognized_keys":return`${$.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${I($.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${$.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${$.origin}`;default:return"Ung\xFCltige Eingabe"}};function k3(){return{localeError:RC}}var kC={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function hV($){return kC[$]??null}var vC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},qC={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},PC=($)=>{switch($.code){case"invalid_type":return`Invalid input: expected ${$.expected}, received ${vC($.input)}`;case"invalid_value":if($.values.length===1)return`Invalid input: expected ${r($.values[0])}`;return`Invalid option: expected one of ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=hV($.origin);if(W)return`Too big: expected ${$.origin??"value"} to have ${T}${$.maximum.toString()} ${W.unit??"elements"}`;return`Too big: expected ${$.origin??"value"} to be ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=hV($.origin);if(W)return`Too small: expected ${$.origin} to have ${T}${$.minimum.toString()} ${W.unit}`;return`Too small: expected ${$.origin} to be ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Invalid string: must start with "${T.prefix}"`;if(T.format==="ends_with")return`Invalid string: must end with "${T.suffix}"`;if(T.format==="includes")return`Invalid string: must include "${T.includes}"`;if(T.format==="regex")return`Invalid string: must match pattern ${T.pattern}`;return`Invalid ${qC[T.format]??$.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${$.divisor}`;case"unrecognized_keys":return`Unrecognized key${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`Invalid key in ${$.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${$.origin}`;default:return"Invalid input"}};function XX(){return{localeError:PC}}var CC={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function gV($){return CC[$]??null}var SC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"n\xFAmero";case"object":{if(Array.isArray($))return"arreglo";if($===null)return"nulo";if(Object.getPrototypeOf($)!==Object.prototype)return $.constructor.name}}return T},jC={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},BC=($)=>{switch($.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${$.expected}, recibido ${SC($.input)}`;case"invalid_value":if($.values.length===1)return`Entrada inv\xE1lida: se esperaba ${r($.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=gV($.origin);if(W)return`Demasiado grande: se esperaba que ${$.origin??"valor"} tuviera ${T}${$.maximum.toString()} ${W.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${$.origin??"valor"} fuera ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=gV($.origin);if(W)return`Demasiado peque\xF1o: se esperaba que ${$.origin} tuviera ${T}${$.minimum.toString()} ${W.unit}`;return`Demasiado peque\xF1o: se esperaba que ${$.origin} fuera ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${T.prefix}"`;if(T.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${T.suffix}"`;if(T.format==="includes")return`Cadena inv\xE1lida: debe incluir "${T.includes}"`;if(T.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${T.pattern}`;return`Inv\xE1lido ${jC[T.format]??$.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${$.divisor}`;case"unrecognized_keys":return`Llave${$.keys.length>1?"s":""} desconocida${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${$.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${$.origin}`;default:return"Entrada inv\xE1lida"}};function v3(){return{localeError:BC}}var xC={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function mV($){return xC[$]??null}var IC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray($))return"\u0622\u0631\u0627\u06CC\u0647";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},bC={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},fC=($)=>{switch($.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${$.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${IC($.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":if($.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${r($.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${I($.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let T=$.inclusive?"<=":"<",W=mV($.origin);if(W)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${$.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${T}${$.maximum.toString()} ${W.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${$.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${T}${$.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let T=$.inclusive?">=":">",W=mV($.origin);if(W)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${$.origin} \u0628\u0627\u06CC\u062F ${T}${$.minimum.toString()} ${W.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${$.origin} \u0628\u0627\u06CC\u062F ${T}${$.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${T.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(T.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${T.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(T.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${T.includes}" \u0628\u0627\u0634\u062F`;if(T.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${T.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${bC[T.format]??$.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${$.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${$.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${I($.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${$.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${$.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}};function q3(){return{localeError:fC}}var yC={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function cV($){return yC[$]??null}var hC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},gC={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},mC=($)=>{switch($.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${$.expected}, oli ${hC($.input)}`;case"invalid_value":if($.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${r($.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=cV($.origin);if(W)return`Liian suuri: ${W.subject} t\xE4ytyy olla ${T}${$.maximum.toString()} ${W.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=cV($.origin);if(W)return`Liian pieni: ${W.subject} t\xE4ytyy olla ${T}${$.minimum.toString()} ${W.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${T.prefix}"`;if(T.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${T.suffix}"`;if(T.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${T.includes}"`;if(T.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${T.pattern}`;return`Virheellinen ${gC[T.format]??$.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${$.divisor} monikerta`;case"unrecognized_keys":return`${$.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${I($.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}};function P3(){return{localeError:mC}}var cC={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function uV($){return cC[$]??null}var uC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"nombre";case"object":{if(Array.isArray($))return"tableau";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},pC={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},dC=($)=>{switch($.code){case"invalid_type":return`Entr\xE9e invalide : ${$.expected} attendu, ${uC($.input)} re\xE7u`;case"invalid_value":if($.values.length===1)return`Entr\xE9e invalide : ${r($.values[0])} attendu`;return`Option invalide : une valeur parmi ${I($.values,"|")} attendue`;case"too_big":{let T=$.inclusive?"<=":"<",W=uV($.origin);if(W)return`Trop grand : ${$.origin??"valeur"} doit ${W.verb} ${T}${$.maximum.toString()} ${W.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${$.origin??"valeur"} doit \xEAtre ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=uV($.origin);if(W)return`Trop petit : ${$.origin} doit ${W.verb} ${T}${$.minimum.toString()} ${W.unit}`;return`Trop petit : ${$.origin} doit \xEAtre ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${T.prefix}"`;if(T.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${T.suffix}"`;if(T.format==="includes")return`Cha\xEEne invalide : doit inclure "${T.includes}"`;if(T.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${T.pattern}`;return`${pC[T.format]??$.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${$.divisor}`;case"unrecognized_keys":return`Cl\xE9${$.keys.length>1?"s":""} non reconnue${$.keys.length>1?"s":""} : ${I($.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${$.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${$.origin}`;default:return"Entr\xE9e invalide"}};function C3(){return{localeError:dC}}var oC={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function pV($){return oC[$]??null}var lC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},rC={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},nC=($)=>{switch($.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${$.expected}, re\xE7u ${lC($.input)}`;case"invalid_value":if($.values.length===1)return`Entr\xE9e invalide : attendu ${r($.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"\u2264":"<",W=pV($.origin);if(W)return`Trop grand : attendu que ${$.origin??"la valeur"} ait ${T}${$.maximum.toString()} ${W.unit}`;return`Trop grand : attendu que ${$.origin??"la valeur"} soit ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?"\u2265":">",W=pV($.origin);if(W)return`Trop petit : attendu que ${$.origin} ait ${T}${$.minimum.toString()} ${W.unit}`;return`Trop petit : attendu que ${$.origin} soit ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${T.prefix}"`;if(T.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${T.suffix}"`;if(T.format==="includes")return`Cha\xEEne invalide : doit inclure "${T.includes}"`;if(T.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${T.pattern}`;return`${rC[T.format]??$.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${$.divisor}`;case"unrecognized_keys":return`Cl\xE9${$.keys.length>1?"s":""} non reconnue${$.keys.length>1?"s":""} : ${I($.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${$.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${$.origin}`;default:return"Entr\xE9e invalide"}};function S3(){return{localeError:nC}}var iC={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function dV($){return iC[$]??null}var tC=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},aC={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"},sC=($)=>{switch($.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${$.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${tC($.input)}`;case"invalid_value":if($.values.length===1)return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${r($.values[0])}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=dV($.origin);if(W)return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${$.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${T}${$.maximum.toString()} ${W.unit??"elements"}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${$.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=dV($.origin);if(W)return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${$.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${T}${$.minimum.toString()} ${W.unit}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${$.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${T.prefix}"`;if(T.format==="ends_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${T.suffix}"`;if(T.format==="includes")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${T.includes}"`;if(T.format==="regex")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${T.pattern}`;return`${aC[T.format]??$.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${$.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${$.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${$.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${I($.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${$.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${$.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}};function j3(){return{localeError:sC}}var eC={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function oV($){return eC[$]??null}var $S=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"sz\xE1m";case"object":{if(Array.isArray($))return"t\xF6mb";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},TS={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},WS=($)=>{switch($.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${$.expected}, a kapott \xE9rt\xE9k ${$S($.input)}`;case"invalid_value":if($.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${r($.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=oV($.origin);if(W)return`T\xFAl nagy: ${$.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${T}${$.maximum.toString()} ${W.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${$.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=oV($.origin);if(W)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${$.origin} m\xE9rete t\xFAl kicsi ${T}${$.minimum.toString()} ${W.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${$.origin} t\xFAl kicsi ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\xC9rv\xE9nytelen string: "${T.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(T.format==="ends_with")return`\xC9rv\xE9nytelen string: "${T.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(T.format==="includes")return`\xC9rv\xE9nytelen string: "${T.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(T.format==="regex")return`\xC9rv\xE9nytelen string: ${T.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${TS[T.format]??$.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${$.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${$.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${$.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}};function B3(){return{localeError:WS}}var US={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function lV($){return US[$]??null}var XS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},YS={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},wS=($)=>{switch($.code){case"invalid_type":return`Input tidak valid: diharapkan ${$.expected}, diterima ${XS($.input)}`;case"invalid_value":if($.values.length===1)return`Input tidak valid: diharapkan ${r($.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=lV($.origin);if(W)return`Terlalu besar: diharapkan ${$.origin??"value"} memiliki ${T}${$.maximum.toString()} ${W.unit??"elemen"}`;return`Terlalu besar: diharapkan ${$.origin??"value"} menjadi ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=lV($.origin);if(W)return`Terlalu kecil: diharapkan ${$.origin} memiliki ${T}${$.minimum.toString()} ${W.unit}`;return`Terlalu kecil: diharapkan ${$.origin} menjadi ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`String tidak valid: harus dimulai dengan "${T.prefix}"`;if(T.format==="ends_with")return`String tidak valid: harus berakhir dengan "${T.suffix}"`;if(T.format==="includes")return`String tidak valid: harus menyertakan "${T.includes}"`;if(T.format==="regex")return`String tidak valid: harus sesuai pola ${T.pattern}`;return`${YS[T.format]??$.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${$.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${$.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${$.origin}`;default:return"Input tidak valid"}};function x3(){return{localeError:wS}}var GS={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function rV($){return GS[$]??null}var zS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"numero";case"object":{if(Array.isArray($))return"vettore";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},HS={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},FS=($)=>{switch($.code){case"invalid_type":return`Input non valido: atteso ${$.expected}, ricevuto ${zS($.input)}`;case"invalid_value":if($.values.length===1)return`Input non valido: atteso ${r($.values[0])}`;return`Opzione non valida: atteso uno tra ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=rV($.origin);if(W)return`Troppo grande: ${$.origin??"valore"} deve avere ${T}${$.maximum.toString()} ${W.unit??"elementi"}`;return`Troppo grande: ${$.origin??"valore"} deve essere ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=rV($.origin);if(W)return`Troppo piccolo: ${$.origin} deve avere ${T}${$.minimum.toString()} ${W.unit}`;return`Troppo piccolo: ${$.origin} deve essere ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Stringa non valida: deve iniziare con "${T.prefix}"`;if(T.format==="ends_with")return`Stringa non valida: deve terminare con "${T.suffix}"`;if(T.format==="includes")return`Stringa non valida: deve includere "${T.includes}"`;if(T.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${T.pattern}`;return`Invalid ${HS[T.format]??$.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${$.divisor}`;case"unrecognized_keys":return`Chiav${$.keys.length>1?"i":"e"} non riconosciut${$.keys.length>1?"e":"a"}: ${I($.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${$.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${$.origin}`;default:return"Input non valido"}};function I3(){return{localeError:FS}}var OS={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function nV($){return OS[$]??null}var QS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray($))return"\u914D\u5217";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},ZS={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},DS=($)=>{switch($.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${$.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${QS($.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":if($.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${r($.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${I($.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let T=$.inclusive?"<=":"<",W=nV($.origin);if(W)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${$.origin??"\u5024"}\u306F${$.maximum.toString()}${W.unit??"\u8981\u7D20"}${T}\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${$.origin??"\u5024"}\u306F${$.maximum.toString()}${T}\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let T=$.inclusive?">=":">",W=nV($.origin);if(W)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${$.origin}\u306F${$.minimum.toString()}${W.unit}${T}\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${$.origin}\u306F${$.minimum.toString()}${T}\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${T.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(T.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${T.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(T.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${T.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(T.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${T.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${ZS[T.format]??$.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${$.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${$.keys.length>1?"\u7FA4":""}: ${I($.keys,"\u3001")}`;case"invalid_key":return`${$.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${$.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}};function b3(){return{localeError:DS}}var VS={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function iV($){return VS[$]??null}var KS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray($))return"\u17A2\u17B6\u179A\u17C1 (Array)";if($===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},ES={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},AS=($)=>{switch($.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${$.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${KS($.input)}`;case"invalid_value":if($.values.length===1)return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${r($.values[0])}`;return`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=iV($.origin);if(W)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${$.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${T} ${$.maximum.toString()} ${W.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${$.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${T} ${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=iV($.origin);if(W)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${$.origin} ${T} ${$.minimum.toString()} ${W.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${$.origin} ${T} ${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${T.prefix}"`;if(T.format==="ends_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${T.suffix}"`;if(T.format==="includes")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${T.includes}"`;if(T.format==="regex")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${T.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${ES[T.format]??$.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${$.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${I($.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${$.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${$.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}};function f3(){return{localeError:AS}}var MS={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function tV($){return MS[$]??null}var NS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},LS={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},JS=($)=>{switch($.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${$.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${NS($.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":if($.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${r($.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${I($.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let T=$.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",W=T==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",U=tV($.origin),X=U?.unit??"\uC694\uC18C";if(U)return`${$.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${$.maximum.toString()}${X} ${T}${W}`;return`${$.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${$.maximum.toString()} ${T}${W}`}case"too_small":{let T=$.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",W=T==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",U=tV($.origin),X=U?.unit??"\uC694\uC18C";if(U)return`${$.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${$.minimum.toString()}${X} ${T}${W}`;return`${$.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${$.minimum.toString()} ${T}${W}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${T.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(T.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${T.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(T.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${T.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(T.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${T.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${LS[T.format]??$.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${$.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${I($.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${$.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${$.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}};function y3(){return{localeError:JS}}var _S={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function aV($){return _S[$]??null}var RS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray($))return"\u043D\u0438\u0437\u0430";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},kS={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},vS=($)=>{switch($.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${$.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${RS($.input)}`;case"invalid_value":if($.values.length===1)return`Invalid input: expected ${r($.values[0])}`;return`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=aV($.origin);if(W)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${$.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${T}${$.maximum.toString()} ${W.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${$.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=aV($.origin);if(W)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${$.origin} \u0434\u0430 \u0438\u043C\u0430 ${T}${$.minimum.toString()} ${W.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${$.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${T.prefix}"`;if(T.format==="ends_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${T.suffix}"`;if(T.format==="includes")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${T.includes}"`;if(T.format==="regex")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${T.pattern}`;return`Invalid ${kS[T.format]??$.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${$.divisor}`;case"unrecognized_keys":return`${$.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${I($.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${$.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${$.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}};function h3(){return{localeError:vS}}var qS={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function sV($){return qS[$]??null}var PS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"nombor";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},CS={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},SS=($)=>{switch($.code){case"invalid_type":return`Input tidak sah: dijangka ${$.expected}, diterima ${PS($.input)}`;case"invalid_value":if($.values.length===1)return`Input tidak sah: dijangka ${r($.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=sV($.origin);if(W)return`Terlalu besar: dijangka ${$.origin??"nilai"} ${W.verb} ${T}${$.maximum.toString()} ${W.unit??"elemen"}`;return`Terlalu besar: dijangka ${$.origin??"nilai"} adalah ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=sV($.origin);if(W)return`Terlalu kecil: dijangka ${$.origin} ${W.verb} ${T}${$.minimum.toString()} ${W.unit}`;return`Terlalu kecil: dijangka ${$.origin} adalah ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`String tidak sah: mesti bermula dengan "${T.prefix}"`;if(T.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${T.suffix}"`;if(T.format==="includes")return`String tidak sah: mesti mengandungi "${T.includes}"`;if(T.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${T.pattern}`;return`${CS[T.format]??$.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${$.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${I($.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${$.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${$.origin}`;default:return"Input tidak sah"}};function g3(){return{localeError:SS}}var jS={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function eV($){return jS[$]??null}var BS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"getal";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},xS={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},IS=($)=>{switch($.code){case"invalid_type":return`Ongeldige invoer: verwacht ${$.expected}, ontving ${BS($.input)}`;case"invalid_value":if($.values.length===1)return`Ongeldige invoer: verwacht ${r($.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=eV($.origin);if(W)return`Te lang: verwacht dat ${$.origin??"waarde"} ${T}${$.maximum.toString()} ${W.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${$.origin??"waarde"} ${T}${$.maximum.toString()} is`}case"too_small":{let T=$.inclusive?">=":">",W=eV($.origin);if(W)return`Te kort: verwacht dat ${$.origin} ${T}${$.minimum.toString()} ${W.unit} bevat`;return`Te kort: verwacht dat ${$.origin} ${T}${$.minimum.toString()} is`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Ongeldige tekst: moet met "${T.prefix}" beginnen`;if(T.format==="ends_with")return`Ongeldige tekst: moet op "${T.suffix}" eindigen`;if(T.format==="includes")return`Ongeldige tekst: moet "${T.includes}" bevatten`;if(T.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${T.pattern}`;return`Ongeldig: ${xS[T.format]??$.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${$.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${$.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${$.origin}`;default:return"Ongeldige invoer"}};function m3(){return{localeError:IS}}var bS={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function $K($){return bS[$]??null}var fS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"tall";case"object":{if(Array.isArray($))return"liste";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},yS={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},hS=($)=>{switch($.code){case"invalid_type":return`Ugyldig input: forventet ${$.expected}, fikk ${fS($.input)}`;case"invalid_value":if($.values.length===1)return`Ugyldig verdi: forventet ${r($.values[0])}`;return`Ugyldig valg: forventet en av ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=$K($.origin);if(W)return`For stor(t): forventet ${$.origin??"value"} til \xE5 ha ${T}${$.maximum.toString()} ${W.unit??"elementer"}`;return`For stor(t): forventet ${$.origin??"value"} til \xE5 ha ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=$K($.origin);if(W)return`For lite(n): forventet ${$.origin} til \xE5 ha ${T}${$.minimum.toString()} ${W.unit}`;return`For lite(n): forventet ${$.origin} til \xE5 ha ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${T.prefix}"`;if(T.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${T.suffix}"`;if(T.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${T.includes}"`;if(T.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${T.pattern}`;return`Ugyldig ${yS[T.format]??$.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${$.divisor}`;case"unrecognized_keys":return`${$.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${I($.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${$.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${$.origin}`;default:return"Ugyldig input"}};function c3(){return{localeError:hS}}var gS={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function TK($){return gS[$]??null}var mS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"numara";case"object":{if(Array.isArray($))return"saf";if($===null)return"gayb";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},cS={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},uS=($)=>{switch($.code){case"invalid_type":return`F\xE2sit giren: umulan ${$.expected}, al\u0131nan ${mS($.input)}`;case"invalid_value":if($.values.length===1)return`F\xE2sit giren: umulan ${r($.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=TK($.origin);if(W)return`Fazla b\xFCy\xFCk: ${$.origin??"value"}, ${T}${$.maximum.toString()} ${W.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${$.origin??"value"}, ${T}${$.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let T=$.inclusive?">=":">",W=TK($.origin);if(W)return`Fazla k\xFC\xE7\xFCk: ${$.origin}, ${T}${$.minimum.toString()} ${W.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${$.origin}, ${T}${$.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`F\xE2sit metin: "${T.prefix}" ile ba\u015Flamal\u0131.`;if(T.format==="ends_with")return`F\xE2sit metin: "${T.suffix}" ile bitmeli.`;if(T.format==="includes")return`F\xE2sit metin: "${T.includes}" ihtiv\xE2 etmeli.`;if(T.format==="regex")return`F\xE2sit metin: ${T.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${cS[T.format]??$.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${$.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`${$.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${$.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}};function u3(){return{localeError:uS}}var pS={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function WK($){return pS[$]??null}var dS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"liczba";case"object":{if(Array.isArray($))return"tablica";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},oS={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},lS=($)=>{switch($.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${$.expected}, otrzymano ${dS($.input)}`;case"invalid_value":if($.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${r($.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=WK($.origin);if(W)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${$.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${T}${$.maximum.toString()} ${W.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${$.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=WK($.origin);if(W)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${$.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${T}${$.minimum.toString()} ${W.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${$.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${T.prefix}"`;if(T.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${T.suffix}"`;if(T.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${T.includes}"`;if(T.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${T.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${oS[T.format]??$.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${$.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${$.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${$.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}};function p3(){return{localeError:lS}}var rS={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function UK($){return rS[$]??null}var nS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"n\xFAmero";case"object":{if(Array.isArray($))return"array";if($===null)return"nulo";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},iS={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},tS=($)=>{switch($.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${$.expected}, recebido ${nS($.input)}`;case"invalid_value":if($.values.length===1)return`Entrada inv\xE1lida: esperado ${r($.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=UK($.origin);if(W)return`Muito grande: esperado que ${$.origin??"valor"} tivesse ${T}${$.maximum.toString()} ${W.unit??"elementos"}`;return`Muito grande: esperado que ${$.origin??"valor"} fosse ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=UK($.origin);if(W)return`Muito pequeno: esperado que ${$.origin} tivesse ${T}${$.minimum.toString()} ${W.unit}`;return`Muito pequeno: esperado que ${$.origin} fosse ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${T.prefix}"`;if(T.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${T.suffix}"`;if(T.format==="includes")return`Texto inv\xE1lido: deve incluir "${T.includes}"`;if(T.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${T.pattern}`;return`${iS[T.format]??$.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${$.divisor}`;case"unrecognized_keys":return`Chave${$.keys.length>1?"s":""} desconhecida${$.keys.length>1?"s":""}: ${I($.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${$.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${$.origin}`;default:return"Campo inv\xE1lido"}};function d3(){return{localeError:tS}}function XK($,T,W,U){let X=Math.abs($),Y=X%10,w=X%100;if(w>=11&&w<=19)return U;if(Y===1)return T;if(Y>=2&&Y<=4)return W;return U}var aS={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function YK($){return aS[$]??null}var sS=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray($))return"\u043C\u0430\u0441\u0441\u0438\u0432";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},eS={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},$j=($)=>{switch($.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${$.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${sS($.input)}`;case"invalid_value":if($.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${r($.values[0])}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=YK($.origin);if(W){let U=Number($.maximum),X=XK(U,W.unit.one,W.unit.few,W.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${$.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${T}${$.maximum.toString()} ${X}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${$.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=YK($.origin);if(W){let U=Number($.minimum),X=XK(U,W.unit.one,W.unit.few,W.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${$.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${T}${$.minimum.toString()} ${X}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${$.origin} \u0431\u0443\u0434\u0435\u0442 ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${T.prefix}"`;if(T.format==="ends_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${T.suffix}"`;if(T.format==="includes")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${T.includes}"`;if(T.format==="regex")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${T.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${eS[T.format]??$.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${$.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${$.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${$.keys.length>1?"\u0438":""}: ${I($.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${$.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${$.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}};function o3(){return{localeError:$j}}var Tj={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function wK($){return Tj[$]??null}var Wj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray($))return"tabela";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},Uj={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},Xj=($)=>{switch($.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${$.expected}, prejeto ${Wj($.input)}`;case"invalid_value":if($.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${r($.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=wK($.origin);if(W)return`Preveliko: pri\u010Dakovano, da bo ${$.origin??"vrednost"} imelo ${T}${$.maximum.toString()} ${W.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${$.origin??"vrednost"} ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=wK($.origin);if(W)return`Premajhno: pri\u010Dakovano, da bo ${$.origin} imelo ${T}${$.minimum.toString()} ${W.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${$.origin} ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${T.prefix}"`;if(T.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${T.suffix}"`;if(T.format==="includes")return`Neveljaven niz: mora vsebovati "${T.includes}"`;if(T.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${T.pattern}`;return`Neveljaven ${Uj[T.format]??$.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${$.divisor}`;case"unrecognized_keys":return`Neprepoznan${$.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${I($.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${$.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${$.origin}`;default:return"Neveljaven vnos"}};function l3(){return{localeError:Xj}}var Yj={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function GK($){return Yj[$]??null}var wj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"antal";case"object":{if(Array.isArray($))return"lista";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},Gj={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},zj=($)=>{switch($.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${$.expected}, fick ${wj($.input)}`;case"invalid_value":if($.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${r($.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=GK($.origin);if(W)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${$.origin??"v\xE4rdet"} att ha ${T}${$.maximum.toString()} ${W.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${$.origin??"v\xE4rdet"} att ha ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=GK($.origin);if(W)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${$.origin??"v\xE4rdet"} att ha ${T}${$.minimum.toString()} ${W.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${$.origin??"v\xE4rdet"} att ha ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${T.prefix}"`;if(T.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${T.suffix}"`;if(T.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${T.includes}"`;if(T.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${T.pattern}"`;return`Ogiltig(t) ${Gj[T.format]??$.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${$.divisor}`;case"unrecognized_keys":return`${$.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${I($.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${$.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${$.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}};function r3(){return{localeError:zj}}var Hj={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function zK($){return Hj[$]??null}var Fj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray($))return"\u0B85\u0BA3\u0BBF";if($===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},Oj={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},Qj=($)=>{switch($.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${$.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Fj($.input)}`;case"invalid_value":if($.values.length===1)return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r($.values[0])}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${I($.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let T=$.inclusive?"<=":"<",W=zK($.origin);if(W)return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${$.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${T}${$.maximum.toString()} ${W.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${$.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${T}${$.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let T=$.inclusive?">=":">",W=zK($.origin);if(W)return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${$.origin} ${T}${$.minimum.toString()} ${W.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${$.origin} ${T}${$.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${T.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(T.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${T.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(T.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${T.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(T.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${T.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${Oj[T.format]??$.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${$.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${$.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${I($.keys,", ")}`;case"invalid_key":return`${$.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${$.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}};function n3(){return{localeError:Qj}}var Zj={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function HK($){return Zj[$]??null}var Dj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray($))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if($===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},Vj={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},Kj=($)=>{switch($.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${$.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${Dj($.input)}`;case"invalid_value":if($.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${r($.values[0])}`;return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",W=HK($.origin);if(W)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${$.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${T} ${$.maximum.toString()} ${W.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${$.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${T} ${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",W=HK($.origin);if(W)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${$.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${T} ${$.minimum.toString()} ${W.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${$.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${T} ${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${T.prefix}"`;if(T.format==="ends_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${T.suffix}"`;if(T.format==="includes")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${T.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(T.format==="regex")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${T.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${Vj[T.format]??$.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${$.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${I($.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${$.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${$.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}};function i3(){return{localeError:Kj}}var Ej={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function FK($){return Ej[$]??null}var Aj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},Mj={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},Nj=($)=>{switch($.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${$.expected}, al\u0131nan ${Aj($.input)}`;case"invalid_value":if($.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${r($.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=FK($.origin);if(W)return`\xC7ok b\xFCy\xFCk: beklenen ${$.origin??"de\u011Fer"} ${T}${$.maximum.toString()} ${W.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${$.origin??"de\u011Fer"} ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=FK($.origin);if(W)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${$.origin} ${T}${$.minimum.toString()} ${W.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${$.origin} ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Ge\xE7ersiz metin: "${T.prefix}" ile ba\u015Flamal\u0131`;if(T.format==="ends_with")return`Ge\xE7ersiz metin: "${T.suffix}" ile bitmeli`;if(T.format==="includes")return`Ge\xE7ersiz metin: "${T.includes}" i\xE7ermeli`;if(T.format==="regex")return`Ge\xE7ersiz metin: ${T.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${Mj[T.format]??$.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${$.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${$.keys.length>1?"lar":""}: ${I($.keys,", ")}`;case"invalid_key":return`${$.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${$.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}};function t3(){return{localeError:Nj}}var Lj={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function OK($){return Lj[$]??null}var Jj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray($))return"\u043C\u0430\u0441\u0438\u0432";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},_j={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},Rj=($)=>{switch($.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${$.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${Jj($.input)}`;case"invalid_value":if($.values.length===1)return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${r($.values[0])}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=OK($.origin);if(W)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${$.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${W.verb} ${T}${$.maximum.toString()} ${W.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${$.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=OK($.origin);if(W)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${$.origin} ${W.verb} ${T}${$.minimum.toString()} ${W.unit}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${$.origin} \u0431\u0443\u0434\u0435 ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${T.prefix}"`;if(T.format==="ends_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${T.suffix}"`;if(T.format==="includes")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${T.includes}"`;if(T.format==="regex")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${T.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${_j[T.format]??$.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${$.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${$.keys.length>1?"\u0456":""}: ${I($.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${$.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${$.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}};function a3(){return{localeError:Rj}}var kj={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function QK($){return kj[$]??null}var vj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray($))return"\u0622\u0631\u06D2";if($===null)return"\u0646\u0644";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},qj={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},Pj=($)=>{switch($.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${$.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${vj($.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":if($.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${r($.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${I($.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let T=$.inclusive?"<=":"<",W=QK($.origin);if(W)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${$.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${T}${$.maximum.toString()} ${W.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${$.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${T}${$.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let T=$.inclusive?">=":">",W=QK($.origin);if(W)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${$.origin} \u06A9\u06D2 ${T}${$.minimum.toString()} ${W.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${$.origin} \u06A9\u0627 ${T}${$.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${T.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(T.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${T.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(T.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${T.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(T.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${T.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${qj[T.format]??$.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${$.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${$.keys.length>1?"\u0632":""}: ${I($.keys,"\u060C ")}`;case"invalid_key":return`${$.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${$.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}};function s3(){return{localeError:Pj}}var Cj={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function ZK($){return Cj[$]??null}var Sj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"s\u1ED1";case"object":{if(Array.isArray($))return"m\u1EA3ng";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},jj={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},Bj=($)=>{switch($.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${$.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${Sj($.input)}`;case"invalid_value":if($.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${r($.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=ZK($.origin);if(W)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${$.origin??"gi\xE1 tr\u1ECB"} ${W.verb} ${T}${$.maximum.toString()} ${W.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${$.origin??"gi\xE1 tr\u1ECB"} ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=ZK($.origin);if(W)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${$.origin} ${W.verb} ${T}${$.minimum.toString()} ${W.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${$.origin} ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${T.prefix}"`;if(T.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${T.suffix}"`;if(T.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${T.includes}"`;if(T.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${T.pattern}`;return`${jj[T.format]??$.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${$.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${I($.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${$.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${$.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}};function e3(){return{localeError:Bj}}var xj={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function DK($){return xj[$]??null}var Ij=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray($))return"\u6570\u7EC4";if($===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},bj={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},fj=($)=>{switch($.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${$.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${Ij($.input)}`;case"invalid_value":if($.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${r($.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=DK($.origin);if(W)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${$.origin??"\u503C"} ${T}${$.maximum.toString()} ${W.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${$.origin??"\u503C"} ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=DK($.origin);if(W)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${$.origin} ${T}${$.minimum.toString()} ${W.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${$.origin} ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${T.prefix}" \u5F00\u5934`;if(T.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${T.suffix}" \u7ED3\u5C3E`;if(T.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${T.includes}"`;if(T.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${T.pattern}`;return`\u65E0\u6548${bj[T.format]??$.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${$.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${I($.keys,", ")}`;case"invalid_key":return`${$.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${$.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}};function $H(){return{localeError:fj}}var yj={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function VK($){return yj[$]??null}var hj=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},gj={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},mj=($)=>{switch($.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${$.expected}\uFF0C\u4F46\u6536\u5230 ${hj($.input)}`;case"invalid_value":if($.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${r($.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${I($.values,"|")}`;case"too_big":{let T=$.inclusive?"<=":"<",W=VK($.origin);if(W)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${$.origin??"\u503C"} \u61C9\u70BA ${T}${$.maximum.toString()} ${W.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${$.origin??"\u503C"} \u61C9\u70BA ${T}${$.maximum.toString()}`}case"too_small":{let T=$.inclusive?">=":">",W=VK($.origin);if(W)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${$.origin} \u61C9\u70BA ${T}${$.minimum.toString()} ${W.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${$.origin} \u61C9\u70BA ${T}${$.minimum.toString()}`}case"invalid_format":{let T=$;if(T.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${T.prefix}" \u958B\u982D`;if(T.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${T.suffix}" \u7D50\u5C3E`;if(T.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${T.includes}"`;if(T.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${T.pattern}`;return`\u7121\u6548\u7684 ${gj[T.format]??$.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${$.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${$.keys.length>1?"\u5011":""}\uFF1A${I($.keys,"\u3001")}`;case"invalid_key":return`${$.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${$.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}};function TH(){return{localeError:mj}}var WH=Symbol("ZodOutput"),UH=Symbol("ZodInput");class wX{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...T){let W=T[0];if(this._map.set($,W),W&&typeof W==="object"&&"id"in W){if(this._idmap.has(W.id))throw new Error(`ID ${W.id} already exists in the registry`);this._idmap.set(W.id,$)}return this}remove($){return this._map.delete($),this}get($){let T=$._zod.parent;if(T){let W={...this.get(T)??{}};return delete W.id,{...W,...this._map.get($)}}return this._map.get($)}has($){return this._map.has($)}}function Cw(){return new wX}var n1=Cw();function XH($,T){return new $({type:"string",...c(T)})}function YH($,T){return new $({type:"string",coerce:!0,...c(T)})}function Sw($,T){return new $({type:"string",format:"email",check:"string_format",abort:!1,...c(T)})}function GX($,T){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...c(T)})}function jw($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...c(T)})}function Bw($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...c(T)})}function xw($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...c(T)})}function Iw($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...c(T)})}function bw($,T){return new $({type:"string",format:"url",check:"string_format",abort:!1,...c(T)})}function fw($,T){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...c(T)})}function yw($,T){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...c(T)})}function hw($,T){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...c(T)})}function gw($,T){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...c(T)})}function mw($,T){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...c(T)})}function cw($,T){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...c(T)})}function uw($,T){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...c(T)})}function pw($,T){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...c(T)})}function dw($,T){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...c(T)})}function ow($,T){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...c(T)})}function lw($,T){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...c(T)})}function rw($,T){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...c(T)})}function nw($,T){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...c(T)})}function iw($,T){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...c(T)})}function tw($,T){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...c(T)})}function wH($,T){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...c(T)})}function GH($,T){return new $({type:"string",format:"date",check:"string_format",...c(T)})}function zH($,T){return new $({type:"string",format:"time",check:"string_format",precision:null,...c(T)})}function HH($,T){return new $({type:"string",format:"duration",check:"string_format",...c(T)})}function FH($,T){return new $({type:"number",checks:[],...c(T)})}function OH($,T){return new $({type:"number",coerce:!0,checks:[],...c(T)})}function QH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...c(T)})}function ZH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...c(T)})}function DH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...c(T)})}function VH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...c(T)})}function KH($,T){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...c(T)})}function EH($,T){return new $({type:"boolean",...c(T)})}function AH($,T){return new $({type:"boolean",coerce:!0,...c(T)})}function MH($,T){return new $({type:"bigint",...c(T)})}function NH($,T){return new $({type:"bigint",coerce:!0,...c(T)})}function LH($,T){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...c(T)})}function JH($,T){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...c(T)})}function _H($,T){return new $({type:"symbol",...c(T)})}function RH($,T){return new $({type:"undefined",...c(T)})}function kH($,T){return new $({type:"null",...c(T)})}function vH($){return new $({type:"any"})}function qH($){return new $({type:"unknown"})}function PH($,T){return new $({type:"never",...c(T)})}function CH($,T){return new $({type:"void",...c(T)})}function SH($,T){return new $({type:"date",...c(T)})}function jH($,T){return new $({type:"date",coerce:!0,...c(T)})}function BH($,T){return new $({type:"nan",...c(T)})}function V0($,T){return new Lw({check:"less_than",...c(T),value:$,inclusive:!1})}function D1($,T){return new Lw({check:"less_than",...c(T),value:$,inclusive:!0})}function K0($,T){return new Jw({check:"greater_than",...c(T),value:$,inclusive:!1})}function j6($,T){return new Jw({check:"greater_than",...c(T),value:$,inclusive:!0})}function xH($){return K0(0,$)}function IH($){return V0(0,$)}function bH($){return D1(0,$)}function fH($){return j6(0,$)}function sT($,T){return new a5({check:"multiple_of",...c(T),value:$})}function X2($,T){return new $7({check:"max_size",...c(T),maximum:$})}function eT($,T){return new T7({check:"min_size",...c(T),minimum:$})}function zX($,T){return new W7({check:"size_equals",...c(T),size:$})}function Y2($,T){return new U7({check:"max_length",...c(T),maximum:$})}function ZT($,T){return new X7({check:"min_length",...c(T),minimum:$})}function w2($,T){return new Y7({check:"length_equals",...c(T),length:$})}function HX($,T){return new w7({check:"string_format",format:"regex",...c(T),pattern:$})}function FX($){return new G7({check:"string_format",format:"lowercase",...c($)})}function OX($){return new z7({check:"string_format",format:"uppercase",...c($)})}function QX($,T){return new H7({check:"string_format",format:"includes",...c(T),includes:$})}function ZX($,T){return new F7({check:"string_format",format:"starts_with",...c(T),prefix:$})}function DX($,T){return new O7({check:"string_format",format:"ends_with",...c(T),suffix:$})}function yH($,T,W){return new Q7({check:"property",property:$,schema:T,...c(W)})}function VX($,T){return new Z7({check:"mime_type",mime:$,...c(T)})}function E0($){return new D7({check:"overwrite",tx:$})}function KX($){return E0((T)=>T.normalize($))}function EX(){return E0(($)=>$.trim())}function AX(){return E0(($)=>$.toLowerCase())}function MX(){return E0(($)=>$.toUpperCase())}function hH($,T,W){return new $({type:"array",element:T,...c(W)})}function cj($,T,W){return new $({type:"union",options:T,...c(W)})}function uj($,T,W,U){return new $({type:"union",options:W,discriminator:T,...c(U)})}function pj($,T,W){return new $({type:"intersection",left:T,right:W})}function gH($,T,W,U){let X=W instanceof Q$;return new $({type:"tuple",items:T,rest:X?W:null,...c(X?U:W)})}function dj($,T,W,U){return new $({type:"record",keyType:T,valueType:W,...c(U)})}function oj($,T,W,U){return new $({type:"map",keyType:T,valueType:W,...c(U)})}function lj($,T,W){return new $({type:"set",valueType:T,...c(W)})}function rj($,T,W){let U=Array.isArray(T)?Object.fromEntries(T.map((X)=>[X,X])):T;return new $({type:"enum",entries:U,...c(W)})}function nj($,T,W){return new $({type:"enum",entries:T,...c(W)})}function ij($,T,W){return new $({type:"literal",values:Array.isArray(T)?T:[T],...c(W)})}function mH($,T){return new $({type:"file",...c(T)})}function tj($,T){return new $({type:"transform",transform:T})}function aj($,T){return new $({type:"optional",innerType:T})}function sj($,T){return new $({type:"nullable",innerType:T})}function ej($,T,W){return new $({type:"default",innerType:T,get defaultValue(){return typeof W==="function"?W():W}})}function $B($,T,W){return new $({type:"nonoptional",innerType:T,...c(W)})}function TB($,T){return new $({type:"success",innerType:T})}function WB($,T,W){return new $({type:"catch",innerType:T,catchValue:typeof W==="function"?W:()=>W})}function UB($,T,W){return new $({type:"pipe",in:T,out:W})}function XB($,T){return new $({type:"readonly",innerType:T})}function YB($,T,W){return new $({type:"template_literal",parts:T,...c(W)})}function wB($,T){return new $({type:"lazy",getter:T})}function GB($,T){return new $({type:"promise",innerType:T})}function NX($,T,W){return new $({type:"custom",check:"custom",fn:T,...c(W)})}function zB($,T,W={}){return NX($,T,W)}function cH($,T){let{case:W,error:U,truthy:X,falsy:Y}=c(T),w=new Set(X??["true","1","yes","on","y","enabled"]),G=new Set(Y??["false","0","no","off","n","disabled"]),H=$.Pipe??UX,z=$.Boolean??TX,O=new($.Unknown??WX)({type:"unknown",checks:[{_zod:{check:(Q)=>{if(typeof Q.value==="string"){let Z=Q.value;if(W!=="sensitive")Z=Z.toLowerCase();if(w.has(Z))Q.value=!0;else if(G.has(Z))Q.value=!1;else Q.issues.push({code:"invalid_value",expected:"stringbool",values:[...w,...G],input:Q.value,inst:O})}else Q.issues.push({code:"invalid_type",expected:"string",input:Q.value})},def:{check:"custom"},onattach:[]}}],error:U});return new H({type:"pipe",in:O,out:new z({type:"boolean",error:U}),error:U})}class G2{constructor($){this._def=$,this.def=$}implement($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let T=(...W)=>{let U=this._def.input?Zw(this._def.input,W,void 0,{callee:T}):W;if(!Array.isArray(U))throw new Error("Invalid arguments schema: not an array or tuple schema.");let X=$(...U);return this._def.output?Zw(this._def.output,X,void 0,{callee:T}):X};return T}implementAsync($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let T=async(...W)=>{let U=this._def.input?await Vw(this._def.input,W,void 0,{callee:T}):W;if(!Array.isArray(U))throw new Error("Invalid arguments schema: not an array or tuple schema.");let X=await $(...U);return this._def.output?Vw(this._def.output,X,void 0,{callee:T}):X};return T}input(...$){if(Array.isArray($[0]))return new G2({type:"function",input:new aT({type:"tuple",items:$[0],rest:$[1]}),output:this._def.output});return new G2({type:"function",input:$[0],output:this._def.output})}output($){return new G2({type:"function",input:this._def.input,output:$})}}function uH($){return new G2({type:"function",input:Array.isArray($?.input)?gH(aT,$?.input):$?.input??null,output:$?.output??null})}var HB={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};class aw{constructor($){this.counter=0,this.metadataRegistry=$?.metadata??n1,this.target=$?.target??"draft-2020-12",this.unrepresentable=$?.unrepresentable??"throw",this.override=$?.override??(()=>{}),this.io=$?.io??"output",this.seen=new Map}process($,T={path:[],schemaPath:[]}){var W;let U=$._zod.def,X=this.seen.get($);if(X){if(X.count++,T.schemaPath.includes($))X.cycle=T.path;return X.count++,X.schema}let Y={schema:{},count:1,cycle:void 0};if(this.seen.set($,Y),$._zod.toJSONSchema)Y.schema=$._zod.toJSONSchema();let w={...T,schemaPath:[...T.schemaPath,$],path:T.path},G=$._zod.parent;if(G)Y.ref=G,this.process(G,w),this.seen.get(G).isParent=!0;else{let F=Y.schema;switch(U.type){case"string":{let O=F;O.type="string";let{minimum:Q,maximum:Z,format:V,patterns:E,contentEncoding:N}=$._zod.bag;if(typeof Q==="number")O.minLength=Q;if(typeof Z==="number")O.maxLength=Z;if(V){if(O.format=HB[V]??V,O.format==="")delete O.format}if(N)O.contentEncoding=N;if(E&&E.size>0){let J=[...E];if(J.length===1)O.pattern=J[0].source;else if(J.length>1)Y.schema.allOf=[...J.map((_)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:_.source}))]}break}case"number":{let O=F,{minimum:Q,maximum:Z,format:V,multipleOf:E,exclusiveMaximum:N,exclusiveMinimum:J}=$._zod.bag;if(typeof V==="string"&&V.includes("int"))O.type="integer";else O.type="number";if(typeof J==="number")O.exclusiveMinimum=J;if(typeof Q==="number"){if(O.minimum=Q,typeof J==="number")if(J>=Q)delete O.minimum;else delete O.exclusiveMinimum}if(typeof N==="number")O.exclusiveMaximum=N;if(typeof Z==="number"){if(O.maximum=Z,typeof N==="number")if(N<=Z)delete O.maximum;else delete O.exclusiveMaximum}if(typeof E==="number")O.multipleOf=E;break}case"boolean":{let O=F;O.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{let O=F;O.type="null";break}case"null":{F.type="null";break}case"any":break;case"unknown":break;case"never":{F.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let O=F,{minimum:Q,maximum:Z}=$._zod.bag;if(typeof Q==="number")O.minItems=Q;if(typeof Z==="number")O.maxItems=Z;O.type="array",O.items=this.process(U.element,{...w,path:[...w.path,"items"]});break}case"object":{let O=F;O.type="object",O.properties={};let Q=U.shape;for(let E in Q)O.properties[E]=this.process(Q[E],{...w,path:[...w.path,"properties",E]});let Z=new Set(Object.keys(Q)),V=new Set([...Z].filter((E)=>{let N=U.shape[E]._zod;if(this.io==="input")return N.optin===void 0;else return N.optout===void 0}));if(V.size>0)O.required=Array.from(V);if(U.catchall?._zod.def.type==="never")O.additionalProperties=!1;else if(!U.catchall){if(this.io==="output")O.additionalProperties=!1}else if(U.catchall)O.additionalProperties=this.process(U.catchall,{...w,path:[...w.path,"additionalProperties"]});break}case"union":{let O=F;O.anyOf=U.options.map((Q,Z)=>this.process(Q,{...w,path:[...w.path,"anyOf",Z]}));break}case"intersection":{let O=F;O.allOf=[this.process(U.left,{...w,path:[...w.path,"allOf",0]}),this.process(U.right,{...w,path:[...w.path,"allOf",1]})];break}case"tuple":{let O=F;O.type="array";let Q=U.items.map((E,N)=>this.process(E,{...w,path:[...w.path,"prefixItems",N]}));if(this.target==="draft-2020-12")O.prefixItems=Q;else O.items=Q;if(U.rest){let E=this.process(U.rest,{...w,path:[...w.path,"items"]});if(this.target==="draft-2020-12")O.items=E;else O.additionalItems=E}if(U.rest)O.items=this.process(U.rest,{...w,path:[...w.path,"items"]});let{minimum:Z,maximum:V}=$._zod.bag;if(typeof Z==="number")O.minItems=Z;if(typeof V==="number")O.maxItems=V;break}case"record":{let O=F;O.type="object",O.propertyNames=this.process(U.keyType,{...w,path:[...w.path,"propertyNames"]}),O.additionalProperties=this.process(U.valueType,{...w,path:[...w.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let O=F;O.enum=Object.values(U.entries);break}case"literal":{let O=F,Q=[];for(let Z of U.values)if(Z===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof Z==="bigint")if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");else Q.push(Number(Z));else Q.push(Z);if(Q.length===0);else if(Q.length===1){let Z=Q[0];O.const=Z}else O.enum=Q;break}case"file":{if(this.unrepresentable==="throw")throw new Error("File cannot be represented in JSON Schema");break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let O=this.process(U.innerType,w);F.anyOf=[O,{type:"null"}];break}case"nonoptional":{this.process(U.innerType,w),Y.ref=U.innerType;break}case"success":{let O=F;O.type="boolean";break}case"default":{this.process(U.innerType,w),Y.ref=U.innerType,F.default=U.defaultValue;break}case"prefault":{if(this.process(U.innerType,w),Y.ref=U.innerType,this.io==="input")F._prefault=U.defaultValue;break}case"catch":{this.process(U.innerType,w),Y.ref=U.innerType;let O;try{O=U.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}F.default=O;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let O=F,Q=$._zod.pattern;if(!Q)throw new Error("Pattern not found in template literal");O.type="string",O.pattern=Q.source;break}case"pipe":{let O=this.io==="input"?U.in._zod.def.type==="transform"?U.out:U.in:U.out;this.process(O,w),Y.ref=O;break}case"readonly":{this.process(U.innerType,w),Y.ref=U.innerType,F.readOnly=!0;break}case"promise":{this.process(U.innerType,w),Y.ref=U.innerType;break}case"optional":{this.process(U.innerType,w),Y.ref=U.innerType;break}case"lazy":{let O=$._zod.innerType;this.process(O,w),Y.ref=O;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}let H=this.metadataRegistry.get($);if(H)Object.assign(Y.schema,H);if(this.io==="input"&&U.type==="pipe"){if(delete Y.schema.examples,delete Y.schema.default,Y.schema._prefault)Y.schema.default=Y.schema._prefault}if(this.io==="input"&&Y.schema._prefault)(W=Y.schema).default??(W.default=Y.schema._prefault);return delete Y.schema._prefault,this.seen.get($).schema}emit($,T){let W={cycles:T?.cycles??"ref",reused:T?.reused??"inline",external:T?.external??void 0},U=this.seen.get($);if(!U)throw new Error("Unprocessed schema. This is a bug in Zod.");let X=(z)=>{let F=this.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let V=W.external.registry.get(z[0])?.id;if(V)return{ref:W.external.uri(V)};let E=z[1].defId??z[1].schema.id??`schema${this.counter++}`;return z[1].defId=E,{defId:E,ref:`${W.external.uri("__shared")}#/${F}/${E}`}}if(z[1]===U)return{ref:"#"};let Q=`${"#"}/${F}/`,Z=z[1].schema.id??`__schema${this.counter++}`;return{defId:Z,ref:Q+Z}},Y=(z)=>{if(z[1].schema.$ref)return;let F=z[1],{ref:O,defId:Q}=X(z);if(F.def={...F.schema},Q)F.defId=Q;let Z=F.schema;for(let V in Z)delete Z[V];Z.$ref=O};for(let z of this.seen.entries()){let F=z[1];if($===z[0]){Y(z);continue}if(W.external){let Q=W.external.registry.get(z[0])?.id;if($!==z[0]&&Q){Y(z);continue}}if(this.metadataRegistry.get(z[0])?.id){Y(z);continue}if(F.cycle){if(W.cycles==="throw")throw new Error(`Cycle detected: #/${F.cycle?.join("/")}/<root>
|
|
30
|
+
path: iss.path ? [${cT(R)}, ...iss.path] : [${cT(R)}]
|
|
31
|
+
})));`),Q.write(`newResult[${cT(R)}] = ${_}.value`)}Q.write("payload.value = newResult;"),Q.write("return payload;");let L=Q.compile();return(R,_)=>L(O,R,_)},X,U=wY,Y=!qX.jitless,H=Y&&az.value,{catchall:z}=T,F;$._zod.parse=(O,Q)=>{F??(F=W.value);let Z=O.value;if(!U(Z))return O.issues.push({expected:"object",code:"invalid_type",input:Z,inst:$}),O;let K=[];if(Y&&H&&Q?.async===!1&&Q.jitless!==!0){if(!X)X=w(T.shape);O=X(O,Q)}else{O.value={};let _=F.shape;for(let S of F.keys){let x=_[S],b=x._zod.run({value:Z[S],issues:[]},Q),g=x._zod.optin==="optional"&&x._zod.optout==="optional";if(b instanceof Promise)K.push(b.then((T$)=>g?rV(T$,O,S,Z):KY(T$,O,S)));else if(g)rV(b,O,S,Z);else KY(b,O,S)}}if(!z)return K.length?Promise.all(K).then(()=>O):O;let E=[],M=F.keySet,L=z._zod,R=L.def.type;for(let _ of Object.keys(Z)){if(M.has(_))continue;if(R==="never"){E.push(_);continue}let S=L.run({value:Z[_],issues:[]},Q);if(S instanceof Promise)K.push(S.then((x)=>KY(x,O,_)));else KY(S,O,_)}if(E.length)O.issues.push({code:"unrecognized_keys",keys:E,input:Z,inst:$});if(!K.length)return O;return Promise.all(K).then(()=>{return O})}});function nV($,T,W,w){for(let X of $)if(X.issues.length===0)return T.value=X.value,T;return T.issues.push({code:"invalid_union",input:T.value,inst:W,errors:$.map((X)=>X.issues.map((U)=>s6(U,w,N4())))}),T}var DY=k("$ZodUnion",($,T)=>{K$.init($,T),c$($._zod,"values",()=>{if(T.options.every((W)=>W._zod.values))return new Set(T.options.flatMap((W)=>Array.from(W._zod.values)));return}),c$($._zod,"pattern",()=>{if(T.options.every((W)=>W._zod.pattern)){let W=T.options.map((w)=>w._zod.pattern);return new RegExp(`^(${W.map((w)=>jX(w.source)).join("|")})$`)}return}),$._zod.parse=(W,w)=>{let X=!1,U=[];for(let Y of T.options){let G=Y._zod.run({value:W.value,issues:[]},w);if(G instanceof Promise)U.push(G),X=!0;else{if(G.issues.length===0)return G;U.push(G)}}if(!X)return nV(U,W,$,w);return Promise.all(U).then((Y)=>{return nV(Y,W,$,w)})}}),b7=k("$ZodDiscriminatedUnion",($,T)=>{DY.init($,T);let W=$._zod.parse;c$($._zod,"propValues",()=>{let X={};for(let U of T.options){let Y=U._zod.propValues;if(console.dir(Y,{depth:null}),!Y||Object.keys(Y).length===0)throw new Error(`Invalid discriminated union option at index "${T.options.indexOf(U)}"`);for(let[G,H]of Object.entries(Y)){if(!X[G])X[G]=new Set;for(let z of H)X[G].add(z)}}return X});let w=SX(()=>{let X=T.options,U=new Map;for(let Y of X){let G=Y._zod.propValues[T.discriminator];if(!G||G.size===0)throw new Error(`Invalid discriminated union option at index "${T.options.indexOf(Y)}"`);for(let H of G){if(U.has(H))throw new Error(`Duplicate discriminator value "${String(H)}"`);U.set(H,Y)}}return U});$._zod.parse=(X,U)=>{let Y=X.value;if(!wY(Y))return X.issues.push({code:"invalid_type",expected:"object",input:Y,inst:$}),X;let G=w.value.get(Y?.[T.discriminator]);if(G)return G._zod.run(X,U);if(T.unionFallback)return W(X,U);return X.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:Y,path:[T.discriminator],inst:$}),X}}),y7=k("$ZodIntersection",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let{value:X}=W,U=T.left._zod.run({value:X,issues:[]},w),Y=T.right._zod.run({value:X,issues:[]},w);if(U instanceof Promise||Y instanceof Promise)return Promise.all([U,Y]).then(([H,z])=>{return iV(W,H,z)});return iV(W,U,Y)}});function T7($,T){if($===T)return{valid:!0,data:$};if($ instanceof Date&&T instanceof Date&&+$===+T)return{valid:!0,data:$};if(IX($)&&IX(T)){let W=Object.keys(T),w=Object.keys($).filter((U)=>W.indexOf(U)!==-1),X={...$,...T};for(let U of w){let Y=T7($[U],T[U]);if(!Y.valid)return{valid:!1,mergeErrorPath:[U,...Y.mergeErrorPath]};X[U]=Y.data}return{valid:!0,data:X}}if(Array.isArray($)&&Array.isArray(T)){if($.length!==T.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let w=0;w<$.length;w++){let X=$[w],U=T[w],Y=T7(X,U);if(!Y.valid)return{valid:!1,mergeErrorPath:[w,...Y.mergeErrorPath]};W.push(Y.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function iV($,T,W){if(T.issues.length)$.issues.push(...T.issues);if(W.issues.length)$.issues.push(...W.issues);if(uT($))return $;let w=T7(T.value,W.value);if(!w.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(w.mergeErrorPath)}`);return $.value=w.data,$}var oT=k("$ZodTuple",($,T)=>{K$.init($,T);let W=T.items,w=W.length-[...W].reverse().findIndex((X)=>X._zod.optin!=="optional");$._zod.parse=(X,U)=>{let Y=X.value;if(!Array.isArray(Y))return X.issues.push({input:Y,inst:$,expected:"tuple",code:"invalid_type"}),X;X.value=[];let G=[];if(!T.rest){let z=Y.length>W.length,F=Y.length<w-1;if(z||F)return X.issues.push({input:Y,inst:$,origin:"array",...z?{code:"too_big",maximum:W.length}:{code:"too_small",minimum:W.length}}),X}let H=-1;for(let z of W){if(H++,H>=Y.length){if(H>=w)continue}let F=z._zod.run({value:Y[H],issues:[]},U);if(F instanceof Promise)G.push(F.then((O)=>AY(O,X,H)));else AY(F,X,H)}if(T.rest){let z=Y.slice(W.length);for(let F of z){H++;let O=T.rest._zod.run({value:F,issues:[]},U);if(O instanceof Promise)G.push(O.then((Q)=>AY(Q,X,H)));else AY(O,X,H)}}if(G.length)return Promise.all(G).then(()=>X);return X}});function AY($,T,W){if($.issues.length)T.issues.push(...I6(W,$.issues));T.value[W]=$.value}var h7=k("$ZodRecord",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let X=W.value;if(!IX(X))return W.issues.push({expected:"record",code:"invalid_type",input:X,inst:$}),W;let U=[];if(T.keyType._zod.values){let Y=T.keyType._zod.values;W.value={};for(let H of Y)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let z=T.valueType._zod.run({value:X[H],issues:[]},w);if(z instanceof Promise)U.push(z.then((F)=>{if(F.issues.length)W.issues.push(...I6(H,F.issues));W.value[H]=F.value}));else{if(z.issues.length)W.issues.push(...I6(H,z.issues));W.value[H]=z.value}}let G;for(let H in X)if(!Y.has(H))G=G??[],G.push(H);if(G&&G.length>0)W.issues.push({code:"unrecognized_keys",input:X,inst:$,keys:G})}else{W.value={};for(let Y of Reflect.ownKeys(X)){if(Y==="__proto__")continue;let G=T.keyType._zod.run({value:Y,issues:[]},w);if(G instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(G.issues.length){W.issues.push({origin:"record",code:"invalid_key",issues:G.issues.map((z)=>s6(z,w,N4())),input:Y,path:[Y],inst:$}),W.value[G.value]=G.value;continue}let H=T.valueType._zod.run({value:X[Y],issues:[]},w);if(H instanceof Promise)U.push(H.then((z)=>{if(z.issues.length)W.issues.push(...I6(Y,z.issues));W.value[G.value]=z.value}));else{if(H.issues.length)W.issues.push(...I6(Y,H.issues));W.value[G.value]=H.value}}}if(U.length)return Promise.all(U).then(()=>W);return W}}),g7=k("$ZodMap",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let X=W.value;if(!(X instanceof Map))return W.issues.push({expected:"map",code:"invalid_type",input:X,inst:$}),W;let U=[];W.value=new Map;for(let[Y,G]of X){let H=T.keyType._zod.run({value:Y,issues:[]},w),z=T.valueType._zod.run({value:G,issues:[]},w);if(H instanceof Promise||z instanceof Promise)U.push(Promise.all([H,z]).then(([F,O])=>{tV(F,O,W,Y,X,$,w)}));else tV(H,z,W,Y,X,$,w)}if(U.length)return Promise.all(U).then(()=>W);return W}});function tV($,T,W,w,X,U,Y){if($.issues.length)if(BX.has(typeof w))W.issues.push(...I6(w,$.issues));else W.issues.push({origin:"map",code:"invalid_key",input:X,inst:U,issues:$.issues.map((G)=>s6(G,Y,N4()))});if(T.issues.length)if(BX.has(typeof w))W.issues.push(...I6(w,T.issues));else W.issues.push({origin:"map",code:"invalid_element",input:X,inst:U,key:w,issues:T.issues.map((G)=>s6(G,Y,N4()))});W.value.set($.value,T.value)}var m7=k("$ZodSet",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let X=W.value;if(!(X instanceof Set))return W.issues.push({input:X,inst:$,expected:"set",code:"invalid_type"}),W;let U=[];W.value=new Set;for(let Y of X){let G=T.valueType._zod.run({value:Y,issues:[]},w);if(G instanceof Promise)U.push(G.then((H)=>aV(H,W)));else aV(G,W)}if(U.length)return Promise.all(U).then(()=>W);return W}});function aV($,T){if($.issues.length)T.issues.push(...$.issues);T.value.add($.value)}var c7=k("$ZodEnum",($,T)=>{K$.init($,T);let W=CX(T.entries);$._zod.values=new Set(W),$._zod.pattern=new RegExp(`^(${W.filter((w)=>BX.has(typeof w)).map((w)=>typeof w==="string"?Q0(w):w.toString()).join("|")})$`),$._zod.parse=(w,X)=>{let U=w.value;if($._zod.values.has(U))return w;return w.issues.push({code:"invalid_value",values:W,input:U,inst:$}),w}}),u7=k("$ZodLiteral",($,T)=>{K$.init($,T),$._zod.values=new Set(T.values),$._zod.pattern=new RegExp(`^(${T.values.map((W)=>typeof W==="string"?Q0(W):W?W.toString():String(W)).join("|")})$`),$._zod.parse=(W,w)=>{let X=W.value;if($._zod.values.has(X))return W;return W.issues.push({code:"invalid_value",values:T.values,input:X,inst:$}),W}}),p7=k("$ZodFile",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let X=W.value;if(X instanceof File)return W;return W.issues.push({expected:"file",code:"invalid_type",input:X,inst:$}),W}}),d7=k("$ZodTransform",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let X=T.transform(W.value,W);if(w.async)return(X instanceof Promise?X:Promise.resolve(X)).then((Y)=>{return W.value=Y,W});if(X instanceof Promise)throw new O0;return W.value=X,W}}),o7=k("$ZodOptional",($,T)=>{K$.init($,T),$._zod.optin="optional",$._zod.optout="optional",c$($._zod,"values",()=>{return T.innerType._zod.values?new Set([...T.innerType._zod.values,void 0]):void 0}),c$($._zod,"pattern",()=>{let W=T.innerType._zod.pattern;return W?new RegExp(`^(${jX(W.source)})?$`):void 0}),$._zod.parse=(W,w)=>{if(W.value===void 0)return W;return T.innerType._zod.run(W,w)}}),l7=k("$ZodNullable",($,T)=>{K$.init($,T),c$($._zod,"optin",()=>T.innerType._zod.optin),c$($._zod,"optout",()=>T.innerType._zod.optout),c$($._zod,"pattern",()=>{let W=T.innerType._zod.pattern;return W?new RegExp(`^(${jX(W.source)}|null)$`):void 0}),c$($._zod,"values",()=>{return T.innerType._zod.values?new Set([...T.innerType._zod.values,null]):void 0}),$._zod.parse=(W,w)=>{if(W.value===null)return W;return T.innerType._zod.run(W,w)}}),r7=k("$ZodDefault",($,T)=>{K$.init($,T),$._zod.optin="optional",c$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,w)=>{if(W.value===void 0)return W.value=T.defaultValue,W;let X=T.innerType._zod.run(W,w);if(X instanceof Promise)return X.then((U)=>sV(U,T));return sV(X,T)}});function sV($,T){if($.value===void 0)$.value=T.defaultValue;return $}var n7=k("$ZodPrefault",($,T)=>{K$.init($,T),$._zod.optin="optional",c$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,w)=>{if(W.value===void 0)W.value=T.defaultValue;return T.innerType._zod.run(W,w)}}),i7=k("$ZodNonOptional",($,T)=>{K$.init($,T),c$($._zod,"values",()=>{let W=T.innerType._zod.values;return W?new Set([...W].filter((w)=>w!==void 0)):void 0}),$._zod.parse=(W,w)=>{let X=T.innerType._zod.run(W,w);if(X instanceof Promise)return X.then((U)=>eV(U,$));return eV(X,$)}});function eV($,T){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:T});return $}var t7=k("$ZodSuccess",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{let X=T.innerType._zod.run(W,w);if(X instanceof Promise)return X.then((U)=>{return W.value=U.issues.length===0,W});return W.value=X.issues.length===0,W}}),a7=k("$ZodCatch",($,T)=>{K$.init($,T),c$($._zod,"optin",()=>T.innerType._zod.optin),c$($._zod,"optout",()=>T.innerType._zod.optout),c$($._zod,"values",()=>T.innerType._zod.values),$._zod.parse=(W,w)=>{let X=T.innerType._zod.run(W,w);if(X instanceof Promise)return X.then((U)=>{if(W.value=U.value,U.issues.length)W.value=T.catchValue({...W,error:{issues:U.issues.map((Y)=>s6(Y,w,N4()))},input:W.value}),W.issues=[];return W});if(W.value=X.value,X.issues.length)W.value=T.catchValue({...W,error:{issues:X.issues.map((U)=>s6(U,w,N4()))},input:W.value}),W.issues=[];return W}}),s7=k("$ZodNaN",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{if(typeof W.value!=="number"||!Number.isNaN(W.value))return W.issues.push({input:W.value,inst:$,expected:"nan",code:"invalid_type"}),W;return W}}),uX=k("$ZodPipe",($,T)=>{K$.init($,T),c$($._zod,"values",()=>T.in._zod.values),c$($._zod,"optin",()=>T.in._zod.optin),c$($._zod,"optout",()=>T.out._zod.optout),$._zod.parse=(W,w)=>{let X=T.in._zod.run(W,w);if(X instanceof Promise)return X.then((U)=>$K(U,T,w));return $K(X,T,w)}});function $K($,T,W){if(uT($))return $;return T.out._zod.run({value:$.value,issues:$.issues},W)}var e7=k("$ZodReadonly",($,T)=>{K$.init($,T),c$($._zod,"propValues",()=>T.innerType._zod.propValues),c$($._zod,"optin",()=>T.innerType._zod.optin),c$($._zod,"optout",()=>T.innerType._zod.optout),$._zod.parse=(W,w)=>{let X=T.innerType._zod.run(W,w);if(X instanceof Promise)return X.then(TK);return TK(X)}});function TK($){return $.value=Object.freeze($.value),$}var $3=k("$ZodTemplateLiteral",($,T)=>{K$.init($,T);let W=[];for(let w of T.parts)if(w instanceof K$){if(!w._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...w._zod.traits].shift()}`);let X=w._zod.pattern instanceof RegExp?w._zod.pattern.source:w._zod.pattern;if(!X)throw new Error(`Invalid template literal part: ${w._zod.traits}`);let U=X.startsWith("^")?1:0,Y=X.endsWith("$")?X.length-1:X.length;W.push(X.slice(U,Y))}else if(w===null||sz.has(typeof w))W.push(Q0(`${w}`));else throw new Error(`Invalid template literal part: ${w}`);$._zod.pattern=new RegExp(`^${W.join("")}$`),$._zod.parse=(w,X)=>{if(typeof w.value!=="string")return w.issues.push({input:w.value,inst:$,expected:"template_literal",code:"invalid_type"}),w;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(w.value))return w.issues.push({input:w.value,inst:$,code:"invalid_format",format:"template_literal",pattern:$._zod.pattern.source}),w;return w}}),T3=k("$ZodPromise",($,T)=>{K$.init($,T),$._zod.parse=(W,w)=>{return Promise.resolve(W.value).then((X)=>T.innerType._zod.run({value:X,issues:[]},w))}}),W3=k("$ZodLazy",($,T)=>{K$.init($,T),c$($._zod,"innerType",()=>T.getter()),c$($._zod,"pattern",()=>$._zod.innerType._zod.pattern),c$($._zod,"propValues",()=>$._zod.innerType._zod.propValues),c$($._zod,"optin",()=>$._zod.innerType._zod.optin),c$($._zod,"optout",()=>$._zod.innerType._zod.optout),$._zod.parse=(W,w)=>{return $._zod.innerType._zod.run(W,w)}}),X3=k("$ZodCustom",($,T)=>{z4.init($,T),K$.init($,T),$._zod.parse=(W,w)=>{return W},$._zod.check=(W)=>{let w=W.value,X=T.fn(w);if(X instanceof Promise)return X.then((U)=>WK(U,W,w,$));WK(X,W,w,$);return}});function WK($,T,W,w){if(!$){let X={code:"custom",input:W,inst:w,path:[...w._zod.def.path??[]],continue:!w._zod.def.abort};if(w._zod.def.params)X.params=w._zod.def.params;T.issues.push(W5(X))}}var dX={};e0(dX,{zhTW:()=>g3,zhCN:()=>h3,vi:()=>y3,ur:()=>b3,ua:()=>f3,tr:()=>x3,th:()=>B3,ta:()=>I3,sv:()=>j3,sl:()=>S3,ru:()=>C3,pt:()=>P3,pl:()=>q3,ota:()=>v3,no:()=>k3,nl:()=>_3,ms:()=>R3,mk:()=>J3,ko:()=>L3,kh:()=>N3,ja:()=>D3,it:()=>M3,id:()=>E3,hu:()=>A3,he:()=>K3,frCA:()=>V3,fr:()=>Z3,fi:()=>Q3,fa:()=>O3,es:()=>F3,en:()=>pX,de:()=>H3,cs:()=>z3,ca:()=>G3,be:()=>Y3,az:()=>U3,ar:()=>w3});var pq=()=>{let $={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return(X)=>{switch(X.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${X.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${i(X.values[0])}`;return`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${X.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${U} ${X.maximum.toString()} ${Y.unit??"\u0639\u0646\u0635\u0631"}`;return`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${X.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${U} ${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${X.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${U} ${X.minimum.toString()} ${Y.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${X.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${U} ${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${X.prefix}"`;if(U.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${U.suffix}"`;if(U.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${U.includes}"`;if(U.format==="regex")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${U.pattern}`;return`${w[U.format]??X.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${X.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${X.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${X.keys.length>1?"\u0629":""}: ${f(X.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${X.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${X.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function w3(){return{localeError:pq()}}var dq=()=>{let $={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${X.expected}, daxil olan ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i(X.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${X.origin??"d\u0259y\u0259r"} ${U}${X.maximum.toString()} ${Y.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${X.origin??"d\u0259y\u0259r"} ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${X.origin} ${U}${X.minimum.toString()} ${Y.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${X.origin} ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${U.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(U.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${U.suffix}" il\u0259 bitm\u0259lidir`;if(U.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${U.includes}" daxil olmal\u0131d\u0131r`;if(U.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${U.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${w[U.format]??X.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${X.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${X.keys.length>1?"lar":""}: ${f(X.keys,", ")}`;case"invalid_key":return`${X.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${X.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function U3(){return{localeError:dq()}}function YK($,T,W,w){let X=Math.abs($),U=X%10,Y=X%100;if(Y>=11&&Y<=19)return w;if(U===1)return T;if(U>=2&&U<=4)return W;return w}var oq=()=>{let $={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(X))return"\u043C\u0430\u0441\u0456\u045E";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return(X)=>{switch(X.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${X.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${i(X.values[0])}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y){let G=Number(X.maximum),H=YK(G,Y.unit.one,Y.unit.few,Y.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${X.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${Y.verb} ${U}${X.maximum.toString()} ${H}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${X.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y){let G=Number(X.minimum),H=YK(G,Y.unit.one,Y.unit.few,Y.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${X.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${Y.verb} ${U}${X.minimum.toString()} ${H}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${X.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${U.prefix}"`;if(U.format==="ends_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${U.suffix}"`;if(U.format==="includes")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${U.includes}"`;if(U.format==="regex")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${U.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${w[U.format]??X.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${X.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${X.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${f(X.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${X.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${X.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function Y3(){return{localeError:oq()}}var lq=()=>{let $={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(X)=>{switch(X.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${X.expected}, s'ha rebut ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Valor inv\xE0lid: s'esperava ${i(X.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${f(X.values," o ")}`;case"too_big":{let U=X.inclusive?"com a m\xE0xim":"menys de",Y=T(X.origin);if(Y)return`Massa gran: s'esperava que ${X.origin??"el valor"} contingu\xE9s ${U} ${X.maximum.toString()} ${Y.unit??"elements"}`;return`Massa gran: s'esperava que ${X.origin??"el valor"} fos ${U} ${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?"com a m\xEDnim":"m\xE9s de",Y=T(X.origin);if(Y)return`Massa petit: s'esperava que ${X.origin} contingu\xE9s ${U} ${X.minimum.toString()} ${Y.unit}`;return`Massa petit: s'esperava que ${X.origin} fos ${U} ${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${U.prefix}"`;if(U.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${U.suffix}"`;if(U.format==="includes")return`Format inv\xE0lid: ha d'incloure "${U.includes}"`;if(U.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${U.pattern}`;return`Format inv\xE0lid per a ${w[U.format]??X.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${X.divisor}`;case"unrecognized_keys":return`Clau${X.keys.length>1?"s":""} no reconeguda${X.keys.length>1?"s":""}: ${f(X.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${X.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${X.origin}`;default:return"Entrada inv\xE0lida"}}};function G3(){return{localeError:lq()}}var rq=()=>{let $={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(X))return"pole";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return(X)=>{switch(X.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${X.expected}, obdr\u017Eeno ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i(X.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${X.origin??"hodnota"} mus\xED m\xEDt ${U}${X.maximum.toString()} ${Y.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${X.origin??"hodnota"} mus\xED b\xFDt ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${X.origin??"hodnota"} mus\xED m\xEDt ${U}${X.minimum.toString()} ${Y.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${X.origin??"hodnota"} mus\xED b\xFDt ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${U.prefix}"`;if(U.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${U.suffix}"`;if(U.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${U.includes}"`;if(U.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${U.pattern}`;return`Neplatn\xFD form\xE1t ${w[U.format]??X.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${X.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${f(X.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${X.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${X.origin}`;default:return"Neplatn\xFD vstup"}}};function z3(){return{localeError:rq()}}var nq=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"Zahl";case"object":{if(Array.isArray(X))return"Array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(X)=>{switch(X.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${X.expected}, erhalten ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${i(X.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Zu gro\xDF: erwartet, dass ${X.origin??"Wert"} ${U}${X.maximum.toString()} ${Y.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${X.origin??"Wert"} ${U}${X.maximum.toString()} ist`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Zu klein: erwartet, dass ${X.origin} ${U}${X.minimum.toString()} ${Y.unit} hat`;return`Zu klein: erwartet, dass ${X.origin} ${U}${X.minimum.toString()} ist`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Ung\xFCltiger String: muss mit "${U.prefix}" beginnen`;if(U.format==="ends_with")return`Ung\xFCltiger String: muss mit "${U.suffix}" enden`;if(U.format==="includes")return`Ung\xFCltiger String: muss "${U.includes}" enthalten`;if(U.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${U.pattern} entsprechen`;return`Ung\xFCltig: ${w[U.format]??X.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${X.divisor} sein`;case"unrecognized_keys":return`${X.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${f(X.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${X.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${X.origin}`;default:return"Ung\xFCltige Eingabe"}}};function H3(){return{localeError:nq()}}var iq=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},tq=()=>{let $={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function T(w){return $[w]??null}let W={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(w)=>{switch(w.code){case"invalid_type":return`Invalid input: expected ${w.expected}, received ${iq(w.input)}`;case"invalid_value":if(w.values.length===1)return`Invalid input: expected ${i(w.values[0])}`;return`Invalid option: expected one of ${f(w.values,"|")}`;case"too_big":{let X=w.inclusive?"<=":"<",U=T(w.origin);if(U)return`Too big: expected ${w.origin??"value"} to have ${X}${w.maximum.toString()} ${U.unit??"elements"}`;return`Too big: expected ${w.origin??"value"} to be ${X}${w.maximum.toString()}`}case"too_small":{let X=w.inclusive?">=":">",U=T(w.origin);if(U)return`Too small: expected ${w.origin} to have ${X}${w.minimum.toString()} ${U.unit}`;return`Too small: expected ${w.origin} to be ${X}${w.minimum.toString()}`}case"invalid_format":{let X=w;if(X.format==="starts_with")return`Invalid string: must start with "${X.prefix}"`;if(X.format==="ends_with")return`Invalid string: must end with "${X.suffix}"`;if(X.format==="includes")return`Invalid string: must include "${X.includes}"`;if(X.format==="regex")return`Invalid string: must match pattern ${X.pattern}`;return`Invalid ${W[X.format]??w.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${w.divisor}`;case"unrecognized_keys":return`Unrecognized key${w.keys.length>1?"s":""}: ${f(w.keys,", ")}`;case"invalid_key":return`Invalid key in ${w.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${w.origin}`;default:return"Invalid input"}}};function pX(){return{localeError:tq()}}var aq=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(X))return"arreglo";if(X===null)return"nulo";if(Object.getPrototypeOf(X)!==Object.prototype)return X.constructor.name}}return U},w={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(X)=>{switch(X.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${X.expected}, recibido ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Entrada inv\xE1lida: se esperaba ${i(X.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Demasiado grande: se esperaba que ${X.origin??"valor"} tuviera ${U}${X.maximum.toString()} ${Y.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${X.origin??"valor"} fuera ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Demasiado peque\xF1o: se esperaba que ${X.origin} tuviera ${U}${X.minimum.toString()} ${Y.unit}`;return`Demasiado peque\xF1o: se esperaba que ${X.origin} fuera ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${U.prefix}"`;if(U.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${U.suffix}"`;if(U.format==="includes")return`Cadena inv\xE1lida: debe incluir "${U.includes}"`;if(U.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${U.pattern}`;return`Inv\xE1lido ${w[U.format]??X.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${X.divisor}`;case"unrecognized_keys":return`Llave${X.keys.length>1?"s":""} desconocida${X.keys.length>1?"s":""}: ${f(X.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${X.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${X.origin}`;default:return"Entrada inv\xE1lida"}}};function F3(){return{localeError:aq()}}var sq=()=>{let $={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(X))return"\u0622\u0631\u0627\u06CC\u0647";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return(X)=>{switch(X.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${X.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${W(X.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":if(X.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i(X.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${f(X.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${X.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${U}${X.maximum.toString()} ${Y.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${X.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${U}${X.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${X.origin} \u0628\u0627\u06CC\u062F ${U}${X.minimum.toString()} ${Y.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${X.origin} \u0628\u0627\u06CC\u062F ${U}${X.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${U.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(U.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${U.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(U.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${U.includes}" \u0628\u0627\u0634\u062F`;if(U.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${U.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${w[U.format]??X.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${X.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${X.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${f(X.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${X.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${X.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function O3(){return{localeError:sq()}}var eq=()=>{let $={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(X)=>{switch(X.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${X.expected}, oli ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${i(X.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Liian suuri: ${Y.subject} t\xE4ytyy olla ${U}${X.maximum.toString()} ${Y.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Liian pieni: ${Y.subject} t\xE4ytyy olla ${U}${X.minimum.toString()} ${Y.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${U.prefix}"`;if(U.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${U.suffix}"`;if(U.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${U.includes}"`;if(U.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${U.pattern}`;return`Virheellinen ${w[U.format]??X.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${X.divisor} monikerta`;case"unrecognized_keys":return`${X.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${f(X.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function Q3(){return{localeError:eq()}}var $P=()=>{let $={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"nombre";case"object":{if(Array.isArray(X))return"tableau";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return(X)=>{switch(X.code){case"invalid_type":return`Entr\xE9e invalide : ${X.expected} attendu, ${W(X.input)} re\xE7u`;case"invalid_value":if(X.values.length===1)return`Entr\xE9e invalide : ${i(X.values[0])} attendu`;return`Option invalide : une valeur parmi ${f(X.values,"|")} attendue`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Trop grand : ${X.origin??"valeur"} doit ${Y.verb} ${U}${X.maximum.toString()} ${Y.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${X.origin??"valeur"} doit \xEAtre ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Trop petit : ${X.origin} doit ${Y.verb} ${U}${X.minimum.toString()} ${Y.unit}`;return`Trop petit : ${X.origin} doit \xEAtre ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${U.prefix}"`;if(U.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${U.suffix}"`;if(U.format==="includes")return`Cha\xEEne invalide : doit inclure "${U.includes}"`;if(U.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${U.pattern}`;return`${w[U.format]??X.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${X.divisor}`;case"unrecognized_keys":return`Cl\xE9${X.keys.length>1?"s":""} non reconnue${X.keys.length>1?"s":""} : ${f(X.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${X.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${X.origin}`;default:return"Entr\xE9e invalide"}}};function Z3(){return{localeError:$P()}}var TP=()=>{let $={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return(X)=>{switch(X.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${X.expected}, re\xE7u ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Entr\xE9e invalide : attendu ${i(X.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"\u2264":"<",Y=T(X.origin);if(Y)return`Trop grand : attendu que ${X.origin??"la valeur"} ait ${U}${X.maximum.toString()} ${Y.unit}`;return`Trop grand : attendu que ${X.origin??"la valeur"} soit ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?"\u2265":">",Y=T(X.origin);if(Y)return`Trop petit : attendu que ${X.origin} ait ${U}${X.minimum.toString()} ${Y.unit}`;return`Trop petit : attendu que ${X.origin} soit ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${U.prefix}"`;if(U.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${U.suffix}"`;if(U.format==="includes")return`Cha\xEEne invalide : doit inclure "${U.includes}"`;if(U.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${U.pattern}`;return`${w[U.format]??X.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${X.divisor}`;case"unrecognized_keys":return`Cl\xE9${X.keys.length>1?"s":""} non reconnue${X.keys.length>1?"s":""} : ${f(X.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${X.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${X.origin}`;default:return"Entr\xE9e invalide"}}};function V3(){return{localeError:TP()}}var WP=()=>{let $={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return(X)=>{switch(X.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${X.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${i(X.values[0])}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${X.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${U}${X.maximum.toString()} ${Y.unit??"elements"}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${X.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${X.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${U}${X.minimum.toString()} ${Y.unit}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${X.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${U.prefix}"`;if(U.format==="ends_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${U.suffix}"`;if(U.format==="includes")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${U.includes}"`;if(U.format==="regex")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${U.pattern}`;return`${w[U.format]??X.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${X.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${X.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${X.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${f(X.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${X.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${X.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function K3(){return{localeError:WP()}}var XP=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(X))return"t\xF6mb";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return(X)=>{switch(X.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${X.expected}, a kapott \xE9rt\xE9k ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i(X.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`T\xFAl nagy: ${X.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${U}${X.maximum.toString()} ${Y.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${X.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${X.origin} m\xE9rete t\xFAl kicsi ${U}${X.minimum.toString()} ${Y.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${X.origin} t\xFAl kicsi ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\xC9rv\xE9nytelen string: "${U.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(U.format==="ends_with")return`\xC9rv\xE9nytelen string: "${U.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(U.format==="includes")return`\xC9rv\xE9nytelen string: "${U.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(U.format==="regex")return`\xC9rv\xE9nytelen string: ${U.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${w[U.format]??X.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${X.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${X.keys.length>1?"s":""}: ${f(X.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${X.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${X.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function A3(){return{localeError:XP()}}var wP=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Input tidak valid: diharapkan ${X.expected}, diterima ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input tidak valid: diharapkan ${i(X.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Terlalu besar: diharapkan ${X.origin??"value"} memiliki ${U}${X.maximum.toString()} ${Y.unit??"elemen"}`;return`Terlalu besar: diharapkan ${X.origin??"value"} menjadi ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Terlalu kecil: diharapkan ${X.origin} memiliki ${U}${X.minimum.toString()} ${Y.unit}`;return`Terlalu kecil: diharapkan ${X.origin} menjadi ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`String tidak valid: harus dimulai dengan "${U.prefix}"`;if(U.format==="ends_with")return`String tidak valid: harus berakhir dengan "${U.suffix}"`;if(U.format==="includes")return`String tidak valid: harus menyertakan "${U.includes}"`;if(U.format==="regex")return`String tidak valid: harus sesuai pola ${U.pattern}`;return`${w[U.format]??X.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${X.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${X.keys.length>1?"s":""}: ${f(X.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${X.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${X.origin}`;default:return"Input tidak valid"}}};function E3(){return{localeError:wP()}}var UP=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"numero";case"object":{if(Array.isArray(X))return"vettore";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Input non valido: atteso ${X.expected}, ricevuto ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input non valido: atteso ${i(X.values[0])}`;return`Opzione non valida: atteso uno tra ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Troppo grande: ${X.origin??"valore"} deve avere ${U}${X.maximum.toString()} ${Y.unit??"elementi"}`;return`Troppo grande: ${X.origin??"valore"} deve essere ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Troppo piccolo: ${X.origin} deve avere ${U}${X.minimum.toString()} ${Y.unit}`;return`Troppo piccolo: ${X.origin} deve essere ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Stringa non valida: deve iniziare con "${U.prefix}"`;if(U.format==="ends_with")return`Stringa non valida: deve terminare con "${U.suffix}"`;if(U.format==="includes")return`Stringa non valida: deve includere "${U.includes}"`;if(U.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${U.pattern}`;return`Invalid ${w[U.format]??X.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${X.divisor}`;case"unrecognized_keys":return`Chiav${X.keys.length>1?"i":"e"} non riconosciut${X.keys.length>1?"e":"a"}: ${f(X.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${X.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${X.origin}`;default:return"Input non valido"}}};function M3(){return{localeError:UP()}}var YP=()=>{let $={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(X))return"\u914D\u5217";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return(X)=>{switch(X.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${X.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${W(X.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":if(X.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${i(X.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${f(X.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${X.origin??"\u5024"}\u306F${X.maximum.toString()}${Y.unit??"\u8981\u7D20"}${U}\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${X.origin??"\u5024"}\u306F${X.maximum.toString()}${U}\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${X.origin}\u306F${X.minimum.toString()}${Y.unit}${U}\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${X.origin}\u306F${X.minimum.toString()}${U}\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${U.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(U.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${U.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(U.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${U.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(U.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${U.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${w[U.format]??X.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${X.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${X.keys.length>1?"\u7FA4":""}: ${f(X.keys,"\u3001")}`;case"invalid_key":return`${X.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${X.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function D3(){return{localeError:YP()}}var GP=()=>{let $={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(X))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(X===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return(X)=>{switch(X.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i(X.values[0])}`;return`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${U} ${X.maximum.toString()} ${Y.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${U} ${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.origin} ${U} ${X.minimum.toString()} ${Y.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${X.origin} ${U} ${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${U.prefix}"`;if(U.format==="ends_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${U.suffix}"`;if(U.format==="includes")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${U.includes}"`;if(U.format==="regex")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${U.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${w[U.format]??X.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${X.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${f(X.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${X.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${X.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function N3(){return{localeError:GP()}}var zP=()=>{let $={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return(X)=>{switch(X.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${X.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${W(X.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":if(X.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${i(X.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${f(X.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let U=X.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",Y=U==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",G=T(X.origin),H=G?.unit??"\uC694\uC18C";if(G)return`${X.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${X.maximum.toString()}${H} ${U}${Y}`;return`${X.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${X.maximum.toString()} ${U}${Y}`}case"too_small":{let U=X.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",Y=U==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",G=T(X.origin),H=G?.unit??"\uC694\uC18C";if(G)return`${X.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${X.minimum.toString()}${H} ${U}${Y}`;return`${X.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${X.minimum.toString()} ${U}${Y}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${U.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(U.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${U.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(U.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${U.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(U.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${U.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${w[U.format]??X.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${X.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${f(X.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${X.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${X.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function L3(){return{localeError:zP()}}var HP=()=>{let $={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(X))return"\u043D\u0438\u0437\u0430";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return(X)=>{switch(X.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Invalid input: expected ${i(X.values[0])}`;return`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${U}${X.maximum.toString()} ${Y.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.origin} \u0434\u0430 \u0438\u043C\u0430 ${U}${X.minimum.toString()} ${Y.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${X.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${U.prefix}"`;if(U.format==="ends_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${U.suffix}"`;if(U.format==="includes")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${U.includes}"`;if(U.format==="regex")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${U.pattern}`;return`Invalid ${w[U.format]??X.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${X.divisor}`;case"unrecognized_keys":return`${X.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${f(X.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${X.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${X.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function J3(){return{localeError:HP()}}var FP=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"nombor";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Input tidak sah: dijangka ${X.expected}, diterima ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Input tidak sah: dijangka ${i(X.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Terlalu besar: dijangka ${X.origin??"nilai"} ${Y.verb} ${U}${X.maximum.toString()} ${Y.unit??"elemen"}`;return`Terlalu besar: dijangka ${X.origin??"nilai"} adalah ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Terlalu kecil: dijangka ${X.origin} ${Y.verb} ${U}${X.minimum.toString()} ${Y.unit}`;return`Terlalu kecil: dijangka ${X.origin} adalah ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`String tidak sah: mesti bermula dengan "${U.prefix}"`;if(U.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${U.suffix}"`;if(U.format==="includes")return`String tidak sah: mesti mengandungi "${U.includes}"`;if(U.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${U.pattern}`;return`${w[U.format]??X.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${X.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${f(X.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${X.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${X.origin}`;default:return"Input tidak sah"}}};function R3(){return{localeError:FP()}}var OP=()=>{let $={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"getal";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(X)=>{switch(X.code){case"invalid_type":return`Ongeldige invoer: verwacht ${X.expected}, ontving ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ongeldige invoer: verwacht ${i(X.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Te lang: verwacht dat ${X.origin??"waarde"} ${U}${X.maximum.toString()} ${Y.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${X.origin??"waarde"} ${U}${X.maximum.toString()} is`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Te kort: verwacht dat ${X.origin} ${U}${X.minimum.toString()} ${Y.unit} bevat`;return`Te kort: verwacht dat ${X.origin} ${U}${X.minimum.toString()} is`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Ongeldige tekst: moet met "${U.prefix}" beginnen`;if(U.format==="ends_with")return`Ongeldige tekst: moet op "${U.suffix}" eindigen`;if(U.format==="includes")return`Ongeldige tekst: moet "${U.includes}" bevatten`;if(U.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${U.pattern}`;return`Ongeldig: ${w[U.format]??X.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${X.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${X.keys.length>1?"s":""}: ${f(X.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${X.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${X.origin}`;default:return"Ongeldige invoer"}}};function _3(){return{localeError:OP()}}var QP=()=>{let $={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"tall";case"object":{if(Array.isArray(X))return"liste";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`Ugyldig input: forventet ${X.expected}, fikk ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ugyldig verdi: forventet ${i(X.values[0])}`;return`Ugyldig valg: forventet en av ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`For stor(t): forventet ${X.origin??"value"} til \xE5 ha ${U}${X.maximum.toString()} ${Y.unit??"elementer"}`;return`For stor(t): forventet ${X.origin??"value"} til \xE5 ha ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`For lite(n): forventet ${X.origin} til \xE5 ha ${U}${X.minimum.toString()} ${Y.unit}`;return`For lite(n): forventet ${X.origin} til \xE5 ha ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${U.prefix}"`;if(U.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${U.suffix}"`;if(U.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${U.includes}"`;if(U.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${U.pattern}`;return`Ugyldig ${w[U.format]??X.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${X.divisor}`;case"unrecognized_keys":return`${X.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${f(X.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${X.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${X.origin}`;default:return"Ugyldig input"}}};function k3(){return{localeError:QP()}}var ZP=()=>{let $={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"numara";case"object":{if(Array.isArray(X))return"saf";if(X===null)return"gayb";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return(X)=>{switch(X.code){case"invalid_type":return`F\xE2sit giren: umulan ${X.expected}, al\u0131nan ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`F\xE2sit giren: umulan ${i(X.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Fazla b\xFCy\xFCk: ${X.origin??"value"}, ${U}${X.maximum.toString()} ${Y.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${X.origin??"value"}, ${U}${X.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Fazla k\xFC\xE7\xFCk: ${X.origin}, ${U}${X.minimum.toString()} ${Y.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${X.origin}, ${U}${X.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`F\xE2sit metin: "${U.prefix}" ile ba\u015Flamal\u0131.`;if(U.format==="ends_with")return`F\xE2sit metin: "${U.suffix}" ile bitmeli.`;if(U.format==="includes")return`F\xE2sit metin: "${U.includes}" ihtiv\xE2 etmeli.`;if(U.format==="regex")return`F\xE2sit metin: ${U.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${w[U.format]??X.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${X.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${X.keys.length>1?"s":""}: ${f(X.keys,", ")}`;case"invalid_key":return`${X.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${X.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function v3(){return{localeError:ZP()}}var VP=()=>{let $={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"liczba";case"object":{if(Array.isArray(X))return"tablica";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return(X)=>{switch(X.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${X.expected}, otrzymano ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i(X.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${X.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${U}${X.maximum.toString()} ${Y.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${X.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${X.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${U}${X.minimum.toString()} ${Y.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${X.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${U.prefix}"`;if(U.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${U.suffix}"`;if(U.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${U.includes}"`;if(U.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${U.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${w[U.format]??X.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${X.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${X.keys.length>1?"s":""}: ${f(X.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${X.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${X.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function q3(){return{localeError:VP()}}var KP=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(X))return"array";if(X===null)return"nulo";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(X)=>{switch(X.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${X.expected}, recebido ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Entrada inv\xE1lida: esperado ${i(X.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Muito grande: esperado que ${X.origin??"valor"} tivesse ${U}${X.maximum.toString()} ${Y.unit??"elementos"}`;return`Muito grande: esperado que ${X.origin??"valor"} fosse ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Muito pequeno: esperado que ${X.origin} tivesse ${U}${X.minimum.toString()} ${Y.unit}`;return`Muito pequeno: esperado que ${X.origin} fosse ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${U.prefix}"`;if(U.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${U.suffix}"`;if(U.format==="includes")return`Texto inv\xE1lido: deve incluir "${U.includes}"`;if(U.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${U.pattern}`;return`${w[U.format]??X.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${X.divisor}`;case"unrecognized_keys":return`Chave${X.keys.length>1?"s":""} desconhecida${X.keys.length>1?"s":""}: ${f(X.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${X.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${X.origin}`;default:return"Campo inv\xE1lido"}}};function P3(){return{localeError:KP()}}function GK($,T,W,w){let X=Math.abs($),U=X%10,Y=X%100;if(Y>=11&&Y<=19)return w;if(U===1)return T;if(U>=2&&U<=4)return W;return w}var AP=()=>{let $={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(X))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return(X)=>{switch(X.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${X.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i(X.values[0])}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y){let G=Number(X.maximum),H=GK(G,Y.unit.one,Y.unit.few,Y.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${X.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${U}${X.maximum.toString()} ${H}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${X.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y){let G=Number(X.minimum),H=GK(G,Y.unit.one,Y.unit.few,Y.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${X.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${U}${X.minimum.toString()} ${H}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${X.origin} \u0431\u0443\u0434\u0435\u0442 ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${U.prefix}"`;if(U.format==="ends_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${U.suffix}"`;if(U.format==="includes")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${U.includes}"`;if(U.format==="regex")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${U.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${w[U.format]??X.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${X.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${X.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${X.keys.length>1?"\u0438":""}: ${f(X.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${X.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${X.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function C3(){return{localeError:AP()}}var EP=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(X))return"tabela";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return(X)=>{switch(X.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${X.expected}, prejeto ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${i(X.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Preveliko: pri\u010Dakovano, da bo ${X.origin??"vrednost"} imelo ${U}${X.maximum.toString()} ${Y.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${X.origin??"vrednost"} ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Premajhno: pri\u010Dakovano, da bo ${X.origin} imelo ${U}${X.minimum.toString()} ${Y.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${X.origin} ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${U.prefix}"`;if(U.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${U.suffix}"`;if(U.format==="includes")return`Neveljaven niz: mora vsebovati "${U.includes}"`;if(U.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${U.pattern}`;return`Neveljaven ${w[U.format]??X.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${X.divisor}`;case"unrecognized_keys":return`Neprepoznan${X.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${f(X.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${X.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${X.origin}`;default:return"Neveljaven vnos"}}};function S3(){return{localeError:EP()}}var MP=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"antal";case"object":{if(Array.isArray(X))return"lista";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(X)=>{switch(X.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${X.expected}, fick ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${i(X.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${X.origin??"v\xE4rdet"} att ha ${U}${X.maximum.toString()} ${Y.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${X.origin??"v\xE4rdet"} att ha ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${X.origin??"v\xE4rdet"} att ha ${U}${X.minimum.toString()} ${Y.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${X.origin??"v\xE4rdet"} att ha ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${U.prefix}"`;if(U.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${U.suffix}"`;if(U.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${U.includes}"`;if(U.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${U.pattern}"`;return`Ogiltig(t) ${w[U.format]??X.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${X.divisor}`;case"unrecognized_keys":return`${X.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${f(X.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${X.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${X.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function j3(){return{localeError:MP()}}var DP=()=>{let $={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(X))return"\u0B85\u0BA3\u0BBF";if(X===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return(X)=>{switch(X.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${X.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i(X.values[0])}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${f(X.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${X.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${U}${X.maximum.toString()} ${Y.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${X.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${U}${X.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${X.origin} ${U}${X.minimum.toString()} ${Y.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${X.origin} ${U}${X.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${U.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(U.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${U.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(U.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${U.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(U.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${U.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${w[U.format]??X.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${X.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${X.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${f(X.keys,", ")}`;case"invalid_key":return`${X.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${X.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function I3(){return{localeError:DP()}}var NP=()=>{let $={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(X))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(X===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return(X)=>{switch(X.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${X.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${i(X.values[0])}`;return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",Y=T(X.origin);if(Y)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${X.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${U} ${X.maximum.toString()} ${Y.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${X.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${U} ${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",Y=T(X.origin);if(Y)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${X.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${U} ${X.minimum.toString()} ${Y.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${X.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${U} ${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${U.prefix}"`;if(U.format==="ends_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${U.suffix}"`;if(U.format==="includes")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${U.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(U.format==="regex")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${U.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${w[U.format]??X.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${X.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${f(X.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${X.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${X.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function B3(){return{localeError:NP()}}var LP=($)=>{let T=typeof $;switch(T){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return T},JP=()=>{let $={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function T(w){return $[w]??null}let W={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return(w)=>{switch(w.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${w.expected}, al\u0131nan ${LP(w.input)}`;case"invalid_value":if(w.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${i(w.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${f(w.values,"|")}`;case"too_big":{let X=w.inclusive?"<=":"<",U=T(w.origin);if(U)return`\xC7ok b\xFCy\xFCk: beklenen ${w.origin??"de\u011Fer"} ${X}${w.maximum.toString()} ${U.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${w.origin??"de\u011Fer"} ${X}${w.maximum.toString()}`}case"too_small":{let X=w.inclusive?">=":">",U=T(w.origin);if(U)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${w.origin} ${X}${w.minimum.toString()} ${U.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${w.origin} ${X}${w.minimum.toString()}`}case"invalid_format":{let X=w;if(X.format==="starts_with")return`Ge\xE7ersiz metin: "${X.prefix}" ile ba\u015Flamal\u0131`;if(X.format==="ends_with")return`Ge\xE7ersiz metin: "${X.suffix}" ile bitmeli`;if(X.format==="includes")return`Ge\xE7ersiz metin: "${X.includes}" i\xE7ermeli`;if(X.format==="regex")return`Ge\xE7ersiz metin: ${X.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${W[X.format]??w.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${w.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${w.keys.length>1?"lar":""}: ${f(w.keys,", ")}`;case"invalid_key":return`${w.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${w.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function x3(){return{localeError:JP()}}var RP=()=>{let $={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(X))return"\u043C\u0430\u0441\u0438\u0432";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return(X)=>{switch(X.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${X.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${i(X.values[0])}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${X.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${Y.verb} ${U}${X.maximum.toString()} ${Y.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${X.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${X.origin} ${Y.verb} ${U}${X.minimum.toString()} ${Y.unit}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${X.origin} \u0431\u0443\u0434\u0435 ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${U.prefix}"`;if(U.format==="ends_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${U.suffix}"`;if(U.format==="includes")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${U.includes}"`;if(U.format==="regex")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${U.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${w[U.format]??X.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${X.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${X.keys.length>1?"\u0456":""}: ${f(X.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${X.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${X.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function f3(){return{localeError:RP()}}var _P=()=>{let $={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(X))return"\u0622\u0631\u06D2";if(X===null)return"\u0646\u0644";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return(X)=>{switch(X.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${X.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${W(X.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":if(X.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i(X.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${f(X.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${X.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${U}${X.maximum.toString()} ${Y.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${X.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${U}${X.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${X.origin} \u06A9\u06D2 ${U}${X.minimum.toString()} ${Y.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${X.origin} \u06A9\u0627 ${U}${X.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${U.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(U.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${U.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(U.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${U.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(U.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${U.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${w[U.format]??X.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${X.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${X.keys.length>1?"\u0632":""}: ${f(X.keys,"\u060C ")}`;case"invalid_key":return`${X.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${X.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function b3(){return{localeError:_P()}}var kP=()=>{let $={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(X))return"m\u1EA3ng";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return(X)=>{switch(X.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${X.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i(X.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${X.origin??"gi\xE1 tr\u1ECB"} ${Y.verb} ${U}${X.maximum.toString()} ${Y.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${X.origin??"gi\xE1 tr\u1ECB"} ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${X.origin} ${Y.verb} ${U}${X.minimum.toString()} ${Y.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${X.origin} ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${U.prefix}"`;if(U.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${U.suffix}"`;if(U.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${U.includes}"`;if(U.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${U.pattern}`;return`${w[U.format]??X.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${X.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${f(X.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${X.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${X.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function y3(){return{localeError:kP()}}var vP=()=>{let $={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(X))return"\u6570\u7EC4";if(X===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return(X)=>{switch(X.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${X.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i(X.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${X.origin??"\u503C"} ${U}${X.maximum.toString()} ${Y.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${X.origin??"\u503C"} ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${X.origin} ${U}${X.minimum.toString()} ${Y.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${X.origin} ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${U.prefix}" \u5F00\u5934`;if(U.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${U.suffix}" \u7ED3\u5C3E`;if(U.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${U.includes}"`;if(U.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${U.pattern}`;return`\u65E0\u6548${w[U.format]??X.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${X.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${f(X.keys,", ")}`;case"invalid_key":return`${X.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${X.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function h3(){return{localeError:vP()}}var qP=()=>{let $={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function T(X){return $[X]??null}let W=(X)=>{let U=typeof X;switch(U){case"number":return Number.isNaN(X)?"NaN":"number";case"object":{if(Array.isArray(X))return"array";if(X===null)return"null";if(Object.getPrototypeOf(X)!==Object.prototype&&X.constructor)return X.constructor.name}}return U},w={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return(X)=>{switch(X.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${X.expected}\uFF0C\u4F46\u6536\u5230 ${W(X.input)}`;case"invalid_value":if(X.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i(X.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${f(X.values,"|")}`;case"too_big":{let U=X.inclusive?"<=":"<",Y=T(X.origin);if(Y)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${X.origin??"\u503C"} \u61C9\u70BA ${U}${X.maximum.toString()} ${Y.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${X.origin??"\u503C"} \u61C9\u70BA ${U}${X.maximum.toString()}`}case"too_small":{let U=X.inclusive?">=":">",Y=T(X.origin);if(Y)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${X.origin} \u61C9\u70BA ${U}${X.minimum.toString()} ${Y.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${X.origin} \u61C9\u70BA ${U}${X.minimum.toString()}`}case"invalid_format":{let U=X;if(U.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${U.prefix}" \u958B\u982D`;if(U.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${U.suffix}" \u7D50\u5C3E`;if(U.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${U.includes}"`;if(U.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${U.pattern}`;return`\u7121\u6548\u7684 ${w[U.format]??X.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${X.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${X.keys.length>1?"\u5011":""}\uFF1A${f(X.keys,"\u3001")}`;case"invalid_key":return`${X.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${X.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function g3(){return{localeError:qP()}}var m3=Symbol("ZodOutput"),c3=Symbol("ZodInput");class oX{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...T){let W=T[0];if(this._map.set($,W),W&&typeof W==="object"&&"id"in W){if(this._idmap.has(W.id))throw new Error(`ID ${W.id} already exists in the registry`);this._idmap.set(W.id,$)}return this}remove($){return this._map.delete($),this}get($){let T=$._zod.parent;if(T){let W={...this.get(T)??{}};return delete W.id,{...W,...this._map.get($)}}return this._map.get($)}has($){return this._map.has($)}}function NY(){return new oX}var o1=NY();function u3($,T){return new $({type:"string",...p(T)})}function p3($,T){return new $({type:"string",coerce:!0,...p(T)})}function LY($,T){return new $({type:"string",format:"email",check:"string_format",abort:!1,...p(T)})}function lX($,T){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...p(T)})}function JY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...p(T)})}function RY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...p(T)})}function _Y($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...p(T)})}function kY($,T){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...p(T)})}function vY($,T){return new $({type:"string",format:"url",check:"string_format",abort:!1,...p(T)})}function qY($,T){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...p(T)})}function PY($,T){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...p(T)})}function CY($,T){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...p(T)})}function SY($,T){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...p(T)})}function jY($,T){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...p(T)})}function IY($,T){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...p(T)})}function BY($,T){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...p(T)})}function xY($,T){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...p(T)})}function fY($,T){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...p(T)})}function bY($,T){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...p(T)})}function yY($,T){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...p(T)})}function hY($,T){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...p(T)})}function gY($,T){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...p(T)})}function mY($,T){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...p(T)})}function cY($,T){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...p(T)})}function d3($,T){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...p(T)})}function o3($,T){return new $({type:"string",format:"date",check:"string_format",...p(T)})}function l3($,T){return new $({type:"string",format:"time",check:"string_format",precision:null,...p(T)})}function r3($,T){return new $({type:"string",format:"duration",check:"string_format",...p(T)})}function n3($,T){return new $({type:"number",checks:[],...p(T)})}function i3($,T){return new $({type:"number",coerce:!0,checks:[],...p(T)})}function t3($,T){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...p(T)})}function a3($,T){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...p(T)})}function s3($,T){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...p(T)})}function e3($,T){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...p(T)})}function $H($,T){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...p(T)})}function TH($,T){return new $({type:"boolean",...p(T)})}function WH($,T){return new $({type:"boolean",coerce:!0,...p(T)})}function XH($,T){return new $({type:"bigint",...p(T)})}function wH($,T){return new $({type:"bigint",coerce:!0,...p(T)})}function UH($,T){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...p(T)})}function YH($,T){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...p(T)})}function GH($,T){return new $({type:"symbol",...p(T)})}function zH($,T){return new $({type:"undefined",...p(T)})}function HH($,T){return new $({type:"null",...p(T)})}function FH($){return new $({type:"any"})}function oW($){return new $({type:"unknown"})}function OH($,T){return new $({type:"never",...p(T)})}function QH($,T){return new $({type:"void",...p(T)})}function ZH($,T){return new $({type:"date",...p(T)})}function VH($,T){return new $({type:"date",coerce:!0,...p(T)})}function KH($,T){return new $({type:"nan",...p(T)})}function Z0($,T){return new QY({check:"less_than",...p(T),value:$,inclusive:!1})}function V1($,T){return new QY({check:"less_than",...p(T),value:$,inclusive:!0})}function V0($,T){return new ZY({check:"greater_than",...p(T),value:$,inclusive:!1})}function B6($,T){return new ZY({check:"greater_than",...p(T),value:$,inclusive:!0})}function AH($){return V0(0,$)}function EH($){return Z0(0,$)}function MH($){return V1(0,$)}function DH($){return B6(0,$)}function lT($,T){return new b5({check:"multiple_of",...p(T),value:$})}function lW($,T){return new g5({check:"max_size",...p(T),maximum:$})}function rT($,T){return new m5({check:"min_size",...p(T),minimum:$})}function rX($,T){return new c5({check:"size_equals",...p(T),size:$})}function rW($,T){return new u5({check:"max_length",...p(T),maximum:$})}function GT($,T){return new p5({check:"min_length",...p(T),minimum:$})}function nW($,T){return new d5({check:"length_equals",...p(T),length:$})}function nX($,T){return new o5({check:"string_format",format:"regex",...p(T),pattern:$})}function iX($){return new l5({check:"string_format",format:"lowercase",...p($)})}function tX($){return new r5({check:"string_format",format:"uppercase",...p($)})}function aX($,T){return new n5({check:"string_format",format:"includes",...p(T),includes:$})}function sX($,T){return new i5({check:"string_format",format:"starts_with",...p(T),prefix:$})}function eX($,T){return new t5({check:"string_format",format:"ends_with",...p(T),suffix:$})}function NH($,T,W){return new a5({check:"property",property:$,schema:T,...p(W)})}function $8($,T){return new s5({check:"mime_type",mime:$,...p(T)})}function K0($){return new e5({check:"overwrite",tx:$})}function T8($){return K0((T)=>T.normalize($))}function W8(){return K0(($)=>$.trim())}function X8(){return K0(($)=>$.toLowerCase())}function w8(){return K0(($)=>$.toUpperCase())}function U8($,T,W){return new $({type:"array",element:T,...p(W)})}function PP($,T,W){return new $({type:"union",options:T,...p(W)})}function CP($,T,W,w){return new $({type:"union",options:W,discriminator:T,...p(w)})}function SP($,T,W){return new $({type:"intersection",left:T,right:W})}function LH($,T,W,w){let X=W instanceof K$;return new $({type:"tuple",items:T,rest:X?W:null,...p(X?w:W)})}function jP($,T,W,w){return new $({type:"record",keyType:T,valueType:W,...p(w)})}function IP($,T,W,w){return new $({type:"map",keyType:T,valueType:W,...p(w)})}function BP($,T,W){return new $({type:"set",valueType:T,...p(W)})}function xP($,T,W){let w=Array.isArray(T)?Object.fromEntries(T.map((X)=>[X,X])):T;return new $({type:"enum",entries:w,...p(W)})}function fP($,T,W){return new $({type:"enum",entries:T,...p(W)})}function bP($,T,W){return new $({type:"literal",values:Array.isArray(T)?T:[T],...p(W)})}function JH($,T){return new $({type:"file",...p(T)})}function yP($,T){return new $({type:"transform",transform:T})}function hP($,T){return new $({type:"optional",innerType:T})}function gP($,T){return new $({type:"nullable",innerType:T})}function mP($,T,W){return new $({type:"default",innerType:T,get defaultValue(){return typeof W==="function"?W():W}})}function cP($,T,W){return new $({type:"nonoptional",innerType:T,...p(W)})}function uP($,T){return new $({type:"success",innerType:T})}function pP($,T,W){return new $({type:"catch",innerType:T,catchValue:typeof W==="function"?W:()=>W})}function dP($,T,W){return new $({type:"pipe",in:T,out:W})}function oP($,T){return new $({type:"readonly",innerType:T})}function lP($,T,W){return new $({type:"template_literal",parts:T,...p(W)})}function rP($,T){return new $({type:"lazy",getter:T})}function nP($,T){return new $({type:"promise",innerType:T})}function Y8($,T,W){return new $({type:"custom",check:"custom",fn:T,...p(W)})}function iP($,T,W={}){return Y8($,T,W)}function RH($,T){let{case:W,error:w,truthy:X,falsy:U}=p(T),Y=new Set(X??["true","1","yes","on","y","enabled"]),G=new Set(U??["false","0","no","off","n","disabled"]),H=$.Pipe??uX,z=$.Boolean??mX,O=new($.Unknown??YT)({type:"unknown",checks:[{_zod:{check:(Q)=>{if(typeof Q.value==="string"){let Z=Q.value;if(W!=="sensitive")Z=Z.toLowerCase();if(Y.has(Z))Q.value=!0;else if(G.has(Z))Q.value=!1;else Q.issues.push({code:"invalid_value",expected:"stringbool",values:[...Y,...G],input:Q.value,inst:O})}else Q.issues.push({code:"invalid_type",expected:"string",input:Q.value})},def:{check:"custom"},onattach:[]}}],error:w});return new H({type:"pipe",in:O,out:new z({type:"boolean",error:w}),error:w})}class _H{constructor($){this._def=$,this.def=$}implement($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let T=(...W)=>{let w=this._def.input?YY(this._def.input,W,void 0,{callee:T}):W;if(!Array.isArray(w))throw new Error("Invalid arguments schema: not an array or tuple schema.");let X=$(...w);return this._def.output?YY(this._def.output,X,void 0,{callee:T}):X};return T}implementAsync($){if(typeof $!=="function")throw new Error("implement() must be called with a function");let T=async(...W)=>{let w=this._def.input?await zY(this._def.input,W,void 0,{callee:T}):W;if(!Array.isArray(w))throw new Error("Invalid arguments schema: not an array or tuple schema.");let X=await $(...w);return this._def.output?zY(this._def.output,X,void 0,{callee:T}):X};return T}input(...$){let T=this.constructor;if(Array.isArray($[0]))return new T({type:"function",input:new oT({type:"tuple",items:$[0],rest:$[1]}),output:this._def.output});return new T({type:"function",input:$[0],output:this._def.output})}output($){return new this.constructor({type:"function",input:this._def.input,output:$})}}function kH($){return new _H({type:"function",input:Array.isArray($?.input)?LH(oT,$?.input):$?.input??U8(cX,oW(YT)),output:$?.output??oW(YT)})}class uY{constructor($){this.counter=0,this.metadataRegistry=$?.metadata??o1,this.target=$?.target??"draft-2020-12",this.unrepresentable=$?.unrepresentable??"throw",this.override=$?.override??(()=>{}),this.io=$?.io??"output",this.seen=new Map}process($,T={path:[],schemaPath:[]}){var W;let w=$._zod.def,X={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},U=this.seen.get($);if(U){if(U.count++,T.schemaPath.includes($))U.cycle=T.path;return U.schema}let Y={schema:{},count:1,cycle:void 0};if(this.seen.set($,Y),$._zod.toJSONSchema)Y.schema=$._zod.toJSONSchema();let G={...T,schemaPath:[...T.schemaPath,$],path:T.path},H=$._zod.parent;if(H)Y.ref=H,this.process(H,G),this.seen.get(H).isParent=!0;else{let O=Y.schema;switch(w.type){case"string":{let Q=O;Q.type="string";let{minimum:Z,maximum:K,format:E,patterns:M,contentEncoding:L}=$._zod.bag;if(typeof Z==="number")Q.minLength=Z;if(typeof K==="number")Q.maxLength=K;if(E){if(Q.format=X[E]??E,Q.format==="")delete Q.format}if(L)Q.contentEncoding=L;if(M&&M.size>0){let R=[...M];if(R.length===1)Q.pattern=R[0].source;else if(R.length>1)Y.schema.allOf=[...R.map((_)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:_.source}))]}break}case"number":{let Q=O,{minimum:Z,maximum:K,format:E,multipleOf:M,exclusiveMaximum:L,exclusiveMinimum:R}=$._zod.bag;if(typeof E==="string"&&E.includes("int"))Q.type="integer";else Q.type="number";if(typeof R==="number")Q.exclusiveMinimum=R;if(typeof Z==="number"){if(Q.minimum=Z,typeof R==="number")if(R>=Z)delete Q.minimum;else delete Q.exclusiveMinimum}if(typeof L==="number")Q.exclusiveMaximum=L;if(typeof K==="number"){if(Q.maximum=K,typeof L==="number")if(L<=K)delete Q.maximum;else delete Q.exclusiveMaximum}if(typeof M==="number")Q.multipleOf=M;break}case"boolean":{let Q=O;Q.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{let Q=O;Q.type="null";break}case"null":{O.type="null";break}case"any":break;case"unknown":break;case"never":{O.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let Q=O,{minimum:Z,maximum:K}=$._zod.bag;if(typeof Z==="number")Q.minItems=Z;if(typeof K==="number")Q.maxItems=K;Q.type="array",Q.items=this.process(w.element,{...G,path:[...G.path,"items"]});break}case"object":{let Q=O;Q.type="object",Q.properties={};let Z=w.shape;for(let M in Z)Q.properties[M]=this.process(Z[M],{...G,path:[...G.path,"properties",M]});let K=new Set(Object.keys(Z)),E=new Set([...K].filter((M)=>{let L=w.shape[M]._zod;if(this.io==="input")return L.optin===void 0;else return L.optout===void 0}));if(E.size>0)Q.required=Array.from(E);if(w.catchall?._zod.def.type==="never")Q.additionalProperties=!1;else if(!w.catchall){if(this.io==="output")Q.additionalProperties=!1}else if(w.catchall)Q.additionalProperties=this.process(w.catchall,{...G,path:[...G.path,"additionalProperties"]});break}case"union":{let Q=O;Q.anyOf=w.options.map((Z,K)=>this.process(Z,{...G,path:[...G.path,"anyOf",K]}));break}case"intersection":{let Q=O,Z=this.process(w.left,{...G,path:[...G.path,"allOf",0]}),K=this.process(w.right,{...G,path:[...G.path,"allOf",1]}),E=(L)=>("allOf"in L)&&Object.keys(L).length===1,M=[...E(Z)?Z.allOf:[Z],...E(K)?K.allOf:[K]];Q.allOf=M;break}case"tuple":{let Q=O;Q.type="array";let Z=w.items.map((M,L)=>this.process(M,{...G,path:[...G.path,"prefixItems",L]}));if(this.target==="draft-2020-12")Q.prefixItems=Z;else Q.items=Z;if(w.rest){let M=this.process(w.rest,{...G,path:[...G.path,"items"]});if(this.target==="draft-2020-12")Q.items=M;else Q.additionalItems=M}if(w.rest)Q.items=this.process(w.rest,{...G,path:[...G.path,"items"]});let{minimum:K,maximum:E}=$._zod.bag;if(typeof K==="number")Q.minItems=K;if(typeof E==="number")Q.maxItems=E;break}case"record":{let Q=O;Q.type="object",Q.propertyNames=this.process(w.keyType,{...G,path:[...G.path,"propertyNames"]}),Q.additionalProperties=this.process(w.valueType,{...G,path:[...G.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let Q=O,Z=CX(w.entries);if(Z.every((K)=>typeof K==="number"))Q.type="number";if(Z.every((K)=>typeof K==="string"))Q.type="string";Q.enum=Z;break}case"literal":{let Q=O,Z=[];for(let K of w.values)if(K===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof K==="bigint")if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");else Z.push(Number(K));else Z.push(K);if(Z.length===0);else if(Z.length===1){let K=Z[0];Q.const=K}else Q.enum=Z;break}case"file":{let Q=O,Z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:K,maximum:E,mime:M}=$._zod.bag;if(K!==void 0)Z.minLength=K;if(E!==void 0)Z.maxLength=E;if(M)if(M.length===1)Z.contentMediaType=M[0],Object.assign(Q,Z);else Q.anyOf=M.map((L)=>{return{...Z,contentMediaType:L}});else Object.assign(Q,Z);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let Q=this.process(w.innerType,G);O.anyOf=[Q,{type:"null"}];break}case"nonoptional":{this.process(w.innerType,G),Y.ref=w.innerType;break}case"success":{let Q=O;Q.type="boolean";break}case"default":{this.process(w.innerType,G),Y.ref=w.innerType,O.default=w.defaultValue;break}case"prefault":{if(this.process(w.innerType,G),Y.ref=w.innerType,this.io==="input")O._prefault=w.defaultValue;break}case"catch":{this.process(w.innerType,G),Y.ref=w.innerType;let Q;try{Q=w.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}O.default=Q;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let Q=O,Z=$._zod.pattern;if(!Z)throw new Error("Pattern not found in template literal");Q.type="string",Q.pattern=Z.source;break}case"pipe":{let Q=this.io==="input"?w.in._zod.def.type==="transform"?w.out:w.in:w.out;this.process(Q,G),Y.ref=Q;break}case"readonly":{this.process(w.innerType,G),Y.ref=w.innerType,O.readOnly=!0;break}case"promise":{this.process(w.innerType,G),Y.ref=w.innerType;break}case"optional":{this.process(w.innerType,G),Y.ref=w.innerType;break}case"lazy":{let Q=$._zod.innerType;this.process(Q,G),Y.ref=Q;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}let z=this.metadataRegistry.get($);if(z)Object.assign(Y.schema,z);if(this.io==="input"&&v4($))delete Y.schema.examples,delete Y.schema.default;if(this.io==="input"&&Y.schema._prefault)(W=Y.schema).default??(W.default=Y.schema._prefault);return delete Y.schema._prefault,this.seen.get($).schema}emit($,T){let W={cycles:T?.cycles??"ref",reused:T?.reused??"inline",external:T?.external??void 0},w=this.seen.get($);if(!w)throw new Error("Unprocessed schema. This is a bug in Zod.");let X=(z)=>{let F=this.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let K=W.external.registry.get(z[0])?.id;if(K)return{ref:W.external.uri(K)};let E=z[1].defId??z[1].schema.id??`schema${this.counter++}`;return z[1].defId=E,{defId:E,ref:`${W.external.uri("__shared")}#/${F}/${E}`}}if(z[1]===w)return{ref:"#"};let Q=`${"#"}/${F}/`,Z=z[1].schema.id??`__schema${this.counter++}`;return{defId:Z,ref:Q+Z}},U=(z)=>{if(z[1].schema.$ref)return;let F=z[1],{ref:O,defId:Q}=X(z);if(F.def={...F.schema},Q)F.defId=Q;let Z=F.schema;for(let K in Z)delete Z[K];Z.$ref=O};for(let z of this.seen.entries()){let F=z[1];if($===z[0]){U(z);continue}if(W.external){let Q=W.external.registry.get(z[0])?.id;if($!==z[0]&&Q){U(z);continue}}if(this.metadataRegistry.get(z[0])?.id){U(z);continue}if(F.cycle){if(W.cycles==="throw")throw new Error(`Cycle detected: #/${F.cycle?.join("/")}/<root>
|
|
32
32
|
|
|
33
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(W.cycles==="ref")Y(z);continue}if(F.count>1){if(W.reused==="ref"){Y(z);continue}}}let w=(z,F)=>{let O=this.seen.get(z),Q=O.def??O.schema,Z={...Q};if(O.ref===null)return;let V=O.ref;if(O.ref=null,V){w(V,F);let E=this.seen.get(V).schema;if(E.$ref&&F.target==="draft-7")Q.allOf=Q.allOf??[],Q.allOf.push(E);else Object.assign(Q,E),Object.assign(Q,Z)}if(!O.isParent)this.override({zodSchema:z,jsonSchema:Q})};for(let z of[...this.seen.entries()].reverse())w(z[0],{target:this.target});let G={};if(this.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")G.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);Object.assign(G,U.def);let H=W.external?.defs??{};for(let z of this.seen.entries()){let F=z[1];if(F.def&&F.defId)H[F.defId]=F.def}if(!W.external&&Object.keys(H).length>0)if(this.target==="draft-2020-12")G.$defs=H;else G.definitions=H;try{return JSON.parse(JSON.stringify(G))}catch(z){throw new Error("Error converting schema to JSON.")}}}function pH($,T){if($ instanceof wX){let U=new aw(T),X={};for(let G of $._idmap.entries()){let[H,z]=G;U.process(z)}let Y={},w={registry:$,uri:T?.uri||((G)=>G),defs:X};for(let G of $._idmap.entries()){let[H,z]=G;Y[H]=U.emit(z,{...T,external:w})}if(Object.keys(X).length>0){let G=U.target==="draft-2020-12"?"$defs":"definitions";Y.__shared={[G]:X}}return{schemas:Y}}let W=new aw(T);return W.process($),W.emit($,T)}var KK={};var sw={};wT(sw,{time:()=>lH,duration:()=>rH,datetime:()=>dH,date:()=>oH,ZodISOTime:()=>MK,ZodISODuration:()=>NK,ZodISODateTime:()=>EK,ZodISODate:()=>AK});var EK=k("ZodISODateTime",($,T)=>{P7.init($,T),T4.init($,T)});function dH($){return wH(EK,$)}var AK=k("ZodISODate",($,T)=>{C7.init($,T),T4.init($,T)});function oH($){return GH(AK,$)}var MK=k("ZodISOTime",($,T)=>{S7.init($,T),T4.init($,T)});function lH($){return zH(MK,$)}var NK=k("ZodISODuration",($,T)=>{j7.init($,T),T4.init($,T)});function rH($){return HH(NK,$)}var JK=($,T)=>{aU.init($,T),$.name="ZodError",Object.defineProperties($,{format:{value:(W)=>eU($,W)},flatten:{value:(W)=>sU($,W)},addIssue:{value:(W)=>$.issues.push(W)},addIssues:{value:(W)=>$.issues.push(...W)},isEmpty:{get(){return $.issues.length===0}}})},OB=k("ZodError",JK),z2=k("ZodError",JK,{Parent:Error});var nH=Qw(z2),iH=Dw(z2),tH=Kw(z2),aH=Ew(z2);var sH={};wT(sH,{string:()=>ZB,number:()=>DB,date:()=>EB,boolean:()=>VB,bigint:()=>KB});function ZB($){return YH(ew,$)}function DB($){return OH(LX,$)}function VB($){return AH(JX,$)}function KB($){return NH(_X,$)}function EB($){return jH($G,$)}var J$=k("ZodType",($,T)=>{return Q$.init($,T),$.def=T,Object.defineProperty($,"_def",{value:T}),$.check=(...W)=>{return $.clone({...T,checks:[...T.checks??[],...W.map((U)=>typeof U==="function"?{_zod:{check:U,def:{check:"custom"},onattach:[]}}:U)]})},$.clone=(W,U)=>a6($,W,U),$.brand=()=>$,$.register=(W,U)=>{return W.add($,U),$},$.parse=(W,U)=>nH($,W,U,{callee:$.parse}),$.safeParse=(W,U)=>tH($,W,U),$.parseAsync=async(W,U)=>iH($,W,U,{callee:$.parseAsync}),$.safeParseAsync=async(W,U)=>aH($,W,U),$.spa=$.safeParseAsync,$.refine=(W,U)=>$.check(zE(W,U)),$.superRefine=(W)=>$.check(HE(W)),$.overwrite=(W)=>$.check(E0(W)),$.optional=()=>UG($),$.nullable=()=>XG($),$.nullish=()=>UG(XG($)),$.nonoptional=(W)=>tK($,W),$.array=()=>LF($),$.or=(W)=>zG([$,W]),$.and=(W)=>bK($,W),$.transform=(W)=>YG($,RF(W)),$.default=(W)=>rK($,W),$.prefault=(W)=>iK($,W),$.catch=(W)=>eK($,W),$.pipe=(W)=>YG($,W),$.readonly=()=>WE($),$.describe=(W)=>{let U=$.clone();return n1.add(U,{description:W}),U},Object.defineProperty($,"description",{get(){return n1.get($)?.description},configurable:!0}),$.meta=(...W)=>{if(W.length===0)return n1.get($);let U=$.clone();return n1.add(U,W[0]),U},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$}),TF=k("_ZodString",($,T)=>{$X.init($,T),J$.init($,T);let W=$._zod.bag;$.format=W.format??null,$.minLength=W.minimum??null,$.maxLength=W.maximum??null,$.regex=(...U)=>$.check(HX(...U)),$.includes=(...U)=>$.check(QX(...U)),$.startsWith=(...U)=>$.check(ZX(...U)),$.endsWith=(...U)=>$.check(DX(...U)),$.min=(...U)=>$.check(ZT(...U)),$.max=(...U)=>$.check(Y2(...U)),$.length=(...U)=>$.check(w2(...U)),$.nonempty=(...U)=>$.check(ZT(1,...U)),$.lowercase=(U)=>$.check(FX(U)),$.uppercase=(U)=>$.check(OX(U)),$.trim=()=>$.check(EX()),$.normalize=(...U)=>$.check(KX(...U)),$.toLowerCase=()=>$.check(AX()),$.toUpperCase=()=>$.check(MX())}),ew=k("ZodString",($,T)=>{$X.init($,T),TF.init($,T),$.email=(W)=>$.check(Sw(WF,W)),$.url=(W)=>$.check(bw(UF,W)),$.jwt=(W)=>$.check(tw(AF,W)),$.emoji=(W)=>$.check(fw(XF,W)),$.guid=(W)=>$.check(GX(TG,W)),$.uuid=(W)=>$.check(jw(M0,W)),$.uuidv4=(W)=>$.check(Bw(M0,W)),$.uuidv6=(W)=>$.check(xw(M0,W)),$.uuidv7=(W)=>$.check(Iw(M0,W)),$.nanoid=(W)=>$.check(yw(YF,W)),$.guid=(W)=>$.check(GX(TG,W)),$.cuid=(W)=>$.check(hw(wF,W)),$.cuid2=(W)=>$.check(gw(GF,W)),$.ulid=(W)=>$.check(mw(zF,W)),$.base64=(W)=>$.check(rw(VF,W)),$.base64url=(W)=>$.check(nw(KF,W)),$.xid=(W)=>$.check(cw(HF,W)),$.ksuid=(W)=>$.check(uw(FF,W)),$.ipv4=(W)=>$.check(pw(OF,W)),$.ipv6=(W)=>$.check(dw(QF,W)),$.cidrv4=(W)=>$.check(ow(ZF,W)),$.cidrv6=(W)=>$.check(lw(DF,W)),$.e164=(W)=>$.check(iw(EF,W)),$.datetime=(W)=>$.check(dH(W)),$.date=(W)=>$.check(oH(W)),$.time=(W)=>$.check(lH(W)),$.duration=(W)=>$.check(rH(W))});function eH($){return XH(ew,$)}var T4=k("ZodStringFormat",($,T)=>{l$.init($,T),TF.init($,T)}),WF=k("ZodEmail",($,T)=>{M7.init($,T),T4.init($,T)});function AB($){return Sw(WF,$)}var TG=k("ZodGUID",($,T)=>{E7.init($,T),T4.init($,T)});function MB($){return GX(TG,$)}var M0=k("ZodUUID",($,T)=>{A7.init($,T),T4.init($,T)});function NB($){return jw(M0,$)}function LB($){return Bw(M0,$)}function JB($){return xw(M0,$)}function _B($){return Iw(M0,$)}var UF=k("ZodURL",($,T)=>{N7.init($,T),T4.init($,T)});function RB($){return bw(UF,$)}var XF=k("ZodEmoji",($,T)=>{L7.init($,T),T4.init($,T)});function kB($){return fw(XF,$)}var YF=k("ZodNanoID",($,T)=>{J7.init($,T),T4.init($,T)});function vB($){return yw(YF,$)}var wF=k("ZodCUID",($,T)=>{_7.init($,T),T4.init($,T)});function qB($){return hw(wF,$)}var GF=k("ZodCUID2",($,T)=>{R7.init($,T),T4.init($,T)});function PB($){return gw(GF,$)}var zF=k("ZodULID",($,T)=>{k7.init($,T),T4.init($,T)});function CB($){return mw(zF,$)}var HF=k("ZodXID",($,T)=>{v7.init($,T),T4.init($,T)});function SB($){return cw(HF,$)}var FF=k("ZodKSUID",($,T)=>{q7.init($,T),T4.init($,T)});function jB($){return uw(FF,$)}var OF=k("ZodIPv4",($,T)=>{B7.init($,T),T4.init($,T)});function BB($){return pw(OF,$)}var QF=k("ZodIPv6",($,T)=>{x7.init($,T),T4.init($,T)});function xB($){return dw(QF,$)}var ZF=k("ZodCIDRv4",($,T)=>{I7.init($,T),T4.init($,T)});function IB($){return ow(ZF,$)}var DF=k("ZodCIDRv6",($,T)=>{b7.init($,T),T4.init($,T)});function bB($){return lw(DF,$)}var VF=k("ZodBase64",($,T)=>{y7.init($,T),T4.init($,T)});function fB($){return rw(VF,$)}var KF=k("ZodBase64URL",($,T)=>{h7.init($,T),T4.init($,T)});function yB($){return nw(KF,$)}var EF=k("ZodE164",($,T)=>{g7.init($,T),T4.init($,T)});function hB($){return iw(EF,$)}var AF=k("ZodJWT",($,T)=>{m7.init($,T),T4.init($,T)});function gB($){return tw(AF,$)}var LX=k("ZodNumber",($,T)=>{vw.init($,T),J$.init($,T),$.gt=(U,X)=>$.check(K0(U,X)),$.gte=(U,X)=>$.check(j6(U,X)),$.min=(U,X)=>$.check(j6(U,X)),$.lt=(U,X)=>$.check(V0(U,X)),$.lte=(U,X)=>$.check(D1(U,X)),$.max=(U,X)=>$.check(D1(U,X)),$.int=(U)=>$.check($F(U)),$.safe=(U)=>$.check($F(U)),$.positive=(U)=>$.check(K0(0,U)),$.nonnegative=(U)=>$.check(j6(0,U)),$.negative=(U)=>$.check(V0(0,U)),$.nonpositive=(U)=>$.check(D1(0,U)),$.multipleOf=(U,X)=>$.check(sT(U,X)),$.step=(U,X)=>$.check(sT(U,X)),$.finite=()=>$;let W=$._zod.bag;$.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),$.isFinite=!0,$.format=W.format??null});function _K($){return FH(LX,$)}var H2=k("ZodNumberFormat",($,T)=>{c7.init($,T),LX.init($,T)});function $F($){return QH(H2,$)}function mB($){return ZH(H2,$)}function cB($){return DH(H2,$)}function uB($){return VH(H2,$)}function pB($){return KH(H2,$)}var JX=k("ZodBoolean",($,T)=>{TX.init($,T),J$.init($,T)});function RK($){return EH(JX,$)}var _X=k("ZodBigInt",($,T)=>{qw.init($,T),J$.init($,T),$.gte=(U,X)=>$.check(j6(U,X)),$.min=(U,X)=>$.check(j6(U,X)),$.gt=(U,X)=>$.check(K0(U,X)),$.gte=(U,X)=>$.check(j6(U,X)),$.min=(U,X)=>$.check(j6(U,X)),$.lt=(U,X)=>$.check(V0(U,X)),$.lte=(U,X)=>$.check(D1(U,X)),$.max=(U,X)=>$.check(D1(U,X)),$.positive=(U)=>$.check(K0(BigInt(0),U)),$.negative=(U)=>$.check(V0(BigInt(0),U)),$.nonpositive=(U)=>$.check(D1(BigInt(0),U)),$.nonnegative=(U)=>$.check(j6(BigInt(0),U)),$.multipleOf=(U,X)=>$.check(sT(U,X));let W=$._zod.bag;$.minValue=W.minimum??null,$.maxValue=W.maximum??null,$.format=W.format??null});function dB($){return MH(_X,$)}var MF=k("ZodBigIntFormat",($,T)=>{u7.init($,T),_X.init($,T)});function oB($){return LH(MF,$)}function lB($){return JH(MF,$)}var kK=k("ZodSymbol",($,T)=>{p7.init($,T),J$.init($,T)});function rB($){return _H(kK,$)}var vK=k("ZodUndefined",($,T)=>{d7.init($,T),J$.init($,T)});function nB($){return RH(vK,$)}var qK=k("ZodNull",($,T)=>{o7.init($,T),J$.init($,T)});function PK($){return kH(qK,$)}var CK=k("ZodAny",($,T)=>{l7.init($,T),J$.init($,T)});function iB(){return vH(CK)}var NF=k("ZodUnknown",($,T)=>{WX.init($,T),J$.init($,T)});function WG(){return qH(NF)}var SK=k("ZodNever",($,T)=>{r7.init($,T),J$.init($,T)});function wG($){return PH(SK,$)}var jK=k("ZodVoid",($,T)=>{n7.init($,T),J$.init($,T)});function tB($){return CH(jK,$)}var $G=k("ZodDate",($,T)=>{i7.init($,T),J$.init($,T),$.min=(U,X)=>$.check(j6(U,X)),$.max=(U,X)=>$.check(D1(U,X));let W=$._zod.bag;$.minDate=W.minimum?new Date(W.minimum):null,$.maxDate=W.maximum?new Date(W.maximum):null});function aB($){return SH($G,$)}var BK=k("ZodArray",($,T)=>{t7.init($,T),J$.init($,T),$.element=T.element,$.min=(W,U)=>$.check(ZT(W,U)),$.nonempty=(W)=>$.check(ZT(1,W)),$.max=(W,U)=>$.check(Y2(W,U)),$.length=(W,U)=>$.check(w2(W,U)),$.unwrap=()=>$.element});function LF($,T){return hH(BK,$,T)}function sB($){let T=$._zod.def.shape;return uK(Object.keys(T))}var GG=k("ZodObject",($,T)=>{a7.init($,T),J$.init($,T),d.defineLazy($,"shape",()=>{return Object.fromEntries(Object.entries($._zod.def.shape))}),$.keyof=()=>mK(Object.keys($._zod.def.shape)),$.catchall=(W)=>$.clone({...$._zod.def,catchall:W}),$.passthrough=()=>$.clone({...$._zod.def,catchall:WG()}),$.loose=()=>$.clone({...$._zod.def,catchall:WG()}),$.strict=()=>$.clone({...$._zod.def,catchall:wG()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(W)=>{return d.extend($,W)},$.merge=(W)=>d.merge($,W),$.pick=(W)=>d.pick($,W),$.omit=(W)=>d.omit($,W),$.partial=(...W)=>d.partial(kF,$,W[0]),$.required=(...W)=>d.required(vF,$,W[0])});function eB($,T){let W={type:"object",get shape(){return d.assignProp(this,"shape",{...$}),this.shape},...d.normalizeParams(T)};return new GG(W)}function $x($,T){return new GG({type:"object",get shape(){return d.assignProp(this,"shape",{...$}),this.shape},catchall:wG(),...d.normalizeParams(T)})}function Tx($,T){return new GG({type:"object",get shape(){return d.assignProp(this,"shape",{...$}),this.shape},catchall:WG(),...d.normalizeParams(T)})}var JF=k("ZodUnion",($,T)=>{Pw.init($,T),J$.init($,T),$.options=T.options});function zG($,T){return new JF({type:"union",options:$,...d.normalizeParams(T)})}var xK=k("ZodDiscriminatedUnion",($,T)=>{JF.init($,T),s7.init($,T)});function Wx($,T,W){return new xK({type:"union",options:T,discriminator:$,...d.normalizeParams(W)})}var IK=k("ZodIntersection",($,T)=>{e7.init($,T),J$.init($,T)});function bK($,T){return new IK({type:"intersection",left:$,right:T})}var fK=k("ZodTuple",($,T)=>{aT.init($,T),J$.init($,T),$.rest=(W)=>$.clone({...$._zod.def,rest:W})});function Ux($,T,W){let U=T instanceof Q$,X=U?W:T;return new fK({type:"tuple",items:$,rest:U?T:null,...d.normalizeParams(X)})}var _F=k("ZodRecord",($,T)=>{$3.init($,T),J$.init($,T),$.keyType=T.keyType,$.valueType=T.valueType});function yK($,T,W){return new _F({type:"record",keyType:$,valueType:T,...d.normalizeParams(W)})}function Xx($,T,W){return new _F({type:"record",keyType:zG([$,wG()]),valueType:T,...d.normalizeParams(W)})}var hK=k("ZodMap",($,T)=>{T3.init($,T),J$.init($,T),$.keyType=T.keyType,$.valueType=T.valueType});function Yx($,T,W){return new hK({type:"map",keyType:$,valueType:T,...d.normalizeParams(W)})}var gK=k("ZodSet",($,T)=>{W3.init($,T),J$.init($,T),$.min=(...W)=>$.check(eT(...W)),$.nonempty=(W)=>$.check(eT(1,W)),$.max=(...W)=>$.check(X2(...W)),$.size=(...W)=>$.check(zX(...W))});function wx($,T){return new gK({type:"set",valueType:$,...d.normalizeParams(T)})}var RX=k("ZodEnum",($,T)=>{U3.init($,T),J$.init($,T),$.enum=T.entries,$.options=Object.values(T.entries);let W=new Set(Object.keys(T.entries));$.extract=(U,X)=>{let Y={};for(let w of U)if(W.has(w))Y[w]=T.entries[w];else throw new Error(`Key ${w} not found in enum`);return new RX({...T,checks:[],...d.normalizeParams(X),entries:Y})},$.exclude=(U,X)=>{let Y={...T.entries};for(let w of U)if(W.has(w))delete Y[w];else throw new Error(`Key ${w} not found in enum`);return new RX({...T,checks:[],...d.normalizeParams(X),entries:Y})}});function mK($,T){let W=Array.isArray($)?Object.fromEntries($.map((U)=>[U,U])):$;return new RX({type:"enum",entries:W,...d.normalizeParams(T)})}function Gx($,T){return new RX({type:"enum",entries:$,...d.normalizeParams(T)})}var cK=k("ZodLiteral",($,T)=>{X3.init($,T),J$.init($,T),$.values=new Set(T.values),Object.defineProperty($,"value",{get(){if(T.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return T.values[0]}})});function uK($,T){return new cK({type:"literal",values:Array.isArray($)?$:[$],...d.normalizeParams(T)})}var pK=k("ZodFile",($,T)=>{Y3.init($,T),J$.init($,T),$.min=(W,U)=>$.check(eT(W,U)),$.max=(W,U)=>$.check(X2(W,U)),$.mime=(W,U)=>$.check(VX(W,U))});function zx($){return mH(pK,$)}var dK=k("ZodTransform",($,T)=>{w3.init($,T),J$.init($,T),$._zod.parse=(W,U)=>{W.addIssue=(Y)=>{if(typeof Y==="string")W.issues.push(d.issue(Y,W.value,T));else{let w=Y;if(w.fatal)w.continue=!1;w.code??(w.code="custom"),w.input??(w.input=W.value),w.inst??(w.inst=$),w.continue??(w.continue=!0),W.issues.push(d.issue(w))}};let X=T.transform(W.value,W);if(X instanceof Promise)return X.then((Y)=>{return W.value=Y,W});return W.value=X,W}});function RF($){return new dK({type:"transform",transform:$})}var kF=k("ZodOptional",($,T)=>{G3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.innerType});function UG($){return new kF({type:"optional",innerType:$})}var oK=k("ZodNullable",($,T)=>{z3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.innerType});function XG($){return new oK({type:"nullable",innerType:$})}function Hx($){return UG(XG($))}var lK=k("ZodDefault",($,T)=>{H3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function rK($,T){return new lK({type:"default",innerType:$,get defaultValue(){return typeof T==="function"?T():T}})}var nK=k("ZodPrefault",($,T)=>{F3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.innerType});function iK($,T){return new nK({type:"prefault",innerType:$,get defaultValue(){return typeof T==="function"?T():T}})}var vF=k("ZodNonOptional",($,T)=>{O3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.innerType});function tK($,T){return new vF({type:"nonoptional",innerType:$,...d.normalizeParams(T)})}var aK=k("ZodSuccess",($,T)=>{Q3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.innerType});function Fx($){return new aK({type:"success",innerType:$})}var sK=k("ZodCatch",($,T)=>{Z3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function eK($,T){return new sK({type:"catch",innerType:$,catchValue:typeof T==="function"?T:()=>T})}var $E=k("ZodNaN",($,T)=>{D3.init($,T),J$.init($,T)});function Ox($){return BH($E,$)}var qF=k("ZodPipe",($,T)=>{UX.init($,T),J$.init($,T),$.in=T.in,$.out=T.out});function YG($,T){return new qF({type:"pipe",in:$,out:T})}var TE=k("ZodReadonly",($,T)=>{V3.init($,T),J$.init($,T)});function WE($){return new TE({type:"readonly",innerType:$})}var UE=k("ZodTemplateLiteral",($,T)=>{K3.init($,T),J$.init($,T)});function Qx($,T){return new UE({type:"template_literal",parts:$,...d.normalizeParams(T)})}var XE=k("ZodLazy",($,T)=>{A3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.getter()});function YE($){return new XE({type:"lazy",getter:$})}var wE=k("ZodPromise",($,T)=>{E3.init($,T),J$.init($,T),$.unwrap=()=>$._zod.def.innerType});function Zx($){return new wE({type:"promise",innerType:$})}var HG=k("ZodCustom",($,T)=>{M3.init($,T),J$.init($,T)});function GE($,T){let W=new G4({check:"custom",...d.normalizeParams(T)});return W._zod.check=$,W}function Dx($,T){return NX(HG,$??(()=>!0),T)}function zE($,T={}){return NX(HG,$,T)}function HE($,T){let W=GE((U)=>{return U.addIssue=(X)=>{if(typeof X==="string")U.issues.push(d.issue(X,U.value,W._zod.def));else{let Y=X;if(Y.fatal)Y.continue=!1;Y.code??(Y.code="custom"),Y.input??(Y.input=U.value),Y.inst??(Y.inst=W),Y.continue??(Y.continue=!W._zod.def.abort),U.issues.push(d.issue(Y))}},$(U.value,U)},T);return W}function Vx($,T={error:`Input not instance of ${$.name}`}){let W=new HG({type:"custom",check:"custom",fn:(U)=>U instanceof $,abort:!0,...d.normalizeParams(T)});return W._zod.bag.Class=$,W}var Kx=cH.bind(null,{Pipe:qF,Boolean:JX,Unknown:NF});function Ex($){let T=YE(()=>{return zG([eH($),_K(),RK(),PK(),LF(T),yK(eH(),T)])});return T}function Ax($,T){return YG(RF($),T)}var Mx={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},Nx=Object.freeze({status:"aborted"}),Lx=Nx;function Jx($){N4({customError:$})}function _x(){return N4().customError}N4(XX());function FE($,T){return function W({schema:U,fallback:X,toJsonSchema:Y=FG.toJSONSchema}){let w=Y(U);return async function G(H,z=3){let F,O=[];while(O.length<z){F=await $(H,w,X,O);let Q=await U["~standard"].validate(F);if("value"in Q)return Q.value;T?.warn(`safegen failed to generate well-formed data.
|
|
33
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);else if(W.cycles==="ref")U(z);continue}if(F.count>1){if(W.reused==="ref"){U(z);continue}}}let Y=(z,F)=>{let O=this.seen.get(z),Q=O.def??O.schema,Z={...Q};if(O.ref===null)return;let K=O.ref;if(O.ref=null,K){Y(K,F);let E=this.seen.get(K).schema;if(E.$ref&&F.target==="draft-7")Q.allOf=Q.allOf??[],Q.allOf.push(E);else Object.assign(Q,E),Object.assign(Q,Z)}if(!O.isParent)this.override({zodSchema:z,jsonSchema:Q})};for(let z of[...this.seen.entries()].reverse())Y(z[0],{target:this.target});let G={};if(this.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")G.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);Object.assign(G,w.def);let H=W.external?.defs??{};for(let z of this.seen.entries()){let F=z[1];if(F.def&&F.defId)H[F.defId]=F.def}if(!W.external&&Object.keys(H).length>0)if(this.target==="draft-2020-12")G.$defs=H;else G.definitions=H;try{return JSON.parse(JSON.stringify(G))}catch(z){throw new Error("Error converting schema to JSON.")}}}function vH($,T){if($ instanceof oX){let w=new uY(T),X={};for(let G of $._idmap.entries()){let[H,z]=G;w.process(z)}let U={},Y={registry:$,uri:T?.uri||((G)=>G),defs:X};for(let G of $._idmap.entries()){let[H,z]=G;U[H]=w.emit(z,{...T,external:Y})}if(Object.keys(X).length>0){let G=w.target==="draft-2020-12"?"$defs":"definitions";U.__shared={[G]:X}}return{schemas:U}}let W=new uY(T);return W.process($),W.emit($,T)}function v4($,T){let W=T??{seen:new Set};if(W.seen.has($))return!1;W.seen.add($);let X=$._zod.def;switch(X.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return v4(X.element,W);case"object":{for(let U in X.shape)if(v4(X.shape[U],W))return!0;return!1}case"union":{for(let U of X.options)if(v4(U,W))return!0;return!1}case"intersection":return v4(X.left,W)||v4(X.right,W);case"tuple":{for(let U of X.items)if(v4(U,W))return!0;if(X.rest&&v4(X.rest,W))return!0;return!1}case"record":return v4(X.keyType,W)||v4(X.valueType,W);case"map":return v4(X.keyType,W)||v4(X.valueType,W);case"set":return v4(X.valueType,W);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return v4(X.innerType,W);case"lazy":return v4(X.getter(),W);case"default":return v4(X.innerType,W);case"prefault":return v4(X.innerType,W);case"custom":return!1;case"transform":return!0;case"pipe":return v4(X.in,W)||v4(X.out,W);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${X.type}`)}var zK={};var rY={};e0(rY,{time:()=>CH,duration:()=>SH,datetime:()=>qH,date:()=>PH,ZodISOTime:()=>oY,ZodISODuration:()=>lY,ZodISODateTime:()=>pY,ZodISODate:()=>dY});var pY=k("ZodISODateTime",($,T)=>{Z7.init($,T),W4.init($,T)});function qH($){return d3(pY,$)}var dY=k("ZodISODate",($,T)=>{V7.init($,T),W4.init($,T)});function PH($){return o3(dY,$)}var oY=k("ZodISOTime",($,T)=>{K7.init($,T),W4.init($,T)});function CH($){return l3(oY,$)}var lY=k("ZodISODuration",($,T)=>{A7.init($,T),W4.init($,T)});function SH($){return r3(lY,$)}var FK=($,T)=>{bX.init($,T),$.name="ZodError",Object.defineProperties($,{format:{value:(W)=>hX($,W)},flatten:{value:(W)=>yX($,W)},addIssue:{value:(W)=>$.issues.push(W)},addIssues:{value:(W)=>$.issues.push(...W)},isEmpty:{get(){return $.issues.length===0}}})},aP=k("ZodError",FK),iW=k("ZodError",FK,{Parent:Error});var jH=UY(iW),IH=GY(iW),BH=HY(iW),xH=FY(iW);var k$=k("ZodType",($,T)=>{return K$.init($,T),$.def=T,Object.defineProperty($,"_def",{value:T}),$.check=(...W)=>{return $.clone({...T,checks:[...T.checks??[],...W.map((w)=>typeof w==="function"?{_zod:{check:w,def:{check:"custom"},onattach:[]}}:w)]})},$.clone=(W,w)=>a6($,W,w),$.brand=()=>$,$.register=(W,w)=>{return W.add($,w),$},$.parse=(W,w)=>jH($,W,w,{callee:$.parse}),$.safeParse=(W,w)=>BH($,W,w),$.parseAsync=async(W,w)=>IH($,W,w,{callee:$.parseAsync}),$.safeParseAsync=async(W,w)=>xH($,W,w),$.spa=$.safeParseAsync,$.refine=(W,w)=>$.check(tK(W,w)),$.superRefine=(W)=>$.check(aK(W)),$.overwrite=(W)=>$.check(K0(W)),$.optional=()=>tY($),$.nullable=()=>aY($),$.nullish=()=>tY(aY($)),$.nonoptional=(W)=>hK($,W),$.array=()=>XF($),$.or=(W)=>XG([$,W]),$.and=(W)=>RK($,W),$.transform=(W)=>sY($,YF(W)),$.default=(W)=>fK($,W),$.prefault=(W)=>yK($,W),$.catch=(W)=>cK($,W),$.pipe=(W)=>sY($,W),$.readonly=()=>dK($),$.describe=(W)=>{let w=$.clone();return o1.add(w,{description:W}),w},Object.defineProperty($,"description",{get(){return o1.get($)?.description},configurable:!0}),$.meta=(...W)=>{if(W.length===0)return o1.get($);let w=$.clone();return o1.add(w,W[0]),w},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$}),yH=k("_ZodString",($,T)=>{gX.init($,T),k$.init($,T);let W=$._zod.bag;$.format=W.format??null,$.minLength=W.minimum??null,$.maxLength=W.maximum??null,$.regex=(...w)=>$.check(nX(...w)),$.includes=(...w)=>$.check(aX(...w)),$.startsWith=(...w)=>$.check(sX(...w)),$.endsWith=(...w)=>$.check(eX(...w)),$.min=(...w)=>$.check(GT(...w)),$.max=(...w)=>$.check(rW(...w)),$.length=(...w)=>$.check(nW(...w)),$.nonempty=(...w)=>$.check(GT(1,...w)),$.lowercase=(w)=>$.check(iX(w)),$.uppercase=(w)=>$.check(tX(w)),$.trim=()=>$.check(W8()),$.normalize=(...w)=>$.check(T8(...w)),$.toLowerCase=()=>$.check(X8()),$.toUpperCase=()=>$.check(w8())}),eY=k("ZodString",($,T)=>{gX.init($,T),yH.init($,T),$.email=(W)=>$.check(LY(hH,W)),$.url=(W)=>$.check(vY(gH,W)),$.jwt=(W)=>$.check(cY($F,W)),$.emoji=(W)=>$.check(qY(mH,W)),$.guid=(W)=>$.check(lX(nY,W)),$.uuid=(W)=>$.check(JY(E0,W)),$.uuidv4=(W)=>$.check(RY(E0,W)),$.uuidv6=(W)=>$.check(_Y(E0,W)),$.uuidv7=(W)=>$.check(kY(E0,W)),$.nanoid=(W)=>$.check(PY(cH,W)),$.guid=(W)=>$.check(lX(nY,W)),$.cuid=(W)=>$.check(CY(uH,W)),$.cuid2=(W)=>$.check(SY(pH,W)),$.ulid=(W)=>$.check(jY(dH,W)),$.base64=(W)=>$.check(hY(aH,W)),$.base64url=(W)=>$.check(gY(sH,W)),$.xid=(W)=>$.check(IY(oH,W)),$.ksuid=(W)=>$.check(BY(lH,W)),$.ipv4=(W)=>$.check(xY(rH,W)),$.ipv6=(W)=>$.check(fY(nH,W)),$.cidrv4=(W)=>$.check(bY(iH,W)),$.cidrv6=(W)=>$.check(yY(tH,W)),$.e164=(W)=>$.check(mY(eH,W)),$.datetime=(W)=>$.check(qH(W)),$.date=(W)=>$.check(PH(W)),$.time=(W)=>$.check(CH(W)),$.duration=(W)=>$.check(SH(W))});function fH($){return u3(eY,$)}var W4=k("ZodStringFormat",($,T)=>{r$.init($,T),yH.init($,T)}),hH=k("ZodEmail",($,T)=>{w7.init($,T),W4.init($,T)});function eP($){return LY(hH,$)}var nY=k("ZodGUID",($,T)=>{W7.init($,T),W4.init($,T)});function $C($){return lX(nY,$)}var E0=k("ZodUUID",($,T)=>{X7.init($,T),W4.init($,T)});function TC($){return JY(E0,$)}function WC($){return RY(E0,$)}function XC($){return _Y(E0,$)}function wC($){return kY(E0,$)}var gH=k("ZodURL",($,T)=>{U7.init($,T),W4.init($,T)});function UC($){return vY(gH,$)}var mH=k("ZodEmoji",($,T)=>{Y7.init($,T),W4.init($,T)});function YC($){return qY(mH,$)}var cH=k("ZodNanoID",($,T)=>{G7.init($,T),W4.init($,T)});function GC($){return PY(cH,$)}var uH=k("ZodCUID",($,T)=>{z7.init($,T),W4.init($,T)});function zC($){return CY(uH,$)}var pH=k("ZodCUID2",($,T)=>{H7.init($,T),W4.init($,T)});function HC($){return SY(pH,$)}var dH=k("ZodULID",($,T)=>{F7.init($,T),W4.init($,T)});function FC($){return jY(dH,$)}var oH=k("ZodXID",($,T)=>{O7.init($,T),W4.init($,T)});function OC($){return IY(oH,$)}var lH=k("ZodKSUID",($,T)=>{Q7.init($,T),W4.init($,T)});function QC($){return BY(lH,$)}var rH=k("ZodIPv4",($,T)=>{E7.init($,T),W4.init($,T)});function ZC($){return xY(rH,$)}var nH=k("ZodIPv6",($,T)=>{M7.init($,T),W4.init($,T)});function VC($){return fY(nH,$)}var iH=k("ZodCIDRv4",($,T)=>{D7.init($,T),W4.init($,T)});function KC($){return bY(iH,$)}var tH=k("ZodCIDRv6",($,T)=>{N7.init($,T),W4.init($,T)});function AC($){return yY(tH,$)}var aH=k("ZodBase64",($,T)=>{J7.init($,T),W4.init($,T)});function EC($){return hY(aH,$)}var sH=k("ZodBase64URL",($,T)=>{R7.init($,T),W4.init($,T)});function MC($){return gY(sH,$)}var eH=k("ZodE164",($,T)=>{_7.init($,T),W4.init($,T)});function DC($){return mY(eH,$)}var $F=k("ZodJWT",($,T)=>{k7.init($,T),W4.init($,T)});function NC($){return cY($F,$)}var z8=k("ZodNumber",($,T)=>{EY.init($,T),k$.init($,T),$.gt=(w,X)=>$.check(V0(w,X)),$.gte=(w,X)=>$.check(B6(w,X)),$.min=(w,X)=>$.check(B6(w,X)),$.lt=(w,X)=>$.check(Z0(w,X)),$.lte=(w,X)=>$.check(V1(w,X)),$.max=(w,X)=>$.check(V1(w,X)),$.int=(w)=>$.check(bH(w)),$.safe=(w)=>$.check(bH(w)),$.positive=(w)=>$.check(V0(0,w)),$.nonnegative=(w)=>$.check(B6(0,w)),$.negative=(w)=>$.check(Z0(0,w)),$.nonpositive=(w)=>$.check(V1(0,w)),$.multipleOf=(w,X)=>$.check(lT(w,X)),$.step=(w,X)=>$.check(lT(w,X)),$.finite=()=>$;let W=$._zod.bag;$.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),$.isFinite=!0,$.format=W.format??null});function OK($){return n3(z8,$)}var tW=k("ZodNumberFormat",($,T)=>{v7.init($,T),z8.init($,T)});function bH($){return t3(tW,$)}function LC($){return a3(tW,$)}function JC($){return s3(tW,$)}function RC($){return e3(tW,$)}function _C($){return $H(tW,$)}var H8=k("ZodBoolean",($,T)=>{mX.init($,T),k$.init($,T)});function QK($){return TH(H8,$)}var F8=k("ZodBigInt",($,T)=>{MY.init($,T),k$.init($,T),$.gte=(w,X)=>$.check(B6(w,X)),$.min=(w,X)=>$.check(B6(w,X)),$.gt=(w,X)=>$.check(V0(w,X)),$.gte=(w,X)=>$.check(B6(w,X)),$.min=(w,X)=>$.check(B6(w,X)),$.lt=(w,X)=>$.check(Z0(w,X)),$.lte=(w,X)=>$.check(V1(w,X)),$.max=(w,X)=>$.check(V1(w,X)),$.positive=(w)=>$.check(V0(BigInt(0),w)),$.negative=(w)=>$.check(Z0(BigInt(0),w)),$.nonpositive=(w)=>$.check(V1(BigInt(0),w)),$.nonnegative=(w)=>$.check(B6(BigInt(0),w)),$.multipleOf=(w,X)=>$.check(lT(w,X));let W=$._zod.bag;$.minValue=W.minimum??null,$.maxValue=W.maximum??null,$.format=W.format??null});function kC($){return XH(F8,$)}var TF=k("ZodBigIntFormat",($,T)=>{q7.init($,T),F8.init($,T)});function vC($){return UH(TF,$)}function qC($){return YH(TF,$)}var ZK=k("ZodSymbol",($,T)=>{P7.init($,T),k$.init($,T)});function PC($){return GH(ZK,$)}var VK=k("ZodUndefined",($,T)=>{C7.init($,T),k$.init($,T)});function CC($){return zH(VK,$)}var KK=k("ZodNull",($,T)=>{S7.init($,T),k$.init($,T)});function AK($){return HH(KK,$)}var EK=k("ZodAny",($,T)=>{j7.init($,T),k$.init($,T)});function SC(){return FH(EK)}var WF=k("ZodUnknown",($,T)=>{YT.init($,T),k$.init($,T)});function iY(){return oW(WF)}var MK=k("ZodNever",($,T)=>{I7.init($,T),k$.init($,T)});function $G($){return OH(MK,$)}var DK=k("ZodVoid",($,T)=>{B7.init($,T),k$.init($,T)});function jC($){return QH(DK,$)}var TG=k("ZodDate",($,T)=>{x7.init($,T),k$.init($,T),$.min=(w,X)=>$.check(B6(w,X)),$.max=(w,X)=>$.check(V1(w,X));let W=$._zod.bag;$.minDate=W.minimum?new Date(W.minimum):null,$.maxDate=W.maximum?new Date(W.maximum):null});function IC($){return ZH(TG,$)}var NK=k("ZodArray",($,T)=>{cX.init($,T),k$.init($,T),$.element=T.element,$.min=(W,w)=>$.check(GT(W,w)),$.nonempty=(W)=>$.check(GT(1,W)),$.max=(W,w)=>$.check(rW(W,w)),$.length=(W,w)=>$.check(nW(W,w)),$.unwrap=()=>$.element});function XF($,T){return U8(NK,$,T)}function BC($){let T=$._zod.def.shape;return SK(Object.keys(T))}var WG=k("ZodObject",($,T)=>{f7.init($,T),k$.init($,T),l.defineLazy($,"shape",()=>{return Object.fromEntries(Object.entries($._zod.def.shape))}),$.keyof=()=>PK(Object.keys($._zod.def.shape)),$.catchall=(W)=>$.clone({...$._zod.def,catchall:W}),$.passthrough=()=>$.clone({...$._zod.def,catchall:iY()}),$.loose=()=>$.clone({...$._zod.def,catchall:iY()}),$.strict=()=>$.clone({...$._zod.def,catchall:$G()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(W)=>{return l.extend($,W)},$.merge=(W)=>l.merge($,W),$.pick=(W)=>l.pick($,W),$.omit=(W)=>l.omit($,W),$.partial=(...W)=>l.partial(GF,$,W[0]),$.required=(...W)=>l.required(zF,$,W[0])});function xC($,T){let W={type:"object",get shape(){return l.assignProp(this,"shape",{...$}),this.shape},...l.normalizeParams(T)};return new WG(W)}function fC($,T){return new WG({type:"object",get shape(){return l.assignProp(this,"shape",{...$}),this.shape},catchall:$G(),...l.normalizeParams(T)})}function bC($,T){return new WG({type:"object",get shape(){return l.assignProp(this,"shape",{...$}),this.shape},catchall:iY(),...l.normalizeParams(T)})}var wF=k("ZodUnion",($,T)=>{DY.init($,T),k$.init($,T),$.options=T.options});function XG($,T){return new wF({type:"union",options:$,...l.normalizeParams(T)})}var LK=k("ZodDiscriminatedUnion",($,T)=>{wF.init($,T),b7.init($,T)});function yC($,T,W){return new LK({type:"union",options:T,discriminator:$,...l.normalizeParams(W)})}var JK=k("ZodIntersection",($,T)=>{y7.init($,T),k$.init($,T)});function RK($,T){return new JK({type:"intersection",left:$,right:T})}var _K=k("ZodTuple",($,T)=>{oT.init($,T),k$.init($,T),$.rest=(W)=>$.clone({...$._zod.def,rest:W})});function hC($,T,W){let w=T instanceof K$,X=w?W:T;return new _K({type:"tuple",items:$,rest:w?T:null,...l.normalizeParams(X)})}var UF=k("ZodRecord",($,T)=>{h7.init($,T),k$.init($,T),$.keyType=T.keyType,$.valueType=T.valueType});function kK($,T,W){return new UF({type:"record",keyType:$,valueType:T,...l.normalizeParams(W)})}function gC($,T,W){return new UF({type:"record",keyType:XG([$,$G()]),valueType:T,...l.normalizeParams(W)})}var vK=k("ZodMap",($,T)=>{g7.init($,T),k$.init($,T),$.keyType=T.keyType,$.valueType=T.valueType});function mC($,T,W){return new vK({type:"map",keyType:$,valueType:T,...l.normalizeParams(W)})}var qK=k("ZodSet",($,T)=>{m7.init($,T),k$.init($,T),$.min=(...W)=>$.check(rT(...W)),$.nonempty=(W)=>$.check(rT(1,W)),$.max=(...W)=>$.check(lW(...W)),$.size=(...W)=>$.check(rX(...W))});function cC($,T){return new qK({type:"set",valueType:$,...l.normalizeParams(T)})}var G8=k("ZodEnum",($,T)=>{c7.init($,T),k$.init($,T),$.enum=T.entries,$.options=Object.values(T.entries);let W=new Set(Object.keys(T.entries));$.extract=(w,X)=>{let U={};for(let Y of w)if(W.has(Y))U[Y]=T.entries[Y];else throw new Error(`Key ${Y} not found in enum`);return new G8({...T,checks:[],...l.normalizeParams(X),entries:U})},$.exclude=(w,X)=>{let U={...T.entries};for(let Y of w)if(W.has(Y))delete U[Y];else throw new Error(`Key ${Y} not found in enum`);return new G8({...T,checks:[],...l.normalizeParams(X),entries:U})}});function PK($,T){let W=Array.isArray($)?Object.fromEntries($.map((w)=>[w,w])):$;return new G8({type:"enum",entries:W,...l.normalizeParams(T)})}function uC($,T){return new G8({type:"enum",entries:$,...l.normalizeParams(T)})}var CK=k("ZodLiteral",($,T)=>{u7.init($,T),k$.init($,T),$.values=new Set(T.values),Object.defineProperty($,"value",{get(){if(T.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return T.values[0]}})});function SK($,T){return new CK({type:"literal",values:Array.isArray($)?$:[$],...l.normalizeParams(T)})}var jK=k("ZodFile",($,T)=>{p7.init($,T),k$.init($,T),$.min=(W,w)=>$.check(rT(W,w)),$.max=(W,w)=>$.check(lW(W,w)),$.mime=(W,w)=>$.check($8(Array.isArray(W)?W:[W],w))});function pC($){return JH(jK,$)}var IK=k("ZodTransform",($,T)=>{d7.init($,T),k$.init($,T),$._zod.parse=(W,w)=>{W.addIssue=(U)=>{if(typeof U==="string")W.issues.push(l.issue(U,W.value,T));else{let Y=U;if(Y.fatal)Y.continue=!1;Y.code??(Y.code="custom"),Y.input??(Y.input=W.value),Y.inst??(Y.inst=$),Y.continue??(Y.continue=!0),W.issues.push(l.issue(Y))}};let X=T.transform(W.value,W);if(X instanceof Promise)return X.then((U)=>{return W.value=U,W});return W.value=X,W}});function YF($){return new IK({type:"transform",transform:$})}var GF=k("ZodOptional",($,T)=>{o7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function tY($){return new GF({type:"optional",innerType:$})}var BK=k("ZodNullable",($,T)=>{l7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function aY($){return new BK({type:"nullable",innerType:$})}function dC($){return tY(aY($))}var xK=k("ZodDefault",($,T)=>{r7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function fK($,T){return new xK({type:"default",innerType:$,get defaultValue(){return typeof T==="function"?T():T}})}var bK=k("ZodPrefault",($,T)=>{n7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function yK($,T){return new bK({type:"prefault",innerType:$,get defaultValue(){return typeof T==="function"?T():T}})}var zF=k("ZodNonOptional",($,T)=>{i7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function hK($,T){return new zF({type:"nonoptional",innerType:$,...l.normalizeParams(T)})}var gK=k("ZodSuccess",($,T)=>{t7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function oC($){return new gK({type:"success",innerType:$})}var mK=k("ZodCatch",($,T)=>{a7.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function cK($,T){return new mK({type:"catch",innerType:$,catchValue:typeof T==="function"?T:()=>T})}var uK=k("ZodNaN",($,T)=>{s7.init($,T),k$.init($,T)});function lC($){return KH(uK,$)}var HF=k("ZodPipe",($,T)=>{uX.init($,T),k$.init($,T),$.in=T.in,$.out=T.out});function sY($,T){return new HF({type:"pipe",in:$,out:T})}var pK=k("ZodReadonly",($,T)=>{e7.init($,T),k$.init($,T)});function dK($){return new pK({type:"readonly",innerType:$})}var oK=k("ZodTemplateLiteral",($,T)=>{$3.init($,T),k$.init($,T)});function rC($,T){return new oK({type:"template_literal",parts:$,...l.normalizeParams(T)})}var lK=k("ZodLazy",($,T)=>{W3.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.getter()});function rK($){return new lK({type:"lazy",getter:$})}var nK=k("ZodPromise",($,T)=>{T3.init($,T),k$.init($,T),$.unwrap=()=>$._zod.def.innerType});function nC($){return new nK({type:"promise",innerType:$})}var wG=k("ZodCustom",($,T)=>{X3.init($,T),k$.init($,T)});function iK($,T){let W=new z4({check:"custom",...l.normalizeParams(T)});return W._zod.check=$,W}function iC($,T){return Y8(wG,$??(()=>!0),T)}function tK($,T={}){return Y8(wG,$,T)}function aK($,T){let W=iK((w)=>{return w.addIssue=(X)=>{if(typeof X==="string")w.issues.push(l.issue(X,w.value,W._zod.def));else{let U=X;if(U.fatal)U.continue=!1;U.code??(U.code="custom"),U.input??(U.input=w.value),U.inst??(U.inst=W),U.continue??(U.continue=!W._zod.def.abort),w.issues.push(l.issue(U))}},$(w.value,w)},T);return W}function tC($,T={error:`Input not instance of ${$.name}`}){let W=new wG({type:"custom",check:"custom",fn:(w)=>w instanceof $,abort:!0,...l.normalizeParams(T)});return W._zod.bag.Class=$,W}var aC=(...$)=>RH({Pipe:HF,Boolean:H8,Unknown:WF},...$);function sC($){let T=rK(()=>{return XG([fH($),OK(),QK(),AK(),XF(T),kK(fH(),T)])});return T}function eC($,T){return sY(YF($),T)}var $S={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},TS=Object.freeze({status:"aborted"}),WS=TS;function XS($){N4({customError:$})}function wS(){return N4().customError}var FF={};e0(FF,{string:()=>US,number:()=>YS,date:()=>HS,boolean:()=>GS,bigint:()=>zS});function US($){return p3(eY,$)}function YS($){return i3(z8,$)}function GS($){return WH(H8,$)}function zS($){return wH(F8,$)}function HS($){return VH(TG,$)}N4(pX());function sK($,T){return function W({schema:w,fallback:X,toJsonSchema:U=UG.toJSONSchema}){let Y=U(w);return async function G(H,z=3){let F,O=[];while(O.length<z){F=await $(H,Y,X,O);let Q=await w["~standard"].validate(F);if("value"in Q)return Q.value;T?.warn(`safegen failed to generate well-formed data.
|
|
34
34
|
`,`Here's what was returned last time:
|
|
35
35
|
`,JSON.stringify(F,null,"\t"),`
|
|
36
36
|
`,`Here are the issues returned from our validation:
|
|
37
|
-
`,JSON.stringify(Q.issues,null,"\t")),O.push({response:F,error:Q})}return T?.error(`safegen was unable to generate well-formed data after ${z} failed attempts.`),X}}}function
|
|
38
|
-
`)}var
|
|
37
|
+
`,JSON.stringify(Q.issues,null,"\t")),O.push({response:F,error:Q})}return T?.error(`safegen was unable to generate well-formed data after ${z} failed attempts.`),X}}}function eK($){return["Please generate a response in JSON that conforms to the following JSON Schema:",JSON.stringify($,null,2)].join(`
|
|
38
|
+
`)}var zA=Hq(WA(),1);import*as x6 from"fs";import*as aW from"path";import{resolve as KS}from"path";import{createHash as AS}from"crypto";import{copyFile as ES}from"fs/promises";import{existsSync as OF,mkdirSync as XA,readFileSync as ZS,readdirSync as wA,rmSync as UA,statSync as YA,writeFileSync as VS}from"fs";import{resolve as QF}from"path";var GA=class{rootDir;get initialized(){return OF(this.rootDir)}initialize(){if(!this.initialized)XA(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let T=QF(this.rootDir,$);if(OF(T))return ZS(T,"utf-8");return null}setItem($,T){this.initialize();let W=QF(this.rootDir,$);VS(W,T)}removeItem($){let T=QF(this.rootDir,$);if(OF(T))this.initialize(),UA(T)}key($){return wA(this.rootDir).sort((w,X)=>{let U=YA(w);return YA(X).ctimeMs-U.ctimeMs})[$]??null}clear(){UA(this.rootDir,{recursive:!0}),XA(this.rootDir,{recursive:!0})}get length(){return wA(this.rootDir).length}};var HA=/[^a-zA-Z0-9\-._]/g;function V8($,T=64){if(T%2===1)T+=1;let W=$.replace(HA,"-");if(W.length<=T)return W;let w=AS("sha256").update($).digest("base64").slice(0,8).replaceAll("/","_"),X=W;if(X.length>T){let U=X.slice(0,T/2),Y=X.slice(-T/2);X=U+"_"+Y}return X+"+"+w}var MS=zA.default("varmint"),Z8=V8(process.cwd(),150),ZF=KS(MS,Z8),q4="_-$-_-$-_",FA=`file${q4}`,OA=`list${q4}`,QA=`root${q4}`,DS=`unmatched${q4}`,n$={storage:new GA({path:ZF,eagerInit:!1}),startGlobalTracking(){if(console.log(`\uD83D\uDC3F\uFE0F Starting global tracking of varmint files using project identifier "${Z8}"`),n$.storage.initialized)console.error(`\uD83D\uDCA5 The global cache for the project "${Z8}" was found already initialized. Clearing it and starting fresh.`),n$.storage.clear();n$.storage.initialize()},async prepareUploads($){console.log(`\uD83D\uDC3F\uFE0F Moving unmatched inputs to /tmp/varmint-uploads using project identifier "${Z8}"`);let T=[];for(let W of x6.readdirSync(n$.storage.rootDir))if(YG(`unmatched${q4}`,W))T.push(W);if(T.length===0){console.log("\uD83D\uDC3F\uFE0F ","No unmatched input files found.");return}if(console.log("\uD83D\uDC3F\uFE0F ","Found the following unmatched files:",`
|
|
39
39
|
- ${T.join(`
|
|
40
40
|
`)}
|
|
41
41
|
`,`in root folder:
|
|
42
|
-
`,
|
|
42
|
+
`,ZF),process.env[$])x6.mkdirSync("/tmp/varmint-uploads",{recursive:!0}),await Promise.all(T.map(async(W)=>{let w=aW.join(ZF,W),X=aW.join("/tmp/varmint-uploads",W);await ES(w,X)}));else console.warn("\uD83D\uDCA5 Skipping artifact upload because process.env.CI is not set.")},endGlobalTrackingAndFlushUnusedFiles(){if(console.log(`\uD83D\uDC3F\uFE0F Ending global tracking of varmint files using project identifier "${Z8}" and starting cleanup of untouched files.`),!n$.storage.initialized){console.error("\uD83D\uDCA5 called flushGlobal, but the global cache wasn't initialized with startGlobalTracking");return}let $=x6.readdirSync(n$.storage.rootDir),T=new Map,W=[],w=[],X=[];for(let Y of $)if(YG(`root${q4}`,Y))W.push(Y);else if(YG(`list${q4}`,Y))w.push(Y);else if(YG(`file${q4}`,Y))X.push(Y);if(n$.storage.getItem("DID_CACHE_MISS"))console.log("\uD83D\uDC3F\uFE0F ","Cache miss detected. Since this likely prevented the cache from being fully utilized, we will not attempt to flush unused files.");else{let Y=new Map;for(let G of W){let H=G.replace(QA,"");Y.set(H,new Map);let z=n$.storage.getItem(G);if(z)T.set(H,z);else console.error(`\uD83D\uDCA5 Could not find folder ${z} referenced in the global cache`)}for(let G of w){let H=G.replace(OA,""),[z,F]=H.split(q4),O=Y.get(z);if(O)O.set(F,new Set);else console.error(`\uD83D\uDCA5 Could not find root ${z} for list ${F}`)}for(let G of X){let H=G.replace(FA,""),[z,F,O]=H.split(q4),Q=Y.get(z);if(Q){let Z=Q.get(F);if(Z)Z.add(O);else console.error(`\uD83D\uDCA5 Could not find list ${F} for file ${H}`)}else console.error(`\uD83D\uDCA5 Could not find root ${z} for file ${H}`)}console.log("\uD83D\uDC3F\uFE0F ",Y);for(let[G,H]of Y.entries()){let z=T.get(G);if(!z){console.error(`\uD83D\uDCA5 Could not find root ${G}`);continue}if(!x6.existsSync(z)){console.warn(`\uD83D\uDCA5 Root folder ${z}, identified as being used during tracking, no longer exists during cleanup.`);continue}let O=x6.readdirSync(z);for(let Q of O)if(Q!==".ferret"&&!H.has(Q)){let Z=aW.join(z,Q);console.log(`\uD83E\uDDF9 globalFlush: removing directory ${Z}`),x6.rmSync(Z,{recursive:!0})}for(let[Q,Z]of H.entries()){let K=aW.join(z,Q);if(!x6.existsSync(K)){console.warn(`\uD83D\uDCA5 List folder ${K}, identified as being used during tracking, no longer exists.`);continue}let M=x6.readdirSync(K);for(let L of M){let R=L.replace(".input.json","").replace(".output.json","").replace(".stream.txt","");if(!Z.has(R)){let _=aW.join(K,L);console.log(`\uD83E\uDDF9 globalFlush: removing file ${_}`),x6.rmSync(_)}}}}}x6.rmSync(n$.storage.rootDir,{recursive:!0})}};function YG($,T){return T.startsWith($)}import*as K4 from"fs";import*as C1 from"path";import{inspect as ZA}from"util";var VA=class{filenameCache=new Map;filesTouched=new Map;mode;baseDir;rootName;constructor($="off",T=C1.join(process.cwd(),".varmint")){if(this.mode=$,this.baseDir=T,this.rootName=V8(this.baseDir),n$.storage.initialized&&!n$.storage.getItem(`root${q4}${this.rootName}`))n$.storage.setItem(`root${q4}${this.rootName}`,this.baseDir)}read($,T,W){let w=C1.join(this.baseDir,$),X=`${T}.input.json`,U=C1.join(w,X);if(!K4.existsSync(U)){if(!K4.existsSync(w)){if(n$.storage.initialized&&this.mode==="read")n$.storage.setItem("DID_CACHE_MISS","true");throw new Error(`Squirrel: input file for key "${$}" with "${T}" was not found. Directory "${w}" does not exist.`)}let O=K4.readdirSync(w).map((K)=>[K,K4.readFileSync(C1.join(w,K),"utf-8")]).filter(([K])=>K.endsWith(".input.json")),Q=[];for(let[K,E]of O){let M=` ${K}`,L=` ${ZA(JSON.parse(E),{depth:Number.POSITIVE_INFINITY,colors:!0}).split(`
|
|
43
43
|
`).join(`
|
|
44
|
-
`)}`;Q.push(
|
|
45
|
-
${
|
|
44
|
+
`)}`;Q.push(M,L)}let Z=` ${X}
|
|
45
|
+
${ZA(W,{depth:Number.POSITIVE_INFINITY,colors:!0}).split(`
|
|
46
46
|
`).join(`
|
|
47
|
-
`)}`;if(
|
|
47
|
+
`)}`;if(n$.storage.initialized&&this.mode==="read")n$.storage.setItem(`unmatched${q4}${X}`,JSON.stringify(W,null,"\t")),n$.storage.setItem("DID_CACHE_MISS","true");throw new Error(`Squirrel: input file for key "${$}" with subKey "${T}" (${U}) was not found. Directory "${w}" exists, but the file does not. Below is a list of CACHED INPUT FILES from that directory and their contents, followed by YOUR INPUT DATA.
|
|
48
48
|
|
|
49
49
|
CACHED INPUT FILES:
|
|
50
50
|
${Q.join(`
|
|
@@ -52,22 +52,24 @@ ${Q.join(`
|
|
|
52
52
|
|
|
53
53
|
YOUR INPUT DATA:
|
|
54
54
|
${Z}
|
|
55
|
-
`)}let
|
|
55
|
+
`)}let Y=K4.readFileSync(U,"utf-8"),G=JSON.stringify(W,null,"\t");if(G!==Y){if(n$.storage.initialized&&this.mode==="read")n$.storage.setItem("DID_CACHE_MISS","true");throw new Error(`Squirrel: the content of the cached input file ${U} does not match the input provided.
|
|
56
56
|
|
|
57
57
|
Provided:
|
|
58
58
|
${G}
|
|
59
59
|
|
|
60
60
|
Cached:
|
|
61
|
-
${w}`)}let H=j1.join(this.baseDir,`${$}/${T}.output.json`);return JSON.parse(V4.readFileSync(H,"utf-8"))}async write($,T,W,U){let X=j1.join(this.baseDir,$),Y=j1.join(X,`${T}.input.json`),w=j1.join(X,`${T}.output.json`),G=JSON.stringify(W,null,"\t");if(!V4.existsSync(this.baseDir))V4.mkdirSync(this.baseDir,{recursive:!0});if(!V4.existsSync(X))V4.mkdirSync(X);if(V4.writeFileSync(Y,G),V4.existsSync(w))V4.unlinkSync(w);let H=await U(...W),z=JSON.stringify(H,null,"\t");return V4.writeFileSync(w,z),H}add($,T){let W=`${this.rootName}${v4}${PX($)}`;return{flush:()=>{this.flush($)},for:(U)=>{if(this.mode!=="off"){if(this.filesTouched.set($,new Set),r$.storage.initialized&&!r$.storage.getItem(`list${v4}${W}`))r$.storage.setItem(`list${v4}${W}`,"true")}return{get:async(...X)=>{let Y=U;if(this.mode!=="off"){let w=this.filenameCache.get(U);if(!w)w=PX(U),this.filenameCache.set(U,w);Y=w,this.filesTouched.get($)?.add(Y);let G=`${W}${v4}${Y}`,H=`file${v4}${G}`;if(r$.storage.initialized&&!r$.storage.getItem(H))r$.storage.setItem(H,"true")}switch(this.mode){case"off":return T(...X);case"read":return this.read($,Y,X);case"write":return this.write($,Y,X,T);case"read-write":try{return this.read($,Y,X)}catch(w){if(w instanceof Error)return this.write($,Y,X,T);throw w}}}}}}}flush(...$){console.log(this.filesTouched);for(let[T,W]of this.filesTouched.entries())if($.length===0||$.includes(T)){let U=j1.join(this.baseDir,T),X=V4.readdirSync(U);for(let Y of X){let w=Y.replace(".input.json","").replace(".output.json","");if(!W.has(w))console.info(`\uD83E\uDDF9 Flushing ${w}`),V4.unlinkSync(j1.join(U,Y))}}}};var QG="RFC3986",ZG={RFC1738:($)=>String($).replace(/%20/g,"+"),RFC3986:($)=>String($)},qE="RFC1738";var Ix=Array.isArray,i1=(()=>{let $=[];for(let T=0;T<256;++T)$.push("%"+((T<16?"0":"")+T.toString(16)).toUpperCase());return $})();var jF=1024,PE=($,T,W,U,X)=>{if($.length===0)return $;let Y=$;if(typeof $==="symbol")Y=Symbol.prototype.toString.call($);else if(typeof $!=="string")Y=String($);if(W==="iso-8859-1")return escape(Y).replace(/%u[0-9a-f]{4}/gi,function(G){return"%26%23"+parseInt(G.slice(2),16)+"%3B"});let w="";for(let G=0;G<Y.length;G+=jF){let H=Y.length>=jF?Y.slice(G,G+jF):Y,z=[];for(let F=0;F<H.length;++F){let O=H.charCodeAt(F);if(O===45||O===46||O===95||O===126||O>=48&&O<=57||O>=65&&O<=90||O>=97&&O<=122||X===qE&&(O===40||O===41)){z[z.length]=H.charAt(F);continue}if(O<128){z[z.length]=i1[O];continue}if(O<2048){z[z.length]=i1[192|O>>6]+i1[128|O&63];continue}if(O<55296||O>=57344){z[z.length]=i1[224|O>>12]+i1[128|O>>6&63]+i1[128|O&63];continue}F+=1,O=65536+((O&1023)<<10|H.charCodeAt(F)&1023),z[z.length]=i1[240|O>>18]+i1[128|O>>12&63]+i1[128|O>>6&63]+i1[128|O&63]}w+=z.join("")}return w};function CE($){if(!$||typeof $!=="object")return!1;return!!($.constructor&&$.constructor.isBuffer&&$.constructor.isBuffer($))}function BF($,T){if(Ix($)){let W=[];for(let U=0;U<$.length;U+=1)W.push(T($[U]));return W}return T($)}var bx=Object.prototype.hasOwnProperty,SE={brackets($){return String($)+"[]"},comma:"comma",indices($,T){return String($)+"["+T+"]"},repeat($){return String($)}},t1=Array.isArray,fx=Array.prototype.push,jE=function($,T){fx.apply($,t1(T)?T:[T])},yx=Date.prototype.toISOString,q4={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:PE,encodeValuesOnly:!1,format:QG,formatter:ZG[QG],indices:!1,serializeDate($){return yx.call($)},skipNulls:!1,strictNullHandling:!1};function hx($){return typeof $==="string"||typeof $==="number"||typeof $==="boolean"||typeof $==="symbol"||typeof $==="bigint"}var xF={};function BE($,T,W,U,X,Y,w,G,H,z,F,O,Q,Z,V,E,N,J){let _=$,R=J,P=0,x=!1;while((R=R.get(xF))!==void 0&&!x){let S=R.get($);if(P+=1,typeof S!=="undefined")if(S===P)throw new RangeError("Cyclic object value");else x=!0;if(typeof R.get(xF)==="undefined")P=0}if(typeof z==="function")_=z(T,_);else if(_ instanceof Date)_=Q?.(_);else if(W==="comma"&&t1(_))_=BF(_,function(S){if(S instanceof Date)return Q?.(S);return S});if(_===null){if(Y)return H&&!E?H(T,q4.encoder,N,"key",Z):T;_=""}if(hx(_)||CE(_)){if(H){let S=E?T:H(T,q4.encoder,N,"key",Z);return[V?.(S)+"="+V?.(H(_,q4.encoder,N,"value",Z))]}return[V?.(T)+"="+V?.(String(_))]}let f=[];if(typeof _==="undefined")return f;let h;if(W==="comma"&&t1(_)){if(E&&H)_=BF(_,H);h=[{value:_.length>0?_.join(",")||null:void 0}]}else if(t1(z))h=z;else{let S=Object.keys(_);h=F?S.sort(F):S}let a=G?String(T).replace(/\./g,"%2E"):String(T),M$=U&&t1(_)&&_.length===1?a+"[]":a;if(X&&t1(_)&&_.length===0)return M$+"[]";for(let S=0;S<h.length;++S){let W$=h[S],n=typeof W$==="object"&&typeof W$.value!=="undefined"?W$.value:_[W$];if(w&&n===null)continue;let Y$=O&&G?W$.replace(/\./g,"%2E"):W$,j$=t1(_)?typeof W==="function"?W(M$,Y$):M$:M$+(O?"."+Y$:"["+Y$+"]");J.set($,P);let s$=new WeakMap;s$.set(xF,J),jE(f,BE(n,j$,W,U,X,Y,w,G,W==="comma"&&E&&t1(_)?null:H,z,F,O,Q,Z,V,E,N,s$))}return f}function gx($=q4){if(typeof $.allowEmptyArrays!=="undefined"&&typeof $.allowEmptyArrays!=="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof $.encodeDotInKeys!=="undefined"&&typeof $.encodeDotInKeys!=="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if($.encoder!==null&&typeof $.encoder!=="undefined"&&typeof $.encoder!=="function")throw new TypeError("Encoder has to be a function.");let T=$.charset||q4.charset;if(typeof $.charset!=="undefined"&&$.charset!=="utf-8"&&$.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let W=QG;if(typeof $.format!=="undefined"){if(!bx.call(ZG,$.format))throw new TypeError("Unknown format option provided.");W=$.format}let U=ZG[W],X=q4.filter;if(typeof $.filter==="function"||t1($.filter))X=$.filter;let Y;if($.arrayFormat&&$.arrayFormat in SE)Y=$.arrayFormat;else if("indices"in $)Y=$.indices?"indices":"repeat";else Y=q4.arrayFormat;if("commaRoundTrip"in $&&typeof $.commaRoundTrip!=="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let w=typeof $.allowDots==="undefined"?!!$.encodeDotInKeys===!0?!0:q4.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix==="boolean"?$.addQueryPrefix:q4.addQueryPrefix,allowDots:w,allowEmptyArrays:typeof $.allowEmptyArrays==="boolean"?!!$.allowEmptyArrays:q4.allowEmptyArrays,arrayFormat:Y,charset:T,charsetSentinel:typeof $.charsetSentinel==="boolean"?$.charsetSentinel:q4.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter==="undefined"?q4.delimiter:$.delimiter,encode:typeof $.encode==="boolean"?$.encode:q4.encode,encodeDotInKeys:typeof $.encodeDotInKeys==="boolean"?$.encodeDotInKeys:q4.encodeDotInKeys,encoder:typeof $.encoder==="function"?$.encoder:q4.encoder,encodeValuesOnly:typeof $.encodeValuesOnly==="boolean"?$.encodeValuesOnly:q4.encodeValuesOnly,filter:X,format:W,formatter:U,serializeDate:typeof $.serializeDate==="function"?$.serializeDate:q4.serializeDate,skipNulls:typeof $.skipNulls==="boolean"?$.skipNulls:q4.skipNulls,sort:typeof $.sort==="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling==="boolean"?$.strictNullHandling:q4.strictNullHandling}}function IF($,T={}){let W=$,U=gx(T),X,Y;if(typeof U.filter==="function")Y=U.filter,W=Y("",W);else if(t1(U.filter))Y=U.filter,X=Y;let w=[];if(typeof W!=="object"||W===null)return"";let G=SE[U.arrayFormat],H=G==="comma"&&U.commaRoundTrip;if(!X)X=Object.keys(W);if(U.sort)X.sort(U.sort);let z=new WeakMap;for(let Q=0;Q<X.length;++Q){let Z=X[Q];if(U.skipNulls&&W[Z]===null)continue;jE(w,BE(W[Z],Z,G,H,U.allowEmptyArrays,U.strictNullHandling,U.skipNulls,U.encodeDotInKeys,U.encode?U.encoder:null,U.filter,U.sort,U.allowDots,U.serializeDate,U.format,U.formatter,U.encodeValuesOnly,U.charset,z))}let F=w.join(U.delimiter),O=U.addQueryPrefix===!0?"?":"";if(U.charsetSentinel)if(U.charset==="iso-8859-1")O+="utf8=%26%2310003%3B&";else O+="utf8=%E2%9C%93&";return F.length>0?O+F:""}var $W="4.103.0";var xE=!1,TW=void 0,bF=void 0,cx=void 0,ux=void 0,px=void 0,fF=void 0,dx=void 0,DG=void 0,yF=void 0,hF=void 0,gF=void 0,VG=void 0,mF=void 0;function IE($,T={auto:!1}){if(xE)throw new Error(`you must \`import 'openai/shims/${$.kind}'\` before importing anything else from openai`);if(TW)throw new Error(`can't \`import 'openai/shims/${$.kind}'\` after \`import 'openai/shims/${TW}'\``);xE=T.auto,TW=$.kind,bF=$.fetch,cx=$.Request,ux=$.Response,px=$.Headers,fF=$.FormData,dx=$.Blob,DG=$.File,yF=$.ReadableStream,hF=$.getMultipartRequestOptions,gF=$.getDefaultAgent,VG=$.fileFromPath,mF=$.isFsReadStream}class cF{constructor($){this.body=$}get[Symbol.toStringTag](){return"MultipartBody"}}function bE({manuallyImported:$}={}){let T=$?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n",W,U,X,Y;try{W=fetch,U=Request,X=Response,Y=Headers}catch(w){throw new Error(`this environment is missing the following Web Fetch API type: ${w.message}. ${T}`)}return{kind:"web",fetch:W,Request:U,Response:X,Headers:Y,FormData:typeof FormData!=="undefined"?FormData:class w{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${T}`)}},Blob:typeof Blob!=="undefined"?Blob:class w{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${T}`)}},File:typeof File!=="undefined"?File:class w{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${T}`)}},ReadableStream:typeof ReadableStream!=="undefined"?ReadableStream:class w{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${T}`)}},getMultipartRequestOptions:async(w,G)=>({...G,body:new cF(w)}),getDefaultAgent:(w)=>{return},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:(w)=>!1}}import{ReadStream as lx}from"fs";function fE(){let $=bE();function T(W){return W instanceof lx}return{...$,isFsReadStream:T}}var uF=()=>{if(!TW)IE(fE(),{auto:!0})};uF();class e extends Error{}class L4 extends e{constructor($,T,W,U){super(`${L4.makeMessage($,T,W)}`);this.status=$,this.headers=U,this.request_id=U?.["x-request-id"],this.error=T;let X=T;this.code=X?.code,this.param=X?.param,this.type=X?.type}static makeMessage($,T,W){let U=T?.message?typeof T.message==="string"?T.message:JSON.stringify(T.message):T?JSON.stringify(T):W;if($&&U)return`${$} ${U}`;if($)return`${$} status code (no body)`;if(U)return U;return"(no status code or body)"}static generate($,T,W,U){if(!$||!U)return new WW({message:W,cause:RG(T)});let X=T?.error;if($===400)return new KG($,X,W,U);if($===401)return new EG($,X,W,U);if($===403)return new AG($,X,W,U);if($===404)return new MG($,X,W,U);if($===409)return new NG($,X,W,U);if($===422)return new LG($,X,W,U);if($===429)return new JG($,X,W,U);if($>=500)return new _G($,X,W,U);return new L4($,X,W,U)}}class P4 extends L4{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class WW extends L4{constructor({message:$,cause:T}){super(void 0,void 0,$||"Connection error.",void 0);if(T)this.cause=T}}class UW extends WW{constructor({message:$}={}){super({message:$??"Request timed out."})}}class KG extends L4{}class EG extends L4{}class AG extends L4{}class MG extends L4{}class NG extends L4{}class LG extends L4{}class JG extends L4{}class _G extends L4{}class CX extends e{constructor(){super("Could not parse response content as the length limit was reached")}}class SX extends e{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}var kG=function($,T,W,U,X){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!X)throw new TypeError("Private accessor was defined without a setter");if(typeof T==="function"?$!==T||!X:!T.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?X.call($,W):X?X.value=W:T.set($,W),W},XW=function($,T,W,U){if(W==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!U:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?U:W==="a"?U.call($):U?U.value:T.get($)},e6;class O2{constructor(){e6.set(this,void 0),this.buffer=new Uint8Array,kG(this,e6,null,"f")}decode($){if($==null)return[];let T=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?new TextEncoder().encode($):$,W=new Uint8Array(this.buffer.length+T.length);W.set(this.buffer),W.set(T,this.buffer.length),this.buffer=W;let U=[],X;while((X=nx(this.buffer,XW(this,e6,"f")))!=null){if(X.carriage&&XW(this,e6,"f")==null){kG(this,e6,X.index,"f");continue}if(XW(this,e6,"f")!=null&&(X.index!==XW(this,e6,"f")+1||X.carriage)){U.push(this.decodeText(this.buffer.slice(0,XW(this,e6,"f")-1))),this.buffer=this.buffer.slice(XW(this,e6,"f")),kG(this,e6,null,"f");continue}let Y=XW(this,e6,"f")!==null?X.preceding-1:X.preceding,w=this.decodeText(this.buffer.slice(0,Y));U.push(w),this.buffer=this.buffer.slice(X.index),kG(this,e6,null,"f")}return U}decodeText($){if($==null)return"";if(typeof $==="string")return $;if(typeof Buffer!=="undefined"){if($ instanceof Buffer)return $.toString();if($ instanceof Uint8Array)return Buffer.from($).toString();throw new e(`Unexpected: received non-Uint8Array (${$.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder!=="undefined"){if($ instanceof Uint8Array||$ instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode($);throw new e(`Unexpected: received non-Uint8Array/ArrayBuffer (${$.constructor.name}) in a web platform. Please report this error.`)}throw new e("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length)return[];return this.decode(`
|
|
62
|
-
`)}}e6=new WeakMap;
|
|
63
|
-
`,"\r"]);
|
|
64
|
-
`);
|
|
65
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push($),$.startsWith(":"))return null;let[T,W,U]=ax($,":");if(U.startsWith(" "))U=U.substring(1);if(T==="event")this.event=U;else if(T==="data")this.data.push(U);return null}}function ax($,T){let W=$.indexOf(T);if(W!==-1)return[$.substring(0,W),T,$.substring(W+T.length)];return[$,"",""]}var gE=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function",mE=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&jX($),jX=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",sx=($)=>{return mE($)||gE($)||mF($)};async function rF($,T,W){if($=await $,mE($))return $;if(gE($)){let X=await $.blob();T||(T=new URL($.url).pathname.split(/[\\/]/).pop()??"unknown_file");let Y=jX(X)?[await X.arrayBuffer()]:[X];return new DG(Y,T,W)}let U=await ex($);if(T||(T=TI($)??"unknown_file"),!W?.type){let X=U[0]?.type;if(typeof X==="string")W={...W,type:X}}return new DG(U,T,W)}async function ex($){let T=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)T.push($);else if(jX($))T.push(await $.arrayBuffer());else if(WI($))for await(let W of $)T.push(W);else throw new Error(`Unexpected data type: ${typeof $}; constructor: ${$?.constructor?.name}; props: ${$I($)}`);return T}function $I($){return`[${Object.getOwnPropertyNames($).map((W)=>`"${W}"`).join(", ")}]`}function TI($){return oF($.name)||oF($.filename)||oF($.path)?.split(/[\\/]/).pop()}var oF=($)=>{if(typeof $==="string")return $;if(typeof Buffer!=="undefined"&&$ instanceof Buffer)return String($);return},WI=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",nF=($)=>$&&typeof $==="object"&&$.body&&$[Symbol.toStringTag]==="MultipartBody";var x6=async($)=>{let T=await cE($.body);return hF(T,$)},cE=async($)=>{let T=new fF;return await Promise.all(Object.entries($||{}).map(([W,U])=>lF(T,W,U))),T};var lF=async($,T,W)=>{if(W===void 0)return;if(W==null)throw new TypeError(`Received null for "${T}"; to pass null in FormData, you must use the string 'null'`);if(typeof W==="string"||typeof W==="number"||typeof W==="boolean")$.append(T,String(W));else if(sx(W)){let U=await rF(W);$.append(T,U)}else if(Array.isArray(W))await Promise.all(W.map((U)=>lF($,T+"[]",U)));else if(typeof W==="object")await Promise.all(Object.entries(W).map(([U,X])=>lF($,`${T}[${U}]`,X)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${W} instead`)};var XI=function($,T,W,U,X){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!X)throw new TypeError("Private accessor was defined without a setter");if(typeof T==="function"?$!==T||!X:!T.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?X.call($,W):X?X.value=W:T.set($,W),W},YI=function($,T,W,U){if(W==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!U:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?U:W==="a"?U.call($):U?U.value:T.get($)},vG;uF();async function rE($){let{response:T}=$;if($.options.stream){if(N0("response",T.status,T.url,T.headers,T.body),$.options.__streamClass)return $.options.__streamClass.fromSSEResponse(T,$.controller);return $1.fromSSEResponse(T,$.controller)}if(T.status===204)return null;if($.options.__binaryResponse)return T;let U=T.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){let w=await T.json();return N0("response",T.status,T.url,T.headers,w),nE(w,T)}let Y=await T.text();return N0("response",T.status,T.url,T.headers,Y),Y}function nE($,T){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:T.headers.get("x-request-id"),enumerable:!1})}class PG extends Promise{constructor($,T=rE){super((W)=>{W(null)});this.responsePromise=$,this.parseResponse=T}_thenUnwrap($){return new PG(this.responsePromise,async(T)=>nE($(await this.parseResponse(T),T),T.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,T]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:T,request_id:T.headers.get("x-request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(this.parseResponse);return this.parsedPromise}then($,T){return this.parse().then($,T)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}class tF{constructor({baseURL:$,maxRetries:T=2,timeout:W=600000,httpAgent:U,fetch:X}){this.baseURL=$,this.maxRetries=iF("maxRetries",T),this.timeout=iF("timeout",W),this.httpAgent=U,this.fetch=X??bF}authHeaders($){return{}}defaultHeaders($){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...HI(),...this.authHeaders($)}}validateHeaders($,T){}defaultIdempotencyKey(){return`stainless-node-retry-${ZI()}`}get($,T){return this.methodRequest("get",$,T)}post($,T){return this.methodRequest("post",$,T)}patch($,T){return this.methodRequest("patch",$,T)}put($,T){return this.methodRequest("put",$,T)}delete($,T){return this.methodRequest("delete",$,T)}methodRequest($,T,W){return this.request(Promise.resolve(W).then(async(U)=>{let X=U&&jX(U?.body)?new DataView(await U.body.arrayBuffer()):U?.body instanceof DataView?U.body:U?.body instanceof ArrayBuffer?new DataView(U.body):U&&ArrayBuffer.isView(U?.body)?new DataView(U.body.buffer):U?.body;return{method:$,path:T,...U,body:X}}))}getAPIList($,T,W){return this.requestAPIList(T,{method:"get",path:$,...W})}calculateContentLength($){if(typeof $==="string"){if(typeof Buffer!=="undefined")return Buffer.byteLength($,"utf8").toString();if(typeof TextEncoder!=="undefined")return new TextEncoder().encode($).length.toString()}else if(ArrayBuffer.isView($))return $.byteLength.toString();return null}buildRequest($,{retryCount:T=0}={}){let W={...$},{method:U,path:X,query:Y,headers:w={}}=W,G=ArrayBuffer.isView(W.body)||W.__binaryRequest&&typeof W.body==="string"?W.body:nF(W.body)?W.body.body:W.body?JSON.stringify(W.body,null,2):null,H=this.calculateContentLength(G),z=this.buildURL(X,Y);if("timeout"in W)iF("timeout",W.timeout);W.timeout=W.timeout??this.timeout;let F=W.httpAgent??this.httpAgent??gF(z),O=W.timeout+1000;if(typeof F?.options?.timeout==="number"&&O>(F.options.timeout??0))F.options.timeout=O;if(this.idempotencyHeader&&U!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();w[this.idempotencyHeader]=$.idempotencyKey}let Q=this.buildHeaders({options:W,headers:w,contentLength:H,retryCount:T});return{req:{method:U,...G&&{body:G},headers:Q,...F&&{agent:F},signal:W.signal??null},url:z,timeout:W.timeout}}buildHeaders({options:$,headers:T,contentLength:W,retryCount:U}){let X={};if(W)X["content-length"]=W;let Y=this.defaultHeaders($);if(oE(X,Y),oE(X,T),nF($.body)&&TW!=="node")delete X["content-type"];if(qG(Y,"x-stainless-retry-count")===void 0&&qG(T,"x-stainless-retry-count")===void 0)X["x-stainless-retry-count"]=String(U);if(qG(Y,"x-stainless-timeout")===void 0&&qG(T,"x-stainless-timeout")===void 0&&$.timeout)X["x-stainless-timeout"]=String(Math.trunc($.timeout/1000));return this.validateHeaders(X,T),X}async prepareOptions($){}async prepareRequest($,{url:T,options:W}){}parseHeaders($){return!$?{}:(Symbol.iterator in $)?Object.fromEntries(Array.from($).map((T)=>[...T])):{...$}}makeStatusError($,T,W,U){return L4.generate($,T,W,U)}request($,T=null){return new PG(this.makeRequest($,T))}async makeRequest($,T){let W=await $,U=W.maxRetries??this.maxRetries;if(T==null)T=U;await this.prepareOptions(W);let{req:X,url:Y,timeout:w}=this.buildRequest(W,{retryCount:U-T});if(await this.prepareRequest(X,{url:Y,options:W}),N0("request",Y,W,X.headers),W.signal?.aborted)throw new P4;let G=new AbortController,H=await this.fetchWithTimeout(Y,X,w,G).catch(RG);if(H instanceof Error){if(W.signal?.aborted)throw new P4;if(T)return this.retryRequest(W,T);if(H.name==="AbortError")throw new UW;throw new WW({cause:H})}let z=dF(H.headers);if(!H.ok){if(T&&this.shouldRetry(H)){let E=`retrying, ${T} attempts remaining`;return N0(`response (error; ${E})`,H.status,Y,z),this.retryRequest(W,T,z)}let F=await H.text().catch((E)=>RG(E).message),O=FI(F),Q=O?void 0:F;throw N0(`response (error; ${T?"(error; no more retries left)":"(error; not retryable)"})`,H.status,Y,z,Q),this.makeStatusError(H.status,O,Q,z)}return{response:H,options:W,controller:G}}requestAPIList($,T){let W=this.makeRequest(T,null);return new iE(this,W,$)}buildURL($,T){let W=QI($)?new URL($):new URL(this.baseURL+(this.baseURL.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),U=this.defaultQuery();if(!tE(U))T={...U,...T};if(typeof T==="object"&&T&&!Array.isArray(T))W.search=this.stringifyQuery(T);return W.toString()}stringifyQuery($){return Object.entries($).filter(([T,W])=>typeof W!=="undefined").map(([T,W])=>{if(typeof W==="string"||typeof W==="number"||typeof W==="boolean")return`${encodeURIComponent(T)}=${encodeURIComponent(W)}`;if(W===null)return`${encodeURIComponent(T)}=`;throw new e(`Cannot stringify type ${typeof W}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout($,T,W,U){let{signal:X,...Y}=T||{};if(X)X.addEventListener("abort",()=>U.abort());let w=setTimeout(()=>U.abort(),W),G={signal:U.signal,...Y};if(G.method)G.method=G.method.toUpperCase();return this.fetch.call(void 0,$,G).finally(()=>{clearTimeout(w)})}shouldRetry($){let T=$.headers.get("x-should-retry");if(T==="true")return!0;if(T==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,T,W){let U,X=W?.["retry-after-ms"];if(X){let w=parseFloat(X);if(!Number.isNaN(w))U=w}let Y=W?.["retry-after"];if(Y&&!U){let w=parseFloat(Y);if(!Number.isNaN(w))U=w*1000;else U=Date.parse(Y)-Date.now()}if(!(U&&0<=U&&U<60000)){let w=$.maxRetries??this.maxRetries;U=this.calculateDefaultRetryTimeoutMillis(T,w)}return await L0(U),this.makeRequest($,T-1)}calculateDefaultRetryTimeoutMillis($,T){let X=T-$,Y=Math.min(0.5*Math.pow(2,X),8),w=1-Math.random()*0.25;return Y*w*1000}getUserAgent(){return`${this.constructor.name}/JS ${$W}`}}class CG{constructor($,T,W,U){vG.set(this,void 0),XI(this,vG,$,"f"),this.options=U,this.response=T,this.body=W}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageInfo()!=null}async getNextPage(){let $=this.nextPageInfo();if(!$)throw new e("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let T={...this.options};if("params"in $&&typeof T.query==="object")T.query={...T.query,...$.params};else if("url"in $){let W=[...Object.entries(T.query||{}),...$.url.searchParams.entries()];for(let[U,X]of W)$.url.searchParams.set(U,X);T.query=void 0,T.path=$.url.toString()}return await YI(this,vG,"f").requestAPIList(this.constructor,T)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(vG=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let T of $.getPaginatedItems())yield T}}class iE extends PG{constructor($,T,W){super(T,async(U)=>new W($,U.response,await rE(U),U.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let T of $)yield T}}var dF=($)=>{return new Proxy(Object.fromEntries($.entries()),{get(T,W){let U=W.toString();return T[U.toLowerCase()]||T[U]}})},wI={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__metadata:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},Z$=($)=>{return typeof $==="object"&&$!==null&&!tE($)&&Object.keys($).every((T)=>aE(wI,T))},GI=()=>{if(typeof Deno!=="undefined"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$W,"X-Stainless-OS":pE(Deno.build.os),"X-Stainless-Arch":uE(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime!=="undefined")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$W,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process!=="undefined"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$W,"X-Stainless-OS":pE(process.platform),"X-Stainless-Arch":uE(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let $=zI();if($)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$W,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${$.browser}`,"X-Stainless-Runtime-Version":$.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$W,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function zI(){if(typeof navigator==="undefined"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:T,pattern:W}of $){let U=W.exec(navigator.userAgent);if(U){let X=U[1]||0,Y=U[2]||0,w=U[3]||0;return{browser:T,version:`${X}.${Y}.${w}`}}}return null}var uE=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},pE=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},dE,HI=()=>{return dE??(dE=GI())},FI=($)=>{try{return JSON.parse($)}catch(T){return}},OI=/^[a-z][a-z0-9+.-]*:/i,QI=($)=>{return OI.test($)},L0=($)=>new Promise((T)=>setTimeout(T,$)),iF=($,T)=>{if(typeof T!=="number"||!Number.isInteger(T))throw new e(`${$} must be an integer`);if(T<0)throw new e(`${$} must be a positive integer`);return T},RG=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null)try{return new Error(JSON.stringify($))}catch{}return new Error($)};var BX=($)=>{if(typeof process!=="undefined")return process.env?.[$]?.trim()??void 0;if(typeof Deno!=="undefined")return Deno.env?.get?.($)?.trim();return};function tE($){if(!$)return!0;for(let T in $)return!1;return!0}function aE($,T){return Object.prototype.hasOwnProperty.call($,T)}function oE($,T){for(let W in T){if(!aE(T,W))continue;let U=W.toLowerCase();if(!U)continue;let X=T[W];if(X===null)delete $[U];else if(X!==void 0)$[U]=X}}var lE=new Set(["authorization","api-key"]);function N0($,...T){if(typeof process!=="undefined"&&process?.env?.DEBUG==="true"){let W=T.map((U)=>{if(!U)return U;if(U.headers){let Y={...U,headers:{...U.headers}};for(let w in U.headers)if(lE.has(w.toLowerCase()))Y.headers[w]="REDACTED";return Y}let X=null;for(let Y in U)if(lE.has(Y.toLowerCase()))X??(X={...U}),X[Y]="REDACTED";return X??U});console.log(`OpenAI:DEBUG:${$}`,...W)}}var ZI=()=>{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let T=Math.random()*16|0;return($==="x"?T:T&3|8).toString(16)})},sE=()=>{return typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof navigator!=="undefined"},DI=($)=>{return typeof $?.get==="function"};var qG=($,T)=>{let W=T.toLowerCase();if(DI($)){let U=T[0]?.toUpperCase()+T.substring(1).replace(/([^\w])(\w)/g,(X,Y,w)=>Y+w.toUpperCase());for(let X of[T,W,T.toUpperCase(),U]){let Y=$.get(X);if(Y)return Y}}for(let[U,X]of Object.entries($))if(U.toLowerCase()===W){if(Array.isArray(X)){if(X.length<=1)return X[0];return console.warn(`Received ${X.length} entries for the ${T} header, using the first entry.`),X[0]}return X}return};var eE=($)=>{if(typeof Buffer!=="undefined"){let T=Buffer.from($,"base64");return Array.from(new Float32Array(T.buffer,T.byteOffset,T.length/Float32Array.BYTES_PER_ELEMENT))}else{let T=atob($),W=T.length,U=new Uint8Array(W);for(let X=0;X<W;X++)U[X]=T.charCodeAt(X);return Array.from(new Float32Array(U.buffer))}};function xX($){return $!=null&&typeof $==="object"&&!Array.isArray($)}class _0 extends CG{constructor($,T,W,U){super($,T,W,U);this.data=W.data||[],this.object=W.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}}class v$ extends CG{constructor($,T,W,U){super($,T,W,U);this.data=W.data||[],this.has_more=W.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageParams(){let $=this.nextPageInfo();if(!$)return null;if("params"in $)return $.params;let T=Object.fromEntries($.url.searchParams);if(!Object.keys(T).length)return null;return T}nextPageInfo(){let $=this.getPaginatedItems();if(!$.length)return null;let T=$[$.length-1]?.id;if(!T)return null;return{params:{after:T}}}}class y{constructor($){this._client=$}}class IX extends y{list($,T={},W){if(Z$(T))return this.list($,{},T);return this._client.getAPIList(`/chat/completions/${$}/messages`,aF,{query:T,...W})}}class YW extends y{constructor(){super(...arguments);this.messages=new IX(this._client)}create($,T){return this._client.post("/chat/completions",{body:$,...T,stream:$.stream??!1})}retrieve($,T){return this._client.get(`/chat/completions/${$}`,T)}update($,T,W){return this._client.post(`/chat/completions/${$}`,{body:T,...W})}list($={},T){if(Z$($))return this.list({},$);return this._client.getAPIList("/chat/completions",wW,{query:$,...T})}del($,T){return this._client.delete(`/chat/completions/${$}`,T)}}class wW extends v${}class aF extends v${}YW.ChatCompletionsPage=wW;YW.Messages=IX;class DT extends y{constructor(){super(...arguments);this.completions=new YW(this._client)}}DT.Completions=YW;DT.ChatCompletionsPage=wW;class bX extends y{create($,T){return this._client.post("/audio/speech",{body:$,...T,headers:{Accept:"application/octet-stream",...T?.headers},__binaryResponse:!0})}}class fX extends y{create($,T){return this._client.post("/audio/transcriptions",x6({body:$,...T,stream:$.stream??!1,__metadata:{model:$.model}}))}}class yX extends y{create($,T){return this._client.post("/audio/translations",x6({body:$,...T,__metadata:{model:$.model}}))}}class R0 extends y{constructor(){super(...arguments);this.transcriptions=new fX(this._client),this.translations=new yX(this._client),this.speech=new bX(this._client)}}R0.Transcriptions=fX;R0.Translations=yX;R0.Speech=bX;class GW extends y{create($,T){return this._client.post("/batches",{body:$,...T})}retrieve($,T){return this._client.get(`/batches/${$}`,T)}list($={},T){if(Z$($))return this.list({},$);return this._client.getAPIList("/batches",Q2,{query:$,...T})}cancel($,T){return this._client.post(`/batches/${$}/cancel`,T)}}class Q2 extends v${}GW.BatchesPage=Q2;var B1=function($,T,W,U,X){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!X)throw new TypeError("Private accessor was defined without a setter");if(typeof T==="function"?$!==T||!X:!T.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?X.call($,W):X?X.value=W:T.set($,W),W},z4=function($,T,W,U){if(W==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!U:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?U:W==="a"?U.call($):U?U.value:T.get($)},sF,SG,jG,hX,gX,BG,mX,k0,cX,xG,IG,Z2,$A;class zW{constructor(){sF.add(this),this.controller=new AbortController,SG.set(this,void 0),jG.set(this,()=>{}),hX.set(this,()=>{}),gX.set(this,void 0),BG.set(this,()=>{}),mX.set(this,()=>{}),k0.set(this,{}),cX.set(this,!1),xG.set(this,!1),IG.set(this,!1),Z2.set(this,!1),B1(this,SG,new Promise(($,T)=>{B1(this,jG,$,"f"),B1(this,hX,T,"f")}),"f"),B1(this,gX,new Promise(($,T)=>{B1(this,BG,$,"f"),B1(this,mX,T,"f")}),"f"),z4(this,SG,"f").catch(()=>{}),z4(this,gX,"f").catch(()=>{})}_run($){setTimeout(()=>{$().then(()=>{this._emitFinal(),this._emit("end")},z4(this,sF,"m",$A).bind(this))},0)}_connected(){if(this.ended)return;z4(this,jG,"f").call(this),this._emit("connect")}get ended(){return z4(this,cX,"f")}get errored(){return z4(this,xG,"f")}get aborted(){return z4(this,IG,"f")}abort(){this.controller.abort()}on($,T){return(z4(this,k0,"f")[$]||(z4(this,k0,"f")[$]=[])).push({listener:T}),this}off($,T){let W=z4(this,k0,"f")[$];if(!W)return this;let U=W.findIndex((X)=>X.listener===T);if(U>=0)W.splice(U,1);return this}once($,T){return(z4(this,k0,"f")[$]||(z4(this,k0,"f")[$]=[])).push({listener:T,once:!0}),this}emitted($){return new Promise((T,W)=>{if(B1(this,Z2,!0,"f"),$!=="error")this.once("error",W);this.once($,T)})}async done(){B1(this,Z2,!0,"f"),await z4(this,gX,"f")}_emit($,...T){if(z4(this,cX,"f"))return;if($==="end")B1(this,cX,!0,"f"),z4(this,BG,"f").call(this);let W=z4(this,k0,"f")[$];if(W)z4(this,k0,"f")[$]=W.filter((U)=>!U.once),W.forEach(({listener:U})=>U(...T));if($==="abort"){let U=T[0];if(!z4(this,Z2,"f")&&!W?.length)Promise.reject(U);z4(this,hX,"f").call(this,U),z4(this,mX,"f").call(this,U),this._emit("end");return}if($==="error"){let U=T[0];if(!z4(this,Z2,"f")&&!W?.length)Promise.reject(U);z4(this,hX,"f").call(this,U),z4(this,mX,"f").call(this,U),this._emit("end")}}_emitFinal(){}}SG=new WeakMap,jG=new WeakMap,hX=new WeakMap,gX=new WeakMap,BG=new WeakMap,mX=new WeakMap,k0=new WeakMap,cX=new WeakMap,xG=new WeakMap,IG=new WeakMap,Z2=new WeakMap,sF=new WeakSet,$A=function $(T){if(B1(this,xG,!0,"f"),T instanceof Error&&T.name==="AbortError")T=new P4;if(T instanceof P4)return B1(this,IG,!0,"f"),this._emit("abort",T);if(T instanceof e)return this._emit("error",T);if(T instanceof Error){let W=new e(T.message);return W.cause=T,this._emit("error",W)}return this._emit("error",new e(String(T)))};var T$=function($,T,W,U){if(W==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!U:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?U:W==="a"?U.call($):U?U.value:T.get($)},T1=function($,T,W,U,X){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!X)throw new TypeError("Private accessor was defined without a setter");if(typeof T==="function"?$!==T||!X:!T.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?X.call($,W):X?X.value=W:T.set($,W),W},p4,eF,a1,bG,x1,FW,D2,HW,hG,W1,fG,yG,dX,uX,pX,TA,WA,UA,XA,YA,wA,GA;class U1 extends zW{constructor(){super(...arguments);p4.add(this),eF.set(this,[]),a1.set(this,{}),bG.set(this,{}),x1.set(this,void 0),FW.set(this,void 0),D2.set(this,void 0),HW.set(this,void 0),hG.set(this,void 0),W1.set(this,void 0),fG.set(this,void 0),yG.set(this,void 0),dX.set(this,void 0)}[(eF=new WeakMap,a1=new WeakMap,bG=new WeakMap,x1=new WeakMap,FW=new WeakMap,D2=new WeakMap,HW=new WeakMap,hG=new WeakMap,W1=new WeakMap,fG=new WeakMap,yG=new WeakMap,dX=new WeakMap,p4=new WeakSet,Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("event",(U)=>{let X=T.shift();if(X)X.resolve(U);else $.push(U)}),this.on("end",()=>{W=!0;for(let U of T)U.resolve(void 0);T.length=0}),this.on("abort",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),this.on("error",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((X,Y)=>T.push({resolve:X,reject:Y})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}static fromReadableStream($){let T=new U1;return T._run(()=>T._fromReadableStream($)),T}async _fromReadableStream($,T){let W=T?.signal;if(W){if(W.aborted)this.controller.abort();W.addEventListener("abort",()=>this.controller.abort())}this._connected();let U=$1.fromReadableStream($,this.controller);for await(let X of U)T$(this,p4,"m",uX).call(this,X);if(U.controller.signal?.aborted)throw new P4;return this._addRun(T$(this,p4,"m",pX).call(this))}toReadableStream(){return new $1(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream($,T,W,U,X){let Y=new U1;return Y._run(()=>Y._runToolAssistantStream($,T,W,U,{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),Y}async _createToolAssistantStream($,T,W,U,X){let Y=X?.signal;if(Y){if(Y.aborted)this.controller.abort();Y.addEventListener("abort",()=>this.controller.abort())}let w={...U,stream:!0},G=await $.submitToolOutputs(T,W,w,{...X,signal:this.controller.signal});this._connected();for await(let H of G)T$(this,p4,"m",uX).call(this,H);if(G.controller.signal?.aborted)throw new P4;return this._addRun(T$(this,p4,"m",pX).call(this))}static createThreadAssistantStream($,T,W){let U=new U1;return U._run(()=>U._threadAssistantStream($,T,{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),U}static createAssistantStream($,T,W,U){let X=new U1;return X._run(()=>X._runAssistantStream($,T,W,{...U,headers:{...U?.headers,"X-Stainless-Helper-Method":"stream"}})),X}currentEvent(){return T$(this,fG,"f")}currentRun(){return T$(this,yG,"f")}currentMessageSnapshot(){return T$(this,x1,"f")}currentRunStepSnapshot(){return T$(this,dX,"f")}async finalRunSteps(){return await this.done(),Object.values(T$(this,a1,"f"))}async finalMessages(){return await this.done(),Object.values(T$(this,bG,"f"))}async finalRun(){if(await this.done(),!T$(this,FW,"f"))throw Error("Final run was not received.");return T$(this,FW,"f")}async _createThreadAssistantStream($,T,W){let U=W?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}let X={...T,stream:!0},Y=await $.createAndRun(X,{...W,signal:this.controller.signal});this._connected();for await(let w of Y)T$(this,p4,"m",uX).call(this,w);if(Y.controller.signal?.aborted)throw new P4;return this._addRun(T$(this,p4,"m",pX).call(this))}async _createAssistantStream($,T,W,U){let X=U?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let Y={...W,stream:!0},w=await $.create(T,Y,{...U,signal:this.controller.signal});this._connected();for await(let G of w)T$(this,p4,"m",uX).call(this,G);if(w.controller.signal?.aborted)throw new P4;return this._addRun(T$(this,p4,"m",pX).call(this))}static accumulateDelta($,T){for(let[W,U]of Object.entries(T)){if(!$.hasOwnProperty(W)){$[W]=U;continue}let X=$[W];if(X===null||X===void 0){$[W]=U;continue}if(W==="index"||W==="type"){$[W]=U;continue}if(typeof X==="string"&&typeof U==="string")X+=U;else if(typeof X==="number"&&typeof U==="number")X+=U;else if(xX(X)&&xX(U))X=this.accumulateDelta(X,U);else if(Array.isArray(X)&&Array.isArray(U)){if(X.every((Y)=>typeof Y==="string"||typeof Y==="number")){X.push(...U);continue}for(let Y of U){if(!xX(Y))throw new Error(`Expected array delta entry to be an object but got: ${Y}`);let w=Y.index;if(w==null)throw console.error(Y),new Error("Expected array delta entry to have an `index` property");if(typeof w!=="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${w}`);let G=X[w];if(G==null)X.push(Y);else X[w]=this.accumulateDelta(G,Y)}continue}else throw Error(`Unhandled record type: ${W}, deltaValue: ${U}, accValue: ${X}`);$[W]=X}return $}_addRun($){return $}async _threadAssistantStream($,T,W){return await this._createThreadAssistantStream(T,$,W)}async _runAssistantStream($,T,W,U){return await this._createAssistantStream(T,$,W,U)}async _runToolAssistantStream($,T,W,U,X){return await this._createToolAssistantStream(W,$,T,U,X)}}uX=function $(T){if(this.ended)return;switch(T1(this,fG,T,"f"),T$(this,p4,"m",UA).call(this,T),T.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":T$(this,p4,"m",GA).call(this,T);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":T$(this,p4,"m",WA).call(this,T);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":T$(this,p4,"m",TA).call(this,T);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:NI(T)}},pX=function $(){if(this.ended)throw new e("stream has ended, this shouldn't happen");if(!T$(this,FW,"f"))throw Error("Final run has not been received");return T$(this,FW,"f")},TA=function $(T){let[W,U]=T$(this,p4,"m",YA).call(this,T,T$(this,x1,"f"));T1(this,x1,W,"f"),T$(this,bG,"f")[W.id]=W;for(let X of U){let Y=W.content[X.index];if(Y?.type=="text")this._emit("textCreated",Y.text)}switch(T.event){case"thread.message.created":this._emit("messageCreated",T.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",T.data.delta,W),T.data.delta.content)for(let X of T.data.delta.content){if(X.type=="text"&&X.text){let Y=X.text,w=W.content[X.index];if(w&&w.type=="text")this._emit("textDelta",Y,w.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(X.index!=T$(this,D2,"f")){if(T$(this,HW,"f"))switch(T$(this,HW,"f").type){case"text":this._emit("textDone",T$(this,HW,"f").text,T$(this,x1,"f"));break;case"image_file":this._emit("imageFileDone",T$(this,HW,"f").image_file,T$(this,x1,"f"));break}T1(this,D2,X.index,"f")}T1(this,HW,W.content[X.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(T$(this,D2,"f")!==void 0){let X=T.data.content[T$(this,D2,"f")];if(X)switch(X.type){case"image_file":this._emit("imageFileDone",X.image_file,T$(this,x1,"f"));break;case"text":this._emit("textDone",X.text,T$(this,x1,"f"));break}}if(T$(this,x1,"f"))this._emit("messageDone",T.data);T1(this,x1,void 0,"f")}},WA=function $(T){let W=T$(this,p4,"m",XA).call(this,T);switch(T1(this,dX,W,"f"),T.event){case"thread.run.step.created":this._emit("runStepCreated",T.data);break;case"thread.run.step.delta":let U=T.data.delta;if(U.step_details&&U.step_details.type=="tool_calls"&&U.step_details.tool_calls&&W.step_details.type=="tool_calls")for(let Y of U.step_details.tool_calls)if(Y.index==T$(this,hG,"f"))this._emit("toolCallDelta",Y,W.step_details.tool_calls[Y.index]);else{if(T$(this,W1,"f"))this._emit("toolCallDone",T$(this,W1,"f"));if(T1(this,hG,Y.index,"f"),T1(this,W1,W.step_details.tool_calls[Y.index],"f"),T$(this,W1,"f"))this._emit("toolCallCreated",T$(this,W1,"f"))}this._emit("runStepDelta",T.data.delta,W);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(T1(this,dX,void 0,"f"),T.data.step_details.type=="tool_calls"){if(T$(this,W1,"f"))this._emit("toolCallDone",T$(this,W1,"f")),T1(this,W1,void 0,"f")}this._emit("runStepDone",T.data,W);break;case"thread.run.step.in_progress":break}},UA=function $(T){T$(this,eF,"f").push(T),this._emit("event",T)},XA=function $(T){switch(T.event){case"thread.run.step.created":return T$(this,a1,"f")[T.data.id]=T.data,T.data;case"thread.run.step.delta":let W=T$(this,a1,"f")[T.data.id];if(!W)throw Error("Received a RunStepDelta before creation of a snapshot");let U=T.data;if(U.delta){let X=U1.accumulateDelta(W,U.delta);T$(this,a1,"f")[T.data.id]=X}return T$(this,a1,"f")[T.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":T$(this,a1,"f")[T.data.id]=T.data;break}if(T$(this,a1,"f")[T.data.id])return T$(this,a1,"f")[T.data.id];throw new Error("No snapshot available")},YA=function $(T,W){let U=[];switch(T.event){case"thread.message.created":return[T.data,U];case"thread.message.delta":if(!W)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let X=T.data;if(X.delta.content)for(let Y of X.delta.content)if(Y.index in W.content){let w=W.content[Y.index];W.content[Y.index]=T$(this,p4,"m",wA).call(this,Y,w)}else W.content[Y.index]=Y,U.push(Y);return[W,U];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(W)return[W,U];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},wA=function $(T,W){return U1.accumulateDelta(W,T)},GA=function $(T){switch(T1(this,yG,T.data,"f"),T.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":if(T1(this,FW,T.data,"f"),T$(this,W1,"f"))this._emit("toolCallDone",T$(this,W1,"f")),T1(this,W1,void 0,"f");break;case"thread.run.cancelling":break}};function NI($){}class V2 extends y{create($,T){return this._client.post("/assistants",{body:$,...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}retrieve($,T){return this._client.get(`/assistants/${$}`,{...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}update($,T,W){return this._client.post(`/assistants/${$}`,{body:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}list($={},T){if(Z$($))return this.list({},$);return this._client.getAPIList("/assistants",oX,{query:$,...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}del($,T){return this._client.delete(`/assistants/${$}`,{...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}}class oX extends v${}V2.AssistantsPage=oX;function $O($){return typeof $.parse==="function"}var VT=($)=>{return $?.role==="assistant"},TO=($)=>{return $?.role==="function"},WO=($)=>{return $?.role==="tool"};function lX($){return $?.$brand==="auto-parseable-response-format"}function OW($){return $?.$brand==="auto-parseable-tool"}function zA($,T){if(!T||!UO(T))return{...$,choices:$.choices.map((W)=>({...W,message:{...W.message,parsed:null,...W.message.tool_calls?{tool_calls:W.message.tool_calls}:void 0}}))};return rX($,T)}function rX($,T){let W=$.choices.map((U)=>{if(U.finish_reason==="length")throw new CX;if(U.finish_reason==="content_filter")throw new SX;return{...U,message:{...U.message,...U.message.tool_calls?{tool_calls:U.message.tool_calls?.map((X)=>_I(T,X))??void 0}:void 0,parsed:U.message.content&&!U.message.refusal?JI(T,U.message.content):null}}});return{...$,choices:W}}function JI($,T){if($.response_format?.type!=="json_schema")return null;if($.response_format?.type==="json_schema"){if("$parseRaw"in $.response_format)return $.response_format.$parseRaw(T);return JSON.parse(T)}return null}function _I($,T){let W=$.tools?.find((U)=>U.function?.name===T.function.name);return{...T,function:{...T.function,parsed_arguments:OW(W)?W.$parseRaw(T.function.arguments):W?.function.strict?JSON.parse(T.function.arguments):null}}}function HA($,T){if(!$)return!1;let W=$.tools?.find((U)=>U.function?.name===T.function.name);return OW(W)||W?.function.strict||!1}function UO($){if(lX($.response_format))return!0;return $.tools?.some((T)=>OW(T)||T.type==="function"&&T.function.strict===!0)??!1}function FA($){for(let T of $??[]){if(T.type!=="function")throw new e(`Currently only \`function\` tool types support auto-parsing; Received \`${T.type}\``);if(T.function.strict!==!0)throw new e(`The \`${T.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var I6=function($,T,W,U){if(W==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!U:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?U:W==="a"?U.call($):U?U.value:T.get($)},a4,XO,gG,YO,wO,GO,QA,zO,OA=10;class nX extends zW{constructor(){super(...arguments);a4.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion($){this._chatCompletions.push($),this._emit("chatCompletion",$);let T=$.choices[0]?.message;if(T)this._addMessage(T);return $}_addMessage($,T=!0){if(!("content"in $))$.content=null;if(this.messages.push($),T){if(this._emit("message",$),(TO($)||WO($))&&$.content)this._emit("functionCallResult",$.content);else if(VT($)&&$.function_call)this._emit("functionCall",$.function_call);else if(VT($)&&$.tool_calls){for(let W of $.tool_calls)if(W.type==="function")this._emit("functionCall",W.function)}}}async finalChatCompletion(){await this.done();let $=this._chatCompletions[this._chatCompletions.length-1];if(!$)throw new e("stream ended without producing a ChatCompletion");return $}async finalContent(){return await this.done(),I6(this,a4,"m",XO).call(this)}async finalMessage(){return await this.done(),I6(this,a4,"m",gG).call(this)}async finalFunctionCall(){return await this.done(),I6(this,a4,"m",YO).call(this)}async finalFunctionCallResult(){return await this.done(),I6(this,a4,"m",wO).call(this)}async totalUsage(){return await this.done(),I6(this,a4,"m",GO).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let $=this._chatCompletions[this._chatCompletions.length-1];if($)this._emit("finalChatCompletion",$);let T=I6(this,a4,"m",gG).call(this);if(T)this._emit("finalMessage",T);let W=I6(this,a4,"m",XO).call(this);if(W)this._emit("finalContent",W);let U=I6(this,a4,"m",YO).call(this);if(U)this._emit("finalFunctionCall",U);let X=I6(this,a4,"m",wO).call(this);if(X!=null)this._emit("finalFunctionCallResult",X);if(this._chatCompletions.some((Y)=>Y.usage))this._emit("totalUsage",I6(this,a4,"m",GO).call(this))}async _createChatCompletion($,T,W){let U=W?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}I6(this,a4,"m",QA).call(this,T);let X=await $.chat.completions.create({...T,stream:!1},{...W,signal:this.controller.signal});return this._connected(),this._addChatCompletion(rX(X,T))}async _runChatCompletion($,T,W){for(let U of T.messages)this._addMessage(U,!1);return await this._createChatCompletion($,T,W)}async _runFunctions($,T,W){let{function_call:X="auto",stream:Y,...w}=T,G=typeof X!=="string"&&X?.name,{maxChatCompletions:H=OA}=W||{},z={};for(let O of T.functions)z[O.name||O.function.name]=O;let F=T.functions.map((O)=>({name:O.name||O.function.name,parameters:O.parameters,description:O.description}));for(let O of T.messages)this._addMessage(O,!1);for(let O=0;O<H;++O){let Z=(await this._createChatCompletion($,{...w,function_call:X,functions:F,messages:[...this.messages]},W)).choices[0]?.message;if(!Z)throw new e("missing message in ChatCompletion response");if(!Z.function_call)return;let{name:V,arguments:E}=Z.function_call,N=z[V];if(!N){let P=`Invalid function_call: ${JSON.stringify(V)}. Available options are: ${F.map((x)=>JSON.stringify(x.name)).join(", ")}. Please try again`;this._addMessage({role:"function",name:V,content:P});continue}else if(G&&G!==V){let P=`Invalid function_call: ${JSON.stringify(V)}. ${JSON.stringify(G)} requested. Please try again`;this._addMessage({role:"function",name:V,content:P});continue}let J;try{J=$O(N)?await N.parse(E):E}catch(P){this._addMessage({role:"function",name:V,content:P instanceof Error?P.message:String(P)});continue}let _=await N.function(J,this),R=I6(this,a4,"m",zO).call(this,_);if(this._addMessage({role:"function",name:V,content:R}),G)return}}async _runTools($,T,W){let{tool_choice:X="auto",stream:Y,...w}=T,G=typeof X!=="string"&&X?.function?.name,{maxChatCompletions:H=OA}=W||{},z=T.tools.map((Q)=>{if(OW(Q)){if(!Q.$callback)throw new e("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:Q.$callback,name:Q.function.name,description:Q.function.description||"",parameters:Q.function.parameters,parse:Q.$parseRaw,strict:!0}}}return Q}),F={};for(let Q of z)if(Q.type==="function")F[Q.function.name||Q.function.function.name]=Q.function;let O="tools"in T?z.map((Q)=>Q.type==="function"?{type:"function",function:{name:Q.function.name||Q.function.function.name,parameters:Q.function.parameters,description:Q.function.description,strict:Q.function.strict}}:Q):void 0;for(let Q of T.messages)this._addMessage(Q,!1);for(let Q=0;Q<H;++Q){let V=(await this._createChatCompletion($,{...w,tool_choice:X,tools:O,messages:[...this.messages]},W)).choices[0]?.message;if(!V)throw new e("missing message in ChatCompletion response");if(!V.tool_calls?.length)return;for(let E of V.tool_calls){if(E.type!=="function")continue;let N=E.id,{name:J,arguments:_}=E.function,R=F[J];if(!R){let h=`Invalid tool_call: ${JSON.stringify(J)}. Available options are: ${Object.keys(F).map((a)=>JSON.stringify(a)).join(", ")}. Please try again`;this._addMessage({role:"tool",tool_call_id:N,content:h});continue}else if(G&&G!==J){let h=`Invalid tool_call: ${JSON.stringify(J)}. ${JSON.stringify(G)} requested. Please try again`;this._addMessage({role:"tool",tool_call_id:N,content:h});continue}let P;try{P=$O(R)?await R.parse(_):_}catch(h){let a=h instanceof Error?h.message:String(h);this._addMessage({role:"tool",tool_call_id:N,content:a});continue}let x=await R.function(P,this),f=I6(this,a4,"m",zO).call(this,x);if(this._addMessage({role:"tool",tool_call_id:N,content:f}),G)return}}return}}a4=new WeakSet,XO=function $(){return I6(this,a4,"m",gG).call(this).content??null},gG=function $(){let T=this.messages.length;while(T-- >0){let W=this.messages[T];if(VT(W)){let{function_call:U,...X}=W,Y={...X,content:W.content??null,refusal:W.refusal??null};if(U)Y.function_call=U;return Y}}throw new e("stream ended without producing a ChatCompletionMessage with role=assistant")},YO=function $(){for(let T=this.messages.length-1;T>=0;T--){let W=this.messages[T];if(VT(W)&&W?.function_call)return W.function_call;if(VT(W)&&W?.tool_calls?.length)return W.tool_calls.at(-1)?.function}return},wO=function $(){for(let T=this.messages.length-1;T>=0;T--){let W=this.messages[T];if(TO(W)&&W.content!=null)return W.content;if(WO(W)&&W.content!=null&&typeof W.content==="string"&&this.messages.some((U)=>U.role==="assistant"&&U.tool_calls?.some((X)=>X.type==="function"&&X.id===W.tool_call_id)))return W.content}return},GO=function $(){let T={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:W}of this._chatCompletions)if(W)T.completion_tokens+=W.completion_tokens,T.prompt_tokens+=W.prompt_tokens,T.total_tokens+=W.total_tokens;return T},QA=function $(T){if(T.n!=null&&T.n>1)throw new e("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},zO=function $(T){return typeof T==="string"?T:T===void 0?"undefined":JSON.stringify(T)};class K2 extends nX{static runFunctions($,T,W){let U=new K2,X={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return U._run(()=>U._runFunctions($,T,X)),U}static runTools($,T,W){let U=new K2,X={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runTools"}};return U._run(()=>U._runTools($,T,X)),U}_addMessage($,T=!0){if(super._addMessage($,T),VT($)&&$.content)this._emit("content",$.content)}}var y4={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511};class ZA extends Error{}class DA extends Error{}function RI($,T=y4.ALL){if(typeof $!=="string")throw new TypeError(`expecting str, got ${typeof $}`);if(!$.trim())throw new Error(`${$} is empty`);return kI($.trim(),T)}var kI=($,T)=>{let W=$.length,U=0,X=(Q)=>{throw new ZA(`${Q} at position ${U}`)},Y=(Q)=>{throw new DA(`${Q} at position ${U}`)},w=()=>{if(O(),U>=W)X("Unexpected end of input");if($[U]==='"')return G();if($[U]==="{")return H();if($[U]==="[")return z();if($.substring(U,U+4)==="null"||y4.NULL&T&&W-U<4&&"null".startsWith($.substring(U)))return U+=4,null;if($.substring(U,U+4)==="true"||y4.BOOL&T&&W-U<4&&"true".startsWith($.substring(U)))return U+=4,!0;if($.substring(U,U+5)==="false"||y4.BOOL&T&&W-U<5&&"false".startsWith($.substring(U)))return U+=5,!1;if($.substring(U,U+8)==="Infinity"||y4.INFINITY&T&&W-U<8&&"Infinity".startsWith($.substring(U)))return U+=8,1/0;if($.substring(U,U+9)==="-Infinity"||y4.MINUS_INFINITY&T&&1<W-U&&W-U<9&&"-Infinity".startsWith($.substring(U)))return U+=9,-1/0;if($.substring(U,U+3)==="NaN"||y4.NAN&T&&W-U<3&&"NaN".startsWith($.substring(U)))return U+=3,NaN;return F()},G=()=>{let Q=U,Z=!1;U++;while(U<W&&($[U]!=='"'||Z&&$[U-1]==="\\"))Z=$[U]==="\\"?!Z:!1,U++;if($.charAt(U)=='"')try{return JSON.parse($.substring(Q,++U-Number(Z)))}catch(V){Y(String(V))}else if(y4.STR&T)try{return JSON.parse($.substring(Q,U-Number(Z))+'"')}catch(V){return JSON.parse($.substring(Q,$.lastIndexOf("\\"))+'"')}X("Unterminated string literal")},H=()=>{U++,O();let Q={};try{while($[U]!=="}"){if(O(),U>=W&&y4.OBJ&T)return Q;let Z=G();O(),U++;try{let V=w();Object.defineProperty(Q,Z,{value:V,writable:!0,enumerable:!0,configurable:!0})}catch(V){if(y4.OBJ&T)return Q;else throw V}if(O(),$[U]===",")U++}}catch(Z){if(y4.OBJ&T)return Q;else X("Expected '}' at end of object")}return U++,Q},z=()=>{U++;let Q=[];try{while($[U]!=="]")if(Q.push(w()),O(),$[U]===",")U++}catch(Z){if(y4.ARR&T)return Q;X("Expected ']' at end of array")}return U++,Q},F=()=>{if(U===0){if($==="-"&&y4.NUM&T)X("Not sure what '-' is");try{return JSON.parse($)}catch(Z){if(y4.NUM&T)try{if($[$.length-1]===".")return JSON.parse($.substring(0,$.lastIndexOf(".")));return JSON.parse($.substring(0,$.lastIndexOf("e")))}catch(V){}Y(String(Z))}}let Q=U;if($[U]==="-")U++;while($[U]&&!",]}".includes($[U]))U++;if(U==W&&!(y4.NUM&T))X("Unterminated number literal");try{return JSON.parse($.substring(Q,U))}catch(Z){if($.substring(Q,U)==="-"&&y4.NUM&T)X("Not sure what '-' is");try{return JSON.parse($.substring(Q,$.lastIndexOf("e")))}catch(V){Y(String(V))}}},O=()=>{while(U<W&&`
|
|
66
|
-
|
|
67
|
-
${uG($)}`);if(f==null)throw new e(`missing choices[${O}].tool_calls[${P}].type
|
|
68
|
-
${
|
|
69
|
-
${
|
|
70
|
-
${uG($)}`);return{...a,id:h,type:f,function:{...W$,name:S,arguments:M$}}})}};return{...Z,message:{...J,content:V,role:_,refusal:z.refusal??null},finish_reason:F,index:O,logprobs:Q}}),created:X,model:Y,object:"chat.completion",...w?{system_fingerprint:w}:{}};return zA(H,T)}function uG($){return JSON.stringify($)}function KA($){return}function EA($){}class ZW extends QW{static fromReadableStream($){let T=new ZW(null);return T._run(()=>T._fromReadableStream($)),T}static runFunctions($,T,W){let U=new ZW(null),X={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return U._run(()=>U._runFunctions($,T,X)),U}static runTools($,T,W){let U=new ZW(T),X={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runTools"}};return U._run(()=>U._runTools($,T,X)),U}}class pG extends y{parse($,T){return FA($.tools),this._client.chat.completions.create($,{...T,headers:{...T?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap((W)=>rX(W,$))}runFunctions($,T){if($.stream)return ZW.runFunctions(this._client,$,T);return K2.runFunctions(this._client,$,T)}runTools($,T){if($.stream)return ZW.runTools(this._client,$,T);return K2.runTools(this._client,$,T)}stream($,T){return QW.createChatCompletion(this._client,$,T)}}class iX extends y{constructor(){super(...arguments);this.completions=new pG(this._client)}}(function($){$.Completions=pG})(iX||(iX={}));class tX extends y{create($,T){return this._client.post("/realtime/sessions",{body:$,...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}}class aX extends y{create($,T){return this._client.post("/realtime/transcription_sessions",{body:$,...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}}class DW extends y{constructor(){super(...arguments);this.sessions=new tX(this._client),this.transcriptionSessions=new aX(this._client)}}DW.Sessions=tX;DW.TranscriptionSessions=aX;class M2 extends y{create($,T,W){return this._client.post(`/threads/${$}/messages`,{body:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}retrieve($,T,W){return this._client.get(`/threads/${$}/messages/${T}`,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}update($,T,W,U){return this._client.post(`/threads/${$}/messages/${T}`,{body:W,...U,headers:{"OpenAI-Beta":"assistants=v2",...U?.headers}})}list($,T={},W){if(Z$(T))return this.list($,{},T);return this._client.getAPIList(`/threads/${$}/messages`,sX,{query:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}del($,T,W){return this._client.delete(`/threads/${$}/messages/${T}`,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}}class sX extends v${}M2.MessagesPage=sX;class N2 extends y{retrieve($,T,W,U={},X){if(Z$(U))return this.retrieve($,T,W,{},U);return this._client.get(`/threads/${$}/runs/${T}/steps/${W}`,{query:U,...X,headers:{"OpenAI-Beta":"assistants=v2",...X?.headers}})}list($,T,W={},U){if(Z$(W))return this.list($,T,{},W);return this._client.getAPIList(`/threads/${$}/runs/${T}/steps`,eX,{query:W,...U,headers:{"OpenAI-Beta":"assistants=v2",...U?.headers}})}}class eX extends v${}N2.RunStepsPage=eX;class ET extends y{constructor(){super(...arguments);this.steps=new N2(this._client)}create($,T,W){let{include:U,...X}=T;return this._client.post(`/threads/${$}/runs`,{query:{include:U},body:X,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers},stream:T.stream??!1})}retrieve($,T,W){return this._client.get(`/threads/${$}/runs/${T}`,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}update($,T,W,U){return this._client.post(`/threads/${$}/runs/${T}`,{body:W,...U,headers:{"OpenAI-Beta":"assistants=v2",...U?.headers}})}list($,T={},W){if(Z$(T))return this.list($,{},T);return this._client.getAPIList(`/threads/${$}/runs`,$8,{query:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}cancel($,T,W){return this._client.post(`/threads/${$}/runs/${T}/cancel`,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}async createAndPoll($,T,W){let U=await this.create($,T,W);return await this.poll($,U.id,W)}createAndStream($,T,W){return U1.createAssistantStream($,this._client.beta.threads.runs,T,W)}async poll($,T,W){let U={...W?.headers,"X-Stainless-Poll-Helper":"true"};if(W?.pollIntervalMs)U["X-Stainless-Custom-Poll-Interval"]=W.pollIntervalMs.toString();while(!0){let{data:X,response:Y}=await this.retrieve($,T,{...W,headers:{...W?.headers,...U}}).withResponse();switch(X.status){case"queued":case"in_progress":case"cancelling":let w=5000;if(W?.pollIntervalMs)w=W.pollIntervalMs;else{let G=Y.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))w=H}}await L0(w);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return X}}}stream($,T,W){return U1.createAssistantStream($,this._client.beta.threads.runs,T,W)}submitToolOutputs($,T,W,U){return this._client.post(`/threads/${$}/runs/${T}/submit_tool_outputs`,{body:W,...U,headers:{"OpenAI-Beta":"assistants=v2",...U?.headers},stream:W.stream??!1})}async submitToolOutputsAndPoll($,T,W,U){let X=await this.submitToolOutputs($,T,W,U);return await this.poll($,X.id,U)}submitToolOutputsStream($,T,W,U){return U1.createToolAssistantStream($,T,this._client.beta.threads.runs,W,U)}}class $8 extends v${}ET.RunsPage=$8;ET.Steps=N2;ET.RunStepsPage=eX;class q0 extends y{constructor(){super(...arguments);this.runs=new ET(this._client),this.messages=new M2(this._client)}create($={},T){if(Z$($))return this.create({},$);return this._client.post("/threads",{body:$,...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}retrieve($,T){return this._client.get(`/threads/${$}`,{...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}update($,T,W){return this._client.post(`/threads/${$}`,{body:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}del($,T){return this._client.delete(`/threads/${$}`,{...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}createAndRun($,T){return this._client.post("/threads/runs",{body:$,...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers},stream:$.stream??!1})}async createAndRunPoll($,T){let W=await this.createAndRun($,T);return await this.runs.poll(W.thread_id,W.id,T)}createAndRunStream($,T){return U1.createThreadAssistantStream($,this._client.beta.threads,T)}}q0.Runs=ET;q0.RunsPage=$8;q0.Messages=M2;q0.MessagesPage=sX;class s1 extends y{constructor(){super(...arguments);this.realtime=new DW(this._client),this.chat=new iX(this._client),this.assistants=new V2(this._client),this.threads=new q0(this._client)}}s1.Realtime=DW;s1.Assistants=V2;s1.AssistantsPage=oX;s1.Threads=q0;class L2 extends y{create($,T){return this._client.post("/completions",{body:$,...T,stream:$.stream??!1})}}class T8 extends y{retrieve($,T,W){return this._client.get(`/containers/${$}/files/${T}/content`,{...W,headers:{Accept:"*/*",...W?.headers}})}}class VW extends y{constructor(){super(...arguments);this.content=new T8(this._client)}create($,T,W){return this._client.post(`/containers/${$}/files`,x6({body:T,...W}))}retrieve($,T,W){return this._client.get(`/containers/${$}/files/${T}`,W)}list($,T={},W){if(Z$(T))return this.list($,{},T);return this._client.getAPIList(`/containers/${$}/files`,W8,{query:T,...W})}del($,T,W){return this._client.delete(`/containers/${$}/files/${T}`,{...W,headers:{Accept:"*/*",...W?.headers}})}}class W8 extends v${}VW.FileListResponsesPage=W8;VW.Content=T8;class P0 extends y{constructor(){super(...arguments);this.files=new VW(this._client)}create($,T){return this._client.post("/containers",{body:$,...T})}retrieve($,T){return this._client.get(`/containers/${$}`,T)}list($={},T){if(Z$($))return this.list({},$);return this._client.getAPIList("/containers",J2,{query:$,...T})}del($,T){return this._client.delete(`/containers/${$}`,{...T,headers:{Accept:"*/*",...T?.headers}})}}class J2 extends v${}P0.ContainerListResponsesPage=J2;P0.Files=VW;P0.FileListResponsesPage=W8;class _2 extends y{create($,T){let W=!!$.encoding_format,U=W?$.encoding_format:"base64";if(W)N0("Request","User defined encoding_format:",$.encoding_format);let X=this._client.post("/embeddings",{body:{...$,encoding_format:U},...T});if(W)return X;return N0("response","Decoding base64 embeddings to float32 array"),X._thenUnwrap((Y)=>{if(Y&&Y.data)Y.data.forEach((w)=>{let G=w.embedding;w.embedding=eE(G)});return Y})}}class R2 extends y{retrieve($,T,W,U){return this._client.get(`/evals/${$}/runs/${T}/output_items/${W}`,U)}list($,T,W={},U){if(Z$(W))return this.list($,T,{},W);return this._client.getAPIList(`/evals/${$}/runs/${T}/output_items`,U8,{query:W,...U})}}class U8 extends v${}R2.OutputItemListResponsesPage=U8;class AT extends y{constructor(){super(...arguments);this.outputItems=new R2(this._client)}create($,T,W){return this._client.post(`/evals/${$}/runs`,{body:T,...W})}retrieve($,T,W){return this._client.get(`/evals/${$}/runs/${T}`,W)}list($,T={},W){if(Z$(T))return this.list($,{},T);return this._client.getAPIList(`/evals/${$}/runs`,X8,{query:T,...W})}del($,T,W){return this._client.delete(`/evals/${$}/runs/${T}`,W)}cancel($,T,W){return this._client.post(`/evals/${$}/runs/${T}`,W)}}class X8 extends v${}AT.RunListResponsesPage=X8;AT.OutputItems=R2;AT.OutputItemListResponsesPage=U8;class C0 extends y{constructor(){super(...arguments);this.runs=new AT(this._client)}create($,T){return this._client.post("/evals",{body:$,...T})}retrieve($,T){return this._client.get(`/evals/${$}`,T)}update($,T,W){return this._client.post(`/evals/${$}`,{body:T,...W})}list($={},T){if(Z$($))return this.list({},$);return this._client.getAPIList("/evals",k2,{query:$,...T})}del($,T){return this._client.delete(`/evals/${$}`,T)}}class k2 extends v${}C0.EvalListResponsesPage=k2;C0.Runs=AT;C0.RunListResponsesPage=X8;class KW extends y{create($,T){return this._client.post("/files",x6({body:$,...T}))}retrieve($,T){return this._client.get(`/files/${$}`,T)}list($={},T){if(Z$($))return this.list({},$);return this._client.getAPIList("/files",v2,{query:$,...T})}del($,T){return this._client.delete(`/files/${$}`,T)}content($,T){return this._client.get(`/files/${$}/content`,{...T,headers:{Accept:"application/binary",...T?.headers},__binaryResponse:!0})}retrieveContent($,T){return this._client.get(`/files/${$}/content`,T)}async waitForProcessing($,{pollInterval:T=5000,maxWait:W=1800000}={}){let U=new Set(["processed","error","deleted"]),X=Date.now(),Y=await this.retrieve($);while(!Y.status||!U.has(Y.status))if(await L0(T),Y=await this.retrieve($),Date.now()-X>W)throw new UW({message:`Giving up on waiting for file ${$} to finish processing after ${W} milliseconds.`});return Y}}class v2 extends v${}KW.FileObjectsPage=v2;class Y8 extends y{}class w8 extends y{run($,T){return this._client.post("/fine_tuning/alpha/graders/run",{body:$,...T})}validate($,T){return this._client.post("/fine_tuning/alpha/graders/validate",{body:$,...T})}}class q2 extends y{constructor(){super(...arguments);this.graders=new w8(this._client)}}q2.Graders=w8;class P2 extends y{create($,T,W){return this._client.getAPIList(`/fine_tuning/checkpoints/${$}/permissions`,G8,{body:T,method:"post",...W})}retrieve($,T={},W){if(Z$(T))return this.retrieve($,{},T);return this._client.get(`/fine_tuning/checkpoints/${$}/permissions`,{query:T,...W})}del($,T,W){return this._client.delete(`/fine_tuning/checkpoints/${$}/permissions/${T}`,W)}}class G8 extends _0{}P2.PermissionCreateResponsesPage=G8;class EW extends y{constructor(){super(...arguments);this.permissions=new P2(this._client)}}EW.Permissions=P2;EW.PermissionCreateResponsesPage=G8;class C2 extends y{list($,T={},W){if(Z$(T))return this.list($,{},T);return this._client.getAPIList(`/fine_tuning/jobs/${$}/checkpoints`,z8,{query:T,...W})}}class z8 extends v${}C2.FineTuningJobCheckpointsPage=z8;class S0 extends y{constructor(){super(...arguments);this.checkpoints=new C2(this._client)}create($,T){return this._client.post("/fine_tuning/jobs",{body:$,...T})}retrieve($,T){return this._client.get(`/fine_tuning/jobs/${$}`,T)}list($={},T){if(Z$($))return this.list({},$);return this._client.getAPIList("/fine_tuning/jobs",H8,{query:$,...T})}cancel($,T){return this._client.post(`/fine_tuning/jobs/${$}/cancel`,T)}listEvents($,T={},W){if(Z$(T))return this.listEvents($,{},T);return this._client.getAPIList(`/fine_tuning/jobs/${$}/events`,F8,{query:T,...W})}pause($,T){return this._client.post(`/fine_tuning/jobs/${$}/pause`,T)}resume($,T){return this._client.post(`/fine_tuning/jobs/${$}/resume`,T)}}class H8 extends v${}class F8 extends v${}S0.FineTuningJobsPage=H8;S0.FineTuningJobEventsPage=F8;S0.Checkpoints=C2;S0.FineTuningJobCheckpointsPage=z8;class V1 extends y{constructor(){super(...arguments);this.methods=new Y8(this._client),this.jobs=new S0(this._client),this.checkpoints=new EW(this._client),this.alpha=new q2(this._client)}}V1.Methods=Y8;V1.Jobs=S0;V1.FineTuningJobsPage=H8;V1.FineTuningJobEventsPage=F8;V1.Checkpoints=EW;V1.Alpha=q2;class O8 extends y{}class AW extends y{constructor(){super(...arguments);this.graderModels=new O8(this._client)}}AW.GraderModels=O8;class S2 extends y{createVariation($,T){return this._client.post("/images/variations",x6({body:$,...T}))}edit($,T){return this._client.post("/images/edits",x6({body:$,...T}))}generate($,T){return this._client.post("/images/generations",{body:$,...T})}}class MW extends y{retrieve($,T){return this._client.get(`/models/${$}`,T)}list($){return this._client.getAPIList("/models",j2,$)}del($,T){return this._client.delete(`/models/${$}`,T)}}class j2 extends _0{}MW.ModelsPage=j2;class B2 extends y{create($,T){return this._client.post("/moderations",{body:$,...T})}}function AA($,T){if(!T||!iI(T))return{...$,output_parsed:null,output:$.output.map((W)=>{if(W.type==="function_call")return{...W,parsed_arguments:null};if(W.type==="message")return{...W,content:W.content.map((U)=>({...U,parsed:null}))};else return W})};return VO($,T)}function VO($,T){let W=$.output.map((X)=>{if(X.type==="function_call")return{...X,parsed_arguments:sI(T,X)};if(X.type==="message"){let Y=X.content.map((w)=>{if(w.type==="output_text")return{...w,parsed:nI(T,w.text)};return w});return{...X,content:Y}}return X}),U=Object.assign({},$,{output:W});if(!Object.getOwnPropertyDescriptor($,"output_text"))dG(U);return Object.defineProperty(U,"output_parsed",{enumerable:!0,get(){for(let X of U.output){if(X.type!=="message")continue;for(let Y of X.content)if(Y.type==="output_text"&&Y.parsed!==null)return Y.parsed}return null}}),U}function nI($,T){if($.text?.format?.type!=="json_schema")return null;if("$parseRaw"in $.text?.format)return($.text?.format).$parseRaw(T);return JSON.parse(T)}function iI($){if(lX($.text?.format))return!0;return!1}function tI($){return $?.$brand==="auto-parseable-tool"}function aI($,T){return $.find((W)=>W.type==="function"&&W.name===T)}function sI($,T){let W=aI($.tools??[],T.name);return{...T,...T,parsed_arguments:tI(W)?W.$parseRaw(T.arguments):W?.strict?JSON.parse(T.arguments):null}}function dG($){let T=[];for(let W of $.output){if(W.type!=="message")continue;for(let U of W.content)if(U.type==="output_text")T.push(U.text)}$.output_text=T.join("")}class Q8 extends y{list($,T={},W){if(Z$(T))return this.list($,{},T);return this._client.getAPIList(`/responses/${$}/input_items`,KO,{query:T,...W})}}var x2=function($,T,W,U,X){if(U==="m")throw new TypeError("Private method is not writable");if(U==="a"&&!X)throw new TypeError("Private accessor was defined without a setter");if(typeof T==="function"?$!==T||!X:!T.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return U==="a"?X.call($,W):X?X.value=W:T.set($,W),W},MT=function($,T,W,U){if(W==="a"&&!U)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!U:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?U:W==="a"?U.call($):U?U.value:T.get($)},I2,oG,NT,lG,MA,NA,LA,JA;class rG extends zW{constructor($){super();I2.add(this),oG.set(this,void 0),NT.set(this,void 0),lG.set(this,void 0),x2(this,oG,$,"f")}static createResponse($,T,W){let U=new rG(T);return U._run(()=>U._createOrRetrieveResponse($,T,{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),U}async _createOrRetrieveResponse($,T,W){let U=W?.signal;if(U){if(U.aborted)this.controller.abort();U.addEventListener("abort",()=>this.controller.abort())}MT(this,I2,"m",MA).call(this);let X,Y=null;if("response_id"in T)X=await $.responses.retrieve(T.response_id,{stream:!0},{...W,signal:this.controller.signal,stream:!0}),Y=T.starting_after??null;else X=await $.responses.create({...T,stream:!0},{...W,signal:this.controller.signal});this._connected();for await(let w of X)MT(this,I2,"m",NA).call(this,w,Y);if(X.controller.signal?.aborted)throw new P4;return MT(this,I2,"m",LA).call(this)}[(oG=new WeakMap,NT=new WeakMap,lG=new WeakMap,I2=new WeakSet,MA=function $(){if(this.ended)return;x2(this,NT,void 0,"f")},NA=function $(T,W){if(this.ended)return;let U=(Y,w)=>{if(W==null||w.sequence_number>W)this._emit(Y,w)},X=MT(this,I2,"m",JA).call(this,T);switch(U("event",T),T.type){case"response.output_text.delta":{let Y=X.output[T.output_index];if(!Y)throw new e(`missing output at index ${T.output_index}`);if(Y.type==="message"){let w=Y.content[T.content_index];if(!w)throw new e(`missing content at index ${T.content_index}`);if(w.type!=="output_text")throw new e(`expected content to be 'output_text', got ${w.type}`);U("response.output_text.delta",{...T,snapshot:w.text})}break}case"response.function_call_arguments.delta":{let Y=X.output[T.output_index];if(!Y)throw new e(`missing output at index ${T.output_index}`);if(Y.type==="function_call")U("response.function_call_arguments.delta",{...T,snapshot:Y.arguments});break}default:U(T.type,T);break}},LA=function $(){if(this.ended)throw new e("stream has ended, this shouldn't happen");let T=MT(this,NT,"f");if(!T)throw new e("request ended without sending any events");x2(this,NT,void 0,"f");let W=$b(T,MT(this,oG,"f"));return x2(this,lG,W,"f"),W},JA=function $(T){let W=MT(this,NT,"f");if(!W){if(T.type!=="response.created")throw new e(`When snapshot hasn't been set yet, expected 'response.created' event, got ${T.type}`);return W=x2(this,NT,T.response,"f"),W}switch(T.type){case"response.output_item.added":{W.output.push(T.item);break}case"response.content_part.added":{let U=W.output[T.output_index];if(!U)throw new e(`missing output at index ${T.output_index}`);if(U.type==="message")U.content.push(T.part);break}case"response.output_text.delta":{let U=W.output[T.output_index];if(!U)throw new e(`missing output at index ${T.output_index}`);if(U.type==="message"){let X=U.content[T.content_index];if(!X)throw new e(`missing content at index ${T.content_index}`);if(X.type!=="output_text")throw new e(`expected content to be 'output_text', got ${X.type}`);X.text+=T.delta}break}case"response.function_call_arguments.delta":{let U=W.output[T.output_index];if(!U)throw new e(`missing output at index ${T.output_index}`);if(U.type==="function_call")U.arguments+=T.delta;break}case"response.completed":{x2(this,NT,T.response,"f");break}}return W},Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("event",(U)=>{let X=T.shift();if(X)X.resolve(U);else $.push(U)}),this.on("end",()=>{W=!0;for(let U of T)U.resolve(void 0);T.length=0}),this.on("abort",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),this.on("error",(U)=>{W=!0;for(let X of T)X.reject(U);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((X,Y)=>T.push({resolve:X,reject:Y})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}async finalResponse(){await this.done();let $=MT(this,lG,"f");if(!$)throw new e("stream ended without producing a ChatCompletion");return $}}function $b($,T){return AA($,T)}class NW extends y{constructor(){super(...arguments);this.inputItems=new Q8(this._client)}create($,T){return this._client.post("/responses",{body:$,...T,stream:$.stream??!1})._thenUnwrap((W)=>{if("object"in W&&W.object==="response")dG(W);return W})}retrieve($,T={},W){if(Z$(T)&&W===void 0)return this.retrieve($,{},T);return this._client.get(`/responses/${$}`,{query:T,...W,stream:T.stream??!1})._thenUnwrap((U)=>{if("object"in U&&U.object==="response")dG(U);return U})}del($,T){return this._client.delete(`/responses/${$}`,{...T,headers:{Accept:"*/*",...T?.headers}})}parse($,T){return this._client.responses.create($,T)._thenUnwrap((W)=>VO(W,$))}stream($,T){return rG.createResponse(this._client,$,T)}cancel($,T){return this._client.post(`/responses/${$}/cancel`,{...T,headers:{Accept:"*/*",...T?.headers}})}}class KO extends v${}NW.InputItems=Q8;class Z8 extends y{create($,T,W){return this._client.post(`/uploads/${$}/parts`,x6({body:T,...W}))}}class LW extends y{constructor(){super(...arguments);this.parts=new Z8(this._client)}create($,T){return this._client.post("/uploads",{body:$,...T})}cancel($,T){return this._client.post(`/uploads/${$}/cancel`,T)}complete($,T,W){return this._client.post(`/uploads/${$}/complete`,{body:T,...W})}}LW.Parts=Z8;var _A=async($)=>{let T=await Promise.allSettled($),W=T.filter((X)=>X.status==="rejected");if(W.length){for(let X of W)console.error(X.reason);throw new Error(`${W.length} promise(s) failed - see the above errors`)}let U=[];for(let X of T)if(X.status==="fulfilled")U.push(X.value);return U};class JW extends y{create($,T,W){return this._client.post(`/vector_stores/${$}/files`,{body:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}retrieve($,T,W){return this._client.get(`/vector_stores/${$}/files/${T}`,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}update($,T,W,U){return this._client.post(`/vector_stores/${$}/files/${T}`,{body:W,...U,headers:{"OpenAI-Beta":"assistants=v2",...U?.headers}})}list($,T={},W){if(Z$(T))return this.list($,{},T);return this._client.getAPIList(`/vector_stores/${$}/files`,_W,{query:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}del($,T,W){return this._client.delete(`/vector_stores/${$}/files/${T}`,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}async createAndPoll($,T,W){let U=await this.create($,T,W);return await this.poll($,U.id,W)}async poll($,T,W){let U={...W?.headers,"X-Stainless-Poll-Helper":"true"};if(W?.pollIntervalMs)U["X-Stainless-Custom-Poll-Interval"]=W.pollIntervalMs.toString();while(!0){let X=await this.retrieve($,T,{...W,headers:U}).withResponse(),Y=X.data;switch(Y.status){case"in_progress":let w=5000;if(W?.pollIntervalMs)w=W.pollIntervalMs;else{let G=X.response.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))w=H}}await L0(w);break;case"failed":case"completed":return Y}}}async upload($,T,W){let U=await this._client.files.create({file:T,purpose:"assistants"},W);return this.create($,{file_id:U.id},W)}async uploadAndPoll($,T,W){let U=await this.upload($,T,W);return await this.poll($,U.id,W)}content($,T,W){return this._client.getAPIList(`/vector_stores/${$}/files/${T}/content`,D8,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}}class _W extends v${}class D8 extends _0{}JW.VectorStoreFilesPage=_W;JW.FileContentResponsesPage=D8;class V8 extends y{create($,T,W){return this._client.post(`/vector_stores/${$}/file_batches`,{body:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}retrieve($,T,W){return this._client.get(`/vector_stores/${$}/file_batches/${T}`,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}cancel($,T,W){return this._client.post(`/vector_stores/${$}/file_batches/${T}/cancel`,{...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}async createAndPoll($,T,W){let U=await this.create($,T);return await this.poll($,U.id,W)}listFiles($,T,W={},U){if(Z$(W))return this.listFiles($,T,{},W);return this._client.getAPIList(`/vector_stores/${$}/file_batches/${T}/files`,_W,{query:W,...U,headers:{"OpenAI-Beta":"assistants=v2",...U?.headers}})}async poll($,T,W){let U={...W?.headers,"X-Stainless-Poll-Helper":"true"};if(W?.pollIntervalMs)U["X-Stainless-Custom-Poll-Interval"]=W.pollIntervalMs.toString();while(!0){let{data:X,response:Y}=await this.retrieve($,T,{...W,headers:U}).withResponse();switch(X.status){case"in_progress":let w=5000;if(W?.pollIntervalMs)w=W.pollIntervalMs;else{let G=Y.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))w=H}}await L0(w);break;case"failed":case"cancelled":case"completed":return X}}}async uploadAndPoll($,{files:T,fileIds:W=[]},U){if(T==null||T.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let X=U?.maxConcurrency??5,Y=Math.min(X,T.length),w=this._client,G=T.values(),H=[...W];async function z(O){for(let Q of O){let Z=await w.files.create({file:Q,purpose:"assistants"},U);H.push(Z.id)}}let F=Array(Y).fill(G).map(z);return await _A(F),await this.createAndPoll($,{file_ids:H})}}class K1 extends y{constructor(){super(...arguments);this.files=new JW(this._client),this.fileBatches=new V8(this._client)}create($,T){return this._client.post("/vector_stores",{body:$,...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}retrieve($,T){return this._client.get(`/vector_stores/${$}`,{...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}update($,T,W){return this._client.post(`/vector_stores/${$}`,{body:T,...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}list($={},T){if(Z$($))return this.list({},$);return this._client.getAPIList("/vector_stores",b2,{query:$,...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}del($,T){return this._client.delete(`/vector_stores/${$}`,{...T,headers:{"OpenAI-Beta":"assistants=v2",...T?.headers}})}search($,T,W){return this._client.getAPIList(`/vector_stores/${$}/search`,f2,{body:T,method:"post",...W,headers:{"OpenAI-Beta":"assistants=v2",...W?.headers}})}}class b2 extends v${}class f2 extends _0{}K1.VectorStoresPage=b2;K1.VectorStoreSearchResponsesPage=f2;K1.Files=JW;K1.VectorStoreFilesPage=_W;K1.FileContentResponsesPage=D8;K1.FileBatches=V8;var RA;class D$ extends tF{constructor({baseURL:$=BX("OPENAI_BASE_URL"),apiKey:T=BX("OPENAI_API_KEY"),organization:W=BX("OPENAI_ORG_ID")??null,project:U=BX("OPENAI_PROJECT_ID")??null,...X}={}){if(T===void 0)throw new e("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let Y={apiKey:T,organization:W,project:U,...X,baseURL:$||"https://api.openai.com/v1"};if(!Y.dangerouslyAllowBrowser&&sE())throw new e(`It looks like you're running in a browser-like environment.
|
|
61
|
+
${Y}`)}let H=C1.join(this.baseDir,`${$}/${T}.output.json`);return JSON.parse(K4.readFileSync(H,"utf-8"))}async write($,T,W,w){let X=C1.join(this.baseDir,$),U=C1.join(X,`${T}.input.json`),Y=C1.join(X,`${T}.output.json`),G=JSON.stringify(W,null,"\t");if(!K4.existsSync(this.baseDir))K4.mkdirSync(this.baseDir,{recursive:!0});if(!K4.existsSync(X))K4.mkdirSync(X);if(K4.writeFileSync(U,G),K4.existsSync(Y))K4.unlinkSync(Y);let H=await w(...W),z=JSON.stringify(H,null,"\t");return K4.writeFileSync(Y,z),H}add($,T){let W=`${this.rootName}${q4}${V8($)}`;return{flush:()=>{this.flush($)},for:(w)=>{if(this.mode!=="off"){if(this.filesTouched.set($,new Set),n$.storage.initialized&&!n$.storage.getItem(`list${q4}${W}`))n$.storage.setItem(`list${q4}${W}`,"true")}return{get:async(...X)=>{let U=w;if(this.mode!=="off"){let Y=this.filenameCache.get(w);if(!Y)Y=V8(w),this.filenameCache.set(w,Y);U=Y,this.filesTouched.get($)?.add(U);let G=`${W}${q4}${U}`,H=`file${q4}${G}`;if(n$.storage.initialized&&!n$.storage.getItem(H))n$.storage.setItem(H,"true")}switch(this.mode){case"off":return T(...X);case"read":return this.read($,U,X);case"write":return this.write($,U,X,T);case"read-write":try{return this.read($,U,X)}catch(Y){if(Y instanceof Error)return this.write($,U,X,T);throw Y}}}}}}}flush(...$){console.log(this.filesTouched);for(let[T,W]of this.filesTouched.entries())if($.length===0||$.includes(T)){let w=C1.join(this.baseDir,T),X=K4.readdirSync(w);for(let U of X){let Y=U.replace(".input.json","").replace(".output.json","");if(!W.has(Y))console.info(`\uD83E\uDDF9 Flushing ${Y}`),K4.unlinkSync(C1.join(w,U))}}}};function w$($,T,W,w,X){if(w==="m")throw new TypeError("Private method is not writable");if(w==="a"&&!X)throw new TypeError("Private accessor was defined without a setter");if(typeof T==="function"?$!==T||!X:!T.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return w==="a"?X.call($,W):X?X.value=W:T.set($,W),W}function v($,T,W,w){if(W==="a"&&!w)throw new TypeError("Private accessor was defined without a getter");if(typeof T==="function"?$!==T||!w:!T.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return W==="m"?w:W==="a"?w.call($):w?w.value:T.get($)}var VF=function(){let{crypto:$}=globalThis;if($?.randomUUID)return VF=$.randomUUID.bind($),$.randomUUID();let T=new Uint8Array(1),W=$?()=>$.getRandomValues(T)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(w)=>(+w^W()&15>>+w/4).toString(16))};function K8($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var A8=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let T=new Error($.message,$.cause?{cause:$.cause}:{});if($.stack)T.stack=$.stack;if($.cause&&!T.cause)T.cause=$.cause;if($.name)T.name=$.name;return T}}catch{}try{return new Error(JSON.stringify($))}catch{}}return new Error($)};class $$ extends Error{}class L4 extends $${constructor($,T,W,w){super(`${L4.makeMessage($,T,W)}`);this.status=$,this.headers=w,this.requestID=w?.get("x-request-id"),this.error=T;let X=T;this.code=X?.code,this.param=X?.param,this.type=X?.type}static makeMessage($,T,W){let w=T?.message?typeof T.message==="string"?T.message:JSON.stringify(T.message):T?JSON.stringify(T):W;if($&&w)return`${$} ${w}`;if($)return`${$} status code (no body)`;if(w)return w;return"(no status code or body)"}static generate($,T,W,w){if(!$||!w)return new nT({message:W,cause:A8(T)});let X=T?.error;if($===400)return new E8($,X,W,w);if($===401)return new M8($,X,W,w);if($===403)return new D8($,X,W,w);if($===404)return new N8($,X,W,w);if($===409)return new L8($,X,W,w);if($===422)return new J8($,X,W,w);if($===429)return new R8($,X,W,w);if($>=500)return new _8($,X,W,w);return new L4($,X,W,w)}}class P4 extends L4{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class nT extends L4{constructor({message:$,cause:T}){super(void 0,void 0,$||"Connection error.",void 0);if(T)this.cause=T}}class iT extends nT{constructor({message:$}={}){super({message:$??"Request timed out."})}}class E8 extends L4{}class M8 extends L4{}class D8 extends L4{}class N8 extends L4{}class L8 extends L4{}class J8 extends L4{}class R8 extends L4{}class _8 extends L4{}class k8 extends $${constructor(){super("Could not parse response content as the length limit was reached")}}class v8 extends $${constructor(){super("Could not parse response content as the request was rejected by the content filter")}}var LS=/^[a-z][a-z0-9+.-]*:/i,KA=($)=>{return LS.test($)};function AA($){if(typeof $!=="object")return{};return $??{}}function EA($){if(!$)return!0;for(let T in $)return!1;return!0}function MA($,T){return Object.prototype.hasOwnProperty.call($,T)}function q8($){return $!=null&&typeof $==="object"&&!Array.isArray($)}var DA=($,T)=>{if(typeof T!=="number"||!Number.isInteger(T))throw new $$(`${$} must be an integer`);if(T<0)throw new $$(`${$} must be a positive integer`);return T};var NA=($)=>{try{return JSON.parse($)}catch(T){return}};var l1=($)=>new Promise((T)=>setTimeout(T,$));var zG={off:0,error:200,warn:300,info:400,debug:500},KF=($,T,W)=>{if(!$)return;if(MA(zG,$))return $;C4(W).warn(`${T} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(zG))}`);return};function P8(){}function GG($,T,W){if(!T||zG[$]>zG[W])return P8;else return T[$].bind(T)}var JS={error:P8,warn:P8,info:P8,debug:P8},LA=new WeakMap;function C4($){let T=$.logger,W=$.logLevel??"off";if(!T)return JS;let w=LA.get(T);if(w&&w[0]===W)return w[1];let X={error:GG("error",T,W),warn:GG("warn",T,W),info:GG("info",T,W),debug:GG("debug",T,W)};return LA.set(T,[W,X]),X}var M0=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([T,W])=>[T,T.toLowerCase()==="authorization"||T.toLowerCase()==="cookie"||T.toLowerCase()==="set-cookie"?"***":W]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var zT="5.0.1";var kA=()=>{return typeof window!=="undefined"&&typeof window.document!=="undefined"&&typeof navigator!=="undefined"};function RS(){if(typeof Deno!=="undefined"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime!=="undefined")return"edge";if(Object.prototype.toString.call(typeof globalThis.process!=="undefined"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var _S=()=>{let $=RS();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":zT,"X-Stainless-OS":RA(Deno.build.os),"X-Stainless-Arch":JA(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime!=="undefined")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":zT,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":zT,"X-Stainless-OS":RA(globalThis.process.platform??"unknown"),"X-Stainless-Arch":JA(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let T=kS();if(T)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":zT,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${T.browser}`,"X-Stainless-Runtime-Version":T.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":zT,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function kS(){if(typeof navigator==="undefined"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:T,pattern:W}of $){let w=W.exec(navigator.userAgent);if(w){let X=w[1]||0,U=w[2]||0,Y=w[3]||0;return{browser:T,version:`${X}.${U}.${Y}`}}}return null}var JA=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},RA=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},_A,vA=()=>{return _A??(_A=_S())};function qA(){if(typeof fetch!=="undefined")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function AF(...$){let T=globalThis.ReadableStream;if(typeof T==="undefined")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new T(...$)}function HG($){let T=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return AF({start(){},async pull(W){let{done:w,value:X}=await T.next();if(w)W.close();else W.enqueue(X)},async cancel(){await T.return?.()}})}function EF($){if($[Symbol.asyncIterator])return $;let T=$.getReader();return{async next(){try{let W=await T.read();if(W?.done)T.releaseLock();return W}catch(W){throw T.releaseLock(),W}},async return(){let W=T.cancel();return T.releaseLock(),await W,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function PA($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let T=$.getReader(),W=T.cancel();T.releaseLock(),await W}var CA=({headers:$,body:T})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(T)}};var C8="RFC3986",S8={RFC1738:($)=>String($).replace(/%20/g,"+"),RFC3986:($)=>String($)},MF="RFC1738";var PS=Array.isArray,r1=(()=>{let $=[];for(let T=0;T<256;++T)$.push("%"+((T<16?"0":"")+T.toString(16)).toUpperCase());return $})();var DF=1024,SA=($,T,W,w,X)=>{if($.length===0)return $;let U=$;if(typeof $==="symbol")U=Symbol.prototype.toString.call($);else if(typeof $!=="string")U=String($);if(W==="iso-8859-1")return escape(U).replace(/%u[0-9a-f]{4}/gi,function(G){return"%26%23"+parseInt(G.slice(2),16)+"%3B"});let Y="";for(let G=0;G<U.length;G+=DF){let H=U.length>=DF?U.slice(G,G+DF):U,z=[];for(let F=0;F<H.length;++F){let O=H.charCodeAt(F);if(O===45||O===46||O===95||O===126||O>=48&&O<=57||O>=65&&O<=90||O>=97&&O<=122||X===MF&&(O===40||O===41)){z[z.length]=H.charAt(F);continue}if(O<128){z[z.length]=r1[O];continue}if(O<2048){z[z.length]=r1[192|O>>6]+r1[128|O&63];continue}if(O<55296||O>=57344){z[z.length]=r1[224|O>>12]+r1[128|O>>6&63]+r1[128|O&63];continue}F+=1,O=65536+((O&1023)<<10|H.charCodeAt(F)&1023),z[z.length]=r1[240|O>>18]+r1[128|O>>12&63]+r1[128|O>>6&63]+r1[128|O&63]}Y+=z.join("")}return Y};function jA($){if(!$||typeof $!=="object")return!1;return!!($.constructor&&$.constructor.isBuffer&&$.constructor.isBuffer($))}function NF($,T){if(PS($)){let W=[];for(let w=0;w<$.length;w+=1)W.push(T($[w]));return W}return T($)}var CS=Object.prototype.hasOwnProperty,IA={brackets($){return String($)+"[]"},comma:"comma",indices($,T){return String($)+"["+T+"]"},repeat($){return String($)}},n1=Array.isArray,SS=Array.prototype.push,BA=function($,T){SS.apply($,n1(T)?T:[T])},jS=Date.prototype.toISOString,S4={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:SA,encodeValuesOnly:!1,format:C8,formatter:S8[C8],indices:!1,serializeDate($){return jS.call($)},skipNulls:!1,strictNullHandling:!1};function IS($){return typeof $==="string"||typeof $==="number"||typeof $==="boolean"||typeof $==="symbol"||typeof $==="bigint"}var LF={};function xA($,T,W,w,X,U,Y,G,H,z,F,O,Q,Z,K,E,M,L){let R=$,_=L,S=0,x=!1;while((_=_.get(LF))!==void 0&&!x){let j=_.get($);if(S+=1,typeof j!=="undefined")if(j===S)throw new RangeError("Cyclic object value");else x=!0;if(typeof _.get(LF)==="undefined")S=0}if(typeof z==="function")R=z(T,R);else if(R instanceof Date)R=Q?.(R);else if(W==="comma"&&n1(R))R=NF(R,function(j){if(j instanceof Date)return Q?.(j);return j});if(R===null){if(U)return H&&!E?H(T,S4.encoder,M,"key",Z):T;R=""}if(IS(R)||jA(R)){if(H){let j=E?T:H(T,S4.encoder,M,"key",Z);return[K?.(j)+"="+K?.(H(R,S4.encoder,M,"value",Z))]}return[K?.(T)+"="+K?.(String(R))]}let b=[];if(typeof R==="undefined")return b;let g;if(W==="comma"&&n1(R)){if(E&&H)R=NF(R,H);g=[{value:R.length>0?R.join(",")||null:void 0}]}else if(n1(z))g=z;else{let j=Object.keys(R);g=F?j.sort(F):j}let T$=G?String(T).replace(/\./g,"%2E"):String(T),N$=w&&n1(R)&&R.length===1?T$+"[]":T$;if(X&&n1(R)&&R.length===0)return N$+"[]";for(let j=0;j<g.length;++j){let U$=g[j],t=typeof U$==="object"&&typeof U$.value!=="undefined"?U$.value:R[U$];if(Y&&t===null)continue;let z$=O&&G?U$.replace(/\./g,"%2E"):U$,B$=n1(R)?typeof W==="function"?W(N$,z$):N$:N$+(O?"."+z$:"["+z$+"]");L.set($,S);let e$=new WeakMap;e$.set(LF,L),BA(b,xA(t,B$,W,w,X,U,Y,G,W==="comma"&&E&&n1(R)?null:H,z,F,O,Q,Z,K,E,M,e$))}return b}function BS($=S4){if(typeof $.allowEmptyArrays!=="undefined"&&typeof $.allowEmptyArrays!=="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof $.encodeDotInKeys!=="undefined"&&typeof $.encodeDotInKeys!=="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if($.encoder!==null&&typeof $.encoder!=="undefined"&&typeof $.encoder!=="function")throw new TypeError("Encoder has to be a function.");let T=$.charset||S4.charset;if(typeof $.charset!=="undefined"&&$.charset!=="utf-8"&&$.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let W=C8;if(typeof $.format!=="undefined"){if(!CS.call(S8,$.format))throw new TypeError("Unknown format option provided.");W=$.format}let w=S8[W],X=S4.filter;if(typeof $.filter==="function"||n1($.filter))X=$.filter;let U;if($.arrayFormat&&$.arrayFormat in IA)U=$.arrayFormat;else if("indices"in $)U=$.indices?"indices":"repeat";else U=S4.arrayFormat;if("commaRoundTrip"in $&&typeof $.commaRoundTrip!=="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let Y=typeof $.allowDots==="undefined"?!!$.encodeDotInKeys===!0?!0:S4.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix==="boolean"?$.addQueryPrefix:S4.addQueryPrefix,allowDots:Y,allowEmptyArrays:typeof $.allowEmptyArrays==="boolean"?!!$.allowEmptyArrays:S4.allowEmptyArrays,arrayFormat:U,charset:T,charsetSentinel:typeof $.charsetSentinel==="boolean"?$.charsetSentinel:S4.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter==="undefined"?S4.delimiter:$.delimiter,encode:typeof $.encode==="boolean"?$.encode:S4.encode,encodeDotInKeys:typeof $.encodeDotInKeys==="boolean"?$.encodeDotInKeys:S4.encodeDotInKeys,encoder:typeof $.encoder==="function"?$.encoder:S4.encoder,encodeValuesOnly:typeof $.encodeValuesOnly==="boolean"?$.encodeValuesOnly:S4.encodeValuesOnly,filter:X,format:W,formatter:w,serializeDate:typeof $.serializeDate==="function"?$.serializeDate:S4.serializeDate,skipNulls:typeof $.skipNulls==="boolean"?$.skipNulls:S4.skipNulls,sort:typeof $.sort==="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling==="boolean"?$.strictNullHandling:S4.strictNullHandling}}function JF($,T={}){let W=$,w=BS(T),X,U;if(typeof w.filter==="function")U=w.filter,W=U("",W);else if(n1(w.filter))U=w.filter,X=U;let Y=[];if(typeof W!=="object"||W===null)return"";let G=IA[w.arrayFormat],H=G==="comma"&&w.commaRoundTrip;if(!X)X=Object.keys(W);if(w.sort)X.sort(w.sort);let z=new WeakMap;for(let Q=0;Q<X.length;++Q){let Z=X[Q];if(w.skipNulls&&W[Z]===null)continue;BA(Y,xA(W[Z],Z,G,H,w.allowEmptyArrays,w.strictNullHandling,w.skipNulls,w.encodeDotInKeys,w.encode?w.encoder:null,w.filter,w.sort,w.allowDots,w.serializeDate,w.format,w.formatter,w.encodeValuesOnly,w.charset,z))}let F=Y.join(w.delimiter),O=w.addQueryPrefix===!0?"?":"";if(w.charsetSentinel)if(w.charset==="iso-8859-1")O+="utf8=%26%2310003%3B&";else O+="utf8=%E2%9C%93&";return F.length>0?O+F:""}function yA($){let T=0;for(let X of $)T+=X.length;let W=new Uint8Array(T),w=0;for(let X of $)W.set(X,w),w+=X.length;return W}var fA;function sW($){let T;return(fA??(T=new globalThis.TextEncoder,fA=T.encode.bind(T)))($)}var bA;function RF($){let T;return(bA??(T=new globalThis.TextDecoder,bA=T.decode.bind(T)))($)}var e6,$1;class eW{constructor(){e6.set(this,void 0),$1.set(this,void 0),w$(this,e6,new Uint8Array,"f"),w$(this,$1,null,"f")}decode($){if($==null)return[];let T=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?sW($):$;w$(this,e6,yA([v(this,e6,"f"),T]),"f");let W=[],w;while((w=fS(v(this,e6,"f"),v(this,$1,"f")))!=null){if(w.carriage&&v(this,$1,"f")==null){w$(this,$1,w.index,"f");continue}if(v(this,$1,"f")!=null&&(w.index!==v(this,$1,"f")+1||w.carriage)){W.push(RF(v(this,e6,"f").subarray(0,v(this,$1,"f")-1))),w$(this,e6,v(this,e6,"f").subarray(v(this,$1,"f")),"f"),w$(this,$1,null,"f");continue}let X=v(this,$1,"f")!==null?w.preceding-1:w.preceding,U=RF(v(this,e6,"f").subarray(0,X));W.push(U),w$(this,e6,v(this,e6,"f").subarray(w.index),"f"),w$(this,$1,null,"f")}return W}flush(){if(!v(this,e6,"f").length)return[];return this.decode(`
|
|
62
|
+
`)}}e6=new WeakMap,$1=new WeakMap;eW.NEWLINE_CHARS=new Set([`
|
|
63
|
+
`,"\r"]);eW.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function fS($,T){for(let X=T??0;X<$.length;X++){if($[X]===10)return{preceding:X,index:X+1,carriage:!1};if($[X]===13)return{preceding:X,index:X+1,carriage:!0}}return null}function hA($){for(let w=0;w<$.length-1;w++){if($[w]===10&&$[w+1]===10)return w+2;if($[w]===13&&$[w+1]===13)return w+2;if($[w]===13&&$[w+1]===10&&w+3<$.length&&$[w+2]===13&&$[w+3]===10)return w+4}return-1}class T1{constructor($,T){this.iterator=$,this.controller=T}static fromSSEResponse($,T){let W=!1;async function*w(){if(W)throw new $$("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");W=!0;let X=!1;try{for await(let U of bS($,T)){if(X)continue;if(U.data.startsWith("[DONE]")){X=!0;continue}if(U.event===null||U.event.startsWith("response.")||U.event.startsWith("transcript.")){let Y;try{Y=JSON.parse(U.data)}catch(G){throw console.error("Could not parse message into JSON:",U.data),console.error("From chunk:",U.raw),G}if(Y&&Y.error)throw new L4(void 0,Y.error,void 0,$.headers);yield Y}else{let Y;try{Y=JSON.parse(U.data)}catch(G){throw console.error("Could not parse message into JSON:",U.data),console.error("From chunk:",U.raw),G}if(U.event=="error")throw new L4(void 0,Y.error,Y.message,void 0);yield{event:U.event,data:Y}}}X=!0}catch(U){if(K8(U))return;throw U}finally{if(!X)T.abort()}}return new T1(w,T)}static fromReadableStream($,T){let W=!1;async function*w(){let U=new eW,Y=EF($);for await(let G of Y)for(let H of U.decode(G))yield H;for(let G of U.flush())yield G}async function*X(){if(W)throw new $$("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");W=!0;let U=!1;try{for await(let Y of w()){if(U)continue;if(Y)yield JSON.parse(Y)}U=!0}catch(Y){if(K8(Y))return;throw Y}finally{if(!U)T.abort()}}return new T1(X,T)}[Symbol.asyncIterator](){return this.iterator()}tee(){let $=[],T=[],W=this.iterator(),w=(X)=>{return{next:()=>{if(X.length===0){let U=W.next();$.push(U),T.push(U)}return X.shift()}}};return[new T1(()=>w($),this.controller),new T1(()=>w(T),this.controller)]}toReadableStream(){let $=this,T;return AF({async start(){T=$[Symbol.asyncIterator]()},async pull(W){try{let{value:w,done:X}=await T.next();if(X)return W.close();let U=sW(JSON.stringify(w)+`
|
|
64
|
+
`);W.enqueue(U)}catch(w){W.error(w)}},async cancel(){await T.return?.()}})}}async function*bS($,T){if(!$.body){if(T.abort(),typeof globalThis.navigator!=="undefined"&&globalThis.navigator.product==="ReactNative")throw new $$("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new $$("Attempted to iterate over a response with no body")}let W=new gA,w=new eW,X=EF($.body);for await(let U of yS(X))for(let Y of w.decode(U)){let G=W.decode(Y);if(G)yield G}for(let U of w.flush()){let Y=W.decode(U);if(Y)yield Y}}async function*yS($){let T=new Uint8Array;for await(let W of $){if(W==null)continue;let w=W instanceof ArrayBuffer?new Uint8Array(W):typeof W==="string"?sW(W):W,X=new Uint8Array(T.length+w.length);X.set(T),X.set(w,T.length),T=X;let U;while((U=hA(T))!==-1)yield T.slice(0,U),T=T.slice(U)}if(T.length>0)yield T}class gA{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let X={event:this.event,data:this.data.join(`
|
|
65
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push($),$.startsWith(":"))return null;let[T,W,w]=hS($,":");if(w.startsWith(" "))w=w.substring(1);if(T==="event")this.event=w;else if(T==="data")this.data.push(w);return null}}function hS($,T){let W=$.indexOf(T);if(W!==-1)return[$.substring(0,W),T,$.substring(W+T.length)];return[$,"",""]}async function FG($,T){let{response:W,requestLogID:w,retryOfRequestLogID:X,startTime:U}=T,Y=await(async()=>{if(T.options.stream){if(C4($).debug("response",W.status,W.url,W.headers,W.body),T.options.__streamClass)return T.options.__streamClass.fromSSEResponse(W,T.controller);return T1.fromSSEResponse(W,T.controller)}if(W.status===204)return null;if(T.options.__binaryResponse)return W;let H=W.headers.get("content-type")?.split(";")[0]?.trim();if(H?.includes("application/json")||H?.endsWith("+json")){let O=await W.json();return _F(O,W)}return await W.text()})();return C4($).debug(`[${w}] response parsed`,M0({retryOfRequestLogID:X,url:W.url,status:W.status,body:Y,durationMs:Date.now()-U})),Y}function _F($,T){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:T.headers.get("x-request-id"),enumerable:!1})}var j8;class tT extends Promise{constructor($,T,W=FG){super((w)=>{w(null)});this.responsePromise=T,this.parseResponse=W,j8.set(this,void 0),w$(this,j8,$,"f")}_thenUnwrap($){return new tT(v(this,j8,"f"),this.responsePromise,async(T,W)=>_F($(await this.parseResponse(T,W),W),W.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,T]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:T,request_id:T.headers.get("x-request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(v(this,j8,"f"),$));return this.parsedPromise}then($,T){return this.parse().then($,T)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}j8=new WeakMap;var OG;class kF{constructor($,T,W,w){OG.set(this,void 0),w$(this,OG,$,"f"),this.options=w,this.response=T,this.body=W}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new $$("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await v(this,OG,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(OG=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let T of $.getPaginatedItems())yield T}}class QG extends tT{constructor($,T,W){super($,T,async(w,X)=>new W(w,X.response,await FG(w,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let T of $)yield T}}class D0 extends kF{constructor($,T,W,w){super($,T,W,w);this.data=W.data||[],this.object=W.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}}class J$ extends kF{constructor($,T,W,w){super($,T,W,w);this.data=W.data||[],this.has_more=W.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.getPaginatedItems(),T=$[$.length-1]?.id;if(!T)return null;return{...this.options,query:{...AA(this.options.query),after:T}}}}var qF=()=>{if(typeof File==="undefined"){let{process:$}=globalThis,T=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(T?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function $2($,T,W){return qF(),new File($,T??"unknown_file",W)}function I8($){return(typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"").split(/[\\/]/).pop()||void 0}var PF=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function";var W1=async($,T)=>{return{...$,body:await cS($.body,T)}},mA=new WeakMap;function mS($){let T=typeof $==="function"?$:$.fetch,W=mA.get(T);if(W)return W;let w=(async()=>{try{let X="Response"in T?T.Response:(await T("data:,")).constructor,U=new FormData;if(U.toString()===await new X(U).text())return!1;return!0}catch{return!0}})();return mA.set(T,w),w}var cS=async($,T)=>{if(!await mS(T))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let W=new FormData;return await Promise.all(Object.entries($||{}).map(([w,X])=>vF(W,w,X))),W},uS=($)=>$ instanceof Blob&&("name"in $);var vF=async($,T,W)=>{if(W===void 0)return;if(W==null)throw new TypeError(`Received null for "${T}"; to pass null in FormData, you must use the string 'null'`);if(typeof W==="string"||typeof W==="number"||typeof W==="boolean")$.append(T,String(W));else if(W instanceof Response)$.append(T,$2([await W.blob()],I8(W)));else if(PF(W))$.append(T,$2([await new Response(HG(W)).blob()],I8(W)));else if(uS(W))$.append(T,W,I8(W));else if(Array.isArray(W))await Promise.all(W.map((w)=>vF($,T+"[]",w)));else if(typeof W==="object")await Promise.all(Object.entries(W).map(([w,X])=>vF($,`${T}[${w}]`,X)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${W} instead`)};var cA=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",pS=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&cA($),dS=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";async function ZG($,T,W){if(qF(),$=await $,pS($)){if($ instanceof File)return $;return $2([await $.arrayBuffer()],$.name)}if(dS($)){let X=await $.blob();return T||(T=new URL($.url).pathname.split(/[\\/]/).pop()),$2(await CF(X),T,W)}let w=await CF($);if(T||(T=I8($)),!W?.type){let X=w.find((U)=>typeof U==="object"&&("type"in U)&&U.type);if(typeof X==="string")W={...W,type:X}}return $2(w,T,W)}async function CF($){let T=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)T.push($);else if(cA($))T.push($ instanceof Blob?$:await $.arrayBuffer());else if(PF($))for await(let W of $)T.push(...await CF(W));else{let W=$?.constructor?.name;throw new Error(`Unexpected data type: ${typeof $}${W?`; constructor: ${W}`:""}${oS($)}`)}return T}function oS($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((W)=>`"${W}"`).join(", ")}]`}class m{constructor($){this._client=$}}function uA($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var rS=($=uA)=>function T(W,...w){if(W.length===1)return W[0];let X=!1,U=W.reduce((F,O,Q)=>{if(/[?#]/.test(O))X=!0;return F+O+(Q===w.length?"":(X?encodeURIComponent:$)(String(w[Q])))},""),Y=U.split(/[?#]/,1)[0],G=[],H=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,z;while((z=H.exec(Y))!==null)G.push({start:z.index,length:z[0].length});if(G.length>0){let F=0,O=G.reduce((Q,Z)=>{let K=" ".repeat(Z.start-F),E="^".repeat(Z.length);return F=Z.start+Z.length,Q+K+E},"");throw new $$(`Path parameters result in path with invalid segments:
|
|
66
|
+
${U}
|
|
67
|
+
${O}`)}return U},h=rS(uA);class T2 extends m{list($,T={},W){return this._client.getAPIList(h`/chat/completions/${$}/messages`,J$,{query:T,...W})}}function pA($){return typeof $.parse==="function"}var W2=($)=>{return $?.role==="assistant"},SF=($)=>{return $?.role==="tool"};var jF,VG,KG,B8,x8,AG,f8,N0,b8,EG,MG,X2,dA;class aT{constructor(){jF.add(this),this.controller=new AbortController,VG.set(this,void 0),KG.set(this,()=>{}),B8.set(this,()=>{}),x8.set(this,void 0),AG.set(this,()=>{}),f8.set(this,()=>{}),N0.set(this,{}),b8.set(this,!1),EG.set(this,!1),MG.set(this,!1),X2.set(this,!1),w$(this,VG,new Promise(($,T)=>{w$(this,KG,$,"f"),w$(this,B8,T,"f")}),"f"),w$(this,x8,new Promise(($,T)=>{w$(this,AG,$,"f"),w$(this,f8,T,"f")}),"f"),v(this,VG,"f").catch(()=>{}),v(this,x8,"f").catch(()=>{})}_run($){setTimeout(()=>{$().then(()=>{this._emitFinal(),this._emit("end")},v(this,jF,"m",dA).bind(this))},0)}_connected(){if(this.ended)return;v(this,KG,"f").call(this),this._emit("connect")}get ended(){return v(this,b8,"f")}get errored(){return v(this,EG,"f")}get aborted(){return v(this,MG,"f")}abort(){this.controller.abort()}on($,T){return(v(this,N0,"f")[$]||(v(this,N0,"f")[$]=[])).push({listener:T}),this}off($,T){let W=v(this,N0,"f")[$];if(!W)return this;let w=W.findIndex((X)=>X.listener===T);if(w>=0)W.splice(w,1);return this}once($,T){return(v(this,N0,"f")[$]||(v(this,N0,"f")[$]=[])).push({listener:T,once:!0}),this}emitted($){return new Promise((T,W)=>{if(w$(this,X2,!0,"f"),$!=="error")this.once("error",W);this.once($,T)})}async done(){w$(this,X2,!0,"f"),await v(this,x8,"f")}_emit($,...T){if(v(this,b8,"f"))return;if($==="end")w$(this,b8,!0,"f"),v(this,AG,"f").call(this);let W=v(this,N0,"f")[$];if(W)v(this,N0,"f")[$]=W.filter((w)=>!w.once),W.forEach(({listener:w})=>w(...T));if($==="abort"){let w=T[0];if(!v(this,X2,"f")&&!W?.length)Promise.reject(w);v(this,B8,"f").call(this,w),v(this,f8,"f").call(this,w),this._emit("end");return}if($==="error"){let w=T[0];if(!v(this,X2,"f")&&!W?.length)Promise.reject(w);v(this,B8,"f").call(this,w),v(this,f8,"f").call(this,w),this._emit("end")}}_emitFinal(){}}VG=new WeakMap,KG=new WeakMap,B8=new WeakMap,x8=new WeakMap,AG=new WeakMap,f8=new WeakMap,N0=new WeakMap,b8=new WeakMap,EG=new WeakMap,MG=new WeakMap,X2=new WeakMap,jF=new WeakSet,dA=function $(T){if(w$(this,EG,!0,"f"),T instanceof Error&&T.name==="AbortError")T=new P4;if(T instanceof P4)return w$(this,MG,!0,"f"),this._emit("abort",T);if(T instanceof $$)return this._emit("error",T);if(T instanceof Error){let W=new $$(T.message);return W.cause=T,this._emit("error",W)}return this._emit("error",new $$(String(T)))};function y8($){return $?.$brand==="auto-parseable-response-format"}function sT($){return $?.$brand==="auto-parseable-tool"}function oA($,T){if(!T||!IF(T))return{...$,choices:$.choices.map((W)=>({...W,message:{...W.message,parsed:null,...W.message.tool_calls?{tool_calls:W.message.tool_calls}:void 0}}))};return h8($,T)}function h8($,T){let W=$.choices.map((w)=>{if(w.finish_reason==="length")throw new k8;if(w.finish_reason==="content_filter")throw new v8;return{...w,message:{...w.message,...w.message.tool_calls?{tool_calls:w.message.tool_calls?.map((X)=>aS(T,X))??void 0}:void 0,parsed:w.message.content&&!w.message.refusal?tS(T,w.message.content):null}}});return{...$,choices:W}}function tS($,T){if($.response_format?.type!=="json_schema")return null;if($.response_format?.type==="json_schema"){if("$parseRaw"in $.response_format)return $.response_format.$parseRaw(T);return JSON.parse(T)}return null}function aS($,T){let W=$.tools?.find((w)=>w.function?.name===T.function.name);return{...T,function:{...T.function,parsed_arguments:sT(W)?W.$parseRaw(T.function.arguments):W?.function.strict?JSON.parse(T.function.arguments):null}}}function lA($,T){if(!$)return!1;let W=$.tools?.find((w)=>w.function?.name===T.function.name);return sT(W)||W?.function.strict||!1}function IF($){if(y8($.response_format))return!0;return $.tools?.some((T)=>sT(T)||T.type==="function"&&T.function.strict===!0)??!1}function rA($){for(let T of $??[]){if(T.type!=="function")throw new $$(`Currently only \`function\` tool types support auto-parsing; Received \`${T.type}\``);if(T.function.strict!==!0)throw new $$(`The \`${T.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var H6,BF,DG,xF,fF,bF,nA,iA,sS=10;class g8 extends aT{constructor(){super(...arguments);H6.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion($){this._chatCompletions.push($),this._emit("chatCompletion",$);let T=$.choices[0]?.message;if(T)this._addMessage(T);return $}_addMessage($,T=!0){if(!("content"in $))$.content=null;if(this.messages.push($),T){if(this._emit("message",$),SF($)&&$.content)this._emit("functionToolCallResult",$.content);else if(W2($)&&$.tool_calls){for(let W of $.tool_calls)if(W.type==="function")this._emit("functionToolCall",W.function)}}}async finalChatCompletion(){await this.done();let $=this._chatCompletions[this._chatCompletions.length-1];if(!$)throw new $$("stream ended without producing a ChatCompletion");return $}async finalContent(){return await this.done(),v(this,H6,"m",BF).call(this)}async finalMessage(){return await this.done(),v(this,H6,"m",DG).call(this)}async finalFunctionToolCall(){return await this.done(),v(this,H6,"m",xF).call(this)}async finalFunctionToolCallResult(){return await this.done(),v(this,H6,"m",fF).call(this)}async totalUsage(){return await this.done(),v(this,H6,"m",bF).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let $=this._chatCompletions[this._chatCompletions.length-1];if($)this._emit("finalChatCompletion",$);let T=v(this,H6,"m",DG).call(this);if(T)this._emit("finalMessage",T);let W=v(this,H6,"m",BF).call(this);if(W)this._emit("finalContent",W);let w=v(this,H6,"m",xF).call(this);if(w)this._emit("finalFunctionToolCall",w);let X=v(this,H6,"m",fF).call(this);if(X!=null)this._emit("finalFunctionToolCallResult",X);if(this._chatCompletions.some((U)=>U.usage))this._emit("totalUsage",v(this,H6,"m",bF).call(this))}async _createChatCompletion($,T,W){let w=W?.signal;if(w){if(w.aborted)this.controller.abort();w.addEventListener("abort",()=>this.controller.abort())}v(this,H6,"m",nA).call(this,T);let X=await $.chat.completions.create({...T,stream:!1},{...W,signal:this.controller.signal});return this._connected(),this._addChatCompletion(h8(X,T))}async _runChatCompletion($,T,W){for(let w of T.messages)this._addMessage(w,!1);return await this._createChatCompletion($,T,W)}async _runTools($,T,W){let{tool_choice:X="auto",stream:U,...Y}=T,G=typeof X!=="string"&&X?.function?.name,{maxChatCompletions:H=sS}=W||{},z=T.tools.map((Q)=>{if(sT(Q)){if(!Q.$callback)throw new $$("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:Q.$callback,name:Q.function.name,description:Q.function.description||"",parameters:Q.function.parameters,parse:Q.$parseRaw,strict:!0}}}return Q}),F={};for(let Q of z)if(Q.type==="function")F[Q.function.name||Q.function.function.name]=Q.function;let O="tools"in T?z.map((Q)=>Q.type==="function"?{type:"function",function:{name:Q.function.name||Q.function.function.name,parameters:Q.function.parameters,description:Q.function.description,strict:Q.function.strict}}:Q):void 0;for(let Q of T.messages)this._addMessage(Q,!1);for(let Q=0;Q<H;++Q){let K=(await this._createChatCompletion($,{...Y,tool_choice:X,tools:O,messages:[...this.messages]},W)).choices[0]?.message;if(!K)throw new $$("missing message in ChatCompletion response");if(!K.tool_calls?.length)return;for(let E of K.tool_calls){if(E.type!=="function")continue;let M=E.id,{name:L,arguments:R}=E.function,_=F[L];if(!_){let g=`Invalid tool_call: ${JSON.stringify(L)}. Available options are: ${Object.keys(F).map((T$)=>JSON.stringify(T$)).join(", ")}. Please try again`;this._addMessage({role:"tool",tool_call_id:M,content:g});continue}else if(G&&G!==L){let g=`Invalid tool_call: ${JSON.stringify(L)}. ${JSON.stringify(G)} requested. Please try again`;this._addMessage({role:"tool",tool_call_id:M,content:g});continue}let S;try{S=pA(_)?await _.parse(R):R}catch(g){let T$=g instanceof Error?g.message:String(g);this._addMessage({role:"tool",tool_call_id:M,content:T$});continue}let x=await _.function(S,this),b=v(this,H6,"m",iA).call(this,x);if(this._addMessage({role:"tool",tool_call_id:M,content:b}),G)return}}return}}H6=new WeakSet,BF=function $(){return v(this,H6,"m",DG).call(this).content??null},DG=function $(){let T=this.messages.length;while(T-- >0){let W=this.messages[T];if(W2(W))return{...W,content:W.content??null,refusal:W.refusal??null}}throw new $$("stream ended without producing a ChatCompletionMessage with role=assistant")},xF=function $(){for(let T=this.messages.length-1;T>=0;T--){let W=this.messages[T];if(W2(W)&&W?.tool_calls?.length)return W.tool_calls.at(-1)?.function}return},fF=function $(){for(let T=this.messages.length-1;T>=0;T--){let W=this.messages[T];if(SF(W)&&W.content!=null&&typeof W.content==="string"&&this.messages.some((w)=>w.role==="assistant"&&w.tool_calls?.some((X)=>X.type==="function"&&X.id===W.tool_call_id)))return W.content}return},bF=function $(){let T={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:W}of this._chatCompletions)if(W)T.completion_tokens+=W.completion_tokens,T.prompt_tokens+=W.prompt_tokens,T.total_tokens+=W.total_tokens;return T},nA=function $(T){if(T.n!=null&&T.n>1)throw new $$("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},iA=function $(T){return typeof T==="string"?T:T===void 0?"undefined":JSON.stringify(T)};class m8 extends g8{static runTools($,T,W){let w=new m8,X={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runTools"}};return w._run(()=>w._runTools($,T,X)),w}_addMessage($,T=!0){if(super._addMessage($,T),W2($)&&$.content)this._emit("content",$.content)}}var g4={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511};class tA extends Error{}class aA extends Error{}function eS($,T=g4.ALL){if(typeof $!=="string")throw new TypeError(`expecting str, got ${typeof $}`);if(!$.trim())throw new Error(`${$} is empty`);return $j($.trim(),T)}var $j=($,T)=>{let W=$.length,w=0,X=(Q)=>{throw new tA(`${Q} at position ${w}`)},U=(Q)=>{throw new aA(`${Q} at position ${w}`)},Y=()=>{if(O(),w>=W)X("Unexpected end of input");if($[w]==='"')return G();if($[w]==="{")return H();if($[w]==="[")return z();if($.substring(w,w+4)==="null"||g4.NULL&T&&W-w<4&&"null".startsWith($.substring(w)))return w+=4,null;if($.substring(w,w+4)==="true"||g4.BOOL&T&&W-w<4&&"true".startsWith($.substring(w)))return w+=4,!0;if($.substring(w,w+5)==="false"||g4.BOOL&T&&W-w<5&&"false".startsWith($.substring(w)))return w+=5,!1;if($.substring(w,w+8)==="Infinity"||g4.INFINITY&T&&W-w<8&&"Infinity".startsWith($.substring(w)))return w+=8,1/0;if($.substring(w,w+9)==="-Infinity"||g4.MINUS_INFINITY&T&&1<W-w&&W-w<9&&"-Infinity".startsWith($.substring(w)))return w+=9,-1/0;if($.substring(w,w+3)==="NaN"||g4.NAN&T&&W-w<3&&"NaN".startsWith($.substring(w)))return w+=3,NaN;return F()},G=()=>{let Q=w,Z=!1;w++;while(w<W&&($[w]!=='"'||Z&&$[w-1]==="\\"))Z=$[w]==="\\"?!Z:!1,w++;if($.charAt(w)=='"')try{return JSON.parse($.substring(Q,++w-Number(Z)))}catch(K){U(String(K))}else if(g4.STR&T)try{return JSON.parse($.substring(Q,w-Number(Z))+'"')}catch(K){return JSON.parse($.substring(Q,$.lastIndexOf("\\"))+'"')}X("Unterminated string literal")},H=()=>{w++,O();let Q={};try{while($[w]!=="}"){if(O(),w>=W&&g4.OBJ&T)return Q;let Z=G();O(),w++;try{let K=Y();Object.defineProperty(Q,Z,{value:K,writable:!0,enumerable:!0,configurable:!0})}catch(K){if(g4.OBJ&T)return Q;else throw K}if(O(),$[w]===",")w++}}catch(Z){if(g4.OBJ&T)return Q;else X("Expected '}' at end of object")}return w++,Q},z=()=>{w++;let Q=[];try{while($[w]!=="]")if(Q.push(Y()),O(),$[w]===",")w++}catch(Z){if(g4.ARR&T)return Q;X("Expected ']' at end of array")}return w++,Q},F=()=>{if(w===0){if($==="-"&&g4.NUM&T)X("Not sure what '-' is");try{return JSON.parse($)}catch(Z){if(g4.NUM&T)try{if($[$.length-1]===".")return JSON.parse($.substring(0,$.lastIndexOf(".")));return JSON.parse($.substring(0,$.lastIndexOf("e")))}catch(K){}U(String(Z))}}let Q=w;if($[w]==="-")w++;while($[w]&&!",]}".includes($[w]))w++;if(w==W&&!(g4.NUM&T))X("Unterminated number literal");try{return JSON.parse($.substring(Q,w))}catch(Z){if($.substring(Q,w)==="-"&&g4.NUM&T)X("Not sure what '-' is");try{return JSON.parse($.substring(Q,$.lastIndexOf("e")))}catch(K){U(String(K))}}},O=()=>{while(w<W&&`
|
|
68
|
+
\r `.includes($[w]))w++};return Y()},yF=($)=>eS($,g4.ALL^g4.NUM);var j4,L0,w2,HT,hF,NG,gF,mF,cF,LG,uF,sA;class FT extends g8{constructor($){super();j4.add(this),L0.set(this,void 0),w2.set(this,void 0),HT.set(this,void 0),w$(this,L0,$,"f"),w$(this,w2,[],"f")}get currentChatCompletionSnapshot(){return v(this,HT,"f")}static fromReadableStream($){let T=new FT(null);return T._run(()=>T._fromReadableStream($)),T}static createChatCompletion($,T,W){let w=new FT(T);return w._run(()=>w._runChatCompletion($,{...T,stream:!0},{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),w}async _createChatCompletion($,T,W){super._createChatCompletion;let w=W?.signal;if(w){if(w.aborted)this.controller.abort();w.addEventListener("abort",()=>this.controller.abort())}v(this,j4,"m",hF).call(this);let X=await $.chat.completions.create({...T,stream:!0},{...W,signal:this.controller.signal});this._connected();for await(let U of X)v(this,j4,"m",gF).call(this,U);if(X.controller.signal?.aborted)throw new P4;return this._addChatCompletion(v(this,j4,"m",LG).call(this))}async _fromReadableStream($,T){let W=T?.signal;if(W){if(W.aborted)this.controller.abort();W.addEventListener("abort",()=>this.controller.abort())}v(this,j4,"m",hF).call(this),this._connected();let w=T1.fromReadableStream($,this.controller),X;for await(let U of w){if(X&&X!==U.id)this._addChatCompletion(v(this,j4,"m",LG).call(this));v(this,j4,"m",gF).call(this,U),X=U.id}if(w.controller.signal?.aborted)throw new P4;return this._addChatCompletion(v(this,j4,"m",LG).call(this))}[(L0=new WeakMap,w2=new WeakMap,HT=new WeakMap,j4=new WeakSet,hF=function $(){if(this.ended)return;w$(this,HT,void 0,"f")},NG=function $(T){let W=v(this,w2,"f")[T.index];if(W)return W;return W={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},v(this,w2,"f")[T.index]=W,W},gF=function $(T){if(this.ended)return;let W=v(this,j4,"m",sA).call(this,T);this._emit("chunk",T,W);for(let w of T.choices){let X=W.choices[w.index];if(w.delta.content!=null&&X.message?.role==="assistant"&&X.message?.content)this._emit("content",w.delta.content,X.message.content),this._emit("content.delta",{delta:w.delta.content,snapshot:X.message.content,parsed:X.message.parsed});if(w.delta.refusal!=null&&X.message?.role==="assistant"&&X.message?.refusal)this._emit("refusal.delta",{delta:w.delta.refusal,snapshot:X.message.refusal});if(w.logprobs?.content!=null&&X.message?.role==="assistant")this._emit("logprobs.content.delta",{content:w.logprobs?.content,snapshot:X.logprobs?.content??[]});if(w.logprobs?.refusal!=null&&X.message?.role==="assistant")this._emit("logprobs.refusal.delta",{refusal:w.logprobs?.refusal,snapshot:X.logprobs?.refusal??[]});let U=v(this,j4,"m",NG).call(this,X);if(X.finish_reason){if(v(this,j4,"m",cF).call(this,X),U.current_tool_call_index!=null)v(this,j4,"m",mF).call(this,X,U.current_tool_call_index)}for(let Y of w.delta.tool_calls??[]){if(U.current_tool_call_index!==Y.index){if(v(this,j4,"m",cF).call(this,X),U.current_tool_call_index!=null)v(this,j4,"m",mF).call(this,X,U.current_tool_call_index)}U.current_tool_call_index=Y.index}for(let Y of w.delta.tool_calls??[]){let G=X.message.tool_calls?.[Y.index];if(!G?.type)continue;if(G?.type==="function")this._emit("tool_calls.function.arguments.delta",{name:G.function?.name,index:Y.index,arguments:G.function.arguments,parsed_arguments:G.function.parsed_arguments,arguments_delta:Y.function?.arguments??""});else $E(G?.type)}}},mF=function $(T,W){if(v(this,j4,"m",NG).call(this,T).done_tool_calls.has(W))return;let X=T.message.tool_calls?.[W];if(!X)throw new Error("no tool call snapshot");if(!X.type)throw new Error("tool call snapshot missing `type`");if(X.type==="function"){let U=v(this,L0,"f")?.tools?.find((Y)=>Y.type==="function"&&Y.function.name===X.function.name);this._emit("tool_calls.function.arguments.done",{name:X.function.name,index:W,arguments:X.function.arguments,parsed_arguments:sT(U)?U.$parseRaw(X.function.arguments):U?.function.strict?JSON.parse(X.function.arguments):null})}else $E(X.type)},cF=function $(T){let W=v(this,j4,"m",NG).call(this,T);if(T.message.content&&!W.content_done){W.content_done=!0;let w=v(this,j4,"m",uF).call(this);this._emit("content.done",{content:T.message.content,parsed:w?w.$parseRaw(T.message.content):null})}if(T.message.refusal&&!W.refusal_done)W.refusal_done=!0,this._emit("refusal.done",{refusal:T.message.refusal});if(T.logprobs?.content&&!W.logprobs_content_done)W.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:T.logprobs.content});if(T.logprobs?.refusal&&!W.logprobs_refusal_done)W.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:T.logprobs.refusal})},LG=function $(){if(this.ended)throw new $$("stream has ended, this shouldn't happen");let T=v(this,HT,"f");if(!T)throw new $$("request ended without sending any chunks");return w$(this,HT,void 0,"f"),w$(this,w2,[],"f"),Tj(T,v(this,L0,"f"))},uF=function $(){let T=v(this,L0,"f")?.response_format;if(y8(T))return T;return null},sA=function $(T){var W,w,X,U;let Y=v(this,HT,"f"),{choices:G,...H}=T;if(!Y)Y=w$(this,HT,{...H,choices:[]},"f");else Object.assign(Y,H);for(let{delta:z,finish_reason:F,index:O,logprobs:Q=null,...Z}of T.choices){let K=Y.choices[O];if(!K)K=Y.choices[O]={finish_reason:F,index:O,message:{},logprobs:Q,...Z};if(Q)if(!K.logprobs)K.logprobs=Object.assign({},Q);else{let{content:x,refusal:b,...g}=Q;if(eA(g),Object.assign(K.logprobs,g),x)(W=K.logprobs).content??(W.content=[]),K.logprobs.content.push(...x);if(b)(w=K.logprobs).refusal??(w.refusal=[]),K.logprobs.refusal.push(...b)}if(F){if(K.finish_reason=F,v(this,L0,"f")&&IF(v(this,L0,"f"))){if(F==="length")throw new k8;if(F==="content_filter")throw new v8}}if(Object.assign(K,Z),!z)continue;let{content:E,refusal:M,function_call:L,role:R,tool_calls:_,...S}=z;if(eA(S),Object.assign(K.message,S),M)K.message.refusal=(K.message.refusal||"")+M;if(R)K.message.role=R;if(L)if(!K.message.function_call)K.message.function_call=L;else{if(L.name)K.message.function_call.name=L.name;if(L.arguments)(X=K.message.function_call).arguments??(X.arguments=""),K.message.function_call.arguments+=L.arguments}if(E){if(K.message.content=(K.message.content||"")+E,!K.message.refusal&&v(this,j4,"m",uF).call(this))K.message.parsed=yF(K.message.content)}if(_){if(!K.message.tool_calls)K.message.tool_calls=[];for(let{index:x,id:b,type:g,function:T$,...N$}of _){let j=(U=K.message.tool_calls)[x]??(U[x]={});if(Object.assign(j,N$),b)j.id=b;if(g)j.type=g;if(T$)j.function??(j.function={name:T$.name??"",arguments:""});if(T$?.name)j.function.name=T$.name;if(T$?.arguments){if(j.function.arguments+=T$.arguments,lA(v(this,L0,"f"),j))j.function.parsed_arguments=yF(j.function.arguments)}}}}return Y},Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("chunk",(w)=>{let X=T.shift();if(X)X.resolve(w);else $.push(w)}),this.on("end",()=>{W=!0;for(let w of T)w.resolve(void 0);T.length=0}),this.on("abort",(w)=>{W=!0;for(let X of T)X.reject(w);T.length=0}),this.on("error",(w)=>{W=!0;for(let X of T)X.reject(w);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((X,U)=>T.push({resolve:X,reject:U})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new T1(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function Tj($,T){let{id:W,choices:w,created:X,model:U,system_fingerprint:Y,...G}=$,H={...G,id:W,choices:w.map(({message:z,finish_reason:F,index:O,logprobs:Q,...Z})=>{if(!F)throw new $$(`missing finish_reason for choice ${O}`);let{content:K=null,function_call:E,tool_calls:M,...L}=z,R=z.role;if(!R)throw new $$(`missing role for choice ${O}`);if(E){let{arguments:_,name:S}=E;if(_==null)throw new $$(`missing function_call.arguments for choice ${O}`);if(!S)throw new $$(`missing function_call.name for choice ${O}`);return{...Z,message:{content:K,function_call:{arguments:_,name:S},role:R,refusal:z.refusal??null},finish_reason:F,index:O,logprobs:Q}}if(M)return{...Z,index:O,finish_reason:F,logprobs:Q,message:{...L,role:R,content:K,refusal:z.refusal??null,tool_calls:M.map((_,S)=>{let{function:x,type:b,id:g,...T$}=_,{arguments:N$,name:j,...U$}=x||{};if(g==null)throw new $$(`missing choices[${O}].tool_calls[${S}].id
|
|
69
|
+
${JG($)}`);if(b==null)throw new $$(`missing choices[${O}].tool_calls[${S}].type
|
|
70
|
+
${JG($)}`);if(j==null)throw new $$(`missing choices[${O}].tool_calls[${S}].function.name
|
|
71
|
+
${JG($)}`);if(N$==null)throw new $$(`missing choices[${O}].tool_calls[${S}].function.arguments
|
|
72
|
+
${JG($)}`);return{...T$,id:g,type:b,function:{...U$,name:j,arguments:N$}}})}};return{...Z,message:{...L,content:K,role:R,refusal:z.refusal??null},finish_reason:F,index:O,logprobs:Q}}),created:X,model:U,object:"chat.completion",...Y?{system_fingerprint:Y}:{}};return oA(H,T)}function JG($){return JSON.stringify($)}function eA($){return}function $E($){}class U2 extends FT{static fromReadableStream($){let T=new U2(null);return T._run(()=>T._fromReadableStream($)),T}static runTools($,T,W){let w=new U2(T),X={...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"runTools"}};return w._run(()=>w._runTools($,T,X)),w}}class OT extends m{constructor(){super(...arguments);this.messages=new T2(this._client)}create($,T){return this._client.post("/chat/completions",{body:$,...T,stream:$.stream??!1})}retrieve($,T){return this._client.get(h`/chat/completions/${$}`,T)}update($,T,W){return this._client.post(h`/chat/completions/${$}`,{body:T,...W})}list($={},T){return this._client.getAPIList("/chat/completions",J$,{query:$,...T})}delete($,T){return this._client.delete(h`/chat/completions/${$}`,T)}parse($,T){return rA($.tools),this._client.chat.completions.create($,{...T,headers:{...T?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((W)=>h8(W,$))}runTools($,T){if($.stream)return U2.runTools(this._client,$,T);return m8.runTools(this._client,$,T)}stream($,T){return FT.createChatCompletion(this._client,$,T)}}OT.Messages=T2;class eT extends m{constructor(){super(...arguments);this.completions=new OT(this._client)}}eT.Completions=OT;var WE=Symbol("brand.privateNullableHeaders"),TE=Array.isArray;function*Xj($){if(!$)return;if(WE in $){let{values:w,nulls:X}=$;yield*w.entries();for(let U of X)yield[U,null];return}let T=!1,W;if($ instanceof Headers)W=$.entries();else if(TE($))W=$;else T=!0,W=Object.entries($??{});for(let w of W){let X=w[0];if(typeof X!=="string")throw new TypeError("expected header name to be a string");let U=TE(w[1])?w[1]:[w[1]],Y=!1;for(let G of U){if(G===void 0)continue;if(T&&!Y)Y=!0,yield[X,null];yield[X,G]}}}var a=($)=>{let T=new Headers,W=new Set;for(let w of $){let X=new Set;for(let[U,Y]of Xj(w)){let G=U.toLowerCase();if(!X.has(G))T.delete(U),X.add(G);if(Y===null)T.delete(U),W.add(G);else T.append(U,Y),W.delete(G)}}return{[WE]:!0,values:T,nulls:W}};class c8 extends m{create($,T){return this._client.post("/audio/speech",{body:$,...T,headers:a([{Accept:"application/octet-stream"},T?.headers]),__binaryResponse:!0})}}class u8 extends m{create($,T){return this._client.post("/audio/transcriptions",W1({body:$,...T,stream:$.stream??!1,__metadata:{model:$.model}},this._client))}}class p8 extends m{create($,T){return this._client.post("/audio/translations",W1({body:$,...T,__metadata:{model:$.model}},this._client))}}class J0 extends m{constructor(){super(...arguments);this.transcriptions=new u8(this._client),this.translations=new p8(this._client),this.speech=new c8(this._client)}}J0.Transcriptions=u8;J0.Translations=p8;J0.Speech=c8;class Y2 extends m{create($,T){return this._client.post("/batches",{body:$,...T})}retrieve($,T){return this._client.get(h`/batches/${$}`,T)}list($={},T){return this._client.getAPIList("/batches",J$,{query:$,...T})}cancel($,T){return this._client.post(h`/batches/${$}/cancel`,T)}}class d8 extends m{create($,T){return this._client.post("/assistants",{body:$,...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/assistants/${$}`,{...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/assistants/${$}`,{body:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($={},T){return this._client.getAPIList("/assistants",J$,{query:$,...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}delete($,T){return this._client.delete(h`/assistants/${$}`,{...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class o8 extends m{create($,T){return this._client.post("/realtime/sessions",{body:$,...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class l8 extends m{create($,T){return this._client.post("/realtime/transcription_sessions",{body:$,...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}}class $W extends m{constructor(){super(...arguments);this.sessions=new o8(this._client),this.transcriptionSessions=new l8(this._client)}}$W.Sessions=o8;$W.TranscriptionSessions=l8;class r8 extends m{create($,T,W){return this._client.post(h`/threads/${$}/messages`,{body:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{thread_id:w}=T;return this._client.get(h`/threads/${w}/messages/${$}`,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{thread_id:w,...X}=T;return this._client.post(h`/threads/${w}/messages/${$}`,{body:X,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/threads/${$}/messages`,J$,{query:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T,W){let{thread_id:w}=T;return this._client.delete(h`/threads/${w}/messages/${$}`,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}class n8 extends m{retrieve($,T,W){let{thread_id:w,run_id:X,...U}=T;return this._client.get(h`/threads/${w}/runs/${X}/steps/${$}`,{query:U,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T,W){let{thread_id:w,...X}=T;return this._client.getAPIList(h`/threads/${w}/runs/${$}/steps`,J$,{query:X,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}var XE=($)=>{if(typeof Buffer!=="undefined"){let T=Buffer.from($,"base64");return Array.from(new Float32Array(T.buffer,T.byteOffset,T.length/Float32Array.BYTES_PER_ELEMENT))}else{let T=atob($),W=T.length,w=new Uint8Array(W);for(let X=0;X<W;X++)w[X]=T.charCodeAt(X);return Array.from(new Float32Array(w.buffer))}};var TW=($)=>{if(typeof globalThis.process!=="undefined")return globalThis.process.env?.[$]?.trim()??void 0;if(typeof globalThis.Deno!=="undefined")return globalThis.Deno.env?.get?.($)?.trim();return};var o4,XW,pF,i1,RG,S1,wW,G2,WW,vG,X1,_G,kG,a8,i8,t8,wE,UE,YE,GE,zE,HE,FE;class QT extends aT{constructor(){super(...arguments);o4.add(this),pF.set(this,[]),i1.set(this,{}),RG.set(this,{}),S1.set(this,void 0),wW.set(this,void 0),G2.set(this,void 0),WW.set(this,void 0),vG.set(this,void 0),X1.set(this,void 0),_G.set(this,void 0),kG.set(this,void 0),a8.set(this,void 0)}[(pF=new WeakMap,i1=new WeakMap,RG=new WeakMap,S1=new WeakMap,wW=new WeakMap,G2=new WeakMap,WW=new WeakMap,vG=new WeakMap,X1=new WeakMap,_G=new WeakMap,kG=new WeakMap,a8=new WeakMap,o4=new WeakSet,Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("event",(w)=>{let X=T.shift();if(X)X.resolve(w);else $.push(w)}),this.on("end",()=>{W=!0;for(let w of T)w.resolve(void 0);T.length=0}),this.on("abort",(w)=>{W=!0;for(let X of T)X.reject(w);T.length=0}),this.on("error",(w)=>{W=!0;for(let X of T)X.reject(w);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((X,U)=>T.push({resolve:X,reject:U})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}static fromReadableStream($){let T=new XW;return T._run(()=>T._fromReadableStream($)),T}async _fromReadableStream($,T){let W=T?.signal;if(W){if(W.aborted)this.controller.abort();W.addEventListener("abort",()=>this.controller.abort())}this._connected();let w=T1.fromReadableStream($,this.controller);for await(let X of w)v(this,o4,"m",i8).call(this,X);if(w.controller.signal?.aborted)throw new P4;return this._addRun(v(this,o4,"m",t8).call(this))}toReadableStream(){return new T1(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream($,T,W,w){let X=new XW;return X._run(()=>X._runToolAssistantStream($,T,W,{...w,headers:{...w?.headers,"X-Stainless-Helper-Method":"stream"}})),X}async _createToolAssistantStream($,T,W,w){let X=w?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let U={...W,stream:!0},Y=await $.submitToolOutputs(T,U,{...w,signal:this.controller.signal});this._connected();for await(let G of Y)v(this,o4,"m",i8).call(this,G);if(Y.controller.signal?.aborted)throw new P4;return this._addRun(v(this,o4,"m",t8).call(this))}static createThreadAssistantStream($,T,W){let w=new XW;return w._run(()=>w._threadAssistantStream($,T,{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),w}static createAssistantStream($,T,W,w){let X=new XW;return X._run(()=>X._runAssistantStream($,T,W,{...w,headers:{...w?.headers,"X-Stainless-Helper-Method":"stream"}})),X}currentEvent(){return v(this,_G,"f")}currentRun(){return v(this,kG,"f")}currentMessageSnapshot(){return v(this,S1,"f")}currentRunStepSnapshot(){return v(this,a8,"f")}async finalRunSteps(){return await this.done(),Object.values(v(this,i1,"f"))}async finalMessages(){return await this.done(),Object.values(v(this,RG,"f"))}async finalRun(){if(await this.done(),!v(this,wW,"f"))throw Error("Final run was not received.");return v(this,wW,"f")}async _createThreadAssistantStream($,T,W){let w=W?.signal;if(w){if(w.aborted)this.controller.abort();w.addEventListener("abort",()=>this.controller.abort())}let X={...T,stream:!0},U=await $.createAndRun(X,{...W,signal:this.controller.signal});this._connected();for await(let Y of U)v(this,o4,"m",i8).call(this,Y);if(U.controller.signal?.aborted)throw new P4;return this._addRun(v(this,o4,"m",t8).call(this))}async _createAssistantStream($,T,W,w){let X=w?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let U={...W,stream:!0},Y=await $.create(T,U,{...w,signal:this.controller.signal});this._connected();for await(let G of Y)v(this,o4,"m",i8).call(this,G);if(Y.controller.signal?.aborted)throw new P4;return this._addRun(v(this,o4,"m",t8).call(this))}static accumulateDelta($,T){for(let[W,w]of Object.entries(T)){if(!$.hasOwnProperty(W)){$[W]=w;continue}let X=$[W];if(X===null||X===void 0){$[W]=w;continue}if(W==="index"||W==="type"){$[W]=w;continue}if(typeof X==="string"&&typeof w==="string")X+=w;else if(typeof X==="number"&&typeof w==="number")X+=w;else if(q8(X)&&q8(w))X=this.accumulateDelta(X,w);else if(Array.isArray(X)&&Array.isArray(w)){if(X.every((U)=>typeof U==="string"||typeof U==="number")){X.push(...w);continue}for(let U of w){if(!q8(U))throw new Error(`Expected array delta entry to be an object but got: ${U}`);let Y=U.index;if(Y==null)throw console.error(U),new Error("Expected array delta entry to have an `index` property");if(typeof Y!=="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${Y}`);let G=X[Y];if(G==null)X.push(U);else X[Y]=this.accumulateDelta(G,U)}continue}else throw Error(`Unhandled record type: ${W}, deltaValue: ${w}, accValue: ${X}`);$[W]=X}return $}_addRun($){return $}async _threadAssistantStream($,T,W){return await this._createThreadAssistantStream(T,$,W)}async _runAssistantStream($,T,W,w){return await this._createAssistantStream(T,$,W,w)}async _runToolAssistantStream($,T,W,w){return await this._createToolAssistantStream(T,$,W,w)}}XW=QT,i8=function $(T){if(this.ended)return;switch(w$(this,_G,T,"f"),v(this,o4,"m",YE).call(this,T),T.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":v(this,o4,"m",FE).call(this,T);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":v(this,o4,"m",UE).call(this,T);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":v(this,o4,"m",wE).call(this,T);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:Zj(T)}},t8=function $(){if(this.ended)throw new $$("stream has ended, this shouldn't happen");if(!v(this,wW,"f"))throw Error("Final run has not been received");return v(this,wW,"f")},wE=function $(T){let[W,w]=v(this,o4,"m",zE).call(this,T,v(this,S1,"f"));w$(this,S1,W,"f"),v(this,RG,"f")[W.id]=W;for(let X of w){let U=W.content[X.index];if(U?.type=="text")this._emit("textCreated",U.text)}switch(T.event){case"thread.message.created":this._emit("messageCreated",T.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",T.data.delta,W),T.data.delta.content)for(let X of T.data.delta.content){if(X.type=="text"&&X.text){let U=X.text,Y=W.content[X.index];if(Y&&Y.type=="text")this._emit("textDelta",U,Y.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(X.index!=v(this,G2,"f")){if(v(this,WW,"f"))switch(v(this,WW,"f").type){case"text":this._emit("textDone",v(this,WW,"f").text,v(this,S1,"f"));break;case"image_file":this._emit("imageFileDone",v(this,WW,"f").image_file,v(this,S1,"f"));break}w$(this,G2,X.index,"f")}w$(this,WW,W.content[X.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(v(this,G2,"f")!==void 0){let X=T.data.content[v(this,G2,"f")];if(X)switch(X.type){case"image_file":this._emit("imageFileDone",X.image_file,v(this,S1,"f"));break;case"text":this._emit("textDone",X.text,v(this,S1,"f"));break}}if(v(this,S1,"f"))this._emit("messageDone",T.data);w$(this,S1,void 0,"f")}},UE=function $(T){let W=v(this,o4,"m",GE).call(this,T);switch(w$(this,a8,W,"f"),T.event){case"thread.run.step.created":this._emit("runStepCreated",T.data);break;case"thread.run.step.delta":let w=T.data.delta;if(w.step_details&&w.step_details.type=="tool_calls"&&w.step_details.tool_calls&&W.step_details.type=="tool_calls")for(let U of w.step_details.tool_calls)if(U.index==v(this,vG,"f"))this._emit("toolCallDelta",U,W.step_details.tool_calls[U.index]);else{if(v(this,X1,"f"))this._emit("toolCallDone",v(this,X1,"f"));if(w$(this,vG,U.index,"f"),w$(this,X1,W.step_details.tool_calls[U.index],"f"),v(this,X1,"f"))this._emit("toolCallCreated",v(this,X1,"f"))}this._emit("runStepDelta",T.data.delta,W);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(w$(this,a8,void 0,"f"),T.data.step_details.type=="tool_calls"){if(v(this,X1,"f"))this._emit("toolCallDone",v(this,X1,"f")),w$(this,X1,void 0,"f")}this._emit("runStepDone",T.data,W);break;case"thread.run.step.in_progress":break}},YE=function $(T){v(this,pF,"f").push(T),this._emit("event",T)},GE=function $(T){switch(T.event){case"thread.run.step.created":return v(this,i1,"f")[T.data.id]=T.data,T.data;case"thread.run.step.delta":let W=v(this,i1,"f")[T.data.id];if(!W)throw Error("Received a RunStepDelta before creation of a snapshot");let w=T.data;if(w.delta){let X=XW.accumulateDelta(W,w.delta);v(this,i1,"f")[T.data.id]=X}return v(this,i1,"f")[T.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":v(this,i1,"f")[T.data.id]=T.data;break}if(v(this,i1,"f")[T.data.id])return v(this,i1,"f")[T.data.id];throw new Error("No snapshot available")},zE=function $(T,W){let w=[];switch(T.event){case"thread.message.created":return[T.data,w];case"thread.message.delta":if(!W)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let X=T.data;if(X.delta.content)for(let U of X.delta.content)if(U.index in W.content){let Y=W.content[U.index];W.content[U.index]=v(this,o4,"m",HE).call(this,U,Y)}else W.content[U.index]=U,w.push(U);return[W,w];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(W)return[W,w];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},HE=function $(T,W){return XW.accumulateDelta(W,T)},FE=function $(T){switch(w$(this,kG,T.data,"f"),T.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":if(w$(this,wW,T.data,"f"),v(this,X1,"f"))this._emit("toolCallDone",v(this,X1,"f")),w$(this,X1,void 0,"f");break;case"thread.run.cancelling":break}};function Zj($){}class z2 extends m{constructor(){super(...arguments);this.steps=new n8(this._client)}create($,T,W){let{include:w,...X}=T;return this._client.post(h`/threads/${$}/runs`,{query:{include:w},body:X,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers]),stream:T.stream??!1})}retrieve($,T,W){let{thread_id:w}=T;return this._client.get(h`/threads/${w}/runs/${$}`,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{thread_id:w,...X}=T;return this._client.post(h`/threads/${w}/runs/${$}`,{body:X,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/threads/${$}/runs`,J$,{query:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}cancel($,T,W){let{thread_id:w}=T;return this._client.post(h`/threads/${w}/runs/${$}/cancel`,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let w=await this.create($,T,W);return await this.poll(w.id,{thread_id:$},W)}createAndStream($,T,W){return QT.createAssistantStream($,this._client.beta.threads.runs,T,W)}async poll($,T,W){let w=a([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:X,response:U}=await this.retrieve($,T,{...W,headers:{...W?.headers,...w}}).withResponse();switch(X.status){case"queued":case"in_progress":case"cancelling":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=U.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await l1(Y);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return X}}}stream($,T,W){return QT.createAssistantStream($,this._client.beta.threads.runs,T,W)}submitToolOutputs($,T,W){let{thread_id:w,...X}=T;return this._client.post(h`/threads/${w}/runs/${$}/submit_tool_outputs`,{body:X,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers]),stream:T.stream??!1})}async submitToolOutputsAndPoll($,T,W){let w=await this.submitToolOutputs($,T,W);return await this.poll(w.id,T,W)}submitToolOutputsStream($,T,W){return QT.createToolAssistantStream($,this._client.beta.threads.runs,T,W)}}z2.Steps=n8;class UW extends m{constructor(){super(...arguments);this.runs=new z2(this._client),this.messages=new r8(this._client)}create($={},T){return this._client.post("/threads",{body:$,...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/threads/${$}`,{...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/threads/${$}`,{body:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T){return this._client.delete(h`/threads/${$}`,{...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}createAndRun($,T){return this._client.post("/threads/runs",{body:$,...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers]),stream:$.stream??!1})}async createAndRunPoll($,T){let W=await this.createAndRun($,T);return await this.runs.poll(W.id,{thread_id:W.thread_id},T)}createAndRunStream($,T){return QT.createThreadAssistantStream($,this._client.beta.threads,T)}}UW.Runs=z2;UW.Messages=r8;class R0 extends m{constructor(){super(...arguments);this.realtime=new $W(this._client),this.assistants=new d8(this._client),this.threads=new UW(this._client)}}R0.Realtime=$W;R0.Assistants=d8;R0.Threads=UW;class H2 extends m{create($,T){return this._client.post("/completions",{body:$,...T,stream:$.stream??!1})}}class s8 extends m{retrieve($,T,W){let{container_id:w}=T;return this._client.get(h`/containers/${w}/files/${$}/content`,{...W,headers:a([{Accept:"application/binary"},W?.headers]),__binaryResponse:!0})}}class F2 extends m{constructor(){super(...arguments);this.content=new s8(this._client)}create($,T,W){return this._client.post(h`/containers/${$}/files`,W1({body:T,...W},this._client))}retrieve($,T,W){let{container_id:w}=T;return this._client.get(h`/containers/${w}/files/${$}`,W)}list($,T={},W){return this._client.getAPIList(h`/containers/${$}/files`,J$,{query:T,...W})}delete($,T,W){let{container_id:w}=T;return this._client.delete(h`/containers/${w}/files/${$}`,{...W,headers:a([{Accept:"*/*"},W?.headers])})}}F2.Content=s8;class YW extends m{constructor(){super(...arguments);this.files=new F2(this._client)}create($,T){return this._client.post("/containers",{body:$,...T})}retrieve($,T){return this._client.get(h`/containers/${$}`,T)}list($={},T){return this._client.getAPIList("/containers",J$,{query:$,...T})}delete($,T){return this._client.delete(h`/containers/${$}`,{...T,headers:a([{Accept:"*/*"},T?.headers])})}}YW.Files=F2;class O2 extends m{create($,T){let W=!!$.encoding_format,w=W?$.encoding_format:"base64";if(W)C4(this._client).debug("embeddings/user defined encoding_format:",$.encoding_format);let X=this._client.post("/embeddings",{body:{...$,encoding_format:w},...T});if(W)return X;return C4(this._client).debug("embeddings/decoding base64 embeddings from base64"),X._thenUnwrap((U)=>{if(U&&U.data)U.data.forEach((Y)=>{let G=Y.embedding;Y.embedding=XE(G)});return U})}}class e8 extends m{retrieve($,T,W){let{eval_id:w,run_id:X}=T;return this._client.get(h`/evals/${w}/runs/${X}/output_items/${$}`,W)}list($,T,W){let{eval_id:w,...X}=T;return this._client.getAPIList(h`/evals/${w}/runs/${$}/output_items`,J$,{query:X,...W})}}class Q2 extends m{constructor(){super(...arguments);this.outputItems=new e8(this._client)}create($,T,W){return this._client.post(h`/evals/${$}/runs`,{body:T,...W})}retrieve($,T,W){let{eval_id:w}=T;return this._client.get(h`/evals/${w}/runs/${$}`,W)}list($,T={},W){return this._client.getAPIList(h`/evals/${$}/runs`,J$,{query:T,...W})}delete($,T,W){let{eval_id:w}=T;return this._client.delete(h`/evals/${w}/runs/${$}`,W)}cancel($,T,W){let{eval_id:w}=T;return this._client.post(h`/evals/${w}/runs/${$}`,W)}}Q2.OutputItems=e8;class GW extends m{constructor(){super(...arguments);this.runs=new Q2(this._client)}create($,T){return this._client.post("/evals",{body:$,...T})}retrieve($,T){return this._client.get(h`/evals/${$}`,T)}update($,T,W){return this._client.post(h`/evals/${$}`,{body:T,...W})}list($={},T){return this._client.getAPIList("/evals",J$,{query:$,...T})}delete($,T){return this._client.delete(h`/evals/${$}`,T)}}GW.Runs=Q2;class Z2 extends m{create($,T){return this._client.post("/files",W1({body:$,...T},this._client))}retrieve($,T){return this._client.get(h`/files/${$}`,T)}list($={},T){return this._client.getAPIList("/files",J$,{query:$,...T})}delete($,T){return this._client.delete(h`/files/${$}`,T)}content($,T){return this._client.get(h`/files/${$}/content`,{...T,headers:a([{Accept:"application/binary"},T?.headers]),__binaryResponse:!0})}async waitForProcessing($,{pollInterval:T=5000,maxWait:W=1800000}={}){let w=new Set(["processed","error","deleted"]),X=Date.now(),U=await this.retrieve($);while(!U.status||!w.has(U.status))if(await l1(T),U=await this.retrieve($),Date.now()-X>W)throw new iT({message:`Giving up on waiting for file ${$} to finish processing after ${W} milliseconds.`});return U}}class $w extends m{}class Tw extends m{run($,T){return this._client.post("/fine_tuning/alpha/graders/run",{body:$,...T})}validate($,T){return this._client.post("/fine_tuning/alpha/graders/validate",{body:$,...T})}}class V2 extends m{constructor(){super(...arguments);this.graders=new Tw(this._client)}}V2.Graders=Tw;class Ww extends m{create($,T,W){return this._client.getAPIList(h`/fine_tuning/checkpoints/${$}/permissions`,D0,{body:T,method:"post",...W})}retrieve($,T={},W){return this._client.get(h`/fine_tuning/checkpoints/${$}/permissions`,{query:T,...W})}delete($,T,W){let{fine_tuned_model_checkpoint:w}=T;return this._client.delete(h`/fine_tuning/checkpoints/${w}/permissions/${$}`,W)}}class K2 extends m{constructor(){super(...arguments);this.permissions=new Ww(this._client)}}K2.Permissions=Ww;class Xw extends m{list($,T={},W){return this._client.getAPIList(h`/fine_tuning/jobs/${$}/checkpoints`,J$,{query:T,...W})}}class A2 extends m{constructor(){super(...arguments);this.checkpoints=new Xw(this._client)}create($,T){return this._client.post("/fine_tuning/jobs",{body:$,...T})}retrieve($,T){return this._client.get(h`/fine_tuning/jobs/${$}`,T)}list($={},T){return this._client.getAPIList("/fine_tuning/jobs",J$,{query:$,...T})}cancel($,T){return this._client.post(h`/fine_tuning/jobs/${$}/cancel`,T)}listEvents($,T={},W){return this._client.getAPIList(h`/fine_tuning/jobs/${$}/events`,J$,{query:T,...W})}pause($,T){return this._client.post(h`/fine_tuning/jobs/${$}/pause`,T)}resume($,T){return this._client.post(h`/fine_tuning/jobs/${$}/resume`,T)}}A2.Checkpoints=Xw;class t1 extends m{constructor(){super(...arguments);this.methods=new $w(this._client),this.jobs=new A2(this._client),this.checkpoints=new K2(this._client),this.alpha=new V2(this._client)}}t1.Methods=$w;t1.Jobs=A2;t1.Checkpoints=K2;t1.Alpha=V2;class ww extends m{}class zW extends m{constructor(){super(...arguments);this.graderModels=new ww(this._client)}}zW.GraderModels=ww;class E2 extends m{createVariation($,T){return this._client.post("/images/variations",W1({body:$,...T},this._client))}edit($,T){return this._client.post("/images/edits",W1({body:$,...T},this._client))}generate($,T){return this._client.post("/images/generations",{body:$,...T})}}class M2 extends m{retrieve($,T){return this._client.get(h`/models/${$}`,T)}list($){return this._client.getAPIList("/models",D0,$)}delete($,T){return this._client.delete(h`/models/${$}`,T)}}class D2 extends m{create($,T){return this._client.post("/moderations",{body:$,...T})}}function OE($,T){if(!T||!Cj(T))return{...$,output_parsed:null,output:$.output.map((W)=>{if(W.type==="function_call")return{...W,parsed_arguments:null};if(W.type==="message")return{...W,content:W.content.map((w)=>({...w,parsed:null}))};else return W})};return dF($,T)}function dF($,T){let W=$.output.map((X)=>{if(X.type==="function_call")return{...X,parsed_arguments:Ij(T,X)};if(X.type==="message"){let U=X.content.map((Y)=>{if(Y.type==="output_text")return{...Y,parsed:Pj(T,Y.text)};return Y});return{...X,content:U}}return X}),w=Object.assign({},$,{output:W});if(!Object.getOwnPropertyDescriptor($,"output_text"))oF(w);return Object.defineProperty(w,"output_parsed",{enumerable:!0,get(){for(let X of w.output){if(X.type!=="message")continue;for(let U of X.content)if(U.type==="output_text"&&U.parsed!==null)return U.parsed}return null}}),w}function Pj($,T){if($.text?.format?.type!=="json_schema")return null;if("$parseRaw"in $.text?.format)return($.text?.format).$parseRaw(T);return JSON.parse(T)}function Cj($){if(y8($.text?.format))return!0;return!1}function Sj($){return $?.$brand==="auto-parseable-tool"}function jj($,T){return $.find((W)=>W.type==="function"&&W.name===T)}function Ij($,T){let W=jj($.tools??[],T.name);return{...T,...T,parsed_arguments:Sj(W)?W.$parseRaw(T.arguments):W?.strict?JSON.parse(T.arguments):null}}function oF($){let T=[];for(let W of $.output){if(W.type!=="message")continue;for(let w of W.content)if(w.type==="output_text")T.push(w.text)}$.output_text=T.join("")}var N2,qG,ZT,PG,QE,ZE,VE,KE;class CG extends aT{constructor($){super();N2.add(this),qG.set(this,void 0),ZT.set(this,void 0),PG.set(this,void 0),w$(this,qG,$,"f")}static createResponse($,T,W){let w=new CG(T);return w._run(()=>w._createOrRetrieveResponse($,T,{...W,headers:{...W?.headers,"X-Stainless-Helper-Method":"stream"}})),w}async _createOrRetrieveResponse($,T,W){let w=W?.signal;if(w){if(w.aborted)this.controller.abort();w.addEventListener("abort",()=>this.controller.abort())}v(this,N2,"m",QE).call(this);let X,U=null;if("response_id"in T)X=await $.responses.retrieve(T.response_id,{stream:!0},{...W,signal:this.controller.signal,stream:!0}),U=T.starting_after??null;else X=await $.responses.create({...T,stream:!0},{...W,signal:this.controller.signal});this._connected();for await(let Y of X)v(this,N2,"m",ZE).call(this,Y,U);if(X.controller.signal?.aborted)throw new P4;return v(this,N2,"m",VE).call(this)}[(qG=new WeakMap,ZT=new WeakMap,PG=new WeakMap,N2=new WeakSet,QE=function $(){if(this.ended)return;w$(this,ZT,void 0,"f")},ZE=function $(T,W){if(this.ended)return;let w=(U,Y)=>{if(W==null||Y.sequence_number>W)this._emit(U,Y)},X=v(this,N2,"m",KE).call(this,T);switch(w("event",T),T.type){case"response.output_text.delta":{let U=X.output[T.output_index];if(!U)throw new $$(`missing output at index ${T.output_index}`);if(U.type==="message"){let Y=U.content[T.content_index];if(!Y)throw new $$(`missing content at index ${T.content_index}`);if(Y.type!=="output_text")throw new $$(`expected content to be 'output_text', got ${Y.type}`);w("response.output_text.delta",{...T,snapshot:Y.text})}break}case"response.function_call_arguments.delta":{let U=X.output[T.output_index];if(!U)throw new $$(`missing output at index ${T.output_index}`);if(U.type==="function_call")w("response.function_call_arguments.delta",{...T,snapshot:U.arguments});break}default:w(T.type,T);break}},VE=function $(){if(this.ended)throw new $$("stream has ended, this shouldn't happen");let T=v(this,ZT,"f");if(!T)throw new $$("request ended without sending any events");w$(this,ZT,void 0,"f");let W=Bj(T,v(this,qG,"f"));return w$(this,PG,W,"f"),W},KE=function $(T){let W=v(this,ZT,"f");if(!W){if(T.type!=="response.created")throw new $$(`When snapshot hasn't been set yet, expected 'response.created' event, got ${T.type}`);return W=w$(this,ZT,T.response,"f"),W}switch(T.type){case"response.output_item.added":{W.output.push(T.item);break}case"response.content_part.added":{let w=W.output[T.output_index];if(!w)throw new $$(`missing output at index ${T.output_index}`);if(w.type==="message")w.content.push(T.part);break}case"response.output_text.delta":{let w=W.output[T.output_index];if(!w)throw new $$(`missing output at index ${T.output_index}`);if(w.type==="message"){let X=w.content[T.content_index];if(!X)throw new $$(`missing content at index ${T.content_index}`);if(X.type!=="output_text")throw new $$(`expected content to be 'output_text', got ${X.type}`);X.text+=T.delta}break}case"response.function_call_arguments.delta":{let w=W.output[T.output_index];if(!w)throw new $$(`missing output at index ${T.output_index}`);if(w.type==="function_call")w.arguments+=T.delta;break}case"response.completed":{w$(this,ZT,T.response,"f");break}}return W},Symbol.asyncIterator)](){let $=[],T=[],W=!1;return this.on("event",(w)=>{let X=T.shift();if(X)X.resolve(w);else $.push(w)}),this.on("end",()=>{W=!0;for(let w of T)w.resolve(void 0);T.length=0}),this.on("abort",(w)=>{W=!0;for(let X of T)X.reject(w);T.length=0}),this.on("error",(w)=>{W=!0;for(let X of T)X.reject(w);T.length=0}),{next:async()=>{if(!$.length){if(W)return{value:void 0,done:!0};return new Promise((X,U)=>T.push({resolve:X,reject:U})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}async finalResponse(){await this.done();let $=v(this,PG,"f");if(!$)throw new $$("stream ended without producing a ChatCompletion");return $}}function Bj($,T){return OE($,T)}class Uw extends m{list($,T={},W){return this._client.getAPIList(h`/responses/${$}/input_items`,J$,{query:T,...W})}}class HW extends m{constructor(){super(...arguments);this.inputItems=new Uw(this._client)}create($,T){return this._client.post("/responses",{body:$,...T,stream:$.stream??!1})._thenUnwrap((W)=>{if("object"in W&&W.object==="response")oF(W);return W})}retrieve($,T={},W){return this._client.get(h`/responses/${$}`,{query:T,...W,stream:T?.stream??!1})}delete($,T){return this._client.delete(h`/responses/${$}`,{...T,headers:a([{Accept:"*/*"},T?.headers])})}parse($,T){return this._client.responses.create($,T)._thenUnwrap((W)=>dF(W,$))}stream($,T){return CG.createResponse(this._client,$,T)}cancel($,T){return this._client.post(h`/responses/${$}/cancel`,{...T,headers:a([{Accept:"*/*"},T?.headers])})}}HW.InputItems=Uw;class Yw extends m{create($,T,W){return this._client.post(h`/uploads/${$}/parts`,W1({body:T,...W},this._client))}}class FW extends m{constructor(){super(...arguments);this.parts=new Yw(this._client)}create($,T){return this._client.post("/uploads",{body:$,...T})}cancel($,T){return this._client.post(h`/uploads/${$}/cancel`,T)}complete($,T,W){return this._client.post(h`/uploads/${$}/complete`,{body:T,...W})}}FW.Parts=Yw;var AE=async($)=>{let T=await Promise.allSettled($),W=T.filter((X)=>X.status==="rejected");if(W.length){for(let X of W)console.error(X.reason);throw new Error(`${W.length} promise(s) failed - see the above errors`)}let w=[];for(let X of T)if(X.status==="fulfilled")w.push(X.value);return w};class Gw extends m{create($,T,W){return this._client.post(h`/vector_stores/${$}/file_batches`,{body:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{vector_store_id:w}=T;return this._client.get(h`/vector_stores/${w}/file_batches/${$}`,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}cancel($,T,W){let{vector_store_id:w}=T;return this._client.post(h`/vector_stores/${w}/file_batches/${$}/cancel`,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let w=await this.create($,T);return await this.poll($,w.id,W)}listFiles($,T,W){let{vector_store_id:w,...X}=T;return this._client.getAPIList(h`/vector_stores/${w}/file_batches/${$}/files`,J$,{query:X,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async poll($,T,W){let w=a([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:X,response:U}=await this.retrieve(T,{vector_store_id:$},{...W,headers:w}).withResponse();switch(X.status){case"in_progress":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=U.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await l1(Y);break;case"failed":case"cancelled":case"completed":return X}}}async uploadAndPoll($,{files:T,fileIds:W=[]},w){if(T==null||T.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let X=w?.maxConcurrency??5,U=Math.min(X,T.length),Y=this._client,G=T.values(),H=[...W];async function z(O){for(let Q of O){let Z=await Y.files.create({file:Q,purpose:"assistants"},w);H.push(Z.id)}}let F=Array(U).fill(G).map(z);return await AE(F),await this.createAndPoll($,{file_ids:H})}}class zw extends m{create($,T,W){return this._client.post(h`/vector_stores/${$}/files`,{body:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}retrieve($,T,W){let{vector_store_id:w}=T;return this._client.get(h`/vector_stores/${w}/files/${$}`,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}update($,T,W){let{vector_store_id:w,...X}=T;return this._client.post(h`/vector_stores/${w}/files/${$}`,{body:X,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($,T={},W){return this._client.getAPIList(h`/vector_stores/${$}/files`,J$,{query:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}delete($,T,W){let{vector_store_id:w}=T;return this._client.delete(h`/vector_stores/${w}/files/${$}`,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}async createAndPoll($,T,W){let w=await this.create($,T,W);return await this.poll($,w.id,W)}async poll($,T,W){let w=a([W?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":W?.pollIntervalMs?.toString()??void 0}]);while(!0){let X=await this.retrieve(T,{vector_store_id:$},{...W,headers:w}).withResponse(),U=X.data;switch(U.status){case"in_progress":let Y=5000;if(W?.pollIntervalMs)Y=W.pollIntervalMs;else{let G=X.response.headers.get("openai-poll-after-ms");if(G){let H=parseInt(G);if(!isNaN(H))Y=H}}await l1(Y);break;case"failed":case"completed":return U}}}async upload($,T,W){let w=await this._client.files.create({file:T,purpose:"assistants"},W);return this.create($,{file_id:w.id},W)}async uploadAndPoll($,T,W){let w=await this.upload($,T,W);return await this.poll($,w.id,W)}content($,T,W){let{vector_store_id:w}=T;return this._client.getAPIList(h`/vector_stores/${w}/files/${$}/content`,D0,{...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}class VT extends m{constructor(){super(...arguments);this.files=new zw(this._client),this.fileBatches=new Gw(this._client)}create($,T){return this._client.post("/vector_stores",{body:$,...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}retrieve($,T){return this._client.get(h`/vector_stores/${$}`,{...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}update($,T,W){return this._client.post(h`/vector_stores/${$}`,{body:T,...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}list($={},T){return this._client.getAPIList("/vector_stores",J$,{query:$,...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}delete($,T){return this._client.delete(h`/vector_stores/${$}`,{...T,headers:a([{"OpenAI-Beta":"assistants=v2"},T?.headers])})}search($,T,W){return this._client.getAPIList(h`/vector_stores/${$}/search`,D0,{body:T,method:"post",...W,headers:a([{"OpenAI-Beta":"assistants=v2"},W?.headers])})}}VT.Files=zw;VT.FileBatches=Gw;var lF,SG;class R${constructor({baseURL:$=TW("OPENAI_BASE_URL"),apiKey:T=TW("OPENAI_API_KEY"),organization:W=TW("OPENAI_ORG_ID")??null,project:w=TW("OPENAI_PROJECT_ID")??null,...X}={}){if(SG.set(this,void 0),this.completions=new H2(this),this.chat=new eT(this),this.embeddings=new O2(this),this.files=new Z2(this),this.images=new E2(this),this.audio=new J0(this),this.moderations=new D2(this),this.models=new M2(this),this.fineTuning=new t1(this),this.graders=new zW(this),this.vectorStores=new VT(this),this.beta=new R0(this),this.batches=new Y2(this),this.uploads=new FW(this),this.responses=new HW(this),this.evals=new GW(this),this.containers=new YW(this),T===void 0)throw new $$("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let U={apiKey:T,organization:W,project:w,...X,baseURL:$||"https://api.openai.com/v1"};if(!U.dangerouslyAllowBrowser&&kA())throw new $$(`It looks like you're running in a browser-like environment.
|
|
71
73
|
|
|
72
74
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
73
75
|
If you understand the risks and have appropriate mitigations in place,
|
|
@@ -76,19 +78,19 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
|
76
78
|
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
77
79
|
|
|
78
80
|
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
79
|
-
`);
|
|
80
|
-
`)});return{model:$,messages:w}}var z$=1e6,vA={"gpt-4.1":{promptPricePerToken:2/z$,promptPricePerTokenCached:0.5/z$,completionPricePerToken:8/z$},"gpt-4.1-mini":{promptPricePerToken:0.4/z$,promptPricePerTokenCached:0.1/z$,completionPricePerToken:1.6/z$},"gpt-4.1-nano":{promptPricePerToken:0.1/z$,promptPricePerTokenCached:0.025/z$,completionPricePerToken:0.4/z$},"gpt-4o":{promptPricePerToken:2.5/z$,promptPricePerTokenCached:1.25/z$,completionPricePerToken:10/z$},"gpt-4o-mini":{promptPricePerToken:0.15/z$,promptPricePerTokenCached:0.075/z$,completionPricePerToken:0.6/z$},o1:{promptPricePerToken:15/z$,promptPricePerTokenCached:7.5/z$,completionPricePerToken:60/z$},"o1-mini":{promptPricePerToken:1.1/z$,promptPricePerTokenCached:0.55/z$,completionPricePerToken:4.4/z$},o3:{promptPricePerToken:10/z$,promptPricePerTokenCached:2.5/z$,completionPricePerToken:40/z$},"o3-mini":{promptPricePerToken:1.1/z$,promptPricePerTokenCached:0.55/z$,completionPricePerToken:4.4/z$},"o4-mini":{promptPricePerToken:1.1/z$,promptPricePerTokenCached:0.275/z$,completionPricePerToken:4.4/z$},"codex-mini-latest":{promptPricePerToken:1.5/z$,promptPricePerTokenCached:0.375/z$,completionPricePerToken:6/z$},"chatgpt-4o-latest":{promptPricePerToken:5/z$,promptPricePerTokenCached:5/z$,completionPricePerToken:15/z$},"gpt-4":{promptPricePerToken:30/z$,promptPricePerTokenCached:30/z$,completionPricePerToken:60/z$},"gpt-4-turbo":{promptPricePerToken:10/z$,promptPricePerTokenCached:10/z$,completionPricePerToken:30/z$},"gpt-3.5-turbo":{promptPricePerToken:0.5/z$,promptPricePerTokenCached:0.5/z$,completionPricePerToken:1.5/z$},"gpt-4-32k":{promptPricePerToken:60/z$,promptPricePerTokenCached:60/z$,completionPricePerToken:120/z$},"gpt-3.5-turbo-16k":{promptPricePerToken:3/z$,promptPricePerTokenCached:3/z$,completionPricePerToken:4/z$}};function wb($){let W=Object.keys(vA).filter((U)=>$.startsWith(U)).sort((U,X)=>X.length-U.length)[0];if(!W)return;return vA[W]}function Gb($){return async function T(W,U){if(!$)throw new Error("This is a bug in safegen. OpenAI client not available to the json generator.");let X=await $.chat.completions.create({...W,stream:!1,response_format:{type:"json_object"}},U),Y=X.choices[0].message?.content,{usage:w}=X;if(Y&&w){let G=w.prompt_tokens,H=w.prompt_tokens_details?.cached_tokens??0,z=G-H,F=w.completion_tokens,O=wb(W.model),Q=0;if(O)Q=G*O.promptPricePerToken+z*(O.promptPricePerTokenCached??0)+F*O.completionPricePerToken;else console.warn(`No pricing facts found for model ${W.model}. Giving a price of 0.`);return{data:JSON.parse(Y),usage:w,usdPrice:Q}}if(!Y&&!w)throw new Error("No content or usage found in completion");if(!Y)throw new Error("No content found in completion");throw new Error("No usage found in completion")}}var qA=new Map,PA=class{usdBudget;usdMinimum;getUnknownJsonFromOpenAi;getUnknownJsonFromOpenAiSquirreled;squirrel;client;lastUsage;constructor({model:$,usdBudget:T,usdMinimum:W,apiKey:U,cachingMode:X,cacheKey:Y="openai-safegen",logger:w}){this.usdBudget=T,this.usdMinimum=W,this.squirrel=new vE(X);let G=qA.get(U);if(X!=="read"){if(!G)G=new kA({apiKey:U,dangerouslyAllowBrowser:!1}),qA.set(U,G);this.client=G}this.getUnknownJsonFromOpenAi=Gb(this.client),this.getUnknownJsonFromOpenAiSquirreled=this.squirrel.add(Y,this.getUnknownJsonFromOpenAi),this.from=FE(async(...H)=>{if(this.usdBudget<this.usdMinimum)return w?.warn("SafeGen budget exhausted"),H[2];let z=Yb($,...H),F=H[0],O=H[3],{data:Q,usage:Z,usdPrice:V}=await this.getUnknownJsonFromOpenAiSquirreled.for(`${F.replace(/[^a-zA-Z0-9-_. ]/g,"_")}-${O.length}`).get(z);return this.lastUsage=Z,this.usdBudget-=V,Q},w)}from};import{exec as Wc}from"child_process";class K extends Array{constructor($,T){if(super($),this.sign=T,Object.setPrototypeOf(this,K.prototype),$>K.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt($){var T=Math.floor,W=Number.isFinite;if(typeof $=="number"){if($===0)return K.__zero();if(K.__isOneDigitInt($))return 0>$?K.__oneDigit(-$,!0):K.__oneDigit($,!1);if(!W($)||T($)!==$)throw new RangeError("The number "+$+" cannot be converted to BigInt because it is not an integer");return K.__fromDouble($)}if(typeof $=="string"){let U=K.__fromString($);if(U===null)throw new SyntaxError("Cannot convert "+$+" to a BigInt");return U}if(typeof $=="boolean")return $===!0?K.__oneDigit(1,!1):K.__zero();if(typeof $=="object"){if($.constructor===K)return $;let U=K.__toPrimitive($);return K.BigInt(U)}throw new TypeError("Cannot convert "+$+" to a BigInt")}toDebugString(){let $=["BigInt["];for(let T of this)$.push((T?(T>>>0).toString(16):T)+", ");return $.push("]"),$.join("")}toString($=10){if(2>$||36<$)throw new RangeError("toString() radix argument must be between 2 and 36");return this.length===0?"0":($&$-1)==0?K.__toStringBasePowerOfTwo(this,$):K.__toStringGeneric(this,$,!1)}valueOf(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}static toNumber($){let T=$.length;if(T===0)return 0;if(T===1){let E=$.__unsignedDigit(0);return $.sign?-E:E}let W=$.__digit(T-1),U=K.__clz30(W),X=30*T-U;if(1024<X)return $.sign?-1/0:1/0;let Y=X-1,w=W,G=T-1,H=U+3,z=H===32?0:w<<H;z>>>=12;let F=H-12,O=12<=H?0:w<<20+H,Q=20+H;for(0<F&&0<G&&(G--,w=$.__digit(G),z|=w>>>30-F,O=w<<F+2,Q=F+2);0<Q&&0<G;)G--,w=$.__digit(G),O|=30<=Q?w<<Q-30:w>>>30-Q,Q-=30;let Z=K.__decideRounding($,Q,G,w);if((Z===1||Z===0&&(1&O)==1)&&(O=O+1>>>0,O===0&&(z++,z>>>20!=0&&(z=0,Y++,1023<Y))))return $.sign?-1/0:1/0;let V=$.sign?-2147483648:0;return Y=Y+1023<<20,K.__kBitConversionInts[K.__kBitConversionIntHigh]=V|Y|z,K.__kBitConversionInts[K.__kBitConversionIntLow]=O,K.__kBitConversionDouble[0]}static unaryMinus($){if($.length===0)return $;let T=$.__copy();return T.sign=!$.sign,T}static bitwiseNot($){return $.sign?K.__absoluteSubOne($).__trim():K.__absoluteAddOne($,!0)}static exponentiate($,T){if(T.sign)throw new RangeError("Exponent must be positive");if(T.length===0)return K.__oneDigit(1,!1);if($.length===0)return $;if($.length===1&&$.__digit(0)===1)return $.sign&&(1&T.__digit(0))==0?K.unaryMinus($):$;if(1<T.length)throw new RangeError("BigInt too big");let W=T.__unsignedDigit(0);if(W===1)return $;if(W>=K.__kMaxLengthBits)throw new RangeError("BigInt too big");if($.length===1&&$.__digit(0)===2){let Y=1+(0|W/30),w=$.sign&&(1&W)!=0,G=new K(Y,w);G.__initializeDigits();let H=1<<W%30;return G.__setDigit(Y-1,H),G}let U=null,X=$;for((1&W)!=0&&(U=$),W>>=1;W!==0;W>>=1)X=K.multiply(X,X),(1&W)!=0&&(U===null?U=X:U=K.multiply(U,X));return U}static multiply($,T){if($.length===0)return $;if(T.length===0)return T;let W=$.length+T.length;30<=$.__clzmsd()+T.__clzmsd()&&W--;let U=new K(W,$.sign!==T.sign);U.__initializeDigits();for(let X=0;X<$.length;X++)K.__multiplyAccumulate(T,$.__digit(X),U,X);return U.__trim()}static divide($,T){if(T.length===0)throw new RangeError("Division by zero");if(0>K.__absoluteCompare($,T))return K.__zero();let W=$.sign!==T.sign,U=T.__unsignedDigit(0),X;if(T.length===1&&32767>=U){if(U===1)return W===$.sign?$:K.unaryMinus($);X=K.__absoluteDivSmall($,U,null)}else X=K.__absoluteDivLarge($,T,!0,!1);return X.sign=W,X.__trim()}static remainder($,T){if(T.length===0)throw new RangeError("Division by zero");if(0>K.__absoluteCompare($,T))return $;let W=T.__unsignedDigit(0);if(T.length===1&&32767>=W){if(W===1)return K.__zero();let X=K.__absoluteModSmall($,W);return X===0?K.__zero():K.__oneDigit(X,$.sign)}let U=K.__absoluteDivLarge($,T,!1,!0);return U.sign=$.sign,U.__trim()}static add($,T){let W=$.sign;return W===T.sign?K.__absoluteAdd($,T,W):0<=K.__absoluteCompare($,T)?K.__absoluteSub($,T,W):K.__absoluteSub(T,$,!W)}static subtract($,T){let W=$.sign;return W===T.sign?0<=K.__absoluteCompare($,T)?K.__absoluteSub($,T,W):K.__absoluteSub(T,$,!W):K.__absoluteAdd($,T,W)}static leftShift($,T){return T.length===0||$.length===0?$:T.sign?K.__rightShiftByAbsolute($,T):K.__leftShiftByAbsolute($,T)}static signedRightShift($,T){return T.length===0||$.length===0?$:T.sign?K.__leftShiftByAbsolute($,T):K.__rightShiftByAbsolute($,T)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan($,T){return 0>K.__compareToBigInt($,T)}static lessThanOrEqual($,T){return 0>=K.__compareToBigInt($,T)}static greaterThan($,T){return 0<K.__compareToBigInt($,T)}static greaterThanOrEqual($,T){return 0<=K.__compareToBigInt($,T)}static equal($,T){if($.sign!==T.sign)return!1;if($.length!==T.length)return!1;for(let W=0;W<$.length;W++)if($.__digit(W)!==T.__digit(W))return!1;return!0}static notEqual($,T){return!K.equal($,T)}static bitwiseAnd($,T){var W=Math.max;if(!$.sign&&!T.sign)return K.__absoluteAnd($,T).__trim();if($.sign&&T.sign){let U=W($.length,T.length)+1,X=K.__absoluteSubOne($,U),Y=K.__absoluteSubOne(T);return X=K.__absoluteOr(X,Y,X),K.__absoluteAddOne(X,!0,X).__trim()}return $.sign&&([$,T]=[T,$]),K.__absoluteAndNot($,K.__absoluteSubOne(T)).__trim()}static bitwiseXor($,T){var W=Math.max;if(!$.sign&&!T.sign)return K.__absoluteXor($,T).__trim();if($.sign&&T.sign){let Y=W($.length,T.length),w=K.__absoluteSubOne($,Y),G=K.__absoluteSubOne(T);return K.__absoluteXor(w,G,w).__trim()}let U=W($.length,T.length)+1;$.sign&&([$,T]=[T,$]);let X=K.__absoluteSubOne(T,U);return X=K.__absoluteXor(X,$,X),K.__absoluteAddOne(X,!0,X).__trim()}static bitwiseOr($,T){var W=Math.max;let U=W($.length,T.length);if(!$.sign&&!T.sign)return K.__absoluteOr($,T).__trim();if($.sign&&T.sign){let Y=K.__absoluteSubOne($,U),w=K.__absoluteSubOne(T);return Y=K.__absoluteAnd(Y,w,Y),K.__absoluteAddOne(Y,!0,Y).__trim()}$.sign&&([$,T]=[T,$]);let X=K.__absoluteSubOne(T,U);return X=K.__absoluteAndNot(X,$,X),K.__absoluteAddOne(X,!0,X).__trim()}static asIntN($,T){var W=Math.floor;if(T.length===0)return T;if($=W($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return K.__zero();if($>=K.__kMaxLengthBits)return T;let U=0|($+29)/30;if(T.length<U)return T;let X=T.__unsignedDigit(U-1),Y=1<<($-1)%30;if(T.length===U&&X<Y)return T;if((X&Y)!==Y)return K.__truncateToNBits($,T);if(!T.sign)return K.__truncateAndSubFromPowerOfTwo($,T,!0);if((X&Y-1)==0){for(let w=U-2;0<=w;w--)if(T.__digit(w)!==0)return K.__truncateAndSubFromPowerOfTwo($,T,!1);return T.length===U&&X===Y?T:K.__truncateToNBits($,T)}return K.__truncateAndSubFromPowerOfTwo($,T,!1)}static asUintN($,T){var W=Math.floor;if(T.length===0)return T;if($=W($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return K.__zero();if(T.sign){if($>K.__kMaxLengthBits)throw new RangeError("BigInt too big");return K.__truncateAndSubFromPowerOfTwo($,T,!1)}if($>=K.__kMaxLengthBits)return T;let U=0|($+29)/30;if(T.length<U)return T;let X=$%30;if(T.length==U){if(X===0)return T;if(T.__digit(U-1)>>>X==0)return T}return K.__truncateToNBits($,T)}static ADD($,T){if($=K.__toPrimitive($),T=K.__toPrimitive(T),typeof $=="string")return typeof T!="string"&&(T=T.toString()),$+T;if(typeof T=="string")return $.toString()+T;if($=K.__toNumeric($),T=K.__toNumeric(T),K.__isBigInt($)&&K.__isBigInt(T))return K.add($,T);if(typeof $=="number"&&typeof T=="number")return $+T;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT($,T){return K.__compare($,T,0)}static LE($,T){return K.__compare($,T,1)}static GT($,T){return K.__compare($,T,2)}static GE($,T){return K.__compare($,T,3)}static EQ($,T){for(;;){if(K.__isBigInt($))return K.__isBigInt(T)?K.equal($,T):K.EQ(T,$);if(typeof $=="number"){if(K.__isBigInt(T))return K.__equalToNumber(T,$);if(typeof T!="object")return $==T;T=K.__toPrimitive(T)}else if(typeof $=="string"){if(K.__isBigInt(T))return $=K.__fromString($),$!==null&&K.equal($,T);if(typeof T!="object")return $==T;T=K.__toPrimitive(T)}else if(typeof $=="boolean"){if(K.__isBigInt(T))return K.__equalToNumber(T,+$);if(typeof T!="object")return $==T;T=K.__toPrimitive(T)}else if(typeof $=="symbol"){if(K.__isBigInt(T))return!1;if(typeof T!="object")return $==T;T=K.__toPrimitive(T)}else if(typeof $=="object"){if(typeof T=="object"&&T.constructor!==K)return $==T;$=K.__toPrimitive($)}else return $==T}}static NE($,T){return!K.EQ($,T)}static DataViewGetBigInt64($,T,W=!1){return K.asIntN(64,K.DataViewGetBigUint64($,T,W))}static DataViewGetBigUint64($,T,W=!1){let[U,X]=W?[4,0]:[0,4],Y=$.getUint32(T+U,W),w=$.getUint32(T+X,W),G=new K(3,!1);return G.__setDigit(0,1073741823&w),G.__setDigit(1,(268435455&Y)<<2|w>>>30),G.__setDigit(2,Y>>>28),G.__trim()}static DataViewSetBigInt64($,T,W,U=!1){K.DataViewSetBigUint64($,T,W,U)}static DataViewSetBigUint64($,T,W,U=!1){W=K.asUintN(64,W);let X=0,Y=0;if(0<W.length&&(Y=W.__digit(0),1<W.length)){let H=W.__digit(1);Y|=H<<30,X=H>>>2,2<W.length&&(X|=W.__digit(2)<<28)}let[w,G]=U?[4,0]:[0,4];$.setUint32(T+w,X,U),$.setUint32(T+G,Y,U)}static __zero(){return new K(0,!1)}static __oneDigit($,T){let W=new K(1,T);return W.__setDigit(0,$),W}__copy(){let $=new K(this.length,this.sign);for(let T=0;T<this.length;T++)$[T]=this[T];return $}__trim(){let $=this.length,T=this[$-1];for(;T===0;)$--,T=this[$-1],this.pop();return $===0&&(this.sign=!1),this}__initializeDigits(){for(let $=0;$<this.length;$++)this[$]=0}static __decideRounding($,T,W,U){if(0<T)return-1;let X;if(0>T)X=-T-1;else{if(W===0)return-1;W--,U=$.__digit(W),X=29}let Y=1<<X;if((U&Y)==0)return-1;if(Y-=1,(U&Y)!=0)return 1;for(;0<W;)if(W--,$.__digit(W)!==0)return 1;return 0}static __fromDouble($){K.__kBitConversionDouble[0]=$;let T=2047&K.__kBitConversionInts[K.__kBitConversionIntHigh]>>>20,W=T-1023,U=(0|W/30)+1,X=new K(U,0>$),Y=1048575&K.__kBitConversionInts[K.__kBitConversionIntHigh]|1048576,w=K.__kBitConversionInts[K.__kBitConversionIntLow],G=20,H=W%30,z,F=0;if(H<20){let O=G-H;F=O+32,z=Y>>>O,Y=Y<<32-O|w>>>O,w<<=32-O}else if(H===20)F=32,z=Y,Y=w,w=0;else{let O=H-G;F=32-O,z=Y<<O|w>>>32-O,Y=w<<O,w=0}X.__setDigit(U-1,z);for(let O=U-2;0<=O;O--)0<F?(F-=30,z=Y>>>2,Y=Y<<30|w>>>2,w<<=30):z=0,X.__setDigit(O,z);return X.__trim()}static __isWhitespace($){return 13>=$&&9<=$||(159>=$?$==32:131071>=$?$==160||$==5760:196607>=$?($&=131071,10>=$||$==40||$==41||$==47||$==95||$==4096):$==65279)}static __fromString($,T=0){let W=0,U=$.length,X=0;if(X===U)return K.__zero();let Y=$.charCodeAt(X);for(;K.__isWhitespace(Y);){if(++X===U)return K.__zero();Y=$.charCodeAt(X)}if(Y===43){if(++X===U)return null;Y=$.charCodeAt(X),W=1}else if(Y===45){if(++X===U)return null;Y=$.charCodeAt(X),W=-1}if(T===0){if(T=10,Y===48){if(++X===U)return K.__zero();if(Y=$.charCodeAt(X),Y===88||Y===120){if(T=16,++X===U)return null;Y=$.charCodeAt(X)}else if(Y===79||Y===111){if(T=8,++X===U)return null;Y=$.charCodeAt(X)}else if(Y===66||Y===98){if(T=2,++X===U)return null;Y=$.charCodeAt(X)}}}else if(T===16&&Y===48){if(++X===U)return K.__zero();if(Y=$.charCodeAt(X),Y===88||Y===120){if(++X===U)return null;Y=$.charCodeAt(X)}}if(W!=0&&T!==10)return null;for(;Y===48;){if(++X===U)return K.__zero();Y=$.charCodeAt(X)}let w=U-X,G=K.__kMaxBitsPerChar[T],H=K.__kBitsPerCharTableMultiplier-1;if(w>1073741824/G)return null;let z=G*w+H>>>K.__kBitsPerCharTableShift,F=new K(0|(z+29)/30,!1),O=10>T?T:10,Q=10<T?T-10:0;if((T&T-1)==0){G>>=K.__kBitsPerCharTableShift;let Z=[],V=[],E=!1;do{let N=0,J=0;for(;;){let _;if(Y-48>>>0<O)_=Y-48;else if((32|Y)-97>>>0<Q)_=(32|Y)-87;else{E=!0;break}if(J+=G,N=N<<G|_,++X===U){E=!0;break}if(Y=$.charCodeAt(X),30<J+G)break}Z.push(N),V.push(J)}while(!E);K.__fillFromParts(F,Z,V)}else{F.__initializeDigits();let Z=!1,V=0;do{let E=0,N=1;for(;;){let _;if(Y-48>>>0<O)_=Y-48;else if((32|Y)-97>>>0<Q)_=(32|Y)-87;else{Z=!0;break}let R=N*T;if(1073741823<R)break;if(N=R,E=E*T+_,V++,++X===U){Z=!0;break}Y=$.charCodeAt(X)}H=30*K.__kBitsPerCharTableMultiplier-1;let J=0|(G*V+H>>>K.__kBitsPerCharTableShift)/30;F.__inplaceMultiplyAdd(N,E,J)}while(!Z)}if(X!==U){if(!K.__isWhitespace(Y))return null;for(X++;X<U;X++)if(Y=$.charCodeAt(X),!K.__isWhitespace(Y))return null}return F.sign=W==-1,F.__trim()}static __fillFromParts($,T,W){let U=0,X=0,Y=0;for(let w=T.length-1;0<=w;w--){let G=T[w],H=W[w];X|=G<<Y,Y+=H,Y===30?($.__setDigit(U++,X),Y=0,X=0):30<Y&&($.__setDigit(U++,1073741823&X),Y-=30,X=G>>>H-Y)}if(X!==0){if(U>=$.length)throw new Error("implementation bug");$.__setDigit(U++,X)}for(;U<$.length;U++)$.__setDigit(U,0)}static __toStringBasePowerOfTwo($,T){let W=$.length,U=T-1;U=(85&U>>>1)+(85&U),U=(51&U>>>2)+(51&U),U=(15&U>>>4)+(15&U);let X=U,Y=T-1,w=$.__digit(W-1),G=K.__clz30(w),H=0|(30*W-G+X-1)/X;if($.sign&&H++,268435456<H)throw new Error("string too long");let z=Array(H),F=H-1,O=0,Q=0;for(let V=0;V<W-1;V++){let E=$.__digit(V),N=(O|E<<Q)&Y;z[F--]=K.__kConversionChars[N];let J=X-Q;for(O=E>>>J,Q=30-J;Q>=X;)z[F--]=K.__kConversionChars[O&Y],O>>>=X,Q-=X}let Z=(O|w<<Q)&Y;for(z[F--]=K.__kConversionChars[Z],O=w>>>X-Q;O!==0;)z[F--]=K.__kConversionChars[O&Y],O>>>=X;if($.sign&&(z[F--]="-"),F!=-1)throw new Error("implementation bug");return z.join("")}static __toStringGeneric($,T,W){let U=$.length;if(U===0)return"";if(U===1){let V=$.__unsignedDigit(0).toString(T);return W===!1&&$.sign&&(V="-"+V),V}let X=30*U-K.__clz30($.__digit(U-1)),Y=K.__kMaxBitsPerChar[T],w=Y-1,G=X*K.__kBitsPerCharTableMultiplier;G+=w-1,G=0|G/w;let H=G+1>>1,z=K.exponentiate(K.__oneDigit(T,!1),K.__oneDigit(H,!1)),F,O,Q=z.__unsignedDigit(0);if(z.length===1&&32767>=Q){F=new K($.length,!1),F.__initializeDigits();let V=0;for(let E=2*$.length-1;0<=E;E--){let N=V<<15|$.__halfDigit(E);F.__setHalfDigit(E,0|N/Q),V=0|N%Q}O=V.toString(T)}else{let V=K.__absoluteDivLarge($,z,!0,!0);F=V.quotient;let E=V.remainder.__trim();O=K.__toStringGeneric(E,T,!0)}F.__trim();let Z=K.__toStringGeneric(F,T,!0);for(;O.length<H;)O="0"+O;return W===!1&&$.sign&&(Z="-"+Z),Z+O}static __unequalSign($){return $?-1:1}static __absoluteGreater($){return $?-1:1}static __absoluteLess($){return $?1:-1}static __compareToBigInt($,T){let W=$.sign;if(W!==T.sign)return K.__unequalSign(W);let U=K.__absoluteCompare($,T);return 0<U?K.__absoluteGreater(W):0>U?K.__absoluteLess(W):0}static __compareToNumber($,T){if(K.__isOneDigitInt(T)){let W=$.sign,U=0>T;if(W!==U)return K.__unequalSign(W);if($.length===0){if(U)throw new Error("implementation bug");return T===0?0:-1}if(1<$.length)return K.__absoluteGreater(W);let X=Math.abs(T),Y=$.__unsignedDigit(0);return Y>X?K.__absoluteGreater(W):Y<X?K.__absoluteLess(W):0}return K.__compareToDouble($,T)}static __compareToDouble($,T){if(T!==T)return T;if(T===1/0)return-1;if(T===-1/0)return 1;let W=$.sign;if(W!==0>T)return K.__unequalSign(W);if(T===0)throw new Error("implementation bug: should be handled elsewhere");if($.length===0)return-1;K.__kBitConversionDouble[0]=T;let U=2047&K.__kBitConversionInts[K.__kBitConversionIntHigh]>>>20;if(U==2047)throw new Error("implementation bug: handled elsewhere");let X=U-1023;if(0>X)return K.__absoluteGreater(W);let Y=$.length,w=$.__digit(Y-1),G=K.__clz30(w),H=30*Y-G,z=X+1;if(H<z)return K.__absoluteLess(W);if(H>z)return K.__absoluteGreater(W);let F=1048576|1048575&K.__kBitConversionInts[K.__kBitConversionIntHigh],O=K.__kBitConversionInts[K.__kBitConversionIntLow],Q=20,Z=29-G;if(Z!==(0|(H-1)%30))throw new Error("implementation bug");let V,E=0;if(20>Z){let N=Q-Z;E=N+32,V=F>>>N,F=F<<32-N|O>>>N,O<<=32-N}else if(Z===20)E=32,V=F,F=O,O=0;else{let N=Z-Q;E=32-N,V=F<<N|O>>>32-N,F=O<<N,O=0}if(w>>>=0,V>>>=0,w>V)return K.__absoluteGreater(W);if(w<V)return K.__absoluteLess(W);for(let N=Y-2;0<=N;N--){0<E?(E-=30,V=F>>>2,F=F<<30|O>>>2,O<<=30):V=0;let J=$.__unsignedDigit(N);if(J>V)return K.__absoluteGreater(W);if(J<V)return K.__absoluteLess(W)}if(F!==0||O!==0){if(E===0)throw new Error("implementation bug");return K.__absoluteLess(W)}return 0}static __equalToNumber($,T){var W=Math.abs;return K.__isOneDigitInt(T)?T===0?$.length===0:$.length===1&&$.sign===0>T&&$.__unsignedDigit(0)===W(T):K.__compareToDouble($,T)===0}static __comparisonResultToBool($,T){return T===0?0>$:T===1?0>=$:T===2?0<$:T===3?0<=$:void 0}static __compare($,T,W){if($=K.__toPrimitive($),T=K.__toPrimitive(T),typeof $=="string"&&typeof T=="string")switch(W){case 0:return $<T;case 1:return $<=T;case 2:return $>T;case 3:return $>=T}if(K.__isBigInt($)&&typeof T=="string")return T=K.__fromString(T),T!==null&&K.__comparisonResultToBool(K.__compareToBigInt($,T),W);if(typeof $=="string"&&K.__isBigInt(T))return $=K.__fromString($),$!==null&&K.__comparisonResultToBool(K.__compareToBigInt($,T),W);if($=K.__toNumeric($),T=K.__toNumeric(T),K.__isBigInt($)){if(K.__isBigInt(T))return K.__comparisonResultToBool(K.__compareToBigInt($,T),W);if(typeof T!="number")throw new Error("implementation bug");return K.__comparisonResultToBool(K.__compareToNumber($,T),W)}if(typeof $!="number")throw new Error("implementation bug");if(K.__isBigInt(T))return K.__comparisonResultToBool(K.__compareToNumber(T,$),2^W);if(typeof T!="number")throw new Error("implementation bug");return W===0?$<T:W===1?$<=T:W===2?$>T:W===3?$>=T:void 0}__clzmsd(){return K.__clz30(this.__digit(this.length-1))}static __absoluteAdd($,T,W){if($.length<T.length)return K.__absoluteAdd(T,$,W);if($.length===0)return $;if(T.length===0)return $.sign===W?$:K.unaryMinus($);let U=$.length;($.__clzmsd()===0||T.length===$.length&&T.__clzmsd()===0)&&U++;let X=new K(U,W),Y=0,w=0;for(;w<T.length;w++){let G=$.__digit(w)+T.__digit(w)+Y;Y=G>>>30,X.__setDigit(w,1073741823&G)}for(;w<$.length;w++){let G=$.__digit(w)+Y;Y=G>>>30,X.__setDigit(w,1073741823&G)}return w<X.length&&X.__setDigit(w,Y),X.__trim()}static __absoluteSub($,T,W){if($.length===0)return $;if(T.length===0)return $.sign===W?$:K.unaryMinus($);let U=new K($.length,W),X=0,Y=0;for(;Y<T.length;Y++){let w=$.__digit(Y)-T.__digit(Y)-X;X=1&w>>>30,U.__setDigit(Y,1073741823&w)}for(;Y<$.length;Y++){let w=$.__digit(Y)-X;X=1&w>>>30,U.__setDigit(Y,1073741823&w)}return U.__trim()}static __absoluteAddOne($,T,W=null){let U=$.length;W===null?W=new K(U,T):W.sign=T;let X=1;for(let Y=0;Y<U;Y++){let w=$.__digit(Y)+X;X=w>>>30,W.__setDigit(Y,1073741823&w)}return X!=0&&W.__setDigitGrow(U,1),W}static __absoluteSubOne($,T){let W=$.length;T=T||W;let U=new K(T,!1),X=1;for(let Y=0;Y<W;Y++){let w=$.__digit(Y)-X;X=1&w>>>30,U.__setDigit(Y,1073741823&w)}if(X!=0)throw new Error("implementation bug");for(let Y=W;Y<T;Y++)U.__setDigit(Y,0);return U}static __absoluteAnd($,T,W=null){let U=$.length,X=T.length,Y=X;if(U<X){Y=U;let H=$,z=U;$=T,U=X,T=H,X=z}let w=Y;W===null?W=new K(w,!1):w=W.length;let G=0;for(;G<Y;G++)W.__setDigit(G,$.__digit(G)&T.__digit(G));for(;G<w;G++)W.__setDigit(G,0);return W}static __absoluteAndNot($,T,W=null){let U=$.length,X=T.length,Y=X;U<X&&(Y=U);let w=U;W===null?W=new K(w,!1):w=W.length;let G=0;for(;G<Y;G++)W.__setDigit(G,$.__digit(G)&~T.__digit(G));for(;G<U;G++)W.__setDigit(G,$.__digit(G));for(;G<w;G++)W.__setDigit(G,0);return W}static __absoluteOr($,T,W=null){let U=$.length,X=T.length,Y=X;if(U<X){Y=U;let H=$,z=U;$=T,U=X,T=H,X=z}let w=U;W===null?W=new K(w,!1):w=W.length;let G=0;for(;G<Y;G++)W.__setDigit(G,$.__digit(G)|T.__digit(G));for(;G<U;G++)W.__setDigit(G,$.__digit(G));for(;G<w;G++)W.__setDigit(G,0);return W}static __absoluteXor($,T,W=null){let U=$.length,X=T.length,Y=X;if(U<X){Y=U;let H=$,z=U;$=T,U=X,T=H,X=z}let w=U;W===null?W=new K(w,!1):w=W.length;let G=0;for(;G<Y;G++)W.__setDigit(G,$.__digit(G)^T.__digit(G));for(;G<U;G++)W.__setDigit(G,$.__digit(G));for(;G<w;G++)W.__setDigit(G,0);return W}static __absoluteCompare($,T){let W=$.length-T.length;if(W!=0)return W;let U=$.length-1;for(;0<=U&&$.__digit(U)===T.__digit(U);)U--;return 0>U?0:$.__unsignedDigit(U)>T.__unsignedDigit(U)?1:-1}static __multiplyAccumulate($,T,W,U){if(T===0)return;let X=32767&T,Y=T>>>15,w=0,G=0;for(let H,z=0;z<$.length;z++,U++){H=W.__digit(U);let F=$.__digit(z),O=32767&F,Q=F>>>15,Z=K.__imul(O,X),V=K.__imul(O,Y),E=K.__imul(Q,X),N=K.__imul(Q,Y);H+=G+Z+w,w=H>>>30,H&=1073741823,H+=((32767&V)<<15)+((32767&E)<<15),w+=H>>>30,G=N+(V>>>15)+(E>>>15),W.__setDigit(U,1073741823&H)}for(;w!=0||G!==0;U++){let H=W.__digit(U);H+=w+G,G=0,w=H>>>30,W.__setDigit(U,1073741823&H)}}static __internalMultiplyAdd($,T,W,U,X){let Y=W,w=0;for(let G=0;G<U;G++){let H=$.__digit(G),z=K.__imul(32767&H,T),F=K.__imul(H>>>15,T),O=z+((32767&F)<<15)+w+Y;Y=O>>>30,w=F>>>15,X.__setDigit(G,1073741823&O)}if(X.length>U)for(X.__setDigit(U++,Y+w);U<X.length;)X.__setDigit(U++,0);else if(Y+w!==0)throw new Error("implementation bug")}__inplaceMultiplyAdd($,T,W){W>this.length&&(W=this.length);let U=32767&$,X=$>>>15,Y=0,w=T;for(let G=0;G<W;G++){let H=this.__digit(G),z=32767&H,F=H>>>15,O=K.__imul(z,U),Q=K.__imul(z,X),Z=K.__imul(F,U),V=K.__imul(F,X),E=w+O+Y;Y=E>>>30,E&=1073741823,E+=((32767&Q)<<15)+((32767&Z)<<15),Y+=E>>>30,w=V+(Q>>>15)+(Z>>>15),this.__setDigit(G,1073741823&E)}if(Y!=0||w!==0)throw new Error("implementation bug")}static __absoluteDivSmall($,T,W=null){W===null&&(W=new K($.length,!1));let U=0;for(let X,Y=2*$.length-1;0<=Y;Y-=2){X=(U<<15|$.__halfDigit(Y))>>>0;let w=0|X/T;U=0|X%T,X=(U<<15|$.__halfDigit(Y-1))>>>0;let G=0|X/T;U=0|X%T,W.__setDigit(Y>>>1,w<<15|G)}return W}static __absoluteModSmall($,T){let W=0;for(let U=2*$.length-1;0<=U;U--)W=0|((W<<15|$.__halfDigit(U))>>>0)%T;return W}static __absoluteDivLarge($,T,W,U){let X=T.__halfDigitLength(),Y=T.length,w=$.__halfDigitLength()-X,G=null;W&&(G=new K(w+2>>>1,!1),G.__initializeDigits());let H=new K(X+2>>>1,!1);H.__initializeDigits();let z=K.__clz15(T.__halfDigit(X-1));0<z&&(T=K.__specialLeftShift(T,z,0));let F=K.__specialLeftShift($,z,1),O=T.__halfDigit(X-1),Q=0;for(let Z,V=w;0<=V;V--){Z=32767;let E=F.__halfDigit(V+X);if(E!==O){let J=(E<<15|F.__halfDigit(V+X-1))>>>0;Z=0|J/O;let _=0|J%O,R=T.__halfDigit(X-2),P=F.__halfDigit(V+X-2);for(;K.__imul(Z,R)>>>0>(_<<16|P)>>>0&&(Z--,_+=O,!(32767<_)););}K.__internalMultiplyAdd(T,Z,0,Y,H);let N=F.__inplaceSub(H,V,X+1);N!==0&&(N=F.__inplaceAdd(T,V,X),F.__setHalfDigit(V+X,32767&F.__halfDigit(V+X)+N),Z--),W&&(1&V?Q=Z<<15:G.__setDigit(V>>>1,Q|Z))}if(U)return F.__inplaceRightShift(z),W?{quotient:G,remainder:F}:F;if(W)return G;throw new Error("unreachable")}static __clz15($){return K.__clz30($)-15}__inplaceAdd($,T,W){let U=0;for(let X=0;X<W;X++){let Y=this.__halfDigit(T+X)+$.__halfDigit(X)+U;U=Y>>>15,this.__setHalfDigit(T+X,32767&Y)}return U}__inplaceSub($,T,W){let U=0;if(1&T){T>>=1;let X=this.__digit(T),Y=32767&X,w=0;for(;w<W-1>>>1;w++){let z=$.__digit(w),F=(X>>>15)-(32767&z)-U;U=1&F>>>15,this.__setDigit(T+w,(32767&F)<<15|32767&Y),X=this.__digit(T+w+1),Y=(32767&X)-(z>>>15)-U,U=1&Y>>>15}let G=$.__digit(w),H=(X>>>15)-(32767&G)-U;if(U=1&H>>>15,this.__setDigit(T+w,(32767&H)<<15|32767&Y),T+w+1>=this.length)throw new RangeError("out of bounds");(1&W)==0&&(X=this.__digit(T+w+1),Y=(32767&X)-(G>>>15)-U,U=1&Y>>>15,this.__setDigit(T+$.length,1073709056&X|32767&Y))}else{T>>=1;let X=0;for(;X<$.length-1;X++){let z=this.__digit(T+X),F=$.__digit(X),O=(32767&z)-(32767&F)-U;U=1&O>>>15;let Q=(z>>>15)-(F>>>15)-U;U=1&Q>>>15,this.__setDigit(T+X,(32767&Q)<<15|32767&O)}let Y=this.__digit(T+X),w=$.__digit(X),G=(32767&Y)-(32767&w)-U;U=1&G>>>15;let H=0;(1&W)==0&&(H=(Y>>>15)-(w>>>15)-U,U=1&H>>>15),this.__setDigit(T+X,(32767&H)<<15|32767&G)}return U}__inplaceRightShift($){if($===0)return;let T=this.__digit(0)>>>$,W=this.length-1;for(let U=0;U<W;U++){let X=this.__digit(U+1);this.__setDigit(U,1073741823&X<<30-$|T),T=X>>>$}this.__setDigit(W,T)}static __specialLeftShift($,T,W){let U=$.length,X=new K(U+W,!1);if(T===0){for(let w=0;w<U;w++)X.__setDigit(w,$.__digit(w));return 0<W&&X.__setDigit(U,0),X}let Y=0;for(let w=0;w<U;w++){let G=$.__digit(w);X.__setDigit(w,1073741823&G<<T|Y),Y=G>>>30-T}return 0<W&&X.__setDigit(U,Y),X}static __leftShiftByAbsolute($,T){let W=K.__toShiftAmount(T);if(0>W)throw new RangeError("BigInt too big");let U=0|W/30,X=W%30,Y=$.length,w=X!==0&&$.__digit(Y-1)>>>30-X!=0,G=Y+U+(w?1:0),H=new K(G,$.sign);if(X===0){let z=0;for(;z<U;z++)H.__setDigit(z,0);for(;z<G;z++)H.__setDigit(z,$.__digit(z-U))}else{let z=0;for(let F=0;F<U;F++)H.__setDigit(F,0);for(let F=0;F<Y;F++){let O=$.__digit(F);H.__setDigit(F+U,1073741823&O<<X|z),z=O>>>30-X}if(w)H.__setDigit(Y+U,z);else if(z!==0)throw new Error("implementation bug")}return H.__trim()}static __rightShiftByAbsolute($,T){let{length:W,sign:U}=$,X=K.__toShiftAmount(T);if(0>X)return K.__rightShiftByMaximum(U);let Y=0|X/30,w=X%30,G=W-Y;if(0>=G)return K.__rightShiftByMaximum(U);let H=!1;if(U){if(($.__digit(Y)&(1<<w)-1)!=0)H=!0;else for(let F=0;F<Y;F++)if($.__digit(F)!==0){H=!0;break}}if(H&&w===0)~$.__digit(W-1)==0&&G++;let z=new K(G,U);if(w===0){z.__setDigit(G-1,0);for(let F=Y;F<W;F++)z.__setDigit(F-Y,$.__digit(F))}else{let F=$.__digit(Y)>>>w,O=W-Y-1;for(let Q=0;Q<O;Q++){let Z=$.__digit(Q+Y+1);z.__setDigit(Q,1073741823&Z<<30-w|F),F=Z>>>w}z.__setDigit(O,F)}return H&&(z=K.__absoluteAddOne(z,!0,z)),z.__trim()}static __rightShiftByMaximum($){return $?K.__oneDigit(1,!0):K.__zero()}static __toShiftAmount($){if(1<$.length)return-1;let T=$.__unsignedDigit(0);return T>K.__kMaxLengthBits?-1:T}static __toPrimitive($,T="default"){if(typeof $!="object")return $;if($.constructor===K)return $;if(typeof Symbol!="undefined"&&typeof Symbol.toPrimitive=="symbol"&&$[Symbol.toPrimitive]){let X=$[Symbol.toPrimitive](T);if(typeof X!="object")return X;throw new TypeError("Cannot convert object to primitive value")}let W=$.valueOf;if(W){let X=W.call($);if(typeof X!="object")return X}let U=$.toString;if(U){let X=U.call($);if(typeof X!="object")return X}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric($){return K.__isBigInt($)?$:+$}static __isBigInt($){return typeof $=="object"&&$!==null&&$.constructor===K}static __truncateToNBits($,T){let W=0|($+29)/30,U=new K(W,T.sign),X=W-1;for(let w=0;w<X;w++)U.__setDigit(w,T.__digit(w));let Y=T.__digit(X);if($%30!=0){let w=32-$%30;Y=Y<<w>>>w}return U.__setDigit(X,Y),U.__trim()}static __truncateAndSubFromPowerOfTwo($,T,W){var U=Math.min;let X=0|($+29)/30,Y=new K(X,W),w=0,G=X-1,H=0;for(let Q=U(G,T.length);w<Q;w++){let Z=0-T.__digit(w)-H;H=1&Z>>>30,Y.__setDigit(w,1073741823&Z)}for(;w<G;w++)Y.__setDigit(w,0|1073741823&-H);let z=G<T.length?T.__digit(G):0,F=$%30,O;if(F==0)O=0-z-H,O&=1073741823;else{let Q=32-F;z=z<<Q>>>Q;let Z=1<<32-Q;O=Z-z-H,O&=Z-1}return Y.__setDigit(G,O),Y.__trim()}__digit($){return this[$]}__unsignedDigit($){return this[$]>>>0}__setDigit($,T){this[$]=0|T}__setDigitGrow($,T){this[$]=0|T}__halfDigitLength(){let $=this.length;return 32767>=this.__unsignedDigit($-1)?2*$-1:2*$}__halfDigit($){return 32767&this[$>>>1]>>>15*(1&$)}__setHalfDigit($,T){let W=$>>>1,U=this.__digit(W),X=1&$?32767&U|T<<15:1073709056&U|32767&T;this.__setDigit(W,X)}static __digitPow($,T){let W=1;for(;0<T;)1&T&&(W*=$),T>>>=1,$*=$;return W}static __detectBigEndian(){return K.__kBitConversionDouble[0]=-0,K.__kBitConversionInts[0]!==0}static __isOneDigitInt($){return(1073741823&$)===$}}K.__kMaxLength=33554432,K.__kMaxLengthBits=K.__kMaxLength<<5,K.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],K.__kBitsPerCharTableShift=5,K.__kBitsPerCharTableMultiplier=1<<K.__kBitsPerCharTableShift,K.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],K.__kBitConversionBuffer=new ArrayBuffer(8),K.__kBitConversionDouble=new Float64Array(K.__kBitConversionBuffer),K.__kBitConversionInts=new Int32Array(K.__kBitConversionBuffer),K.__kBitConversionIntHigh=K.__detectBigEndian()?0:1,K.__kBitConversionIntLow=K.__detectBigEndian()?1:0,K.__clz30=Math.clz32?function($){return Math.clz32($)-2}:function($){return $===0?30:0|29-(0|Math.log($>>>0)/Math.LN2)},K.__imul=Math.imul||function($,T){return 0|$*T};var q=K;var Y1=q.BigInt(0),x8=q.BigInt(1),uO=q.BigInt(2),zb=q.BigInt(10),Hb=q.BigInt(24),Fb=q.BigInt(60),Ob=q.BigInt(1000),u8=q.BigInt(1e6),q8=q.BigInt(1e9),HM=q.multiply(q.BigInt(3600),q8),Qb=q.multiply(Fb,q8),vT=q.multiply(HM,Hb);function B0($){return typeof $=="bigint"?q.BigInt($.toString(10)):$}function FM($){return q.equal(q.remainder($,uO),Y1)}function RW($){return q.lessThan($,Y1)?q.unaryMinus($):$}function tG($,T){return q.lessThan($,T)?-1:q.greaterThan($,T)?1:0}function M8($,T){return{quotient:q.divide($,T),remainder:q.remainder($,T)}}var CA,SA,F$="slot-epochNanoSeconds",O$="slot-iso-date",W4="slot-iso-date-time",O4="slot-time",m="slot-calendar",OM="slot-date-brand",QM="slot-year-month-brand",ZM="slot-month-day-brand",b$="slot-time-zone",O6="slot-years",Q6="slot-months",b6="slot-weeks",Z6="slot-days",D6="slot-hours",V6="slot-minutes",K6="slot-seconds",E6="slot-milliseconds",A6="slot-microseconds",f6="slot-nanoseconds",DM="date",VM="ym",KM="md",EM="time",AM="datetime",MM="instant",IW="original",m2="timezone-canonical",JO="timezone-original",N8="calendar-id",NM="locale",_O="options",LM=new WeakMap,RO=Symbol.for("@@Temporal__GetSlots");(CA=globalThis)[RO]||(CA[RO]=function($){return LM.get($)});var z9=globalThis[RO],kO=Symbol.for("@@Temporal__CreateSlots");(SA=globalThis)[kO]||(SA[kO]=function($){LM.set($,Object.create(null))});var u0=globalThis[kO];function _6($,...T){if(!$||typeof $!="object")return!1;let W=z9($);return!!W&&T.every((U)=>(U in W))}function D($,T){let W=z9($)?.[T];if(W===void 0)throw new TypeError(`Missing internal slot ${T}`);return W}function L$($,T,W){let U=z9($);if(U===void 0)throw new TypeError("Missing slots for the given container");if(U[T])throw new TypeError(`${T} already has set`);U[T]=W}var vO={};function p0($,T){Object.defineProperty($.prototype,Symbol.toStringTag,{value:T,writable:!1,enumerable:!1,configurable:!0});let W=Object.getOwnPropertyNames($);for(let X=0;X<W.length;X++){let Y=W[X],w=Object.getOwnPropertyDescriptor($,Y);w.configurable&&w.enumerable&&(w.enumerable=!1,Object.defineProperty($,Y,w))}let U=Object.getOwnPropertyNames($.prototype);for(let X=0;X<U.length;X++){let Y=U[X],w=Object.getOwnPropertyDescriptor($.prototype,Y);w.configurable&&w.enumerable&&(w.enumerable=!1,Object.defineProperty($.prototype,Y,w))}qO(T,$),qO(`${T}.prototype`,$.prototype)}function qO($,T){let W=`%${$}%`;if(vO[W]!==void 0)throw new Error(`intrinsic ${$} already exists`);vO[W]=T}function r4($){return vO[$]}function u2($,T){let W=$;if(W===0)return{div:W,mod:W};let U=Math.sign(W);W=Math.abs(W);let X=Math.trunc(1+Math.log10(W));if(T>=X)return{div:0*U,mod:U*W};if(T===0)return{div:U*W,mod:0*U};let Y=W.toPrecision(X);return{div:U*Number.parseInt(Y.slice(0,X-T),10),mod:U*Number.parseInt(Y.slice(X-T),10)}}function EO($,T,W){let U=$,X=W;if(U===0)return X;let Y=Math.sign(U)||Math.sign(X);U=Math.abs(U),X=Math.abs(X);let w=U.toPrecision(Math.trunc(1+Math.log10(U)));if(X===0)return Y*Number.parseInt(w+"0".repeat(T),10);let G=w+X.toPrecision(Math.trunc(1+Math.log10(X))).padStart(T,"0");return Y*Number.parseInt(G,10)}function H9($,T){let W=T==="negative";switch($){case"ceil":return W?"zero":"infinity";case"floor":return W?"infinity":"zero";case"expand":return"infinity";case"trunc":return"zero";case"halfCeil":return W?"half-zero":"half-infinity";case"halfFloor":return W?"half-infinity":"half-zero";case"halfExpand":return"half-infinity";case"halfTrunc":return"half-zero";case"halfEven":return"half-even"}}function F9($,T,W,U,X){return X==="zero"?$:X==="infinity"?T:W<0?$:W>0?T:X==="half-zero"?$:X==="half-infinity"?T:U?$:T}class R${constructor($){this.totalNs=B0($),this.sec=q.toNumber(q.divide(this.totalNs,q8)),this.subsec=q.toNumber(q.remainder(this.totalNs,q8))}static validateNew($,T){if(q.greaterThan(RW($),R$.MAX))throw new RangeError(`${T} of duration time units cannot exceed ${R$.MAX} s`);return new R$($)}static fromEpochNsDiff($,T){let W=q.subtract(B0($),B0(T));return new R$(W)}static fromComponents($,T,W,U,X,Y){let w=q.add(q.add(q.add(q.add(q.add(q.BigInt(Y),q.multiply(q.BigInt(X),Ob)),q.multiply(q.BigInt(U),u8)),q.multiply(q.BigInt(W),q8)),q.multiply(q.BigInt(T),Qb)),q.multiply(q.BigInt($),HM));return R$.validateNew(w,"total")}abs(){return new R$(RW(this.totalNs))}add($){return R$.validateNew(q.add(this.totalNs,$.totalNs),"sum")}add24HourDays($){return R$.validateNew(q.add(this.totalNs,q.multiply(q.BigInt($),vT)),"sum")}addToEpochNs($){return q.add(B0($),this.totalNs)}cmp($){return tG(this.totalNs,$.totalNs)}divmod($){let{quotient:T,remainder:W}=M8(this.totalNs,q.BigInt($));return{quotient:q.toNumber(T),remainder:new R$(W)}}fdiv($){let T=B0($),W=q.BigInt(T),{quotient:U,remainder:X}=M8(this.totalNs,W),Y=[],w,G=(q.lessThan(this.totalNs,Y1)?-1:1)*Math.sign(q.toNumber(T));for(;!q.equal(X,Y1)&&Y.length<50;)X=q.multiply(X,zb),{quotient:w,remainder:X}=M8(X,W),Y.push(Math.abs(q.toNumber(w)));return G*Number(RW(U).toString()+"."+Y.join(""))}isZero(){return q.equal(this.totalNs,Y1)}round($,T){let W=B0($);if(q.equal(W,x8))return this;let{quotient:U,remainder:X}=M8(this.totalNs,W),Y=q.lessThan(this.totalNs,Y1)?"negative":"positive",w=q.multiply(RW(U),W),G=q.add(w,W),H=tG(RW(q.multiply(X,uO)),W),z=H9(T,Y),F=q.equal(RW(this.totalNs),w)?w:F9(w,G,H,FM(U),z),O=Y==="positive"?F:q.unaryMinus(F);return R$.validateNew(O,"rounding")}sign(){return this.cmp(new R$(Y1))}subtract($){return R$.validateNew(q.subtract(this.totalNs,$.totalNs),"difference")}}R$.MAX=q.BigInt("9007199254740991999999999"),R$.ZERO=new R$(Y1);var jA=/[A-Za-z._][A-Za-z._0-9+-]*/,p8=new RegExp(`(?:${/(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)/.source}|(?:${jA.source})(?:\\/(?:${jA.source}))*)`),JM=/(?:[+-]\d{6}|\d{4})/,aG=/(?:0[1-9]|1[0-2])/,PO=/(?:0[1-9]|[12]\d|3[01])/,Zb=new RegExp(`(${JM.source})(?:-(${aG.source})-(${PO.source})|(${aG.source})(${PO.source}))`),_M=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,RM=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,kM=new RegExp(`([zZ])|${RM.source}?`),l2=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,Db=new RegExp([`^${Zb.source}`,`(?:(?:[tT]|\\s+)${_M.source}(?:${kM.source})?)?`,`(?:\\[!?(${p8.source})\\])?`,`((?:${l2.source})*)$`].join("")),Vb=new RegExp([`^[tT]?${_M.source}`,`(?:${kM.source})?`,`(?:\\[!?${p8.source}\\])?`,`((?:${l2.source})*)$`].join("")),Kb=new RegExp(`^(${JM.source})-?(${aG.source})(?:\\[!?${p8.source}\\])?((?:${l2.source})*)$`),Eb=new RegExp(`^(?:--)?(${aG.source})-?(${PO.source})(?:\\[!?${p8.source}\\])?((?:${l2.source})*)$`),AO=/(\d+)(?:[.,](\d{1,9}))?/,Ab=new RegExp(`(?:${AO.source}H)?(?:${AO.source}M)?(?:${AO.source}S)?`),Mb=new RegExp(`^([+-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${Ab.source})?$`,"i"),qT=86400000,sG=1e6*qT,Nb=60000000000,vM=1e8*qT,r2=f1(vM),I8=q.unaryMinus(r2),Lb=q.add(q.subtract(I8,vT),x8),Jb=q.subtract(q.add(r2,vT),x8),_b=146097*qT,BA=-271821,xA=275760,P8=Date.UTC(1847,0,1),Rb=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","ethiopic-amete-alem","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"],kb=new Set(["ACT","AET","AGT","ART","AST","BET","BST","CAT","CNT","CST","CTT","EAT","ECT","IET","IST","JST","MIT","NET","NST","PLT","PNT","PRT","PST","SST","VST"]);function Q4($){return typeof $=="object"&&$!==null||typeof $=="function"}function O9($){if(typeof $=="bigint")throw new TypeError("Cannot convert BigInt to number");return Number($)}function Q9($){if(typeof $=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return String($)}function V$($){let T=O9($);if(T===0)return 0;if(Number.isNaN(T)||T===1/0||T===-1/0)throw new RangeError("invalid number value");let W=Math.trunc(T);return W===0?0:W}function IA($,T){let W=V$($);if(W<=0){if(T!==void 0)throw new RangeError(`property '${T}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return W}function I1($){let T=O9($);if(Number.isNaN(T))throw new RangeError("not a number");if(T===1/0||T===-1/0)throw new RangeError("infinity is out of range");if(!function(W){if(typeof W!="number"||Number.isNaN(W)||W===1/0||W===-1/0)return!1;let U=Math.abs(W);return Math.floor(U)===U}(T))throw new RangeError(`unsupported fractional value ${$}`);return T===0?0:T}function b8($,T){return String($).padStart(T,"0")}function S4($){if(typeof $!="string")throw new TypeError(`expected a string, not ${String($)}`);return $}function CO($,T){if(Q4($)){let W=$?.toString();if(typeof W=="string"||typeof W=="number")return W;throw new TypeError("Cannot convert object to primitive value")}return $}var SO=["era","eraYear","year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],vb={era:Q9,eraYear:V$,year:V$,month:IA,monthCode:function($){let T=S4(CO($));if(T.length<3||T.length>4||T[0]!=="M"||"0123456789".indexOf(T[1])===-1||"0123456789".indexOf(T[2])===-1||T[1]+T[2]==="00"&&T[3]!=="L"||T[3]!=="L"&&T[3]!==void 0)throw new RangeError(`bad month code ${T}; must match M01-M99 or M00L-M99L`);return T},day:IA,hour:V$,minute:V$,second:V$,millisecond:V$,microsecond:V$,nanosecond:V$,offset:function($){let T=S4(CO($));return XU(T),T},timeZone:L6},qb={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},n2=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],bA=Object.fromEntries(n2.map(($)=>[$[0],$[1]])),Pb=Object.fromEntries(n2.map(([$,T])=>[T,$])),C8=n2.map(([,$])=>$),i2={day:sG,hour:3600000000000,minute:60000000000,second:1e9,millisecond:1e6,microsecond:1000,nanosecond:1},eG=["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],Cb=Intl.DateTimeFormat,fA=new Map;function qM($){let T=m8($),W=fA.get(T);return W===void 0&&(W=new Cb("en-us",{timeZone:T,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),fA.set(T,W)),W}function d4($){return _6($,F$)&&!_6($,b$,m)}function H4($){return _6($,O6,Q6,Z6,D6,V6,K6,E6,A6,f6)}function F4($){return _6($,OM)}function K4($){return _6($,O4)}function n$($){return _6($,W4)}function o4($){return _6($,QM)}function X1($){return _6($,ZM)}function _$($){return _6($,F$,b$,m)}function C($,T){if(!T($))throw new TypeError("invalid receiver: method called with the wrong type of this-object")}function TU($){if(_6($,m)||_6($,b$))throw new TypeError("with() does not support a calendar or timeZone property");if(K4($))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if($.calendar!==void 0)throw new TypeError("with() does not support a calendar property");if($.timeZone!==void 0)throw new TypeError("with() does not support a timeZone property")}function d8($,T){return T==="never"||T==="auto"&&$==="iso8601"?"":`[${T==="critical"?"!":""}u-ca=${$}]`}function Z9($){let T,W,U=!1;for(l2.lastIndex=0;W=l2.exec($);){let{1:X,2:Y,3:w}=W;if(Y==="u-ca"){if(T===void 0)T=w,U=X==="!";else if(X==="!"||U)throw new RangeError(`Invalid annotations in ${$}: more than one u-ca present with critical flag`)}else if(X==="!")throw new RangeError(`Unrecognized annotation: !${Y}=${w}`)}return T}function G0($){let T=Db.exec($);if(!T)throw new RangeError(`invalid RFC 9557 string: ${$}`);let W=Z9(T[16]),U=T[1];if(U==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);let X=+U,Y=+(T[2]??T[4]??1),w=+(T[3]??T[5]??1),G=T[6]!==void 0,H=+(T[6]??0),z=+(T[7]??T[10]??0),F=+(T[8]??T[11]??0);F===60&&(F=59);let O=(T[9]??T[12]??"")+"000000000",Q=+O.slice(0,3),Z=+O.slice(3,6),V=+O.slice(6,9),E,N=!1;T[13]?(E=void 0,N=!0):T[14]&&(E=T[14]);let J=T[15];return nO(X,Y,w,H,z,F,Q,Z,V),{year:X,month:Y,day:w,time:G?{hour:H,minute:z,second:F,millisecond:Q,microsecond:Z,nanosecond:V}:"start-of-day",tzAnnotation:J,offset:E,z:N,calendar:W}}function PM($){let T=Vb.exec($),W,U,X,Y,w,G,H;if(T){H=Z9(T[10]),W=+(T[1]??0),U=+(T[2]??T[5]??0),X=+(T[3]??T[6]??0),X===60&&(X=59);let z=(T[4]??T[7]??"")+"000000000";if(Y=+z.slice(0,3),w=+z.slice(3,6),G=+z.slice(6,9),T[8])throw new RangeError("Z designator not supported for PlainTime")}else{let z,F;if({time:z,z:F,calendar:H}=G0($),z==="start-of-day")throw new RangeError(`time is missing in string: ${$}`);if(F)throw new RangeError("Z designator not supported for PlainTime");({hour:W,minute:U,second:X,millisecond:Y,microsecond:w,nanosecond:G}=z)}if(E9(W,U,X,Y,w,G),/[tT ][0-9][0-9]/.test($))return{hour:W,minute:U,second:X,millisecond:Y,microsecond:w,nanosecond:G,calendar:H};try{let{month:z,day:F}=dO($);CW(1972,z,F)}catch{try{let{year:z,month:F}=pO($);CW(z,F,1)}catch{return{hour:W,minute:U,second:X,millisecond:Y,microsecond:w,nanosecond:G,calendar:H}}}throw new RangeError(`invalid RFC 9557 time-only string ${$}; may need a T prefix`)}function pO($){let T=Kb.exec($),W,U,X,Y;if(T){X=Z9(T[3]);let w=T[1];if(w==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);if(W=+w,U=+T[2],Y=1,X!==void 0&&X!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let w;if({year:W,month:U,calendar:X,day:Y,z:w}=G0($),w)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:W,month:U,calendar:X,referenceISODay:Y}}function dO($){let T=Eb.exec($),W,U,X,Y;if(T){if(X=Z9(T[3]),W=+T[1],U=+T[2],X!==void 0&&X!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let w;if({month:W,day:U,calendar:X,year:Y,z:w}=G0($),w)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:W,day:U,calendar:X,referenceISOYear:Y}}var CM=new RegExp(`^${p8.source}$`,"i"),SM=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?/.source}$`);function jM($){let T=jb.test($)?"Seconds not allowed in offset time zone":"Invalid time zone";throw new RangeError(`${T}: ${$}`)}function kT($){return CM.test($)||jM($),SM.test($)?{offsetMinutes:XU($)/60000000000}:{tzName:$}}function S8($,T,W,U){let X=$,Y=T,w=W;switch(U){case"reject":CW(X,Y,w);break;case"constrain":({year:X,month:Y,day:w}=nM(X,Y,w))}return{year:X,month:Y,day:w}}function D9($,T,W,U,X,Y,w){let G=$,H=T,z=W,F=U,O=X,Q=Y;switch(w){case"reject":E9(G,H,z,F,O,Q);break;case"constrain":G=M6(G,0,23),H=M6(H,0,59),z=M6(z,0,59),F=M6(F,0,999),O=M6(O,0,999),Q=M6(Q,0,999)}return{hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}function BM($){if(!Q4($))throw new TypeError("invalid duration-like");let T={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},W=!1;for(let U=0;U<eG.length;U++){let X=eG[U],Y=$[X];Y!==void 0&&(W=!0,T[X]=I1(Y))}if(!W)throw new TypeError("invalid duration-like");return T}function e4({years:$,months:T,weeks:W,days:U},X,Y,w){return{years:$,months:w??T,weeks:Y??W,days:X??U}}function B$($,T){return{isoDate:$,time:T}}function C$($){return g0($,"overflow",["constrain","reject"],"constrain")}function j8($){return g0($,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function y1($,T){return g0($,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],T)}function iG($,T){return g0($,"offset",["prefer","use","ignore","reject"],T)}function o8($){return g0($,"calendarName",["auto","always","never","critical"],"auto")}function WU($){let T=$.roundingIncrement;if(T===void 0)return 1;let W=V$(T);if(W<1||W>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${T}`);return W}function UU($,T,W){let U=W?T:T-1;if($>U)throw new RangeError(`roundingIncrement must be at least 1 and less than ${U}, not ${$}`);if(T%$!=0)throw new RangeError(`Rounding increment must divide evenly into ${T}`)}function l8($){let T=$.fractionalSecondDigits;if(T===void 0)return"auto";if(typeof T!="number"){if(Q9(T)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`);return"auto"}let W=Math.floor(T);if(!Number.isFinite(W)||W<0||W>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`);return W}function r8($,T){switch($){case"minute":return{precision:"minute",unit:"minute",increment:1};case"second":return{precision:0,unit:"second",increment:1};case"millisecond":return{precision:3,unit:"millisecond",increment:1};case"microsecond":return{precision:6,unit:"microsecond",increment:1};case"nanosecond":return{precision:9,unit:"nanosecond",increment:1}}switch(T){case"auto":return{precision:T,unit:"nanosecond",increment:1};case 0:return{precision:T,unit:"second",increment:1};case 1:case 2:case 3:return{precision:T,unit:"millisecond",increment:10**(3-T)};case 4:case 5:case 6:return{precision:T,unit:"microsecond",increment:10**(6-T)};case 7:case 8:case 9:return{precision:T,unit:"nanosecond",increment:10**(9-T)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`)}}var c0=Symbol("~required~");function h6($,T,W,U,X=[]){let Y=[];for(let z=0;z<n2.length;z++){let F=n2[z],O=F[1],Q=F[2];W!=="datetime"&&W!==Q||Y.push(O)}Y=Y.concat(X);let w=U;w===c0?w=void 0:w!==void 0&&Y.push(w);let G=[];G=G.concat(Y);for(let z=0;z<Y.length;z++){let F=Y[z],O=Pb[F];O!==void 0&&G.push(O)}let H=g0($,T,G,w);if(H===void 0&&U===c0)throw new RangeError(`${T} is required`);return H&&H in bA?bA[H]:H}function MO($){let T=$.relativeTo;if(T===void 0)return{};let W,U,X,Y,w,G="option",H=!1;if(Q4(T)){if(_$(T))return{zonedRelativeTo:T};if(F4(T))return{plainRelativeTo:T};if(n$(T))return{plainRelativeTo:N6(D(T,W4).isoDate,D(T,m))};X=s8(T);let z=H1(X,T,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],[]);({isoDate:W,time:U}=i8(X,z,"constrain")),{offset:w,timeZone:Y}=z,w===void 0&&(G="wall")}else{let z,F,O,Q,Z;if({year:O,month:Q,day:Z,time:U,calendar:X,tzAnnotation:z,offset:w,z:F}=G0(S4(T)),z)Y=L6(z),F?G="exact":w||(G="wall"),H=!0;else if(F)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");X||(X="iso8601"),X=R6(X),W={year:O,month:Q,day:Z}}return Y===void 0?{plainRelativeTo:N6(W,X)}:{zonedRelativeTo:s4($9(W,U,G,G==="option"?XU(w):0,Y,"compatible","reject",H),Y,X)}}function x0($){return D($,O6)!==0?"year":D($,Q6)!==0?"month":D($,b6)!==0?"week":D($,Z6)!==0?"day":D($,D6)!==0?"hour":D($,V6)!==0?"minute":D($,K6)!==0?"second":D($,E6)!==0?"millisecond":D($,A6)!==0?"microsecond":"nanosecond"}function y0($,T){return C8.indexOf($)>C8.indexOf(T)?T:$}function $0($){return $==="year"||$==="month"||$==="week"}function I0($){return $0($)||$==="day"?"date":"time"}function CT($){return r4("%calendarImpl%")($)}function n8($){return r4("%calendarImpl%")(D($,m))}function J6($,T,W="date"){let U=Object.create(null),X=CT($).isoToDate(T,{year:!0,monthCode:!0,day:!0});return U.monthCode=X.monthCode,W!=="month-day"&&W!=="date"||(U.day=X.day),W!=="year-month"&&W!=="date"||(U.year=X.year),U}function H1($,T,W,U,X){let Y=CT($).extraFields(W),w=W.concat(U,Y),G=Object.create(null),H=!1;w.sort();for(let z=0;z<w.length;z++){let F=w[z],O=T[F];if(O!==void 0)H=!0,G[F]=vb[F](O);else if(X!=="partial"){if(X.includes(F))throw new TypeError(`required property '${F}' missing or undefined`);G[F]=qb[F]}}if(X==="partial"&&!H)throw new TypeError("no supported properties found");return G}function jO($,T="complete"){let W=["hour","microsecond","millisecond","minute","nanosecond","second"],U=!1,X=Object.create(null);for(let Y=0;Y<W.length;Y++){let w=W[Y],G=$[w];G!==void 0?(X[w]=V$(G),U=!0):T==="complete"&&(X[w]=0)}if(!U)throw new TypeError("invalid time-like");return X}function L8($,T){if(Q4($)){if(F4($))return C$($$(T)),N6(D($,O$),D($,m));if(_$($)){let H=N1(D($,b$),D($,F$));return C$($$(T)),N6(H.isoDate,D($,m))}if(n$($))return C$($$(T)),N6(D($,W4).isoDate,D($,m));let G=s8($);return N6(PT(G,H1(G,$,["year","month","monthCode","day"],[],[]),C$($$(T))),G)}let{year:W,month:U,day:X,calendar:Y,z:w}=G0(S4($));if(w)throw new RangeError("Z designator not supported for PlainDate");return Y||(Y="iso8601"),Y=R6(Y),C$($$(T)),N6({year:W,month:U,day:X},Y)}function i8($,T,W){return B$(PT($,T,W),D9(T.hour,T.minute,T.second,T.millisecond,T.microsecond,T.nanosecond,W))}function J8($,T){let W,U,X;if(Q4($)){if(n$($))return C$($$(T)),E1(D($,W4),D($,m));if(_$($)){let G=N1(D($,b$),D($,F$));return C$($$(T)),E1(G,D($,m))}if(F4($))return C$($$(T)),E1(B$(D($,O$),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),D($,m));X=s8($);let Y=H1(X,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],[]),w=C$($$(T));({isoDate:W,time:U}=i8(X,Y,w))}else{let Y,w,G,H;if({year:w,month:G,day:H,time:U,calendar:X,z:Y}=G0(S4($)),Y)throw new RangeError("Z designator not supported for PlainDateTime");U==="start-of-day"&&(U={deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),nO(w,G,H,U.hour,U.minute,U.second,U.millisecond,U.microsecond,U.nanosecond),X||(X="iso8601"),X=R6(X),C$($$(T)),W={year:w,month:G,day:H}}return E1(B$(W,U),X)}function M1($){let T=r4("%Temporal.Duration%");if(H4($))return new T(D($,O6),D($,Q6),D($,b6),D($,Z6),D($,D6),D($,V6),D($,K6),D($,E6),D($,A6),D($,f6));if(!Q4($))return function(X){let{years:Y,months:w,weeks:G,days:H,hours:z,minutes:F,seconds:O,milliseconds:Q,microseconds:Z,nanoseconds:V}=function(E){let N=Mb.exec(E);if(!N)throw new RangeError(`invalid duration: ${E}`);if(N.every((g,G$)=>G$<2||g===void 0))throw new RangeError(`invalid duration: ${E}`);let J=N[1]==="-"?-1:1,_=N[2]===void 0?0:V$(N[2])*J,R=N[3]===void 0?0:V$(N[3])*J,P=N[4]===void 0?0:V$(N[4])*J,x=N[5]===void 0?0:V$(N[5])*J,f=N[6]===void 0?0:V$(N[6])*J,h=N[7],a=N[8],M$=N[9],S=N[10],W$=N[11],n=0,Y$=0,j$=0;if(h!==void 0){if(a??M$??S??W$)throw new RangeError("only the smallest unit can be fractional");j$=3600*V$((h+"000000000").slice(0,9))*J}else if(n=a===void 0?0:V$(a)*J,M$!==void 0){if(S??W$)throw new RangeError("only the smallest unit can be fractional");j$=60*V$((M$+"000000000").slice(0,9))*J}else Y$=S===void 0?0:V$(S)*J,W$!==void 0&&(j$=V$((W$+"000000000").slice(0,9))*J);let s$=j$%1000,f4=Math.trunc(j$/1000)%1000,n6=Math.trunc(j$/1e6)%1000;return Y$+=Math.trunc(j$/1e9)%60,n+=Math.trunc(j$/60000000000),A9(_,R,P,x,f,n,Y$,n6,f4,s$),{years:_,months:R,weeks:P,days:x,hours:f,minutes:n,seconds:Y$,milliseconds:n6,microseconds:f4,nanoseconds:s$}}(X);return new(r4("%Temporal.Duration%"))(Y,w,G,H,z,F,O,Q,Z,V)}(S4($));let W={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},U=BM($);for(let X=0;X<eG.length;X++){let Y=eG[X],w=U[Y];w!==void 0&&(W[Y]=w)}return new T(W.years,W.months,W.weeks,W.days,W.hours,W.minutes,W.seconds,W.milliseconds,W.microseconds,W.nanoseconds)}function _8($){let T;if(Q4($)){if(d4($)||_$($))return b1(D($,F$));T=CO($)}else T=$;let{year:W,month:U,day:X,time:Y,offset:w,z:G}=function(E){let N=G0(E);if(!N.z&&!N.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return N}(S4(T)),{hour:H=0,minute:z=0,second:F=0,millisecond:O=0,microsecond:Q=0,nanosecond:Z=0}=Y==="start-of-day"?{}:Y,V=g8(W,U,X,H,z,F,O,Q,Z-(G?0:XU(w)));return o2(V.isoDate),b1(l4(V))}function yA($,T){if(Q4($)){if(X1($))return C$($$(T)),p2(D($,O$),D($,m));let G;return _6($,m)?G=D($,m):(G=$.calendar,G===void 0&&(G="iso8601"),G=a8(G)),p2(T9(G,H1(G,$,["year","month","monthCode","day"],[],[]),C$($$(T))),G)}let{month:W,day:U,referenceISOYear:X,calendar:Y}=dO(S4($));if(Y===void 0&&(Y="iso8601"),Y=R6(Y),C$($$(T)),Y==="iso8601")return p2({year:1972,month:W,day:U},Y);let w={year:X,month:W,day:U};return bW(w),w=T9(Y,J6(Y,w,"month-day"),"constrain"),p2(w,Y)}function _T($,T){let W;if(Q4($)){if(K4($))return C$($$(T)),b0(D($,O4));if(n$($))return C$($$(T)),b0(D($,W4).time);if(_$($)){let z=N1(D($,b$),D($,F$));return C$($$(T)),b0(z.time)}let{hour:U,minute:X,second:Y,millisecond:w,microsecond:G,nanosecond:H}=jO($);W=D9(U,X,Y,w,G,H,C$($$(T)))}else W=PM(S4($)),C$($$(T));return b0(W)}function xM($){return $===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:D(_T($),O4)}function R8($,T){if(Q4($)){if(o4($))return C$($$(T)),d2(D($,O$),D($,m));let G=s8($);return d2(f8(G,H1(G,$,["year","month","monthCode"],[],[]),C$($$(T))),G)}let{year:W,month:U,referenceISODay:X,calendar:Y}=pO(S4($));Y===void 0&&(Y="iso8601"),Y=R6(Y),C$($$(T));let w={year:W,month:U,day:X};return iO(w),w=f8(Y,J6(Y,w,"year-month"),"constrain"),d2(w,Y)}function $9($,T,W,U,X,Y,w,G){if(T==="start-of-day")return LT(X,$);let H=B$($,T);if(W==="wall"||w==="ignore")return $6(X,H,Y);if(W==="exact"||w==="use"){let O=g8($.year,$.month,$.day,T.hour,T.minute,T.second,T.millisecond,T.microsecond,T.nanosecond-U);o2(O.isoDate);let Q=l4(O);return Y0(Q),Q}o2($);let z=l4(H),F=y8(X,H);for(let O=0;O<F.length;O++){let Q=F[O],Z=q.toNumber(q.subtract(z,Q)),V=RT(Z,60000000000,"halfExpand");if(Z===U||G&&V===U)return Q}if(w==="reject"){let O=BO(U),Q=h8(H,"iso8601","auto");throw new RangeError(`Offset ${O} is invalid for ${Q} in ${X}`)}return uM(F,X,H,Y)}function k8($,T){let W,U,X,Y,w,G,H,z=!1,F="option";if(Q4($)){if(_$($)){let E=$$(T);return j8(E),iG(E,"reject"),C$(E),s4(D($,F$),D($,b$),D($,m))}w=s8($);let Q=H1(w,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],["timeZone"]);({offset:Y,timeZone:X}=Q),Y===void 0&&(F="wall");let Z=$$(T);G=j8(Z),H=iG(Z,"reject");let V=C$(Z);({isoDate:W,time:U}=i8(w,Q,V))}else{let Q,Z,V,E,N;({year:V,month:E,day:N,time:U,tzAnnotation:Q,offset:Y,z:Z,calendar:w}=function(_){let R=G0(_);if(!R.tzAnnotation)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return R}(S4($))),X=L6(Q),Z?F="exact":Y||(F="wall"),w||(w="iso8601"),w=R6(w),z=!0;let J=$$(T);G=j8(J),H=iG(J,"reject"),C$(J),W={year:V,month:E,day:N}}let O=0;return F==="option"&&(O=XU(Y)),s4($9(W,U,F,O,X,G,H,z),X,w)}function IM($,T,W){bW(T),u0($),L$($,O$,T),L$($,m,W),L$($,OM,!0)}function N6($,T){let W=r4("%Temporal.PlainDate%"),U=Object.create(W.prototype);return IM(U,$,T),U}function bM($,T,W){SW(T),u0($),L$($,W4,T),L$($,m,W)}function E1($,T){let W=r4("%Temporal.PlainDateTime%"),U=Object.create(W.prototype);return bM(U,$,T),U}function fM($,T,W){bW(T),u0($),L$($,O$,T),L$($,m,W),L$($,ZM,!0)}function p2($,T){let W=r4("%Temporal.PlainMonthDay%"),U=Object.create(W.prototype);return fM(U,$,T),U}function yM($,T){u0($),L$($,O4,T)}function b0($){let T=r4("%Temporal.PlainTime%"),W=Object.create(T.prototype);return yM(W,$),W}function hM($,T,W){iO(T),u0($),L$($,O$,T),L$($,m,W),L$($,QM,!0)}function d2($,T){let W=r4("%Temporal.PlainYearMonth%"),U=Object.create(W.prototype);return hM(U,$,T),U}function gM($,T){Y0(T),u0($),L$($,F$,T)}function b1($){let T=r4("%Temporal.Instant%"),W=Object.create(T.prototype);return gM(W,$),W}function mM($,T,W,U){Y0(T),u0($),L$($,F$,T),L$($,b$,W),L$($,m,U)}function s4($,T,W="iso8601"){let U=r4("%Temporal.ZonedDateTime%"),X=Object.create(U.prototype);return mM(X,$,T,W),X}function hA($){return SO.filter((T)=>$[T]!==void 0)}function PW($,T,W){let U=hA(W),X=CT($).fieldKeysToIgnore(U),Y=Object.create(null),w=hA(T);for(let G=0;G<SO.length;G++){let H,z=SO[G];w.includes(z)&&!X.includes(z)&&(H=T[z]),U.includes(z)&&(H=W[z]),H!==void 0&&(Y[z]=H)}return Y}function G1($,T,W,U){let X=CT($).dateAdd(T,W,U);return bW(X),X}function t8($,T,W,U){return CT($).dateUntil(T,W,U)}function a8($){if(Q4($)&&_6($,m))return D($,m);let T=S4($);try{return R6(T)}catch{}let W;try{({calendar:W}=G0(T))}catch{try{({calendar:W}=PM(T))}catch{try{({calendar:W}=pO(T))}catch{({calendar:W}=dO(T))}}}return W||(W="iso8601"),R6(W)}function s8($){if(_6($,m))return D($,m);let{calendar:T}=$;return T===void 0?"iso8601":a8(T)}function X0($,T){return R6($)===R6(T)}function PT($,T,W){let U=CT($);U.resolveFields(T,"date");let X=U.dateToISO(T,W);return bW(X),X}function f8($,T,W){let U=CT($);U.resolveFields(T,"year-month"),T.day=1;let X=U.dateToISO(T,W);return iO(X),X}function T9($,T,W){let U=CT($);U.resolveFields(T,"month-day");let X=U.monthDayToISOReferenceDate(T,W);return bW(X),X}function L6($){if(Q4($)&&_$($))return D($,b$);let T=S4($);if(T==="UTC")return"UTC";let{tzName:W,offsetMinutes:U}=function(Y){let{tzAnnotation:w,offset:G,z:H}=function(z){if(CM.test(z))return{tzAnnotation:z,offset:void 0,z:!1};try{let{tzAnnotation:F,offset:O,z:Q}=G0(z);if(Q||F||O)return{tzAnnotation:F,offset:O,z:Q}}catch{}jM(z)}(Y);return w?kT(w):H?kT("UTC"):G?kT(G):void 0}(T);if(U!==void 0)return oO(U);let X=W9(W);if(!X)throw new RangeError(`Unrecognized time zone ${W}`);return X.identifier}function cM($,T){if($===T)return!0;let W=kT($).offsetMinutes,U=kT(T).offsetMinutes;if(W===void 0&&U===void 0){let X=W9(T);if(!X)return!1;let Y=W9($);return!!Y&&Y.primaryIdentifier===X.primaryIdentifier}return W===U}function f0($,T){let W=kT($).offsetMinutes;return W!==void 0?60000000000*W:xO($,T)}function BO($){let T=$<0?"-":"+",W=Math.abs($),U=Math.floor(W/3600000000000),X=Math.floor(W/60000000000)%60,Y=Math.floor(W/1e9)%60,w=W%1e9;return`${T}${V9(U,X,Y,w,Y===0&&w===0?"minute":"auto")}`}function N1($,T){let W=f0($,T),{isoDate:{year:U,month:X,day:Y},time:{hour:w,minute:G,second:H,millisecond:z,microsecond:F,nanosecond:O}}=oM(T);return g8(U,X,Y,w,G,H,z,F,O+W)}function $6($,T,W){return uM(y8($,T),$,T,W)}function uM($,T,W,U){let X=$.length;if(X===1)return $[0];if(X)switch(U){case"compatible":case"earlier":return $[0];case"later":return $[X-1];case"reject":throw new RangeError("multiple instants found")}if(U==="reject")throw new RangeError("multiple instants found");let Y=l4(W),w=q.subtract(Y,vT);Y0(w);let G=f0(T,w),H=q.add(Y,vT);Y0(H);let z=f0(T,H)-G;switch(U){case"earlier":{let F=R$.fromComponents(0,0,0,0,0,-z),O=t2(W.time,F);return y8(T,B$(g6(W.isoDate.year,W.isoDate.month,W.isoDate.day+O.deltaDays),O))[0]}case"compatible":case"later":{let F=R$.fromComponents(0,0,0,0,0,z),O=t2(W.time,F),Q=y8(T,B$(g6(W.isoDate.year,W.isoDate.month,W.isoDate.day+O.deltaDays),O));return Q[Q.length-1]}}}function y8($,T){if($==="UTC")return o2(T.isoDate),[l4(T)];let W=kT($).offsetMinutes;if(W!==void 0){let U=g8(T.isoDate.year,T.isoDate.month,T.isoDate.day,T.time.hour,T.time.minute-W,T.time.second,T.time.millisecond,T.time.microsecond,T.time.nanosecond);o2(U.isoDate);let X=l4(U);return Y0(X),[X]}return o2(T.isoDate),function(U,X){let Y=l4(X),w=q.subtract(Y,vT);q.lessThan(w,I8)&&(w=Y);let G=q.add(Y,vT);q.greaterThan(G,r2)&&(G=Y);let H=xO(U,w),z=xO(U,G);return(H===z?[H]:[H,z]).map((O)=>{let Q=q.subtract(Y,q.BigInt(O)),Z=function(V,E){let{epochMilliseconds:N,time:{millisecond:J,microsecond:_,nanosecond:R}}=oM(E),{year:P,month:x,day:f,hour:h,minute:a,second:M$}=lM(V,N);return g8(P,x,f,h,a,M$,J,_,R)}(U,Q);if(a2(X,Z)===0)return Y0(Q),Q}).filter((O)=>O!==void 0)}($,T)}function LT($,T){let W=B$(T,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),U=y8($,W);if(U.length)return U[0];let X=l4(W),Y=q.subtract(X,vT);return Y0(Y),rO($,Y)}function e8($){let T;return T=$<0||$>9999?($<0?"-":"+")+b8(Math.abs($),6):b8($,4),T}function z1($){return b8($,2)}function pM($,T){let W;if(T==="auto"){if($===0)return"";W=b8($,9).replace(/0+$/,"")}else{if(T===0)return"";W=b8($,9).slice(0,T)}return`.${W}`}function V9($,T,W,U,X){let Y=`${z1($)}:${z1(T)}`;return X==="minute"||(Y+=`:${z1(W)}`,Y+=pM(U,X)),Y}function gA($,T,W){let U=T;U===void 0&&(U="UTC");let X=D($,F$),Y=h8(N1(U,X),"iso8601",W,"never"),w="Z";return T!==void 0&&(w=dM(f0(U,X))),`${Y}${w}`}function nG($,T){let W=D($,O6),U=D($,Q6),X=D($,b6),Y=D($,Z6),w=D($,D6),G=D($,V6),H=X9($),z="";W!==0&&(z+=`${Math.abs(W)}Y`),U!==0&&(z+=`${Math.abs(U)}M`),X!==0&&(z+=`${Math.abs(X)}W`),Y!==0&&(z+=`${Math.abs(Y)}D`);let F="";w!==0&&(F+=`${Math.abs(w)}H`),G!==0&&(F+=`${Math.abs(G)}M`);let O=R$.fromComponents(0,0,D($,K6),D($,E6),D($,A6),D($,f6));O.isZero()&&!["second","millisecond","microsecond","nanosecond"].includes(x0($))&&T==="auto"||(F+=`${Math.abs(O.sec)}${pM(Math.abs(O.subsec),T)}S`);let Q=`${H<0?"-":""}P${z}`;return F&&(Q=`${Q}T${F}`),Q}function mA($,T="auto"){let{year:W,month:U,day:X}=D($,O$);return`${e8(W)}-${z1(U)}-${z1(X)}${d8(D($,m),T)}`}function cA({hour:$,minute:T,second:W,millisecond:U,microsecond:X,nanosecond:Y},w){return V9($,T,W,1e6*U+1000*X+Y,w)}function h8($,T,W,U="auto"){let{isoDate:{year:X,month:Y,day:w},time:{hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}=$;return`${e8(X)}-${z1(Y)}-${z1(w)}T${V9(G,H,z,1e6*F+1000*O+Q,W)}${d8(T,U)}`}function uA($,T="auto"){let{year:W,month:U,day:X}=D($,O$),Y=`${z1(U)}-${z1(X)}`,w=D($,m);T!=="always"&&T!=="critical"&&w==="iso8601"||(Y=`${e8(W)}-${Y}`);let G=d8(w,T);return G&&(Y+=G),Y}function pA($,T="auto"){let{year:W,month:U,day:X}=D($,O$),Y=`${e8(W)}-${z1(U)}`,w=D($,m);T!=="always"&&T!=="critical"&&w==="iso8601"||(Y+=`-${z1(X)}`);let G=d8(w,T);return G&&(Y+=G),Y}function dA($,T,W="auto",U="auto",X="auto",Y=void 0){let w=D($,F$);if(Y){let{unit:F,increment:O,roundingMode:Q}=Y;w=yO(w,O,F,Q)}let G=D($,b$),H=f0(G,w),z=h8(N1(G,w),"iso8601",T,"never");return X!=="never"&&(z+=dM(H)),U!=="never"&&(z+=`[${U==="critical"?"!":""}${G}]`),z+=d8(D($,m),W),z}function oA($){return SM.test($)}function XU($){let T=Bb.exec($);if(!T)throw new RangeError(`invalid time zone offset: ${$}; must match \xB1HH:MM[:SS.SSSSSSSSS]`);return(T[1]==="-"?-1:1)*(1e9*(60*(60*+T[2]+ +(T[3]||0))+ +(T[4]||0))+ +((T[5]||0)+"000000000").slice(0,9))}var K8,Sb=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function W9($){if(K8===void 0){let Y=Intl.supportedValuesOf?.("timeZone");if(Y){K8=new Map;for(let w=0;w<Y.length;w++){let G=Y[w];K8.set(m8(G),G)}}else K8=null}let T=m8($),W=K8?.get(T);if(W)return{identifier:W,primaryIdentifier:W};try{W=qM($).resolvedOptions().timeZone}catch{return}if(T==="antarctica/south_pole"&&(W="Antarctica/McMurdo"),kb.has($))throw new RangeError(`${$} is a legacy time zone identifier from ICU. Use ${W} instead`);let U=[...T].map((Y,w)=>w===0||Sb[T[w-1]]?Y.toUpperCase():Y).join("").split("/");if(U.length===1)return T==="gb-eire"?{identifier:"GB-Eire",primaryIdentifier:W}:{identifier:T.length<=3||/[-0-9]/.test(T)?T.toUpperCase():U[0],primaryIdentifier:W};if(U[0]==="Etc")return{identifier:`Etc/${["Zulu","Greenwich","Universal"].includes(U[1])?U[1]:U[1].toUpperCase()}`,primaryIdentifier:W};if(U[0]==="Us")return{identifier:`US/${U[1]}`,primaryIdentifier:W};let X=new Map([["Act","ACT"],["Lhi","LHI"],["Nsw","NSW"],["Dar_Es_Salaam","Dar_es_Salaam"],["Port_Of_Spain","Port_of_Spain"],["Port-Au-Prince","Port-au-Prince"],["Isle_Of_Man","Isle_of_Man"],["Comodrivadavia","ComodRivadavia"],["Knox_In","Knox_IN"],["Dumontdurville","DumontDUrville"],["Mcmurdo","McMurdo"],["Denoronha","DeNoronha"],["Easterisland","EasterIsland"],["Bajanorte","BajaNorte"],["Bajasur","BajaSur"]]);return U[1]=X.get(U[1])??U[1],U.length>2&&(U[2]=X.get(U[2])??U[2]),{identifier:U.join("/"),primaryIdentifier:W}}function vW($,T){let{year:W,month:U,day:X,hour:Y,minute:w,second:G}=lM($,T),H=T%1000;return H<0&&(H+=1000),1e6*(lO({isoDate:{year:W,month:U,day:X},time:{hour:Y,minute:w,second:G,millisecond:H}})-T)}function xO($,T){return vW($,L1(T,"floor"))}function oO($){let T=$<0?"-":"+",W=Math.abs($);return`${T}${V9(Math.floor(W/60),W%60,0,0,"minute")}`}function dM($){return oO(RT($,Nb,"halfExpand")/60000000000)}function lO({isoDate:{year:$,month:T,day:W},time:{hour:U,minute:X,second:Y,millisecond:w}}){let G=$%400,H=($-G)/400,z=new Date;return z.setUTCHours(U,X,Y,w),z.setUTCFullYear(G,T-1,W),z.getTime()+_b*H}function l4($){let T=lO($),W=1000*$.time.microsecond+$.time.nanosecond;return q.add(f1(T),q.BigInt(W))}function oM($){let T=L1($,"trunc"),W=q.toNumber(q.remainder($,u8));W<0&&(W+=1e6,T-=1);let U=Math.floor(W/1000)%1000,X=W%1000,Y=new Date(T);return{epochMilliseconds:T,isoDate:{year:Y.getUTCFullYear(),month:Y.getUTCMonth()+1,day:Y.getUTCDate()},time:{hour:Y.getUTCHours(),minute:Y.getUTCMinutes(),second:Y.getUTCSeconds(),millisecond:Y.getUTCMilliseconds(),microsecond:U,nanosecond:X}}}function rO($,T){if($==="UTC")return null;let W=L1(T,"floor");if(W<P8)return rO($,f1(P8));let U=Date.now(),X=Math.max(W,U)+366*qT*3,Y=W,w=vW($,Y),G=Y,H=w;for(;w===H&&Y<X;){if(G=Y+2*qT*7,G>vM)return null;H=vW($,G),w===H&&(Y=G)}return w===H?null:f1(WN((z)=>vW($,z),Y,G,w,H))}function IO($,T){if($==="UTC")return null;let W=L1(T,"ceil"),U=Date.now(),X=U+366*qT*3;if(W>X){let z=IO($,f1(X));if(z===null||q.lessThan(z,f1(U)))return z}if($==="Africa/Casablanca"||$==="Africa/El_Aaiun"){let z=Date.UTC(2088,0,1);if(z<W)return IO($,f1(z))}let Y=W-1;if(Y<P8)return null;let w=vW($,Y),G=Y,H=w;for(;w===H&&Y>P8;){if(G=Y-2*qT*7,G<P8)return null;H=vW($,G),w===H&&(Y=G)}return w===H?null:f1(WN((z)=>vW($,z),G,Y,H,w))}function lM($,T){return function(W){let U=W.split(/[^\w]+/);if(U.length!==7)throw new RangeError(`expected 7 parts in "${W}`);let X=+U[0],Y=+U[1],w=+U[2],G=U[3];if(G[0]==="b"||G[0]==="B")w=1-w;else if(G[0]!=="a"&&G[0]!=="A")throw new RangeError(`Unknown era ${G} in "${W}`);let H=U[4]==="24"?0:+U[4],z=+U[5],F=+U[6];if(!(Number.isFinite(w)&&Number.isFinite(X)&&Number.isFinite(Y)&&Number.isFinite(H)&&Number.isFinite(z)&&Number.isFinite(F)))throw new RangeError(`Invalid number in "${W}`);return{year:w,month:X,day:Y,hour:H,minute:z,second:F}}(qM($).format(T))}function U9($){return $!==void 0&&!($%4!=0||$%100==0&&$%400!=0)}function qW($,T){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[U9($)?"leapyear":"standard"][T-1]}function X9($){let T=[D($,O6),D($,Q6),D($,b6),D($,Z6),D($,D6),D($,V6),D($,K6),D($,E6),D($,A6),D($,f6)];for(let W=0;W<T.length;W++){let U=T[W];if(U!==0)return U<0?-1:1}return 0}function K9($){let T=["years","months","weeks","days"];for(let W=0;W<T.length;W++){let U=$[T[W]];if(U!==0)return U<0?-1:1}return 0}function rM($){let T=K9($.date);return T!==0?T:$.time.sign()}function kW($,T){let W=$,U=T;if(!Number.isFinite(W)||!Number.isFinite(U))throw new RangeError("infinity is out of range");return U-=1,W+=Math.floor(U/12),U%=12,U<0&&(U+=12),U+=1,{year:W,month:U}}function g6($,T,W){let U=$,X=T,Y=W;if(!Number.isFinite(Y))throw new RangeError("infinity is out of range");({year:U,month:X}=kW(U,X));let w=146097;if(Math.abs(Y)>w){let z=Math.trunc(Y/w);U+=400*z,Y-=z*w}let G=0,H=X>2?U:U-1;for(;G=U9(H)?366:365,Y<-G;)U-=1,H-=1,Y+=G;for(H+=1;G=U9(H)?366:365,Y>G;)U+=1,H+=1,Y-=G;for(;Y<1;)({year:U,month:X}=kW(U,X-1)),Y+=qW(U,X);for(;Y>qW(U,X);)Y-=qW(U,X),{year:U,month:X}=kW(U,X+1);return{year:U,month:X,day:Y}}function g8($,T,W,U,X,Y,w,G,H){let z=JT(U,X,Y,w,G,H);return B$(g6($,T,W+z.deltaDays),z)}function JT($,T,W,U,X,Y){let w,G=$,H=T,z=W,F=U,O=X,Q=Y;({div:w,mod:Q}=u2(Q,3)),O+=w,Q<0&&(O-=1,Q+=1000),{div:w,mod:O}=u2(O,3),F+=w,O<0&&(F-=1,O+=1000),z+=Math.trunc(F/1000),F%=1000,F<0&&(z-=1,F+=1000),H+=Math.trunc(z/60),z%=60,z<0&&(H-=1,z+=60),G+=Math.trunc(H/60),H%=60,H<0&&(G-=1,H+=60);let Z=Math.trunc(G/24);return G%=24,G<0&&(Z-=1,G+=24),Z+=0,G+=0,H+=0,z+=0,F+=0,O+=0,Q+=0,{deltaDays:Z,hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}function lA($,T){let W=e4($,0);if(K9(W)===0)return $.days;let U=D(T,O$),X=G1(D(T,m),U,W,"constrain"),Y=jW(U.year,U.month-1,U.day),w=jW(X.year,X.month-1,X.day)-Y;return $.days+w}function m6($){return new(r4("%Temporal.Duration%"))(-D($,O6),-D($,Q6),-D($,b6),-D($,Z6),-D($,D6),-D($,V6),-D($,K6),-D($,E6),-D($,A6),-D($,f6))}function M6($,T,W){return Math.min(W,Math.max(T,$))}function nM($,T,W){let U=M6(T,1,12);return{year:$,month:U,day:M6(W,1,qW($,U))}}function g4($,T,W){if($<T||$>W)throw new RangeError(`value out of range: ${T} <= ${$} <= ${W}`)}function CW($,T,W){g4(T,1,12),g4(W,1,qW($,T))}function bW($){SW(B$($,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function E9($,T,W,U,X,Y){g4($,0,23),g4(T,0,59),g4(W,0,59),g4(U,0,999),g4(X,0,999),g4(Y,0,999)}function nO($,T,W,U,X,Y,w,G,H){CW($,T,W),E9(U,X,Y,w,G,H)}function SW($){let T=l4($);(q.lessThan(T,Lb)||q.greaterThan(T,Jb))&&Y0(T)}function bO($){l4($)}function Y0($){if(q.lessThan($,I8)||q.greaterThan($,r2))throw new RangeError("date/time value is outside of supported range")}function iO({year:$,month:T}){g4($,BA,xA),$===BA?g4(T,4,12):$===xA&&g4(T,1,9)}function A9($,T,W,U,X,Y,w,G,H,z){let F=0,O=[$,T,W,U,X,Y,w,G,H,z];for(let J=0;J<O.length;J++){let _=O[J];if(_===1/0||_===-1/0)throw new RangeError("infinite values not allowed as duration fields");if(_!==0){let R=_<0?-1:1;if(F!==0&&R!==F)throw new RangeError("mixed-sign values not allowed as duration fields");F=R}}if(Math.abs($)>=4294967296||Math.abs(T)>=4294967296||Math.abs(W)>=4294967296)throw new RangeError("years, months, and weeks must be < 2\xB3\xB2");let Q=u2(G,3),Z=u2(H,6),V=u2(z,9),E=u2(1e6*Q.mod+1000*Z.mod+V.mod,9).div,N=86400*U+3600*X+60*Y+w+Q.div+Z.div+V.div+E;if(!Number.isSafeInteger(N))throw new RangeError("total of duration time units cannot exceed 9007199254740991.999999999 s")}function c2($){return{date:{years:D($,O6),months:D($,Q6),weeks:D($,b6),days:D($,Z6)},time:R$.fromComponents(D($,D6),D($,V6),D($,K6),D($,E6),D($,A6),D($,f6))}}function W0($){let T=R$.fromComponents(D($,D6),D($,V6),D($,K6),D($,E6),D($,A6),D($,f6)).add24HourDays(D($,Z6));return{date:{years:D($,O6),months:D($,Q6),weeks:D($,b6),days:0},time:T}}function iM($){let T=W0($),W=Math.trunc(T.time.sec/86400);return A9(T.date.years,T.date.months,T.date.weeks,W,0,0,0,0,0,0),{...T.date,days:W}}function A1($,T){let W=$.time.sign(),U=$.time.abs().subsec,X=0,Y=0,w=$.time.abs().sec,G=0,H=0,z=0;switch(T){case"year":case"month":case"week":case"day":X=Math.trunc(U/1000),U%=1000,Y=Math.trunc(X/1000),X%=1000,w+=Math.trunc(Y/1000),Y%=1000,G=Math.trunc(w/60),w%=60,H=Math.trunc(G/60),G%=60,z=Math.trunc(H/24),H%=24;break;case"hour":X=Math.trunc(U/1000),U%=1000,Y=Math.trunc(X/1000),X%=1000,w+=Math.trunc(Y/1000),Y%=1000,G=Math.trunc(w/60),w%=60,H=Math.trunc(G/60),G%=60;break;case"minute":X=Math.trunc(U/1000),U%=1000,Y=Math.trunc(X/1000),X%=1000,w+=Math.trunc(Y/1000),Y%=1000,G=Math.trunc(w/60),w%=60;break;case"second":X=Math.trunc(U/1000),U%=1000,Y=Math.trunc(X/1000),X%=1000,w+=Math.trunc(Y/1000),Y%=1000;break;case"millisecond":X=Math.trunc(U/1000),U%=1000,Y=EO(w,3,Math.trunc(X/1000)),X%=1000,w=0;break;case"microsecond":X=EO(w,6,Math.trunc(U/1000)),U%=1000,w=0;break;case"nanosecond":U=EO(w,9,U),w=0}return new(r4("%Temporal.Duration%"))($.date.years,$.date.months,$.date.weeks,$.date.days+W*z,W*H,W*G,W*w,W*Y,W*X,W*U)}function h0($,T){return K9($),T.sign(),{date:$,time:T}}function jW($,T,W){return lO({isoDate:{year:$,month:T+1,day:W},time:{hour:0,minute:0,second:0,millisecond:0}})/qT}function o2({year:$,month:T,day:W}){if(Math.abs(jW($,T-1,W))>1e8)throw new RangeError("date/time value is outside the supported range")}function tO($,T){let W=T.hour-$.hour,U=T.minute-$.minute,X=T.second-$.second,Y=T.millisecond-$.millisecond,w=T.microsecond-$.microsecond,G=T.nanosecond-$.nanosecond;return R$.fromComponents(W,U,X,Y,w,G)}function aO($,T,W,U,X){let Y=R$.fromEpochNsDiff(T,$);return Y=Y9(Y,W,U,X),h0({years:0,months:0,weeks:0,days:0},Y)}function tM($,T,W,U){bO($),bO(T);let X=tO($.time,T.time),Y=X.sign(),w=w0($.isoDate,T.isoDate),G=T.isoDate;w===Y&&(G=g6(G.year,G.month,G.day+Y),X=X.add24HourDays(-Y));let H=y0("day",U),z=t8(W,$.isoDate,G,H);return U!==H&&(X=X.add24HourDays(z.days),z.days=0),h0(z,X)}function aM($,T,W,U,X){let Y=q.subtract(T,$);if(q.equal(Y,Y1))return{date:{years:0,months:0,weeks:0,days:0},time:R$.ZERO};let w=q.lessThan(Y,Y1)?-1:1,G=N1(W,$),H=N1(W,T),z,F=0,O=w===1?2:1,Q=tO(G.time,H.time);for(Q.sign()===-w&&F++;F<=O;F++){z=B$(g6(H.isoDate.year,H.isoDate.month,H.isoDate.day-F*w),G.time);let V=$6(W,z,"compatible");if(Q=R$.fromEpochNsDiff(T,V),Q.sign()!==-w)break}let Z=y0("day",X);return h0(t8(U,G.isoDate,z.isoDate,Z),Q)}function sM($,T,W,U,X,Y,w,G,H){let z,F,O,Q,Z=T;switch(G){case"year":{let n=RT(Z.date.years,w,"trunc");z=n,F=n+w*$,O={years:z,months:0,weeks:0,days:0},Q={...O,years:F};break}case"month":{let n=RT(Z.date.months,w,"trunc");z=n,F=n+w*$,O=e4(Z.date,0,0,z),Q=e4(Z.date,0,0,F);break}case"week":{let n=e4(Z.date,0,0),Y$=G1(Y,U.isoDate,n,"constrain"),j$=t8(Y,Y$,g6(Y$.year,Y$.month,Y$.day+Z.date.days),"week"),s$=RT(Z.date.weeks+j$.weeks,w,"trunc");z=s$,F=s$+w*$,O=e4(Z.date,0,z),Q=e4(Z.date,0,F);break}case"day":{let n=RT(Z.date.days,w,"trunc");z=n,F=n+w*$,O=e4(Z.date,z),Q=e4(Z.date,F);break}}let V=G1(Y,U.isoDate,O,"constrain"),E=G1(Y,U.isoDate,Q,"constrain"),N,J,_=B$(V,U.time),R=B$(E,U.time);X?(N=$6(X,_,"compatible"),J=$6(X,R,"compatible")):(N=l4(_),J=l4(R));let P=R$.fromEpochNsDiff(W,N),x=R$.fromEpochNsDiff(J,N),f=H9(H,$<0?"negative":"positive"),h=P.add(P).abs().subtract(x.abs()).sign(),a=Math.abs(z)/w%2==0,M$=P.isZero()?Math.abs(z):P.cmp(x)?F9(Math.abs(z),Math.abs(F),h,a,f):Math.abs(F),S=new R$(q.add(q.multiply(x.totalNs,q.BigInt(z)),q.multiply(P.totalNs,q.BigInt(w*$)))).fdiv(x.totalNs),W$=M$===Math.abs(F);return Z={date:W$?Q:O,time:R$.ZERO},{nudgeResult:{duration:Z,nudgedEpochNs:W$?J:N,didExpandCalendarUnit:W$},total:S}}function M9($,T,W,U,X,Y,w,G,H){let z=$,F=$0(G)||U&&G==="day",O=rM(z)<0?-1:1,Q;return F?{nudgeResult:Q}=sM(O,z,T,W,U,X,w,G,H):Q=U?function(Z,V,E,N,J,_,R,P){let x=V,f=G1(J,E.isoDate,x.date,"constrain"),h=B$(f,E.time),a=B$(g6(f.year,f.month,f.day+Z),E.time),M$=$6(N,h,"compatible"),S=$6(N,a,"compatible"),W$=R$.fromEpochNsDiff(S,M$);if(W$.sign()!==Z)throw new RangeError("time zone returned inconsistent Instants");let n=q.BigInt(i2[R]*_),Y$=x.time.round(n,P),j$=Y$.subtract(W$),s$=j$.sign()!==-Z,f4,n6;return s$?(f4=Z,Y$=j$.round(n,P),n6=Y$.addToEpochNs(S)):(f4=0,n6=Y$.addToEpochNs(M$)),{duration:h0(e4(x.date,x.date.days+f4),Y$),nudgedEpochNs:n6,didExpandCalendarUnit:s$}}(O,z,W,U,X,w,G,H):function(Z,V,E,N,J,_){let R=Z,P=R.time.add24HourDays(R.date.days),x=P.round(q.BigInt(N*i2[J]),_),f=x.subtract(P),{quotient:h}=P.divmod(sG),{quotient:a}=x.divmod(sG),M$=Math.sign(a-h)===P.sign(),S=f.addToEpochNs(V),W$=0,n=x;return I0(E)==="date"&&(W$=a,n=x.add(R$.fromComponents(24*-a,0,0,0,0,0))),{duration:{date:e4(R.date,W$),time:n},nudgedEpochNs:S,didExpandCalendarUnit:M$}}(z,T,Y,w,G,H),z=Q.duration,Q.didExpandCalendarUnit&&G!=="week"&&(z=function(Z,V,E,N,J,_,R,P){let x=V;if(P===R)return x;let f=C8.indexOf(R);for(let h=C8.indexOf(P)-1;h>=f;h--){let a=C8[h];if(a==="week"&&R!=="week")continue;let M$;switch(a){case"year":M$={years:x.date.years+Z,months:0,weeks:0,days:0};break;case"month":{let n=x.date.months+Z;M$=e4(x.date,0,0,n);break}case"week":{let n=x.date.weeks+Z;M$=e4(x.date,0,n);break}}let S=B$(G1(_,N.isoDate,M$,"constrain"),N.time),W$;if(W$=J?$6(J,S,"compatible"):l4(S),tG(E,W$)===-Z)break;x={date:M$,time:R$.ZERO}}return x}(O,z,Q.nudgedEpochNs,W,U,X,Y,y0(G,"day"))),z}function rA($,T,W,U,X,Y){return $0(Y)||U&&Y==="day"?sM(rM($)<0?-1:1,$,T,W,U,X,1,Y,"trunc").total:B8($.time.add24HourDays($.date.days),Y)}function eM($,T,W,U,X,Y,w){if(a2($,T)==0)return{date:{years:0,months:0,weeks:0,days:0},time:R$.ZERO};SW($),SW(T);let G=tM($,T,W,U);return Y==="nanosecond"&&X===1?G:M9(G,l4(T),$,null,W,U,X,Y,w)}function $N($,T,W,U,X,Y,w,G){if(I0(X)==="time")return aO($,T,Y,w,G);let H=aM($,T,W,U,X);return w==="nanosecond"&&Y===1?H:M9(H,T,N1(W,$),W,U,X,Y,w,G)}function YU($,T,W,U,X,Y){let w=n2.reduce((Z,V)=>{let E=V[0],N=V[1],J=V[2];return W!=="datetime"&&J!==W||U.includes(N)||Z.push(N,E),Z},[]),G=h6(T,"largestUnit",W,"auto");if(U.includes(G))throw new RangeError(`largestUnit must be one of ${w.join(", ")}, not ${G}`);let H=WU(T),z=y1(T,"trunc");$==="since"&&(z=function(Z){switch(Z){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return Z}}(z));let F=h6(T,"smallestUnit",W,X);if(U.includes(F))throw new RangeError(`smallestUnit must be one of ${w.join(", ")}, not ${F}`);let O=y0(Y,F);if(G==="auto"&&(G=O),y0(G,F)!==G)throw new RangeError(`largestUnit ${G} cannot be smaller than smallestUnit ${F}`);let Q={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[F];return Q!==void 0&&UU(H,Q,!1),{largestUnit:G,roundingIncrement:H,roundingMode:z,smallestUnit:F}}function nA($,T,W,U){let X=_8(W),Y=YU($,$$(U),"time",[],"nanosecond","second"),w=A1(aO(D(T,F$),D(X,F$),Y.roundingIncrement,Y.smallestUnit,Y.roundingMode),Y.largestUnit);return $==="since"&&(w=m6(w)),w}function iA($,T,W,U){let X=L8(W),Y=D(T,m),w=D(X,m);if(!X0(Y,w))throw new RangeError(`cannot compute difference between dates of ${Y} and ${w} calendars`);let G=YU($,$$(U),"date",[],"day","day"),H=r4("%Temporal.Duration%"),z=D(T,O$),F=D(X,O$);if(w0(z,F)===0)return new H;let O={date:t8(Y,z,F,G.largestUnit),time:R$.ZERO};if(G.smallestUnit!=="day"||G.roundingIncrement!==1){let Z=B$(z,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});O=M9(O,l4(B$(F,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),Z,null,Y,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode)}let Q=A1(O,"day");return $==="since"&&(Q=m6(Q)),Q}function tA($,T,W,U){let X=J8(W),Y=D(T,m),w=D(X,m);if(!X0(Y,w))throw new RangeError(`cannot compute difference between dates of ${Y} and ${w} calendars`);let G=YU($,$$(U),"datetime",[],"nanosecond","day"),H=r4("%Temporal.Duration%"),z=D(T,W4),F=D(X,W4);if(a2(z,F)===0)return new H;let O=A1(eM(z,F,Y,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode),G.largestUnit);return $==="since"&&(O=m6(O)),O}function aA($,T,W,U){let X=_T(W),Y=YU($,$$(U),"time",[],"nanosecond","hour"),w=tO(D(T,O4),D(X,O4));w=Y9(w,Y.roundingIncrement,Y.smallestUnit,Y.roundingMode);let G=A1(h0({years:0,months:0,weeks:0,days:0},w),Y.largestUnit);return $==="since"&&(G=m6(G)),G}function sA($,T,W,U){let X=R8(W),Y=D(T,m),w=D(X,m);if(!X0(Y,w))throw new RangeError(`cannot compute difference between months of ${Y} and ${w} calendars`);let G=YU($,$$(U),"date",["week","day"],"month","year"),H=r4("%Temporal.Duration%");if(w0(D(T,O$),D(X,O$))==0)return new H;let z=J6(Y,D(T,O$),"year-month");z.day=1;let F=PT(Y,z,"constrain"),O=J6(Y,D(X,O$),"year-month");O.day=1;let Q=PT(Y,O,"constrain"),Z={date:e4(t8(Y,F,Q,G.largestUnit),0,0),time:R$.ZERO};if(G.smallestUnit!=="month"||G.roundingIncrement!==1){let E=B$(F,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});Z=M9(Z,l4(B$(Q,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),E,null,Y,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode)}let V=A1(Z,"day");return $==="since"&&(V=m6(V)),V}function eA($,T,W,U){let X=k8(W),Y=D(T,m),w=D(X,m);if(!X0(Y,w))throw new RangeError(`cannot compute difference between dates of ${Y} and ${w} calendars`);let G=YU($,$$(U),"datetime",[],"nanosecond","hour"),H=D(T,F$),z=D(X,F$),F=r4("%Temporal.Duration%"),O;if(I0(G.largestUnit)!=="date")O=A1(aO(H,z,G.roundingIncrement,G.smallestUnit,G.roundingMode),G.largestUnit);else{let Q=D(T,b$);if(!cM(Q,D(X,b$)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");if(q.equal(H,z))return new F;O=A1($N(H,z,Q,Y,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode),"hour")}return $==="since"&&(O=m6(O)),O}function t2({hour:$,minute:T,second:W,millisecond:U,microsecond:X,nanosecond:Y},w){let G=W,H=Y;return G+=w.sec,H+=w.subsec,JT($,T,G,U,X,H)}function fO($,T){let W=T.addToEpochNs($);return Y0(W),W}function v8($,T,W,U,X="constrain"){if(K9(U.date)===0)return fO($,U.time);let Y=N1(T,$);return fO($6(T,B$(G1(W,Y.isoDate,U.date,X),Y.time),"compatible"),U.time)}function $M($,T,W){let U=M1(W);$==="subtract"&&(U=m6(U));let X=y0(x0(T),x0(U));if($0(X))throw new RangeError("For years, months, or weeks arithmetic, use date arithmetic relative to a starting point");let Y=W0(T),w=W0(U);return A1(h0({years:0,months:0,weeks:0,days:0},Y.time.add(w.time)),X)}function TM($,T,W){let U=M1(W);$==="subtract"&&(U=m6(U));let X=x0(U);if(I0(X)==="date")throw new RangeError(`Duration field ${X} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let Y=W0(U);return b1(fO(D(T,F$),Y.time))}function WM($,T,W,U){let X=D(T,m),Y=M1(W);$==="subtract"&&(Y=m6(Y));let w=iM(Y),G=C$($$(U));return N6(G1(X,D(T,O$),w,G),X)}function UM($,T,W,U){let X=M1(W);$==="subtract"&&(X=m6(X));let Y=C$($$(U)),w=D(T,m),G=W0(X),H=D(T,W4),z=t2(H.time,G.time),F=e4(G.date,z.deltaDays);return A9(F.years,F.months,F.weeks,F.days,0,0,0,0,0,0),E1(B$(G1(w,H.isoDate,F,Y),z),w)}function XM($,T,W){let U=M1(W);$==="subtract"&&(U=m6(U));let X=W0(U),{hour:Y,minute:w,second:G,millisecond:H,microsecond:z,nanosecond:F}=t2(D(T,O4),X.time);return b0(D9(Y,w,G,H,z,F,"reject"))}function YM($,T,W,U){let X=M1(W);$==="subtract"&&(X=m6(X));let Y=C$($$(U)),w=X9(X),G=D(T,m),H=J6(G,D(T,O$),"year-month");H.day=1;let z=PT(G,H,"constrain");if(w<0){let O=G1(G,z,{months:1},"constrain");z=g6(O.year,O.month,O.day-1)}let F=iM(X);return bW(z),d2(f8(G,J6(G,G1(G,z,F,Y),"year-month"),Y),G)}function wM($,T,W,U){let X=M1(W);$==="subtract"&&(X=m6(X));let Y=C$($$(U)),w=D(T,b$),G=D(T,m),H=c2(X);return s4(v8(D(T,F$),w,G,H,Y),w,G)}function RT($,T,W){let U=Math.trunc($/T),X=$%T,Y=$<0?"negative":"positive",w=Math.abs(U),G=w+1,H=y6(Math.abs(2*X)-T),z=w%2==0,F=H9(W,Y),O=X===0?w:F9(w,G,H,z,F);return T*(Y==="positive"?O:-O)}function yO($,T,W,U){let X=i2[W]*T;return function(Y,w,G){let H=B0(Y),z=B0(w),F=q.divide(H,z),O=q.remainder(H,z),Q=H9(G,"positive"),Z,V;q.lessThan(H,Y1)?(Z=q.subtract(F,x8),V=F):(Z=F,V=q.add(F,x8));let E=tG(RW(q.multiply(O,uO)),z)*(q.lessThan(H,Y1)?-1:1)+0,N=q.equal(O,Y1)?F:F9(Z,V,E,FM(Z),Q);return q.multiply(N,z)}($,q.BigInt(X),U)}function hO($,T,W,U){bO($);let{year:X,month:Y,day:w}=$.isoDate,G=gO($.time,T,W,U);return B$(g6(X,Y,w+G.deltaDays),G)}function gO({hour:$,minute:T,second:W,millisecond:U,microsecond:X,nanosecond:Y},w,G,H){let z;switch(G){case"day":case"hour":z=1000*(1000*(1000*(60*(60*$+T)+W)+U)+X)+Y;break;case"minute":z=1000*(1000*(1000*(60*T+W)+U)+X)+Y;break;case"second":z=1000*(1000*(1000*W+U)+X)+Y;break;case"millisecond":z=1000*(1000*U+X)+Y;break;case"microsecond":z=1000*X+Y;break;case"nanosecond":z=Y}let F=i2[G],O=RT(z,F*w,H)/F;switch(G){case"day":return{deltaDays:O,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return JT(O,0,0,0,0,0);case"minute":return JT($,O,0,0,0,0);case"second":return JT($,T,O,0,0,0);case"millisecond":return JT($,T,W,O,0,0);case"microsecond":return JT($,T,W,U,O,0);case"nanosecond":return JT($,T,W,U,X,O);default:throw new Error(`Invalid unit ${G}`)}}function Y9($,T,W,U){let X=i2[W];return $.round(q.BigInt(X*T),U)}function B8($,T){let W=i2[T];return $.fdiv(q.BigInt(W))}function w0($,T){return $.year!==T.year?y6($.year-T.year):$.month!==T.month?y6($.month-T.month):$.day!==T.day?y6($.day-T.day):0}function mO($,T){return $.hour!==T.hour?y6($.hour-T.hour):$.minute!==T.minute?y6($.minute-T.minute):$.second!==T.second?y6($.second-T.second):$.millisecond!==T.millisecond?y6($.millisecond-T.millisecond):$.microsecond!==T.microsecond?y6($.microsecond-T.microsecond):$.nanosecond!==T.nanosecond?y6($.nanosecond-T.nanosecond):0}function a2($,T){let W=w0($.isoDate,T.isoDate);return W!==0?W:mO($.time,T.time)}function TN($){let T=w9($);return globalThis.BigInt!==void 0?globalThis.BigInt(T.toString(10)):T}function L1($,T){let W=B0($),{quotient:U,remainder:X}=M8(W,u8),Y=q.toNumber(U);return T==="floor"&&q.toNumber(X)<0&&(Y-=1),T==="ceil"&&q.toNumber(X)>0&&(Y+=1),Y}function f1($){if(!Number.isInteger($))throw new RangeError("epoch milliseconds must be an integer");return q.multiply(q.BigInt($),u8)}function w9($){let T=$;if(typeof $=="object"){let W=$[Symbol.toPrimitive];W&&typeof W=="function"&&(T=W.call($,"number"))}if(typeof T=="number")throw new TypeError("cannot convert number to bigint");return typeof T=="bigint"?q.BigInt(T.toString(10)):q.BigInt(T)}var cO=(()=>{let $=q.BigInt(Date.now()%1e6);return()=>{let T=Date.now(),W=q.BigInt(T),U=q.add(f1(T),$);return $=q.remainder(W,u8),q.greaterThan(U,r2)?r2:q.lessThan(U,I8)?I8:U}})();function E8(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function y6($){return $<0?-1:$>0?1:$}function $$($){if($===void 0)return Object.create(null);if(Q4($)&&$!==null)return $;throw new TypeError("Options parameter must be an object, not "+($===null?"null":typeof $))}function BW($,T){let W=Object.create(null);return W[$]=T,W}function g0($,T,W,U){let X=$[T];if(X!==void 0){if(X=Q9(X),!W.includes(X))throw new RangeError(`${T} must be one of ${W.join(", ")}, not ${X}`);return X}if(U===c0)throw new RangeError(`${T} option is required`);return U}function R6($){let T=m8($);if(!Rb.includes(m8(T)))throw new RangeError(`invalid calendar identifier ${T}`);switch(T){case"ethiopic-amete-alem":return"ethioaa";case"islamicc":return"islamic-civil"}return T}function m8($){let T="";for(let W=0;W<$.length;W++){let U=$.charCodeAt(W);T+=U>=65&&U<=90?String.fromCharCode(U+32):String.fromCharCode(U)}return T}function ST($){throw new TypeError(`Do not use built-in arithmetic operators with Temporal objects. When comparing, use ${$==="PlainMonthDay"?"Temporal.PlainDate.compare(obj1.toPlainDate(year), obj2.toPlainDate(year))":`Temporal.${$}.compare(obj1, obj2)`}, not obj1 > obj2. When coercing to strings, use \`\${obj}\` or String(obj), not '' + obj. When coercing to numbers, use properties or methods of the object, not \`+obj\`. When concatenating with strings, use \`\${str}\${obj}\` or str.concat(obj), not str + obj. In React, coerce to a string before rendering a Temporal object.`)}var jb=new RegExp(`^${RM.source}$`),Bb=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/.source}$`);function WN($,T,W,U=$(T),X=$(W)){let Y=T,w=W,G=U,H=X;for(;w-Y>1;){let z=Math.trunc((Y+w)/2),F=$(z);F===G?(Y=z,G=F):F===H&&(w=z,H=F)}return w}function UN($){return[...$]}function XN($,T){if($!=="gregory"&&$!=="iso8601")return;let W=$Y[$],U=T.year,{dayOfWeek:X,dayOfYear:Y,daysInYear:w}=W.isoToDate(T,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),G=W.getFirstDayOfWeek(),H=W.getMinimalDaysInFirstWeek(),z=(X+7-G)%7,F=(X-Y+7001-G)%7,O=Math.floor((Y-1+F)/7);if(7-F>=H&&++O,O==0)O=function(Q,Z,V,E){let N=(E-Q-V+1)%7;N<0&&(N+=7);let J=Math.floor((V+N-1)/7);return 7-N>=Z&&++J,J}(G,H,Y+W.isoToDate(W.dateAdd(T,{years:-1},"constrain"),{daysInYear:!0}).daysInYear,X),U--;else if(Y>=w-5){let Q=(z+w-Y)%7;Q<0&&(Q+=7),6-Q>=H&&Y+7-z>w&&(O=1,U++)}return{week:O,year:U}}function GM($,T,W,U,X){if(T!==X.year){if($*(T-X.year)>0)return!0}else if(W!==X.month){if($*(W-X.month)>0)return!0}else if(U!==X.day&&$*(U-X.day)>0)return!0;return!1}var $Y={};function xW($){if(!$.startsWith("M"))throw new RangeError(`Invalid month code: ${$}. Month codes must start with M.`);let T=+$.slice(1);if(Number.isNaN(T))throw new RangeError(`Invalid month code: ${$}`);return T}function U0($,T=!1){return`M${`${$}`.padStart(2,"0")}${T?"L":""}`}function sO($,T=void 0,W=12){let{month:U,monthCode:X}=$;if(X===void 0){if(U===void 0)throw new TypeError("Either month or monthCode are required");T==="reject"&&g4(U,1,W),T==="constrain"&&(U=M6(U,1,W)),X=U0(U)}else{let Y=xW(X);if(X!==U0(Y))throw new RangeError(`Invalid month code: ${X}`);if(U!==void 0&&U!==Y)throw new RangeError(`monthCode ${X} and month ${U} must match if both are present`);if(U=Y,U<1||U>W)throw new RangeError(`Invalid monthCode: ${X}`)}return{...$,month:U,monthCode:X}}$Y.iso8601={resolveFields($,T){if((T==="date"||T==="year-month")&&$.year===void 0)throw new TypeError("year is required");if((T==="date"||T==="month-day")&&$.day===void 0)throw new TypeError("day is required");Object.assign($,sO($))},dateToISO:($,T)=>S8($.year,$.month,$.day,T),monthDayToISOReferenceDate($,T){let{month:W,day:U}=S8($.year??1972,$.month,$.day,T);return{month:W,day:U,year:1972}},extraFields:()=>[],fieldKeysToIgnore($){let T=new Set;for(let W=0;W<$.length;W++){let U=$[W];T.add(U),U==="month"?T.add("monthCode"):U==="monthCode"&&T.add("month")}return UN(T)},dateAdd($,{years:T=0,months:W=0,weeks:U=0,days:X=0},Y){let{year:w,month:G,day:H}=$;return w+=T,G+=W,{year:w,month:G}=kW(w,G),{year:w,month:G,day:H}=S8(w,G,H,Y),H+=X+7*U,g6(w,G,H)},dateUntil($,T,W){let U=-w0($,T);if(U===0)return{years:0,months:0,weeks:0,days:0};let X,Y=0,w=0;if(W==="year"||W==="month"){let F=T.year-$.year;for(F!==0&&(F-=U);!GM(U,$.year+F,$.month,$.day,T);)Y=F,F+=U;let O=U;for(X=kW($.year+Y,$.month+O);!GM(U,X.year,X.month,$.day,T);)w=O,O+=U,X=kW(X.year,X.month+U);W==="month"&&(w+=12*Y,Y=0)}X=kW($.year+Y,$.month+w);let G=nM(X.year,X.month,$.day),H=0,z=jW(T.year,T.month-1,T.day)-jW(G.year,G.month-1,G.day);return W==="week"&&(H=Math.trunc(z/7),z%=7),{years:Y,months:w,weeks:H,days:z}},isoToDate({year:$,month:T,day:W},U){let X={era:void 0,eraYear:void 0,year:$,month:T,day:W,daysInWeek:7,monthsInYear:12};if(U.monthCode&&(X.monthCode=U0(T)),U.dayOfWeek){let Y=T+(T<3?10:-2),w=$-(T<3?1:0),G=Math.floor(w/100),H=w-100*G,z=(W+Math.floor(2.6*Y-0.2)+(H+Math.floor(H/4))+(Math.floor(G/4)-2*G))%7;X.dayOfWeek=z+(z<=0?7:0)}if(U.dayOfYear){let Y=W;for(let w=T-1;w>0;w--)Y+=qW($,w);X.dayOfYear=Y}return U.weekOfYear&&(X.weekOfYear=XN("iso8601",{year:$,month:T,day:W})),U.daysInMonth&&(X.daysInMonth=qW($,T)),(U.daysInYear||U.inLeapYear)&&(X.inLeapYear=U9($),X.daysInYear=X.inLeapYear?366:365),X},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};class h4{constructor($){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,$!==void 0){let T=0;for(let W of $.map.entries()){if(++T>h4.MAX_CACHE_ENTRIES)break;this.map.set(...W)}}}get($){let T=this.map.get($);return T&&(this.hits++,this.report()),this.calls++,T}set($,T){this.map.set($,T),this.misses++,this.report()}report(){}setObject($){if(h4.objectMap.get($))throw new RangeError("object already cached");h4.objectMap.set($,this),this.report()}static getCacheForObject($){let T=h4.objectMap.get($);return T||(T=new h4,h4.objectMap.set($,T)),T}}function YN({isoYear:$,isoMonth:T,isoDay:W}){return`${e8($)}-${z1(T)}-${z1(W)}T00:00Z`}function NO($,T){return{years:$.year-T.year,months:$.month-T.month,days:$.day-T.day}}h4.objectMap=new WeakMap,h4.MAX_CACHE_ENTRIES=1000;class jT{constructor(){this.eras=[],this.hasEra=!1,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new Intl.DateTimeFormat(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:"short",timeZone:"UTC"})),this.formatter}getCalendarParts($){let T=this.getFormatter(),W=new Date($);if($==="-271821-04-19T00:00Z"){let U=T.resolvedOptions();T=new Intl.DateTimeFormat(U.locale,{...U,timeZone:"Etc/GMT+1"}),W=new Date("-271821-04-20T00:00Z")}try{return T.formatToParts(W)}catch(U){throw new RangeError(`Invalid ISO date: ${$}`)}}isoToCalendarDate($,T){let{year:W,month:U,day:X}=$,Y=JSON.stringify({func:"isoToCalendarDate",isoYear:W,isoMonth:U,isoDay:X,id:this.id}),w=T.get(Y);if(w)return w;let G=YN({isoYear:W,isoMonth:U,isoDay:X}),H=this.getCalendarParts(G),z={};for(let O=0;O<H.length;O++){let{type:Q,value:Z}=H[O];if(Q!=="year"&&Q!=="relatedYear"||(this.hasEra?z.eraYear=+Z:z.year=+Z),Q==="month"){let V=/^([0-9]*)(.*?)$/.exec(Z);if(!V||V.length!=3||!V[1]&&!V[2])throw new RangeError(`Unexpected month: ${Z}`);if(z.month=V[1]?+V[1]:1,z.month<1)throw new RangeError(`Invalid month ${Z} from ${G}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(z.month>13)throw new RangeError(`Invalid month ${Z} from ${G}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);V[2]&&(z.monthExtra=V[2])}Q==="day"&&(z.day=+Z),this.hasEra&&Q==="era"&&Z!=null&&Z!==""&&(z.era=Z.split(" (")[0].normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(/ /g,"-").toLowerCase())}if(this.hasEra&&z.eraYear===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.hasEra){let O=this.eras.find((Q)=>z.era===Q.genericName);O&&(z.era=O.code)}if(this.reviseIntlEra){let{era:O,eraYear:Q}=this.reviseIntlEra(z,$);z.era=O,z.eraYear=Q}this.checkIcuBugs&&this.checkIcuBugs($);let F=this.adjustCalendarDate(z,T,"constrain",!0);if(F.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify($)}`);if(F.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify($)}`);if(F.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify($)}`);return T.set(Y,F),["constrain","reject"].forEach((O)=>{let Q=JSON.stringify({func:"calendarToIsoDate",year:F.year,month:F.month,day:F.day,overflow:O,id:this.id});T.set(Q,$)}),F}validateCalendarDate($){let{month:T,year:W,day:U,eraYear:X,monthCode:Y,monthExtra:w}=$;if(w!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(W===void 0&&X===void 0)throw new TypeError("year or eraYear is required");if(T===void 0&&Y===void 0)throw new TypeError("month or monthCode is required");if(U===void 0)throw new RangeError("Missing day");if(Y!==void 0){if(typeof Y!="string")throw new RangeError("monthCode must be a string, not "+typeof Y);if(!/^M([01]?\d)(L?)$/.test(Y))throw new RangeError(`Invalid monthCode: ${Y}`)}if(this.hasEra&&$.era===void 0!=($.eraYear===void 0))throw new TypeError("properties era and eraYear must be provided together")}adjustCalendarDate($,T=void 0,W="constrain",U=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let X=$;this.validateCalendarDate(X);let Y=this.monthsInYear(X,T),{month:w,monthCode:G}=X;return{month:w,monthCode:G}=sO(X,W,Y),{...X,month:w,monthCode:G}}regulateMonthDayNaive($,T,W){let U=this.monthsInYear($,W),{month:X,day:Y}=$;return T==="reject"?(g4(X,1,U),g4(Y,1,this.maximumMonthLength($))):(X=M6(X,1,U),Y=M6(Y,1,this.maximumMonthLength({...$,month:X}))),{...$,month:X,day:Y}}calendarToIsoDate($,T="constrain",W){let U=$,X=this.adjustCalendarDate($,W,T,!1);X=this.regulateMonthDayNaive(X,T,W);let{year:Y,month:w,day:G}=X,H=JSON.stringify({func:"calendarToIsoDate",year:Y,month:w,day:G,overflow:T,id:this.id}),z,F=W.get(H);if(F)return F;if(U.year!==void 0&&U.month!==void 0&&U.day!==void 0&&(U.year!==X.year||U.month!==X.month||U.day!==X.day)&&(z=JSON.stringify({func:"calendarToIsoDate",year:U.year,month:U.month,day:U.day,overflow:T,id:this.id}),F=W.get(z),F))return F;let O=this.estimateIsoDate({year:Y,month:w,day:G}),Q=(J)=>{let _=this.addDaysIso(O,J);if(X.day>this.minimumMonthLength(X)){let R=this.isoToCalendarDate(_,W);for(;R.month!==w||R.year!==Y;){if(T==="reject")throw new RangeError(`day ${G} does not exist in month ${w} of year ${Y}`);_=this.addDaysIso(_,-1),R=this.isoToCalendarDate(_,W)}}return _},Z=0,V=this.isoToCalendarDate(O,W),E=NO(X,V);if(E.years!==0||E.months!==0||E.days!==0){let J=365*E.years+30*E.months+E.days;O=this.addDaysIso(O,J),V=this.isoToCalendarDate(O,W),E=NO(X,V),E.years===0&&E.months===0?O=Q(E.days):Z=this.compareCalendarDates(X,V)}let N=8;for(;Z;){O=this.addDaysIso(O,Z*N);let J=V;V=this.isoToCalendarDate(O,W);let _=Z;if(Z=this.compareCalendarDates(X,V),Z){if(E=NO(X,V),E.years===0&&E.months===0)O=Q(E.days),Z=0;else if(_&&Z!==_)if(N>1)N/=2;else{if(T==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...U})}`);this.compareCalendarDates(V,J)>0&&(O=this.addDaysIso(O,-1)),Z=0}}}if(W.set(H,O),z&&W.set(z,O),X.year===void 0||X.month===void 0||X.day===void 0||X.monthCode===void 0||this.hasEra&&(X.era===void 0||X.eraYear===void 0))throw new RangeError("Unexpected missing property");return O}compareCalendarDates($,T){return $.year!==T.year?y6($.year-T.year):$.month!==T.month?y6($.month-T.month):$.day!==T.day?y6($.day-T.day):0}regulateDate($,T="constrain",W){let U=this.calendarToIsoDate($,T,W);return this.isoToCalendarDate(U,W)}addDaysIso($,T){return g6($.year,$.month,$.day+T)}addDaysCalendar($,T,W){let U=this.calendarToIsoDate($,"constrain",W),X=this.addDaysIso(U,T);return this.isoToCalendarDate(X,W)}addMonthsCalendar($,T,W,U){let X=$,{day:Y}=X;for(let w=0,G=Math.abs(T);w<G;w++){let{month:H}=X,z=X,F=T<0?-Math.max(Y,this.daysInPreviousMonth(X,U)):this.daysInMonth(X,U),O=this.calendarToIsoDate(X,"constrain",U),Q=this.addDaysIso(O,F);if(X=this.isoToCalendarDate(Q,U),T>0){let Z=this.monthsInYear(z,U);for(;X.month-1!=H%Z;)Q=this.addDaysIso(Q,-1),X=this.isoToCalendarDate(Q,U)}X.day!==Y&&(X=this.regulateDate({...X,day:Y},"constrain",U))}if(W==="reject"&&X.day!==Y)throw new RangeError(`Day ${Y} does not exist in resulting calendar month`);return X}addCalendar($,{years:T=0,months:W=0,weeks:U=0,days:X=0},Y,w){let{year:G,day:H,monthCode:z}=$,F=this.adjustCalendarDate({year:G+T,monthCode:z,day:H},w),O=this.addMonthsCalendar(F,W,Y,w),Q=X+7*U;return this.addDaysCalendar(O,Q,w)}untilCalendar($,T,W,U){let X=0,Y=0,w=0,G=0;switch(W){case"day":X=this.calendarDaysUntil($,T,U);break;case"week":{let H=this.calendarDaysUntil($,T,U);X=H%7,Y=(H-X)/7;break}case"month":case"year":{let H=this.compareCalendarDates(T,$);if(!H)return{years:0,months:0,weeks:0,days:0};let z=T.year-$.year,F=T.day-$.day;if(W==="year"&&z){let Z=0;T.monthCode>$.monthCode&&(Z=1),T.monthCode<$.monthCode&&(Z=-1),Z||(Z=Math.sign(F)),G=Z*H<0?z-H:z}let O,Q=G?this.addCalendar($,{years:G},"constrain",U):$;do w+=H,O=Q,Q=this.addMonthsCalendar(O,H,"constrain",U),Q.day!==$.day&&(Q=this.regulateDate({...Q,day:$.day},"constrain",U));while(this.compareCalendarDates(T,Q)*H>=0);w-=H,X=this.calendarDaysUntil(O,T,U);break}}return{years:G,months:w,weeks:Y,days:X}}daysInMonth($,T){let{day:W}=$,U=this.maximumMonthLength($),X=this.minimumMonthLength($);if(X===U)return X;let Y=W<=U-X?U:X,w=this.calendarToIsoDate($,"constrain",T),G=this.addDaysIso(w,Y),H=this.isoToCalendarDate(G,T),z=this.addDaysIso(G,-H.day);return this.isoToCalendarDate(z,T).day}daysInPreviousMonth($,T){let{day:W,month:U,year:X}=$,Y={year:U>1?X:X-1,month:U,day:1},w=U>1?U-1:this.monthsInYear(Y,T);Y={...Y,month:w};let G=this.minimumMonthLength(Y),H=this.maximumMonthLength(Y);if(G===H)return H;let z=this.calendarToIsoDate($,"constrain",T),F=this.addDaysIso(z,-W);return this.isoToCalendarDate(F,T).day}startOfCalendarYear($){return{year:$.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth($){return{year:$.year,month:$.month,day:1}}calendarDaysUntil($,T,W){let U=this.calendarToIsoDate($,"constrain",W),X=this.calendarToIsoDate(T,"constrain",W);return jW(X.year,X.month-1,X.day)-jW(U.year,U.month-1,U.day)}monthDaySearchStartYear($,T){return 1972}monthDayFromFields($,T,W){let U,X,Y,w,G,{era:H,eraYear:z,year:F,month:O,monthCode:Q,day:Z}=$;if(O!==void 0&&F===void 0&&(!this.hasEra||H===void 0||z===void 0))throw new TypeError("when month is present, year (or era and eraYear) are required");(Q===void 0||F!==void 0||this.hasEra&&z!==void 0)&&({monthCode:Q,day:Z}=this.isoToCalendarDate(this.calendarToIsoDate($,T,W),W));let V={year:this.monthDaySearchStartYear(Q,Z),month:12,day:31},E=this.isoToCalendarDate(V,W),N=E.monthCode>Q||E.monthCode===Q&&E.day>=Z?E.year:E.year-1;for(let J=0;J<20;J++){let _=this.adjustCalendarDate({day:Z,monthCode:Q,year:N-J},W),R=this.calendarToIsoDate(_,"constrain",W),P=this.isoToCalendarDate(R,W);if({year:U,month:X,day:Y}=R,P.monthCode===Q&&P.day===Z)return{month:X,day:Y,year:U};if(T==="constrain"){let x=this.maxLengthOfMonthCodeInAnyYear(P.monthCode);if(P.monthCode===Q&&P.day===x&&Z>x)return{month:X,day:Y,year:U};(w===void 0||P.monthCode===w.monthCode&&P.day>w.day)&&(w=P,G=R)}}if(T==="constrain"&&G!==void 0)return G;throw new RangeError(`No recent ${this.id} year with monthCode ${Q} and day ${Z}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}}class wN extends jT{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}}}inLeapYear($){let{year:T}=$;return(7*T+1)%19<7}monthsInYear($){return this.inLeapYear($)?13:12}minimumMonthLength($){return this.minMaxMonthLength($,"min")}maximumMonthLength($){return this.minMaxMonthLength($,"max")}minMaxMonthLength($,T){let{month:W,year:U}=$,X=this.getMonthCode(U,W),Y=Object.entries(this.months).find((G)=>G[1].monthCode===X);if(Y===void 0)throw new RangeError(`unmatched Hebrew month: ${W}`);let w=Y[1].days;return typeof w=="number"?w:w[T]}maxLengthOfMonthCodeInAnyYear($){return["M04","M06","M08","M10","M12"].includes($)?29:30}estimateIsoDate($){let{year:T}=$;return{year:T-3760,month:1,day:1}}getMonthCode($,T){return this.inLeapYear({year:$})?T===6?U0(5,!0):U0(T<6?T:T-1):U0(T)}adjustCalendarDate($,T,W="constrain",U=!1){let{year:X,month:Y,monthCode:w,day:G,monthExtra:H}=$;if(X===void 0)throw new TypeError("Missing property: year");if(U){if(H){let z=this.months[H];if(!z)throw new RangeError(`Unrecognized month from formatToParts: ${H}`);Y=this.inLeapYear({year:X})?z.leap:z.regular}return w=this.getMonthCode(X,Y),{year:X,month:Y,day:G,monthCode:w}}if(this.validateCalendarDate($),Y===void 0)if(w.endsWith("L")){if(w!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${w}`);if(Y=6,!this.inLeapYear({year:X})){if(W==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${X} which is not a leap year`);Y=6,w="M06"}}else{Y=xW(w),this.inLeapYear({year:X})&&Y>=6&&Y++;let z=this.monthsInYear({year:X});if(Y<1||Y>z)throw new RangeError(`Invalid monthCode: ${w}`)}else if(W==="reject"?(g4(Y,1,this.monthsInYear({year:X})),g4(G,1,this.maximumMonthLength({year:X,month:Y}))):(Y=M6(Y,1,this.monthsInYear({year:X})),G=M6(G,1,this.maximumMonthLength({year:X,month:Y}))),w===void 0)w=this.getMonthCode(X,Y);else if(this.getMonthCode(X,Y)!==w)throw new RangeError(`monthCode ${w} doesn't correspond to month ${Y} in Hebrew year ${X}`);return{...$,day:G,month:Y,monthCode:w,year:X}}}class fW extends jT{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354.3666666666667,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear($,T){let W={year:$.year,month:1,monthCode:"M01",day:1},U={year:$.year+1,month:1,monthCode:"M01",day:1};return this.calendarDaysUntil(W,U,T)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate($){let{year:T}=this.adjustCalendarDate($);return{year:Math.floor(T*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class GN extends fW{constructor(){super(...arguments),this.id="islamic"}}class zN extends fW{constructor(){super(...arguments),this.id="islamic-umalqura"}}class HN extends fW{constructor(){super(...arguments),this.id="islamic-tbla"}}class FN extends fW{constructor(){super(...arguments),this.id="islamic-civil"}}class ON extends fW{constructor(){super(...arguments),this.id="islamic-rgsa"}}class QN extends fW{constructor(){super(...arguments),this.id="islamicc"}}class ZN extends jT{constructor(){super(...arguments),this.id="persian",this.calendarType="solar"}inLeapYear($,T){return this.daysInMonth({year:$.year,month:12,day:1},T)===30}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===12?29:T<=6?31:30}maximumMonthLength($){let{month:T}=$;return T===12?30:T<=6?31:30}maxLengthOfMonthCodeInAnyYear($){return xW($)<=6?31:30}estimateIsoDate($){let{year:T}=this.adjustCalendarDate($);return{year:T+621,month:1,day:1}}}class DN extends jT{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"})!=="10/11/-79 Saka"}inLeapYear($){return eO($.year+78)}monthsInYear(){return 12}minimumMonthLength($){return this.getMonthInfo($).length}maximumMonthLength($){return this.getMonthInfo($).length}maxLengthOfMonthCodeInAnyYear($){let T=xW($),W=this.months[T];return W=W.leap??W,W.length}getMonthInfo($){let{month:T}=$,W=this.months[T];if(W===void 0)throw new RangeError(`Invalid month: ${T}`);return this.inLeapYear($)&&W.leap&&(W=W.leap),W}estimateIsoDate($){let T=this.adjustCalendarDate($),W=this.getMonthInfo(T);return g6(T.year+78+(W.nextYear?1:0),W.month,W.day+T.day-1)}checkIcuBugs($){if(this.vulnerableToBceBug&&$.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}}function eO($){return $%4==0&&($%100!=0||$%400==0)}class $Q extends jT{constructor($,T){super(),this.calendarType="solar",this.id=$,this.isoEpoch=T}inLeapYear($){let{year:T}=this.estimateIsoDate({month:1,day:1,year:$.year});return eO(T)}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(T)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][xW($)-1]}estimateIsoDate($){let T=this.adjustCalendarDate($);return S8(T.year+this.isoEpoch.year,T.month+this.isoEpoch.month,T.day+this.isoEpoch.day,"constrain")}}class TQ extends jT{constructor($,T){super(),this.hasEra=!0,this.calendarType="solar",this.id=$;let{eras:W,anchorEra:U}=function(X){let Y,w=X;if(w.length===0)throw new RangeError("Invalid era data: eras are required");if(w.length===1&&w[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(w.length===1&&!w[0].code)throw new RangeError("Invalid era data: at least one named era is required");if(w.filter((H)=>H.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");w.forEach((H)=>{if(H.isAnchor||!H.anchorEpoch&&!H.reverseOf){if(Y)throw new RangeError("Invalid era data: cannot have multiple anchor eras");Y=H,H.anchorEpoch={year:H.hasYearZero?0:1}}else if(!H.code)throw new RangeError("If era name is blank, it must be the anchor era")}),w=w.filter((H)=>H.code),w.forEach((H)=>{let{reverseOf:z}=H;if(z){let F=w.find((O)=>O.code===z);if(F===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${z}`);H.reverseOf=F,H.anchorEpoch=F.anchorEpoch,H.isoEpoch=F.isoEpoch}H.anchorEpoch.month===void 0&&(H.anchorEpoch.month=1),H.anchorEpoch.day===void 0&&(H.anchorEpoch.day=1)}),w.sort((H,z)=>{if(H.reverseOf)return 1;if(z.reverseOf)return-1;if(!H.isoEpoch||!z.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return z.isoEpoch.year-H.isoEpoch.year});let G=w[w.length-1].reverseOf;if(G&&G!==w[w.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return w.forEach((H,z)=>{H.genericName="era"+(w.length-1-z)}),{eras:w,anchorEra:Y||w[0]}}(T);this.anchorEra=U,this.eras=W}inLeapYear($){let{year:T}=this.estimateIsoDate({month:1,day:1,year:$.year});return eO(T)}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(T)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][xW($)-1]}completeEraYear($){let T=(w,G,H)=>{let z=$[w];if(z!=null&&z!=G&&!(H||[]).includes(z)){let F=H?.[0];throw new RangeError(`Input ${w} ${z} doesn't match calculated value ${F?`${G} (also called ${F})`:G}`)}},W=(w)=>{let G,H={...$,year:w},z=this.eras.find((F,O)=>{if(O===this.eras.length-1){if(F.reverseOf){if(w>0)throw new RangeError(`Signed year ${w} is invalid for era ${F.code}`);return G=F.anchorEpoch.year-w,!0}return G=w-F.anchorEpoch.year+(F.hasYearZero?0:1),!0}return this.compareCalendarDates(H,F.anchorEpoch)>=0&&(G=w-F.anchorEpoch.year+(F.hasYearZero?0:1),!0)});if(!z)throw new RangeError(`Year ${w} was not matched by any era`);return{eraYear:G,era:z.code,eraNames:z.names}},{year:U,eraYear:X,era:Y}=$;if(U!=null){let w=W(U);({eraYear:X,era:Y}=w),T("era",Y,w?.eraNames),T("eraYear",X)}else{if(X==null)throw new RangeError("Either year or eraYear and era are required");{if(Y===void 0)throw new RangeError("era and eraYear must be provided together");let w=this.eras.find(({code:G,names:H=[]})=>G===Y||H.includes(Y));if(!w)throw new RangeError(`Era ${Y} (ISO year ${X}) was not matched by any era`);U=w.reverseOf?w.anchorEpoch.year-X:X+w.anchorEpoch.year-(w.hasYearZero?0:1),T("year",U),{eraYear:X,era:Y}=W(U)}}return{...$,year:U,eraYear:X,era:Y}}adjustCalendarDate($,T,W="constrain"){let U=$,{month:X,monthCode:Y}=U;return X===void 0&&(U={...U,month:xW(Y)}),this.validateCalendarDate(U),U=this.completeEraYear(U),super.adjustCalendarDate(U,T,W)}estimateIsoDate($){let T=this.adjustCalendarDate($),{year:W,month:U,day:X}=T,{anchorEra:Y}=this;return S8(W+Y.isoEpoch.year-(Y.hasYearZero?0:1),U,X,"constrain")}}class N9 extends TQ{constructor($,T){super($,T)}isoToCalendarDate($){let{year:T,month:W,day:U}=$,X=U0(W),Y=T-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:Y,month:W,monthCode:X,day:U})}}var T0={inLeapYear($){let{year:T}=$;return(T+1)%4==0},monthsInYear:()=>13,minimumMonthLength($){let{month:T}=$;return T===13?this.inLeapYear($)?6:5:30},maximumMonthLength($){return this.minimumMonthLength($)},maxLengthOfMonthCodeInAnyYear:($)=>$==="M13"?6:30};class VN extends $Q{constructor($,T){super($,T),this.inLeapYear=T0.inLeapYear,this.monthsInYear=T0.monthsInYear,this.minimumMonthLength=T0.minimumMonthLength,this.maximumMonthLength=T0.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=T0.maxLengthOfMonthCodeInAnyYear}}class WQ extends TQ{constructor($,T){super($,T),this.inLeapYear=T0.inLeapYear,this.monthsInYear=T0.monthsInYear,this.minimumMonthLength=T0.minimumMonthLength,this.maximumMonthLength=T0.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=T0.maxLengthOfMonthCodeInAnyYear}}class KN extends VN{constructor(){super("ethioaa",{year:-5492,month:7,day:17})}}class EN extends WQ{constructor(){super("coptic",[{code:"coptic",isoEpoch:{year:284,month:8,day:29}},{code:"coptic-inverse",reverseOf:"coptic"}])}}class AN extends WQ{constructor(){super("ethiopic",[{code:"ethioaa",names:["ethiopic-amete-alem","mundi"],isoEpoch:{year:-5492,month:7,day:17}},{code:"ethiopic",names:["incar"],isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}}class MN extends N9{constructor(){super("roc",[{code:"roc",names:["minguo"],isoEpoch:{year:1912,month:1,day:1}},{code:"roc-inverse",names:["before-roc"],reverseOf:"roc"}])}}class NN extends $Q{constructor(){super("buddhist",{year:-543,month:1,day:1})}}class LN extends N9{constructor(){super("gregory",[{code:"gregory",names:["ad","ce"],isoEpoch:{year:1,month:1,day:1}},{code:"gregory-inverse",names:["be","bce"],reverseOf:"gregory"}])}reviseIntlEra($){let{era:T,eraYear:W}=$;return T==="b"&&(T="gregory-inverse"),T==="a"&&(T="gregory"),{era:T,eraYear:W}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}}class JN extends N9{constructor(){super("japanese",[{code:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{code:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{code:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{code:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{code:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{code:"japanese",names:["japanese","gregory","ad","ce"],isoEpoch:{year:1,month:1,day:1}},{code:"japanese-inverse",names:["japanese-inverse","gregory-inverse","bc","bce"],reverseOf:"japanese"}]),this.erasBeginMidYear=!0}reviseIntlEra($,T){let{era:W,eraYear:U}=$,{year:X}=T;return this.eras.find((Y)=>Y.code===W)?{era:W,eraYear:U}:X<1?{era:"japanese-inverse",eraYear:1-X}:{era:"japanese",eraYear:X}}}class UQ extends jT{constructor(){super(...arguments),this.calendarType="lunisolar"}inLeapYear($,T){let W=this.getMonthList($.year,T);return Object.entries(W).length===13}monthsInYear($,T){return this.inLeapYear($,T)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear($){return["M01L","M09L","M10L","M11L","M12L"].includes($)?29:30}monthDaySearchStartYear($,T){let W={M01L:[1651,1651],M02L:[1947,1765],M03L:[1966,1955],M04L:[1963,1944],M05L:[1971,1952],M06L:[1960,1941],M07L:[1968,1938],M08L:[1957,1718],M09L:[1832,1832],M10L:[1870,1870],M11L:[1814,1814],M12L:[1890,1890]}[$]??[1972,1972];return T<30?W[0]:W[1]}getMonthList($,T){if($===void 0)throw new TypeError("Missing year");let W=JSON.stringify({func:"getMonthList",calendarYear:$,id:this.id}),U=T.get(W);if(U)return U;let X=this.getFormatter(),Y=(E,N)=>{let J=YN({isoYear:E,isoMonth:2,isoDay:1}),_=new Date(J);_.setUTCDate(N+1);let R=X.formatToParts(_),P=R.find((a)=>a.type==="month").value,x=+R.find((a)=>a.type==="day").value,f=R.find((a)=>a.type==="relatedYear"),h;if(f===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return h=+f.value,{calendarMonthString:P,calendarDay:x,calendarYearToVerify:h}},w=17,{calendarMonthString:G,calendarDay:H,calendarYearToVerify:z}=Y($,w);G!=="1"&&(w+=29,{calendarMonthString:G,calendarDay:H}=Y($,w)),w-=H-5;let F={},O,Q,Z=1,V=!1;do({calendarMonthString:G,calendarDay:H,calendarYearToVerify:z}=Y($,w)),O&&(F[Q].daysInMonth=O+30-H),z!==$?V=!0:(F[G]={monthIndex:Z++},w+=30),O=H,Q=G;while(!V);return F[Q].daysInMonth=O+30-H,T.set(W,F),F}estimateIsoDate($){let{year:T,month:W}=$;return{year:T,month:W>=12?12:W+1,day:1}}adjustCalendarDate($,T,W="constrain",U=!1){let{year:X,month:Y,monthExtra:w,day:G,monthCode:H}=$;if(X===void 0)throw new TypeError("Missing property: year");if(U){if(w&&w!=="bis")throw new RangeError(`Unexpected leap month suffix: ${w}`);let z=U0(Y,w!==void 0),F=`${Y}${w||""}`,O=this.getMonthList(X,T)[F];if(O===void 0)throw new RangeError(`Unmatched month ${F} in Chinese year ${X}`);return Y=O.monthIndex,{year:X,month:Y,day:G,monthCode:z}}if(this.validateCalendarDate($),Y===void 0){let z=this.getMonthList(X,T),F=H.replace(/^M|L$/g,(Q)=>Q==="L"?"bis":"");F[0]==="0"&&(F=F.slice(1));let O=z[F];if(Y=O&&O.monthIndex,Y===void 0&&H.endsWith("L")&&H!="M13L"&&W==="constrain"){let Q=+H.replace(/^M0?|L$/g,"");O=z[Q],O&&(Y=O.monthIndex,H=U0(Q))}if(Y===void 0)throw new RangeError(`Unmatched month ${H} in Chinese year ${X}`)}else if(H===void 0){let z=this.getMonthList(X,T),F=Object.entries(z),O=F.length;W==="reject"?(g4(Y,1,O),g4(G,1,this.maximumMonthLength())):(Y=M6(Y,1,O),G=M6(G,1,this.maximumMonthLength()));let Q=F.find((Z)=>Z[1].monthIndex===Y);if(Q===void 0)throw new RangeError(`Invalid month ${Y} in Chinese year ${X}`);H=U0(+Q[0].replace("bis",""),Q[0].indexOf("bis")!==-1)}else{let z=this.getMonthList(X,T),F=H.replace(/^M|L$/g,(Q)=>Q==="L"?"bis":"");F[0]==="0"&&(F=F.slice(1));let O=z[F];if(!O)throw new RangeError(`Unmatched monthCode ${H} in Chinese year ${X}`);if(Y!==O.monthIndex)throw new RangeError(`monthCode ${H} doesn't correspond to month ${Y} in Chinese year ${X}`)}return{...$,year:X,month:Y,monthCode:H,day:G}}}class _N extends UQ{constructor(){super(...arguments),this.id="chinese"}}class RN extends UQ{constructor(){super(...arguments),this.id="dangi"}}class kN{constructor($){this.helper=$}extraFields($){return this.helper.hasEra&&$.includes("year")?["era","eraYear"]:[]}resolveFields($){if(this.helper.calendarType!=="lunisolar"){let T=new h4;sO($,void 0,this.helper.monthsInYear({year:$.year??1972},T))}}dateToISO($,T){let W=new h4,U=this.helper.calendarToIsoDate($,T,W);return W.setObject(U),U}monthDayToISOReferenceDate($,T){let W=new h4,U=this.helper.monthDayFromFields($,T,W);return W.setObject(U),U}fieldKeysToIgnore($){let T=new Set;for(let W=0;W<$.length;W++){let U=$[W];switch(T.add(U),U){case"era":T.add("eraYear"),T.add("year");break;case"eraYear":T.add("era"),T.add("year");break;case"year":T.add("era"),T.add("eraYear");break;case"month":T.add("monthCode"),this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"));break;case"monthCode":T.add("month"),this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"));break;case"day":this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"))}}return UN(T)}dateAdd($,{years:T,months:W,weeks:U,days:X},Y){let w=h4.getCacheForObject($),G=this.helper.isoToCalendarDate($,w),H=this.helper.addCalendar(G,{years:T,months:W,weeks:U,days:X},Y,w),z=this.helper.calendarToIsoDate(H,"constrain",w);return h4.getCacheForObject(z)||new h4(w).setObject(z),z}dateUntil($,T,W){let U=h4.getCacheForObject($),X=h4.getCacheForObject(T),Y=this.helper.isoToCalendarDate($,U),w=this.helper.isoToCalendarDate(T,X);return this.helper.untilCalendar(Y,w,W,U)}isoToDate($,T){let W=h4.getCacheForObject($),U=this.helper.isoToCalendarDate($,W);if(T.dayOfWeek&&(U.dayOfWeek=$Y.iso8601.isoToDate($,{dayOfWeek:!0}).dayOfWeek),T.dayOfYear){let X=this.helper.startOfCalendarYear(U),Y=this.helper.calendarDaysUntil(X,U,W);U.dayOfYear=Y+1}if(T.weekOfYear&&(U.weekOfYear=XN(this.helper.id,$)),U.daysInWeek=7,T.daysInMonth&&(U.daysInMonth=this.helper.daysInMonth(U,W)),T.daysInYear){let X=this.helper.startOfCalendarYear(U),Y=this.helper.addCalendar(X,{years:1},"constrain",W);U.daysInYear=this.helper.calendarDaysUntil(X,Y,W)}return T.monthsInYear&&(U.monthsInYear=this.helper.monthsInYear(U,W)),T.inLeapYear&&(U.inLeapYear=this.helper.inLeapYear(U,W)),U}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}}for(let $ of[wN,ZN,AN,KN,EN,_N,RN,MN,DN,NN,LN,JN,GN,zN,HN,FN,ON,QN]){let T=new $;$Y[T.id]=new kN(T)}qO("calendarImpl",function($){return $Y[$]});var c8=Intl.DateTimeFormat;function y2($,T){let W=D($,T);return typeof W=="function"&&(W=new c8(D($,NM),W(D($,_O))),function(U,X,Y){let w=z9(U);if(w===void 0)throw new TypeError("Missing slots for the given container");if(w[X]===void 0)throw new TypeError(`tried to reset ${X} which was not set`);w[X]=Y}($,T,W)),W}function A8($){return _6($,IW)}class s2{constructor($=void 0,T=void 0){(function(W,U,X){let Y=X!==void 0,w;if(Y){let F=["localeMatcher","calendar","numberingSystem","hour12","hourCycle","timeZone","weekday","era","year","month","day","dayPeriod","hour","minute","second","fractionalSecondDigits","timeZoneName","formatMatcher","dateStyle","timeStyle"];w=function(Q){if(Q==null)throw new TypeError(`Expected object not ${Q}`);return Object(Q)}(X);let O=Object.create(null);for(let Q=0;Q<F.length;Q++){let Z=F[Q];Object.prototype.hasOwnProperty.call(w,Z)&&(O[Z]=w[Z])}w=O}else w=Object.create(null);let G=new c8(U,w),H=G.resolvedOptions();if(u0(W),Y){let F=Object.assign(Object.create(null),H);for(let O in F)Object.prototype.hasOwnProperty.call(w,O)||delete F[O];F.hour12=w.hour12,F.hourCycle=w.hourCycle,L$(W,_O,F)}else L$(W,_O,w);L$(W,NM,H.locale),L$(W,IW,G),L$(W,m2,H.timeZone),L$(W,N8,H.calendar),L$(W,DM,cb),L$(W,VM,gb),L$(W,KM,mb),L$(W,EM,hb),L$(W,AM,ub),L$(W,MM,pb);let z=Y?w.timeZone:void 0;if(z===void 0)L$(W,JO,H.timeZone);else{let F=Q9(z);if(F.startsWith("\u2212"))throw new RangeError("Unicode minus (U+2212) is not supported in time zone offsets");L$(W,JO,L6(F))}})(this,$,T)}get format(){C(this,A8);let $=Ib.bind(this);return Object.defineProperties($,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:"",enumerable:!1,writable:!1,configurable:!0}}),$}formatRange($,T){return C(this,A8),fb.call(this,$,T)}formatToParts($,...T){return C(this,A8),bb.call(this,$,...T)}formatRangeToParts($,T){return C(this,A8),yb.call(this,$,T)}resolvedOptions(){return C(this,A8),xb.call(this)}}"formatToParts"in c8.prototype||delete s2.prototype.formatToParts,"formatRangeToParts"in c8.prototype||delete s2.prototype.formatRangeToParts;var w1=function($=void 0,T=void 0){return new s2($,T)};function xb(){let $=D(this,IW).resolvedOptions();return $.timeZone=D(this,JO),$}function Ib($,...T){let W,U,X=e2($,this);return X.formatter?(W=X.formatter,U=[L1(X.epochNs,"floor")]):(W=D(this,IW),U=[$,...T]),W.format(...U)}function bb($,...T){let W,U,X=e2($,this);return X.formatter?(W=X.formatter,U=[L1(X.epochNs,"floor")]):(W=D(this,IW),U=[$,...T]),W.formatToParts(...U)}function fb($,T){if($===void 0||T===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let W=G9($),U=G9(T),X,Y=[W,U];if(m0(W)!==m0(U))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");if(m0(W)){if(!vN(W,U))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{epochNs:w,formatter:G}=e2(W,this),{epochNs:H,formatter:z}=e2(U,this);G&&(X=G,Y=[L1(w,"floor"),L1(H,"floor")])}return X||(X=D(this,IW)),X.formatRange(...Y)}function yb($,T){if($===void 0||T===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let W=G9($),U=G9(T),X,Y=[W,U];if(m0(W)!==m0(U))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");if(m0(W)){if(!vN(W,U))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{epochNs:w,formatter:G}=e2(W,this),{epochNs:H,formatter:z}=e2(U,this);G&&(X=G,Y=[L1(w,"floor"),L1(H,"floor")])}return X||(X=D(this,IW)),X.formatRangeToParts(...Y)}function TY($={},T={}){let W=Object.assign({},$),U=["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"];for(let X=0;X<U.length;X++){let Y=U[X];W[Y]=Y in T?T[Y]:W[Y],W[Y]!==!1&&W[Y]!==void 0||delete W[Y]}return W}function hb($){let T=TY($,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(T.timeStyle!=="long"&&T.timeStyle!=="full"||(delete T.timeStyle,Object.assign(T,{hour:"numeric",minute:"2-digit",second:"2-digit"})),!J9(T)){if(WY($))throw new TypeError(`cannot format Temporal.PlainTime with options [${Object.keys($)}]`);Object.assign(T,{hour:"numeric",minute:"numeric",second:"numeric"})}return T}function gb($){let T={short:{year:"2-digit",month:"numeric"},medium:{year:"numeric",month:"short"},long:{year:"numeric",month:"long"},full:{year:"numeric",month:"long"}},W=TY($,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in W&&W.dateStyle){let U=W.dateStyle;delete W.dateStyle,Object.assign(W,T[U])}if(!(("year"in W)||("month"in W)||("era"in W))){if(WY($))throw new TypeError(`cannot format PlainYearMonth with options [${Object.keys($)}]`);Object.assign(W,{year:"numeric",month:"numeric"})}return W}function mb($){let T={short:{month:"numeric",day:"numeric"},medium:{month:"short",day:"numeric"},long:{month:"long",day:"numeric"},full:{month:"long",day:"numeric"}},W=TY($,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in W&&W.dateStyle){let U=W.dateStyle;delete W.dateStyle,Object.assign(W,T[U])}if(!("month"in W)&&!("day"in W)){if(WY($))throw new TypeError(`cannot format PlainMonthDay with options [${Object.keys($)}]`);Object.assign(W,{month:"numeric",day:"numeric"})}return W}function cb($){let T=TY($,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!L9(T)){if(WY($))throw new TypeError(`cannot format PlainDate with options [${Object.keys($)}]`);Object.assign(T,{year:"numeric",month:"numeric",day:"numeric"})}return T}function ub($){let T=TY($,{timeZoneName:!1});if((T.timeStyle==="long"||T.timeStyle==="full")&&(delete T.timeStyle,Object.assign(T,{hour:"numeric",minute:"2-digit",second:"2-digit"}),T.dateStyle))Object.assign(T,{short:{year:"numeric",month:"numeric",day:"numeric"},medium:{year:"numeric",month:"short",day:"numeric"},long:{year:"numeric",month:"long",day:"numeric"},full:{year:"numeric",month:"long",day:"numeric",weekday:"long"}}[T.dateStyle]),delete T.dateStyle;if(!J9(T)&&!L9(T)){if(WY($))throw new TypeError(`cannot format PlainDateTime with options [${Object.keys($)}]`);Object.assign(T,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}return T}function pb($){let T=$;return J9(T)||L9(T)||(T=Object.assign({},T,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),T}function L9($){return"year"in $||"month"in $||"day"in $||"weekday"in $||"dateStyle"in $||"era"in $}function J9($){return"hour"in $||"minute"in $||"second"in $||"timeStyle"in $||"dayPeriod"in $||"fractionalSecondDigits"in $}function WY($){return L9($)||J9($)||"dateStyle"in $||"timeStyle"in $||"timeZoneName"in $}function m0($){return F4($)||K4($)||n$($)||_$($)||o4($)||X1($)||d4($)}function G9($){return m0($)?$:O9($)}function vN($,T){return!(!m0($)||!m0(T)||K4($)&&!K4(T)||F4($)&&!F4(T)||n$($)&&!n$(T)||_$($)&&!_$(T)||o4($)&&!o4(T)||X1($)&&!X1(T)||d4($)&&!d4(T))}function e2($,T){if(K4($)){let W={isoDate:{year:1970,month:1,day:1},time:D($,O4)};return{epochNs:$6(D(T,m2),W,"compatible"),formatter:y2(T,EM)}}if(o4($)){let W=D($,m),U=D(T,N8);if(W!==U)throw new RangeError(`cannot format PlainYearMonth with calendar ${W} in locale with calendar ${U}`);let X=B$(D($,O$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:$6(D(T,m2),X,"compatible"),formatter:y2(T,VM)}}if(X1($)){let W=D($,m),U=D(T,N8);if(W!==U)throw new RangeError(`cannot format PlainMonthDay with calendar ${W} in locale with calendar ${U}`);let X=B$(D($,O$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:$6(D(T,m2),X,"compatible"),formatter:y2(T,KM)}}if(F4($)){let W=D($,m),U=D(T,N8);if(W!=="iso8601"&&W!==U)throw new RangeError(`cannot format PlainDate with calendar ${W} in locale with calendar ${U}`);let X=B$(D($,O$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:$6(D(T,m2),X,"compatible"),formatter:y2(T,DM)}}if(n$($)){let W=D($,m),U=D(T,N8);if(W!=="iso8601"&&W!==U)throw new RangeError(`cannot format PlainDateTime with calendar ${W} in locale with calendar ${U}`);let X=D($,W4);return{epochNs:$6(D(T,m2),X,"compatible"),formatter:y2(T,AM)}}if(_$($))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return d4($)?{epochNs:D($,F$),formatter:y2(T,MM)}:{}}function qN($){let T=Object.create(null);return T.years=D($,O6),T.months=D($,Q6),T.weeks=D($,b6),T.days=D($,Z6),T.hours=D($,D6),T.minutes=D($,V6),T.seconds=D($,K6),T.milliseconds=D($,E6),T.microseconds=D($,A6),T.nanoseconds=D($,f6),T}s2.prototype.constructor=w1,Object.defineProperty(w1,"prototype",{value:s2.prototype,writable:!1,enumerable:!1,configurable:!1}),w1.supportedLocalesOf=c8.supportedLocalesOf,p0(w1,"Intl.DateTimeFormat");var{format:db,formatToParts:ob}=Intl.DurationFormat?.prototype??Object.create(null);function XQ($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let T=qN(M1($));return db.call(this,T)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=XQ,Intl.DurationFormat.prototype.formatToParts=function($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let T=qN(M1($));return ob.call(this,T)});var Qs=Object.freeze({__proto__:null,DateTimeFormat:w1,ModifiedIntlDurationFormatPrototypeFormat:XQ});class _9{constructor($){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");gM(this,w9($))}get epochMilliseconds(){return C(this,d4),L1(D(this,F$),"floor")}get epochNanoseconds(){return C(this,d4),TN(q.BigInt(D(this,F$)))}add($){return C(this,d4),TM("add",this,$)}subtract($){return C(this,d4),TM("subtract",this,$)}until($,T=void 0){return C(this,d4),nA("until",this,$,T)}since($,T=void 0){return C(this,d4),nA("since",this,$,T)}round($){if(C(this,d4),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?BW("smallestUnit",$):$$($),W=WU(T),U=y1(T,"halfExpand"),X=h6(T,"smallestUnit","time",c0);return UU(W,{hour:24,minute:1440,second:86400,millisecond:86400000,microsecond:86400000000,nanosecond:86400000000000}[X],!0),b1(yO(D(this,F$),W,X,U))}equals($){C(this,d4);let T=_8($),W=D(this,F$),U=D(T,F$);return q.equal(q.BigInt(W),q.BigInt(U))}toString($=void 0){C(this,d4);let T=$$($),W=l8(T),U=y1(T,"trunc"),X=h6(T,"smallestUnit","time",void 0);if(X==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let Y=T.timeZone;Y!==void 0&&(Y=L6(Y));let{precision:w,unit:G,increment:H}=r8(X,W);return gA(b1(yO(D(this,F$),H,G,U)),Y,w)}toJSON(){return C(this,d4),gA(this,void 0,"auto")}toLocaleString($=void 0,T=void 0){return C(this,d4),new w1($,T).format(this)}valueOf(){ST("Instant")}toZonedDateTimeISO($){C(this,d4);let T=L6($);return s4(D(this,F$),T,"iso8601")}static fromEpochMilliseconds($){return b1(f1(O9($)))}static fromEpochNanoseconds($){return b1(w9($))}static from($){return _8($)}static compare($,T){let W=_8($),U=_8(T),X=D(W,F$),Y=D(U,F$);return q.lessThan(X,Y)?-1:q.greaterThan(X,Y)?1:0}}p0(_9,"Temporal.Instant");class R9{constructor($,T,W,U="iso8601"){let X=V$($),Y=V$(T),w=V$(W),G=R6(U===void 0?"iso8601":S4(U));CW(X,Y,w),IM(this,{year:X,month:Y,day:w},G)}get calendarId(){return C(this,F4),D(this,m)}get era(){return z6(this,"era")}get eraYear(){return z6(this,"eraYear")}get year(){return z6(this,"year")}get month(){return z6(this,"month")}get monthCode(){return z6(this,"monthCode")}get day(){return z6(this,"day")}get dayOfWeek(){return z6(this,"dayOfWeek")}get dayOfYear(){return z6(this,"dayOfYear")}get weekOfYear(){return z6(this,"weekOfYear")?.week}get yearOfWeek(){return z6(this,"weekOfYear")?.year}get daysInWeek(){return z6(this,"daysInWeek")}get daysInMonth(){return z6(this,"daysInMonth")}get daysInYear(){return z6(this,"daysInYear")}get monthsInYear(){return z6(this,"monthsInYear")}get inLeapYear(){return z6(this,"inLeapYear")}with($,T=void 0){if(C(this,F4),!Q4($))throw new TypeError("invalid argument");TU($);let W=D(this,m),U=J6(W,D(this,O$));return U=PW(W,U,H1(W,$,["year","month","monthCode","day"],[],"partial")),N6(PT(W,U,C$($$(T))),W)}withCalendar($){C(this,F4);let T=a8($);return N6(D(this,O$),T)}add($,T=void 0){return C(this,F4),WM("add",this,$,T)}subtract($,T=void 0){return C(this,F4),WM("subtract",this,$,T)}until($,T=void 0){return C(this,F4),iA("until",this,$,T)}since($,T=void 0){return C(this,F4),iA("since",this,$,T)}equals($){C(this,F4);let T=L8($);return w0(D(this,O$),D(T,O$))===0&&X0(D(this,m),D(T,m))}toString($=void 0){return C(this,F4),mA(this,o8($$($)))}toJSON(){return C(this,F4),mA(this)}toLocaleString($=void 0,T=void 0){return C(this,F4),new w1($,T).format(this)}valueOf(){ST("PlainDate")}toPlainDateTime($=void 0){C(this,F4);let T=xM($);return E1(B$(D(this,O$),T),D(this,m))}toZonedDateTime($){let T,W;if(C(this,F4),Q4($)){let Y=$.timeZone;Y===void 0?T=L6($):(T=L6(Y),W=$.plainTime)}else T=L6($);let U=D(this,O$),X;return W===void 0?X=LT(T,U):(W=_T(W),X=$6(T,B$(U,D(W,O4)),"compatible")),s4(X,T,D(this,m))}toPlainYearMonth(){C(this,F4);let $=D(this,m);return d2(f8($,J6($,D(this,O$)),"constrain"),$)}toPlainMonthDay(){C(this,F4);let $=D(this,m);return p2(T9($,J6($,D(this,O$)),"constrain"),$)}static from($,T=void 0){return L8($,T)}static compare($,T){let W=L8($),U=L8(T);return w0(D(W,O$),D(U,O$))}}function z6($,T){C($,F4);let W=D($,O$);return n8($).isoToDate(W,{[T]:!0})[T]}p0(R9,"Temporal.PlainDate");class k9{constructor($,T,W,U=0,X=0,Y=0,w=0,G=0,H=0,z="iso8601"){let F=V$($),O=V$(T),Q=V$(W),Z=U===void 0?0:V$(U),V=X===void 0?0:V$(X),E=Y===void 0?0:V$(Y),N=w===void 0?0:V$(w),J=G===void 0?0:V$(G),_=H===void 0?0:V$(H),R=R6(z===void 0?"iso8601":S4(z));nO(F,O,Q,Z,V,E,N,J,_),bM(this,{isoDate:{year:F,month:O,day:Q},time:{hour:Z,minute:V,second:E,millisecond:N,microsecond:J,nanosecond:_}},R)}get calendarId(){return C(this,n$),D(this,m)}get year(){return H6(this,"year")}get month(){return H6(this,"month")}get monthCode(){return H6(this,"monthCode")}get day(){return H6(this,"day")}get hour(){return h2(this,"hour")}get minute(){return h2(this,"minute")}get second(){return h2(this,"second")}get millisecond(){return h2(this,"millisecond")}get microsecond(){return h2(this,"microsecond")}get nanosecond(){return h2(this,"nanosecond")}get era(){return H6(this,"era")}get eraYear(){return H6(this,"eraYear")}get dayOfWeek(){return H6(this,"dayOfWeek")}get dayOfYear(){return H6(this,"dayOfYear")}get weekOfYear(){return H6(this,"weekOfYear")?.week}get yearOfWeek(){return H6(this,"weekOfYear")?.year}get daysInWeek(){return H6(this,"daysInWeek")}get daysInYear(){return H6(this,"daysInYear")}get daysInMonth(){return H6(this,"daysInMonth")}get monthsInYear(){return H6(this,"monthsInYear")}get inLeapYear(){return H6(this,"inLeapYear")}with($,T=void 0){if(C(this,n$),!Q4($))throw new TypeError("invalid argument");TU($);let W=D(this,m),U=D(this,W4),X={...J6(W,U.isoDate),...U.time};return X=PW(W,X,H1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],"partial")),E1(i8(W,X,C$($$(T))),W)}withPlainTime($=void 0){C(this,n$);let T=xM($);return E1(B$(D(this,W4).isoDate,T),D(this,m))}withCalendar($){C(this,n$);let T=a8($);return E1(D(this,W4),T)}add($,T=void 0){return C(this,n$),UM("add",this,$,T)}subtract($,T=void 0){return C(this,n$),UM("subtract",this,$,T)}until($,T=void 0){return C(this,n$),tA("until",this,$,T)}since($,T=void 0){return C(this,n$),tA("since",this,$,T)}round($){if(C(this,n$),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?BW("smallestUnit",$):$$($),W=WU(T),U=y1(T,"halfExpand"),X=h6(T,"smallestUnit","time",c0,["day"]),Y={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X];UU(W,Y,Y===1);let w=D(this,W4);return E1(W===1&&X==="nanosecond"?w:hO(w,W,X,U),D(this,m))}equals($){C(this,n$);let T=J8($);return a2(D(this,W4),D(T,W4))===0&&X0(D(this,m),D(T,m))}toString($=void 0){C(this,n$);let T=$$($),W=o8(T),U=l8(T),X=y1(T,"trunc"),Y=h6(T,"smallestUnit","time",void 0);if(Y==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:w,unit:G,increment:H}=r8(Y,U),z=hO(D(this,W4),H,G,X);return SW(z),h8(z,D(this,m),w,W)}toJSON(){return C(this,n$),h8(D(this,W4),D(this,m),"auto")}toLocaleString($=void 0,T=void 0){return C(this,n$),new w1($,T).format(this)}valueOf(){ST("PlainDateTime")}toZonedDateTime($,T=void 0){C(this,n$);let W=L6($),U=j8($$(T));return s4($6(W,D(this,W4),U),W,D(this,m))}toPlainDate(){return C(this,n$),N6(D(this,W4).isoDate,D(this,m))}toPlainTime(){return C(this,n$),b0(D(this,W4).time)}static from($,T=void 0){return J8($,T)}static compare($,T){let W=J8($),U=J8(T);return a2(D(W,W4),D(U,W4))}}function H6($,T){C($,n$);let W=D($,W4).isoDate;return n8($).isoToDate(W,{[T]:!0})[T]}function h2($,T){return C($,n$),D($,W4).time[T]}p0(k9,"Temporal.PlainDateTime");class $U{constructor($=0,T=0,W=0,U=0,X=0,Y=0,w=0,G=0,H=0,z=0){let F=$===void 0?0:I1($),O=T===void 0?0:I1(T),Q=W===void 0?0:I1(W),Z=U===void 0?0:I1(U),V=X===void 0?0:I1(X),E=Y===void 0?0:I1(Y),N=w===void 0?0:I1(w),J=G===void 0?0:I1(G),_=H===void 0?0:I1(H),R=z===void 0?0:I1(z);A9(F,O,Q,Z,V,E,N,J,_,R),u0(this),L$(this,O6,F),L$(this,Q6,O),L$(this,b6,Q),L$(this,Z6,Z),L$(this,D6,V),L$(this,V6,E),L$(this,K6,N),L$(this,E6,J),L$(this,A6,_),L$(this,f6,R)}get years(){return C(this,H4),D(this,O6)}get months(){return C(this,H4),D(this,Q6)}get weeks(){return C(this,H4),D(this,b6)}get days(){return C(this,H4),D(this,Z6)}get hours(){return C(this,H4),D(this,D6)}get minutes(){return C(this,H4),D(this,V6)}get seconds(){return C(this,H4),D(this,K6)}get milliseconds(){return C(this,H4),D(this,E6)}get microseconds(){return C(this,H4),D(this,A6)}get nanoseconds(){return C(this,H4),D(this,f6)}get sign(){return C(this,H4),X9(this)}get blank(){return C(this,H4),X9(this)===0}with($){C(this,H4);let T=BM($),{years:W=D(this,O6),months:U=D(this,Q6),weeks:X=D(this,b6),days:Y=D(this,Z6),hours:w=D(this,D6),minutes:G=D(this,V6),seconds:H=D(this,K6),milliseconds:z=D(this,E6),microseconds:F=D(this,A6),nanoseconds:O=D(this,f6)}=T;return new $U(W,U,X,Y,w,G,H,z,F,O)}negated(){return C(this,H4),m6(this)}abs(){return C(this,H4),new $U(Math.abs(D(this,O6)),Math.abs(D(this,Q6)),Math.abs(D(this,b6)),Math.abs(D(this,Z6)),Math.abs(D(this,D6)),Math.abs(D(this,V6)),Math.abs(D(this,K6)),Math.abs(D(this,E6)),Math.abs(D(this,A6)),Math.abs(D(this,f6)))}add($){return C(this,H4),$M("add",this,$)}subtract($){return C(this,H4),$M("subtract",this,$)}round($){if(C(this,H4),$===void 0)throw new TypeError("options parameter is required");let T=x0(this),W=typeof $=="string"?BW("smallestUnit",$):$$($),U=h6(W,"largestUnit","datetime",void 0,["auto"]),{plainRelativeTo:X,zonedRelativeTo:Y}=MO(W),w=WU(W),G=y1(W,"halfExpand"),H=h6(W,"smallestUnit","datetime",void 0),z=!0;H||(z=!1,H="nanosecond");let F=y0(T,H),O=!0;if(U||(O=!1,U=F),U==="auto"&&(U=F),!z&&!O)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(y0(U,H)!==U)throw new RangeError(`largestUnit ${U} cannot be smaller than smallestUnit ${H}`);let Q={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[H];if(Q!==void 0&&UU(w,Q,!1),w>1&&I0(H)==="date"&&U!==H)throw new RangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit");if(Y){let V=c2(this),E=D(Y,b$),N=D(Y,m),J=D(Y,F$);return V=$N(J,v8(J,E,N,V),E,N,U,w,H,G),I0(U)==="date"&&(U="hour"),A1(V,U)}if(X){let V=W0(this),E=t2({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},V.time),N=D(X,O$),J=D(X,m),_=G1(J,N,e4(V.date,E.deltaDays),"constrain");return V=eM(B$(N,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),B$(_,E),J,U,w,H,G),A1(V,U)}if($0(T))throw new RangeError(`a starting point is required for ${T}s balancing`);if($0(U))throw new RangeError(`a starting point is required for ${U}s balancing`);let Z=W0(this);if(H==="day"){let{quotient:V,remainder:E}=Z.time.divmod(sG),N=Z.date.days+V+B8(E,"day");N=RT(N,w,G),Z=h0({years:0,months:0,weeks:0,days:N},R$.ZERO)}else Z=h0({years:0,months:0,weeks:0,days:0},Y9(Z.time,w,H,G));return A1(Z,U)}total($){if(C(this,H4),$===void 0)throw new TypeError("options argument is required");let T=typeof $=="string"?BW("unit",$):$$($),{plainRelativeTo:W,zonedRelativeTo:U}=MO(T),X=h6(T,"unit","datetime",c0);if(U){let w=c2(this),G=D(U,b$),H=D(U,m),z=D(U,F$);return function(F,O,Q,Z,V){return I0(V)==="time"?B8(R$.fromEpochNsDiff(O,F),V):rA(aM(F,O,Q,Z,V),O,N1(Q,F),Q,Z,V)}(z,v8(z,G,H,w),G,H,X)}if(W){let w=W0(this),G=t2({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},w.time),H=D(W,O$),z=D(W,m),F=G1(z,H,e4(w.date,G.deltaDays),"constrain");return function(O,Q,Z,V){if(a2(O,Q)==0)return 0;SW(O),SW(Q);let E=tM(O,Q,Z,V);return V==="nanosecond"?q.toNumber(E.time.totalNs):rA(E,l4(Q),O,null,Z,V)}(B$(H,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),B$(F,G),z,X)}let Y=x0(this);if($0(Y))throw new RangeError(`a starting point is required for ${Y}s total`);if($0(X))throw new RangeError(`a starting point is required for ${X}s total`);return B8(W0(this).time,X)}toString($=void 0){C(this,H4);let T=$$($),W=l8(T),U=y1(T,"trunc"),X=h6(T,"smallestUnit","time",void 0);if(X==="hour"||X==="minute")throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');let{precision:Y,unit:w,increment:G}=r8(X,W);if(w==="nanosecond"&&G===1)return nG(this,Y);let H=x0(this),z=c2(this),F=Y9(z.time,G,w,U);return z=h0(z.date,F),nG(A1(z,y0(H,"second")),Y)}toJSON(){return C(this,H4),nG(this,"auto")}toLocaleString($=void 0,T=void 0){if(C(this,H4),typeof Intl.DurationFormat=="function"){let W=new Intl.DurationFormat($,T);return XQ.call(W,this)}return console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),nG(this,"auto")}valueOf(){ST("Duration")}static from($){return M1($)}static compare($,T,W=void 0){let U=M1($),X=M1(T),Y=$$(W),{plainRelativeTo:w,zonedRelativeTo:G}=MO(Y);if(D(U,O6)===D(X,O6)&&D(U,Q6)===D(X,Q6)&&D(U,b6)===D(X,b6)&&D(U,Z6)===D(X,Z6)&&D(U,D6)===D(X,D6)&&D(U,V6)===D(X,V6)&&D(U,K6)===D(X,K6)&&D(U,E6)===D(X,E6)&&D(U,A6)===D(X,A6)&&D(U,f6)===D(X,f6))return 0;let H=x0(U),z=x0(X),F=c2(U),O=c2(X);if(G&&(I0(H)==="date"||I0(z)==="date")){let N=D(G,b$),J=D(G,m),_=D(G,F$),R=v8(_,N,J,F),P=v8(_,N,J,O);return y6(q.toNumber(q.subtract(R,P)))}let Q=F.date.days,Z=O.date.days;if($0(H)||$0(z)){if(!w)throw new RangeError("A starting point is required for years, months, or weeks comparison");Q=lA(F.date,w),Z=lA(O.date,w)}let V=F.time.add24HourDays(Q),E=O.time.add24HourDays(Z);return V.cmp(E)}}p0($U,"Temporal.Duration");class v9{constructor($,T,W="iso8601",U=1972){let X=V$($),Y=V$(T),w=R6(W===void 0?"iso8601":S4(W)),G=V$(U);CW(G,X,Y),fM(this,{year:G,month:X,day:Y},w)}get monthCode(){return zM(this,"monthCode")}get day(){return zM(this,"day")}get calendarId(){return C(this,X1),D(this,m)}with($,T=void 0){if(C(this,X1),!Q4($))throw new TypeError("invalid argument");TU($);let W=D(this,m),U=J6(W,D(this,O$),"month-day");return U=PW(W,U,H1(W,$,["year","month","monthCode","day"],[],"partial")),p2(T9(W,U,C$($$(T))),W)}equals($){C(this,X1);let T=yA($);return w0(D(this,O$),D(T,O$))===0&&X0(D(this,m),D(T,m))}toString($=void 0){return C(this,X1),uA(this,o8($$($)))}toJSON(){return C(this,X1),uA(this)}toLocaleString($=void 0,T=void 0){return C(this,X1),new w1($,T).format(this)}valueOf(){ST("PlainMonthDay")}toPlainDate($){if(C(this,X1),!Q4($))throw new TypeError("argument should be an object");let T=D(this,m);return N6(PT(T,PW(T,J6(T,D(this,O$),"month-day"),H1(T,$,["year"],[],[])),"constrain"),T)}static from($,T=void 0){return yA($,T)}}function zM($,T){C($,X1);let W=D($,O$);return n8($).isoToDate(W,{[T]:!0})[T]}function LO($){return N1($,cO())}p0(v9,"Temporal.PlainMonthDay");var PN={instant:()=>b1(cO()),plainDateTimeISO:($=E8())=>E1(LO(L6($)),"iso8601"),plainDateISO:($=E8())=>N6(LO(L6($)).isoDate,"iso8601"),plainTimeISO:($=E8())=>b0(LO(L6($)).time),timeZoneId:()=>E8(),zonedDateTimeISO:($=E8())=>{let T=L6($);return s4(cO(),T,"iso8601")},[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(PN,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});class UY{constructor($=0,T=0,W=0,U=0,X=0,Y=0){let w=$===void 0?0:V$($),G=T===void 0?0:V$(T),H=W===void 0?0:V$(W),z=U===void 0?0:V$(U),F=X===void 0?0:V$(X),O=Y===void 0?0:V$(Y);E9(w,G,H,z,F,O),yM(this,{hour:w,minute:G,second:H,millisecond:z,microsecond:F,nanosecond:O})}get hour(){return C(this,K4),D(this,O4).hour}get minute(){return C(this,K4),D(this,O4).minute}get second(){return C(this,K4),D(this,O4).second}get millisecond(){return C(this,K4),D(this,O4).millisecond}get microsecond(){return C(this,K4),D(this,O4).microsecond}get nanosecond(){return C(this,K4),D(this,O4).nanosecond}with($,T=void 0){if(C(this,K4),!Q4($))throw new TypeError("invalid argument");TU($);let W=jO($,"partial"),U=jO(this),{hour:X,minute:Y,second:w,millisecond:G,microsecond:H,nanosecond:z}=Object.assign(U,W),F=C$($$(T));return{hour:X,minute:Y,second:w,millisecond:G,microsecond:H,nanosecond:z}=D9(X,Y,w,G,H,z,F),new UY(X,Y,w,G,H,z)}add($){return C(this,K4),XM("add",this,$)}subtract($){return C(this,K4),XM("subtract",this,$)}until($,T=void 0){return C(this,K4),aA("until",this,$,T)}since($,T=void 0){return C(this,K4),aA("since",this,$,T)}round($){if(C(this,K4),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?BW("smallestUnit",$):$$($),W=WU(T),U=y1(T,"halfExpand"),X=h6(T,"smallestUnit","time",c0);return UU(W,{hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X],!1),b0(gO(D(this,O4),W,X,U))}equals($){C(this,K4);let T=_T($);return mO(D(this,O4),D(T,O4))===0}toString($=void 0){C(this,K4);let T=$$($),W=l8(T),U=y1(T,"trunc"),X=h6(T,"smallestUnit","time",void 0);if(X==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:Y,unit:w,increment:G}=r8(X,W);return cA(gO(D(this,O4),G,w,U),Y)}toJSON(){return C(this,K4),cA(D(this,O4),"auto")}toLocaleString($=void 0,T=void 0){return C(this,K4),new w1($,T).format(this)}valueOf(){ST("PlainTime")}static from($,T=void 0){return _T($,T)}static compare($,T){let W=_T($),U=_T(T);return mO(D(W,O4),D(U,O4))}}p0(UY,"Temporal.PlainTime");class q9{constructor($,T,W="iso8601",U=1){let X=V$($),Y=V$(T),w=R6(W===void 0?"iso8601":S4(W)),G=V$(U);CW(X,Y,G),hM(this,{year:X,month:Y,day:G},w)}get year(){return j0(this,"year")}get month(){return j0(this,"month")}get monthCode(){return j0(this,"monthCode")}get calendarId(){return C(this,o4),D(this,m)}get era(){return j0(this,"era")}get eraYear(){return j0(this,"eraYear")}get daysInMonth(){return j0(this,"daysInMonth")}get daysInYear(){return j0(this,"daysInYear")}get monthsInYear(){return j0(this,"monthsInYear")}get inLeapYear(){return j0(this,"inLeapYear")}with($,T=void 0){if(C(this,o4),!Q4($))throw new TypeError("invalid argument");TU($);let W=D(this,m),U=J6(W,D(this,O$),"year-month");return U=PW(W,U,H1(W,$,["year","month","monthCode"],[],"partial")),d2(f8(W,U,C$($$(T))),W)}add($,T=void 0){return C(this,o4),YM("add",this,$,T)}subtract($,T=void 0){return C(this,o4),YM("subtract",this,$,T)}until($,T=void 0){return C(this,o4),sA("until",this,$,T)}since($,T=void 0){return C(this,o4),sA("since",this,$,T)}equals($){C(this,o4);let T=R8($);return w0(D(this,O$),D(T,O$))===0&&X0(D(this,m),D(T,m))}toString($=void 0){return C(this,o4),pA(this,o8($$($)))}toJSON(){return C(this,o4),pA(this)}toLocaleString($=void 0,T=void 0){return C(this,o4),new w1($,T).format(this)}valueOf(){ST("PlainYearMonth")}toPlainDate($){if(C(this,o4),!Q4($))throw new TypeError("argument should be an object");let T=D(this,m);return N6(PT(T,PW(T,J6(T,D(this,O$),"year-month"),H1(T,$,["day"],[],[])),"constrain"),T)}static from($,T=void 0){return R8($,T)}static compare($,T){let W=R8($),U=R8(T);return w0(D(W,O$),D(U,O$))}}function j0($,T){C($,o4);let W=D($,O$);return n8($).isoToDate(W,{[T]:!0})[T]}p0(q9,"Temporal.PlainYearMonth");var lb=w1.prototype.resolvedOptions;class P9{constructor($,T,W="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let U=w9($),X=S4(T),{tzName:Y,offsetMinutes:w}=kT(X);if(w===void 0){let G=W9(Y);if(!G)throw new RangeError(`unknown time zone ${Y}`);X=G.identifier}else X=oO(w);mM(this,U,X,R6(W===void 0?"iso8601":S4(W)))}get calendarId(){return C(this,_$),D(this,m)}get timeZoneId(){return C(this,_$),D(this,b$)}get year(){return F6(this,"year")}get month(){return F6(this,"month")}get monthCode(){return F6(this,"monthCode")}get day(){return F6(this,"day")}get hour(){return g2(this,"hour")}get minute(){return g2(this,"minute")}get second(){return g2(this,"second")}get millisecond(){return g2(this,"millisecond")}get microsecond(){return g2(this,"microsecond")}get nanosecond(){return g2(this,"nanosecond")}get era(){return F6(this,"era")}get eraYear(){return F6(this,"eraYear")}get epochMilliseconds(){return C(this,_$),L1(D(this,F$),"floor")}get epochNanoseconds(){return C(this,_$),TN(D(this,F$))}get dayOfWeek(){return F6(this,"dayOfWeek")}get dayOfYear(){return F6(this,"dayOfYear")}get weekOfYear(){return F6(this,"weekOfYear")?.week}get yearOfWeek(){return F6(this,"weekOfYear")?.year}get hoursInDay(){C(this,_$);let $=D(this,b$),T=e1(this).isoDate,W=g6(T.year,T.month,T.day+1),U=LT($,T),X=LT($,W);return B8(R$.fromEpochNsDiff(X,U),"hour")}get daysInWeek(){return F6(this,"daysInWeek")}get daysInMonth(){return F6(this,"daysInMonth")}get daysInYear(){return F6(this,"daysInYear")}get monthsInYear(){return F6(this,"monthsInYear")}get inLeapYear(){return F6(this,"inLeapYear")}get offset(){return C(this,_$),BO(f0(D(this,b$),D(this,F$)))}get offsetNanoseconds(){return C(this,_$),f0(D(this,b$),D(this,F$))}with($,T=void 0){if(C(this,_$),!Q4($))throw new TypeError("invalid zoned-date-time-like");TU($);let W=D(this,m),U=D(this,b$),X=f0(U,D(this,F$)),Y=e1(this),w={...J6(W,Y.isoDate),...Y.time,offset:BO(X)};w=PW(W,w,H1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset"],"partial"));let G=$$(T),H=j8(G),z=iG(G,"prefer"),F=i8(W,w,C$(G)),O=XU(w.offset);return s4($9(F.isoDate,F.time,"option",O,U,H,z,!1),U,W)}withPlainTime($=void 0){C(this,_$);let T=D(this,b$),W=D(this,m),U=e1(this).isoDate,X;return X=$===void 0?LT(T,U):$6(T,B$(U,D(_T($),O4)),"compatible"),s4(X,T,W)}withTimeZone($){C(this,_$);let T=L6($);return s4(D(this,F$),T,D(this,m))}withCalendar($){C(this,_$);let T=a8($);return s4(D(this,F$),D(this,b$),T)}add($,T=void 0){return C(this,_$),wM("add",this,$,T)}subtract($,T=void 0){return C(this,_$),wM("subtract",this,$,T)}until($,T=void 0){return C(this,_$),eA("until",this,$,T)}since($,T=void 0){return C(this,_$),eA("since",this,$,T)}round($){if(C(this,_$),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?BW("smallestUnit",$):$$($),W=WU(T),U=y1(T,"halfExpand"),X=h6(T,"smallestUnit","time",c0,["day"]),Y={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X];if(UU(W,Y,Y===1),X==="nanosecond"&&W===1)return s4(D(this,F$),D(this,b$),D(this,m));let w=D(this,b$),G=D(this,F$),H=e1(this),z;if(X==="day"){let F=H.isoDate,O=g6(F.year,F.month,F.day+1),Q=LT(w,F),Z=LT(w,O),V=q.subtract(Z,Q);z=R$.fromEpochNsDiff(G,Q).round(V,U).addToEpochNs(Q)}else{let F=hO(H,W,X,U),O=f0(w,G);z=$9(F.isoDate,F.time,"option",O,w,"compatible","prefer",!1)}return s4(z,w,D(this,m))}equals($){C(this,_$);let T=k8($),W=D(this,F$),U=D(T,F$);return!!q.equal(q.BigInt(W),q.BigInt(U))&&!!cM(D(this,b$),D(T,b$))&&X0(D(this,m),D(T,m))}toString($=void 0){C(this,_$);let T=$$($),W=o8(T),U=l8(T),X=function(O){return g0(O,"offset",["auto","never"],"auto")}(T),Y=y1(T,"trunc"),w=h6(T,"smallestUnit","time",void 0);if(w==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let G=function(O){return g0(O,"timeZoneName",["auto","never","critical"],"auto")}(T),{precision:H,unit:z,increment:F}=r8(w,U);return dA(this,H,W,G,X,{unit:z,increment:F,roundingMode:Y})}toLocaleString($=void 0,T=void 0){C(this,_$);let W=$$(T),U=Object.create(null);if(function(G,H,z,F){if(H==null)return;let O=Reflect.ownKeys(H);for(let Q=0;Q<O.length;Q++){let Z=O[Q];if(!z.some((V)=>Object.is(V,Z))&&Object.prototype.propertyIsEnumerable.call(H,Z)){let V=H[Z];G[Z]=V}}}(U,W,["timeZone"]),W.timeZone!==void 0)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");if(U.year===void 0&&U.month===void 0&&U.day===void 0&&U.era===void 0&&U.weekday===void 0&&U.dateStyle===void 0&&U.hour===void 0&&U.minute===void 0&&U.second===void 0&&U.fractionalSecondDigits===void 0&&U.timeStyle===void 0&&U.dayPeriod===void 0&&U.timeZoneName===void 0&&(U.timeZoneName="short"),U.timeZone=D(this,b$),oA(U.timeZone))throw new RangeError("toLocaleString does not currently support offset time zones");let X=new w1($,U),Y=lb.call(X).calendar,w=D(this,m);if(w!=="iso8601"&&Y!=="iso8601"&&!X0(Y,w))throw new RangeError(`cannot format ZonedDateTime with calendar ${w} in locale with calendar ${Y}`);return X.format(b1(D(this,F$)))}toJSON(){return C(this,_$),dA(this,"auto")}valueOf(){ST("ZonedDateTime")}startOfDay(){C(this,_$);let $=D(this,b$);return s4(LT($,e1(this).isoDate),$,D(this,m))}getTimeZoneTransition($){C(this,_$);let T=D(this,b$);if($===void 0)throw new TypeError("options parameter is required");let W=g0(typeof $=="string"?BW("direction",$):$$($),"direction",["next","previous"],c0);if(W===void 0)throw new TypeError("direction option is required");if(oA(T)||T==="UTC")return null;let U=D(this,F$),X=W==="next"?rO(T,U):IO(T,U);return X===null?null:s4(X,T,D(this,m))}toInstant(){return C(this,_$),b1(D(this,F$))}toPlainDate(){return C(this,_$),N6(e1(this).isoDate,D(this,m))}toPlainTime(){return C(this,_$),b0(e1(this).time)}toPlainDateTime(){return C(this,_$),E1(e1(this),D(this,m))}static from($,T=void 0){return k8($,T)}static compare($,T){let W=k8($),U=k8(T),X=D(W,F$),Y=D(U,F$);return q.lessThan(q.BigInt(X),q.BigInt(Y))?-1:q.greaterThan(q.BigInt(X),q.BigInt(Y))?1:0}}function e1($){return N1(D($,b$),D($,F$))}function F6($,T){C($,_$);let W=e1($).isoDate;return n8($).isoToDate(W,{[T]:!0})[T]}function g2($,T){return C($,_$),e1($).time[T]}p0(P9,"Temporal.ZonedDateTime");var C9=Object.freeze({__proto__:null,Duration:$U,Instant:_9,Now:PN,PlainDate:R9,PlainDateTime:k9,PlainMonthDay:v9,PlainTime:UY,PlainYearMonth:q9,ZonedDateTime:P9}),Zs=class ${toTemporalInstant(){return b1(f1(Date.prototype.valueOf.call(this)))}}.prototype.toTemporalInstant,rb=[_9,R9,k9,$U,v9,UY,q9,P9];for(let $ of rb){let T=Object.getOwnPropertyDescriptor($,"prototype");(T.configurable||T.enumerable||T.writable)&&(T.configurable=!1,T.enumerable=!1,T.writable=!1,Object.defineProperty($,"prototype",T))}class S9{supported;constructor($){this.supported=$}refine($){for(let[T,W]of Object.entries(this.supported))try{if(W($)===!0&&W!==Boolean)return{type:T,data:$}}catch(U){try{if($ instanceof W)return{type:T,data:$}}catch(X){}}return null}}var nb=new S9({number:($)=>typeof $==="number",string:($)=>typeof $==="string",boolean:($)=>typeof $==="boolean",null:($)=>$===null});function ib($){if(!$)return!1;return Object.getPrototypeOf($)===Object.prototype}var tb=new S9({object:ib,array:($)=>Array.isArray($)}),ab=new S9({...nb.supported,...tb.supported}),CN=($)=>{if($===void 0)return"undefined";let T=ab.refine($);if(T)return T.type;return Object.getPrototypeOf($).constructor.name};var M=Symbol.for("drizzle:entityKind"),Ks=Symbol.for("drizzle:hasOwnEntityKind");function j($,T){if(!$||typeof $!=="object")return!1;if($ instanceof T)return!0;if(!Object.prototype.hasOwnProperty.call(T,M))throw new Error(`Class "${T.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 W=Object.getPrototypeOf($).constructor;if(W)while(W){if(M in W&&W[M]===T[M])return!0;W=Object.getPrototypeOf(W)}return!1}class u${constructor($,T){this.table=$,this.config=T,this.name=T.name,this.keyAsName=T.keyAsName,this.notNull=T.notNull,this.default=T.default,this.defaultFn=T.defaultFn,this.onUpdateFn=T.onUpdateFn,this.hasDefault=T.hasDefault,this.primary=T.primaryKey,this.isUnique=T.isUnique,this.uniqueName=T.uniqueName,this.uniqueType=T.uniqueType,this.dataType=T.dataType,this.columnType=T.columnType,this.generated=T.generated,this.generatedIdentity=T.generatedIdentity}static[M]="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($){return $}mapToDriverValue($){return $}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class YQ{static[M]="ColumnBuilder";config;constructor($,T,W){this.config={name:$,keyAsName:$==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:T,columnType:W,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default($){return this.config.default=$,this.config.hasDefault=!0,this}$defaultFn($){return this.config.defaultFn=$,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn($){return this.config.onUpdateFn=$,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName($){if(this.config.name!=="")return;this.config.name=$}}var h1=Symbol.for("drizzle:Name");class wQ{static[M]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor($,T){if(this.reference=()=>{let{name:W,columns:U,foreignColumns:X}=$();return{name:W,columns:U,foreignTable:X[0].table,foreignColumns:X}},T)this._onUpdate=T.onUpdate,this._onDelete=T.onDelete}onUpdate($){return this._onUpdate=$===void 0?"no action":$,this}onDelete($){return this._onDelete=$===void 0?"no action":$,this}build($){return new SN($,this)}}class SN{constructor($,T){this.table=$,this.reference=T.reference,this.onUpdate=T._onUpdate,this.onDelete=T._onDelete}static[M]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:$,columns:T,foreignColumns:W}=this.reference(),U=T.map((w)=>w.name),X=W.map((w)=>w.name),Y=[this.table[h1],...U,W[0].table[h1],...X];return $??`${Y.join("_")}_fk`}}function j9($,...T){return $(...T)}function jN($,T){return`${$[h1]}_${T.join("_")}_unique`}function BN($,T,W){for(let U=T;U<$.length;U++){let X=$[U];if(X==="\\"){U++;continue}if(X==='"')return[$.slice(T,U).replace(/\\/g,""),U+1];if(W)continue;if(X===","||X==="}")return[$.slice(T,U).replace(/\\/g,""),U]}return[$.slice(T).replace(/\\/g,""),$.length]}function xN($,T=0){let W=[],U=T,X=!1;while(U<$.length){let Y=$[U];if(Y===","){if(X||U===T)W.push("");X=!0,U++;continue}if(X=!1,Y==="\\"){U+=2;continue}if(Y==='"'){let[H,z]=BN($,U+1,!0);W.push(H),U=z;continue}if(Y==="}")return[W,U+1];if(Y==="{"){let[H,z]=xN($,U+1);W.push(H),U=z;continue}let[w,G]=BN($,U,!1);W.push(w),U=G}return[W,U]}function IN($){let[T]=xN($,1);return T}function GQ($){return`{${$.map((T)=>{if(Array.isArray(T))return GQ(T);if(typeof T==="string")return`"${T.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${T}`}).join(",")}}`}class t extends YQ{foreignKeyConfigs=[];static[M]="PgColumnBuilder";array($){return new fN(this.config.name,this,$)}references($,T={}){return this.foreignKeyConfigs.push({ref:$,actions:T}),this}unique($,T){return this.config.isUnique=!0,this.config.uniqueName=$,this.config.uniqueType=T?.nulls,this}generatedAlwaysAs($){return this.config.generated={as:$,type:"always",mode:"stored"},this}buildForeignKeys($,T){return this.foreignKeyConfigs.map(({ref:W,actions:U})=>{return j9((X,Y)=>{let w=new wQ(()=>{let G=X();return{columns:[$],foreignColumns:[G]}});if(Y.onUpdate)w.onUpdate(Y.onUpdate);if(Y.onDelete)w.onDelete(Y.onDelete);return w.build(T)},W,U)})}buildExtraConfigColumn($){return new bN($,this.config)}}class u extends u${constructor($,T){if(!T.uniqueName)T.uniqueName=jN($,[T.name]);super($,T);this.table=$}static[M]="PgColumn"}class bN extends u{static[M]="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($){return this.indexConfig.opClass=$,this}}class XY{static[M]="IndexedColumn";constructor($,T,W,U){this.name=$,this.keyAsName=T,this.type=W,this.indexConfig=U}name;keyAsName;type;indexConfig}class fN extends t{static[M]="PgArrayBuilder";constructor($,T,W){super($,"array","PgArray");this.config.baseBuilder=T,this.config.size=W}build($){let T=this.config.baseBuilder.build($);return new zQ($,this.config,T)}}class zQ extends u{constructor($,T,W,U){super($,T);this.baseColumn=W,this.range=U,this.size=T.size}size;static[M]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue($){if(typeof $==="string")$=IN($);return $.map((T)=>this.baseColumn.mapFromDriverValue(T))}mapToDriverValue($,T=!1){let W=$.map((U)=>U===null?null:j(this.baseColumn,zQ)?this.baseColumn.mapToDriverValue(U,!0):this.baseColumn.mapToDriverValue(U));if(T)return W;return GQ(W)}}class yN extends t{static[M]="PgEnumObjectColumnBuilder";constructor($,T){super($,"string","PgEnumObjectColumn");this.config.enum=T}build($){return new hN($,this.config)}}class hN extends u{static[M]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor($,T){super($,T);this.enum=T.enum}getSQLType(){return this.enum.enumName}}var B9=Symbol.for("drizzle:isPgEnum");function gN($){return!!$&&typeof $==="function"&&B9 in $&&$[B9]===!0}class mN extends t{static[M]="PgEnumColumnBuilder";constructor($,T){super($,"string","PgEnumColumn");this.config.enum=T}build($){return new cN($,this.config)}}class cN extends u{static[M]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor($,T){super($,T);this.enum=T.enum}getSQLType(){return this.enum.enumName}}function YY($,T){return Array.isArray(T)?sb($,[...T],void 0):eb($,T,void 0)}function sb($,T,W){let U=Object.assign((X)=>new mN(X??"",U),{enumName:$,enumValues:T,schema:W,[B9]:!0});return U}function eb($,T,W){let U=Object.assign((X)=>new yN(X??"",U),{enumName:$,enumValues:Object.values(T),schema:W,[B9]:!0});return U}class A4{static[M]="Subquery";constructor($,T,W,U=!1,X=[]){this._={brand:"Subquery",sql:$,selectedFields:T,alias:W,isWith:U,usedTables:X}}}class wY extends A4{static[M]="WithSubquery"}var uN="0.44.0";var HQ,FQ,p$={startActiveSpan($,T){if(!HQ)return T();if(!FQ)FQ=HQ.trace.getTracer("drizzle-orm",uN);return j9((W,U)=>U.startActiveSpan($,(X)=>{try{return T(X)}catch(Y){throw X.setStatus({code:W.SpanStatusCode.ERROR,message:Y instanceof Error?Y.message:"Unknown error"}),Y}finally{X.end()}}),HQ,FQ)}};var i$=Symbol.for("drizzle:ViewBaseConfig");var yW=Symbol.for("drizzle:Schema"),x9=Symbol.for("drizzle:Columns"),pN=Symbol.for("drizzle:ExtraConfigColumns"),OQ=Symbol.for("drizzle:OriginalName"),QQ=Symbol.for("drizzle:BaseName"),GY=Symbol.for("drizzle:IsAlias"),dN=Symbol.for("drizzle:ExtraConfigBuilder"),$f=Symbol.for("drizzle:IsDrizzleTable");class p{static[M]="Table";static Symbol={Name:h1,Schema:yW,OriginalName:OQ,Columns:x9,ExtraConfigColumns:pN,BaseName:QQ,IsAlias:GY,ExtraConfigBuilder:dN};[h1];[OQ];[yW];[x9];[pN];[QQ];[GY]=!1;[$f]=!0;[dN]=void 0;constructor($,T,W){this[h1]=this[OQ]=$,this[yW]=T,this[QQ]=W}}function m4($){return $[h1]}function hW($){return`${$[yW]??"public"}.${$[h1]}`}function ZQ($){return $!==null&&$!==void 0&&typeof $.getSQL==="function"}function Tf($){let T={sql:"",params:[]};for(let W of $)if(T.sql+=W.sql,T.params.push(...W.params),W.typings?.length){if(!T.typings)T.typings=[];T.typings.push(...W.typings)}return T}class j4{static[M]="StringChunk";value;constructor($){this.value=Array.isArray($)?$:[$]}getSQL(){return new i([this])}}class i{constructor($){this.queryChunks=$;for(let T of $)if(j(T,p)){let W=T[p.Symbol.Schema];this.usedTables.push(W===void 0?T[p.Symbol.Name]:W+"."+T[p.Symbol.Name])}}static[M]="SQL";decoder=lN;shouldInlineParams=!1;usedTables=[];append($){return this.queryChunks.push(...$.queryChunks),this}toQuery($){return p$.startActiveSpan("drizzle.buildSQL",(T)=>{let W=this.buildQueryFromSourceParams(this.queryChunks,$);return T?.setAttributes({"drizzle.query.text":W.sql,"drizzle.query.params":JSON.stringify(W.params)}),W})}buildQueryFromSourceParams($,T){let W=Object.assign({},T,{inlineParams:T.inlineParams||this.shouldInlineParams,paramStartIndex:T.paramStartIndex||{value:0}}),{casing:U,escapeName:X,escapeParam:Y,prepareTyping:w,inlineParams:G,paramStartIndex:H}=W;return Tf($.map((z)=>{if(j(z,j4))return{sql:z.value.join(""),params:[]};if(j(z,I9))return{sql:X(z.value),params:[]};if(z===void 0)return{sql:"",params:[]};if(Array.isArray(z)){let F=[new j4("(")];for(let[O,Q]of z.entries())if(F.push(Q),O<z.length-1)F.push(new j4(", "));return F.push(new j4(")")),this.buildQueryFromSourceParams(F,W)}if(j(z,i))return this.buildQueryFromSourceParams(z.queryChunks,{...W,inlineParams:G||z.shouldInlineParams});if(j(z,p)){let F=z[p.Symbol.Schema],O=z[p.Symbol.Name];return{sql:F===void 0||z[GY]?X(O):X(F)+"."+X(O),params:[]}}if(j(z,u$)){let F=U.getColumnCasing(z);if(T.invokeSource==="indexes")return{sql:X(F),params:[]};let O=z.table[p.Symbol.Schema];return{sql:z.table[GY]||O===void 0?X(z.table[p.Symbol.Name])+"."+X(F):X(O)+"."+X(z.table[p.Symbol.Name])+"."+X(F),params:[]}}if(j(z,c6)){let F=z[i$].schema,O=z[i$].name;return{sql:F===void 0||z[i$].isAlias?X(O):X(F)+"."+X(O),params:[]}}if(j(z,F1)){if(j(z.value,BT))return{sql:Y(H.value++,z),params:[z],typings:["none"]};let F=z.value===null?null:z.encoder.mapToDriverValue(z.value);if(j(F,i))return this.buildQueryFromSourceParams([F],W);if(G)return{sql:this.mapInlineParam(F,W),params:[]};let O=["none"];if(w)O=[w(z.encoder)];return{sql:Y(H.value++,F),params:[F],typings:O}}if(j(z,BT))return{sql:Y(H.value++,z),params:[z],typings:["none"]};if(j(z,i.Aliased)&&z.fieldAlias!==void 0)return{sql:X(z.fieldAlias),params:[]};if(j(z,A4)){if(z._.isWith)return{sql:X(z._.alias),params:[]};return this.buildQueryFromSourceParams([new j4("("),z._.sql,new j4(") "),new I9(z._.alias)],W)}if(gN(z)){if(z.schema)return{sql:X(z.schema)+"."+X(z.enumName),params:[]};return{sql:X(z.enumName),params:[]}}if(ZQ(z)){if(z.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([z.getSQL()],W);return this.buildQueryFromSourceParams([new j4("("),z.getSQL(),new j4(")")],W)}if(G)return{sql:this.mapInlineParam(z,W),params:[]};return{sql:Y(H.value++,z),params:[z],typings:["none"]}}))}mapInlineParam($,{escapeString:T}){if($===null)return"null";if(typeof $==="number"||typeof $==="boolean")return $.toString();if(typeof $==="string")return T($);if(typeof $==="object"){let W=$.toString();if(W==="[object Object]")return T(JSON.stringify($));return T(W)}throw new Error("Unexpected param value: "+$)}getSQL(){return this}as($){if($===void 0)return this;return new i.Aliased(this,$)}mapWith($){return this.decoder=typeof $==="function"?{mapFromDriverValue:$}:$,this}inlineParams(){return this.shouldInlineParams=!0,this}if($){return $?this:void 0}}class I9{constructor($){this.value=$}static[M]="Name";brand;getSQL(){return new i([this])}}function oN($){return typeof $==="object"&&$!==null&&"mapToDriverValue"in $&&typeof $.mapToDriverValue==="function"}var lN={mapFromDriverValue:($)=>$},rN={mapToDriverValue:($)=>$},Xe={...lN,...rN};class F1{constructor($,T=rN){this.value=$,this.encoder=T}static[M]="Param";brand;getSQL(){return new i([this])}}function L($,...T){let W=[];if(T.length>0||$.length>0&&$[0]!=="")W.push(new j4($[0]));for(let[U,X]of T.entries())W.push(X,new j4($[U+1]));return new i(W)}(($)=>{function T(){return new i([])}$.empty=T;function W(H){return new i(H)}$.fromList=W;function U(H){return new i([new j4(H)])}$.raw=U;function X(H,z){let F=[];for(let[O,Q]of H.entries()){if(O>0&&z!==void 0)F.push(z);F.push(Q)}return new i(F)}$.join=X;function Y(H){return new I9(H)}$.identifier=Y;function w(H){return new BT(H)}$.placeholder=w;function G(H,z){return new F1(H,z)}$.param=G})(L||(L={}));(($)=>{class T{constructor(W,U){this.sql=W,this.fieldAlias=U}static[M]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new T(this.sql,this.fieldAlias)}}$.Aliased=T})(i||(i={}));class BT{constructor($){this.name=$}static[M]="Placeholder";getSQL(){return new i([this])}}function DQ($,T){return $.map((W)=>{if(j(W,BT)){if(!(W.name in T))throw new Error(`No value for placeholder "${W.name}" was provided`);return T[W.name]}if(j(W,F1)&&j(W.value,BT)){if(!(W.value.name in T))throw new Error(`No value for placeholder "${W.value.name}" was provided`);return W.encoder.mapToDriverValue(T[W.value.name])}return W})}var Wf=Symbol.for("drizzle:IsDrizzleView");class c6{static[M]="View";[i$];[Wf]=!0;constructor({name:$,schema:T,selectedFields:W,query:U}){this[i$]={name:$,originalName:$,schema:T,selectedFields:W,query:U,isExisting:!U,isAlias:!1}}getSQL(){return new i([this])}}u$.prototype.getSQL=function(){return new i([this])};p.prototype.getSQL=function(){return new i([this])};A4.prototype.getSQL=function(){return new i([this])};class wU{constructor($){this.table=$}static[M]="ColumnAliasProxyHandler";get($,T){if(T==="table")return this.table;return $[T]}}class zY{constructor($,T){this.alias=$,this.replaceOriginalName=T}static[M]="TableAliasProxyHandler";get($,T){if(T===p.Symbol.IsAlias)return!0;if(T===p.Symbol.Name)return this.alias;if(this.replaceOriginalName&&T===p.Symbol.OriginalName)return this.alias;if(T===i$)return{...$[i$],name:this.alias,isAlias:!0};if(T===p.Symbol.Columns){let U=$[p.Symbol.Columns];if(!U)return U;let X={};return Object.keys(U).map((Y)=>{X[Y]=new Proxy(U[Y],new wU(new Proxy($,this)))}),X}let W=$[T];if(j(W,u$))return new Proxy(W,new wU(new Proxy($,this)));return W}}function b9($,T){return new Proxy($,new zY(T,!1))}function z0($,T){return new Proxy($,new wU(new Proxy($.table,new zY(T,!1))))}function VQ($,T){return new i.Aliased(HY($.sql,T),$.fieldAlias)}function HY($,T){return L.join($.queryChunks.map((W)=>{if(j(W,u$))return z0(W,T);if(j(W,i))return HY(W,T);if(j(W,i.Aliased))return VQ(W,T);return W}))}class f9 extends Error{static[M]="DrizzleError";constructor({message:$,cause:T}){super($);this.name="DrizzleError",this.cause=T}}class KQ extends f9{static[M]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class nN{static[M]="ConsoleLogWriter";write($){console.log($)}}class EQ{static[M]="DefaultLogger";writer;constructor($){this.writer=$?.writer??new nN}logQuery($,T){let W=T.map((X)=>{try{return JSON.stringify(X)}catch{return String(X)}}),U=W.length?` -- params: [${W.join(", ")}]`:"";this.writer.write(`Query: ${$}${U}`)}}class AQ{static[M]="NoopLogger";logQuery(){}}class k6{static[M]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch($){return this.then(void 0,$)}finally($){return this.then((T)=>{return $?.(),T},(T)=>{throw $?.(),T})}then($,T){return this.execute().then($,T)}}function iN($,T,W){let U={},X=$.reduce((Y,{path:w,field:G},H)=>{let z;if(j(G,u$))z=G;else if(j(G,i))z=G.decoder;else z=G.sql.decoder;let F=Y;for(let[O,Q]of w.entries())if(O<w.length-1){if(!(Q in F))F[Q]={};F=F[Q]}else{let Z=T[H],V=F[Q]=Z===null?null:z.mapFromDriverValue(Z);if(W&&j(G,u$)&&w.length===2){let E=w[0];if(!(E in U))U[E]=V===null?m4(G.table):!1;else if(typeof U[E]==="string"&&U[E]!==m4(G.table))U[E]=!1}}return Y},{});if(W&&Object.keys(U).length>0){for(let[Y,w]of Object.entries(U))if(typeof w==="string"&&!W[w])X[Y]=null}return X}function J1($,T){return Object.entries($).reduce((W,[U,X])=>{if(typeof U!=="string")return W;let Y=T?[...T,U]:[U];if(j(X,u$)||j(X,i)||j(X,i.Aliased))W.push({path:Y,field:X});else if(j(X,p))W.push(...J1(X[p.Symbol.Columns],Y));else W.push(...J1(X,Y));return W},[])}function FY($,T){let W=Object.keys($),U=Object.keys(T);if(W.length!==U.length)return!1;for(let[X,Y]of W.entries())if(Y!==U[X])return!1;return!0}function y9($,T){let W=Object.entries(T).filter(([,U])=>U!==void 0).map(([U,X])=>{if(j(X,i)||j(X,u$))return[U,X];else return[U,new F1(X,$[p.Symbol.Columns][U])]});if(W.length===0)throw new Error("No values to set");return Object.fromEntries(W)}function tN($,T){for(let W of T)for(let U of Object.getOwnPropertyNames(W.prototype)){if(U==="constructor")continue;Object.defineProperty($.prototype,U,Object.getOwnPropertyDescriptor(W.prototype,U)||Object.create(null))}}function aN($){return $[p.Symbol.Columns]}function d0($){return j($,A4)?$._.alias:j($,c6)?$[i$].name:j($,i)?void 0:$[p.Symbol.IsAlias]?$[p.Symbol.Name]:$[p.Symbol.BaseName]}function P$($,T){return{name:typeof $==="string"&&$.length>0?$:"",config:typeof $==="object"?$:T}}function sN($){if(typeof $!=="object"||$===null)return!1;if($.constructor.name!=="Object")return!1;if("logger"in $){let T=typeof $.logger;if(T!=="boolean"&&(T!=="object"||typeof $.logger.logQuery!=="function")&&T!=="undefined")return!1;return!0}if("schema"in $){let T=typeof $.schema;if(T!=="object"&&T!=="undefined")return!1;return!0}if("casing"in $){let T=typeof $.casing;if(T!=="string"&&T!=="undefined")return!1;return!0}if("mode"in $){if($.mode!=="default"||$.mode!=="planetscale"||$.mode!==void 0)return!1;return!0}if("connection"in $){let T=typeof $.connection;if(T!=="string"&&T!=="object"&&T!=="undefined")return!1;return!0}if("client"in $){let T=typeof $.client;if(T!=="object"&&T!=="function"&&T!=="undefined")return!1;return!0}if(Object.keys($).length===0)return!0;return!1}class xT extends t{static[M]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity($){if($){let{name:T,...W}=$;this.config.generatedIdentity={type:"always",sequenceName:T,sequenceOptions:W}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity($){if($){let{name:T,...W}=$;this.config.generatedIdentity={type:"byDefault",sequenceName:T,sequenceOptions:W}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class eN extends xT{static[M]="PgBigInt53Builder";constructor($){super($,"number","PgBigInt53")}build($){return new $L($,this.config)}}class $L extends u{static[M]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class TL extends xT{static[M]="PgBigInt64Builder";constructor($){super($,"bigint","PgBigInt64")}build($){return new WL($,this.config)}}class WL extends u{static[M]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue($){return BigInt($)}}function UL($,T){let{name:W,config:U}=P$($,T);if(U.mode==="number")return new eN(W);return new TL(W)}class XL extends t{static[M]="PgBigSerial53Builder";constructor($){super($,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new YL($,this.config)}}class YL extends u{static[M]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class wL extends t{static[M]="PgBigSerial64Builder";constructor($){super($,"bigint","PgBigSerial64");this.config.hasDefault=!0}build($){return new GL($,this.config)}}class GL extends u{static[M]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue($){return BigInt($)}}function zL($,T){let{name:W,config:U}=P$($,T);if(U.mode==="number")return new XL(W);return new wL(W)}class HL extends t{static[M]="PgBooleanBuilder";constructor($){super($,"boolean","PgBoolean")}build($){return new FL($,this.config)}}class FL extends u{static[M]="PgBoolean";getSQLType(){return"boolean"}}function OY($){return new HL($??"")}class OL extends t{static[M]="PgCharBuilder";constructor($,T){super($,"string","PgChar");this.config.length=T.length,this.config.enumValues=T.enum}build($){return new QL($,this.config)}}class QL extends u{static[M]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function ZL($,T={}){let{name:W,config:U}=P$($,T);return new OL(W,U)}class DL extends t{static[M]="PgCidrBuilder";constructor($){super($,"string","PgCidr")}build($){return new VL($,this.config)}}class VL extends u{static[M]="PgCidr";getSQLType(){return"cidr"}}function KL($){return new DL($??"")}class EL extends t{static[M]="PgCustomColumnBuilder";constructor($,T,W){super($,"custom","PgCustomColumn");this.config.fieldConfig=T,this.config.customTypeParams=W}build($){return new AL($,this.config)}}class AL extends u{static[M]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor($,T){super($,T);this.sqlName=T.customTypeParams.dataType(T.fieldConfig),this.mapTo=T.customTypeParams.toDriver,this.mapFrom=T.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue($){return typeof this.mapFrom==="function"?this.mapFrom($):$}mapToDriverValue($){return typeof this.mapTo==="function"?this.mapTo($):$}}function ML($){return(T,W)=>{let{name:U,config:X}=P$(T,W);return new EL(U,X,$)}}class o0 extends t{static[M]="PgDateColumnBaseBuilder";defaultNow(){return this.default(L`now()`)}}class NL extends o0{static[M]="PgDateBuilder";constructor($){super($,"date","PgDate")}build($){return new h9($,this.config)}}class h9 extends u{static[M]="PgDate";getSQLType(){return"date"}mapFromDriverValue($){return new Date($)}mapToDriverValue($){return $.toISOString()}}class LL extends o0{static[M]="PgDateStringBuilder";constructor($){super($,"string","PgDateString")}build($){return new g9($,this.config)}}class g9 extends u{static[M]="PgDateString";getSQLType(){return"date"}}function JL($,T){let{name:W,config:U}=P$($,T);if(U?.mode==="date")return new NL(W);return new LL(W)}class _L extends t{static[M]="PgDoublePrecisionBuilder";constructor($){super($,"number","PgDoublePrecision")}build($){return new RL($,this.config)}}class RL extends u{static[M]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue($){if(typeof $==="string")return Number.parseFloat($);return $}}function kL($){return new _L($??"")}class vL extends t{static[M]="PgInetBuilder";constructor($){super($,"string","PgInet")}build($){return new qL($,this.config)}}class qL extends u{static[M]="PgInet";getSQLType(){return"inet"}}function PL($){return new vL($??"")}class CL extends xT{static[M]="PgIntegerBuilder";constructor($){super($,"number","PgInteger")}build($){return new SL($,this.config)}}class SL extends u{static[M]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue($){if(typeof $==="string")return Number.parseInt($);return $}}function QY($){return new CL($??"")}class jL extends t{static[M]="PgIntervalBuilder";constructor($,T){super($,"string","PgInterval");this.config.intervalConfig=T}build($){return new BL($,this.config)}}class BL extends u{static[M]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let $=this.fields?` ${this.fields}`:"",T=this.precision?`(${this.precision})`:"";return`interval${$}${T}`}}function xL($,T={}){let{name:W,config:U}=P$($,T);return new jL(W,U)}class IL extends t{static[M]="PgJsonBuilder";constructor($){super($,"json","PgJson")}build($){return new m9($,this.config)}}class m9 extends u{static[M]="PgJson";constructor($,T){super($,T)}getSQLType(){return"json"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function bL($){return new IL($??"")}class fL extends t{static[M]="PgJsonbBuilder";constructor($){super($,"json","PgJsonb")}build($){return new c9($,this.config)}}class c9 extends u{static[M]="PgJsonb";constructor($,T){super($,T)}getSQLType(){return"jsonb"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function yL($){return new fL($??"")}class hL extends t{static[M]="PgLineBuilder";constructor($){super($,"array","PgLine")}build($){return new gL($,this.config)}}class gL extends u{static[M]="PgLine";getSQLType(){return"line"}mapFromDriverValue($){let[T,W,U]=$.slice(1,-1).split(",");return[Number.parseFloat(T),Number.parseFloat(W),Number.parseFloat(U)]}mapToDriverValue($){return`{${$[0]},${$[1]},${$[2]}}`}}class mL extends t{static[M]="PgLineABCBuilder";constructor($){super($,"json","PgLineABC")}build($){return new cL($,this.config)}}class cL extends u{static[M]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue($){let[T,W,U]=$.slice(1,-1).split(",");return{a:Number.parseFloat(T),b:Number.parseFloat(W),c:Number.parseFloat(U)}}mapToDriverValue($){return`{${$.a},${$.b},${$.c}}`}}function uL($,T){let{name:W,config:U}=P$($,T);if(!U?.mode||U.mode==="tuple")return new hL(W);return new mL(W)}class pL extends t{static[M]="PgMacaddrBuilder";constructor($){super($,"string","PgMacaddr")}build($){return new dL($,this.config)}}class dL extends u{static[M]="PgMacaddr";getSQLType(){return"macaddr"}}function oL($){return new pL($??"")}class lL extends t{static[M]="PgMacaddr8Builder";constructor($){super($,"string","PgMacaddr8")}build($){return new rL($,this.config)}}class rL extends u{static[M]="PgMacaddr8";getSQLType(){return"macaddr8"}}function nL($){return new lL($??"")}class iL extends t{static[M]="PgNumericBuilder";constructor($,T,W){super($,"string","PgNumeric");this.config.precision=T,this.config.scale=W}build($){return new u9($,this.config)}}class u9 extends u{static[M]="PgNumeric";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.scale}mapFromDriverValue($){if(typeof $==="string")return $;return 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 tL extends t{static[M]="PgNumericNumberBuilder";constructor($,T,W){super($,"number","PgNumericNumber");this.config.precision=T,this.config.scale=W}build($){return new aL($,this.config)}}class aL extends u{static[M]="PgNumericNumber";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.scale}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}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 sL extends t{static[M]="PgNumericBigIntBuilder";constructor($,T,W){super($,"bigint","PgNumericBigInt");this.config.precision=T,this.config.scale=W}build($){return new eL($,this.config)}}class eL extends u{static[M]="PgNumericBigInt";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.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 $J($,T){let{name:W,config:U}=P$($,T),X=U?.mode;return X==="number"?new tL(W,U?.precision,U?.scale):X==="bigint"?new sL(W,U?.precision,U?.scale):new iL(W,U?.precision,U?.scale)}class TJ extends t{static[M]="PgPointTupleBuilder";constructor($){super($,"array","PgPointTuple")}build($){return new WJ($,this.config)}}class WJ extends u{static[M]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[T,W]=$.slice(1,-1).split(",");return[Number.parseFloat(T),Number.parseFloat(W)]}return[$.x,$.y]}mapToDriverValue($){return`(${$[0]},${$[1]})`}}class UJ extends t{static[M]="PgPointObjectBuilder";constructor($){super($,"json","PgPointObject")}build($){return new XJ($,this.config)}}class XJ extends u{static[M]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[T,W]=$.slice(1,-1).split(",");return{x:Number.parseFloat(T),y:Number.parseFloat(W)}}return $}mapToDriverValue($){return`(${$.x},${$.y})`}}function YJ($,T){let{name:W,config:U}=P$($,T);if(!U?.mode||U.mode==="tuple")return new TJ(W);return new UJ(W)}function Uf($){let T=[];for(let W=0;W<$.length;W+=2)T.push(Number.parseInt($.slice(W,W+2),16));return new Uint8Array(T)}function wJ($,T){let W=new ArrayBuffer(8),U=new DataView(W);for(let X=0;X<8;X++)U.setUint8(X,$[T+X]);return U.getFloat64(0,!0)}function MQ($){let T=Uf($),W=0,U=T[W];W+=1;let X=new DataView(T.buffer),Y=X.getUint32(W,U===1);W+=4;let w;if(Y&536870912)w=X.getUint32(W,U===1),W+=4;if((Y&65535)===1){let G=wJ(T,W);W+=8;let H=wJ(T,W);return W+=8,[G,H]}throw new Error("Unsupported geometry type")}class GJ extends t{static[M]="PgGeometryBuilder";constructor($){super($,"array","PgGeometry")}build($){return new zJ($,this.config)}}class zJ extends u{static[M]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue($){return MQ($)}mapToDriverValue($){return`point(${$[0]} ${$[1]})`}}class HJ extends t{static[M]="PgGeometryObjectBuilder";constructor($){super($,"json","PgGeometryObject")}build($){return new FJ($,this.config)}}class FJ extends u{static[M]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue($){let T=MQ($);return{x:T[0],y:T[1]}}mapToDriverValue($){return`point(${$.x} ${$.y})`}}function OJ($,T){let{name:W,config:U}=P$($,T);if(!U?.mode||U.mode==="tuple")return new GJ(W);return new HJ(W)}class QJ extends t{static[M]="PgRealBuilder";constructor($,T){super($,"number","PgReal");this.config.length=T}build($){return new ZJ($,this.config)}}class ZJ extends u{static[M]="PgReal";constructor($,T){super($,T)}getSQLType(){return"real"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number.parseFloat($);return $}}function DJ($){return new QJ($??"")}class VJ extends t{static[M]="PgSerialBuilder";constructor($){super($,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new KJ($,this.config)}}class KJ extends u{static[M]="PgSerial";getSQLType(){return"serial"}}function EJ($){return new VJ($??"")}class AJ extends xT{static[M]="PgSmallIntBuilder";constructor($){super($,"number","PgSmallInt")}build($){return new MJ($,this.config)}}class MJ extends u{static[M]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number($);return $}}function NJ($){return new AJ($??"")}class LJ extends t{static[M]="PgSmallSerialBuilder";constructor($){super($,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new JJ($,this.config)}}class JJ extends u{static[M]="PgSmallSerial";getSQLType(){return"smallserial"}}function _J($){return new LJ($??"")}class RJ extends t{static[M]="PgTextBuilder";constructor($,T){super($,"string","PgText");this.config.enumValues=T.enum}build($){return new kJ($,this.config)}}class kJ extends u{static[M]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function vJ($,T={}){let{name:W,config:U}=P$($,T);return new RJ(W,U)}class qJ extends o0{constructor($,T,W){super($,"string","PgTime");this.withTimezone=T,this.precision=W,this.config.withTimezone=T,this.config.precision=W}static[M]="PgTimeBuilder";build($){return new p9($,this.config)}}class p9 extends u{static[M]="PgTime";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function PJ($,T={}){let{name:W,config:U}=P$($,T);return new qJ(W,U.withTimezone??!1,U.precision)}class CJ extends o0{static[M]="PgTimestampBuilder";constructor($,T,W){super($,"date","PgTimestamp");this.config.withTimezone=T,this.config.precision=W}build($){return new d9($,this.config)}}class d9 extends u{static[M]="PgTimestamp";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=($)=>{return new Date(this.withTimezone?$:$+"+0000")};mapToDriverValue=($)=>{return $.toISOString()}}class SJ extends o0{static[M]="PgTimestampStringBuilder";constructor($,T,W){super($,"string","PgTimestampString");this.config.withTimezone=T,this.config.precision=W}build($){return new o9($,this.config)}}class o9 extends u{static[M]="PgTimestampString";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function jJ($,T={}){let{name:W,config:U}=P$($,T);if(U?.mode==="string")return new SJ(W,U.withTimezone??!1,U.precision);return new CJ(W,U?.withTimezone??!1,U?.precision)}class BJ extends t{static[M]="PgUUIDBuilder";constructor($){super($,"string","PgUUID")}defaultRandom(){return this.default(L`gen_random_uuid()`)}build($){return new l9($,this.config)}}class l9 extends u{static[M]="PgUUID";getSQLType(){return"uuid"}}function _1($){return new BJ($??"")}class xJ extends t{static[M]="PgVarcharBuilder";constructor($,T){super($,"string","PgVarchar");this.config.length=T.length,this.config.enumValues=T.enum}build($){return new IJ($,this.config)}}class IJ extends u{static[M]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function T6($,T={}){let{name:W,config:U}=P$($,T);return new xJ(W,U)}class bJ extends t{static[M]="PgBinaryVectorBuilder";constructor($,T){super($,"string","PgBinaryVector");this.config.dimensions=T.dimensions}build($){return new fJ($,this.config)}}class fJ extends u{static[M]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function yJ($,T){let{name:W,config:U}=P$($,T);return new bJ(W,U)}class hJ extends t{static[M]="PgHalfVectorBuilder";constructor($,T){super($,"array","PgHalfVector");this.config.dimensions=T.dimensions}build($){return new gJ($,this.config)}}class gJ extends u{static[M]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((T)=>Number.parseFloat(T))}}function mJ($,T){let{name:W,config:U}=P$($,T);return new hJ(W,U)}class cJ extends t{static[M]="PgSparseVectorBuilder";constructor($,T){super($,"string","PgSparseVector");this.config.dimensions=T.dimensions}build($){return new uJ($,this.config)}}class uJ extends u{static[M]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function pJ($,T){let{name:W,config:U}=P$($,T);return new cJ(W,U)}class dJ extends t{static[M]="PgVectorBuilder";constructor($,T){super($,"array","PgVector");this.config.dimensions=T.dimensions}build($){return new oJ($,this.config)}}class oJ extends u{static[M]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((T)=>Number.parseFloat(T))}}function lJ($,T){let{name:W,config:U}=P$($,T);return new dJ(W,U)}function rJ(){return{bigint:UL,bigserial:zL,boolean:OY,char:ZL,cidr:KL,customType:ML,date:JL,doublePrecision:kL,inet:PL,integer:QY,interval:xL,json:bL,jsonb:yL,line:uL,macaddr:oL,macaddr8:nL,numeric:$J,point:YJ,geometry:OJ,real:DJ,serial:EJ,smallint:NJ,smallserial:_J,text:vJ,time:PJ,timestamp:jJ,uuid:_1,varchar:T6,bit:yJ,halfvec:mJ,sparsevec:pJ,vector:lJ}}var NQ=Symbol.for("drizzle:PgInlineForeignKeys"),nJ=Symbol.for("drizzle:EnableRLS");class B4 extends p{static[M]="PgTable";static Symbol=Object.assign({},p.Symbol,{InlineForeignKeys:NQ,EnableRLS:nJ});[NQ]=[];[nJ]=!1;[p.Symbol.ExtraConfigBuilder]=void 0;[p.Symbol.ExtraConfigColumns]={}}function Xf($,T,W,U,X=$){let Y=new B4($,U,X),w=typeof T==="function"?T(rJ()):T,G=Object.fromEntries(Object.entries(w).map(([F,O])=>{let Q=O;Q.setName(F);let Z=Q.build(Y);return Y[NQ].push(...Q.buildForeignKeys(Z,Y)),[F,Z]})),H=Object.fromEntries(Object.entries(w).map(([F,O])=>{let Q=O;Q.setName(F);let Z=Q.buildExtraConfigColumn(Y);return[F,Z]})),z=Object.assign(Y,G);if(z[p.Symbol.Columns]=G,z[p.Symbol.ExtraConfigColumns]=H,W)z[B4.Symbol.ExtraConfigBuilder]=W;return Object.assign(z,{enableRLS:()=>{return z[B4.Symbol.EnableRLS]=!0,z}})}var IT=($,T,W)=>{return Xf($,T,W,void 0)};function iJ(...$){if($[0].columns)return new ZY($[0].columns,$[0].name);return new ZY($)}class ZY{static[M]="PgPrimaryKeyBuilder";columns;name;constructor($,T){this.columns=$,this.name=T}build($){return new tJ($,this.columns,this.name)}}class tJ{constructor($,T,W){this.table=$,this.columns=T,this.name=W}static[M]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[B4.Symbol.Name]}_${this.columns.map(($)=>$.name).join("_")}_pk`}}function u6($,T){if(oN(T)&&!ZQ($)&&!j($,F1)&&!j($,BT)&&!j($,u$)&&!j($,p)&&!j($,c6))return new F1($,T);return $}var r9=($,T)=>{return L`${$} = ${u6(T,$)}`},aJ=($,T)=>{return L`${$} <> ${u6(T,$)}`};function DY(...$){let T=$.filter((W)=>W!==void 0);if(T.length===0)return;if(T.length===1)return new i(T);return new i([new j4("("),L.join(T,new j4(" and ")),new j4(")")])}function sJ(...$){let T=$.filter((W)=>W!==void 0);if(T.length===0)return;if(T.length===1)return new i(T);return new i([new j4("("),L.join(T,new j4(" or ")),new j4(")")])}function eJ($){return L`not ${$}`}var n9=($,T)=>{return L`${$} > ${u6(T,$)}`},$_=($,T)=>{return L`${$} >= ${u6(T,$)}`},T_=($,T)=>{return L`${$} < ${u6(T,$)}`},W_=($,T)=>{return L`${$} <= ${u6(T,$)}`};function U_($,T){if(Array.isArray(T)){if(T.length===0)return L`false`;return L`${$} in ${T.map((W)=>u6(W,$))}`}return L`${$} in ${u6(T,$)}`}function X_($,T){if(Array.isArray(T)){if(T.length===0)return L`true`;return L`${$} not in ${T.map((W)=>u6(W,$))}`}return L`${$} not in ${u6(T,$)}`}function Y_($){return L`${$} is null`}function w_($){return L`${$} is not null`}function G_($){return L`exists ${$}`}function z_($){return L`not exists ${$}`}function H_($,T,W){return L`${$} between ${u6(T,$)} and ${u6(W,$)}`}function F_($,T,W){return L`${$} not between ${u6(T,$)} and ${u6(W,$)}`}function O_($,T){return L`${$} like ${T}`}function Q_($,T){return L`${$} not like ${T}`}function Z_($,T){return L`${$} ilike ${T}`}function D_($,T){return L`${$} not ilike ${T}`}function V_($){return L`${$} asc`}function K_($){return L`${$} desc`}class LQ{constructor($,T,W){this.sourceTable=$,this.referencedTable=T,this.relationName=W,this.referencedTableName=T[p.Symbol.Name]}static[M]="Relation";referencedTableName;fieldName}class E_{constructor($,T){this.table=$,this.config=T}static[M]="Relations"}class bT extends LQ{constructor($,T,W,U){super($,T,W?.relationName);this.config=W,this.isNullable=U}static[M]="One";withFieldName($){let T=new bT(this.sourceTable,this.referencedTable,this.config,this.isNullable);return T.fieldName=$,T}}class VY extends LQ{constructor($,T,W){super($,T,W?.relationName);this.config=W}static[M]="Many";withFieldName($){let T=new VY(this.sourceTable,this.referencedTable,this.config);return T.fieldName=$,T}}function A_(){return{and:DY,between:H_,eq:r9,exists:G_,gt:n9,gte:$_,ilike:Z_,inArray:U_,isNull:Y_,isNotNull:w_,like:O_,lt:T_,lte:W_,ne:aJ,not:eJ,notBetween:F_,notExists:z_,notLike:Q_,notIlike:D_,notInArray:X_,or:sJ,sql:L}}function M_(){return{sql:L,asc:V_,desc:K_}}function N_($,T){if(Object.keys($).length===1&&"default"in $&&!j($.default,p))$=$.default;let W={},U={},X={};for(let[Y,w]of Object.entries($))if(j(w,p)){let G=hW(w),H=U[G];W[G]=Y,X[Y]={tsName:Y,dbName:w[p.Symbol.Name],schema:w[p.Symbol.Schema],columns:w[p.Symbol.Columns],relations:H?.relations??{},primaryKey:H?.primaryKey??[]};for(let F of Object.values(w[p.Symbol.Columns]))if(F.primary)X[Y].primaryKey.push(F);let z=w[p.Symbol.ExtraConfigBuilder]?.(w[p.Symbol.ExtraConfigColumns]);if(z){for(let F of Object.values(z))if(j(F,ZY))X[Y].primaryKey.push(...F.columns)}}else if(j(w,E_)){let G=hW(w.table),H=W[G],z=w.config(T(w.table)),F;for(let[O,Q]of Object.entries(z))if(H){let Z=X[H];if(Z.relations[O]=Q,F)Z.primaryKey.push(...F)}else{if(!(G in U))U[G]={relations:{},primaryKey:F};U[G].relations[O]=Q}}return{tables:X,tableNamesMap:W}}function Yf($){return function T(W,U){return new bT($,W,U,U?.fields.reduce((X,Y)=>X&&Y.notNull,!0)??!1)}}function wf($){return function T(W,U){return new VY($,W,U)}}function L_($,T,W){if(j(W,bT)&&W.config)return{fields:W.config.fields,references:W.config.references};let U=T[hW(W.referencedTable)];if(!U)throw new Error(`Table "${W.referencedTable[p.Symbol.Name]}" not found in schema`);let X=$[U];if(!X)throw new Error(`Table "${U}" not found in schema`);let Y=W.sourceTable,w=T[hW(Y)];if(!w)throw new Error(`Table "${Y[p.Symbol.Name]}" not found in schema`);let G=[];for(let H of Object.values(X.relations))if(W.relationName&&W!==H&&H.relationName===W.relationName||!W.relationName&&H.referencedTable===W.sourceTable)G.push(H);if(G.length>1)throw W.relationName?new Error(`There are multiple relations with name "${W.relationName}" in table "${U}"`):new Error(`There are multiple relations between "${U}" and "${W.sourceTable[p.Symbol.Name]}". Please specify relation name`);if(G[0]&&j(G[0],bT)&&G[0].config)return{fields:G[0].config.references,references:G[0].config.fields};throw new Error(`There is not enough information to infer relation "${w}.${W.fieldName}"`)}function J_($){return{one:Yf($),many:wf($)}}function i9($,T,W,U,X=(Y)=>Y){let Y={};for(let[w,G]of U.entries())if(G.isJson){let H=T.relations[G.tsKey],z=W[w],F=typeof z==="string"?JSON.parse(z):z;Y[G.tsKey]=j(H,bT)?F&&i9($,$[G.relationTableTsKey],F,G.selection,X):F.map((O)=>i9($,$[G.relationTableTsKey],O,G.selection,X))}else{let H=X(W[w]),z=G.field,F;if(j(z,u$))F=z;else if(j(z,i))F=z.decoder;else F=z.sql.decoder;Y[G.tsKey]=H===null?null:F.mapFromDriverValue(H)}return Y}import tm from"path";import Sf from"os";import jf from"fs";var t9=new Map,JQ=new Map,_Q=Symbol("OriginError"),GU={};class R1 extends Promise{constructor($,T,W,U,X={}){let Y,w;super((G,H)=>{Y=G,w=H});this.tagged=Array.isArray($.raw),this.strings=$,this.args=T,this.handler=W,this.canceller=U,this.options=X,this.state=null,this.statement=null,this.resolve=(G)=>(this.active=!1,Y(G)),this.reject=(G)=>(this.active=!1,w(G)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[_Q]=this.handler.debug?new Error:this.tagged&&Gf(this.strings)}get origin(){return(this.handler.debug?this[_Q].stack:this.tagged&&JQ.has(this.strings)?JQ.get(this.strings):JQ.set(this.strings,this[_Q].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($=1,T){if(this.options.simple=!1,typeof $==="function")T=$,$=1;if(this.cursorRows=$,typeof T==="function")return this.cursorFn=T,this;let W;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};W&&W();let U=new Promise((X,Y)=>{this.cursorFn=(w)=>{return X({value:w,done:!1}),new Promise((G)=>W=G)},this.resolve=()=>(this.active=!1,X({done:!0})),this.reject=(w)=>(this.active=!1,Y(w))});return this.execute(),U},return(){return W&&W(GU),{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($){return this.forEachFn=$,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 Gf($){if(t9.has($))return t9.get($);let T=Error.stackTraceLimit;return Error.stackTraceLimit=4,t9.set($,new Error),Error.stackTraceLimit=T,t9.get($)}class zU extends Error{constructor($){super($.message);this.name=this.constructor.name,Object.assign(this,$)}}var J4={connection:__,postgres:R_,generic:k_,notSupported:v_};function __($,T,W){let{host:U,port:X}=W||T,Y=Object.assign(new Error("write "+$+" "+(T.path||U+":"+X)),{code:$,errno:$,address:T.path||U},T.path?{}:{port:X});return Error.captureStackTrace(Y,__),Y}function R_($){let T=new zU($);return Error.captureStackTrace(T,R_),T}function k_($,T){let W=Object.assign(new Error($+": "+T),{code:$});return Error.captureStackTrace(W,k_),W}function v_($){let T=Object.assign(new Error($+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:$});return Error.captureStackTrace(T,v_),T}var zf={string:{to:25,from:null,serialize:($)=>""+$},number:{to:0,from:[21,23,26,700,701],serialize:($)=>""+$,parse:($)=>+$},json:{to:114,from:[114,3802],serialize:($)=>JSON.stringify($),parse:($)=>JSON.parse($)},boolean:{to:16,from:16,serialize:($)=>$===!0?"t":"f",parse:($)=>$==="t"},date:{to:1184,from:[1082,1114,1184],serialize:($)=>($ instanceof Date?$:new Date($)).toISOString(),parse:($)=>new Date($)},bytea:{to:17,from:17,serialize:($)=>"\\x"+Buffer.from($).toString("hex"),parse:($)=>Buffer.from($.slice(2),"hex")}};class e9{then(){RQ()}catch(){RQ()}finally(){RQ()}}class MY extends e9{constructor($){super();this.value=Wz($)}}class H0 extends e9{constructor($,T,W){super();this.value=$,this.type=T,this.array=W}}class $z extends e9{constructor($,T){super();this.first=$,this.rest=T}build($,T,W,U){let X=Hf.map(([Y,w])=>({fn:w,i:$.search(Y)})).sort((Y,w)=>Y.i-w.i).pop();return X.i===-1?CQ(this.first,U):X.fn(this.first,this.rest,T,W,U)}}function Tz($,T,W,U){let X=$ instanceof H0?$.value:$;if(X===void 0){if($ instanceof H0?$.value=U.transform.undefined:X=$=U.transform.undefined,X===void 0)throw J4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+W.push($ instanceof H0?(T.push($.value),$.array?$.array[$.type||s9($.value)]||$.type||S_($.value):$.type):(T.push($),s9($)))}var P_=B_(zf);function qQ($,T,W,U,X,Y){for(let w=1;w<$.strings.length;w++)T+=PQ(T,W,U,X,Y)+$.strings[w],W=$.args[w];return T}function PQ($,T,W,U,X){return T instanceof $z?T.build($,W,U,X):T instanceof R1?vQ(T,W,U,X):T instanceof MY?T.value:T&&T[0]instanceof R1?T.reduce((Y,w)=>Y+" "+vQ(w,W,U,X),""):Tz(T,W,U,X)}function vQ($,T,W,U){return $.fragment=!0,qQ($,$.strings[0],$.args[0],T,W,U)}function C_($,T,W,U,X){return $.map((Y)=>"("+U.map((w)=>PQ("values",Y[w],T,W,X)).join(",")+")").join(",")}function q_($,T,W,U,X){let Y=Array.isArray($[0]),w=T.length?T.flat():Object.keys(Y?$[0]:$);return C_(Y?$:[$],W,U,w,X)}function a9($,T,W,U,X){if(typeof $==="string"&&($=[$].concat(T)),Array.isArray($))return CQ($,X);let Y;return(T.length?T.flat():Object.keys($)).map((G)=>{return Y=$[G],(Y instanceof R1?vQ(Y,W,U,X):Y instanceof MY?Y.value:Tz(Y,W,U,X))+" as "+Wz(X.transform.column.to?X.transform.column.to(G):G)}).join(",")}var Hf=Object.entries({values:q_,in:(...$)=>{let T=q_(...$);return T==="()"?"(null)":T},select:a9,as:a9,returning:a9,"\\(":a9,update($,T,W,U,X){return(T.length?T.flat():Object.keys($)).map((Y)=>Wz(X.transform.column.to?X.transform.column.to(Y):Y)+"="+PQ("values",$[Y],W,U,X))},insert($,T,W,U,X){let Y=T.length?T.flat():Object.keys(Array.isArray($)?$[0]:$);return"("+CQ(Y,X)+")values"+C_(Array.isArray($)?$:[$],W,U,Y,X)}}).map(([$,T])=>[new RegExp("((?:^|[\\s(])"+$+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),T]);function RQ(){throw J4.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:Ff,parsers:Of}=P_;function S_($){if(Array.isArray($))return S_($[0]);return typeof $==="string"?1009:0}var j_=function($){let T=B_($||{});return{serializers:Object.assign({},Ff,T.serializers),parsers:Object.assign({},Of,T.parsers)}};function B_($){return Object.keys($).reduce((T,W)=>{if($[W].from&&[].concat($[W].from).forEach((U)=>T.parsers[U]=$[W].parse),$[W].serialize)T.serializers[$[W].to]=$[W].serialize,$[W].from&&[].concat($[W].from).forEach((U)=>T.serializers[U]=$[W].serialize);return T},{parsers:{},serializers:{}})}function CQ($,{transform:{column:T}}){return $.map((W)=>Wz(T.to?T.to(W):W)).join(",")}var Wz=function $(T){return'"'+T.replace(/"/g,'""').replace(/\./g,'"."')+'"'},s9=function $(T){return T instanceof H0?T.type:T instanceof Date?1184:T instanceof Uint8Array?17:T===!0||T===!1?16:typeof T==="bigint"?20:Array.isArray(T)?$(T[0]):0},Qf=/\\/g,Zf=/"/g;function Df($){return $.replace(Qf,"\\\\").replace(Zf,"\\\"")}var x_=function $(T,W,U,X){if(Array.isArray(T)===!1)return T;if(!T.length)return"{}";let Y=T[0],w=X===1020?";":",";if(Array.isArray(Y)&&!Y.type)return"{"+T.map((G)=>$(G,W,U,X)).join(w)+"}";return"{"+T.map((G)=>{if(G===void 0){if(G=U.transform.undefined,G===void 0)throw J4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return G===null?"null":'"'+Df(W?W(G.type?G.value:G):""+G)+'"'}).join(w)+"}"},kQ={i:0,char:null,str:"",quoted:!1,last:0},I_=function $(T,W,U){return kQ.i=kQ.last=0,b_(kQ,T,W,U)};function b_($,T,W,U){let X=[],Y=U===1020?";":",";for(;$.i<T.length;$.i++){if($.char=T[$.i],$.quoted)if($.char==="\\")$.str+=T[++$.i];else if($.char==='"')X.push(W?W($.str):$.str),$.str="",$.quoted=T[$.i+1]==='"',$.last=$.i+2;else $.str+=$.char;else if($.char==='"')$.quoted=!0;else if($.char==="{")$.last=++$.i,X.push(b_($,T,W,U));else if($.char==="}"){$.quoted=!1,$.last<$.i&&X.push(W?W(T.slice($.last,$.i)):T.slice($.last,$.i)),$.last=$.i+1;break}else if($.char===Y&&$.p!=="}"&&$.p!=='"')X.push(W?W(T.slice($.last,$.i)):T.slice($.last,$.i)),$.last=$.i+1;$.p=$.char}return $.last<$.i&&X.push(W?W(T.slice($.last,$.i+1)):T.slice($.last,$.i+1)),X}var gW=($)=>{let T=$[0];for(let W=1;W<$.length;W++)T+=$[W]==="_"?$[++W].toUpperCase():$[W];return T},mW=($)=>{let T=$[0].toUpperCase();for(let W=1;W<$.length;W++)T+=$[W]==="_"?$[++W].toUpperCase():$[W];return T},cW=($)=>$.replace(/_/g,"-"),KY=($)=>$.replace(/([A-Z])/g,"_$1").toLowerCase(),EY=($)=>($.slice(0,1)+$.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),AY=($)=>$.replace(/-/g,"_");function SQ($){return function T(W,U){return typeof W==="object"&&W!==null&&(U.type===114||U.type===3802)?Array.isArray(W)?W.map((X)=>T(X,U)):Object.entries(W).reduce((X,[Y,w])=>Object.assign(X,{[$(Y)]:T(w,U)}),{}):W}}gW.column={from:gW};gW.value={from:SQ(gW)};KY.column={to:KY};var jQ={...gW};jQ.column.to=KY;mW.column={from:mW};mW.value={from:SQ(mW)};EY.column={to:EY};var BQ={...mW};BQ.column.to=EY;cW.column={from:cW};cW.value={from:SQ(cW)};AY.column={to:AY};var xQ={...cW};xQ.column.to=AY;import f_ from"net";import Af from"tls";import NY from"crypto";import IQ from"stream";import{performance as y_}from"perf_hooks";class uW 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 O1=Vf;function Vf($=[]){let T=$.slice(),W=0;return{get length(){return T.length-W},remove:(U)=>{let X=T.indexOf(U);return X===-1?null:(T.splice(X,1),U)},push:(U)=>(T.push(U),U),shift:()=>{let U=T[W++];if(W===T.length)W=0,T=[];else T[W-1]=void 0;return U}}}var W6=Buffer.allocUnsafe(256),Kf="BCcDdEFfHPpQSX".split("").reduce(($,T)=>{let W=T.charCodeAt(0);return $[T]=()=>{return W6[0]=W,c$.i=5,c$},$},{}),c$=Object.assign(Ef,Kf,{N:String.fromCharCode(0),i:0,inc($){return c$.i+=$,c$},str($){let T=Buffer.byteLength($);return Uz(T),c$.i+=W6.write($,c$.i,T,"utf8"),c$},i16($){return Uz(2),W6.writeUInt16BE($,c$.i),c$.i+=2,c$},i32($,T){if(T||T===0)return W6.writeUInt32BE($,T),c$;return Uz(4),W6.writeUInt32BE($,c$.i),c$.i+=4,c$},z($){return Uz($),W6.fill(0,c$.i,c$.i+$),c$.i+=$,c$},raw($){return W6=Buffer.concat([W6.subarray(0,c$.i),$]),c$.i=W6.length,c$},end($=1){W6.writeUInt32BE(c$.i-$,$);let T=W6.subarray(0,c$.i);return c$.i=0,W6=Buffer.allocUnsafe(256),T}}),U$=c$;function Uz($){if(W6.length-c$.i<$){let T=W6,W=T.length;W6=Buffer.allocUnsafe(W+(W>>1)+$),T.copy(W6)}}function Ef(){return c$.i=0,c$}var yQ=m_,Mf=1,fT=U$().S().end(),h_=U$().H().end(),Nf=U$().i32(8).i32(80877103).end(8),Lf=Buffer.concat([U$().E().str(U$.N).i32(0).end(),fT]),Jf=U$().D().str("S").str(U$.N).end(),HU=()=>{},_f=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),Rf={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 m_($,T={},{onopen:W=HU,onend:U=HU,onclose:X=HU}={}){let{ssl:Y,max:w,user:G,host:H,port:z,database:F,parsers:O,transform:Q,onnotice:Z,onnotify:V,onparameter:E,max_pipeline:N,keep_alive:J,backoff:_,target_session_attrs:R}=$,P=O1(),x=Mf++,f={pid:null,secret:null},h=fQ(rz,$.idle_timeout),a=fQ(rz,$.max_lifetime),M$=fQ(qq,$.connect_timeout),S=null,W$,n=new uW,Y$=Buffer.alloc(0),j$=$.fetch_types,s$={},f4={},n6=Math.random().toString(36).slice(2),g=1,G$=0,y$=0,Y4=0,R4=0,N$=0,h$=0,M4=0,w4=null,e$=null,n4=!1,o$=null,C1=null,c4=null,XT=null,k4=null,$4=null,S1=null,o1=null,l=null,BU=null,i4={queue:T.closed,idleTimer:h,connect(A){c4=A,CD()},terminate:IU,execute:xU,cancel:_q,end:rz,count:0,id:x};return T.closed&&T.closed.push(i4),i4;async function Jq(){let A;try{A=$.socket?await Promise.resolve($.socket($)):new f_.Socket}catch(v){sW(v);return}return A.on("error",sW),A.on("close",SD),A.on("drain",qD),A}async function _q({pid:A,secret:v},w$,x$){try{W$=U$().i32(16).i32(80877102).i32(A).i32(v).end(16),await PD(),S.once("error",x$),S.once("close",w$)}catch(D4){x$(D4)}}function xU(A){if(n4)return Uw(A,J4.connection("CONNECTION_DESTROYED",$));if(A.cancelled)return;try{return A.state=f,l?P.push(A):(l=A,l.active=!0),vq(A),u4(Rq(A))&&!A.describeFirst&&!A.cursorFn&&P.length<N&&(!A.options.onexecute||A.options.onexecute(i4))}catch(v){return P.length===0&&u4(fT),l1(v),!0}}function Rq(A){if(A.parameters.length>=65534)throw J4.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return A.options.simple?U$().Q().str(A.statement.string+U$.N).end():A.describeFirst?Buffer.concat([RD(A),h_]):A.prepare?A.prepared?Ww(A):Buffer.concat([RD(A),Ww(A)]):kq(A)}function RD(A){return Buffer.concat([BD(A.statement.string,A.parameters,A.statement.types,A.statement.name),OP("S",A.statement.name)])}function Ww(A){return Buffer.concat([FP(A.parameters,A.statement.types,A.statement.name,A.cursorName),A.cursorFn?xD("",A.cursorRows):Lf])}function kq(A){return Buffer.concat([BD(A.statement.string,A.parameters,A.statement.types),Jf,Ww(A)])}function vq(A){let v=[],w$=[],x$=qQ(A,A.strings[0],A.args[0],v,w$,$);!A.tagged&&A.args.forEach((D4)=>Tz(D4,v,w$,$)),A.prepare=$.prepare&&("prepare"in A.options?A.options.prepare:!0),A.string=x$,A.signature=A.prepare&&w$+x$,A.onlyDescribe&&delete f4[A.signature],A.parameters=A.parameters||v,A.prepared=A.prepare&&A.signature in f4,A.describeFirst=A.onlyDescribe||v.length&&!A.prepared,A.statement=A.prepared?f4[A.signature]:{string:x$,types:w$,name:A.prepare?n6+g++:""},typeof $.debug==="function"&&$.debug(x,x$,v,w$)}function u4(A,v){if($4=$4?Buffer.concat([$4,A]):Buffer.from(A),v||$4.length>=1024)return kD(v);return e$===null&&(e$=setImmediate(kD)),!0}function kD(A){let v=S.write($4,A);return e$!==null&&clearImmediate(e$),$4=e$=null,v}function qq(){l1(J4.connection("CONNECT_TIMEOUT",$,S)),S.destroy()}async function vD(){if(u4(Nf),!await new Promise((v)=>S.once("data",(w$)=>v(w$[0]===83)))&&Y==="prefer")return aW();S.removeAllListeners(),S=Af.connect({socket:S,servername:f_.isIP(S.host)?void 0:S.host,...Y==="require"||Y==="allow"||Y==="prefer"?{rejectUnauthorized:!1}:Y==="verify-full"?{}:typeof Y==="object"?Y:{}}),S.on("secureConnect",aW),S.on("error",sW),S.on("close",SD),S.on("drain",qD)}function qD(){!l&&W(i4)}function lz(A){if(o$){if(o$.push(A),y$-=A.length,y$>0)return}Y$=o$?Buffer.concat(o$,N$-y$):Y$.length===0?A:Buffer.concat([Y$,A],Y$.length+A.length);while(Y$.length>4){if(N$=Y$.readUInt32BE(1),N$>=Y$.length){y$=N$-Y$.length,o$=[Y$];break}try{Pq(Y$.subarray(0,N$+1))}catch(v){l&&(l.cursorFn||l.describeFirst)&&u4(fT),l1(v)}Y$=Y$.subarray(N$+1),y$=0,o$=null}}async function PD(){if(n4=!1,s$={},S||(S=await Jq()),!S)return;if(M$.start(),$.socket)return Y?vD():aW();if(S.on("connect",Y?vD:aW),$.path)return S.connect($.path);S.ssl=Y,S.connect(z[Y4],H[Y4]),S.host=H[Y4],S.port=z[Y4],Y4=(Y4+1)%z.length}function CD(){setTimeout(PD,G$?G$+h$-y_.now():0)}function aW(){try{f4={},j$=$.fetch_types,n6=Math.random().toString(36).slice(2),g=1,a.start(),S.on("data",lz),J&&S.setKeepAlive&&S.setKeepAlive(!0,1000*J);let A=ZP();u4(A)}catch(A){sW(A)}}function sW(A){if(i4.queue===T.connecting&&$.host[R4+1])return;l1(A);while(P.length)Uw(P.shift(),A)}function l1(A){k4&&(k4.destroy(A),k4=null),l&&Uw(l,A),c4&&(Uw(c4,A),c4=null)}function Uw(A,v){if(A.reserve)return A.reject(v);if(!v||typeof v!=="object")v=new Error(v);"query"in v||"parameters"in v||Object.defineProperties(v,{stack:{value:v.stack+A.origin.replace(/.*\n/,`
|
|
81
|
-
`),enumerable:$.debug},query:{value:
|
|
81
|
+
`);this.baseURL=U.baseURL,this.timeout=U.timeout??lF.DEFAULT_TIMEOUT,this.logger=U.logger??console;let Y="warn";this.logLevel=Y,this.logLevel=KF(U.logLevel,"ClientOptions.logLevel",this)??KF(TW("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??Y,this.fetchOptions=U.fetchOptions,this.maxRetries=U.maxRetries??2,this.fetch=U.fetch??qA(),w$(this,SG,CA,"f"),this._options=U,this.apiKey=T,this.organization=W,this.project=w}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:T}){return}authHeaders($){return a([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery($){return JF($,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${zT}`}defaultIdempotencyKey(){return`stainless-node-retry-${VF()}`}makeStatusError($,T,W,w){return L4.generate($,T,W,w)}buildURL($,T){let W=KA($)?new URL($):new URL(this.baseURL+(this.baseURL.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),w=this.defaultQuery();if(!EA(w))T={...w,...T};if(typeof T==="object"&&T&&!Array.isArray(T))W.search=this.stringifyQuery(T);return W.toString()}async prepareOptions($){}async prepareRequest($,{url:T,options:W}){}get($,T){return this.methodRequest("get",$,T)}post($,T){return this.methodRequest("post",$,T)}patch($,T){return this.methodRequest("patch",$,T)}put($,T){return this.methodRequest("put",$,T)}delete($,T){return this.methodRequest("delete",$,T)}methodRequest($,T,W){return this.request(Promise.resolve(W).then((w)=>{return{method:$,path:T,...w}}))}request($,T=null){return new tT(this,this.makeRequest($,T,void 0))}async makeRequest($,T,W){let w=await $,X=w.maxRetries??this.maxRetries;if(T==null)T=X;await this.prepareOptions(w);let{req:U,url:Y,timeout:G}=this.buildRequest(w,{retryCount:X-T});await this.prepareRequest(U,{url:Y,options:w});let H="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),z=W===void 0?"":`, retryOf: ${W}`,F=Date.now();if(C4(this).debug(`[${H}] sending request`,M0({retryOfRequestLogID:W,method:w.method,url:Y,options:w,headers:U.headers})),w.signal?.aborted)throw new P4;let O=new AbortController,Q=await this.fetchWithTimeout(Y,U,G,O).catch(A8),Z=Date.now();if(Q instanceof Error){let M=`retrying, ${T} attempts remaining`;if(w.signal?.aborted)throw new P4;let L=K8(Q)||/timed? ?out/i.test(String(Q)+("cause"in Q?String(Q.cause):""));if(T)return C4(this).info(`[${H}] connection ${L?"timed out":"failed"} - ${M}`),C4(this).debug(`[${H}] connection ${L?"timed out":"failed"} (${M})`,M0({retryOfRequestLogID:W,url:Y,durationMs:Z-F,message:Q.message})),this.retryRequest(w,T,W??H);if(C4(this).info(`[${H}] connection ${L?"timed out":"failed"} - error; no more retries left`),C4(this).debug(`[${H}] connection ${L?"timed out":"failed"} (error; no more retries left)`,M0({retryOfRequestLogID:W,url:Y,durationMs:Z-F,message:Q.message})),L)throw new iT;throw new nT({cause:Q})}let K=[...Q.headers.entries()].filter(([M])=>M==="x-request-id").map(([M,L])=>", "+M+": "+JSON.stringify(L)).join(""),E=`[${H}${z}${K}] ${U.method} ${Y} ${Q.ok?"succeeded":"failed"} with status ${Q.status} in ${Z-F}ms`;if(!Q.ok){let M=this.shouldRetry(Q);if(T&&M){let b=`retrying, ${T} attempts remaining`;return await PA(Q.body),C4(this).info(`${E} - ${b}`),C4(this).debug(`[${H}] response error (${b})`,M0({retryOfRequestLogID:W,url:Q.url,status:Q.status,headers:Q.headers,durationMs:Z-F})),this.retryRequest(w,T,W??H,Q.headers)}let L=M?"error; no more retries left":"error; not retryable";C4(this).info(`${E} - ${L}`);let R=await Q.text().catch((b)=>A8(b).message),_=NA(R),S=_?void 0:R;throw C4(this).debug(`[${H}] response error (${L})`,M0({retryOfRequestLogID:W,url:Q.url,status:Q.status,headers:Q.headers,message:S,durationMs:Date.now()-F})),this.makeStatusError(Q.status,_,S,Q.headers)}return C4(this).info(E),C4(this).debug(`[${H}] response start`,M0({retryOfRequestLogID:W,url:Q.url,status:Q.status,headers:Q.headers,durationMs:Z-F})),{response:Q,options:w,controller:O,requestLogID:H,retryOfRequestLogID:W,startTime:F}}getAPIList($,T,W){return this.requestAPIList(T,{method:"get",path:$,...W})}requestAPIList($,T){let W=this.makeRequest(T,null,void 0);return new QG(this,W,$)}async fetchWithTimeout($,T,W,w){let{signal:X,method:U,...Y}=T||{};if(X)X.addEventListener("abort",()=>w.abort());let G=setTimeout(()=>w.abort(),W),H=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,z={signal:w.signal,...H?{duplex:"half"}:{},method:"GET",...Y};if(U)z.method=U.toUpperCase();try{return await this.fetch.call(void 0,$,z)}finally{clearTimeout(G)}}shouldRetry($){let T=$.headers.get("x-should-retry");if(T==="true")return!0;if(T==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,T,W,w){let X,U=w?.get("retry-after-ms");if(U){let G=parseFloat(U);if(!Number.isNaN(G))X=G}let Y=w?.get("retry-after");if(Y&&!X){let G=parseFloat(Y);if(!Number.isNaN(G))X=G*1000;else X=Date.parse(Y)-Date.now()}if(!(X&&0<=X&&X<60000)){let G=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(T,G)}return await l1(X),this.makeRequest($,T-1,W)}calculateDefaultRetryTimeoutMillis($,T){let X=T-$,U=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return U*Y*1000}buildRequest($,{retryCount:T=0}={}){let W={...$},{method:w,path:X,query:U}=W,Y=this.buildURL(X,U);if("timeout"in W)DA("timeout",W.timeout);W.timeout=W.timeout??this.timeout;let{bodyHeaders:G,body:H}=this.buildBody({options:W}),z=this.buildHeaders({options:$,method:w,bodyHeaders:G,retryCount:T});return{req:{method:w,headers:z,...W.signal&&{signal:W.signal},...globalThis.ReadableStream&&H instanceof globalThis.ReadableStream&&{duplex:"half"},...H&&{body:H},...this.fetchOptions??{},...W.fetchOptions??{}},url:Y,timeout:W.timeout}}buildHeaders({options:$,method:T,bodyHeaders:W,retryCount:w}){let X={};if(this.idempotencyHeader&&T!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let U=a([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(w),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...vA(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},this.authHeaders($),this._options.defaultHeaders,W,$.headers]);return this.validateHeaders(U),U.values}buildBody({options:{body:$,headers:T}}){if(!$)return{bodyHeaders:void 0,body:void 0};let W=a([T]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&W.values.has("content-type")||$ instanceof Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:HG($)};else return v(this,SG,"f").call(this,{body:$,headers:W})}}lF=R$,SG=new WeakMap;R$.OpenAI=lF;R$.DEFAULT_TIMEOUT=600000;R$.OpenAIError=$$;R$.APIError=L4;R$.APIConnectionError=nT;R$.APIConnectionTimeoutError=iT;R$.APIUserAbortError=P4;R$.NotFoundError=N8;R$.ConflictError=L8;R$.RateLimitError=R8;R$.BadRequestError=E8;R$.AuthenticationError=M8;R$.InternalServerError=_8;R$.PermissionDeniedError=D8;R$.UnprocessableEntityError=J8;R$.toFile=ZG;R$.Completions=H2;R$.Chat=eT;R$.Embeddings=O2;R$.Files=Z2;R$.Images=E2;R$.Audio=J0;R$.Moderations=D2;R$.Models=M2;R$.FineTuning=t1;R$.Graders=zW;R$.VectorStores=VT;R$.Beta=R0;R$.Batches=Y2;R$.Uploads=FW;R$.Responses=HW;R$.Evals=GW;R$.Containers=YW;function gj($,...T){let[W,w,X,U]=T,Y=[{role:"user",content:eK(w)},{role:"user",content:W}],G=U.at(-1);if(G)Y.push({role:"user",content:["Oops! That didn't work. Here's what was returned last time:",JSON.stringify(G.response,null,2),"Here's the error message:",JSON.stringify(G.error.issues,null,2)].join(`
|
|
82
|
+
`)});return{model:$,messages:Y}}var O$=1e6,EE={"gpt-4.1":{promptPricePerToken:2/O$,promptPricePerTokenCached:0.5/O$,completionPricePerToken:8/O$},"gpt-4.1-mini":{promptPricePerToken:0.4/O$,promptPricePerTokenCached:0.1/O$,completionPricePerToken:1.6/O$},"gpt-4.1-nano":{promptPricePerToken:0.1/O$,promptPricePerTokenCached:0.025/O$,completionPricePerToken:0.4/O$},"gpt-4o":{promptPricePerToken:2.5/O$,promptPricePerTokenCached:1.25/O$,completionPricePerToken:10/O$},"gpt-4o-mini":{promptPricePerToken:0.15/O$,promptPricePerTokenCached:0.075/O$,completionPricePerToken:0.6/O$},o1:{promptPricePerToken:15/O$,promptPricePerTokenCached:7.5/O$,completionPricePerToken:60/O$},"o1-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.55/O$,completionPricePerToken:4.4/O$},o3:{promptPricePerToken:10/O$,promptPricePerTokenCached:2.5/O$,completionPricePerToken:40/O$},"o3-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.55/O$,completionPricePerToken:4.4/O$},"o4-mini":{promptPricePerToken:1.1/O$,promptPricePerTokenCached:0.275/O$,completionPricePerToken:4.4/O$},"codex-mini-latest":{promptPricePerToken:1.5/O$,promptPricePerTokenCached:0.375/O$,completionPricePerToken:6/O$},"chatgpt-4o-latest":{promptPricePerToken:5/O$,promptPricePerTokenCached:5/O$,completionPricePerToken:15/O$},"gpt-4":{promptPricePerToken:30/O$,promptPricePerTokenCached:30/O$,completionPricePerToken:60/O$},"gpt-4-turbo":{promptPricePerToken:10/O$,promptPricePerTokenCached:10/O$,completionPricePerToken:30/O$},"gpt-3.5-turbo":{promptPricePerToken:0.5/O$,promptPricePerTokenCached:0.5/O$,completionPricePerToken:1.5/O$},"gpt-4-32k":{promptPricePerToken:60/O$,promptPricePerTokenCached:60/O$,completionPricePerToken:120/O$},"gpt-3.5-turbo-16k":{promptPricePerToken:3/O$,promptPricePerTokenCached:3/O$,completionPricePerToken:4/O$}};function mj($){let W=Object.keys(EE).filter((w)=>$.startsWith(w)).sort((w,X)=>X.length-w.length)[0];if(!W)return;return EE[W]}function cj($){return async function T(W,w){if(!$)throw new Error("This is a bug in safegen. OpenAI client not available to the json generator.");let X=await $.chat.completions.create({...W,stream:!1,response_format:{type:"json_object"}},w),U=X.choices[0].message?.content,{usage:Y}=X;if(U&&Y){let G=Y.prompt_tokens,H=Y.prompt_tokens_details?.cached_tokens??0,z=G-H,F=Y.completion_tokens,O=mj(W.model),Q=0;if(O)Q=G*O.promptPricePerToken+z*(O.promptPricePerTokenCached??0)+F*O.completionPricePerToken;else console.warn(`No pricing facts found for model ${W.model}. Giving a price of 0.`);return{data:JSON.parse(U),usage:Y,usdPrice:Q}}if(!U&&!Y)throw new Error("No content or usage found in completion");if(!U)throw new Error("No content found in completion");throw new Error("No usage found in completion")}}var ME=new Map,DE=class{usdBudget;usdMinimum;getUnknownJsonFromOpenAi;getUnknownJsonFromOpenAiSquirreled;squirrel;client;lastUsage;constructor({model:$,usdBudget:T,usdMinimum:W,apiKey:w,cachingMode:X,cacheKey:U="openai-safegen",logger:Y}){this.usdBudget=T,this.usdMinimum=W,this.squirrel=new VA(X);let G=ME.get(w);if(X!=="read"){if(!G)G=new R$({apiKey:w,dangerouslyAllowBrowser:!1}),ME.set(w,G);this.client=G}this.getUnknownJsonFromOpenAi=cj(this.client),this.getUnknownJsonFromOpenAiSquirreled=this.squirrel.add(U,this.getUnknownJsonFromOpenAi),this.from=sK(async(...H)=>{if(this.usdBudget<this.usdMinimum)return Y?.warn("SafeGen budget exhausted"),H[2];let z=gj($,...H),F=H[0],O=H[3],{data:Q,usage:Z,usdPrice:K}=await this.getUnknownJsonFromOpenAiSquirreled.for(`${F.replace(/[^a-zA-Z0-9-_. ]/g,"_")}-${O.length}`).get(z);return this.lastUsage=Z,this.usdBudget-=K,Q},Y)}from};import{exec as by}from"child_process";class A extends Array{constructor($,T){if(super($),this.sign=T,Object.setPrototypeOf(this,A.prototype),$>A.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt($){var T=Math.floor,W=Number.isFinite;if(typeof $=="number"){if($===0)return A.__zero();if(A.__isOneDigitInt($))return 0>$?A.__oneDigit(-$,!0):A.__oneDigit($,!1);if(!W($)||T($)!==$)throw new RangeError("The number "+$+" cannot be converted to BigInt because it is not an integer");return A.__fromDouble($)}if(typeof $=="string"){let w=A.__fromString($);if(w===null)throw new SyntaxError("Cannot convert "+$+" to a BigInt");return w}if(typeof $=="boolean")return $===!0?A.__oneDigit(1,!1):A.__zero();if(typeof $=="object"){if($.constructor===A)return $;let w=A.__toPrimitive($);return A.BigInt(w)}throw new TypeError("Cannot convert "+$+" to a BigInt")}toDebugString(){let $=["BigInt["];for(let T of this)$.push((T?(T>>>0).toString(16):T)+", ");return $.push("]"),$.join("")}toString($=10){if(2>$||36<$)throw new RangeError("toString() radix argument must be between 2 and 36");return this.length===0?"0":($&$-1)==0?A.__toStringBasePowerOfTwo(this,$):A.__toStringGeneric(this,$,!1)}valueOf(){throw new Error("Convert JSBI instances to native numbers using `toNumber`.")}static toNumber($){let T=$.length;if(T===0)return 0;if(T===1){let E=$.__unsignedDigit(0);return $.sign?-E:E}let W=$.__digit(T-1),w=A.__clz30(W),X=30*T-w;if(1024<X)return $.sign?-1/0:1/0;let U=X-1,Y=W,G=T-1,H=w+3,z=H===32?0:Y<<H;z>>>=12;let F=H-12,O=12<=H?0:Y<<20+H,Q=20+H;for(0<F&&0<G&&(G--,Y=$.__digit(G),z|=Y>>>30-F,O=Y<<F+2,Q=F+2);0<Q&&0<G;)G--,Y=$.__digit(G),O|=30<=Q?Y<<Q-30:Y>>>30-Q,Q-=30;let Z=A.__decideRounding($,Q,G,Y);if((Z===1||Z===0&&(1&O)==1)&&(O=O+1>>>0,O===0&&(z++,z>>>20!=0&&(z=0,U++,1023<U))))return $.sign?-1/0:1/0;let K=$.sign?-2147483648:0;return U=U+1023<<20,A.__kBitConversionInts[A.__kBitConversionIntHigh]=K|U|z,A.__kBitConversionInts[A.__kBitConversionIntLow]=O,A.__kBitConversionDouble[0]}static unaryMinus($){if($.length===0)return $;let T=$.__copy();return T.sign=!$.sign,T}static bitwiseNot($){return $.sign?A.__absoluteSubOne($).__trim():A.__absoluteAddOne($,!0)}static exponentiate($,T){if(T.sign)throw new RangeError("Exponent must be positive");if(T.length===0)return A.__oneDigit(1,!1);if($.length===0)return $;if($.length===1&&$.__digit(0)===1)return $.sign&&(1&T.__digit(0))==0?A.unaryMinus($):$;if(1<T.length)throw new RangeError("BigInt too big");let W=T.__unsignedDigit(0);if(W===1)return $;if(W>=A.__kMaxLengthBits)throw new RangeError("BigInt too big");if($.length===1&&$.__digit(0)===2){let U=1+(0|W/30),Y=$.sign&&(1&W)!=0,G=new A(U,Y);G.__initializeDigits();let H=1<<W%30;return G.__setDigit(U-1,H),G}let w=null,X=$;for((1&W)!=0&&(w=$),W>>=1;W!==0;W>>=1)X=A.multiply(X,X),(1&W)!=0&&(w===null?w=X:w=A.multiply(w,X));return w}static multiply($,T){if($.length===0)return $;if(T.length===0)return T;let W=$.length+T.length;30<=$.__clzmsd()+T.__clzmsd()&&W--;let w=new A(W,$.sign!==T.sign);w.__initializeDigits();for(let X=0;X<$.length;X++)A.__multiplyAccumulate(T,$.__digit(X),w,X);return w.__trim()}static divide($,T){if(T.length===0)throw new RangeError("Division by zero");if(0>A.__absoluteCompare($,T))return A.__zero();let W=$.sign!==T.sign,w=T.__unsignedDigit(0),X;if(T.length===1&&32767>=w){if(w===1)return W===$.sign?$:A.unaryMinus($);X=A.__absoluteDivSmall($,w,null)}else X=A.__absoluteDivLarge($,T,!0,!1);return X.sign=W,X.__trim()}static remainder($,T){if(T.length===0)throw new RangeError("Division by zero");if(0>A.__absoluteCompare($,T))return $;let W=T.__unsignedDigit(0);if(T.length===1&&32767>=W){if(W===1)return A.__zero();let X=A.__absoluteModSmall($,W);return X===0?A.__zero():A.__oneDigit(X,$.sign)}let w=A.__absoluteDivLarge($,T,!1,!0);return w.sign=$.sign,w.__trim()}static add($,T){let W=$.sign;return W===T.sign?A.__absoluteAdd($,T,W):0<=A.__absoluteCompare($,T)?A.__absoluteSub($,T,W):A.__absoluteSub(T,$,!W)}static subtract($,T){let W=$.sign;return W===T.sign?0<=A.__absoluteCompare($,T)?A.__absoluteSub($,T,W):A.__absoluteSub(T,$,!W):A.__absoluteAdd($,T,W)}static leftShift($,T){return T.length===0||$.length===0?$:T.sign?A.__rightShiftByAbsolute($,T):A.__leftShiftByAbsolute($,T)}static signedRightShift($,T){return T.length===0||$.length===0?$:T.sign?A.__leftShiftByAbsolute($,T):A.__rightShiftByAbsolute($,T)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan($,T){return 0>A.__compareToBigInt($,T)}static lessThanOrEqual($,T){return 0>=A.__compareToBigInt($,T)}static greaterThan($,T){return 0<A.__compareToBigInt($,T)}static greaterThanOrEqual($,T){return 0<=A.__compareToBigInt($,T)}static equal($,T){if($.sign!==T.sign)return!1;if($.length!==T.length)return!1;for(let W=0;W<$.length;W++)if($.__digit(W)!==T.__digit(W))return!1;return!0}static notEqual($,T){return!A.equal($,T)}static bitwiseAnd($,T){var W=Math.max;if(!$.sign&&!T.sign)return A.__absoluteAnd($,T).__trim();if($.sign&&T.sign){let w=W($.length,T.length)+1,X=A.__absoluteSubOne($,w),U=A.__absoluteSubOne(T);return X=A.__absoluteOr(X,U,X),A.__absoluteAddOne(X,!0,X).__trim()}return $.sign&&([$,T]=[T,$]),A.__absoluteAndNot($,A.__absoluteSubOne(T)).__trim()}static bitwiseXor($,T){var W=Math.max;if(!$.sign&&!T.sign)return A.__absoluteXor($,T).__trim();if($.sign&&T.sign){let U=W($.length,T.length),Y=A.__absoluteSubOne($,U),G=A.__absoluteSubOne(T);return A.__absoluteXor(Y,G,Y).__trim()}let w=W($.length,T.length)+1;$.sign&&([$,T]=[T,$]);let X=A.__absoluteSubOne(T,w);return X=A.__absoluteXor(X,$,X),A.__absoluteAddOne(X,!0,X).__trim()}static bitwiseOr($,T){var W=Math.max;let w=W($.length,T.length);if(!$.sign&&!T.sign)return A.__absoluteOr($,T).__trim();if($.sign&&T.sign){let U=A.__absoluteSubOne($,w),Y=A.__absoluteSubOne(T);return U=A.__absoluteAnd(U,Y,U),A.__absoluteAddOne(U,!0,U).__trim()}$.sign&&([$,T]=[T,$]);let X=A.__absoluteSubOne(T,w);return X=A.__absoluteAndNot(X,$,X),A.__absoluteAddOne(X,!0,X).__trim()}static asIntN($,T){var W=Math.floor;if(T.length===0)return T;if($=W($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return A.__zero();if($>=A.__kMaxLengthBits)return T;let w=0|($+29)/30;if(T.length<w)return T;let X=T.__unsignedDigit(w-1),U=1<<($-1)%30;if(T.length===w&&X<U)return T;if((X&U)!==U)return A.__truncateToNBits($,T);if(!T.sign)return A.__truncateAndSubFromPowerOfTwo($,T,!0);if((X&U-1)==0){for(let Y=w-2;0<=Y;Y--)if(T.__digit(Y)!==0)return A.__truncateAndSubFromPowerOfTwo($,T,!1);return T.length===w&&X===U?T:A.__truncateToNBits($,T)}return A.__truncateAndSubFromPowerOfTwo($,T,!1)}static asUintN($,T){var W=Math.floor;if(T.length===0)return T;if($=W($),0>$)throw new RangeError("Invalid value: not (convertible to) a safe integer");if($===0)return A.__zero();if(T.sign){if($>A.__kMaxLengthBits)throw new RangeError("BigInt too big");return A.__truncateAndSubFromPowerOfTwo($,T,!1)}if($>=A.__kMaxLengthBits)return T;let w=0|($+29)/30;if(T.length<w)return T;let X=$%30;if(T.length==w){if(X===0)return T;if(T.__digit(w-1)>>>X==0)return T}return A.__truncateToNBits($,T)}static ADD($,T){if($=A.__toPrimitive($),T=A.__toPrimitive(T),typeof $=="string")return typeof T!="string"&&(T=T.toString()),$+T;if(typeof T=="string")return $.toString()+T;if($=A.__toNumeric($),T=A.__toNumeric(T),A.__isBigInt($)&&A.__isBigInt(T))return A.add($,T);if(typeof $=="number"&&typeof T=="number")return $+T;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT($,T){return A.__compare($,T,0)}static LE($,T){return A.__compare($,T,1)}static GT($,T){return A.__compare($,T,2)}static GE($,T){return A.__compare($,T,3)}static EQ($,T){for(;;){if(A.__isBigInt($))return A.__isBigInt(T)?A.equal($,T):A.EQ(T,$);if(typeof $=="number"){if(A.__isBigInt(T))return A.__equalToNumber(T,$);if(typeof T!="object")return $==T;T=A.__toPrimitive(T)}else if(typeof $=="string"){if(A.__isBigInt(T))return $=A.__fromString($),$!==null&&A.equal($,T);if(typeof T!="object")return $==T;T=A.__toPrimitive(T)}else if(typeof $=="boolean"){if(A.__isBigInt(T))return A.__equalToNumber(T,+$);if(typeof T!="object")return $==T;T=A.__toPrimitive(T)}else if(typeof $=="symbol"){if(A.__isBigInt(T))return!1;if(typeof T!="object")return $==T;T=A.__toPrimitive(T)}else if(typeof $=="object"){if(typeof T=="object"&&T.constructor!==A)return $==T;$=A.__toPrimitive($)}else return $==T}}static NE($,T){return!A.EQ($,T)}static DataViewGetBigInt64($,T,W=!1){return A.asIntN(64,A.DataViewGetBigUint64($,T,W))}static DataViewGetBigUint64($,T,W=!1){let[w,X]=W?[4,0]:[0,4],U=$.getUint32(T+w,W),Y=$.getUint32(T+X,W),G=new A(3,!1);return G.__setDigit(0,1073741823&Y),G.__setDigit(1,(268435455&U)<<2|Y>>>30),G.__setDigit(2,U>>>28),G.__trim()}static DataViewSetBigInt64($,T,W,w=!1){A.DataViewSetBigUint64($,T,W,w)}static DataViewSetBigUint64($,T,W,w=!1){W=A.asUintN(64,W);let X=0,U=0;if(0<W.length&&(U=W.__digit(0),1<W.length)){let H=W.__digit(1);U|=H<<30,X=H>>>2,2<W.length&&(X|=W.__digit(2)<<28)}let[Y,G]=w?[4,0]:[0,4];$.setUint32(T+Y,X,w),$.setUint32(T+G,U,w)}static __zero(){return new A(0,!1)}static __oneDigit($,T){let W=new A(1,T);return W.__setDigit(0,$),W}__copy(){let $=new A(this.length,this.sign);for(let T=0;T<this.length;T++)$[T]=this[T];return $}__trim(){let $=this.length,T=this[$-1];for(;T===0;)$--,T=this[$-1],this.pop();return $===0&&(this.sign=!1),this}__initializeDigits(){for(let $=0;$<this.length;$++)this[$]=0}static __decideRounding($,T,W,w){if(0<T)return-1;let X;if(0>T)X=-T-1;else{if(W===0)return-1;W--,w=$.__digit(W),X=29}let U=1<<X;if((w&U)==0)return-1;if(U-=1,(w&U)!=0)return 1;for(;0<W;)if(W--,$.__digit(W)!==0)return 1;return 0}static __fromDouble($){A.__kBitConversionDouble[0]=$;let T=2047&A.__kBitConversionInts[A.__kBitConversionIntHigh]>>>20,W=T-1023,w=(0|W/30)+1,X=new A(w,0>$),U=1048575&A.__kBitConversionInts[A.__kBitConversionIntHigh]|1048576,Y=A.__kBitConversionInts[A.__kBitConversionIntLow],G=20,H=W%30,z,F=0;if(H<20){let O=G-H;F=O+32,z=U>>>O,U=U<<32-O|Y>>>O,Y<<=32-O}else if(H===20)F=32,z=U,U=Y,Y=0;else{let O=H-G;F=32-O,z=U<<O|Y>>>32-O,U=Y<<O,Y=0}X.__setDigit(w-1,z);for(let O=w-2;0<=O;O--)0<F?(F-=30,z=U>>>2,U=U<<30|Y>>>2,Y<<=30):z=0,X.__setDigit(O,z);return X.__trim()}static __isWhitespace($){return 13>=$&&9<=$||(159>=$?$==32:131071>=$?$==160||$==5760:196607>=$?($&=131071,10>=$||$==40||$==41||$==47||$==95||$==4096):$==65279)}static __fromString($,T=0){let W=0,w=$.length,X=0;if(X===w)return A.__zero();let U=$.charCodeAt(X);for(;A.__isWhitespace(U);){if(++X===w)return A.__zero();U=$.charCodeAt(X)}if(U===43){if(++X===w)return null;U=$.charCodeAt(X),W=1}else if(U===45){if(++X===w)return null;U=$.charCodeAt(X),W=-1}if(T===0){if(T=10,U===48){if(++X===w)return A.__zero();if(U=$.charCodeAt(X),U===88||U===120){if(T=16,++X===w)return null;U=$.charCodeAt(X)}else if(U===79||U===111){if(T=8,++X===w)return null;U=$.charCodeAt(X)}else if(U===66||U===98){if(T=2,++X===w)return null;U=$.charCodeAt(X)}}}else if(T===16&&U===48){if(++X===w)return A.__zero();if(U=$.charCodeAt(X),U===88||U===120){if(++X===w)return null;U=$.charCodeAt(X)}}if(W!=0&&T!==10)return null;for(;U===48;){if(++X===w)return A.__zero();U=$.charCodeAt(X)}let Y=w-X,G=A.__kMaxBitsPerChar[T],H=A.__kBitsPerCharTableMultiplier-1;if(Y>1073741824/G)return null;let z=G*Y+H>>>A.__kBitsPerCharTableShift,F=new A(0|(z+29)/30,!1),O=10>T?T:10,Q=10<T?T-10:0;if((T&T-1)==0){G>>=A.__kBitsPerCharTableShift;let Z=[],K=[],E=!1;do{let M=0,L=0;for(;;){let R;if(U-48>>>0<O)R=U-48;else if((32|U)-97>>>0<Q)R=(32|U)-87;else{E=!0;break}if(L+=G,M=M<<G|R,++X===w){E=!0;break}if(U=$.charCodeAt(X),30<L+G)break}Z.push(M),K.push(L)}while(!E);A.__fillFromParts(F,Z,K)}else{F.__initializeDigits();let Z=!1,K=0;do{let E=0,M=1;for(;;){let R;if(U-48>>>0<O)R=U-48;else if((32|U)-97>>>0<Q)R=(32|U)-87;else{Z=!0;break}let _=M*T;if(1073741823<_)break;if(M=_,E=E*T+R,K++,++X===w){Z=!0;break}U=$.charCodeAt(X)}H=30*A.__kBitsPerCharTableMultiplier-1;let L=0|(G*K+H>>>A.__kBitsPerCharTableShift)/30;F.__inplaceMultiplyAdd(M,E,L)}while(!Z)}if(X!==w){if(!A.__isWhitespace(U))return null;for(X++;X<w;X++)if(U=$.charCodeAt(X),!A.__isWhitespace(U))return null}return F.sign=W==-1,F.__trim()}static __fillFromParts($,T,W){let w=0,X=0,U=0;for(let Y=T.length-1;0<=Y;Y--){let G=T[Y],H=W[Y];X|=G<<U,U+=H,U===30?($.__setDigit(w++,X),U=0,X=0):30<U&&($.__setDigit(w++,1073741823&X),U-=30,X=G>>>H-U)}if(X!==0){if(w>=$.length)throw new Error("implementation bug");$.__setDigit(w++,X)}for(;w<$.length;w++)$.__setDigit(w,0)}static __toStringBasePowerOfTwo($,T){let W=$.length,w=T-1;w=(85&w>>>1)+(85&w),w=(51&w>>>2)+(51&w),w=(15&w>>>4)+(15&w);let X=w,U=T-1,Y=$.__digit(W-1),G=A.__clz30(Y),H=0|(30*W-G+X-1)/X;if($.sign&&H++,268435456<H)throw new Error("string too long");let z=Array(H),F=H-1,O=0,Q=0;for(let K=0;K<W-1;K++){let E=$.__digit(K),M=(O|E<<Q)&U;z[F--]=A.__kConversionChars[M];let L=X-Q;for(O=E>>>L,Q=30-L;Q>=X;)z[F--]=A.__kConversionChars[O&U],O>>>=X,Q-=X}let Z=(O|Y<<Q)&U;for(z[F--]=A.__kConversionChars[Z],O=Y>>>X-Q;O!==0;)z[F--]=A.__kConversionChars[O&U],O>>>=X;if($.sign&&(z[F--]="-"),F!=-1)throw new Error("implementation bug");return z.join("")}static __toStringGeneric($,T,W){let w=$.length;if(w===0)return"";if(w===1){let K=$.__unsignedDigit(0).toString(T);return W===!1&&$.sign&&(K="-"+K),K}let X=30*w-A.__clz30($.__digit(w-1)),U=A.__kMaxBitsPerChar[T],Y=U-1,G=X*A.__kBitsPerCharTableMultiplier;G+=Y-1,G=0|G/Y;let H=G+1>>1,z=A.exponentiate(A.__oneDigit(T,!1),A.__oneDigit(H,!1)),F,O,Q=z.__unsignedDigit(0);if(z.length===1&&32767>=Q){F=new A($.length,!1),F.__initializeDigits();let K=0;for(let E=2*$.length-1;0<=E;E--){let M=K<<15|$.__halfDigit(E);F.__setHalfDigit(E,0|M/Q),K=0|M%Q}O=K.toString(T)}else{let K=A.__absoluteDivLarge($,z,!0,!0);F=K.quotient;let E=K.remainder.__trim();O=A.__toStringGeneric(E,T,!0)}F.__trim();let Z=A.__toStringGeneric(F,T,!0);for(;O.length<H;)O="0"+O;return W===!1&&$.sign&&(Z="-"+Z),Z+O}static __unequalSign($){return $?-1:1}static __absoluteGreater($){return $?-1:1}static __absoluteLess($){return $?1:-1}static __compareToBigInt($,T){let W=$.sign;if(W!==T.sign)return A.__unequalSign(W);let w=A.__absoluteCompare($,T);return 0<w?A.__absoluteGreater(W):0>w?A.__absoluteLess(W):0}static __compareToNumber($,T){if(A.__isOneDigitInt(T)){let W=$.sign,w=0>T;if(W!==w)return A.__unequalSign(W);if($.length===0){if(w)throw new Error("implementation bug");return T===0?0:-1}if(1<$.length)return A.__absoluteGreater(W);let X=Math.abs(T),U=$.__unsignedDigit(0);return U>X?A.__absoluteGreater(W):U<X?A.__absoluteLess(W):0}return A.__compareToDouble($,T)}static __compareToDouble($,T){if(T!==T)return T;if(T===1/0)return-1;if(T===-1/0)return 1;let W=$.sign;if(W!==0>T)return A.__unequalSign(W);if(T===0)throw new Error("implementation bug: should be handled elsewhere");if($.length===0)return-1;A.__kBitConversionDouble[0]=T;let w=2047&A.__kBitConversionInts[A.__kBitConversionIntHigh]>>>20;if(w==2047)throw new Error("implementation bug: handled elsewhere");let X=w-1023;if(0>X)return A.__absoluteGreater(W);let U=$.length,Y=$.__digit(U-1),G=A.__clz30(Y),H=30*U-G,z=X+1;if(H<z)return A.__absoluteLess(W);if(H>z)return A.__absoluteGreater(W);let F=1048576|1048575&A.__kBitConversionInts[A.__kBitConversionIntHigh],O=A.__kBitConversionInts[A.__kBitConversionIntLow],Q=20,Z=29-G;if(Z!==(0|(H-1)%30))throw new Error("implementation bug");let K,E=0;if(20>Z){let M=Q-Z;E=M+32,K=F>>>M,F=F<<32-M|O>>>M,O<<=32-M}else if(Z===20)E=32,K=F,F=O,O=0;else{let M=Z-Q;E=32-M,K=F<<M|O>>>32-M,F=O<<M,O=0}if(Y>>>=0,K>>>=0,Y>K)return A.__absoluteGreater(W);if(Y<K)return A.__absoluteLess(W);for(let M=U-2;0<=M;M--){0<E?(E-=30,K=F>>>2,F=F<<30|O>>>2,O<<=30):K=0;let L=$.__unsignedDigit(M);if(L>K)return A.__absoluteGreater(W);if(L<K)return A.__absoluteLess(W)}if(F!==0||O!==0){if(E===0)throw new Error("implementation bug");return A.__absoluteLess(W)}return 0}static __equalToNumber($,T){var W=Math.abs;return A.__isOneDigitInt(T)?T===0?$.length===0:$.length===1&&$.sign===0>T&&$.__unsignedDigit(0)===W(T):A.__compareToDouble($,T)===0}static __comparisonResultToBool($,T){return T===0?0>$:T===1?0>=$:T===2?0<$:T===3?0<=$:void 0}static __compare($,T,W){if($=A.__toPrimitive($),T=A.__toPrimitive(T),typeof $=="string"&&typeof T=="string")switch(W){case 0:return $<T;case 1:return $<=T;case 2:return $>T;case 3:return $>=T}if(A.__isBigInt($)&&typeof T=="string")return T=A.__fromString(T),T!==null&&A.__comparisonResultToBool(A.__compareToBigInt($,T),W);if(typeof $=="string"&&A.__isBigInt(T))return $=A.__fromString($),$!==null&&A.__comparisonResultToBool(A.__compareToBigInt($,T),W);if($=A.__toNumeric($),T=A.__toNumeric(T),A.__isBigInt($)){if(A.__isBigInt(T))return A.__comparisonResultToBool(A.__compareToBigInt($,T),W);if(typeof T!="number")throw new Error("implementation bug");return A.__comparisonResultToBool(A.__compareToNumber($,T),W)}if(typeof $!="number")throw new Error("implementation bug");if(A.__isBigInt(T))return A.__comparisonResultToBool(A.__compareToNumber(T,$),2^W);if(typeof T!="number")throw new Error("implementation bug");return W===0?$<T:W===1?$<=T:W===2?$>T:W===3?$>=T:void 0}__clzmsd(){return A.__clz30(this.__digit(this.length-1))}static __absoluteAdd($,T,W){if($.length<T.length)return A.__absoluteAdd(T,$,W);if($.length===0)return $;if(T.length===0)return $.sign===W?$:A.unaryMinus($);let w=$.length;($.__clzmsd()===0||T.length===$.length&&T.__clzmsd()===0)&&w++;let X=new A(w,W),U=0,Y=0;for(;Y<T.length;Y++){let G=$.__digit(Y)+T.__digit(Y)+U;U=G>>>30,X.__setDigit(Y,1073741823&G)}for(;Y<$.length;Y++){let G=$.__digit(Y)+U;U=G>>>30,X.__setDigit(Y,1073741823&G)}return Y<X.length&&X.__setDigit(Y,U),X.__trim()}static __absoluteSub($,T,W){if($.length===0)return $;if(T.length===0)return $.sign===W?$:A.unaryMinus($);let w=new A($.length,W),X=0,U=0;for(;U<T.length;U++){let Y=$.__digit(U)-T.__digit(U)-X;X=1&Y>>>30,w.__setDigit(U,1073741823&Y)}for(;U<$.length;U++){let Y=$.__digit(U)-X;X=1&Y>>>30,w.__setDigit(U,1073741823&Y)}return w.__trim()}static __absoluteAddOne($,T,W=null){let w=$.length;W===null?W=new A(w,T):W.sign=T;let X=1;for(let U=0;U<w;U++){let Y=$.__digit(U)+X;X=Y>>>30,W.__setDigit(U,1073741823&Y)}return X!=0&&W.__setDigitGrow(w,1),W}static __absoluteSubOne($,T){let W=$.length;T=T||W;let w=new A(T,!1),X=1;for(let U=0;U<W;U++){let Y=$.__digit(U)-X;X=1&Y>>>30,w.__setDigit(U,1073741823&Y)}if(X!=0)throw new Error("implementation bug");for(let U=W;U<T;U++)w.__setDigit(U,0);return w}static __absoluteAnd($,T,W=null){let w=$.length,X=T.length,U=X;if(w<X){U=w;let H=$,z=w;$=T,w=X,T=H,X=z}let Y=U;W===null?W=new A(Y,!1):Y=W.length;let G=0;for(;G<U;G++)W.__setDigit(G,$.__digit(G)&T.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteAndNot($,T,W=null){let w=$.length,X=T.length,U=X;w<X&&(U=w);let Y=w;W===null?W=new A(Y,!1):Y=W.length;let G=0;for(;G<U;G++)W.__setDigit(G,$.__digit(G)&~T.__digit(G));for(;G<w;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteOr($,T,W=null){let w=$.length,X=T.length,U=X;if(w<X){U=w;let H=$,z=w;$=T,w=X,T=H,X=z}let Y=w;W===null?W=new A(Y,!1):Y=W.length;let G=0;for(;G<U;G++)W.__setDigit(G,$.__digit(G)|T.__digit(G));for(;G<w;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteXor($,T,W=null){let w=$.length,X=T.length,U=X;if(w<X){U=w;let H=$,z=w;$=T,w=X,T=H,X=z}let Y=w;W===null?W=new A(Y,!1):Y=W.length;let G=0;for(;G<U;G++)W.__setDigit(G,$.__digit(G)^T.__digit(G));for(;G<w;G++)W.__setDigit(G,$.__digit(G));for(;G<Y;G++)W.__setDigit(G,0);return W}static __absoluteCompare($,T){let W=$.length-T.length;if(W!=0)return W;let w=$.length-1;for(;0<=w&&$.__digit(w)===T.__digit(w);)w--;return 0>w?0:$.__unsignedDigit(w)>T.__unsignedDigit(w)?1:-1}static __multiplyAccumulate($,T,W,w){if(T===0)return;let X=32767&T,U=T>>>15,Y=0,G=0;for(let H,z=0;z<$.length;z++,w++){H=W.__digit(w);let F=$.__digit(z),O=32767&F,Q=F>>>15,Z=A.__imul(O,X),K=A.__imul(O,U),E=A.__imul(Q,X),M=A.__imul(Q,U);H+=G+Z+Y,Y=H>>>30,H&=1073741823,H+=((32767&K)<<15)+((32767&E)<<15),Y+=H>>>30,G=M+(K>>>15)+(E>>>15),W.__setDigit(w,1073741823&H)}for(;Y!=0||G!==0;w++){let H=W.__digit(w);H+=Y+G,G=0,Y=H>>>30,W.__setDigit(w,1073741823&H)}}static __internalMultiplyAdd($,T,W,w,X){let U=W,Y=0;for(let G=0;G<w;G++){let H=$.__digit(G),z=A.__imul(32767&H,T),F=A.__imul(H>>>15,T),O=z+((32767&F)<<15)+Y+U;U=O>>>30,Y=F>>>15,X.__setDigit(G,1073741823&O)}if(X.length>w)for(X.__setDigit(w++,U+Y);w<X.length;)X.__setDigit(w++,0);else if(U+Y!==0)throw new Error("implementation bug")}__inplaceMultiplyAdd($,T,W){W>this.length&&(W=this.length);let w=32767&$,X=$>>>15,U=0,Y=T;for(let G=0;G<W;G++){let H=this.__digit(G),z=32767&H,F=H>>>15,O=A.__imul(z,w),Q=A.__imul(z,X),Z=A.__imul(F,w),K=A.__imul(F,X),E=Y+O+U;U=E>>>30,E&=1073741823,E+=((32767&Q)<<15)+((32767&Z)<<15),U+=E>>>30,Y=K+(Q>>>15)+(Z>>>15),this.__setDigit(G,1073741823&E)}if(U!=0||Y!==0)throw new Error("implementation bug")}static __absoluteDivSmall($,T,W=null){W===null&&(W=new A($.length,!1));let w=0;for(let X,U=2*$.length-1;0<=U;U-=2){X=(w<<15|$.__halfDigit(U))>>>0;let Y=0|X/T;w=0|X%T,X=(w<<15|$.__halfDigit(U-1))>>>0;let G=0|X/T;w=0|X%T,W.__setDigit(U>>>1,Y<<15|G)}return W}static __absoluteModSmall($,T){let W=0;for(let w=2*$.length-1;0<=w;w--)W=0|((W<<15|$.__halfDigit(w))>>>0)%T;return W}static __absoluteDivLarge($,T,W,w){let X=T.__halfDigitLength(),U=T.length,Y=$.__halfDigitLength()-X,G=null;W&&(G=new A(Y+2>>>1,!1),G.__initializeDigits());let H=new A(X+2>>>1,!1);H.__initializeDigits();let z=A.__clz15(T.__halfDigit(X-1));0<z&&(T=A.__specialLeftShift(T,z,0));let F=A.__specialLeftShift($,z,1),O=T.__halfDigit(X-1),Q=0;for(let Z,K=Y;0<=K;K--){Z=32767;let E=F.__halfDigit(K+X);if(E!==O){let L=(E<<15|F.__halfDigit(K+X-1))>>>0;Z=0|L/O;let R=0|L%O,_=T.__halfDigit(X-2),S=F.__halfDigit(K+X-2);for(;A.__imul(Z,_)>>>0>(R<<16|S)>>>0&&(Z--,R+=O,!(32767<R)););}A.__internalMultiplyAdd(T,Z,0,U,H);let M=F.__inplaceSub(H,K,X+1);M!==0&&(M=F.__inplaceAdd(T,K,X),F.__setHalfDigit(K+X,32767&F.__halfDigit(K+X)+M),Z--),W&&(1&K?Q=Z<<15:G.__setDigit(K>>>1,Q|Z))}if(w)return F.__inplaceRightShift(z),W?{quotient:G,remainder:F}:F;if(W)return G;throw new Error("unreachable")}static __clz15($){return A.__clz30($)-15}__inplaceAdd($,T,W){let w=0;for(let X=0;X<W;X++){let U=this.__halfDigit(T+X)+$.__halfDigit(X)+w;w=U>>>15,this.__setHalfDigit(T+X,32767&U)}return w}__inplaceSub($,T,W){let w=0;if(1&T){T>>=1;let X=this.__digit(T),U=32767&X,Y=0;for(;Y<W-1>>>1;Y++){let z=$.__digit(Y),F=(X>>>15)-(32767&z)-w;w=1&F>>>15,this.__setDigit(T+Y,(32767&F)<<15|32767&U),X=this.__digit(T+Y+1),U=(32767&X)-(z>>>15)-w,w=1&U>>>15}let G=$.__digit(Y),H=(X>>>15)-(32767&G)-w;if(w=1&H>>>15,this.__setDigit(T+Y,(32767&H)<<15|32767&U),T+Y+1>=this.length)throw new RangeError("out of bounds");(1&W)==0&&(X=this.__digit(T+Y+1),U=(32767&X)-(G>>>15)-w,w=1&U>>>15,this.__setDigit(T+$.length,1073709056&X|32767&U))}else{T>>=1;let X=0;for(;X<$.length-1;X++){let z=this.__digit(T+X),F=$.__digit(X),O=(32767&z)-(32767&F)-w;w=1&O>>>15;let Q=(z>>>15)-(F>>>15)-w;w=1&Q>>>15,this.__setDigit(T+X,(32767&Q)<<15|32767&O)}let U=this.__digit(T+X),Y=$.__digit(X),G=(32767&U)-(32767&Y)-w;w=1&G>>>15;let H=0;(1&W)==0&&(H=(U>>>15)-(Y>>>15)-w,w=1&H>>>15),this.__setDigit(T+X,(32767&H)<<15|32767&G)}return w}__inplaceRightShift($){if($===0)return;let T=this.__digit(0)>>>$,W=this.length-1;for(let w=0;w<W;w++){let X=this.__digit(w+1);this.__setDigit(w,1073741823&X<<30-$|T),T=X>>>$}this.__setDigit(W,T)}static __specialLeftShift($,T,W){let w=$.length,X=new A(w+W,!1);if(T===0){for(let Y=0;Y<w;Y++)X.__setDigit(Y,$.__digit(Y));return 0<W&&X.__setDigit(w,0),X}let U=0;for(let Y=0;Y<w;Y++){let G=$.__digit(Y);X.__setDigit(Y,1073741823&G<<T|U),U=G>>>30-T}return 0<W&&X.__setDigit(w,U),X}static __leftShiftByAbsolute($,T){let W=A.__toShiftAmount(T);if(0>W)throw new RangeError("BigInt too big");let w=0|W/30,X=W%30,U=$.length,Y=X!==0&&$.__digit(U-1)>>>30-X!=0,G=U+w+(Y?1:0),H=new A(G,$.sign);if(X===0){let z=0;for(;z<w;z++)H.__setDigit(z,0);for(;z<G;z++)H.__setDigit(z,$.__digit(z-w))}else{let z=0;for(let F=0;F<w;F++)H.__setDigit(F,0);for(let F=0;F<U;F++){let O=$.__digit(F);H.__setDigit(F+w,1073741823&O<<X|z),z=O>>>30-X}if(Y)H.__setDigit(U+w,z);else if(z!==0)throw new Error("implementation bug")}return H.__trim()}static __rightShiftByAbsolute($,T){let{length:W,sign:w}=$,X=A.__toShiftAmount(T);if(0>X)return A.__rightShiftByMaximum(w);let U=0|X/30,Y=X%30,G=W-U;if(0>=G)return A.__rightShiftByMaximum(w);let H=!1;if(w){if(($.__digit(U)&(1<<Y)-1)!=0)H=!0;else for(let F=0;F<U;F++)if($.__digit(F)!==0){H=!0;break}}if(H&&Y===0)~$.__digit(W-1)==0&&G++;let z=new A(G,w);if(Y===0){z.__setDigit(G-1,0);for(let F=U;F<W;F++)z.__setDigit(F-U,$.__digit(F))}else{let F=$.__digit(U)>>>Y,O=W-U-1;for(let Q=0;Q<O;Q++){let Z=$.__digit(Q+U+1);z.__setDigit(Q,1073741823&Z<<30-Y|F),F=Z>>>Y}z.__setDigit(O,F)}return H&&(z=A.__absoluteAddOne(z,!0,z)),z.__trim()}static __rightShiftByMaximum($){return $?A.__oneDigit(1,!0):A.__zero()}static __toShiftAmount($){if(1<$.length)return-1;let T=$.__unsignedDigit(0);return T>A.__kMaxLengthBits?-1:T}static __toPrimitive($,T="default"){if(typeof $!="object")return $;if($.constructor===A)return $;if(typeof Symbol!="undefined"&&typeof Symbol.toPrimitive=="symbol"&&$[Symbol.toPrimitive]){let X=$[Symbol.toPrimitive](T);if(typeof X!="object")return X;throw new TypeError("Cannot convert object to primitive value")}let W=$.valueOf;if(W){let X=W.call($);if(typeof X!="object")return X}let w=$.toString;if(w){let X=w.call($);if(typeof X!="object")return X}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric($){return A.__isBigInt($)?$:+$}static __isBigInt($){return typeof $=="object"&&$!==null&&$.constructor===A}static __truncateToNBits($,T){let W=0|($+29)/30,w=new A(W,T.sign),X=W-1;for(let Y=0;Y<X;Y++)w.__setDigit(Y,T.__digit(Y));let U=T.__digit(X);if($%30!=0){let Y=32-$%30;U=U<<Y>>>Y}return w.__setDigit(X,U),w.__trim()}static __truncateAndSubFromPowerOfTwo($,T,W){var w=Math.min;let X=0|($+29)/30,U=new A(X,W),Y=0,G=X-1,H=0;for(let Q=w(G,T.length);Y<Q;Y++){let Z=0-T.__digit(Y)-H;H=1&Z>>>30,U.__setDigit(Y,1073741823&Z)}for(;Y<G;Y++)U.__setDigit(Y,0|1073741823&-H);let z=G<T.length?T.__digit(G):0,F=$%30,O;if(F==0)O=0-z-H,O&=1073741823;else{let Q=32-F;z=z<<Q>>>Q;let Z=1<<32-Q;O=Z-z-H,O&=Z-1}return U.__setDigit(G,O),U.__trim()}__digit($){return this[$]}__unsignedDigit($){return this[$]>>>0}__setDigit($,T){this[$]=0|T}__setDigitGrow($,T){this[$]=0|T}__halfDigitLength(){let $=this.length;return 32767>=this.__unsignedDigit($-1)?2*$-1:2*$}__halfDigit($){return 32767&this[$>>>1]>>>15*(1&$)}__setHalfDigit($,T){let W=$>>>1,w=this.__digit(W),X=1&$?32767&w|T<<15:1073709056&w|32767&T;this.__setDigit(W,X)}static __digitPow($,T){let W=1;for(;0<T;)1&T&&(W*=$),T>>>=1,$*=$;return W}static __detectBigEndian(){return A.__kBitConversionDouble[0]=-0,A.__kBitConversionInts[0]!==0}static __isOneDigitInt($){return(1073741823&$)===$}}A.__kMaxLength=33554432,A.__kMaxLengthBits=A.__kMaxLength<<5,A.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],A.__kBitsPerCharTableShift=5,A.__kBitsPerCharTableMultiplier=1<<A.__kBitsPerCharTableShift,A.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],A.__kBitConversionBuffer=new ArrayBuffer(8),A.__kBitConversionDouble=new Float64Array(A.__kBitConversionBuffer),A.__kBitConversionInts=new Int32Array(A.__kBitConversionBuffer),A.__kBitConversionIntHigh=A.__detectBigEndian()?0:1,A.__kBitConversionIntLow=A.__detectBigEndian()?1:0,A.__clz30=Math.clz32?function($){return Math.clz32($)-2}:function($){return $===0?30:0|29-(0|Math.log($>>>0)/Math.LN2)},A.__imul=Math.imul||function($,T){return 0|$*T};var P=A;var U1=P.BigInt(0),vw=P.BigInt(1),MO=P.BigInt(2),uj=P.BigInt(10),pj=P.BigInt(24),dj=P.BigInt(60),oj=P.BigInt(1000),fw=P.BigInt(1e6),Nw=P.BigInt(1e9),$M=P.multiply(P.BigInt(3600),Nw),lj=P.multiply(dj,Nw),NT=P.multiply($M,pj);function k0($){return typeof $=="bigint"?P.BigInt($.toString(10)):$}function TM($){return P.equal(P.remainder($,MO),U1)}function OW($){return P.lessThan($,U1)?P.unaryMinus($):$}function BG($,T){return P.lessThan($,T)?-1:P.greaterThan($,T)?1:0}function Qw($,T){return{quotient:P.divide($,T),remainder:P.remainder($,T)}}var NE,LE,Z$="slot-epochNanoSeconds",V$="slot-iso-date",X4="slot-iso-date-time",O4="slot-time",u="slot-calendar",WM="slot-date-brand",XM="slot-year-month-brand",wM="slot-month-day-brand",y$="slot-time-zone",Z6="slot-years",V6="slot-months",f6="slot-weeks",K6="slot-days",A6="slot-hours",E6="slot-minutes",M6="slot-seconds",D6="slot-milliseconds",N6="slot-microseconds",b6="slot-nanoseconds",UM="date",YM="ym",GM="md",zM="time",HM="datetime",FM="instant",LW="original",_2="timezone-canonical",sF="timezone-original",Zw="calendar-id",OM="locale",eF="options",QM=new WeakMap,$O=Symbol.for("@@Temporal__GetSlots");(NE=globalThis)[$O]||(NE[$O]=function($){return QM.get($)});var oG=globalThis[$O],TO=Symbol.for("@@Temporal__CreateSlots");(LE=globalThis)[TO]||(LE[TO]=function($){QM.set($,Object.create(null))});var f0=globalThis[TO];function k6($,...T){if(!$||typeof $!="object")return!1;let W=oG($);return!!W&&T.every((w)=>(w in W))}function V($,T){let W=oG($)?.[T];if(W===void 0)throw new TypeError(`Missing internal slot ${T}`);return W}function _$($,T,W){let w=oG($);if(w===void 0)throw new TypeError("Missing slots for the given container");if(w[T])throw new TypeError(`${T} already has set`);w[T]=W}var WO={};function b0($,T){Object.defineProperty($.prototype,Symbol.toStringTag,{value:T,writable:!1,enumerable:!1,configurable:!0});let W=Object.getOwnPropertyNames($);for(let X=0;X<W.length;X++){let U=W[X],Y=Object.getOwnPropertyDescriptor($,U);Y.configurable&&Y.enumerable&&(Y.enumerable=!1,Object.defineProperty($,U,Y))}let w=Object.getOwnPropertyNames($.prototype);for(let X=0;X<w.length;X++){let U=w[X],Y=Object.getOwnPropertyDescriptor($.prototype,U);Y.configurable&&Y.enumerable&&(Y.enumerable=!1,Object.defineProperty($.prototype,U,Y))}XO(T,$),XO(`${T}.prototype`,$.prototype)}function XO($,T){let W=`%${$}%`;if(WO[W]!==void 0)throw new Error(`intrinsic ${$} already exists`);WO[W]=T}function i4($){return WO[$]}function v2($,T){let W=$;if(W===0)return{div:W,mod:W};let w=Math.sign(W);W=Math.abs(W);let X=Math.trunc(1+Math.log10(W));if(T>=X)return{div:0*w,mod:w*W};if(T===0)return{div:w*W,mod:0*w};let U=W.toPrecision(X);return{div:w*Number.parseInt(U.slice(0,X-T),10),mod:w*Number.parseInt(U.slice(X-T),10)}}function rF($,T,W){let w=$,X=W;if(w===0)return X;let U=Math.sign(w)||Math.sign(X);w=Math.abs(w),X=Math.abs(X);let Y=w.toPrecision(Math.trunc(1+Math.log10(w)));if(X===0)return U*Number.parseInt(Y+"0".repeat(T),10);let G=Y+X.toPrecision(Math.trunc(1+Math.log10(X))).padStart(T,"0");return U*Number.parseInt(G,10)}function lG($,T){let W=T==="negative";switch($){case"ceil":return W?"zero":"infinity";case"floor":return W?"infinity":"zero";case"expand":return"infinity";case"trunc":return"zero";case"halfCeil":return W?"half-zero":"half-infinity";case"halfFloor":return W?"half-infinity":"half-zero";case"halfExpand":return"half-infinity";case"halfTrunc":return"half-zero";case"halfEven":return"half-even"}}function rG($,T,W,w,X){return X==="zero"?$:X==="infinity"?T:W<0?$:W>0?T:X==="half-zero"?$:X==="half-infinity"?T:w?$:T}class q${constructor($){this.totalNs=k0($),this.sec=P.toNumber(P.divide(this.totalNs,Nw)),this.subsec=P.toNumber(P.remainder(this.totalNs,Nw))}static validateNew($,T){if(P.greaterThan(OW($),q$.MAX))throw new RangeError(`${T} of duration time units cannot exceed ${q$.MAX} s`);return new q$($)}static fromEpochNsDiff($,T){let W=P.subtract(k0($),k0(T));return new q$(W)}static fromComponents($,T,W,w,X,U){let Y=P.add(P.add(P.add(P.add(P.add(P.BigInt(U),P.multiply(P.BigInt(X),oj)),P.multiply(P.BigInt(w),fw)),P.multiply(P.BigInt(W),Nw)),P.multiply(P.BigInt(T),lj)),P.multiply(P.BigInt($),$M));return q$.validateNew(Y,"total")}abs(){return new q$(OW(this.totalNs))}add($){return q$.validateNew(P.add(this.totalNs,$.totalNs),"sum")}add24HourDays($){return q$.validateNew(P.add(this.totalNs,P.multiply(P.BigInt($),NT)),"sum")}addToEpochNs($){return P.add(k0($),this.totalNs)}cmp($){return BG(this.totalNs,$.totalNs)}divmod($){let{quotient:T,remainder:W}=Qw(this.totalNs,P.BigInt($));return{quotient:P.toNumber(T),remainder:new q$(W)}}fdiv($){let T=k0($),W=P.BigInt(T),{quotient:w,remainder:X}=Qw(this.totalNs,W),U=[],Y,G=(P.lessThan(this.totalNs,U1)?-1:1)*Math.sign(P.toNumber(T));for(;!P.equal(X,U1)&&U.length<50;)X=P.multiply(X,uj),{quotient:Y,remainder:X}=Qw(X,W),U.push(Math.abs(P.toNumber(Y)));return G*Number(OW(w).toString()+"."+U.join(""))}isZero(){return P.equal(this.totalNs,U1)}round($,T){let W=k0($);if(P.equal(W,vw))return this;let{quotient:w,remainder:X}=Qw(this.totalNs,W),U=P.lessThan(this.totalNs,U1)?"negative":"positive",Y=P.multiply(OW(w),W),G=P.add(Y,W),H=BG(OW(P.multiply(X,MO)),W),z=lG(T,U),F=P.equal(OW(this.totalNs),Y)?Y:rG(Y,G,H,TM(w),z),O=U==="positive"?F:P.unaryMinus(F);return q$.validateNew(O,"rounding")}sign(){return this.cmp(new q$(U1))}subtract($){return q$.validateNew(P.subtract(this.totalNs,$.totalNs),"difference")}}q$.MAX=P.BigInt("9007199254740991999999999"),q$.ZERO=new q$(U1);var JE=/[A-Za-z._][A-Za-z._0-9+-]*/,bw=new RegExp(`(?:${/(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)/.source}|(?:${JE.source})(?:\\/(?:${JE.source}))*)`),ZM=/(?:[+-]\d{6}|\d{4})/,xG=/(?:0[1-9]|1[0-2])/,wO=/(?:0[1-9]|[12]\d|3[01])/,rj=new RegExp(`(${ZM.source})(?:-(${xG.source})-(${wO.source})|(${xG.source})(${wO.source}))`),VM=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,KM=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,AM=new RegExp(`([zZ])|${KM.source}?`),S2=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,nj=new RegExp([`^${rj.source}`,`(?:(?:[tT]|\\s+)${VM.source}(?:${AM.source})?)?`,`(?:\\[!?(${bw.source})\\])?`,`((?:${S2.source})*)$`].join("")),ij=new RegExp([`^[tT]?${VM.source}`,`(?:${AM.source})?`,`(?:\\[!?${bw.source}\\])?`,`((?:${S2.source})*)$`].join("")),tj=new RegExp(`^(${ZM.source})-?(${xG.source})(?:\\[!?${bw.source}\\])?((?:${S2.source})*)$`),aj=new RegExp(`^(?:--)?(${xG.source})-?(${wO.source})(?:\\[!?${bw.source}\\])?((?:${S2.source})*)$`),nF=/(\d+)(?:[.,](\d{1,9}))?/,sj=new RegExp(`(?:${nF.source}H)?(?:${nF.source}M)?(?:${nF.source}S)?`),ej=new RegExp(`^([+-])?P${/(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/.source}(?:T(?!$)${sj.source})?$`,"i"),LT=86400000,fG=1e6*LT,$I=60000000000,EM=1e8*LT,j2=B1(EM),qw=P.unaryMinus(j2),TI=P.add(P.subtract(qw,NT),vw),WI=P.subtract(P.add(j2,NT),vw),XI=146097*LT,RE=-271821,_E=275760,Lw=Date.UTC(1847,0,1),wI=["iso8601","hebrew","islamic","islamic-umalqura","islamic-tbla","islamic-civil","islamic-rgsa","islamicc","persian","ethiopic","ethioaa","ethiopic-amete-alem","coptic","chinese","dangi","roc","indian","buddhist","japanese","gregory"],UI=new Set(["ACT","AET","AGT","ART","AST","BET","BST","CAT","CNT","CST","CTT","EAT","ECT","IET","IST","JST","MIT","NET","NST","PLT","PNT","PRT","PST","SST","VST"]);function Q4($){return typeof $=="object"&&$!==null||typeof $=="function"}function nG($){if(typeof $=="bigint")throw new TypeError("Cannot convert BigInt to number");return Number($)}function iG($){if(typeof $=="symbol")throw new TypeError("Cannot convert a Symbol value to a String");return String($)}function A$($){let T=nG($);if(T===0)return 0;if(Number.isNaN(T)||T===1/0||T===-1/0)throw new RangeError("invalid number value");let W=Math.trunc(T);return W===0?0:W}function kE($,T){let W=A$($);if(W<=0){if(T!==void 0)throw new RangeError(`property '${T}' cannot be a a number less than one`);throw new RangeError("Cannot convert a number less than one to a positive integer")}return W}function j1($){let T=nG($);if(Number.isNaN(T))throw new RangeError("not a number");if(T===1/0||T===-1/0)throw new RangeError("infinity is out of range");if(!function(W){if(typeof W!="number"||Number.isNaN(W)||W===1/0||W===-1/0)return!1;let w=Math.abs(W);return Math.floor(w)===w}(T))throw new RangeError(`unsupported fractional value ${$}`);return T===0?0:T}function Pw($,T){return String($).padStart(T,"0")}function I4($){if(typeof $!="string")throw new TypeError(`expected a string, not ${String($)}`);return $}function UO($,T){if(Q4($)){let W=$?.toString();if(typeof W=="string"||typeof W=="number")return W;throw new TypeError("Cannot convert object to primitive value")}return $}var YO=["era","eraYear","year","month","monthCode","day","hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],YI={era:iG,eraYear:A$,year:A$,month:kE,monthCode:function($){let T=I4(UO($));if(T.length<3||T.length>4||T[0]!=="M"||"0123456789".indexOf(T[1])===-1||"0123456789".indexOf(T[2])===-1||T[1]+T[2]==="00"&&T[3]!=="L"||T[3]!=="L"&&T[3]!==void 0)throw new RangeError(`bad month code ${T}; must match M01-M99 or M00L-M99L`);return T},day:kE,hour:A$,minute:A$,second:A$,millisecond:A$,microsecond:A$,nanosecond:A$,offset:function($){let T=I4(UO($));return u2(T),T},timeZone:R6},GI={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},I2=[["years","year","date"],["months","month","date"],["weeks","week","date"],["days","day","date"],["hours","hour","time"],["minutes","minute","time"],["seconds","second","time"],["milliseconds","millisecond","time"],["microseconds","microsecond","time"],["nanoseconds","nanosecond","time"]],vE=Object.fromEntries(I2.map(($)=>[$[0],$[1]])),zI=Object.fromEntries(I2.map(([$,T])=>[T,$])),Jw=I2.map(([,$])=>$),B2={day:fG,hour:3600000000000,minute:60000000000,second:1e9,millisecond:1e6,microsecond:1000,nanosecond:1},bG=["days","hours","microseconds","milliseconds","minutes","months","nanoseconds","seconds","weeks","years"],HI=Intl.DateTimeFormat,qE=new Map;function MM($){let T=Bw($),W=qE.get(T);return W===void 0&&(W=new HI("en-us",{timeZone:T,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),qE.set(T,W)),W}function l4($){return k6($,Z$)&&!k6($,y$,u)}function H4($){return k6($,Z6,V6,K6,A6,E6,M6,D6,N6,b6)}function F4($){return k6($,WM)}function A4($){return k6($,O4)}function i$($){return k6($,X4)}function r4($){return k6($,XM)}function w1($){return k6($,wM)}function v$($){return k6($,Z$,y$,u)}function C($,T){if(!T($))throw new TypeError("invalid receiver: method called with the wrong type of this-object")}function g2($){if(k6($,u)||k6($,y$))throw new TypeError("with() does not support a calendar or timeZone property");if(A4($))throw new TypeError("with() does not accept Temporal.PlainTime, use withPlainTime() instead");if($.calendar!==void 0)throw new TypeError("with() does not support a calendar property");if($.timeZone!==void 0)throw new TypeError("with() does not support a timeZone property")}function yw($,T){return T==="never"||T==="auto"&&$==="iso8601"?"":`[${T==="critical"?"!":""}u-ca=${$}]`}function tG($){let T,W,w=!1;for(S2.lastIndex=0;W=S2.exec($);){let{1:X,2:U,3:Y}=W;if(U==="u-ca"){if(T===void 0)T=Y,w=X==="!";else if(X==="!"||w)throw new RangeError(`Invalid annotations in ${$}: more than one u-ca present with critical flag`)}else if(X==="!")throw new RangeError(`Unrecognized annotation: !${U}=${Y}`)}return T}function U0($){let T=nj.exec($);if(!T)throw new RangeError(`invalid RFC 9557 string: ${$}`);let W=tG(T[16]),w=T[1];if(w==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);let X=+w,U=+(T[2]??T[4]??1),Y=+(T[3]??T[5]??1),G=T[6]!==void 0,H=+(T[6]??0),z=+(T[7]??T[10]??0),F=+(T[8]??T[11]??0);F===60&&(F=59);let O=(T[9]??T[12]??"")+"000000000",Q=+O.slice(0,3),Z=+O.slice(3,6),K=+O.slice(6,9),E,M=!1;T[13]?(E=void 0,M=!0):T[14]&&(E=T[14]);let L=T[15];return _O(X,U,Y,H,z,F,Q,Z,K),{year:X,month:U,day:Y,time:G?{hour:H,minute:z,second:F,millisecond:Q,microsecond:Z,nanosecond:K}:"start-of-day",tzAnnotation:L,offset:E,z:M,calendar:W}}function DM($){let T=ij.exec($),W,w,X,U,Y,G,H;if(T){H=tG(T[10]),W=+(T[1]??0),w=+(T[2]??T[5]??0),X=+(T[3]??T[6]??0),X===60&&(X=59);let z=(T[4]??T[7]??"")+"000000000";if(U=+z.slice(0,3),Y=+z.slice(3,6),G=+z.slice(6,9),T[8])throw new RangeError("Z designator not supported for PlainTime")}else{let z,F;if({time:z,z:F,calendar:H}=U0($),z==="start-of-day")throw new RangeError(`time is missing in string: ${$}`);if(F)throw new RangeError("Z designator not supported for PlainTime");({hour:W,minute:w,second:X,millisecond:U,microsecond:Y,nanosecond:G}=z)}if($9(W,w,X,U,Y,G),/[tT ][0-9][0-9]/.test($))return{hour:W,minute:w,second:X,millisecond:U,microsecond:Y,nanosecond:G,calendar:H};try{let{month:z,day:F}=NO($);AW(1972,z,F)}catch{try{let{year:z,month:F}=DO($);AW(z,F,1)}catch{return{hour:W,minute:w,second:X,millisecond:U,microsecond:Y,nanosecond:G,calendar:H}}}throw new RangeError(`invalid RFC 9557 time-only string ${$}; may need a T prefix`)}function DO($){let T=tj.exec($),W,w,X,U;if(T){X=tG(T[3]);let Y=T[1];if(Y==="-000000")throw new RangeError(`invalid RFC 9557 string: ${$}`);if(W=+Y,w=+T[2],U=1,X!==void 0&&X!=="iso8601")throw new RangeError("YYYY-MM format is only valid with iso8601 calendar")}else{let Y;if({year:W,month:w,calendar:X,day:U,z:Y}=U0($),Y)throw new RangeError("Z designator not supported for PlainYearMonth")}return{year:W,month:w,calendar:X,referenceISODay:U}}function NO($){let T=aj.exec($),W,w,X,U;if(T){if(X=tG(T[3]),W=+T[1],w=+T[2],X!==void 0&&X!=="iso8601")throw new RangeError("MM-DD format is only valid with iso8601 calendar")}else{let Y;if({month:W,day:w,calendar:X,year:U,z:Y}=U0($),Y)throw new RangeError("Z designator not supported for PlainMonthDay")}return{month:W,day:w,calendar:X,referenceISOYear:U}}var NM=new RegExp(`^${bw.source}$`,"i"),LM=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?/.source}$`);function JM($){let T=OI.test($)?"Seconds not allowed in offset time zone":"Invalid time zone";throw new RangeError(`${T}: ${$}`)}function DT($){return NM.test($)||JM($),LM.test($)?{offsetMinutes:u2($)/60000000000}:{tzName:$}}function Rw($,T,W,w){let X=$,U=T,Y=W;switch(w){case"reject":AW(X,U,Y);break;case"constrain":({year:X,month:U,day:Y}=gM(X,U,Y))}return{year:X,month:U,day:Y}}function aG($,T,W,w,X,U,Y){let G=$,H=T,z=W,F=w,O=X,Q=U;switch(Y){case"reject":$9(G,H,z,F,O,Q);break;case"constrain":G=L6(G,0,23),H=L6(H,0,59),z=L6(z,0,59),F=L6(F,0,999),O=L6(O,0,999),Q=L6(Q,0,999)}return{hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}function RM($){if(!Q4($))throw new TypeError("invalid duration-like");let T={years:void 0,months:void 0,weeks:void 0,days:void 0,hours:void 0,minutes:void 0,seconds:void 0,milliseconds:void 0,microseconds:void 0,nanoseconds:void 0},W=!1;for(let w=0;w<bG.length;w++){let X=bG[w],U=$[X];U!==void 0&&(W=!0,T[X]=j1(U))}if(!W)throw new TypeError("invalid duration-like");return T}function $6({years:$,months:T,weeks:W,days:w},X,U,Y){return{years:$,months:Y??T,weeks:U??W,days:X??w}}function x$($,T){return{isoDate:$,time:T}}function j$($){return I0($,"overflow",["constrain","reject"],"constrain")}function _w($){return I0($,"disambiguation",["compatible","earlier","later","reject"],"compatible")}function x1($,T){return I0($,"roundingMode",["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"],T)}function IG($,T){return I0($,"offset",["prefer","use","ignore","reject"],T)}function hw($){return I0($,"calendarName",["auto","always","never","critical"],"auto")}function m2($){let T=$.roundingIncrement;if(T===void 0)return 1;let W=A$(T);if(W<1||W>1e9)throw new RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${T}`);return W}function c2($,T,W){let w=W?T:T-1;if($>w)throw new RangeError(`roundingIncrement must be at least 1 and less than ${w}, not ${$}`);if(T%$!=0)throw new RangeError(`Rounding increment must divide evenly into ${T}`)}function gw($){let T=$.fractionalSecondDigits;if(T===void 0)return"auto";if(typeof T!="number"){if(iG(T)!=="auto")throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`);return"auto"}let W=Math.floor(T);if(!Number.isFinite(W)||W<0||W>9)throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`);return W}function mw($,T){switch($){case"minute":return{precision:"minute",unit:"minute",increment:1};case"second":return{precision:0,unit:"second",increment:1};case"millisecond":return{precision:3,unit:"millisecond",increment:1};case"microsecond":return{precision:6,unit:"microsecond",increment:1};case"nanosecond":return{precision:9,unit:"nanosecond",increment:1}}switch(T){case"auto":return{precision:T,unit:"nanosecond",increment:1};case 0:return{precision:T,unit:"second",increment:1};case 1:case 2:case 3:return{precision:T,unit:"millisecond",increment:10**(3-T)};case 4:case 5:case 6:return{precision:T,unit:"microsecond",increment:10**(6-T)};case 7:case 8:case 9:return{precision:T,unit:"nanosecond",increment:10**(9-T)};default:throw new RangeError(`fractionalSecondDigits must be 'auto' or 0 through 9, not ${T}`)}}var x0=Symbol("~required~");function h6($,T,W,w,X=[]){let U=[];for(let z=0;z<I2.length;z++){let F=I2[z],O=F[1],Q=F[2];W!=="datetime"&&W!==Q||U.push(O)}U=U.concat(X);let Y=w;Y===x0?Y=void 0:Y!==void 0&&U.push(Y);let G=[];G=G.concat(U);for(let z=0;z<U.length;z++){let F=U[z],O=zI[F];O!==void 0&&G.push(O)}let H=I0($,T,G,Y);if(H===void 0&&w===x0)throw new RangeError(`${T} is required`);return H&&H in vE?vE[H]:H}function iF($){let T=$.relativeTo;if(T===void 0)return{};let W,w,X,U,Y,G="option",H=!1;if(Q4(T)){if(v$(T))return{zonedRelativeTo:T};if(F4(T))return{plainRelativeTo:T};if(i$(T))return{plainRelativeTo:J6(V(T,X4).isoDate,V(T,u))};X=ow(T);let z=H1(X,T,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],[]);({isoDate:W,time:w}=uw(X,z,"constrain")),{offset:Y,timeZone:U}=z,Y===void 0&&(G="wall")}else{let z,F,O,Q,Z;if({year:O,month:Q,day:Z,time:w,calendar:X,tzAnnotation:z,offset:Y,z:F}=U0(I4(T)),z)U=R6(z),F?G="exact":Y||(G="wall"),H=!0;else if(F)throw new RangeError("Z designator not supported for PlainDate relativeTo; either remove the Z or add a bracketed time zone");X||(X="iso8601"),X=v6(X),W={year:O,month:Q,day:Z}}return U===void 0?{plainRelativeTo:J6(W,X)}:{zonedRelativeTo:e4(yG(W,w,G,G==="option"?u2(Y):0,U,"compatible","reject",H),U,X)}}function v0($){return V($,Z6)!==0?"year":V($,V6)!==0?"month":V($,f6)!==0?"week":V($,K6)!==0?"day":V($,A6)!==0?"hour":V($,E6)!==0?"minute":V($,M6)!==0?"second":V($,D6)!==0?"millisecond":V($,N6)!==0?"microsecond":"nanosecond"}function S0($,T){return Jw.indexOf($)>Jw.indexOf(T)?T:$}function s1($){return $==="year"||$==="month"||$==="week"}function q0($){return s1($)||$==="day"?"date":"time"}function RT($){return i4("%calendarImpl%")($)}function cw($){return i4("%calendarImpl%")(V($,u))}function _6($,T,W="date"){let w=Object.create(null),X=RT($).isoToDate(T,{year:!0,monthCode:!0,day:!0});return w.monthCode=X.monthCode,W!=="month-day"&&W!=="date"||(w.day=X.day),W!=="year-month"&&W!=="date"||(w.year=X.year),w}function H1($,T,W,w,X){let U=RT($).extraFields(W),Y=W.concat(w,U),G=Object.create(null),H=!1;Y.sort();for(let z=0;z<Y.length;z++){let F=Y[z],O=T[F];if(O!==void 0)H=!0,G[F]=YI[F](O);else if(X!=="partial"){if(X.includes(F))throw new TypeError(`required property '${F}' missing or undefined`);G[F]=GI[F]}}if(X==="partial"&&!H)throw new TypeError("no supported properties found");return G}function GO($,T="complete"){let W=["hour","microsecond","millisecond","minute","nanosecond","second"],w=!1,X=Object.create(null);for(let U=0;U<W.length;U++){let Y=W[U],G=$[Y];G!==void 0?(X[Y]=A$(G),w=!0):T==="complete"&&(X[Y]=0)}if(!w)throw new TypeError("invalid time-like");return X}function Vw($,T){if(Q4($)){if(F4($))return j$(X$(T)),J6(V($,V$),V($,u));if(v$($)){let H=M1(V($,y$),V($,Z$));return j$(X$(T)),J6(H.isoDate,V($,u))}if(i$($))return j$(X$(T)),J6(V($,X4).isoDate,V($,u));let G=ow($);return J6(JT(G,H1(G,$,["year","month","monthCode","day"],[],[]),j$(X$(T))),G)}let{year:W,month:w,day:X,calendar:U,z:Y}=U0(I4($));if(Y)throw new RangeError("Z designator not supported for PlainDate");return U||(U="iso8601"),U=v6(U),j$(X$(T)),J6({year:W,month:w,day:X},U)}function uw($,T,W){return x$(JT($,T,W),aG(T.hour,T.minute,T.second,T.millisecond,T.microsecond,T.nanosecond,W))}function Kw($,T){let W,w,X;if(Q4($)){if(i$($))return j$(X$(T)),K1(V($,X4),V($,u));if(v$($)){let G=M1(V($,y$),V($,Z$));return j$(X$(T)),K1(G,V($,u))}if(F4($))return j$(X$(T)),K1(x$(V($,V$),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),V($,u));X=ow($);let U=H1(X,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],[]),Y=j$(X$(T));({isoDate:W,time:w}=uw(X,U,Y))}else{let U,Y,G,H;if({year:Y,month:G,day:H,time:w,calendar:X,z:U}=U0(I4($)),U)throw new RangeError("Z designator not supported for PlainDateTime");w==="start-of-day"&&(w={deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),_O(Y,G,H,w.hour,w.minute,w.second,w.millisecond,w.microsecond,w.nanosecond),X||(X="iso8601"),X=v6(X),j$(X$(T)),W={year:Y,month:G,day:H}}return K1(x$(W,w),X)}function E1($){let T=i4("%Temporal.Duration%");if(H4($))return new T(V($,Z6),V($,V6),V($,f6),V($,K6),V($,A6),V($,E6),V($,M6),V($,D6),V($,N6),V($,b6));if(!Q4($))return function(X){let{years:U,months:Y,weeks:G,days:H,hours:z,minutes:F,seconds:O,milliseconds:Q,microseconds:Z,nanoseconds:K}=function(E){let M=ej.exec(E);if(!M)throw new RangeError(`invalid duration: ${E}`);if(M.every((c,F$)=>F$<2||c===void 0))throw new RangeError(`invalid duration: ${E}`);let L=M[1]==="-"?-1:1,R=M[2]===void 0?0:A$(M[2])*L,_=M[3]===void 0?0:A$(M[3])*L,S=M[4]===void 0?0:A$(M[4])*L,x=M[5]===void 0?0:A$(M[5])*L,b=M[6]===void 0?0:A$(M[6])*L,g=M[7],T$=M[8],N$=M[9],j=M[10],U$=M[11],t=0,z$=0,B$=0;if(g!==void 0){if(T$??N$??j??U$)throw new RangeError("only the smallest unit can be fractional");B$=3600*A$((g+"000000000").slice(0,9))*L}else if(t=T$===void 0?0:A$(T$)*L,N$!==void 0){if(j??U$)throw new RangeError("only the smallest unit can be fractional");B$=60*A$((N$+"000000000").slice(0,9))*L}else z$=j===void 0?0:A$(j)*L,U$!==void 0&&(B$=A$((U$+"000000000").slice(0,9))*L);let e$=B$%1000,h4=Math.trunc(B$/1000)%1000,n6=Math.trunc(B$/1e6)%1000;return z$+=Math.trunc(B$/1e9)%60,t+=Math.trunc(B$/60000000000),T9(R,_,S,x,b,t,z$,n6,h4,e$),{years:R,months:_,weeks:S,days:x,hours:b,minutes:t,seconds:z$,milliseconds:n6,microseconds:h4,nanoseconds:e$}}(X);return new(i4("%Temporal.Duration%"))(U,Y,G,H,z,F,O,Q,Z,K)}(I4($));let W={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},w=RM($);for(let X=0;X<bG.length;X++){let U=bG[X],Y=w[U];Y!==void 0&&(W[U]=Y)}return new T(W.years,W.months,W.weeks,W.days,W.hours,W.minutes,W.seconds,W.milliseconds,W.microseconds,W.nanoseconds)}function Aw($){let T;if(Q4($)){if(l4($)||v$($))return I1(V($,Z$));T=UO($)}else T=$;let{year:W,month:w,day:X,time:U,offset:Y,z:G}=function(E){let M=U0(E);if(!M.z&&!M.offset)throw new RangeError("Temporal.Instant requires a time zone offset");return M}(I4(T)),{hour:H=0,minute:z=0,second:F=0,millisecond:O=0,microsecond:Q=0,nanosecond:Z=0}=U==="start-of-day"?{}:U,K=Iw(W,w,X,H,z,F,O,Q,Z-(G?0:u2(Y)));return C2(K.isoDate),I1(n4(K))}function PE($,T){if(Q4($)){if(w1($))return j$(X$(T)),q2(V($,V$),V($,u));let G;return k6($,u)?G=V($,u):(G=$.calendar,G===void 0&&(G="iso8601"),G=dw(G)),q2(hG(G,H1(G,$,["year","month","monthCode","day"],[],[]),j$(X$(T))),G)}let{month:W,day:w,referenceISOYear:X,calendar:U}=NO(I4($));if(U===void 0&&(U="iso8601"),U=v6(U),j$(X$(T)),U==="iso8601")return q2({year:1972,month:W,day:w},U);let Y={year:X,month:W,day:w};return JW(Y),Y=hG(U,_6(U,Y,"month-day"),"constrain"),q2(Y,U)}function ET($,T){let W;if(Q4($)){if(A4($))return j$(X$(T)),P0(V($,O4));if(i$($))return j$(X$(T)),P0(V($,X4).time);if(v$($)){let z=M1(V($,y$),V($,Z$));return j$(X$(T)),P0(z.time)}let{hour:w,minute:X,second:U,millisecond:Y,microsecond:G,nanosecond:H}=GO($);W=aG(w,X,U,Y,G,H,j$(X$(T)))}else W=DM(I4($)),j$(X$(T));return P0(W)}function _M($){return $===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:V(ET($),O4)}function Ew($,T){if(Q4($)){if(r4($))return j$(X$(T)),P2(V($,V$),V($,u));let G=ow($);return P2(Cw(G,H1(G,$,["year","month","monthCode"],[],[]),j$(X$(T))),G)}let{year:W,month:w,referenceISODay:X,calendar:U}=DO(I4($));U===void 0&&(U="iso8601"),U=v6(U),j$(X$(T));let Y={year:W,month:w,day:X};return kO(Y),Y=Cw(U,_6(U,Y,"year-month"),"constrain"),P2(Y,U)}function yG($,T,W,w,X,U,Y,G){if(T==="start-of-day")return KT(X,$);let H=x$($,T);if(W==="wall"||Y==="ignore")return T6(X,H,U);if(W==="exact"||Y==="use"){let O=Iw($.year,$.month,$.day,T.hour,T.minute,T.second,T.millisecond,T.microsecond,T.nanosecond-w);C2(O.isoDate);let Q=n4(O);return X0(Q),Q}C2($);let z=n4(H),F=Sw(X,H);for(let O=0;O<F.length;O++){let Q=F[O],Z=P.toNumber(P.subtract(z,Q)),K=MT(Z,60000000000,"halfExpand");if(Z===w||G&&K===w)return Q}if(Y==="reject"){let O=zO(w),Q=jw(H,"iso8601","auto");throw new RangeError(`Offset ${O} is invalid for ${Q} in ${X}`)}return BM(F,X,H,U)}function Mw($,T){let W,w,X,U,Y,G,H,z=!1,F="option";if(Q4($)){if(v$($)){let E=X$(T);return _w(E),IG(E,"reject"),j$(E),e4(V($,Z$),V($,y$),V($,u))}Y=ow($);let Q=H1(Y,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset","timeZone"],["timeZone"]);({offset:U,timeZone:X}=Q),U===void 0&&(F="wall");let Z=X$(T);G=_w(Z),H=IG(Z,"reject");let K=j$(Z);({isoDate:W,time:w}=uw(Y,Q,K))}else{let Q,Z,K,E,M;({year:K,month:E,day:M,time:w,tzAnnotation:Q,offset:U,z:Z,calendar:Y}=function(R){let _=U0(R);if(!_.tzAnnotation)throw new RangeError("Temporal.ZonedDateTime requires a time zone ID in brackets");return _}(I4($))),X=R6(Q),Z?F="exact":U||(F="wall"),Y||(Y="iso8601"),Y=v6(Y),z=!0;let L=X$(T);G=_w(L),H=IG(L,"reject"),j$(L),W={year:K,month:E,day:M}}let O=0;return F==="option"&&(O=u2(U)),e4(yG(W,w,F,O,X,G,H,z),X,Y)}function kM($,T,W){JW(T),f0($),_$($,V$,T),_$($,u,W),_$($,WM,!0)}function J6($,T){let W=i4("%Temporal.PlainDate%"),w=Object.create(W.prototype);return kM(w,$,T),w}function vM($,T,W){EW(T),f0($),_$($,X4,T),_$($,u,W)}function K1($,T){let W=i4("%Temporal.PlainDateTime%"),w=Object.create(W.prototype);return vM(w,$,T),w}function qM($,T,W){JW(T),f0($),_$($,V$,T),_$($,u,W),_$($,wM,!0)}function q2($,T){let W=i4("%Temporal.PlainMonthDay%"),w=Object.create(W.prototype);return qM(w,$,T),w}function PM($,T){f0($),_$($,O4,T)}function P0($){let T=i4("%Temporal.PlainTime%"),W=Object.create(T.prototype);return PM(W,$),W}function CM($,T,W){kO(T),f0($),_$($,V$,T),_$($,u,W),_$($,XM,!0)}function P2($,T){let W=i4("%Temporal.PlainYearMonth%"),w=Object.create(W.prototype);return CM(w,$,T),w}function SM($,T){X0(T),f0($),_$($,Z$,T)}function I1($){let T=i4("%Temporal.Instant%"),W=Object.create(T.prototype);return SM(W,$),W}function jM($,T,W,w){X0(T),f0($),_$($,Z$,T),_$($,y$,W),_$($,u,w)}function e4($,T,W="iso8601"){let w=i4("%Temporal.ZonedDateTime%"),X=Object.create(w.prototype);return jM(X,$,T,W),X}function CE($){return YO.filter((T)=>$[T]!==void 0)}function KW($,T,W){let w=CE(W),X=RT($).fieldKeysToIgnore(w),U=Object.create(null),Y=CE(T);for(let G=0;G<YO.length;G++){let H,z=YO[G];Y.includes(z)&&!X.includes(z)&&(H=T[z]),w.includes(z)&&(H=W[z]),H!==void 0&&(U[z]=H)}return U}function G1($,T,W,w){let X=RT($).dateAdd(T,W,w);return JW(X),X}function pw($,T,W,w){return RT($).dateUntil(T,W,w)}function dw($){if(Q4($)&&k6($,u))return V($,u);let T=I4($);try{return v6(T)}catch{}let W;try{({calendar:W}=U0(T))}catch{try{({calendar:W}=DM(T))}catch{try{({calendar:W}=DO(T))}catch{({calendar:W}=NO(T))}}}return W||(W="iso8601"),v6(W)}function ow($){if(k6($,u))return V($,u);let{calendar:T}=$;return T===void 0?"iso8601":dw(T)}function W0($,T){return v6($)===v6(T)}function JT($,T,W){let w=RT($);w.resolveFields(T,"date");let X=w.dateToISO(T,W);return JW(X),X}function Cw($,T,W){let w=RT($);w.resolveFields(T,"year-month"),T.day=1;let X=w.dateToISO(T,W);return kO(X),X}function hG($,T,W){let w=RT($);w.resolveFields(T,"month-day");let X=w.monthDayToISOReferenceDate(T,W);return JW(X),X}function R6($){if(Q4($)&&v$($))return V($,y$);let T=I4($);if(T==="UTC")return"UTC";let{tzName:W,offsetMinutes:w}=function(U){let{tzAnnotation:Y,offset:G,z:H}=function(z){if(NM.test(z))return{tzAnnotation:z,offset:void 0,z:!1};try{let{tzAnnotation:F,offset:O,z:Q}=U0(z);if(Q||F||O)return{tzAnnotation:F,offset:O,z:Q}}catch{}JM(z)}(U);return Y?DT(Y):H?DT("UTC"):G?DT(G):void 0}(T);if(w!==void 0)return LO(w);let X=gG(W);if(!X)throw new RangeError(`Unrecognized time zone ${W}`);return X.identifier}function IM($,T){if($===T)return!0;let W=DT($).offsetMinutes,w=DT(T).offsetMinutes;if(W===void 0&&w===void 0){let X=gG(T);if(!X)return!1;let U=gG($);return!!U&&U.primaryIdentifier===X.primaryIdentifier}return W===w}function C0($,T){let W=DT($).offsetMinutes;return W!==void 0?60000000000*W:HO($,T)}function zO($){let T=$<0?"-":"+",W=Math.abs($),w=Math.floor(W/3600000000000),X=Math.floor(W/60000000000)%60,U=Math.floor(W/1e9)%60,Y=W%1e9;return`${T}${sG(w,X,U,Y,U===0&&Y===0?"minute":"auto")}`}function M1($,T){let W=C0($,T),{isoDate:{year:w,month:X,day:U},time:{hour:Y,minute:G,second:H,millisecond:z,microsecond:F,nanosecond:O}}=bM(T);return Iw(w,X,U,Y,G,H,z,F,O+W)}function T6($,T,W){return BM(Sw($,T),$,T,W)}function BM($,T,W,w){let X=$.length;if(X===1)return $[0];if(X)switch(w){case"compatible":case"earlier":return $[0];case"later":return $[X-1];case"reject":throw new RangeError("multiple instants found")}if(w==="reject")throw new RangeError("multiple instants found");let U=n4(W),Y=P.subtract(U,NT);X0(Y);let G=C0(T,Y),H=P.add(U,NT);X0(H);let z=C0(T,H)-G;switch(w){case"earlier":{let F=q$.fromComponents(0,0,0,0,0,-z),O=x2(W.time,F);return Sw(T,x$(g6(W.isoDate.year,W.isoDate.month,W.isoDate.day+O.deltaDays),O))[0]}case"compatible":case"later":{let F=q$.fromComponents(0,0,0,0,0,z),O=x2(W.time,F),Q=Sw(T,x$(g6(W.isoDate.year,W.isoDate.month,W.isoDate.day+O.deltaDays),O));return Q[Q.length-1]}}}function Sw($,T){if($==="UTC")return C2(T.isoDate),[n4(T)];let W=DT($).offsetMinutes;if(W!==void 0){let w=Iw(T.isoDate.year,T.isoDate.month,T.isoDate.day,T.time.hour,T.time.minute-W,T.time.second,T.time.millisecond,T.time.microsecond,T.time.nanosecond);C2(w.isoDate);let X=n4(w);return X0(X),[X]}return C2(T.isoDate),function(w,X){let U=n4(X),Y=P.subtract(U,NT);P.lessThan(Y,qw)&&(Y=U);let G=P.add(U,NT);P.greaterThan(G,j2)&&(G=U);let H=HO(w,Y),z=HO(w,G);return(H===z?[H]:[H,z]).map((O)=>{let Q=P.subtract(U,P.BigInt(O)),Z=function(K,E){let{epochMilliseconds:M,time:{millisecond:L,microsecond:R,nanosecond:_}}=bM(E),{year:S,month:x,day:b,hour:g,minute:T$,second:N$}=yM(K,M);return Iw(S,x,b,g,T$,N$,L,R,_)}(w,Q);if(f2(X,Z)===0)return X0(Q),Q}).filter((O)=>O!==void 0)}($,T)}function KT($,T){let W=x$(T,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),w=Sw($,W);if(w.length)return w[0];let X=n4(W),U=P.subtract(X,NT);return X0(U),RO($,U)}function lw($){let T;return T=$<0||$>9999?($<0?"-":"+")+Pw(Math.abs($),6):Pw($,4),T}function z1($){return Pw($,2)}function xM($,T){let W;if(T==="auto"){if($===0)return"";W=Pw($,9).replace(/0+$/,"")}else{if(T===0)return"";W=Pw($,9).slice(0,T)}return`.${W}`}function sG($,T,W,w,X){let U=`${z1($)}:${z1(T)}`;return X==="minute"||(U+=`:${z1(W)}`,U+=xM(w,X)),U}function SE($,T,W){let w=T;w===void 0&&(w="UTC");let X=V($,Z$),U=jw(M1(w,X),"iso8601",W,"never"),Y="Z";return T!==void 0&&(Y=fM(C0(w,X))),`${U}${Y}`}function jG($,T){let W=V($,Z6),w=V($,V6),X=V($,f6),U=V($,K6),Y=V($,A6),G=V($,E6),H=cG($),z="";W!==0&&(z+=`${Math.abs(W)}Y`),w!==0&&(z+=`${Math.abs(w)}M`),X!==0&&(z+=`${Math.abs(X)}W`),U!==0&&(z+=`${Math.abs(U)}D`);let F="";Y!==0&&(F+=`${Math.abs(Y)}H`),G!==0&&(F+=`${Math.abs(G)}M`);let O=q$.fromComponents(0,0,V($,M6),V($,D6),V($,N6),V($,b6));O.isZero()&&!["second","millisecond","microsecond","nanosecond"].includes(v0($))&&T==="auto"||(F+=`${Math.abs(O.sec)}${xM(Math.abs(O.subsec),T)}S`);let Q=`${H<0?"-":""}P${z}`;return F&&(Q=`${Q}T${F}`),Q}function jE($,T="auto"){let{year:W,month:w,day:X}=V($,V$);return`${lw(W)}-${z1(w)}-${z1(X)}${yw(V($,u),T)}`}function IE({hour:$,minute:T,second:W,millisecond:w,microsecond:X,nanosecond:U},Y){return sG($,T,W,1e6*w+1000*X+U,Y)}function jw($,T,W,w="auto"){let{isoDate:{year:X,month:U,day:Y},time:{hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}=$;return`${lw(X)}-${z1(U)}-${z1(Y)}T${sG(G,H,z,1e6*F+1000*O+Q,W)}${yw(T,w)}`}function BE($,T="auto"){let{year:W,month:w,day:X}=V($,V$),U=`${z1(w)}-${z1(X)}`,Y=V($,u);T!=="always"&&T!=="critical"&&Y==="iso8601"||(U=`${lw(W)}-${U}`);let G=yw(Y,T);return G&&(U+=G),U}function xE($,T="auto"){let{year:W,month:w,day:X}=V($,V$),U=`${lw(W)}-${z1(w)}`,Y=V($,u);T!=="always"&&T!=="critical"&&Y==="iso8601"||(U+=`-${z1(X)}`);let G=yw(Y,T);return G&&(U+=G),U}function fE($,T,W="auto",w="auto",X="auto",U=void 0){let Y=V($,Z$);if(U){let{unit:F,increment:O,roundingMode:Q}=U;Y=ZO(Y,O,F,Q)}let G=V($,y$),H=C0(G,Y),z=jw(M1(G,Y),"iso8601",T,"never");return X!=="never"&&(z+=fM(H)),w!=="never"&&(z+=`[${w==="critical"?"!":""}${G}]`),z+=yw(V($,u),W),z}function bE($){return LM.test($)}function u2($){let T=QI.exec($);if(!T)throw new RangeError(`invalid time zone offset: ${$}; must match \xB1HH:MM[:SS.SSSSSSSSS]`);return(T[1]==="-"?-1:1)*(1e9*(60*(60*+T[2]+ +(T[3]||0))+ +(T[4]||0))+ +((T[5]||0)+"000000000").slice(0,9))}var Hw,FI=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function gG($){if(Hw===void 0){let U=Intl.supportedValuesOf?.("timeZone");if(U){Hw=new Map;for(let Y=0;Y<U.length;Y++){let G=U[Y];Hw.set(Bw(G),G)}}else Hw=null}let T=Bw($),W=Hw?.get(T);if(W)return{identifier:W,primaryIdentifier:W};try{W=MM($).resolvedOptions().timeZone}catch{return}if(T==="antarctica/south_pole"&&(W="Antarctica/McMurdo"),UI.has($))throw new RangeError(`${$} is a legacy time zone identifier from ICU. Use ${W} instead`);let w=[...T].map((U,Y)=>Y===0||FI[T[Y-1]]?U.toUpperCase():U).join("").split("/");if(w.length===1)return T==="gb-eire"?{identifier:"GB-Eire",primaryIdentifier:W}:{identifier:T.length<=3||/[-0-9]/.test(T)?T.toUpperCase():w[0],primaryIdentifier:W};if(w[0]==="Etc")return{identifier:`Etc/${["Zulu","Greenwich","Universal"].includes(w[1])?w[1]:w[1].toUpperCase()}`,primaryIdentifier:W};if(w[0]==="Us")return{identifier:`US/${w[1]}`,primaryIdentifier:W};let X=new Map([["Act","ACT"],["Lhi","LHI"],["Nsw","NSW"],["Dar_Es_Salaam","Dar_es_Salaam"],["Port_Of_Spain","Port_of_Spain"],["Port-Au-Prince","Port-au-Prince"],["Isle_Of_Man","Isle_of_Man"],["Comodrivadavia","ComodRivadavia"],["Knox_In","Knox_IN"],["Dumontdurville","DumontDUrville"],["Mcmurdo","McMurdo"],["Denoronha","DeNoronha"],["Easterisland","EasterIsland"],["Bajanorte","BajaNorte"],["Bajasur","BajaSur"]]);return w[1]=X.get(w[1])??w[1],w.length>2&&(w[2]=X.get(w[2])??w[2]),{identifier:w.join("/"),primaryIdentifier:W}}function ZW($,T){let{year:W,month:w,day:X,hour:U,minute:Y,second:G}=yM($,T),H=T%1000;return H<0&&(H+=1000),1e6*(JO({isoDate:{year:W,month:w,day:X},time:{hour:U,minute:Y,second:G,millisecond:H}})-T)}function HO($,T){return ZW($,D1(T,"floor"))}function LO($){let T=$<0?"-":"+",W=Math.abs($);return`${T}${sG(Math.floor(W/60),W%60,0,0,"minute")}`}function fM($){return LO(MT($,$I,"halfExpand")/60000000000)}function JO({isoDate:{year:$,month:T,day:W},time:{hour:w,minute:X,second:U,millisecond:Y}}){let G=$%400,H=($-G)/400,z=new Date;return z.setUTCHours(w,X,U,Y),z.setUTCFullYear(G,T-1,W),z.getTime()+XI*H}function n4($){let T=JO($),W=1000*$.time.microsecond+$.time.nanosecond;return P.add(B1(T),P.BigInt(W))}function bM($){let T=D1($,"trunc"),W=P.toNumber(P.remainder($,fw));W<0&&(W+=1e6,T-=1);let w=Math.floor(W/1000)%1000,X=W%1000,U=new Date(T);return{epochMilliseconds:T,isoDate:{year:U.getUTCFullYear(),month:U.getUTCMonth()+1,day:U.getUTCDate()},time:{hour:U.getUTCHours(),minute:U.getUTCMinutes(),second:U.getUTCSeconds(),millisecond:U.getUTCMilliseconds(),microsecond:w,nanosecond:X}}}function RO($,T){if($==="UTC")return null;let W=D1(T,"floor");if(W<Lw)return RO($,B1(Lw));let w=Date.now(),X=Math.max(W,w)+366*LT*3,U=W,Y=ZW($,U),G=U,H=Y;for(;Y===H&&U<X;){if(G=U+2*LT*7,G>EM)return null;H=ZW($,G),Y===H&&(U=G)}return Y===H?null:B1(rM((z)=>ZW($,z),U,G,Y,H))}function FO($,T){if($==="UTC")return null;let W=D1(T,"ceil"),w=Date.now(),X=w+366*LT*3;if(W>X){let z=FO($,B1(X));if(z===null||P.lessThan(z,B1(w)))return z}if($==="Africa/Casablanca"||$==="Africa/El_Aaiun"){let z=Date.UTC(2088,0,1);if(z<W)return FO($,B1(z))}let U=W-1;if(U<Lw)return null;let Y=ZW($,U),G=U,H=Y;for(;Y===H&&U>Lw;){if(G=U-2*LT*7,G<Lw)return null;H=ZW($,G),Y===H&&(U=G)}return Y===H?null:B1(rM((z)=>ZW($,z),G,U,H,Y))}function yM($,T){return function(W){let w=W.split(/[^\w]+/);if(w.length!==7)throw new RangeError(`expected 7 parts in "${W}`);let X=+w[0],U=+w[1],Y=+w[2],G=w[3];if(G[0]==="b"||G[0]==="B")Y=1-Y;else if(G[0]!=="a"&&G[0]!=="A")throw new RangeError(`Unknown era ${G} in "${W}`);let H=w[4]==="24"?0:+w[4],z=+w[5],F=+w[6];if(!(Number.isFinite(Y)&&Number.isFinite(X)&&Number.isFinite(U)&&Number.isFinite(H)&&Number.isFinite(z)&&Number.isFinite(F)))throw new RangeError(`Invalid number in "${W}`);return{year:Y,month:X,day:U,hour:H,minute:z,second:F}}(MM($).format(T))}function mG($){return $!==void 0&&!($%4!=0||$%100==0&&$%400!=0)}function VW($,T){return{standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]}[mG($)?"leapyear":"standard"][T-1]}function cG($){let T=[V($,Z6),V($,V6),V($,f6),V($,K6),V($,A6),V($,E6),V($,M6),V($,D6),V($,N6),V($,b6)];for(let W=0;W<T.length;W++){let w=T[W];if(w!==0)return w<0?-1:1}return 0}function eG($){let T=["years","months","weeks","days"];for(let W=0;W<T.length;W++){let w=$[T[W]];if(w!==0)return w<0?-1:1}return 0}function hM($){let T=eG($.date);return T!==0?T:$.time.sign()}function QW($,T){let W=$,w=T;if(!Number.isFinite(W)||!Number.isFinite(w))throw new RangeError("infinity is out of range");return w-=1,W+=Math.floor(w/12),w%=12,w<0&&(w+=12),w+=1,{year:W,month:w}}function g6($,T,W){let w=$,X=T,U=W;if(!Number.isFinite(U))throw new RangeError("infinity is out of range");({year:w,month:X}=QW(w,X));let Y=146097;if(Math.abs(U)>Y){let z=Math.trunc(U/Y);w+=400*z,U-=z*Y}let G=0,H=X>2?w:w-1;for(;G=mG(H)?366:365,U<-G;)w-=1,H-=1,U+=G;for(H+=1;G=mG(H)?366:365,U>G;)w+=1,H+=1,U-=G;for(;U<1;)({year:w,month:X}=QW(w,X-1)),U+=VW(w,X);for(;U>VW(w,X);)U-=VW(w,X),{year:w,month:X}=QW(w,X+1);return{year:w,month:X,day:U}}function Iw($,T,W,w,X,U,Y,G,H){let z=AT(w,X,U,Y,G,H);return x$(g6($,T,W+z.deltaDays),z)}function AT($,T,W,w,X,U){let Y,G=$,H=T,z=W,F=w,O=X,Q=U;({div:Y,mod:Q}=v2(Q,3)),O+=Y,Q<0&&(O-=1,Q+=1000),{div:Y,mod:O}=v2(O,3),F+=Y,O<0&&(F-=1,O+=1000),z+=Math.trunc(F/1000),F%=1000,F<0&&(z-=1,F+=1000),H+=Math.trunc(z/60),z%=60,z<0&&(H-=1,z+=60),G+=Math.trunc(H/60),H%=60,H<0&&(G-=1,H+=60);let Z=Math.trunc(G/24);return G%=24,G<0&&(Z-=1,G+=24),Z+=0,G+=0,H+=0,z+=0,F+=0,O+=0,Q+=0,{deltaDays:Z,hour:G,minute:H,second:z,millisecond:F,microsecond:O,nanosecond:Q}}function yE($,T){let W=$6($,0);if(eG(W)===0)return $.days;let w=V(T,V$),X=G1(V(T,u),w,W,"constrain"),U=MW(w.year,w.month-1,w.day),Y=MW(X.year,X.month-1,X.day)-U;return $.days+Y}function m6($){return new(i4("%Temporal.Duration%"))(-V($,Z6),-V($,V6),-V($,f6),-V($,K6),-V($,A6),-V($,E6),-V($,M6),-V($,D6),-V($,N6),-V($,b6))}function L6($,T,W){return Math.min(W,Math.max(T,$))}function gM($,T,W){let w=L6(T,1,12);return{year:$,month:w,day:L6(W,1,VW($,w))}}function c4($,T,W){if($<T||$>W)throw new RangeError(`value out of range: ${T} <= ${$} <= ${W}`)}function AW($,T,W){c4(T,1,12),c4(W,1,VW($,T))}function JW($){EW(x$($,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function $9($,T,W,w,X,U){c4($,0,23),c4(T,0,59),c4(W,0,59),c4(w,0,999),c4(X,0,999),c4(U,0,999)}function _O($,T,W,w,X,U,Y,G,H){AW($,T,W),$9(w,X,U,Y,G,H)}function EW($){let T=n4($);(P.lessThan(T,TI)||P.greaterThan(T,WI))&&X0(T)}function OO($){n4($)}function X0($){if(P.lessThan($,qw)||P.greaterThan($,j2))throw new RangeError("date/time value is outside of supported range")}function kO({year:$,month:T}){c4($,RE,_E),$===RE?c4(T,4,12):$===_E&&c4(T,1,9)}function T9($,T,W,w,X,U,Y,G,H,z){let F=0,O=[$,T,W,w,X,U,Y,G,H,z];for(let L=0;L<O.length;L++){let R=O[L];if(R===1/0||R===-1/0)throw new RangeError("infinite values not allowed as duration fields");if(R!==0){let _=R<0?-1:1;if(F!==0&&_!==F)throw new RangeError("mixed-sign values not allowed as duration fields");F=_}}if(Math.abs($)>=4294967296||Math.abs(T)>=4294967296||Math.abs(W)>=4294967296)throw new RangeError("years, months, and weeks must be < 2\xB3\xB2");let Q=v2(G,3),Z=v2(H,6),K=v2(z,9),E=v2(1e6*Q.mod+1000*Z.mod+K.mod,9).div,M=86400*w+3600*X+60*U+Y+Q.div+Z.div+K.div+E;if(!Number.isSafeInteger(M))throw new RangeError("total of duration time units cannot exceed 9007199254740991.999999999 s")}function k2($){return{date:{years:V($,Z6),months:V($,V6),weeks:V($,f6),days:V($,K6)},time:q$.fromComponents(V($,A6),V($,E6),V($,M6),V($,D6),V($,N6),V($,b6))}}function $0($){let T=q$.fromComponents(V($,A6),V($,E6),V($,M6),V($,D6),V($,N6),V($,b6)).add24HourDays(V($,K6));return{date:{years:V($,Z6),months:V($,V6),weeks:V($,f6),days:0},time:T}}function mM($){let T=$0($),W=Math.trunc(T.time.sec/86400);return T9(T.date.years,T.date.months,T.date.weeks,W,0,0,0,0,0,0),{...T.date,days:W}}function A1($,T){let W=$.time.sign(),w=$.time.abs().subsec,X=0,U=0,Y=$.time.abs().sec,G=0,H=0,z=0;switch(T){case"year":case"month":case"week":case"day":X=Math.trunc(w/1000),w%=1000,U=Math.trunc(X/1000),X%=1000,Y+=Math.trunc(U/1000),U%=1000,G=Math.trunc(Y/60),Y%=60,H=Math.trunc(G/60),G%=60,z=Math.trunc(H/24),H%=24;break;case"hour":X=Math.trunc(w/1000),w%=1000,U=Math.trunc(X/1000),X%=1000,Y+=Math.trunc(U/1000),U%=1000,G=Math.trunc(Y/60),Y%=60,H=Math.trunc(G/60),G%=60;break;case"minute":X=Math.trunc(w/1000),w%=1000,U=Math.trunc(X/1000),X%=1000,Y+=Math.trunc(U/1000),U%=1000,G=Math.trunc(Y/60),Y%=60;break;case"second":X=Math.trunc(w/1000),w%=1000,U=Math.trunc(X/1000),X%=1000,Y+=Math.trunc(U/1000),U%=1000;break;case"millisecond":X=Math.trunc(w/1000),w%=1000,U=rF(Y,3,Math.trunc(X/1000)),X%=1000,Y=0;break;case"microsecond":X=rF(Y,6,Math.trunc(w/1000)),w%=1000,Y=0;break;case"nanosecond":w=rF(Y,9,w),Y=0}return new(i4("%Temporal.Duration%"))($.date.years,$.date.months,$.date.weeks,$.date.days+W*z,W*H,W*G,W*Y,W*U,W*X,W*w)}function j0($,T){return eG($),T.sign(),{date:$,time:T}}function MW($,T,W){return JO({isoDate:{year:$,month:T+1,day:W},time:{hour:0,minute:0,second:0,millisecond:0}})/LT}function C2({year:$,month:T,day:W}){if(Math.abs(MW($,T-1,W))>1e8)throw new RangeError("date/time value is outside the supported range")}function vO($,T){let W=T.hour-$.hour,w=T.minute-$.minute,X=T.second-$.second,U=T.millisecond-$.millisecond,Y=T.microsecond-$.microsecond,G=T.nanosecond-$.nanosecond;return q$.fromComponents(W,w,X,U,Y,G)}function qO($,T,W,w,X){let U=q$.fromEpochNsDiff(T,$);return U=uG(U,W,w,X),j0({years:0,months:0,weeks:0,days:0},U)}function cM($,T,W,w){OO($),OO(T);let X=vO($.time,T.time),U=X.sign(),Y=w0($.isoDate,T.isoDate),G=T.isoDate;Y===U&&(G=g6(G.year,G.month,G.day+U),X=X.add24HourDays(-U));let H=S0("day",w),z=pw(W,$.isoDate,G,H);return w!==H&&(X=X.add24HourDays(z.days),z.days=0),j0(z,X)}function uM($,T,W,w,X){let U=P.subtract(T,$);if(P.equal(U,U1))return{date:{years:0,months:0,weeks:0,days:0},time:q$.ZERO};let Y=P.lessThan(U,U1)?-1:1,G=M1(W,$),H=M1(W,T),z,F=0,O=Y===1?2:1,Q=vO(G.time,H.time);for(Q.sign()===-Y&&F++;F<=O;F++){z=x$(g6(H.isoDate.year,H.isoDate.month,H.isoDate.day-F*Y),G.time);let K=T6(W,z,"compatible");if(Q=q$.fromEpochNsDiff(T,K),Q.sign()!==-Y)break}let Z=S0("day",X);return j0(pw(w,G.isoDate,z.isoDate,Z),Q)}function pM($,T,W,w,X,U,Y,G,H){let z,F,O,Q,Z=T;switch(G){case"year":{let t=MT(Z.date.years,Y,"trunc");z=t,F=t+Y*$,O={years:z,months:0,weeks:0,days:0},Q={...O,years:F};break}case"month":{let t=MT(Z.date.months,Y,"trunc");z=t,F=t+Y*$,O=$6(Z.date,0,0,z),Q=$6(Z.date,0,0,F);break}case"week":{let t=$6(Z.date,0,0),z$=G1(U,w.isoDate,t,"constrain"),B$=pw(U,z$,g6(z$.year,z$.month,z$.day+Z.date.days),"week"),e$=MT(Z.date.weeks+B$.weeks,Y,"trunc");z=e$,F=e$+Y*$,O=$6(Z.date,0,z),Q=$6(Z.date,0,F);break}case"day":{let t=MT(Z.date.days,Y,"trunc");z=t,F=t+Y*$,O=$6(Z.date,z),Q=$6(Z.date,F);break}}let K=G1(U,w.isoDate,O,"constrain"),E=G1(U,w.isoDate,Q,"constrain"),M,L,R=x$(K,w.time),_=x$(E,w.time);X?(M=T6(X,R,"compatible"),L=T6(X,_,"compatible")):(M=n4(R),L=n4(_));let S=q$.fromEpochNsDiff(W,M),x=q$.fromEpochNsDiff(L,M),b=lG(H,$<0?"negative":"positive"),g=S.add(S).abs().subtract(x.abs()).sign(),T$=Math.abs(z)/Y%2==0,N$=S.isZero()?Math.abs(z):S.cmp(x)?rG(Math.abs(z),Math.abs(F),g,T$,b):Math.abs(F),j=new q$(P.add(P.multiply(x.totalNs,P.BigInt(z)),P.multiply(S.totalNs,P.BigInt(Y*$)))).fdiv(x.totalNs),U$=N$===Math.abs(F);return Z={date:U$?Q:O,time:q$.ZERO},{nudgeResult:{duration:Z,nudgedEpochNs:U$?L:M,didExpandCalendarUnit:U$},total:j}}function W9($,T,W,w,X,U,Y,G,H){let z=$,F=s1(G)||w&&G==="day",O=hM(z)<0?-1:1,Q;return F?{nudgeResult:Q}=pM(O,z,T,W,w,X,Y,G,H):Q=w?function(Z,K,E,M,L,R,_,S){let x=K,b=G1(L,E.isoDate,x.date,"constrain"),g=x$(b,E.time),T$=x$(g6(b.year,b.month,b.day+Z),E.time),N$=T6(M,g,"compatible"),j=T6(M,T$,"compatible"),U$=q$.fromEpochNsDiff(j,N$);if(U$.sign()!==Z)throw new RangeError("time zone returned inconsistent Instants");let t=P.BigInt(B2[_]*R),z$=x.time.round(t,S),B$=z$.subtract(U$),e$=B$.sign()!==-Z,h4,n6;return e$?(h4=Z,z$=B$.round(t,S),n6=z$.addToEpochNs(j)):(h4=0,n6=z$.addToEpochNs(N$)),{duration:j0($6(x.date,x.date.days+h4),z$),nudgedEpochNs:n6,didExpandCalendarUnit:e$}}(O,z,W,w,X,Y,G,H):function(Z,K,E,M,L,R){let _=Z,S=_.time.add24HourDays(_.date.days),x=S.round(P.BigInt(M*B2[L]),R),b=x.subtract(S),{quotient:g}=S.divmod(fG),{quotient:T$}=x.divmod(fG),N$=Math.sign(T$-g)===S.sign(),j=b.addToEpochNs(K),U$=0,t=x;return q0(E)==="date"&&(U$=T$,t=x.add(q$.fromComponents(24*-T$,0,0,0,0,0))),{duration:{date:$6(_.date,U$),time:t},nudgedEpochNs:j,didExpandCalendarUnit:N$}}(z,T,U,Y,G,H),z=Q.duration,Q.didExpandCalendarUnit&&G!=="week"&&(z=function(Z,K,E,M,L,R,_,S){let x=K;if(S===_)return x;let b=Jw.indexOf(_);for(let g=Jw.indexOf(S)-1;g>=b;g--){let T$=Jw[g];if(T$==="week"&&_!=="week")continue;let N$;switch(T$){case"year":N$={years:x.date.years+Z,months:0,weeks:0,days:0};break;case"month":{let t=x.date.months+Z;N$=$6(x.date,0,0,t);break}case"week":{let t=x.date.weeks+Z;N$=$6(x.date,0,t);break}}let j=x$(G1(R,M.isoDate,N$,"constrain"),M.time),U$;if(U$=L?T6(L,j,"compatible"):n4(j),BG(E,U$)===-Z)break;x={date:N$,time:q$.ZERO}}return x}(O,z,Q.nudgedEpochNs,W,w,X,U,S0(G,"day"))),z}function hE($,T,W,w,X,U){return s1(U)||w&&U==="day"?pM(hM($)<0?-1:1,$,T,W,w,X,1,U,"trunc").total:kw($.time.add24HourDays($.date.days),U)}function dM($,T,W,w,X,U,Y){if(f2($,T)==0)return{date:{years:0,months:0,weeks:0,days:0},time:q$.ZERO};EW($),EW(T);let G=cM($,T,W,w);return U==="nanosecond"&&X===1?G:W9(G,n4(T),$,null,W,w,X,U,Y)}function oM($,T,W,w,X,U,Y,G){if(q0(X)==="time")return qO($,T,U,Y,G);let H=uM($,T,W,w,X);return Y==="nanosecond"&&U===1?H:W9(H,T,M1(W,$),W,w,X,U,Y,G)}function p2($,T,W,w,X,U){let Y=I2.reduce((Z,K)=>{let E=K[0],M=K[1],L=K[2];return W!=="datetime"&&L!==W||w.includes(M)||Z.push(M,E),Z},[]),G=h6(T,"largestUnit",W,"auto");if(w.includes(G))throw new RangeError(`largestUnit must be one of ${Y.join(", ")}, not ${G}`);let H=m2(T),z=x1(T,"trunc");$==="since"&&(z=function(Z){switch(Z){case"ceil":return"floor";case"floor":return"ceil";case"halfCeil":return"halfFloor";case"halfFloor":return"halfCeil";default:return Z}}(z));let F=h6(T,"smallestUnit",W,X);if(w.includes(F))throw new RangeError(`smallestUnit must be one of ${Y.join(", ")}, not ${F}`);let O=S0(U,F);if(G==="auto"&&(G=O),S0(G,F)!==G)throw new RangeError(`largestUnit ${G} cannot be smaller than smallestUnit ${F}`);let Q={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[F];return Q!==void 0&&c2(H,Q,!1),{largestUnit:G,roundingIncrement:H,roundingMode:z,smallestUnit:F}}function gE($,T,W,w){let X=Aw(W),U=p2($,X$(w),"time",[],"nanosecond","second"),Y=A1(qO(V(T,Z$),V(X,Z$),U.roundingIncrement,U.smallestUnit,U.roundingMode),U.largestUnit);return $==="since"&&(Y=m6(Y)),Y}function mE($,T,W,w){let X=Vw(W),U=V(T,u),Y=V(X,u);if(!W0(U,Y))throw new RangeError(`cannot compute difference between dates of ${U} and ${Y} calendars`);let G=p2($,X$(w),"date",[],"day","day"),H=i4("%Temporal.Duration%"),z=V(T,V$),F=V(X,V$);if(w0(z,F)===0)return new H;let O={date:pw(U,z,F,G.largestUnit),time:q$.ZERO};if(G.smallestUnit!=="day"||G.roundingIncrement!==1){let Z=x$(z,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});O=W9(O,n4(x$(F,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),Z,null,U,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode)}let Q=A1(O,"day");return $==="since"&&(Q=m6(Q)),Q}function cE($,T,W,w){let X=Kw(W),U=V(T,u),Y=V(X,u);if(!W0(U,Y))throw new RangeError(`cannot compute difference between dates of ${U} and ${Y} calendars`);let G=p2($,X$(w),"datetime",[],"nanosecond","day"),H=i4("%Temporal.Duration%"),z=V(T,X4),F=V(X,X4);if(f2(z,F)===0)return new H;let O=A1(dM(z,F,U,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode),G.largestUnit);return $==="since"&&(O=m6(O)),O}function uE($,T,W,w){let X=ET(W),U=p2($,X$(w),"time",[],"nanosecond","hour"),Y=vO(V(T,O4),V(X,O4));Y=uG(Y,U.roundingIncrement,U.smallestUnit,U.roundingMode);let G=A1(j0({years:0,months:0,weeks:0,days:0},Y),U.largestUnit);return $==="since"&&(G=m6(G)),G}function pE($,T,W,w){let X=Ew(W),U=V(T,u),Y=V(X,u);if(!W0(U,Y))throw new RangeError(`cannot compute difference between months of ${U} and ${Y} calendars`);let G=p2($,X$(w),"date",["week","day"],"month","year"),H=i4("%Temporal.Duration%");if(w0(V(T,V$),V(X,V$))==0)return new H;let z=_6(U,V(T,V$),"year-month");z.day=1;let F=JT(U,z,"constrain"),O=_6(U,V(X,V$),"year-month");O.day=1;let Q=JT(U,O,"constrain"),Z={date:$6(pw(U,F,Q,G.largestUnit),0,0),time:q$.ZERO};if(G.smallestUnit!=="month"||G.roundingIncrement!==1){let E=x$(F,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});Z=W9(Z,n4(x$(Q,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0})),E,null,U,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode)}let K=A1(Z,"day");return $==="since"&&(K=m6(K)),K}function dE($,T,W,w){let X=Mw(W),U=V(T,u),Y=V(X,u);if(!W0(U,Y))throw new RangeError(`cannot compute difference between dates of ${U} and ${Y} calendars`);let G=p2($,X$(w),"datetime",[],"nanosecond","hour"),H=V(T,Z$),z=V(X,Z$),F=i4("%Temporal.Duration%"),O;if(q0(G.largestUnit)!=="date")O=A1(qO(H,z,G.roundingIncrement,G.smallestUnit,G.roundingMode),G.largestUnit);else{let Q=V(T,y$);if(!IM(Q,V(X,y$)))throw new RangeError("When calculating difference between time zones, largestUnit must be 'hours' or smaller because day lengths can vary between time zones due to DST or time zone offset changes.");if(P.equal(H,z))return new F;O=A1(oM(H,z,Q,U,G.largestUnit,G.roundingIncrement,G.smallestUnit,G.roundingMode),"hour")}return $==="since"&&(O=m6(O)),O}function x2({hour:$,minute:T,second:W,millisecond:w,microsecond:X,nanosecond:U},Y){let G=W,H=U;return G+=Y.sec,H+=Y.subsec,AT($,T,G,w,X,H)}function QO($,T){let W=T.addToEpochNs($);return X0(W),W}function Dw($,T,W,w,X="constrain"){if(eG(w.date)===0)return QO($,w.time);let U=M1(T,$);return QO(T6(T,x$(G1(W,U.isoDate,w.date,X),U.time),"compatible"),w.time)}function oE($,T,W){let w=E1(W);$==="subtract"&&(w=m6(w));let X=S0(v0(T),v0(w));if(s1(X))throw new RangeError("For years, months, or weeks arithmetic, use date arithmetic relative to a starting point");let U=$0(T),Y=$0(w);return A1(j0({years:0,months:0,weeks:0,days:0},U.time.add(Y.time)),X)}function lE($,T,W){let w=E1(W);$==="subtract"&&(w=m6(w));let X=v0(w);if(q0(X)==="date")throw new RangeError(`Duration field ${X} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let U=$0(w);return I1(QO(V(T,Z$),U.time))}function rE($,T,W,w){let X=V(T,u),U=E1(W);$==="subtract"&&(U=m6(U));let Y=mM(U),G=j$(X$(w));return J6(G1(X,V(T,V$),Y,G),X)}function nE($,T,W,w){let X=E1(W);$==="subtract"&&(X=m6(X));let U=j$(X$(w)),Y=V(T,u),G=$0(X),H=V(T,X4),z=x2(H.time,G.time),F=$6(G.date,z.deltaDays);return T9(F.years,F.months,F.weeks,F.days,0,0,0,0,0,0),K1(x$(G1(Y,H.isoDate,F,U),z),Y)}function iE($,T,W){let w=E1(W);$==="subtract"&&(w=m6(w));let X=$0(w),{hour:U,minute:Y,second:G,millisecond:H,microsecond:z,nanosecond:F}=x2(V(T,O4),X.time);return P0(aG(U,Y,G,H,z,F,"reject"))}function tE($,T,W,w){let X=E1(W);$==="subtract"&&(X=m6(X));let U=j$(X$(w)),Y=cG(X),G=V(T,u),H=_6(G,V(T,V$),"year-month");H.day=1;let z=JT(G,H,"constrain");if(Y<0){let O=G1(G,z,{months:1},"constrain");z=g6(O.year,O.month,O.day-1)}let F=mM(X);return JW(z),P2(Cw(G,_6(G,G1(G,z,F,U),"year-month"),U),G)}function aE($,T,W,w){let X=E1(W);$==="subtract"&&(X=m6(X));let U=j$(X$(w)),Y=V(T,y$),G=V(T,u),H=k2(X);return e4(Dw(V(T,Z$),Y,G,H,U),Y,G)}function MT($,T,W){let w=Math.trunc($/T),X=$%T,U=$<0?"negative":"positive",Y=Math.abs(w),G=Y+1,H=y6(Math.abs(2*X)-T),z=Y%2==0,F=lG(W,U),O=X===0?Y:rG(Y,G,H,z,F);return T*(U==="positive"?O:-O)}function ZO($,T,W,w){let X=B2[W]*T;return function(U,Y,G){let H=k0(U),z=k0(Y),F=P.divide(H,z),O=P.remainder(H,z),Q=lG(G,"positive"),Z,K;P.lessThan(H,U1)?(Z=P.subtract(F,vw),K=F):(Z=F,K=P.add(F,vw));let E=BG(OW(P.multiply(O,MO)),z)*(P.lessThan(H,U1)?-1:1)+0,M=P.equal(O,U1)?F:rG(Z,K,E,TM(Z),Q);return P.multiply(M,z)}($,P.BigInt(X),w)}function VO($,T,W,w){OO($);let{year:X,month:U,day:Y}=$.isoDate,G=KO($.time,T,W,w);return x$(g6(X,U,Y+G.deltaDays),G)}function KO({hour:$,minute:T,second:W,millisecond:w,microsecond:X,nanosecond:U},Y,G,H){let z;switch(G){case"day":case"hour":z=1000*(1000*(1000*(60*(60*$+T)+W)+w)+X)+U;break;case"minute":z=1000*(1000*(1000*(60*T+W)+w)+X)+U;break;case"second":z=1000*(1000*(1000*W+w)+X)+U;break;case"millisecond":z=1000*(1000*w+X)+U;break;case"microsecond":z=1000*X+U;break;case"nanosecond":z=U}let F=B2[G],O=MT(z,F*Y,H)/F;switch(G){case"day":return{deltaDays:O,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0};case"hour":return AT(O,0,0,0,0,0);case"minute":return AT($,O,0,0,0,0);case"second":return AT($,T,O,0,0,0);case"millisecond":return AT($,T,W,O,0,0);case"microsecond":return AT($,T,W,w,O,0);case"nanosecond":return AT($,T,W,w,X,O);default:throw new Error(`Invalid unit ${G}`)}}function uG($,T,W,w){let X=B2[W];return $.round(P.BigInt(X*T),w)}function kw($,T){let W=B2[T];return $.fdiv(P.BigInt(W))}function w0($,T){return $.year!==T.year?y6($.year-T.year):$.month!==T.month?y6($.month-T.month):$.day!==T.day?y6($.day-T.day):0}function AO($,T){return $.hour!==T.hour?y6($.hour-T.hour):$.minute!==T.minute?y6($.minute-T.minute):$.second!==T.second?y6($.second-T.second):$.millisecond!==T.millisecond?y6($.millisecond-T.millisecond):$.microsecond!==T.microsecond?y6($.microsecond-T.microsecond):$.nanosecond!==T.nanosecond?y6($.nanosecond-T.nanosecond):0}function f2($,T){let W=w0($.isoDate,T.isoDate);return W!==0?W:AO($.time,T.time)}function lM($){let T=pG($);return globalThis.BigInt!==void 0?globalThis.BigInt(T.toString(10)):T}function D1($,T){let W=k0($),{quotient:w,remainder:X}=Qw(W,fw),U=P.toNumber(w);return T==="floor"&&P.toNumber(X)<0&&(U-=1),T==="ceil"&&P.toNumber(X)>0&&(U+=1),U}function B1($){if(!Number.isInteger($))throw new RangeError("epoch milliseconds must be an integer");return P.multiply(P.BigInt($),fw)}function pG($){let T=$;if(typeof $=="object"){let W=$[Symbol.toPrimitive];W&&typeof W=="function"&&(T=W.call($,"number"))}if(typeof T=="number")throw new TypeError("cannot convert number to bigint");return typeof T=="bigint"?P.BigInt(T.toString(10)):P.BigInt(T)}var EO=(()=>{let $=P.BigInt(Date.now()%1e6);return()=>{let T=Date.now(),W=P.BigInt(T),w=P.add(B1(T),$);return $=P.remainder(W,fw),P.greaterThan(w,j2)?j2:P.lessThan(w,qw)?qw:w}})();function Fw(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function y6($){return $<0?-1:$>0?1:$}function X$($){if($===void 0)return Object.create(null);if(Q4($)&&$!==null)return $;throw new TypeError("Options parameter must be an object, not "+($===null?"null":typeof $))}function DW($,T){let W=Object.create(null);return W[$]=T,W}function I0($,T,W,w){let X=$[T];if(X!==void 0){if(X=iG(X),!W.includes(X))throw new RangeError(`${T} must be one of ${W.join(", ")}, not ${X}`);return X}if(w===x0)throw new RangeError(`${T} option is required`);return w}function v6($){let T=Bw($);if(!wI.includes(Bw(T)))throw new RangeError(`invalid calendar identifier ${T}`);switch(T){case"ethiopic-amete-alem":return"ethioaa";case"islamicc":return"islamic-civil"}return T}function Bw($){let T="";for(let W=0;W<$.length;W++){let w=$.charCodeAt(W);T+=w>=65&&w<=90?String.fromCharCode(w+32):String.fromCharCode(w)}return T}function _T($){throw new TypeError(`Do not use built-in arithmetic operators with Temporal objects. When comparing, use ${$==="PlainMonthDay"?"Temporal.PlainDate.compare(obj1.toPlainDate(year), obj2.toPlainDate(year))":`Temporal.${$}.compare(obj1, obj2)`}, not obj1 > obj2. When coercing to strings, use \`\${obj}\` or String(obj), not '' + obj. When coercing to numbers, use properties or methods of the object, not \`+obj\`. When concatenating with strings, use \`\${str}\${obj}\` or str.concat(obj), not str + obj. In React, coerce to a string before rendering a Temporal object.`)}var OI=new RegExp(`^${KM.source}$`),QI=new RegExp(`^${/([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\d{1,9}))?)?)?/.source}$`);function rM($,T,W,w=$(T),X=$(W)){let U=T,Y=W,G=w,H=X;for(;Y-U>1;){let z=Math.trunc((U+Y)/2),F=$(z);F===G?(U=z,G=F):F===H&&(Y=z,H=F)}return Y}function nM($){return[...$]}function iM($,T){if($!=="gregory"&&$!=="iso8601")return;let W=rw[$],w=T.year,{dayOfWeek:X,dayOfYear:U,daysInYear:Y}=W.isoToDate(T,{dayOfWeek:!0,dayOfYear:!0,daysInYear:!0}),G=W.getFirstDayOfWeek(),H=W.getMinimalDaysInFirstWeek(),z=(X+7-G)%7,F=(X-U+7001-G)%7,O=Math.floor((U-1+F)/7);if(7-F>=H&&++O,O==0)O=function(Q,Z,K,E){let M=(E-Q-K+1)%7;M<0&&(M+=7);let L=Math.floor((K+M-1)/7);return 7-M>=Z&&++L,L}(G,H,U+W.isoToDate(W.dateAdd(T,{years:-1},"constrain"),{daysInYear:!0}).daysInYear,X),w--;else if(U>=Y-5){let Q=(z+Y-U)%7;Q<0&&(Q+=7),6-Q>=H&&U+7-z>Y&&(O=1,w++)}return{week:O,year:w}}function sE($,T,W,w,X){if(T!==X.year){if($*(T-X.year)>0)return!0}else if(W!==X.month){if($*(W-X.month)>0)return!0}else if(w!==X.day&&$*(w-X.day)>0)return!0;return!1}var rw={};function NW($){if(!$.startsWith("M"))throw new RangeError(`Invalid month code: ${$}. Month codes must start with M.`);let T=+$.slice(1);if(Number.isNaN(T))throw new RangeError(`Invalid month code: ${$}`);return T}function T0($,T=!1){return`M${`${$}`.padStart(2,"0")}${T?"L":""}`}function PO($,T=void 0,W=12){let{month:w,monthCode:X}=$;if(X===void 0){if(w===void 0)throw new TypeError("Either month or monthCode are required");T==="reject"&&c4(w,1,W),T==="constrain"&&(w=L6(w,1,W)),X=T0(w)}else{let U=NW(X);if(X!==T0(U))throw new RangeError(`Invalid month code: ${X}`);if(w!==void 0&&w!==U)throw new RangeError(`monthCode ${X} and month ${w} must match if both are present`);if(w=U,w<1||w>W)throw new RangeError(`Invalid monthCode: ${X}`)}return{...$,month:w,monthCode:X}}rw.iso8601={resolveFields($,T){if((T==="date"||T==="year-month")&&$.year===void 0)throw new TypeError("year is required");if((T==="date"||T==="month-day")&&$.day===void 0)throw new TypeError("day is required");Object.assign($,PO($))},dateToISO:($,T)=>Rw($.year,$.month,$.day,T),monthDayToISOReferenceDate($,T){let{month:W,day:w}=Rw($.year??1972,$.month,$.day,T);return{month:W,day:w,year:1972}},extraFields:()=>[],fieldKeysToIgnore($){let T=new Set;for(let W=0;W<$.length;W++){let w=$[W];T.add(w),w==="month"?T.add("monthCode"):w==="monthCode"&&T.add("month")}return nM(T)},dateAdd($,{years:T=0,months:W=0,weeks:w=0,days:X=0},U){let{year:Y,month:G,day:H}=$;return Y+=T,G+=W,{year:Y,month:G}=QW(Y,G),{year:Y,month:G,day:H}=Rw(Y,G,H,U),H+=X+7*w,g6(Y,G,H)},dateUntil($,T,W){let w=-w0($,T);if(w===0)return{years:0,months:0,weeks:0,days:0};let X,U=0,Y=0;if(W==="year"||W==="month"){let F=T.year-$.year;for(F!==0&&(F-=w);!sE(w,$.year+F,$.month,$.day,T);)U=F,F+=w;let O=w;for(X=QW($.year+U,$.month+O);!sE(w,X.year,X.month,$.day,T);)Y=O,O+=w,X=QW(X.year,X.month+w);W==="month"&&(Y+=12*U,U=0)}X=QW($.year+U,$.month+Y);let G=gM(X.year,X.month,$.day),H=0,z=MW(T.year,T.month-1,T.day)-MW(G.year,G.month-1,G.day);return W==="week"&&(H=Math.trunc(z/7),z%=7),{years:U,months:Y,weeks:H,days:z}},isoToDate({year:$,month:T,day:W},w){let X={era:void 0,eraYear:void 0,year:$,month:T,day:W,daysInWeek:7,monthsInYear:12};if(w.monthCode&&(X.monthCode=T0(T)),w.dayOfWeek){let U=T+(T<3?10:-2),Y=$-(T<3?1:0),G=Math.floor(Y/100),H=Y-100*G,z=(W+Math.floor(2.6*U-0.2)+(H+Math.floor(H/4))+(Math.floor(G/4)-2*G))%7;X.dayOfWeek=z+(z<=0?7:0)}if(w.dayOfYear){let U=W;for(let Y=T-1;Y>0;Y--)U+=VW($,Y);X.dayOfYear=U}return w.weekOfYear&&(X.weekOfYear=iM("iso8601",{year:$,month:T,day:W})),w.daysInMonth&&(X.daysInMonth=VW($,T)),(w.daysInYear||w.inLeapYear)&&(X.inLeapYear=mG($),X.daysInYear=X.inLeapYear?366:365),X},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};class m4{constructor($){if(this.map=new Map,this.calls=0,this.hits=0,this.misses=0,$!==void 0){let T=0;for(let W of $.map.entries()){if(++T>m4.MAX_CACHE_ENTRIES)break;this.map.set(...W)}}}get($){let T=this.map.get($);return T&&(this.hits++,this.report()),this.calls++,T}set($,T){this.map.set($,T),this.misses++,this.report()}report(){}setObject($){if(m4.objectMap.get($))throw new RangeError("object already cached");m4.objectMap.set($,this),this.report()}static getCacheForObject($){let T=m4.objectMap.get($);return T||(T=new m4,m4.objectMap.set($,T)),T}}function tM({isoYear:$,isoMonth:T,isoDay:W}){return`${lw($)}-${z1(T)}-${z1(W)}T00:00Z`}function tF($,T){return{years:$.year-T.year,months:$.month-T.month,days:$.day-T.day}}m4.objectMap=new WeakMap,m4.MAX_CACHE_ENTRIES=1000;class kT{constructor(){this.eras=[],this.hasEra=!1,this.erasBeginMidYear=!1}getFormatter(){return this.formatter===void 0&&(this.formatter=new Intl.DateTimeFormat(`en-US-u-ca-${this.id}`,{day:"numeric",month:"numeric",year:"numeric",era:"short",timeZone:"UTC"})),this.formatter}getCalendarParts($){let T=this.getFormatter(),W=new Date($);if($==="-271821-04-19T00:00Z"){let w=T.resolvedOptions();T=new Intl.DateTimeFormat(w.locale,{...w,timeZone:"Etc/GMT+1"}),W=new Date("-271821-04-20T00:00Z")}try{return T.formatToParts(W)}catch(w){throw new RangeError(`Invalid ISO date: ${$}`)}}isoToCalendarDate($,T){let{year:W,month:w,day:X}=$,U=JSON.stringify({func:"isoToCalendarDate",isoYear:W,isoMonth:w,isoDay:X,id:this.id}),Y=T.get(U);if(Y)return Y;let G=tM({isoYear:W,isoMonth:w,isoDay:X}),H=this.getCalendarParts(G),z={};for(let O=0;O<H.length;O++){let{type:Q,value:Z}=H[O];if(Q!=="year"&&Q!=="relatedYear"||(this.hasEra?z.eraYear=+Z:z.year=+Z),Q==="month"){let K=/^([0-9]*)(.*?)$/.exec(Z);if(!K||K.length!=3||!K[1]&&!K[2])throw new RangeError(`Unexpected month: ${Z}`);if(z.month=K[1]?+K[1]:1,z.month<1)throw new RangeError(`Invalid month ${Z} from ${G}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10527)`);if(z.month>13)throw new RangeError(`Invalid month ${Z} from ${G}[u-ca-${this.id}] (probably due to https://bugs.chromium.org/p/v8/issues/detail?id=10529)`);K[2]&&(z.monthExtra=K[2])}Q==="day"&&(z.day=+Z),this.hasEra&&Q==="era"&&Z!=null&&Z!==""&&(z.era=Z.split(" (")[0].normalize("NFD").replace(/[^-0-9 \p{L}]/gu,"").replace(/ /g,"-").toLowerCase())}if(this.hasEra&&z.eraYear===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);if(this.hasEra){let O=this.eras.find((Q)=>z.era===Q.genericName);O&&(z.era=O.code)}if(this.reviseIntlEra){let{era:O,eraYear:Q}=this.reviseIntlEra(z,$);z.era=O,z.eraYear=Q}this.checkIcuBugs&&this.checkIcuBugs($);let F=this.adjustCalendarDate(z,T,"constrain",!0);if(F.year===void 0)throw new RangeError(`Missing year converting ${JSON.stringify($)}`);if(F.month===void 0)throw new RangeError(`Missing month converting ${JSON.stringify($)}`);if(F.day===void 0)throw new RangeError(`Missing day converting ${JSON.stringify($)}`);return T.set(U,F),["constrain","reject"].forEach((O)=>{let Q=JSON.stringify({func:"calendarToIsoDate",year:F.year,month:F.month,day:F.day,overflow:O,id:this.id});T.set(Q,$)}),F}validateCalendarDate($){let{month:T,year:W,day:w,eraYear:X,monthCode:U,monthExtra:Y}=$;if(Y!==void 0)throw new RangeError("Unexpected `monthExtra` value");if(W===void 0&&X===void 0)throw new TypeError("year or eraYear is required");if(T===void 0&&U===void 0)throw new TypeError("month or monthCode is required");if(w===void 0)throw new RangeError("Missing day");if(U!==void 0){if(typeof U!="string")throw new RangeError("monthCode must be a string, not "+typeof U);if(!/^M([01]?\d)(L?)$/.test(U))throw new RangeError(`Invalid monthCode: ${U}`)}if(this.hasEra&&$.era===void 0!=($.eraYear===void 0))throw new TypeError("properties era and eraYear must be provided together")}adjustCalendarDate($,T=void 0,W="constrain",w=!1){if(this.calendarType==="lunisolar")throw new RangeError("Override required for lunisolar calendars");let X=$;this.validateCalendarDate(X);let U=this.monthsInYear(X,T),{month:Y,monthCode:G}=X;return{month:Y,monthCode:G}=PO(X,W,U),{...X,month:Y,monthCode:G}}regulateMonthDayNaive($,T,W){let w=this.monthsInYear($,W),{month:X,day:U}=$;return T==="reject"?(c4(X,1,w),c4(U,1,this.maximumMonthLength($))):(X=L6(X,1,w),U=L6(U,1,this.maximumMonthLength({...$,month:X}))),{...$,month:X,day:U}}calendarToIsoDate($,T="constrain",W){let w=$,X=this.adjustCalendarDate($,W,T,!1);X=this.regulateMonthDayNaive(X,T,W);let{year:U,month:Y,day:G}=X,H=JSON.stringify({func:"calendarToIsoDate",year:U,month:Y,day:G,overflow:T,id:this.id}),z,F=W.get(H);if(F)return F;if(w.year!==void 0&&w.month!==void 0&&w.day!==void 0&&(w.year!==X.year||w.month!==X.month||w.day!==X.day)&&(z=JSON.stringify({func:"calendarToIsoDate",year:w.year,month:w.month,day:w.day,overflow:T,id:this.id}),F=W.get(z),F))return F;let O=this.estimateIsoDate({year:U,month:Y,day:G}),Q=(L)=>{let R=this.addDaysIso(O,L);if(X.day>this.minimumMonthLength(X)){let _=this.isoToCalendarDate(R,W);for(;_.month!==Y||_.year!==U;){if(T==="reject")throw new RangeError(`day ${G} does not exist in month ${Y} of year ${U}`);R=this.addDaysIso(R,-1),_=this.isoToCalendarDate(R,W)}}return R},Z=0,K=this.isoToCalendarDate(O,W),E=tF(X,K);if(E.years!==0||E.months!==0||E.days!==0){let L=365*E.years+30*E.months+E.days;O=this.addDaysIso(O,L),K=this.isoToCalendarDate(O,W),E=tF(X,K),E.years===0&&E.months===0?O=Q(E.days):Z=this.compareCalendarDates(X,K)}let M=8;for(;Z;){O=this.addDaysIso(O,Z*M);let L=K;K=this.isoToCalendarDate(O,W);let R=Z;if(Z=this.compareCalendarDates(X,K),Z){if(E=tF(X,K),E.years===0&&E.months===0)O=Q(E.days),Z=0;else if(R&&Z!==R)if(M>1)M/=2;else{if(T==="reject")throw new RangeError(`Can't find ISO date from calendar date: ${JSON.stringify({...w})}`);this.compareCalendarDates(K,L)>0&&(O=this.addDaysIso(O,-1)),Z=0}}}if(W.set(H,O),z&&W.set(z,O),X.year===void 0||X.month===void 0||X.day===void 0||X.monthCode===void 0||this.hasEra&&(X.era===void 0||X.eraYear===void 0))throw new RangeError("Unexpected missing property");return O}compareCalendarDates($,T){return $.year!==T.year?y6($.year-T.year):$.month!==T.month?y6($.month-T.month):$.day!==T.day?y6($.day-T.day):0}regulateDate($,T="constrain",W){let w=this.calendarToIsoDate($,T,W);return this.isoToCalendarDate(w,W)}addDaysIso($,T){return g6($.year,$.month,$.day+T)}addDaysCalendar($,T,W){let w=this.calendarToIsoDate($,"constrain",W),X=this.addDaysIso(w,T);return this.isoToCalendarDate(X,W)}addMonthsCalendar($,T,W,w){let X=$,{day:U}=X;for(let Y=0,G=Math.abs(T);Y<G;Y++){let{month:H}=X,z=X,F=T<0?-Math.max(U,this.daysInPreviousMonth(X,w)):this.daysInMonth(X,w),O=this.calendarToIsoDate(X,"constrain",w),Q=this.addDaysIso(O,F);if(X=this.isoToCalendarDate(Q,w),T>0){let Z=this.monthsInYear(z,w);for(;X.month-1!=H%Z;)Q=this.addDaysIso(Q,-1),X=this.isoToCalendarDate(Q,w)}X.day!==U&&(X=this.regulateDate({...X,day:U},"constrain",w))}if(W==="reject"&&X.day!==U)throw new RangeError(`Day ${U} does not exist in resulting calendar month`);return X}addCalendar($,{years:T=0,months:W=0,weeks:w=0,days:X=0},U,Y){let{year:G,day:H,monthCode:z}=$,F=this.adjustCalendarDate({year:G+T,monthCode:z,day:H},Y),O=this.addMonthsCalendar(F,W,U,Y),Q=X+7*w;return this.addDaysCalendar(O,Q,Y)}untilCalendar($,T,W,w){let X=0,U=0,Y=0,G=0;switch(W){case"day":X=this.calendarDaysUntil($,T,w);break;case"week":{let H=this.calendarDaysUntil($,T,w);X=H%7,U=(H-X)/7;break}case"month":case"year":{let H=this.compareCalendarDates(T,$);if(!H)return{years:0,months:0,weeks:0,days:0};let z=T.year-$.year,F=T.day-$.day;if(W==="year"&&z){let Z=0;T.monthCode>$.monthCode&&(Z=1),T.monthCode<$.monthCode&&(Z=-1),Z||(Z=Math.sign(F)),G=Z*H<0?z-H:z}let O,Q=G?this.addCalendar($,{years:G},"constrain",w):$;do Y+=H,O=Q,Q=this.addMonthsCalendar(O,H,"constrain",w),Q.day!==$.day&&(Q=this.regulateDate({...Q,day:$.day},"constrain",w));while(this.compareCalendarDates(T,Q)*H>=0);Y-=H,X=this.calendarDaysUntil(O,T,w);break}}return{years:G,months:Y,weeks:U,days:X}}daysInMonth($,T){let{day:W}=$,w=this.maximumMonthLength($),X=this.minimumMonthLength($);if(X===w)return X;let U=W<=w-X?w:X,Y=this.calendarToIsoDate($,"constrain",T),G=this.addDaysIso(Y,U),H=this.isoToCalendarDate(G,T),z=this.addDaysIso(G,-H.day);return this.isoToCalendarDate(z,T).day}daysInPreviousMonth($,T){let{day:W,month:w,year:X}=$,U={year:w>1?X:X-1,month:w,day:1},Y=w>1?w-1:this.monthsInYear(U,T);U={...U,month:Y};let G=this.minimumMonthLength(U),H=this.maximumMonthLength(U);if(G===H)return H;let z=this.calendarToIsoDate($,"constrain",T),F=this.addDaysIso(z,-W);return this.isoToCalendarDate(F,T).day}startOfCalendarYear($){return{year:$.year,month:1,monthCode:"M01",day:1}}startOfCalendarMonth($){return{year:$.year,month:$.month,day:1}}calendarDaysUntil($,T,W){let w=this.calendarToIsoDate($,"constrain",W),X=this.calendarToIsoDate(T,"constrain",W);return MW(X.year,X.month-1,X.day)-MW(w.year,w.month-1,w.day)}monthDaySearchStartYear($,T){return 1972}monthDayFromFields($,T,W){let w,X,U,Y,G,{era:H,eraYear:z,year:F,month:O,monthCode:Q,day:Z}=$;if(O!==void 0&&F===void 0&&(!this.hasEra||H===void 0||z===void 0))throw new TypeError("when month is present, year (or era and eraYear) are required");(Q===void 0||F!==void 0||this.hasEra&&z!==void 0)&&({monthCode:Q,day:Z}=this.isoToCalendarDate(this.calendarToIsoDate($,T,W),W));let K={year:this.monthDaySearchStartYear(Q,Z),month:12,day:31},E=this.isoToCalendarDate(K,W),M=E.monthCode>Q||E.monthCode===Q&&E.day>=Z?E.year:E.year-1;for(let L=0;L<20;L++){let R=this.adjustCalendarDate({day:Z,monthCode:Q,year:M-L},W),_=this.calendarToIsoDate(R,"constrain",W),S=this.isoToCalendarDate(_,W);if({year:w,month:X,day:U}=_,S.monthCode===Q&&S.day===Z)return{month:X,day:U,year:w};if(T==="constrain"){let x=this.maxLengthOfMonthCodeInAnyYear(S.monthCode);if(S.monthCode===Q&&S.day===x&&Z>x)return{month:X,day:U,year:w};(Y===void 0||S.monthCode===Y.monthCode&&S.day>Y.day)&&(Y=S,G=_)}}if(T==="constrain"&&G!==void 0)return G;throw new RangeError(`No recent ${this.id} year with monthCode ${Q} and day ${Z}`)}getFirstDayOfWeek(){}getMinimalDaysInFirstWeek(){}}class aM extends kT{constructor(){super(...arguments),this.id="hebrew",this.calendarType="lunisolar",this.months={Tishri:{leap:1,regular:1,monthCode:"M01",days:30},Heshvan:{leap:2,regular:2,monthCode:"M02",days:{min:29,max:30}},Kislev:{leap:3,regular:3,monthCode:"M03",days:{min:29,max:30}},Tevet:{leap:4,regular:4,monthCode:"M04",days:29},Shevat:{leap:5,regular:5,monthCode:"M05",days:30},Adar:{leap:void 0,regular:6,monthCode:"M06",days:29},"Adar I":{leap:6,regular:void 0,monthCode:"M05L",days:30},"Adar II":{leap:7,regular:void 0,monthCode:"M06",days:29},Nisan:{leap:8,regular:7,monthCode:"M07",days:30},Iyar:{leap:9,regular:8,monthCode:"M08",days:29},Sivan:{leap:10,regular:9,monthCode:"M09",days:30},Tamuz:{leap:11,regular:10,monthCode:"M10",days:29},Av:{leap:12,regular:11,monthCode:"M11",days:30},Elul:{leap:13,regular:12,monthCode:"M12",days:29}}}inLeapYear($){let{year:T}=$;return(7*T+1)%19<7}monthsInYear($){return this.inLeapYear($)?13:12}minimumMonthLength($){return this.minMaxMonthLength($,"min")}maximumMonthLength($){return this.minMaxMonthLength($,"max")}minMaxMonthLength($,T){let{month:W,year:w}=$,X=this.getMonthCode(w,W),U=Object.entries(this.months).find((G)=>G[1].monthCode===X);if(U===void 0)throw new RangeError(`unmatched Hebrew month: ${W}`);let Y=U[1].days;return typeof Y=="number"?Y:Y[T]}maxLengthOfMonthCodeInAnyYear($){return["M04","M06","M08","M10","M12"].includes($)?29:30}estimateIsoDate($){let{year:T}=$;return{year:T-3760,month:1,day:1}}getMonthCode($,T){return this.inLeapYear({year:$})?T===6?T0(5,!0):T0(T<6?T:T-1):T0(T)}adjustCalendarDate($,T,W="constrain",w=!1){let{year:X,month:U,monthCode:Y,day:G,monthExtra:H}=$;if(X===void 0)throw new TypeError("Missing property: year");if(w){if(H){let z=this.months[H];if(!z)throw new RangeError(`Unrecognized month from formatToParts: ${H}`);U=this.inLeapYear({year:X})?z.leap:z.regular}return Y=this.getMonthCode(X,U),{year:X,month:U,day:G,monthCode:Y}}if(this.validateCalendarDate($),U===void 0)if(Y.endsWith("L")){if(Y!=="M05L")throw new RangeError(`Hebrew leap month must have monthCode M05L, not ${Y}`);if(U=6,!this.inLeapYear({year:X})){if(W==="reject")throw new RangeError(`Hebrew monthCode M05L is invalid in year ${X} which is not a leap year`);U=6,Y="M06"}}else{U=NW(Y),this.inLeapYear({year:X})&&U>=6&&U++;let z=this.monthsInYear({year:X});if(U<1||U>z)throw new RangeError(`Invalid monthCode: ${Y}`)}else if(W==="reject"?(c4(U,1,this.monthsInYear({year:X})),c4(G,1,this.maximumMonthLength({year:X,month:U}))):(U=L6(U,1,this.monthsInYear({year:X})),G=L6(G,1,this.maximumMonthLength({year:X,month:U}))),Y===void 0)Y=this.getMonthCode(X,U);else if(this.getMonthCode(X,U)!==Y)throw new RangeError(`monthCode ${Y} doesn't correspond to month ${U} in Hebrew year ${X}`);return{...$,day:G,month:U,monthCode:Y,year:X}}}class RW extends kT{constructor(){super(...arguments),this.calendarType="lunar",this.DAYS_PER_ISLAMIC_YEAR=354.3666666666667,this.DAYS_PER_ISO_YEAR=365.2425}inLeapYear($,T){let W={year:$.year,month:1,monthCode:"M01",day:1},w={year:$.year+1,month:1,monthCode:"M01",day:1};return this.calendarDaysUntil(W,w,T)===355}monthsInYear(){return 12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear(){return 30}estimateIsoDate($){let{year:T}=this.adjustCalendarDate($);return{year:Math.floor(T*this.DAYS_PER_ISLAMIC_YEAR/this.DAYS_PER_ISO_YEAR)+622,month:1,day:1}}}class sM extends RW{constructor(){super(...arguments),this.id="islamic"}}class eM extends RW{constructor(){super(...arguments),this.id="islamic-umalqura"}}class $D extends RW{constructor(){super(...arguments),this.id="islamic-tbla"}}class TD extends RW{constructor(){super(...arguments),this.id="islamic-civil"}}class WD extends RW{constructor(){super(...arguments),this.id="islamic-rgsa"}}class XD extends RW{constructor(){super(...arguments),this.id="islamicc"}}class wD extends kT{constructor(){super(...arguments),this.id="persian",this.calendarType="solar"}inLeapYear($,T){return this.daysInMonth({year:$.year,month:12,day:1},T)===30}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===12?29:T<=6?31:30}maximumMonthLength($){let{month:T}=$;return T===12?30:T<=6?31:30}maxLengthOfMonthCodeInAnyYear($){return NW($)<=6?31:30}estimateIsoDate($){let{year:T}=this.adjustCalendarDate($);return{year:T+621,month:1,day:1}}}class UD extends kT{constructor(){super(...arguments),this.id="indian",this.calendarType="solar",this.months={1:{length:30,month:3,day:22,leap:{length:31,month:3,day:21}},2:{length:31,month:4,day:21},3:{length:31,month:5,day:22},4:{length:31,month:6,day:22},5:{length:31,month:7,day:23},6:{length:31,month:8,day:23},7:{length:30,month:9,day:23},8:{length:30,month:10,day:23},9:{length:30,month:11,day:22},10:{length:30,month:12,day:22},11:{length:30,month:1,nextYear:!0,day:21},12:{length:30,month:2,nextYear:!0,day:20}},this.vulnerableToBceBug=new Date("0000-01-01T00:00Z").toLocaleDateString("en-US-u-ca-indian",{timeZone:"UTC"})!=="10/11/-79 Saka"}inLeapYear($){return CO($.year+78)}monthsInYear(){return 12}minimumMonthLength($){return this.getMonthInfo($).length}maximumMonthLength($){return this.getMonthInfo($).length}maxLengthOfMonthCodeInAnyYear($){let T=NW($),W=this.months[T];return W=W.leap??W,W.length}getMonthInfo($){let{month:T}=$,W=this.months[T];if(W===void 0)throw new RangeError(`Invalid month: ${T}`);return this.inLeapYear($)&&W.leap&&(W=W.leap),W}estimateIsoDate($){let T=this.adjustCalendarDate($),W=this.getMonthInfo(T);return g6(T.year+78+(W.nextYear?1:0),W.month,W.day+T.day-1)}checkIcuBugs($){if(this.vulnerableToBceBug&&$.year<1)throw new RangeError(`calendar '${this.id}' is broken for ISO dates before 0001-01-01 (see https://bugs.chromium.org/p/v8/issues/detail?id=10529)`)}}function CO($){return $%4==0&&($%100!=0||$%400==0)}class SO extends kT{constructor($,T){super(),this.calendarType="solar",this.id=$,this.isoEpoch=T}inLeapYear($){let{year:T}=this.estimateIsoDate({month:1,day:1,year:$.year});return CO(T)}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(T)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][NW($)-1]}estimateIsoDate($){let T=this.adjustCalendarDate($);return Rw(T.year+this.isoEpoch.year,T.month+this.isoEpoch.month,T.day+this.isoEpoch.day,"constrain")}}class jO extends kT{constructor($,T){super(),this.hasEra=!0,this.calendarType="solar",this.id=$;let{eras:W,anchorEra:w}=function(X){let U,Y=X;if(Y.length===0)throw new RangeError("Invalid era data: eras are required");if(Y.length===1&&Y[0].reverseOf)throw new RangeError("Invalid era data: anchor era cannot count years backwards");if(Y.length===1&&!Y[0].code)throw new RangeError("Invalid era data: at least one named era is required");if(Y.filter((H)=>H.reverseOf!=null).length>1)throw new RangeError("Invalid era data: only one era can count years backwards");Y.forEach((H)=>{if(H.isAnchor||!H.anchorEpoch&&!H.reverseOf){if(U)throw new RangeError("Invalid era data: cannot have multiple anchor eras");U=H,H.anchorEpoch={year:H.hasYearZero?0:1}}else if(!H.code)throw new RangeError("If era name is blank, it must be the anchor era")}),Y=Y.filter((H)=>H.code),Y.forEach((H)=>{let{reverseOf:z}=H;if(z){let F=Y.find((O)=>O.code===z);if(F===void 0)throw new RangeError(`Invalid era data: unmatched reverseOf era: ${z}`);H.reverseOf=F,H.anchorEpoch=F.anchorEpoch,H.isoEpoch=F.isoEpoch}H.anchorEpoch.month===void 0&&(H.anchorEpoch.month=1),H.anchorEpoch.day===void 0&&(H.anchorEpoch.day=1)}),Y.sort((H,z)=>{if(H.reverseOf)return 1;if(z.reverseOf)return-1;if(!H.isoEpoch||!z.isoEpoch)throw new RangeError("Invalid era data: missing ISO epoch");return z.isoEpoch.year-H.isoEpoch.year});let G=Y[Y.length-1].reverseOf;if(G&&G!==Y[Y.length-2])throw new RangeError("Invalid era data: invalid reverse-sign era");return Y.forEach((H,z)=>{H.genericName="era"+(Y.length-1-z)}),{eras:Y,anchorEra:U||Y[0]}}(T);this.anchorEra=w,this.eras=W}inLeapYear($){let{year:T}=this.estimateIsoDate({month:1,day:1,year:$.year});return CO(T)}monthsInYear(){return 12}minimumMonthLength($){let{month:T}=$;return T===2?this.inLeapYear($)?29:28:[4,6,9,11].indexOf(T)>=0?30:31}maximumMonthLength($){return this.minimumMonthLength($)}maxLengthOfMonthCodeInAnyYear($){return[31,29,31,30,31,30,31,31,30,31,30,31][NW($)-1]}completeEraYear($){let T=(Y,G,H)=>{let z=$[Y];if(z!=null&&z!=G&&!(H||[]).includes(z)){let F=H?.[0];throw new RangeError(`Input ${Y} ${z} doesn't match calculated value ${F?`${G} (also called ${F})`:G}`)}},W=(Y)=>{let G,H={...$,year:Y},z=this.eras.find((F,O)=>{if(O===this.eras.length-1){if(F.reverseOf){if(Y>0)throw new RangeError(`Signed year ${Y} is invalid for era ${F.code}`);return G=F.anchorEpoch.year-Y,!0}return G=Y-F.anchorEpoch.year+(F.hasYearZero?0:1),!0}return this.compareCalendarDates(H,F.anchorEpoch)>=0&&(G=Y-F.anchorEpoch.year+(F.hasYearZero?0:1),!0)});if(!z)throw new RangeError(`Year ${Y} was not matched by any era`);return{eraYear:G,era:z.code,eraNames:z.names}},{year:w,eraYear:X,era:U}=$;if(w!=null){let Y=W(w);({eraYear:X,era:U}=Y),T("era",U,Y?.eraNames),T("eraYear",X)}else{if(X==null)throw new RangeError("Either year or eraYear and era are required");{if(U===void 0)throw new RangeError("era and eraYear must be provided together");let Y=this.eras.find(({code:G,names:H=[]})=>G===U||H.includes(U));if(!Y)throw new RangeError(`Era ${U} (ISO year ${X}) was not matched by any era`);w=Y.reverseOf?Y.anchorEpoch.year-X:X+Y.anchorEpoch.year-(Y.hasYearZero?0:1),T("year",w),{eraYear:X,era:U}=W(w)}}return{...$,year:w,eraYear:X,era:U}}adjustCalendarDate($,T,W="constrain"){let w=$,{month:X,monthCode:U}=w;return X===void 0&&(w={...w,month:NW(U)}),this.validateCalendarDate(w),w=this.completeEraYear(w),super.adjustCalendarDate(w,T,W)}estimateIsoDate($){let T=this.adjustCalendarDate($),{year:W,month:w,day:X}=T,{anchorEra:U}=this;return Rw(W+U.isoEpoch.year-(U.hasYearZero?0:1),w,X,"constrain")}}class X9 extends jO{constructor($,T){super($,T)}isoToCalendarDate($){let{year:T,month:W,day:w}=$,X=T0(W),U=T-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:U,month:W,monthCode:X,day:w})}}var e1={inLeapYear($){let{year:T}=$;return(T+1)%4==0},monthsInYear:()=>13,minimumMonthLength($){let{month:T}=$;return T===13?this.inLeapYear($)?6:5:30},maximumMonthLength($){return this.minimumMonthLength($)},maxLengthOfMonthCodeInAnyYear:($)=>$==="M13"?6:30};class YD extends SO{constructor($,T){super($,T),this.inLeapYear=e1.inLeapYear,this.monthsInYear=e1.monthsInYear,this.minimumMonthLength=e1.minimumMonthLength,this.maximumMonthLength=e1.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=e1.maxLengthOfMonthCodeInAnyYear}}class IO extends jO{constructor($,T){super($,T),this.inLeapYear=e1.inLeapYear,this.monthsInYear=e1.monthsInYear,this.minimumMonthLength=e1.minimumMonthLength,this.maximumMonthLength=e1.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=e1.maxLengthOfMonthCodeInAnyYear}}class GD extends YD{constructor(){super("ethioaa",{year:-5492,month:7,day:17})}}class zD extends IO{constructor(){super("coptic",[{code:"coptic",isoEpoch:{year:284,month:8,day:29}},{code:"coptic-inverse",reverseOf:"coptic"}])}}class HD extends IO{constructor(){super("ethiopic",[{code:"ethioaa",names:["ethiopic-amete-alem","mundi"],isoEpoch:{year:-5492,month:7,day:17}},{code:"ethiopic",names:["incar"],isoEpoch:{year:8,month:8,day:27},anchorEpoch:{year:5501}}])}}class FD extends X9{constructor(){super("roc",[{code:"roc",names:["minguo"],isoEpoch:{year:1912,month:1,day:1}},{code:"roc-inverse",names:["before-roc"],reverseOf:"roc"}])}}class OD extends SO{constructor(){super("buddhist",{year:-543,month:1,day:1})}}class QD extends X9{constructor(){super("gregory",[{code:"gregory",names:["ad","ce"],isoEpoch:{year:1,month:1,day:1}},{code:"gregory-inverse",names:["be","bce"],reverseOf:"gregory"}])}reviseIntlEra($){let{era:T,eraYear:W}=$;return T==="b"&&(T="gregory-inverse"),T==="a"&&(T="gregory"),{era:T,eraYear:W}}getFirstDayOfWeek(){return 1}getMinimalDaysInFirstWeek(){return 1}}class ZD extends X9{constructor(){super("japanese",[{code:"reiwa",isoEpoch:{year:2019,month:5,day:1},anchorEpoch:{year:2019,month:5,day:1}},{code:"heisei",isoEpoch:{year:1989,month:1,day:8},anchorEpoch:{year:1989,month:1,day:8}},{code:"showa",isoEpoch:{year:1926,month:12,day:25},anchorEpoch:{year:1926,month:12,day:25}},{code:"taisho",isoEpoch:{year:1912,month:7,day:30},anchorEpoch:{year:1912,month:7,day:30}},{code:"meiji",isoEpoch:{year:1868,month:9,day:8},anchorEpoch:{year:1868,month:9,day:8}},{code:"japanese",names:["japanese","gregory","ad","ce"],isoEpoch:{year:1,month:1,day:1}},{code:"japanese-inverse",names:["japanese-inverse","gregory-inverse","bc","bce"],reverseOf:"japanese"}]),this.erasBeginMidYear=!0}reviseIntlEra($,T){let{era:W,eraYear:w}=$,{year:X}=T;return this.eras.find((U)=>U.code===W)?{era:W,eraYear:w}:X<1?{era:"japanese-inverse",eraYear:1-X}:{era:"japanese",eraYear:X}}}class BO extends kT{constructor(){super(...arguments),this.calendarType="lunisolar"}inLeapYear($,T){let W=this.getMonthList($.year,T);return Object.entries(W).length===13}monthsInYear($,T){return this.inLeapYear($,T)?13:12}minimumMonthLength(){return 29}maximumMonthLength(){return 30}maxLengthOfMonthCodeInAnyYear($){return["M01L","M09L","M10L","M11L","M12L"].includes($)?29:30}monthDaySearchStartYear($,T){let W={M01L:[1651,1651],M02L:[1947,1765],M03L:[1966,1955],M04L:[1963,1944],M05L:[1971,1952],M06L:[1960,1941],M07L:[1968,1938],M08L:[1957,1718],M09L:[1832,1832],M10L:[1870,1870],M11L:[1814,1814],M12L:[1890,1890]}[$]??[1972,1972];return T<30?W[0]:W[1]}getMonthList($,T){if($===void 0)throw new TypeError("Missing year");let W=JSON.stringify({func:"getMonthList",calendarYear:$,id:this.id}),w=T.get(W);if(w)return w;let X=this.getFormatter(),U=(E,M)=>{let L=tM({isoYear:E,isoMonth:2,isoDay:1}),R=new Date(L);R.setUTCDate(M+1);let _=X.formatToParts(R),S=_.find((T$)=>T$.type==="month").value,x=+_.find((T$)=>T$.type==="day").value,b=_.find((T$)=>T$.type==="relatedYear"),g;if(b===void 0)throw new RangeError(`Intl.DateTimeFormat.formatToParts lacks relatedYear in ${this.id} calendar. Try Node 14+ or modern browsers.`);return g=+b.value,{calendarMonthString:S,calendarDay:x,calendarYearToVerify:g}},Y=17,{calendarMonthString:G,calendarDay:H,calendarYearToVerify:z}=U($,Y);G!=="1"&&(Y+=29,{calendarMonthString:G,calendarDay:H}=U($,Y)),Y-=H-5;let F={},O,Q,Z=1,K=!1;do({calendarMonthString:G,calendarDay:H,calendarYearToVerify:z}=U($,Y)),O&&(F[Q].daysInMonth=O+30-H),z!==$?K=!0:(F[G]={monthIndex:Z++},Y+=30),O=H,Q=G;while(!K);return F[Q].daysInMonth=O+30-H,T.set(W,F),F}estimateIsoDate($){let{year:T,month:W}=$;return{year:T,month:W>=12?12:W+1,day:1}}adjustCalendarDate($,T,W="constrain",w=!1){let{year:X,month:U,monthExtra:Y,day:G,monthCode:H}=$;if(X===void 0)throw new TypeError("Missing property: year");if(w){if(Y&&Y!=="bis")throw new RangeError(`Unexpected leap month suffix: ${Y}`);let z=T0(U,Y!==void 0),F=`${U}${Y||""}`,O=this.getMonthList(X,T)[F];if(O===void 0)throw new RangeError(`Unmatched month ${F} in Chinese year ${X}`);return U=O.monthIndex,{year:X,month:U,day:G,monthCode:z}}if(this.validateCalendarDate($),U===void 0){let z=this.getMonthList(X,T),F=H.replace(/^M|L$/g,(Q)=>Q==="L"?"bis":"");F[0]==="0"&&(F=F.slice(1));let O=z[F];if(U=O&&O.monthIndex,U===void 0&&H.endsWith("L")&&H!="M13L"&&W==="constrain"){let Q=+H.replace(/^M0?|L$/g,"");O=z[Q],O&&(U=O.monthIndex,H=T0(Q))}if(U===void 0)throw new RangeError(`Unmatched month ${H} in Chinese year ${X}`)}else if(H===void 0){let z=this.getMonthList(X,T),F=Object.entries(z),O=F.length;W==="reject"?(c4(U,1,O),c4(G,1,this.maximumMonthLength())):(U=L6(U,1,O),G=L6(G,1,this.maximumMonthLength()));let Q=F.find((Z)=>Z[1].monthIndex===U);if(Q===void 0)throw new RangeError(`Invalid month ${U} in Chinese year ${X}`);H=T0(+Q[0].replace("bis",""),Q[0].indexOf("bis")!==-1)}else{let z=this.getMonthList(X,T),F=H.replace(/^M|L$/g,(Q)=>Q==="L"?"bis":"");F[0]==="0"&&(F=F.slice(1));let O=z[F];if(!O)throw new RangeError(`Unmatched monthCode ${H} in Chinese year ${X}`);if(U!==O.monthIndex)throw new RangeError(`monthCode ${H} doesn't correspond to month ${U} in Chinese year ${X}`)}return{...$,year:X,month:U,monthCode:H,day:G}}}class VD extends BO{constructor(){super(...arguments),this.id="chinese"}}class KD extends BO{constructor(){super(...arguments),this.id="dangi"}}class AD{constructor($){this.helper=$}extraFields($){return this.helper.hasEra&&$.includes("year")?["era","eraYear"]:[]}resolveFields($){if(this.helper.calendarType!=="lunisolar"){let T=new m4;PO($,void 0,this.helper.monthsInYear({year:$.year??1972},T))}}dateToISO($,T){let W=new m4,w=this.helper.calendarToIsoDate($,T,W);return W.setObject(w),w}monthDayToISOReferenceDate($,T){let W=new m4,w=this.helper.monthDayFromFields($,T,W);return W.setObject(w),w}fieldKeysToIgnore($){let T=new Set;for(let W=0;W<$.length;W++){let w=$[W];switch(T.add(w),w){case"era":T.add("eraYear"),T.add("year");break;case"eraYear":T.add("era"),T.add("year");break;case"year":T.add("era"),T.add("eraYear");break;case"month":T.add("monthCode"),this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"));break;case"monthCode":T.add("month"),this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"));break;case"day":this.helper.erasBeginMidYear&&(T.add("era"),T.add("eraYear"))}}return nM(T)}dateAdd($,{years:T,months:W,weeks:w,days:X},U){let Y=m4.getCacheForObject($),G=this.helper.isoToCalendarDate($,Y),H=this.helper.addCalendar(G,{years:T,months:W,weeks:w,days:X},U,Y),z=this.helper.calendarToIsoDate(H,"constrain",Y);return m4.getCacheForObject(z)||new m4(Y).setObject(z),z}dateUntil($,T,W){let w=m4.getCacheForObject($),X=m4.getCacheForObject(T),U=this.helper.isoToCalendarDate($,w),Y=this.helper.isoToCalendarDate(T,X);return this.helper.untilCalendar(U,Y,W,w)}isoToDate($,T){let W=m4.getCacheForObject($),w=this.helper.isoToCalendarDate($,W);if(T.dayOfWeek&&(w.dayOfWeek=rw.iso8601.isoToDate($,{dayOfWeek:!0}).dayOfWeek),T.dayOfYear){let X=this.helper.startOfCalendarYear(w),U=this.helper.calendarDaysUntil(X,w,W);w.dayOfYear=U+1}if(T.weekOfYear&&(w.weekOfYear=iM(this.helper.id,$)),w.daysInWeek=7,T.daysInMonth&&(w.daysInMonth=this.helper.daysInMonth(w,W)),T.daysInYear){let X=this.helper.startOfCalendarYear(w),U=this.helper.addCalendar(X,{years:1},"constrain",W);w.daysInYear=this.helper.calendarDaysUntil(X,U,W)}return T.monthsInYear&&(w.monthsInYear=this.helper.monthsInYear(w,W)),T.inLeapYear&&(w.inLeapYear=this.helper.inLeapYear(w,W)),w}getFirstDayOfWeek(){return this.helper.getFirstDayOfWeek()}getMinimalDaysInFirstWeek(){return this.helper.getMinimalDaysInFirstWeek()}}for(let $ of[aM,wD,HD,GD,zD,VD,KD,FD,UD,OD,QD,ZD,sM,eM,$D,TD,WD,XD]){let T=new $;rw[T.id]=new AD(T)}XO("calendarImpl",function($){return rw[$]});var xw=Intl.DateTimeFormat;function L2($,T){let W=V($,T);return typeof W=="function"&&(W=new xw(V($,OM),W(V($,eF))),function(w,X,U){let Y=oG(w);if(Y===void 0)throw new TypeError("Missing slots for the given container");if(Y[X]===void 0)throw new TypeError(`tried to reset ${X} which was not set`);Y[X]=U}($,T,W)),W}function Ow($){return k6($,LW)}class b2{constructor($=void 0,T=void 0){(function(W,w,X){let U=X!==void 0,Y;if(U){let F=["localeMatcher","calendar","numberingSystem","hour12","hourCycle","timeZone","weekday","era","year","month","day","dayPeriod","hour","minute","second","fractionalSecondDigits","timeZoneName","formatMatcher","dateStyle","timeStyle"];Y=function(Q){if(Q==null)throw new TypeError(`Expected object not ${Q}`);return Object(Q)}(X);let O=Object.create(null);for(let Q=0;Q<F.length;Q++){let Z=F[Q];Object.prototype.hasOwnProperty.call(Y,Z)&&(O[Z]=Y[Z])}Y=O}else Y=Object.create(null);let G=new xw(w,Y),H=G.resolvedOptions();if(f0(W),U){let F=Object.assign(Object.create(null),H);for(let O in F)Object.prototype.hasOwnProperty.call(Y,O)||delete F[O];F.hour12=Y.hour12,F.hourCycle=Y.hourCycle,_$(W,eF,F)}else _$(W,eF,Y);_$(W,OM,H.locale),_$(W,LW,G),_$(W,_2,H.timeZone),_$(W,Zw,H.calendar),_$(W,UM,LI),_$(W,YM,DI),_$(W,GM,NI),_$(W,zM,MI),_$(W,HM,JI),_$(W,FM,RI);let z=U?Y.timeZone:void 0;if(z===void 0)_$(W,sF,H.timeZone);else{let F=iG(z);if(F.startsWith("\u2212"))throw new RangeError("Unicode minus (U+2212) is not supported in time zone offsets");_$(W,sF,R6(F))}})(this,$,T)}get format(){C(this,Ow);let $=VI.bind(this);return Object.defineProperties($,{length:{value:1,enumerable:!1,writable:!1,configurable:!0},name:{value:"",enumerable:!1,writable:!1,configurable:!0}}),$}formatRange($,T){return C(this,Ow),AI.call(this,$,T)}formatToParts($,...T){return C(this,Ow),KI.call(this,$,...T)}formatRangeToParts($,T){return C(this,Ow),EI.call(this,$,T)}resolvedOptions(){return C(this,Ow),ZI.call(this)}}"formatToParts"in xw.prototype||delete b2.prototype.formatToParts,"formatRangeToParts"in xw.prototype||delete b2.prototype.formatRangeToParts;var Y1=function($=void 0,T=void 0){return new b2($,T)};function ZI(){let $=V(this,LW).resolvedOptions();return $.timeZone=V(this,sF),$}function VI($,...T){let W,w,X=y2($,this);return X.formatter?(W=X.formatter,w=[D1(X.epochNs,"floor")]):(W=V(this,LW),w=[$,...T]),W.format(...w)}function KI($,...T){let W,w,X=y2($,this);return X.formatter?(W=X.formatter,w=[D1(X.epochNs,"floor")]):(W=V(this,LW),w=[$,...T]),W.formatToParts(...w)}function AI($,T){if($===void 0||T===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let W=dG($),w=dG(T),X,U=[W,w];if(B0(W)!==B0(w))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");if(B0(W)){if(!ED(W,w))throw new TypeError("Intl.DateTimeFormat.formatRange accepts two values of the same type");let{epochNs:Y,formatter:G}=y2(W,this),{epochNs:H,formatter:z}=y2(w,this);G&&(X=G,U=[D1(Y,"floor"),D1(H,"floor")])}return X||(X=V(this,LW)),X.formatRange(...U)}function EI($,T){if($===void 0||T===void 0)throw new TypeError("Intl.DateTimeFormat.formatRange requires two values");let W=dG($),w=dG(T),X,U=[W,w];if(B0(W)!==B0(w))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");if(B0(W)){if(!ED(W,w))throw new TypeError("Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type");let{epochNs:Y,formatter:G}=y2(W,this),{epochNs:H,formatter:z}=y2(w,this);G&&(X=G,U=[D1(Y,"floor"),D1(H,"floor")])}return X||(X=V(this,LW)),X.formatRangeToParts(...U)}function nw($={},T={}){let W=Object.assign({},$),w=["year","month","day","hour","minute","second","weekday","dayPeriod","timeZoneName","dateStyle","timeStyle"];for(let X=0;X<w.length;X++){let U=w[X];W[U]=U in T?T[U]:W[U],W[U]!==!1&&W[U]!==void 0||delete W[U]}return W}function MI($){let T=nw($,{year:!1,month:!1,day:!1,weekday:!1,timeZoneName:!1,dateStyle:!1});if(T.timeStyle!=="long"&&T.timeStyle!=="full"||(delete T.timeStyle,Object.assign(T,{hour:"numeric",minute:"2-digit",second:"2-digit"})),!U9(T)){if(iw($))throw new TypeError(`cannot format Temporal.PlainTime with options [${Object.keys($)}]`);Object.assign(T,{hour:"numeric",minute:"numeric",second:"numeric"})}return T}function DI($){let T={short:{year:"2-digit",month:"numeric"},medium:{year:"numeric",month:"short"},long:{year:"numeric",month:"long"},full:{year:"numeric",month:"long"}},W=nw($,{day:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in W&&W.dateStyle){let w=W.dateStyle;delete W.dateStyle,Object.assign(W,T[w])}if(!(("year"in W)||("month"in W)||("era"in W))){if(iw($))throw new TypeError(`cannot format PlainYearMonth with options [${Object.keys($)}]`);Object.assign(W,{year:"numeric",month:"numeric"})}return W}function NI($){let T={short:{month:"numeric",day:"numeric"},medium:{month:"short",day:"numeric"},long:{month:"long",day:"numeric"},full:{month:"long",day:"numeric"}},W=nw($,{year:!1,hour:!1,minute:!1,second:!1,weekday:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if("dateStyle"in W&&W.dateStyle){let w=W.dateStyle;delete W.dateStyle,Object.assign(W,T[w])}if(!("month"in W)&&!("day"in W)){if(iw($))throw new TypeError(`cannot format PlainMonthDay with options [${Object.keys($)}]`);Object.assign(W,{month:"numeric",day:"numeric"})}return W}function LI($){let T=nw($,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!w9(T)){if(iw($))throw new TypeError(`cannot format PlainDate with options [${Object.keys($)}]`);Object.assign(T,{year:"numeric",month:"numeric",day:"numeric"})}return T}function JI($){let T=nw($,{timeZoneName:!1});if((T.timeStyle==="long"||T.timeStyle==="full")&&(delete T.timeStyle,Object.assign(T,{hour:"numeric",minute:"2-digit",second:"2-digit"}),T.dateStyle))Object.assign(T,{short:{year:"numeric",month:"numeric",day:"numeric"},medium:{year:"numeric",month:"short",day:"numeric"},long:{year:"numeric",month:"long",day:"numeric"},full:{year:"numeric",month:"long",day:"numeric",weekday:"long"}}[T.dateStyle]),delete T.dateStyle;if(!U9(T)&&!w9(T)){if(iw($))throw new TypeError(`cannot format PlainDateTime with options [${Object.keys($)}]`);Object.assign(T,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}return T}function RI($){let T=$;return U9(T)||w9(T)||(T=Object.assign({},T,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})),T}function w9($){return"year"in $||"month"in $||"day"in $||"weekday"in $||"dateStyle"in $||"era"in $}function U9($){return"hour"in $||"minute"in $||"second"in $||"timeStyle"in $||"dayPeriod"in $||"fractionalSecondDigits"in $}function iw($){return w9($)||U9($)||"dateStyle"in $||"timeStyle"in $||"timeZoneName"in $}function B0($){return F4($)||A4($)||i$($)||v$($)||r4($)||w1($)||l4($)}function dG($){return B0($)?$:nG($)}function ED($,T){return!(!B0($)||!B0(T)||A4($)&&!A4(T)||F4($)&&!F4(T)||i$($)&&!i$(T)||v$($)&&!v$(T)||r4($)&&!r4(T)||w1($)&&!w1(T)||l4($)&&!l4(T))}function y2($,T){if(A4($)){let W={isoDate:{year:1970,month:1,day:1},time:V($,O4)};return{epochNs:T6(V(T,_2),W,"compatible"),formatter:L2(T,zM)}}if(r4($)){let W=V($,u),w=V(T,Zw);if(W!==w)throw new RangeError(`cannot format PlainYearMonth with calendar ${W} in locale with calendar ${w}`);let X=x$(V($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:T6(V(T,_2),X,"compatible"),formatter:L2(T,YM)}}if(w1($)){let W=V($,u),w=V(T,Zw);if(W!==w)throw new RangeError(`cannot format PlainMonthDay with calendar ${W} in locale with calendar ${w}`);let X=x$(V($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:T6(V(T,_2),X,"compatible"),formatter:L2(T,GM)}}if(F4($)){let W=V($,u),w=V(T,Zw);if(W!=="iso8601"&&W!==w)throw new RangeError(`cannot format PlainDate with calendar ${W} in locale with calendar ${w}`);let X=x$(V($,V$),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:T6(V(T,_2),X,"compatible"),formatter:L2(T,UM)}}if(i$($)){let W=V($,u),w=V(T,Zw);if(W!=="iso8601"&&W!==w)throw new RangeError(`cannot format PlainDateTime with calendar ${W} in locale with calendar ${w}`);let X=V($,X4);return{epochNs:T6(V(T,_2),X,"compatible"),formatter:L2(T,HM)}}if(v$($))throw new TypeError("Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.");return l4($)?{epochNs:V($,Z$),formatter:L2(T,FM)}:{}}function MD($){let T=Object.create(null);return T.years=V($,Z6),T.months=V($,V6),T.weeks=V($,f6),T.days=V($,K6),T.hours=V($,A6),T.minutes=V($,E6),T.seconds=V($,M6),T.milliseconds=V($,D6),T.microseconds=V($,N6),T.nanoseconds=V($,b6),T}b2.prototype.constructor=Y1,Object.defineProperty(Y1,"prototype",{value:b2.prototype,writable:!1,enumerable:!1,configurable:!1}),Y1.supportedLocalesOf=xw.supportedLocalesOf,b0(Y1,"Intl.DateTimeFormat");var{format:_I,formatToParts:kI}=Intl.DurationFormat?.prototype??Object.create(null);function xO($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let T=MD(E1($));return _I.call(this,T)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=xO,Intl.DurationFormat.prototype.formatToParts=function($){Intl.DurationFormat.prototype.resolvedOptions.call(this);let T=MD(E1($));return kI.call(this,T)});var bt=Object.freeze({__proto__:null,DateTimeFormat:Y1,ModifiedIntlDurationFormatPrototypeFormat:xO});class Y9{constructor($){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");SM(this,pG($))}get epochMilliseconds(){return C(this,l4),D1(V(this,Z$),"floor")}get epochNanoseconds(){return C(this,l4),lM(P.BigInt(V(this,Z$)))}add($){return C(this,l4),lE("add",this,$)}subtract($){return C(this,l4),lE("subtract",this,$)}until($,T=void 0){return C(this,l4),gE("until",this,$,T)}since($,T=void 0){return C(this,l4),gE("since",this,$,T)}round($){if(C(this,l4),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):X$($),W=m2(T),w=x1(T,"halfExpand"),X=h6(T,"smallestUnit","time",x0);return c2(W,{hour:24,minute:1440,second:86400,millisecond:86400000,microsecond:86400000000,nanosecond:86400000000000}[X],!0),I1(ZO(V(this,Z$),W,X,w))}equals($){C(this,l4);let T=Aw($),W=V(this,Z$),w=V(T,Z$);return P.equal(P.BigInt(W),P.BigInt(w))}toString($=void 0){C(this,l4);let T=X$($),W=gw(T),w=x1(T,"trunc"),X=h6(T,"smallestUnit","time",void 0);if(X==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let U=T.timeZone;U!==void 0&&(U=R6(U));let{precision:Y,unit:G,increment:H}=mw(X,W);return SE(I1(ZO(V(this,Z$),H,G,w)),U,Y)}toJSON(){return C(this,l4),SE(this,void 0,"auto")}toLocaleString($=void 0,T=void 0){return C(this,l4),new Y1($,T).format(this)}valueOf(){_T("Instant")}toZonedDateTimeISO($){C(this,l4);let T=R6($);return e4(V(this,Z$),T,"iso8601")}static fromEpochMilliseconds($){return I1(B1(nG($)))}static fromEpochNanoseconds($){return I1(pG($))}static from($){return Aw($)}static compare($,T){let W=Aw($),w=Aw(T),X=V(W,Z$),U=V(w,Z$);return P.lessThan(X,U)?-1:P.greaterThan(X,U)?1:0}}b0(Y9,"Temporal.Instant");class G9{constructor($,T,W,w="iso8601"){let X=A$($),U=A$(T),Y=A$(W),G=v6(w===void 0?"iso8601":I4(w));AW(X,U,Y),kM(this,{year:X,month:U,day:Y},G)}get calendarId(){return C(this,F4),V(this,u)}get era(){return F6(this,"era")}get eraYear(){return F6(this,"eraYear")}get year(){return F6(this,"year")}get month(){return F6(this,"month")}get monthCode(){return F6(this,"monthCode")}get day(){return F6(this,"day")}get dayOfWeek(){return F6(this,"dayOfWeek")}get dayOfYear(){return F6(this,"dayOfYear")}get weekOfYear(){return F6(this,"weekOfYear")?.week}get yearOfWeek(){return F6(this,"weekOfYear")?.year}get daysInWeek(){return F6(this,"daysInWeek")}get daysInMonth(){return F6(this,"daysInMonth")}get daysInYear(){return F6(this,"daysInYear")}get monthsInYear(){return F6(this,"monthsInYear")}get inLeapYear(){return F6(this,"inLeapYear")}with($,T=void 0){if(C(this,F4),!Q4($))throw new TypeError("invalid argument");g2($);let W=V(this,u),w=_6(W,V(this,V$));return w=KW(W,w,H1(W,$,["year","month","monthCode","day"],[],"partial")),J6(JT(W,w,j$(X$(T))),W)}withCalendar($){C(this,F4);let T=dw($);return J6(V(this,V$),T)}add($,T=void 0){return C(this,F4),rE("add",this,$,T)}subtract($,T=void 0){return C(this,F4),rE("subtract",this,$,T)}until($,T=void 0){return C(this,F4),mE("until",this,$,T)}since($,T=void 0){return C(this,F4),mE("since",this,$,T)}equals($){C(this,F4);let T=Vw($);return w0(V(this,V$),V(T,V$))===0&&W0(V(this,u),V(T,u))}toString($=void 0){return C(this,F4),jE(this,hw(X$($)))}toJSON(){return C(this,F4),jE(this)}toLocaleString($=void 0,T=void 0){return C(this,F4),new Y1($,T).format(this)}valueOf(){_T("PlainDate")}toPlainDateTime($=void 0){C(this,F4);let T=_M($);return K1(x$(V(this,V$),T),V(this,u))}toZonedDateTime($){let T,W;if(C(this,F4),Q4($)){let U=$.timeZone;U===void 0?T=R6($):(T=R6(U),W=$.plainTime)}else T=R6($);let w=V(this,V$),X;return W===void 0?X=KT(T,w):(W=ET(W),X=T6(T,x$(w,V(W,O4)),"compatible")),e4(X,T,V(this,u))}toPlainYearMonth(){C(this,F4);let $=V(this,u);return P2(Cw($,_6($,V(this,V$)),"constrain"),$)}toPlainMonthDay(){C(this,F4);let $=V(this,u);return q2(hG($,_6($,V(this,V$)),"constrain"),$)}static from($,T=void 0){return Vw($,T)}static compare($,T){let W=Vw($),w=Vw(T);return w0(V(W,V$),V(w,V$))}}function F6($,T){C($,F4);let W=V($,V$);return cw($).isoToDate(W,{[T]:!0})[T]}b0(G9,"Temporal.PlainDate");class z9{constructor($,T,W,w=0,X=0,U=0,Y=0,G=0,H=0,z="iso8601"){let F=A$($),O=A$(T),Q=A$(W),Z=w===void 0?0:A$(w),K=X===void 0?0:A$(X),E=U===void 0?0:A$(U),M=Y===void 0?0:A$(Y),L=G===void 0?0:A$(G),R=H===void 0?0:A$(H),_=v6(z===void 0?"iso8601":I4(z));_O(F,O,Q,Z,K,E,M,L,R),vM(this,{isoDate:{year:F,month:O,day:Q},time:{hour:Z,minute:K,second:E,millisecond:M,microsecond:L,nanosecond:R}},_)}get calendarId(){return C(this,i$),V(this,u)}get year(){return O6(this,"year")}get month(){return O6(this,"month")}get monthCode(){return O6(this,"monthCode")}get day(){return O6(this,"day")}get hour(){return J2(this,"hour")}get minute(){return J2(this,"minute")}get second(){return J2(this,"second")}get millisecond(){return J2(this,"millisecond")}get microsecond(){return J2(this,"microsecond")}get nanosecond(){return J2(this,"nanosecond")}get era(){return O6(this,"era")}get eraYear(){return O6(this,"eraYear")}get dayOfWeek(){return O6(this,"dayOfWeek")}get dayOfYear(){return O6(this,"dayOfYear")}get weekOfYear(){return O6(this,"weekOfYear")?.week}get yearOfWeek(){return O6(this,"weekOfYear")?.year}get daysInWeek(){return O6(this,"daysInWeek")}get daysInYear(){return O6(this,"daysInYear")}get daysInMonth(){return O6(this,"daysInMonth")}get monthsInYear(){return O6(this,"monthsInYear")}get inLeapYear(){return O6(this,"inLeapYear")}with($,T=void 0){if(C(this,i$),!Q4($))throw new TypeError("invalid argument");g2($);let W=V(this,u),w=V(this,X4),X={..._6(W,w.isoDate),...w.time};return X=KW(W,X,H1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond"],"partial")),K1(uw(W,X,j$(X$(T))),W)}withPlainTime($=void 0){C(this,i$);let T=_M($);return K1(x$(V(this,X4).isoDate,T),V(this,u))}withCalendar($){C(this,i$);let T=dw($);return K1(V(this,X4),T)}add($,T=void 0){return C(this,i$),nE("add",this,$,T)}subtract($,T=void 0){return C(this,i$),nE("subtract",this,$,T)}until($,T=void 0){return C(this,i$),cE("until",this,$,T)}since($,T=void 0){return C(this,i$),cE("since",this,$,T)}round($){if(C(this,i$),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):X$($),W=m2(T),w=x1(T,"halfExpand"),X=h6(T,"smallestUnit","time",x0,["day"]),U={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X];c2(W,U,U===1);let Y=V(this,X4);return K1(W===1&&X==="nanosecond"?Y:VO(Y,W,X,w),V(this,u))}equals($){C(this,i$);let T=Kw($);return f2(V(this,X4),V(T,X4))===0&&W0(V(this,u),V(T,u))}toString($=void 0){C(this,i$);let T=X$($),W=hw(T),w=gw(T),X=x1(T,"trunc"),U=h6(T,"smallestUnit","time",void 0);if(U==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:Y,unit:G,increment:H}=mw(U,w),z=VO(V(this,X4),H,G,X);return EW(z),jw(z,V(this,u),Y,W)}toJSON(){return C(this,i$),jw(V(this,X4),V(this,u),"auto")}toLocaleString($=void 0,T=void 0){return C(this,i$),new Y1($,T).format(this)}valueOf(){_T("PlainDateTime")}toZonedDateTime($,T=void 0){C(this,i$);let W=R6($),w=_w(X$(T));return e4(T6(W,V(this,X4),w),W,V(this,u))}toPlainDate(){return C(this,i$),J6(V(this,X4).isoDate,V(this,u))}toPlainTime(){return C(this,i$),P0(V(this,X4).time)}static from($,T=void 0){return Kw($,T)}static compare($,T){let W=Kw($),w=Kw(T);return f2(V(W,X4),V(w,X4))}}function O6($,T){C($,i$);let W=V($,X4).isoDate;return cw($).isoToDate(W,{[T]:!0})[T]}function J2($,T){return C($,i$),V($,X4).time[T]}b0(z9,"Temporal.PlainDateTime");class h2{constructor($=0,T=0,W=0,w=0,X=0,U=0,Y=0,G=0,H=0,z=0){let F=$===void 0?0:j1($),O=T===void 0?0:j1(T),Q=W===void 0?0:j1(W),Z=w===void 0?0:j1(w),K=X===void 0?0:j1(X),E=U===void 0?0:j1(U),M=Y===void 0?0:j1(Y),L=G===void 0?0:j1(G),R=H===void 0?0:j1(H),_=z===void 0?0:j1(z);T9(F,O,Q,Z,K,E,M,L,R,_),f0(this),_$(this,Z6,F),_$(this,V6,O),_$(this,f6,Q),_$(this,K6,Z),_$(this,A6,K),_$(this,E6,E),_$(this,M6,M),_$(this,D6,L),_$(this,N6,R),_$(this,b6,_)}get years(){return C(this,H4),V(this,Z6)}get months(){return C(this,H4),V(this,V6)}get weeks(){return C(this,H4),V(this,f6)}get days(){return C(this,H4),V(this,K6)}get hours(){return C(this,H4),V(this,A6)}get minutes(){return C(this,H4),V(this,E6)}get seconds(){return C(this,H4),V(this,M6)}get milliseconds(){return C(this,H4),V(this,D6)}get microseconds(){return C(this,H4),V(this,N6)}get nanoseconds(){return C(this,H4),V(this,b6)}get sign(){return C(this,H4),cG(this)}get blank(){return C(this,H4),cG(this)===0}with($){C(this,H4);let T=RM($),{years:W=V(this,Z6),months:w=V(this,V6),weeks:X=V(this,f6),days:U=V(this,K6),hours:Y=V(this,A6),minutes:G=V(this,E6),seconds:H=V(this,M6),milliseconds:z=V(this,D6),microseconds:F=V(this,N6),nanoseconds:O=V(this,b6)}=T;return new h2(W,w,X,U,Y,G,H,z,F,O)}negated(){return C(this,H4),m6(this)}abs(){return C(this,H4),new h2(Math.abs(V(this,Z6)),Math.abs(V(this,V6)),Math.abs(V(this,f6)),Math.abs(V(this,K6)),Math.abs(V(this,A6)),Math.abs(V(this,E6)),Math.abs(V(this,M6)),Math.abs(V(this,D6)),Math.abs(V(this,N6)),Math.abs(V(this,b6)))}add($){return C(this,H4),oE("add",this,$)}subtract($){return C(this,H4),oE("subtract",this,$)}round($){if(C(this,H4),$===void 0)throw new TypeError("options parameter is required");let T=v0(this),W=typeof $=="string"?DW("smallestUnit",$):X$($),w=h6(W,"largestUnit","datetime",void 0,["auto"]),{plainRelativeTo:X,zonedRelativeTo:U}=iF(W),Y=m2(W),G=x1(W,"halfExpand"),H=h6(W,"smallestUnit","datetime",void 0),z=!0;H||(z=!1,H="nanosecond");let F=S0(T,H),O=!0;if(w||(O=!1,w=F),w==="auto"&&(w=F),!z&&!O)throw new RangeError("at least one of smallestUnit or largestUnit is required");if(S0(w,H)!==w)throw new RangeError(`largestUnit ${w} cannot be smaller than smallestUnit ${H}`);let Q={hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[H];if(Q!==void 0&&c2(Y,Q,!1),Y>1&&q0(H)==="date"&&w!==H)throw new RangeError("For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit");if(U){let K=k2(this),E=V(U,y$),M=V(U,u),L=V(U,Z$);return K=oM(L,Dw(L,E,M,K),E,M,w,Y,H,G),q0(w)==="date"&&(w="hour"),A1(K,w)}if(X){let K=$0(this),E=x2({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},K.time),M=V(X,V$),L=V(X,u),R=G1(L,M,$6(K.date,E.deltaDays),"constrain");return K=dM(x$(M,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),x$(R,E),L,w,Y,H,G),A1(K,w)}if(s1(T))throw new RangeError(`a starting point is required for ${T}s balancing`);if(s1(w))throw new RangeError(`a starting point is required for ${w}s balancing`);let Z=$0(this);if(H==="day"){let{quotient:K,remainder:E}=Z.time.divmod(fG),M=Z.date.days+K+kw(E,"day");M=MT(M,Y,G),Z=j0({years:0,months:0,weeks:0,days:M},q$.ZERO)}else Z=j0({years:0,months:0,weeks:0,days:0},uG(Z.time,Y,H,G));return A1(Z,w)}total($){if(C(this,H4),$===void 0)throw new TypeError("options argument is required");let T=typeof $=="string"?DW("unit",$):X$($),{plainRelativeTo:W,zonedRelativeTo:w}=iF(T),X=h6(T,"unit","datetime",x0);if(w){let Y=k2(this),G=V(w,y$),H=V(w,u),z=V(w,Z$);return function(F,O,Q,Z,K){return q0(K)==="time"?kw(q$.fromEpochNsDiff(O,F),K):hE(uM(F,O,Q,Z,K),O,M1(Q,F),Q,Z,K)}(z,Dw(z,G,H,Y),G,H,X)}if(W){let Y=$0(this),G=x2({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},Y.time),H=V(W,V$),z=V(W,u),F=G1(z,H,$6(Y.date,G.deltaDays),"constrain");return function(O,Q,Z,K){if(f2(O,Q)==0)return 0;EW(O),EW(Q);let E=cM(O,Q,Z,K);return K==="nanosecond"?P.toNumber(E.time.totalNs):hE(E,n4(Q),O,null,Z,K)}(x$(H,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),x$(F,G),z,X)}let U=v0(this);if(s1(U))throw new RangeError(`a starting point is required for ${U}s total`);if(s1(X))throw new RangeError(`a starting point is required for ${X}s total`);return kw($0(this).time,X)}toString($=void 0){C(this,H4);let T=X$($),W=gw(T),w=x1(T,"trunc"),X=h6(T,"smallestUnit","time",void 0);if(X==="hour"||X==="minute")throw new RangeError('smallestUnit must be a time unit other than "hours" or "minutes"');let{precision:U,unit:Y,increment:G}=mw(X,W);if(Y==="nanosecond"&&G===1)return jG(this,U);let H=v0(this),z=k2(this),F=uG(z.time,G,Y,w);return z=j0(z.date,F),jG(A1(z,S0(H,"second")),U)}toJSON(){return C(this,H4),jG(this,"auto")}toLocaleString($=void 0,T=void 0){if(C(this,H4),typeof Intl.DurationFormat=="function"){let W=new Intl.DurationFormat($,T);return xO.call(W,this)}return console.warn("Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat."),jG(this,"auto")}valueOf(){_T("Duration")}static from($){return E1($)}static compare($,T,W=void 0){let w=E1($),X=E1(T),U=X$(W),{plainRelativeTo:Y,zonedRelativeTo:G}=iF(U);if(V(w,Z6)===V(X,Z6)&&V(w,V6)===V(X,V6)&&V(w,f6)===V(X,f6)&&V(w,K6)===V(X,K6)&&V(w,A6)===V(X,A6)&&V(w,E6)===V(X,E6)&&V(w,M6)===V(X,M6)&&V(w,D6)===V(X,D6)&&V(w,N6)===V(X,N6)&&V(w,b6)===V(X,b6))return 0;let H=v0(w),z=v0(X),F=k2(w),O=k2(X);if(G&&(q0(H)==="date"||q0(z)==="date")){let M=V(G,y$),L=V(G,u),R=V(G,Z$),_=Dw(R,M,L,F),S=Dw(R,M,L,O);return y6(P.toNumber(P.subtract(_,S)))}let Q=F.date.days,Z=O.date.days;if(s1(H)||s1(z)){if(!Y)throw new RangeError("A starting point is required for years, months, or weeks comparison");Q=yE(F.date,Y),Z=yE(O.date,Y)}let K=F.time.add24HourDays(Q),E=O.time.add24HourDays(Z);return K.cmp(E)}}b0(h2,"Temporal.Duration");class H9{constructor($,T,W="iso8601",w=1972){let X=A$($),U=A$(T),Y=v6(W===void 0?"iso8601":I4(W)),G=A$(w);AW(G,X,U),qM(this,{year:G,month:X,day:U},Y)}get monthCode(){return eE(this,"monthCode")}get day(){return eE(this,"day")}get calendarId(){return C(this,w1),V(this,u)}with($,T=void 0){if(C(this,w1),!Q4($))throw new TypeError("invalid argument");g2($);let W=V(this,u),w=_6(W,V(this,V$),"month-day");return w=KW(W,w,H1(W,$,["year","month","monthCode","day"],[],"partial")),q2(hG(W,w,j$(X$(T))),W)}equals($){C(this,w1);let T=PE($);return w0(V(this,V$),V(T,V$))===0&&W0(V(this,u),V(T,u))}toString($=void 0){return C(this,w1),BE(this,hw(X$($)))}toJSON(){return C(this,w1),BE(this)}toLocaleString($=void 0,T=void 0){return C(this,w1),new Y1($,T).format(this)}valueOf(){_T("PlainMonthDay")}toPlainDate($){if(C(this,w1),!Q4($))throw new TypeError("argument should be an object");let T=V(this,u);return J6(JT(T,KW(T,_6(T,V(this,V$),"month-day"),H1(T,$,["year"],[],[])),"constrain"),T)}static from($,T=void 0){return PE($,T)}}function eE($,T){C($,w1);let W=V($,V$);return cw($).isoToDate(W,{[T]:!0})[T]}function aF($){return M1($,EO())}b0(H9,"Temporal.PlainMonthDay");var DD={instant:()=>I1(EO()),plainDateTimeISO:($=Fw())=>K1(aF(R6($)),"iso8601"),plainDateISO:($=Fw())=>J6(aF(R6($)).isoDate,"iso8601"),plainTimeISO:($=Fw())=>P0(aF(R6($)).time),timeZoneId:()=>Fw(),zonedDateTimeISO:($=Fw())=>{let T=R6($);return e4(EO(),T,"iso8601")},[Symbol.toStringTag]:"Temporal.Now"};Object.defineProperty(DD,Symbol.toStringTag,{value:"Temporal.Now",writable:!1,enumerable:!1,configurable:!0});class tw{constructor($=0,T=0,W=0,w=0,X=0,U=0){let Y=$===void 0?0:A$($),G=T===void 0?0:A$(T),H=W===void 0?0:A$(W),z=w===void 0?0:A$(w),F=X===void 0?0:A$(X),O=U===void 0?0:A$(U);$9(Y,G,H,z,F,O),PM(this,{hour:Y,minute:G,second:H,millisecond:z,microsecond:F,nanosecond:O})}get hour(){return C(this,A4),V(this,O4).hour}get minute(){return C(this,A4),V(this,O4).minute}get second(){return C(this,A4),V(this,O4).second}get millisecond(){return C(this,A4),V(this,O4).millisecond}get microsecond(){return C(this,A4),V(this,O4).microsecond}get nanosecond(){return C(this,A4),V(this,O4).nanosecond}with($,T=void 0){if(C(this,A4),!Q4($))throw new TypeError("invalid argument");g2($);let W=GO($,"partial"),w=GO(this),{hour:X,minute:U,second:Y,millisecond:G,microsecond:H,nanosecond:z}=Object.assign(w,W),F=j$(X$(T));return{hour:X,minute:U,second:Y,millisecond:G,microsecond:H,nanosecond:z}=aG(X,U,Y,G,H,z,F),new tw(X,U,Y,G,H,z)}add($){return C(this,A4),iE("add",this,$)}subtract($){return C(this,A4),iE("subtract",this,$)}until($,T=void 0){return C(this,A4),uE("until",this,$,T)}since($,T=void 0){return C(this,A4),uE("since",this,$,T)}round($){if(C(this,A4),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):X$($),W=m2(T),w=x1(T,"halfExpand"),X=h6(T,"smallestUnit","time",x0);return c2(W,{hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X],!1),P0(KO(V(this,O4),W,X,w))}equals($){C(this,A4);let T=ET($);return AO(V(this,O4),V(T,O4))===0}toString($=void 0){C(this,A4);let T=X$($),W=gw(T),w=x1(T,"trunc"),X=h6(T,"smallestUnit","time",void 0);if(X==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let{precision:U,unit:Y,increment:G}=mw(X,W);return IE(KO(V(this,O4),G,Y,w),U)}toJSON(){return C(this,A4),IE(V(this,O4),"auto")}toLocaleString($=void 0,T=void 0){return C(this,A4),new Y1($,T).format(this)}valueOf(){_T("PlainTime")}static from($,T=void 0){return ET($,T)}static compare($,T){let W=ET($),w=ET(T);return AO(V(W,O4),V(w,O4))}}b0(tw,"Temporal.PlainTime");class F9{constructor($,T,W="iso8601",w=1){let X=A$($),U=A$(T),Y=v6(W===void 0?"iso8601":I4(W)),G=A$(w);AW(X,U,G),CM(this,{year:X,month:U,day:G},Y)}get year(){return _0(this,"year")}get month(){return _0(this,"month")}get monthCode(){return _0(this,"monthCode")}get calendarId(){return C(this,r4),V(this,u)}get era(){return _0(this,"era")}get eraYear(){return _0(this,"eraYear")}get daysInMonth(){return _0(this,"daysInMonth")}get daysInYear(){return _0(this,"daysInYear")}get monthsInYear(){return _0(this,"monthsInYear")}get inLeapYear(){return _0(this,"inLeapYear")}with($,T=void 0){if(C(this,r4),!Q4($))throw new TypeError("invalid argument");g2($);let W=V(this,u),w=_6(W,V(this,V$),"year-month");return w=KW(W,w,H1(W,$,["year","month","monthCode"],[],"partial")),P2(Cw(W,w,j$(X$(T))),W)}add($,T=void 0){return C(this,r4),tE("add",this,$,T)}subtract($,T=void 0){return C(this,r4),tE("subtract",this,$,T)}until($,T=void 0){return C(this,r4),pE("until",this,$,T)}since($,T=void 0){return C(this,r4),pE("since",this,$,T)}equals($){C(this,r4);let T=Ew($);return w0(V(this,V$),V(T,V$))===0&&W0(V(this,u),V(T,u))}toString($=void 0){return C(this,r4),xE(this,hw(X$($)))}toJSON(){return C(this,r4),xE(this)}toLocaleString($=void 0,T=void 0){return C(this,r4),new Y1($,T).format(this)}valueOf(){_T("PlainYearMonth")}toPlainDate($){if(C(this,r4),!Q4($))throw new TypeError("argument should be an object");let T=V(this,u);return J6(JT(T,KW(T,_6(T,V(this,V$),"year-month"),H1(T,$,["day"],[],[])),"constrain"),T)}static from($,T=void 0){return Ew($,T)}static compare($,T){let W=Ew($),w=Ew(T);return w0(V(W,V$),V(w,V$))}}function _0($,T){C($,r4);let W=V($,V$);return cw($).isoToDate(W,{[T]:!0})[T]}b0(F9,"Temporal.PlainYearMonth");var vI=Y1.prototype.resolvedOptions;class O9{constructor($,T,W="iso8601"){if(arguments.length<1)throw new TypeError("missing argument: epochNanoseconds is required");let w=pG($),X=I4(T),{tzName:U,offsetMinutes:Y}=DT(X);if(Y===void 0){let G=gG(U);if(!G)throw new RangeError(`unknown time zone ${U}`);X=G.identifier}else X=LO(Y);jM(this,w,X,v6(W===void 0?"iso8601":I4(W)))}get calendarId(){return C(this,v$),V(this,u)}get timeZoneId(){return C(this,v$),V(this,y$)}get year(){return Q6(this,"year")}get month(){return Q6(this,"month")}get monthCode(){return Q6(this,"monthCode")}get day(){return Q6(this,"day")}get hour(){return R2(this,"hour")}get minute(){return R2(this,"minute")}get second(){return R2(this,"second")}get millisecond(){return R2(this,"millisecond")}get microsecond(){return R2(this,"microsecond")}get nanosecond(){return R2(this,"nanosecond")}get era(){return Q6(this,"era")}get eraYear(){return Q6(this,"eraYear")}get epochMilliseconds(){return C(this,v$),D1(V(this,Z$),"floor")}get epochNanoseconds(){return C(this,v$),lM(V(this,Z$))}get dayOfWeek(){return Q6(this,"dayOfWeek")}get dayOfYear(){return Q6(this,"dayOfYear")}get weekOfYear(){return Q6(this,"weekOfYear")?.week}get yearOfWeek(){return Q6(this,"weekOfYear")?.year}get hoursInDay(){C(this,v$);let $=V(this,y$),T=a1(this).isoDate,W=g6(T.year,T.month,T.day+1),w=KT($,T),X=KT($,W);return kw(q$.fromEpochNsDiff(X,w),"hour")}get daysInWeek(){return Q6(this,"daysInWeek")}get daysInMonth(){return Q6(this,"daysInMonth")}get daysInYear(){return Q6(this,"daysInYear")}get monthsInYear(){return Q6(this,"monthsInYear")}get inLeapYear(){return Q6(this,"inLeapYear")}get offset(){return C(this,v$),zO(C0(V(this,y$),V(this,Z$)))}get offsetNanoseconds(){return C(this,v$),C0(V(this,y$),V(this,Z$))}with($,T=void 0){if(C(this,v$),!Q4($))throw new TypeError("invalid zoned-date-time-like");g2($);let W=V(this,u),w=V(this,y$),X=C0(w,V(this,Z$)),U=a1(this),Y={..._6(W,U.isoDate),...U.time,offset:zO(X)};Y=KW(W,Y,H1(W,$,["year","month","monthCode","day"],["hour","minute","second","millisecond","microsecond","nanosecond","offset"],"partial"));let G=X$(T),H=_w(G),z=IG(G,"prefer"),F=uw(W,Y,j$(G)),O=u2(Y.offset);return e4(yG(F.isoDate,F.time,"option",O,w,H,z,!1),w,W)}withPlainTime($=void 0){C(this,v$);let T=V(this,y$),W=V(this,u),w=a1(this).isoDate,X;return X=$===void 0?KT(T,w):T6(T,x$(w,V(ET($),O4)),"compatible"),e4(X,T,W)}withTimeZone($){C(this,v$);let T=R6($);return e4(V(this,Z$),T,V(this,u))}withCalendar($){C(this,v$);let T=dw($);return e4(V(this,Z$),V(this,y$),T)}add($,T=void 0){return C(this,v$),aE("add",this,$,T)}subtract($,T=void 0){return C(this,v$),aE("subtract",this,$,T)}until($,T=void 0){return C(this,v$),dE("until",this,$,T)}since($,T=void 0){return C(this,v$),dE("since",this,$,T)}round($){if(C(this,v$),$===void 0)throw new TypeError("options parameter is required");let T=typeof $=="string"?DW("smallestUnit",$):X$($),W=m2(T),w=x1(T,"halfExpand"),X=h6(T,"smallestUnit","time",x0,["day"]),U={day:1,hour:24,minute:60,second:60,millisecond:1000,microsecond:1000,nanosecond:1000}[X];if(c2(W,U,U===1),X==="nanosecond"&&W===1)return e4(V(this,Z$),V(this,y$),V(this,u));let Y=V(this,y$),G=V(this,Z$),H=a1(this),z;if(X==="day"){let F=H.isoDate,O=g6(F.year,F.month,F.day+1),Q=KT(Y,F),Z=KT(Y,O),K=P.subtract(Z,Q);z=q$.fromEpochNsDiff(G,Q).round(K,w).addToEpochNs(Q)}else{let F=VO(H,W,X,w),O=C0(Y,G);z=yG(F.isoDate,F.time,"option",O,Y,"compatible","prefer",!1)}return e4(z,Y,V(this,u))}equals($){C(this,v$);let T=Mw($),W=V(this,Z$),w=V(T,Z$);return!!P.equal(P.BigInt(W),P.BigInt(w))&&!!IM(V(this,y$),V(T,y$))&&W0(V(this,u),V(T,u))}toString($=void 0){C(this,v$);let T=X$($),W=hw(T),w=gw(T),X=function(O){return I0(O,"offset",["auto","never"],"auto")}(T),U=x1(T,"trunc"),Y=h6(T,"smallestUnit","time",void 0);if(Y==="hour")throw new RangeError('smallestUnit must be a time unit other than "hour"');let G=function(O){return I0(O,"timeZoneName",["auto","never","critical"],"auto")}(T),{precision:H,unit:z,increment:F}=mw(Y,w);return fE(this,H,W,G,X,{unit:z,increment:F,roundingMode:U})}toLocaleString($=void 0,T=void 0){C(this,v$);let W=X$(T),w=Object.create(null);if(function(G,H,z,F){if(H==null)return;let O=Reflect.ownKeys(H);for(let Q=0;Q<O.length;Q++){let Z=O[Q];if(!z.some((K)=>Object.is(K,Z))&&Object.prototype.propertyIsEnumerable.call(H,Z)){let K=H[Z];G[Z]=K}}}(w,W,["timeZone"]),W.timeZone!==void 0)throw new TypeError("ZonedDateTime toLocaleString does not accept a timeZone option");if(w.year===void 0&&w.month===void 0&&w.day===void 0&&w.era===void 0&&w.weekday===void 0&&w.dateStyle===void 0&&w.hour===void 0&&w.minute===void 0&&w.second===void 0&&w.fractionalSecondDigits===void 0&&w.timeStyle===void 0&&w.dayPeriod===void 0&&w.timeZoneName===void 0&&(w.timeZoneName="short"),w.timeZone=V(this,y$),bE(w.timeZone))throw new RangeError("toLocaleString does not currently support offset time zones");let X=new Y1($,w),U=vI.call(X).calendar,Y=V(this,u);if(Y!=="iso8601"&&U!=="iso8601"&&!W0(U,Y))throw new RangeError(`cannot format ZonedDateTime with calendar ${Y} in locale with calendar ${U}`);return X.format(I1(V(this,Z$)))}toJSON(){return C(this,v$),fE(this,"auto")}valueOf(){_T("ZonedDateTime")}startOfDay(){C(this,v$);let $=V(this,y$);return e4(KT($,a1(this).isoDate),$,V(this,u))}getTimeZoneTransition($){C(this,v$);let T=V(this,y$);if($===void 0)throw new TypeError("options parameter is required");let W=I0(typeof $=="string"?DW("direction",$):X$($),"direction",["next","previous"],x0);if(W===void 0)throw new TypeError("direction option is required");if(bE(T)||T==="UTC")return null;let w=V(this,Z$),X=W==="next"?RO(T,w):FO(T,w);return X===null?null:e4(X,T,V(this,u))}toInstant(){return C(this,v$),I1(V(this,Z$))}toPlainDate(){return C(this,v$),J6(a1(this).isoDate,V(this,u))}toPlainTime(){return C(this,v$),P0(a1(this).time)}toPlainDateTime(){return C(this,v$),K1(a1(this),V(this,u))}static from($,T=void 0){return Mw($,T)}static compare($,T){let W=Mw($),w=Mw(T),X=V(W,Z$),U=V(w,Z$);return P.lessThan(P.BigInt(X),P.BigInt(U))?-1:P.greaterThan(P.BigInt(X),P.BigInt(U))?1:0}}function a1($){return M1(V($,y$),V($,Z$))}function Q6($,T){C($,v$);let W=a1($).isoDate;return cw($).isoToDate(W,{[T]:!0})[T]}function R2($,T){return C($,v$),a1($).time[T]}b0(O9,"Temporal.ZonedDateTime");var Q9=Object.freeze({__proto__:null,Duration:h2,Instant:Y9,Now:DD,PlainDate:G9,PlainDateTime:z9,PlainMonthDay:H9,PlainTime:tw,PlainYearMonth:F9,ZonedDateTime:O9}),yt=class ${toTemporalInstant(){return I1(B1(Date.prototype.valueOf.call(this)))}}.prototype.toTemporalInstant,qI=[Y9,G9,z9,h2,H9,tw,F9,O9];for(let $ of qI){let T=Object.getOwnPropertyDescriptor($,"prototype");(T.configurable||T.enumerable||T.writable)&&(T.configurable=!1,T.enumerable=!1,T.writable=!1,Object.defineProperty($,"prototype",T))}class Z9{supported;constructor($){this.supported=$}refine($){for(let[T,W]of Object.entries(this.supported))try{if(W($)===!0&&W!==Boolean)return{type:T,data:$}}catch(w){try{if($ instanceof W)return{type:T,data:$}}catch(X){}}return null}}var PI=new Z9({number:($)=>typeof $==="number",string:($)=>typeof $==="string",boolean:($)=>typeof $==="boolean",null:($)=>$===null});function CI($){if(!$)return!1;return Object.getPrototypeOf($)===Object.prototype}var SI=new Z9({object:CI,array:($)=>Array.isArray($)}),jI=new Z9({...PI.supported,...SI.supported}),ND=($)=>{if($===void 0)return"undefined";let T=jI.refine($);if(T)return T.type;return Object.getPrototypeOf($).constructor.name};var N=Symbol.for("drizzle:entityKind"),mt=Symbol.for("drizzle:hasOwnEntityKind");function I($,T){if(!$||typeof $!=="object")return!1;if($ instanceof T)return!0;if(!Object.prototype.hasOwnProperty.call(T,N))throw new Error(`Class "${T.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 W=Object.getPrototypeOf($).constructor;if(W)while(W){if(N in W&&W[N]===T[N])return!0;W=Object.getPrototypeOf(W)}return!1}class p${constructor($,T){this.table=$,this.config=T,this.name=T.name,this.keyAsName=T.keyAsName,this.notNull=T.notNull,this.default=T.default,this.defaultFn=T.defaultFn,this.onUpdateFn=T.onUpdateFn,this.hasDefault=T.hasDefault,this.primary=T.primaryKey,this.isUnique=T.isUnique,this.uniqueName=T.uniqueName,this.uniqueType=T.uniqueType,this.dataType=T.dataType,this.columnType=T.columnType,this.generated=T.generated,this.generatedIdentity=T.generatedIdentity}static[N]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue($){return $}mapToDriverValue($){return $}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class fO{static[N]="ColumnBuilder";config;constructor($,T,W){this.config={name:$,keyAsName:$==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:T,columnType:W,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default($){return this.config.default=$,this.config.hasDefault=!0,this}$defaultFn($){return this.config.defaultFn=$,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn($){return this.config.onUpdateFn=$,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName($){if(this.config.name!=="")return;this.config.name=$}}var f1=Symbol.for("drizzle:Name");class bO{static[N]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor($,T){if(this.reference=()=>{let{name:W,columns:w,foreignColumns:X}=$();return{name:W,columns:w,foreignTable:X[0].table,foreignColumns:X}},T)this._onUpdate=T.onUpdate,this._onDelete=T.onDelete}onUpdate($){return this._onUpdate=$===void 0?"no action":$,this}onDelete($){return this._onDelete=$===void 0?"no action":$,this}build($){return new LD($,this)}}class LD{constructor($,T){this.table=$,this.reference=T.reference,this.onUpdate=T._onUpdate,this.onDelete=T._onDelete}static[N]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:$,columns:T,foreignColumns:W}=this.reference(),w=T.map((Y)=>Y.name),X=W.map((Y)=>Y.name),U=[this.table[f1],...w,W[0].table[f1],...X];return $??`${U.join("_")}_fk`}}function V9($,...T){return $(...T)}function JD($,T){return`${$[f1]}_${T.join("_")}_unique`}function RD($,T,W){for(let w=T;w<$.length;w++){let X=$[w];if(X==="\\"){w++;continue}if(X==='"')return[$.slice(T,w).replace(/\\/g,""),w+1];if(W)continue;if(X===","||X==="}")return[$.slice(T,w).replace(/\\/g,""),w]}return[$.slice(T).replace(/\\/g,""),$.length]}function _D($,T=0){let W=[],w=T,X=!1;while(w<$.length){let U=$[w];if(U===","){if(X||w===T)W.push("");X=!0,w++;continue}if(X=!1,U==="\\"){w+=2;continue}if(U==='"'){let[H,z]=RD($,w+1,!0);W.push(H),w=z;continue}if(U==="}")return[W,w+1];if(U==="{"){let[H,z]=_D($,w+1);W.push(H),w=z;continue}let[Y,G]=RD($,w,!1);W.push(Y),w=G}return[W,w]}function kD($){let[T]=_D($,1);return T}function yO($){return`{${$.map((T)=>{if(Array.isArray(T))return yO(T);if(typeof T==="string")return`"${T.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${T}`}).join(",")}}`}class e extends fO{foreignKeyConfigs=[];static[N]="PgColumnBuilder";array($){return new qD(this.config.name,this,$)}references($,T={}){return this.foreignKeyConfigs.push({ref:$,actions:T}),this}unique($,T){return this.config.isUnique=!0,this.config.uniqueName=$,this.config.uniqueType=T?.nulls,this}generatedAlwaysAs($){return this.config.generated={as:$,type:"always",mode:"stored"},this}buildForeignKeys($,T){return this.foreignKeyConfigs.map(({ref:W,actions:w})=>{return V9((X,U)=>{let Y=new bO(()=>{let G=X();return{columns:[$],foreignColumns:[G]}});if(U.onUpdate)Y.onUpdate(U.onUpdate);if(U.onDelete)Y.onDelete(U.onDelete);return Y.build(T)},W,w)})}buildExtraConfigColumn($){return new vD($,this.config)}}class d extends p${constructor($,T){if(!T.uniqueName)T.uniqueName=JD($,[T.name]);super($,T);this.table=$}static[N]="PgColumn"}class vD extends d{static[N]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op($){return this.indexConfig.opClass=$,this}}class aw{static[N]="IndexedColumn";constructor($,T,W,w){this.name=$,this.keyAsName=T,this.type=W,this.indexConfig=w}name;keyAsName;type;indexConfig}class qD extends e{static[N]="PgArrayBuilder";constructor($,T,W){super($,"array","PgArray");this.config.baseBuilder=T,this.config.size=W}build($){let T=this.config.baseBuilder.build($);return new hO($,this.config,T)}}class hO extends d{constructor($,T,W,w){super($,T);this.baseColumn=W,this.range=w,this.size=T.size}size;static[N]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue($){if(typeof $==="string")$=kD($);return $.map((T)=>this.baseColumn.mapFromDriverValue(T))}mapToDriverValue($,T=!1){let W=$.map((w)=>w===null?null:I(this.baseColumn,hO)?this.baseColumn.mapToDriverValue(w,!0):this.baseColumn.mapToDriverValue(w));if(T)return W;return yO(W)}}class PD extends e{static[N]="PgEnumObjectColumnBuilder";constructor($,T){super($,"string","PgEnumObjectColumn");this.config.enum=T}build($){return new CD($,this.config)}}class CD extends d{static[N]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor($,T){super($,T);this.enum=T.enum}getSQLType(){return this.enum.enumName}}var K9=Symbol.for("drizzle:isPgEnum");function SD($){return!!$&&typeof $==="function"&&K9 in $&&$[K9]===!0}class jD extends e{static[N]="PgEnumColumnBuilder";constructor($,T){super($,"string","PgEnumColumn");this.config.enum=T}build($){return new ID($,this.config)}}class ID extends d{static[N]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor($,T){super($,T);this.enum=T.enum}getSQLType(){return this.enum.enumName}}function sw($,T){return Array.isArray(T)?II($,[...T],void 0):BI($,T,void 0)}function II($,T,W){let w=Object.assign((X)=>new jD(X??"",w),{enumName:$,enumValues:T,schema:W,[K9]:!0});return w}function BI($,T,W){let w=Object.assign((X)=>new PD(X??"",w),{enumName:$,enumValues:Object.values(T),schema:W,[K9]:!0});return w}class M4{static[N]="Subquery";constructor($,T,W,w=!1,X=[]){this._={brand:"Subquery",sql:$,selectedFields:T,alias:W,isWith:w,usedTables:X}}}class ew extends M4{static[N]="WithSubquery"}var BD="0.44.1";var gO,mO,d$={startActiveSpan($,T){if(!gO)return T();if(!mO)mO=gO.trace.getTracer("drizzle-orm",BD);return V9((W,w)=>w.startActiveSpan($,(X)=>{try{return T(X)}catch(U){throw X.setStatus({code:W.SpanStatusCode.ERROR,message:U instanceof Error?U.message:"Unknown error"}),U}finally{X.end()}}),gO,mO)}};var t$=Symbol.for("drizzle:ViewBaseConfig");var _W=Symbol.for("drizzle:Schema"),A9=Symbol.for("drizzle:Columns"),xD=Symbol.for("drizzle:ExtraConfigColumns"),cO=Symbol.for("drizzle:OriginalName"),uO=Symbol.for("drizzle:BaseName"),$U=Symbol.for("drizzle:IsAlias"),fD=Symbol.for("drizzle:ExtraConfigBuilder"),xI=Symbol.for("drizzle:IsDrizzleTable");class o{static[N]="Table";static Symbol={Name:f1,Schema:_W,OriginalName:cO,Columns:A9,ExtraConfigColumns:xD,BaseName:uO,IsAlias:$U,ExtraConfigBuilder:fD};[f1];[cO];[_W];[A9];[xD];[uO];[$U]=!1;[xI]=!0;[fD]=void 0;constructor($,T,W){this[f1]=this[cO]=$,this[_W]=T,this[uO]=W}}function u4($){return $[f1]}function kW($){return`${$[_W]??"public"}.${$[f1]}`}function pO($){return $!==null&&$!==void 0&&typeof $.getSQL==="function"}function fI($){let T={sql:"",params:[]};for(let W of $)if(T.sql+=W.sql,T.params.push(...W.params),W.typings?.length){if(!T.typings)T.typings=[];T.typings.push(...W.typings)}return T}class B4{static[N]="StringChunk";value;constructor($){this.value=Array.isArray($)?$:[$]}getSQL(){return new s([this])}}class s{constructor($){this.queryChunks=$;for(let T of $)if(I(T,o)){let W=T[o.Symbol.Schema];this.usedTables.push(W===void 0?T[o.Symbol.Name]:W+"."+T[o.Symbol.Name])}}static[N]="SQL";decoder=yD;shouldInlineParams=!1;usedTables=[];append($){return this.queryChunks.push(...$.queryChunks),this}toQuery($){return d$.startActiveSpan("drizzle.buildSQL",(T)=>{let W=this.buildQueryFromSourceParams(this.queryChunks,$);return T?.setAttributes({"drizzle.query.text":W.sql,"drizzle.query.params":JSON.stringify(W.params)}),W})}buildQueryFromSourceParams($,T){let W=Object.assign({},T,{inlineParams:T.inlineParams||this.shouldInlineParams,paramStartIndex:T.paramStartIndex||{value:0}}),{casing:w,escapeName:X,escapeParam:U,prepareTyping:Y,inlineParams:G,paramStartIndex:H}=W;return fI($.map((z)=>{if(I(z,B4))return{sql:z.value.join(""),params:[]};if(I(z,E9))return{sql:X(z.value),params:[]};if(z===void 0)return{sql:"",params:[]};if(Array.isArray(z)){let F=[new B4("(")];for(let[O,Q]of z.entries())if(F.push(Q),O<z.length-1)F.push(new B4(", "));return F.push(new B4(")")),this.buildQueryFromSourceParams(F,W)}if(I(z,s))return this.buildQueryFromSourceParams(z.queryChunks,{...W,inlineParams:G||z.shouldInlineParams});if(I(z,o)){let F=z[o.Symbol.Schema],O=z[o.Symbol.Name];return{sql:F===void 0||z[$U]?X(O):X(F)+"."+X(O),params:[]}}if(I(z,p$)){let F=w.getColumnCasing(z);if(T.invokeSource==="indexes")return{sql:X(F),params:[]};let O=z.table[o.Symbol.Schema];return{sql:z.table[$U]||O===void 0?X(z.table[o.Symbol.Name])+"."+X(F):X(O)+"."+X(z.table[o.Symbol.Name])+"."+X(F),params:[]}}if(I(z,c6)){let F=z[t$].schema,O=z[t$].name;return{sql:F===void 0||z[t$].isAlias?X(O):X(F)+"."+X(O),params:[]}}if(I(z,F1)){if(I(z.value,vT))return{sql:U(H.value++,z),params:[z],typings:["none"]};let F=z.value===null?null:z.encoder.mapToDriverValue(z.value);if(I(F,s))return this.buildQueryFromSourceParams([F],W);if(G)return{sql:this.mapInlineParam(F,W),params:[]};let O=["none"];if(Y)O=[Y(z.encoder)];return{sql:U(H.value++,F),params:[F],typings:O}}if(I(z,vT))return{sql:U(H.value++,z),params:[z],typings:["none"]};if(I(z,s.Aliased)&&z.fieldAlias!==void 0)return{sql:X(z.fieldAlias),params:[]};if(I(z,M4)){if(z._.isWith)return{sql:X(z._.alias),params:[]};return this.buildQueryFromSourceParams([new B4("("),z._.sql,new B4(") "),new E9(z._.alias)],W)}if(SD(z)){if(z.schema)return{sql:X(z.schema)+"."+X(z.enumName),params:[]};return{sql:X(z.enumName),params:[]}}if(pO(z)){if(z.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([z.getSQL()],W);return this.buildQueryFromSourceParams([new B4("("),z.getSQL(),new B4(")")],W)}if(G)return{sql:this.mapInlineParam(z,W),params:[]};return{sql:U(H.value++,z),params:[z],typings:["none"]}}))}mapInlineParam($,{escapeString:T}){if($===null)return"null";if(typeof $==="number"||typeof $==="boolean")return $.toString();if(typeof $==="string")return T($);if(typeof $==="object"){let W=$.toString();if(W==="[object Object]")return T(JSON.stringify($));return T(W)}throw new Error("Unexpected param value: "+$)}getSQL(){return this}as($){if($===void 0)return this;return new s.Aliased(this,$)}mapWith($){return this.decoder=typeof $==="function"?{mapFromDriverValue:$}:$,this}inlineParams(){return this.shouldInlineParams=!0,this}if($){return $?this:void 0}}class E9{constructor($){this.value=$}static[N]="Name";brand;getSQL(){return new s([this])}}function bD($){return typeof $==="object"&&$!==null&&"mapToDriverValue"in $&&typeof $.mapToDriverValue==="function"}var yD={mapFromDriverValue:($)=>$},hD={mapToDriverValue:($)=>$},Pa={...yD,...hD};class F1{constructor($,T=hD){this.value=$,this.encoder=T}static[N]="Param";brand;getSQL(){return new s([this])}}function J($,...T){let W=[];if(T.length>0||$.length>0&&$[0]!=="")W.push(new B4($[0]));for(let[w,X]of T.entries())W.push(X,new B4($[w+1]));return new s(W)}(($)=>{function T(){return new s([])}$.empty=T;function W(H){return new s(H)}$.fromList=W;function w(H){return new s([new B4(H)])}$.raw=w;function X(H,z){let F=[];for(let[O,Q]of H.entries()){if(O>0&&z!==void 0)F.push(z);F.push(Q)}return new s(F)}$.join=X;function U(H){return new E9(H)}$.identifier=U;function Y(H){return new vT(H)}$.placeholder=Y;function G(H,z){return new F1(H,z)}$.param=G})(J||(J={}));(($)=>{class T{constructor(W,w){this.sql=W,this.fieldAlias=w}static[N]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new T(this.sql,this.fieldAlias)}}$.Aliased=T})(s||(s={}));class vT{constructor($){this.name=$}static[N]="Placeholder";getSQL(){return new s([this])}}function dO($,T){return $.map((W)=>{if(I(W,vT)){if(!(W.name in T))throw new Error(`No value for placeholder "${W.name}" was provided`);return T[W.name]}if(I(W,F1)&&I(W.value,vT)){if(!(W.value.name in T))throw new Error(`No value for placeholder "${W.value.name}" was provided`);return W.encoder.mapToDriverValue(T[W.value.name])}return W})}var bI=Symbol.for("drizzle:IsDrizzleView");class c6{static[N]="View";[t$];[bI]=!0;constructor({name:$,schema:T,selectedFields:W,query:w}){this[t$]={name:$,originalName:$,schema:T,selectedFields:W,query:w,isExisting:!w,isAlias:!1}}getSQL(){return new s([this])}}p$.prototype.getSQL=function(){return new s([this])};o.prototype.getSQL=function(){return new s([this])};M4.prototype.getSQL=function(){return new s([this])};class d2{constructor($){this.table=$}static[N]="ColumnAliasProxyHandler";get($,T){if(T==="table")return this.table;return $[T]}}class TU{constructor($,T){this.alias=$,this.replaceOriginalName=T}static[N]="TableAliasProxyHandler";get($,T){if(T===o.Symbol.IsAlias)return!0;if(T===o.Symbol.Name)return this.alias;if(this.replaceOriginalName&&T===o.Symbol.OriginalName)return this.alias;if(T===t$)return{...$[t$],name:this.alias,isAlias:!0};if(T===o.Symbol.Columns){let w=$[o.Symbol.Columns];if(!w)return w;let X={};return Object.keys(w).map((U)=>{X[U]=new Proxy(w[U],new d2(new Proxy($,this)))}),X}let W=$[T];if(I(W,p$))return new Proxy(W,new d2(new Proxy($,this)));return W}}function M9($,T){return new Proxy($,new TU(T,!1))}function Y0($,T){return new Proxy($,new d2(new Proxy($.table,new TU(T,!1))))}function oO($,T){return new s.Aliased(WU($.sql,T),$.fieldAlias)}function WU($,T){return J.join($.queryChunks.map((W)=>{if(I(W,p$))return Y0(W,T);if(I(W,s))return WU(W,T);if(I(W,s.Aliased))return oO(W,T);return W}))}class D9 extends Error{static[N]="DrizzleError";constructor({message:$,cause:T}){super($);this.name="DrizzleError",this.cause=T}}class lO extends D9{static[N]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class gD{static[N]="ConsoleLogWriter";write($){console.log($)}}class rO{static[N]="DefaultLogger";writer;constructor($){this.writer=$?.writer??new gD}logQuery($,T){let W=T.map((X)=>{try{return JSON.stringify(X)}catch{return String(X)}}),w=W.length?` -- params: [${W.join(", ")}]`:"";this.writer.write(`Query: ${$}${w}`)}}class nO{static[N]="NoopLogger";logQuery(){}}class q6{static[N]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch($){return this.then(void 0,$)}finally($){return this.then((T)=>{return $?.(),T},(T)=>{throw $?.(),T})}then($,T){return this.execute().then($,T)}}function mD($,T,W){let w={},X=$.reduce((U,{path:Y,field:G},H)=>{let z;if(I(G,p$))z=G;else if(I(G,s))z=G.decoder;else z=G.sql.decoder;let F=U;for(let[O,Q]of Y.entries())if(O<Y.length-1){if(!(Q in F))F[Q]={};F=F[Q]}else{let Z=T[H],K=F[Q]=Z===null?null:z.mapFromDriverValue(Z);if(W&&I(G,p$)&&Y.length===2){let E=Y[0];if(!(E in w))w[E]=K===null?u4(G.table):!1;else if(typeof w[E]==="string"&&w[E]!==u4(G.table))w[E]=!1}}return U},{});if(W&&Object.keys(w).length>0){for(let[U,Y]of Object.entries(w))if(typeof Y==="string"&&!W[Y])X[U]=null}return X}function N1($,T){return Object.entries($).reduce((W,[w,X])=>{if(typeof w!=="string")return W;let U=T?[...T,w]:[w];if(I(X,p$)||I(X,s)||I(X,s.Aliased))W.push({path:U,field:X});else if(I(X,o))W.push(...N1(X[o.Symbol.Columns],U));else W.push(...N1(X,U));return W},[])}function XU($,T){let W=Object.keys($),w=Object.keys(T);if(W.length!==w.length)return!1;for(let[X,U]of W.entries())if(U!==w[X])return!1;return!0}function N9($,T){let W=Object.entries(T).filter(([,w])=>w!==void 0).map(([w,X])=>{if(I(X,s)||I(X,p$))return[w,X];else return[w,new F1(X,$[o.Symbol.Columns][w])]});if(W.length===0)throw new Error("No values to set");return Object.fromEntries(W)}function cD($,T){for(let W of T)for(let w of Object.getOwnPropertyNames(W.prototype)){if(w==="constructor")continue;Object.defineProperty($.prototype,w,Object.getOwnPropertyDescriptor(W.prototype,w)||Object.create(null))}}function uD($){return $[o.Symbol.Columns]}function y0($){return I($,M4)?$._.alias:I($,c6)?$[t$].name:I($,s)?void 0:$[o.Symbol.IsAlias]?$[o.Symbol.Name]:$[o.Symbol.BaseName]}function S$($,T){return{name:typeof $==="string"&&$.length>0?$:"",config:typeof $==="object"?$:T}}function pD($){if(typeof $!=="object"||$===null)return!1;if($.constructor.name!=="Object")return!1;if("logger"in $){let T=typeof $.logger;if(T!=="boolean"&&(T!=="object"||typeof $.logger.logQuery!=="function")&&T!=="undefined")return!1;return!0}if("schema"in $){let T=typeof $.schema;if(T!=="object"&&T!=="undefined")return!1;return!0}if("casing"in $){let T=typeof $.casing;if(T!=="string"&&T!=="undefined")return!1;return!0}if("mode"in $){if($.mode!=="default"||$.mode!=="planetscale"||$.mode!==void 0)return!1;return!0}if("connection"in $){let T=typeof $.connection;if(T!=="string"&&T!=="object"&&T!=="undefined")return!1;return!0}if("client"in $){let T=typeof $.client;if(T!=="object"&&T!=="function"&&T!=="undefined")return!1;return!0}if(Object.keys($).length===0)return!0;return!1}class qT extends e{static[N]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity($){if($){let{name:T,...W}=$;this.config.generatedIdentity={type:"always",sequenceName:T,sequenceOptions:W}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity($){if($){let{name:T,...W}=$;this.config.generatedIdentity={type:"byDefault",sequenceName:T,sequenceOptions:W}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class dD extends qT{static[N]="PgBigInt53Builder";constructor($){super($,"number","PgBigInt53")}build($){return new oD($,this.config)}}class oD extends d{static[N]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class lD extends qT{static[N]="PgBigInt64Builder";constructor($){super($,"bigint","PgBigInt64")}build($){return new rD($,this.config)}}class rD extends d{static[N]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue($){return BigInt($)}}function nD($,T){let{name:W,config:w}=S$($,T);if(w.mode==="number")return new dD(W);return new lD(W)}class iD extends e{static[N]="PgBigSerial53Builder";constructor($){super($,"number","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new tD($,this.config)}}class tD extends d{static[N]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}}class aD extends e{static[N]="PgBigSerial64Builder";constructor($){super($,"bigint","PgBigSerial64");this.config.hasDefault=!0}build($){return new sD($,this.config)}}class sD extends d{static[N]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue($){return BigInt($)}}function eD($,T){let{name:W,config:w}=S$($,T);if(w.mode==="number")return new iD(W);return new aD(W)}class $N extends e{static[N]="PgBooleanBuilder";constructor($){super($,"boolean","PgBoolean")}build($){return new TN($,this.config)}}class TN extends d{static[N]="PgBoolean";getSQLType(){return"boolean"}}function wU($){return new $N($??"")}class WN extends e{static[N]="PgCharBuilder";constructor($,T){super($,"string","PgChar");this.config.length=T.length,this.config.enumValues=T.enum}build($){return new XN($,this.config)}}class XN extends d{static[N]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function wN($,T={}){let{name:W,config:w}=S$($,T);return new WN(W,w)}class UN extends e{static[N]="PgCidrBuilder";constructor($){super($,"string","PgCidr")}build($){return new YN($,this.config)}}class YN extends d{static[N]="PgCidr";getSQLType(){return"cidr"}}function GN($){return new UN($??"")}class zN extends e{static[N]="PgCustomColumnBuilder";constructor($,T,W){super($,"custom","PgCustomColumn");this.config.fieldConfig=T,this.config.customTypeParams=W}build($){return new HN($,this.config)}}class HN extends d{static[N]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor($,T){super($,T);this.sqlName=T.customTypeParams.dataType(T.fieldConfig),this.mapTo=T.customTypeParams.toDriver,this.mapFrom=T.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue($){return typeof this.mapFrom==="function"?this.mapFrom($):$}mapToDriverValue($){return typeof this.mapTo==="function"?this.mapTo($):$}}function FN($){return(T,W)=>{let{name:w,config:X}=S$(T,W);return new zN(w,X,$)}}class h0 extends e{static[N]="PgDateColumnBaseBuilder";defaultNow(){return this.default(J`now()`)}}class ON extends h0{static[N]="PgDateBuilder";constructor($){super($,"date","PgDate")}build($){return new L9($,this.config)}}class L9 extends d{static[N]="PgDate";getSQLType(){return"date"}mapFromDriverValue($){return new Date($)}mapToDriverValue($){return $.toISOString()}}class QN extends h0{static[N]="PgDateStringBuilder";constructor($){super($,"string","PgDateString")}build($){return new J9($,this.config)}}class J9 extends d{static[N]="PgDateString";getSQLType(){return"date"}}function ZN($,T){let{name:W,config:w}=S$($,T);if(w?.mode==="date")return new ON(W);return new QN(W)}class VN extends e{static[N]="PgDoublePrecisionBuilder";constructor($){super($,"number","PgDoublePrecision")}build($){return new KN($,this.config)}}class KN extends d{static[N]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue($){if(typeof $==="string")return Number.parseFloat($);return $}}function AN($){return new VN($??"")}class EN extends e{static[N]="PgInetBuilder";constructor($){super($,"string","PgInet")}build($){return new MN($,this.config)}}class MN extends d{static[N]="PgInet";getSQLType(){return"inet"}}function DN($){return new EN($??"")}class NN extends qT{static[N]="PgIntegerBuilder";constructor($){super($,"number","PgInteger")}build($){return new LN($,this.config)}}class LN extends d{static[N]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue($){if(typeof $==="string")return Number.parseInt($);return $}}function UU($){return new NN($??"")}class JN extends e{static[N]="PgIntervalBuilder";constructor($,T){super($,"string","PgInterval");this.config.intervalConfig=T}build($){return new RN($,this.config)}}class RN extends d{static[N]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let $=this.fields?` ${this.fields}`:"",T=this.precision?`(${this.precision})`:"";return`interval${$}${T}`}}function _N($,T={}){let{name:W,config:w}=S$($,T);return new JN(W,w)}class kN extends e{static[N]="PgJsonBuilder";constructor($){super($,"json","PgJson")}build($){return new R9($,this.config)}}class R9 extends d{static[N]="PgJson";constructor($,T){super($,T)}getSQLType(){return"json"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function vN($){return new kN($??"")}class qN extends e{static[N]="PgJsonbBuilder";constructor($){super($,"json","PgJsonb")}build($){return new _9($,this.config)}}class _9 extends d{static[N]="PgJsonb";constructor($,T){super($,T)}getSQLType(){return"jsonb"}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){if(typeof $==="string")try{return JSON.parse($)}catch{return $}return $}}function PN($){return new qN($??"")}class CN extends e{static[N]="PgLineBuilder";constructor($){super($,"array","PgLine")}build($){return new SN($,this.config)}}class SN extends d{static[N]="PgLine";getSQLType(){return"line"}mapFromDriverValue($){let[T,W,w]=$.slice(1,-1).split(",");return[Number.parseFloat(T),Number.parseFloat(W),Number.parseFloat(w)]}mapToDriverValue($){return`{${$[0]},${$[1]},${$[2]}}`}}class jN extends e{static[N]="PgLineABCBuilder";constructor($){super($,"json","PgLineABC")}build($){return new IN($,this.config)}}class IN extends d{static[N]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue($){let[T,W,w]=$.slice(1,-1).split(",");return{a:Number.parseFloat(T),b:Number.parseFloat(W),c:Number.parseFloat(w)}}mapToDriverValue($){return`{${$.a},${$.b},${$.c}}`}}function BN($,T){let{name:W,config:w}=S$($,T);if(!w?.mode||w.mode==="tuple")return new CN(W);return new jN(W)}class xN extends e{static[N]="PgMacaddrBuilder";constructor($){super($,"string","PgMacaddr")}build($){return new fN($,this.config)}}class fN extends d{static[N]="PgMacaddr";getSQLType(){return"macaddr"}}function bN($){return new xN($??"")}class yN extends e{static[N]="PgMacaddr8Builder";constructor($){super($,"string","PgMacaddr8")}build($){return new hN($,this.config)}}class hN extends d{static[N]="PgMacaddr8";getSQLType(){return"macaddr8"}}function gN($){return new yN($??"")}class mN extends e{static[N]="PgNumericBuilder";constructor($,T,W){super($,"string","PgNumeric");this.config.precision=T,this.config.scale=W}build($){return new k9($,this.config)}}class k9 extends d{static[N]="PgNumeric";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.scale}mapFromDriverValue($){if(typeof $==="string")return $;return 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 cN extends e{static[N]="PgNumericNumberBuilder";constructor($,T,W){super($,"number","PgNumericNumber");this.config.precision=T,this.config.scale=W}build($){return new uN($,this.config)}}class uN extends d{static[N]="PgNumericNumber";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.scale}mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}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 pN extends e{static[N]="PgNumericBigIntBuilder";constructor($,T,W){super($,"bigint","PgNumericBigInt");this.config.precision=T,this.config.scale=W}build($){return new dN($,this.config)}}class dN extends d{static[N]="PgNumericBigInt";precision;scale;constructor($,T){super($,T);this.precision=T.precision,this.scale=T.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 oN($,T){let{name:W,config:w}=S$($,T),X=w?.mode;return X==="number"?new cN(W,w?.precision,w?.scale):X==="bigint"?new pN(W,w?.precision,w?.scale):new mN(W,w?.precision,w?.scale)}class lN extends e{static[N]="PgPointTupleBuilder";constructor($){super($,"array","PgPointTuple")}build($){return new rN($,this.config)}}class rN extends d{static[N]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[T,W]=$.slice(1,-1).split(",");return[Number.parseFloat(T),Number.parseFloat(W)]}return[$.x,$.y]}mapToDriverValue($){return`(${$[0]},${$[1]})`}}class nN extends e{static[N]="PgPointObjectBuilder";constructor($){super($,"json","PgPointObject")}build($){return new iN($,this.config)}}class iN extends d{static[N]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue($){if(typeof $==="string"){let[T,W]=$.slice(1,-1).split(",");return{x:Number.parseFloat(T),y:Number.parseFloat(W)}}return $}mapToDriverValue($){return`(${$.x},${$.y})`}}function tN($,T){let{name:W,config:w}=S$($,T);if(!w?.mode||w.mode==="tuple")return new lN(W);return new nN(W)}function yI($){let T=[];for(let W=0;W<$.length;W+=2)T.push(Number.parseInt($.slice(W,W+2),16));return new Uint8Array(T)}function aN($,T){let W=new ArrayBuffer(8),w=new DataView(W);for(let X=0;X<8;X++)w.setUint8(X,$[T+X]);return w.getFloat64(0,!0)}function iO($){let T=yI($),W=0,w=T[W];W+=1;let X=new DataView(T.buffer),U=X.getUint32(W,w===1);W+=4;let Y;if(U&536870912)Y=X.getUint32(W,w===1),W+=4;if((U&65535)===1){let G=aN(T,W);W+=8;let H=aN(T,W);return W+=8,[G,H]}throw new Error("Unsupported geometry type")}class sN extends e{static[N]="PgGeometryBuilder";constructor($){super($,"array","PgGeometry")}build($){return new eN($,this.config)}}class eN extends d{static[N]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue($){return iO($)}mapToDriverValue($){return`point(${$[0]} ${$[1]})`}}class $L extends e{static[N]="PgGeometryObjectBuilder";constructor($){super($,"json","PgGeometryObject")}build($){return new TL($,this.config)}}class TL extends d{static[N]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue($){let T=iO($);return{x:T[0],y:T[1]}}mapToDriverValue($){return`point(${$.x} ${$.y})`}}function WL($,T){let{name:W,config:w}=S$($,T);if(!w?.mode||w.mode==="tuple")return new sN(W);return new $L(W)}class XL extends e{static[N]="PgRealBuilder";constructor($,T){super($,"number","PgReal");this.config.length=T}build($){return new wL($,this.config)}}class wL extends d{static[N]="PgReal";constructor($,T){super($,T)}getSQLType(){return"real"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number.parseFloat($);return $}}function UL($){return new XL($??"")}class YL extends e{static[N]="PgSerialBuilder";constructor($){super($,"number","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new GL($,this.config)}}class GL extends d{static[N]="PgSerial";getSQLType(){return"serial"}}function zL($){return new YL($??"")}class HL extends qT{static[N]="PgSmallIntBuilder";constructor($){super($,"number","PgSmallInt")}build($){return new FL($,this.config)}}class FL extends d{static[N]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=($)=>{if(typeof $==="string")return Number($);return $}}function OL($){return new HL($??"")}class QL extends e{static[N]="PgSmallSerialBuilder";constructor($){super($,"number","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build($){return new ZL($,this.config)}}class ZL extends d{static[N]="PgSmallSerial";getSQLType(){return"smallserial"}}function VL($){return new QL($??"")}class KL extends e{static[N]="PgTextBuilder";constructor($,T){super($,"string","PgText");this.config.enumValues=T.enum}build($){return new AL($,this.config)}}class AL extends d{static[N]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function EL($,T={}){let{name:W,config:w}=S$($,T);return new KL(W,w)}class ML extends h0{constructor($,T,W){super($,"string","PgTime");this.withTimezone=T,this.precision=W,this.config.withTimezone=T,this.config.precision=W}static[N]="PgTimeBuilder";build($){return new v9($,this.config)}}class v9 extends d{static[N]="PgTime";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function DL($,T={}){let{name:W,config:w}=S$($,T);return new ML(W,w.withTimezone??!1,w.precision)}class NL extends h0{static[N]="PgTimestampBuilder";constructor($,T,W){super($,"date","PgTimestamp");this.config.withTimezone=T,this.config.precision=W}build($){return new q9($,this.config)}}class q9 extends d{static[N]="PgTimestamp";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=($)=>{return new Date(this.withTimezone?$:$+"+0000")};mapToDriverValue=($)=>{return $.toISOString()}}class LL extends h0{static[N]="PgTimestampStringBuilder";constructor($,T,W){super($,"string","PgTimestampString");this.config.withTimezone=T,this.config.precision=W}build($){return new P9($,this.config)}}class P9 extends d{static[N]="PgTimestampString";withTimezone;precision;constructor($,T){super($,T);this.withTimezone=T.withTimezone,this.precision=T.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function JL($,T={}){let{name:W,config:w}=S$($,T);if(w?.mode==="string")return new LL(W,w.withTimezone??!1,w.precision);return new NL(W,w?.withTimezone??!1,w?.precision)}class RL extends e{static[N]="PgUUIDBuilder";constructor($){super($,"string","PgUUID")}defaultRandom(){return this.default(J`gen_random_uuid()`)}build($){return new C9($,this.config)}}class C9 extends d{static[N]="PgUUID";getSQLType(){return"uuid"}}function L1($){return new RL($??"")}class _L extends e{static[N]="PgVarcharBuilder";constructor($,T){super($,"string","PgVarchar");this.config.length=T.length,this.config.enumValues=T.enum}build($){return new kL($,this.config)}}class kL extends d{static[N]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function W6($,T={}){let{name:W,config:w}=S$($,T);return new _L(W,w)}class vL extends e{static[N]="PgBinaryVectorBuilder";constructor($,T){super($,"string","PgBinaryVector");this.config.dimensions=T.dimensions}build($){return new qL($,this.config)}}class qL extends d{static[N]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function PL($,T){let{name:W,config:w}=S$($,T);return new vL(W,w)}class CL extends e{static[N]="PgHalfVectorBuilder";constructor($,T){super($,"array","PgHalfVector");this.config.dimensions=T.dimensions}build($){return new SL($,this.config)}}class SL extends d{static[N]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((T)=>Number.parseFloat(T))}}function jL($,T){let{name:W,config:w}=S$($,T);return new CL(W,w)}class IL extends e{static[N]="PgSparseVectorBuilder";constructor($,T){super($,"string","PgSparseVector");this.config.dimensions=T.dimensions}build($){return new BL($,this.config)}}class BL extends d{static[N]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function xL($,T){let{name:W,config:w}=S$($,T);return new IL(W,w)}class fL extends e{static[N]="PgVectorBuilder";constructor($,T){super($,"array","PgVector");this.config.dimensions=T.dimensions}build($){return new bL($,this.config)}}class bL extends d{static[N]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue($){return JSON.stringify($)}mapFromDriverValue($){return $.slice(1,-1).split(",").map((T)=>Number.parseFloat(T))}}function yL($,T){let{name:W,config:w}=S$($,T);return new fL(W,w)}function hL(){return{bigint:nD,bigserial:eD,boolean:wU,char:wN,cidr:GN,customType:FN,date:ZN,doublePrecision:AN,inet:DN,integer:UU,interval:_N,json:vN,jsonb:PN,line:BN,macaddr:bN,macaddr8:gN,numeric:oN,point:tN,geometry:WL,real:UL,serial:zL,smallint:OL,smallserial:VL,text:EL,time:DL,timestamp:JL,uuid:L1,varchar:W6,bit:PL,halfvec:jL,sparsevec:xL,vector:yL}}var tO=Symbol.for("drizzle:PgInlineForeignKeys"),gL=Symbol.for("drizzle:EnableRLS");class x4 extends o{static[N]="PgTable";static Symbol=Object.assign({},o.Symbol,{InlineForeignKeys:tO,EnableRLS:gL});[tO]=[];[gL]=!1;[o.Symbol.ExtraConfigBuilder]=void 0;[o.Symbol.ExtraConfigColumns]={}}function hI($,T,W,w,X=$){let U=new x4($,w,X),Y=typeof T==="function"?T(hL()):T,G=Object.fromEntries(Object.entries(Y).map(([F,O])=>{let Q=O;Q.setName(F);let Z=Q.build(U);return U[tO].push(...Q.buildForeignKeys(Z,U)),[F,Z]})),H=Object.fromEntries(Object.entries(Y).map(([F,O])=>{let Q=O;Q.setName(F);let Z=Q.buildExtraConfigColumn(U);return[F,Z]})),z=Object.assign(U,G);if(z[o.Symbol.Columns]=G,z[o.Symbol.ExtraConfigColumns]=H,W)z[x4.Symbol.ExtraConfigBuilder]=W;return Object.assign(z,{enableRLS:()=>{return z[x4.Symbol.EnableRLS]=!0,z}})}var PT=($,T,W)=>{return hI($,T,W,void 0)};function mL(...$){if($[0].columns)return new YU($[0].columns,$[0].name);return new YU($)}class YU{static[N]="PgPrimaryKeyBuilder";columns;name;constructor($,T){this.columns=$,this.name=T}build($){return new cL($,this.columns,this.name)}}class cL{constructor($,T,W){this.table=$,this.columns=T,this.name=W}static[N]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[x4.Symbol.Name]}_${this.columns.map(($)=>$.name).join("_")}_pk`}}function u6($,T){if(bD(T)&&!pO($)&&!I($,F1)&&!I($,vT)&&!I($,p$)&&!I($,o)&&!I($,c6))return new F1($,T);return $}var S9=($,T)=>{return J`${$} = ${u6(T,$)}`},uL=($,T)=>{return J`${$} <> ${u6(T,$)}`};function GU(...$){let T=$.filter((W)=>W!==void 0);if(T.length===0)return;if(T.length===1)return new s(T);return new s([new B4("("),J.join(T,new B4(" and ")),new B4(")")])}function pL(...$){let T=$.filter((W)=>W!==void 0);if(T.length===0)return;if(T.length===1)return new s(T);return new s([new B4("("),J.join(T,new B4(" or ")),new B4(")")])}function dL($){return J`not ${$}`}var j9=($,T)=>{return J`${$} > ${u6(T,$)}`},oL=($,T)=>{return J`${$} >= ${u6(T,$)}`},lL=($,T)=>{return J`${$} < ${u6(T,$)}`},rL=($,T)=>{return J`${$} <= ${u6(T,$)}`};function nL($,T){if(Array.isArray(T)){if(T.length===0)return J`false`;return J`${$} in ${T.map((W)=>u6(W,$))}`}return J`${$} in ${u6(T,$)}`}function iL($,T){if(Array.isArray(T)){if(T.length===0)return J`true`;return J`${$} not in ${T.map((W)=>u6(W,$))}`}return J`${$} not in ${u6(T,$)}`}function tL($){return J`${$} is null`}function aL($){return J`${$} is not null`}function sL($){return J`exists ${$}`}function eL($){return J`not exists ${$}`}function $J($,T,W){return J`${$} between ${u6(T,$)} and ${u6(W,$)}`}function TJ($,T,W){return J`${$} not between ${u6(T,$)} and ${u6(W,$)}`}function WJ($,T){return J`${$} like ${T}`}function XJ($,T){return J`${$} not like ${T}`}function wJ($,T){return J`${$} ilike ${T}`}function UJ($,T){return J`${$} not ilike ${T}`}function YJ($){return J`${$} asc`}function GJ($){return J`${$} desc`}class aO{constructor($,T,W){this.sourceTable=$,this.referencedTable=T,this.relationName=W,this.referencedTableName=T[o.Symbol.Name]}static[N]="Relation";referencedTableName;fieldName}class zJ{constructor($,T){this.table=$,this.config=T}static[N]="Relations"}class CT extends aO{constructor($,T,W,w){super($,T,W?.relationName);this.config=W,this.isNullable=w}static[N]="One";withFieldName($){let T=new CT(this.sourceTable,this.referencedTable,this.config,this.isNullable);return T.fieldName=$,T}}class zU extends aO{constructor($,T,W){super($,T,W?.relationName);this.config=W}static[N]="Many";withFieldName($){let T=new zU(this.sourceTable,this.referencedTable,this.config);return T.fieldName=$,T}}function HJ(){return{and:GU,between:$J,eq:S9,exists:sL,gt:j9,gte:oL,ilike:wJ,inArray:nL,isNull:tL,isNotNull:aL,like:WJ,lt:lL,lte:rL,ne:uL,not:dL,notBetween:TJ,notExists:eL,notLike:XJ,notIlike:UJ,notInArray:iL,or:pL,sql:J}}function FJ(){return{sql:J,asc:YJ,desc:GJ}}function OJ($,T){if(Object.keys($).length===1&&"default"in $&&!I($.default,o))$=$.default;let W={},w={},X={};for(let[U,Y]of Object.entries($))if(I(Y,o)){let G=kW(Y),H=w[G];W[G]=U,X[U]={tsName:U,dbName:Y[o.Symbol.Name],schema:Y[o.Symbol.Schema],columns:Y[o.Symbol.Columns],relations:H?.relations??{},primaryKey:H?.primaryKey??[]};for(let F of Object.values(Y[o.Symbol.Columns]))if(F.primary)X[U].primaryKey.push(F);let z=Y[o.Symbol.ExtraConfigBuilder]?.(Y[o.Symbol.ExtraConfigColumns]);if(z){for(let F of Object.values(z))if(I(F,YU))X[U].primaryKey.push(...F.columns)}}else if(I(Y,zJ)){let G=kW(Y.table),H=W[G],z=Y.config(T(Y.table)),F;for(let[O,Q]of Object.entries(z))if(H){let Z=X[H];if(Z.relations[O]=Q,F)Z.primaryKey.push(...F)}else{if(!(G in w))w[G]={relations:{},primaryKey:F};w[G].relations[O]=Q}}return{tables:X,tableNamesMap:W}}function gI($){return function T(W,w){return new CT($,W,w,w?.fields.reduce((X,U)=>X&&U.notNull,!0)??!1)}}function mI($){return function T(W,w){return new zU($,W,w)}}function QJ($,T,W){if(I(W,CT)&&W.config)return{fields:W.config.fields,references:W.config.references};let w=T[kW(W.referencedTable)];if(!w)throw new Error(`Table "${W.referencedTable[o.Symbol.Name]}" not found in schema`);let X=$[w];if(!X)throw new Error(`Table "${w}" not found in schema`);let U=W.sourceTable,Y=T[kW(U)];if(!Y)throw new Error(`Table "${U[o.Symbol.Name]}" not found in schema`);let G=[];for(let H of Object.values(X.relations))if(W.relationName&&W!==H&&H.relationName===W.relationName||!W.relationName&&H.referencedTable===W.sourceTable)G.push(H);if(G.length>1)throw W.relationName?new Error(`There are multiple relations with name "${W.relationName}" in table "${w}"`):new Error(`There are multiple relations between "${w}" and "${W.sourceTable[o.Symbol.Name]}". Please specify relation name`);if(G[0]&&I(G[0],CT)&&G[0].config)return{fields:G[0].config.references,references:G[0].config.fields};throw new Error(`There is not enough information to infer relation "${Y}.${W.fieldName}"`)}function ZJ($){return{one:gI($),many:mI($)}}function I9($,T,W,w,X=(U)=>U){let U={};for(let[Y,G]of w.entries())if(G.isJson){let H=T.relations[G.tsKey],z=W[Y],F=typeof z==="string"?JSON.parse(z):z;U[G.tsKey]=I(H,CT)?F&&I9($,$[G.relationTableTsKey],F,G.selection,X):F.map((O)=>I9($,$[G.relationTableTsKey],O,G.selection,X))}else{let H=X(W[Y]),z=G.field,F;if(I(z,p$))F=z;else if(I(z,s))F=z.decoder;else F=z.sql.decoder;U[G.tsKey]=H===null?null:F.mapFromDriverValue(H)}return U}import Sy from"path";import FB from"os";import OB from"fs";var B9=new Map,sO=new Map,eO=Symbol("OriginError"),o2={};class J1 extends Promise{constructor($,T,W,w,X={}){let U,Y;super((G,H)=>{U=G,Y=H});this.tagged=Array.isArray($.raw),this.strings=$,this.args=T,this.handler=W,this.canceller=w,this.options=X,this.state=null,this.statement=null,this.resolve=(G)=>(this.active=!1,U(G)),this.reject=(G)=>(this.active=!1,Y(G)),this.active=!1,this.cancelled=null,this.executed=!1,this.signature="",this[eO]=this.handler.debug?new Error:this.tagged&&cI(this.strings)}get origin(){return(this.handler.debug?this[eO].stack:this.tagged&&sO.has(this.strings)?sO.get(this.strings):sO.set(this.strings,this[eO].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($=1,T){if(this.options.simple=!1,typeof $==="function")T=$,$=1;if(this.cursorRows=$,typeof T==="function")return this.cursorFn=T,this;let W;return{[Symbol.asyncIterator]:()=>({next:()=>{if(this.executed&&!this.active)return{done:!0};W&&W();let w=new Promise((X,U)=>{this.cursorFn=(Y)=>{return X({value:Y,done:!1}),new Promise((G)=>W=G)},this.resolve=()=>(this.active=!1,X({done:!0})),this.reject=(Y)=>(this.active=!1,U(Y))});return this.execute(),w},return(){return W&&W(o2),{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($){return this.forEachFn=$,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 cI($){if(B9.has($))return B9.get($);let T=Error.stackTraceLimit;return Error.stackTraceLimit=4,B9.set($,new Error),Error.stackTraceLimit=T,B9.get($)}class l2 extends Error{constructor($){super($.message);this.name=this.constructor.name,Object.assign(this,$)}}var J4={connection:VJ,postgres:KJ,generic:AJ,notSupported:EJ};function VJ($,T,W){let{host:w,port:X}=W||T,U=Object.assign(new Error("write "+$+" "+(T.path||w+":"+X)),{code:$,errno:$,address:T.path||w},T.path?{}:{port:X});return Error.captureStackTrace(U,VJ),U}function KJ($){let T=new l2($);return Error.captureStackTrace(T,KJ),T}function AJ($,T){let W=Object.assign(new Error($+": "+T),{code:$});return Error.captureStackTrace(W,AJ),W}function EJ($){let T=Object.assign(new Error($+" (B) is not supported"),{code:"MESSAGE_NOT_SUPPORTED",name:$});return Error.captureStackTrace(T,EJ),T}var uI={string:{to:25,from:null,serialize:($)=>""+$},number:{to:0,from:[21,23,26,700,701],serialize:($)=>""+$,parse:($)=>+$},json:{to:114,from:[114,3802],serialize:($)=>JSON.stringify($),parse:($)=>JSON.parse($)},boolean:{to:16,from:16,serialize:($)=>$===!0?"t":"f",parse:($)=>$==="t"},date:{to:1184,from:[1082,1114,1184],serialize:($)=>($ instanceof Date?$:new Date($)).toISOString(),parse:($)=>new Date($)},bytea:{to:17,from:17,serialize:($)=>"\\x"+Buffer.from($).toString("hex"),parse:($)=>Buffer.from($.slice(2),"hex")}};class b9{then(){$Q()}catch(){$Q()}finally(){$Q()}}class QU extends b9{constructor($){super();this.value=g9($)}}class G0 extends b9{constructor($,T,W){super();this.value=$,this.type=T,this.array=W}}class y9 extends b9{constructor($,T){super();this.first=$,this.rest=T}build($,T,W,w){let X=pI.map(([U,Y])=>({fn:Y,i:$.search(U)})).sort((U,Y)=>U.i-Y.i).pop();return X.i===-1?UQ(this.first,w):X.fn(this.first,this.rest,T,W,w)}}function h9($,T,W,w){let X=$ instanceof G0?$.value:$;if(X===void 0){if($ instanceof G0?$.value=w.transform.undefined:X=$=w.transform.undefined,X===void 0)throw J4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return"$"+W.push($ instanceof G0?(T.push($.value),$.array?$.array[$.type||f9($.value)]||$.type||LJ($.value):$.type):(T.push($),f9($)))}var DJ=RJ(uI);function XQ($,T,W,w,X,U){for(let Y=1;Y<$.strings.length;Y++)T+=wQ(T,W,w,X,U)+$.strings[Y],W=$.args[Y];return T}function wQ($,T,W,w,X){return T instanceof y9?T.build($,W,w,X):T instanceof J1?WQ(T,W,w,X):T instanceof QU?T.value:T&&T[0]instanceof J1?T.reduce((U,Y)=>U+" "+WQ(Y,W,w,X),""):h9(T,W,w,X)}function WQ($,T,W,w){return $.fragment=!0,XQ($,$.strings[0],$.args[0],T,W,w)}function NJ($,T,W,w,X){return $.map((U)=>"("+w.map((Y)=>wQ("values",U[Y],T,W,X)).join(",")+")").join(",")}function MJ($,T,W,w,X){let U=Array.isArray($[0]),Y=T.length?T.flat():Object.keys(U?$[0]:$);return NJ(U?$:[$],W,w,Y,X)}function x9($,T,W,w,X){if(typeof $==="string"&&($=[$].concat(T)),Array.isArray($))return UQ($,X);let U;return(T.length?T.flat():Object.keys($)).map((G)=>{return U=$[G],(U instanceof J1?WQ(U,W,w,X):U instanceof QU?U.value:h9(U,W,w,X))+" as "+g9(X.transform.column.to?X.transform.column.to(G):G)}).join(",")}var pI=Object.entries({values:MJ,in:(...$)=>{let T=MJ(...$);return T==="()"?"(null)":T},select:x9,as:x9,returning:x9,"\\(":x9,update($,T,W,w,X){return(T.length?T.flat():Object.keys($)).map((U)=>g9(X.transform.column.to?X.transform.column.to(U):U)+"="+wQ("values",$[U],W,w,X))},insert($,T,W,w,X){let U=T.length?T.flat():Object.keys(Array.isArray($)?$[0]:$);return"("+UQ(U,X)+")values"+NJ(Array.isArray($)?$:[$],W,w,U,X)}}).map(([$,T])=>[new RegExp("((?:^|[\\s(])"+$+"(?:$|[\\s(]))(?![\\s\\S]*\\1)","i"),T]);function $Q(){throw J4.generic("NOT_TAGGED_CALL","Query not called as a tagged template literal")}var{serializers:dI,parsers:oI}=DJ;function LJ($){if(Array.isArray($))return LJ($[0]);return typeof $==="string"?1009:0}var JJ=function($){let T=RJ($||{});return{serializers:Object.assign({},dI,T.serializers),parsers:Object.assign({},oI,T.parsers)}};function RJ($){return Object.keys($).reduce((T,W)=>{if($[W].from&&[].concat($[W].from).forEach((w)=>T.parsers[w]=$[W].parse),$[W].serialize)T.serializers[$[W].to]=$[W].serialize,$[W].from&&[].concat($[W].from).forEach((w)=>T.serializers[w]=$[W].serialize);return T},{parsers:{},serializers:{}})}function UQ($,{transform:{column:T}}){return $.map((W)=>g9(T.to?T.to(W):W)).join(",")}var g9=function $(T){return'"'+T.replace(/"/g,'""').replace(/\./g,'"."')+'"'},f9=function $(T){return T instanceof G0?T.type:T instanceof Date?1184:T instanceof Uint8Array?17:T===!0||T===!1?16:typeof T==="bigint"?20:Array.isArray(T)?$(T[0]):0},lI=/\\/g,rI=/"/g;function nI($){return $.replace(lI,"\\\\").replace(rI,"\\\"")}var _J=function $(T,W,w,X){if(Array.isArray(T)===!1)return T;if(!T.length)return"{}";let U=T[0],Y=X===1020?";":",";if(Array.isArray(U)&&!U.type)return"{"+T.map((G)=>$(G,W,w,X)).join(Y)+"}";return"{"+T.map((G)=>{if(G===void 0){if(G=w.transform.undefined,G===void 0)throw J4.generic("UNDEFINED_VALUE","Undefined values are not allowed")}return G===null?"null":'"'+nI(W?W(G.type?G.value:G):""+G)+'"'}).join(Y)+"}"},TQ={i:0,char:null,str:"",quoted:!1,last:0},kJ=function $(T,W,w){return TQ.i=TQ.last=0,vJ(TQ,T,W,w)};function vJ($,T,W,w){let X=[],U=w===1020?";":",";for(;$.i<T.length;$.i++){if($.char=T[$.i],$.quoted)if($.char==="\\")$.str+=T[++$.i];else if($.char==='"')X.push(W?W($.str):$.str),$.str="",$.quoted=T[$.i+1]==='"',$.last=$.i+2;else $.str+=$.char;else if($.char==='"')$.quoted=!0;else if($.char==="{")$.last=++$.i,X.push(vJ($,T,W,w));else if($.char==="}"){$.quoted=!1,$.last<$.i&&X.push(W?W(T.slice($.last,$.i)):T.slice($.last,$.i)),$.last=$.i+1;break}else if($.char===U&&$.p!=="}"&&$.p!=='"')X.push(W?W(T.slice($.last,$.i)):T.slice($.last,$.i)),$.last=$.i+1;$.p=$.char}return $.last<$.i&&X.push(W?W(T.slice($.last,$.i+1)):T.slice($.last,$.i+1)),X}var vW=($)=>{let T=$[0];for(let W=1;W<$.length;W++)T+=$[W]==="_"?$[++W].toUpperCase():$[W];return T},qW=($)=>{let T=$[0].toUpperCase();for(let W=1;W<$.length;W++)T+=$[W]==="_"?$[++W].toUpperCase():$[W];return T},PW=($)=>$.replace(/_/g,"-"),HU=($)=>$.replace(/([A-Z])/g,"_$1").toLowerCase(),FU=($)=>($.slice(0,1)+$.slice(1).replace(/([A-Z])/g,"_$1")).toLowerCase(),OU=($)=>$.replace(/-/g,"_");function YQ($){return function T(W,w){return typeof W==="object"&&W!==null&&(w.type===114||w.type===3802)?Array.isArray(W)?W.map((X)=>T(X,w)):Object.entries(W).reduce((X,[U,Y])=>Object.assign(X,{[$(U)]:T(Y,w)}),{}):W}}vW.column={from:vW};vW.value={from:YQ(vW)};HU.column={to:HU};var GQ={...vW};GQ.column.to=HU;qW.column={from:qW};qW.value={from:YQ(qW)};FU.column={to:FU};var zQ={...qW};zQ.column.to=FU;PW.column={from:PW};PW.value={from:YQ(PW)};OU.column={to:OU};var HQ={...PW};HQ.column.to=OU;import qJ from"net";import sI from"tls";import ZU from"crypto";import FQ from"stream";import{performance as PJ}from"perf_hooks";class CW 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 O1=iI;function iI($=[]){let T=$.slice(),W=0;return{get length(){return T.length-W},remove:(w)=>{let X=T.indexOf(w);return X===-1?null:(T.splice(X,1),w)},push:(w)=>(T.push(w),w),shift:()=>{let w=T[W++];if(W===T.length)W=0,T=[];else T[W-1]=void 0;return w}}}var X6=Buffer.allocUnsafe(256),tI="BCcDdEFfHPpQSX".split("").reduce(($,T)=>{let W=T.charCodeAt(0);return $[T]=()=>{return X6[0]=W,u$.i=5,u$},$},{}),u$=Object.assign(aI,tI,{N:String.fromCharCode(0),i:0,inc($){return u$.i+=$,u$},str($){let T=Buffer.byteLength($);return m9(T),u$.i+=X6.write($,u$.i,T,"utf8"),u$},i16($){return m9(2),X6.writeUInt16BE($,u$.i),u$.i+=2,u$},i32($,T){if(T||T===0)return X6.writeUInt32BE($,T),u$;return m9(4),X6.writeUInt32BE($,u$.i),u$.i+=4,u$},z($){return m9($),X6.fill(0,u$.i,u$.i+$),u$.i+=$,u$},raw($){return X6=Buffer.concat([X6.subarray(0,u$.i),$]),u$.i=X6.length,u$},end($=1){X6.writeUInt32BE(u$.i-$,$);let T=X6.subarray(0,u$.i);return u$.i=0,X6=Buffer.allocUnsafe(256),T}}),Y$=u$;function m9($){if(X6.length-u$.i<$){let T=X6,W=T.length;X6=Buffer.allocUnsafe(W+(W>>1)+$),T.copy(X6)}}function aI(){return u$.i=0,u$}var ZQ=jJ,eI=1,ST=Y$().S().end(),CJ=Y$().H().end(),$B=Y$().i32(8).i32(80877103).end(8),TB=Buffer.concat([Y$().E().str(Y$.N).i32(0).end(),ST]),WB=Y$().D().str("S").str(Y$.N).end(),r2=()=>{},XB=new Set(["FetchPreparedStatement","RevalidateCachedQuery","transformAssignedExpr"]),wB={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 jJ($,T={},{onopen:W=r2,onend:w=r2,onclose:X=r2}={}){let{ssl:U,max:Y,user:G,host:H,port:z,database:F,parsers:O,transform:Q,onnotice:Z,onnotify:K,onparameter:E,max_pipeline:M,keep_alive:L,backoff:R,target_session_attrs:_}=$,S=O1(),x=eI++,b={pid:null,secret:null},g=QQ(Sz,$.idle_timeout),T$=QQ(Sz,$.max_lifetime),N$=QQ(Mv,$.connect_timeout),j=null,U$,t=new CW,z$=Buffer.alloc(0),B$=$.fetch_types,e$={},h4={},n6=Math.random().toString(36).slice(2),c=1,F$=0,g$=0,Y4=0,_4=0,L$=0,m$=0,D4=0,G4=null,$4=null,t4=!1,l$=null,q1=null,p4=null,a0=null,k4=null,T4=null,P1=null,u1=null,n=null,AX=null,a4={queue:T.closed,idleTimer:g,connect(D){p4=D,UV()},terminate:MX,execute:EX,cancel:Vv,end:Sz,count:0,id:x};return T.closed&&T.closed.push(a4),a4;async function Zv(){let D;try{D=$.socket?await Promise.resolve($.socket($)):new qJ.Socket}catch(q){gW(q);return}return D.on("error",gW),D.on("close",YV),D.on("drain",XV),D}async function Vv({pid:D,secret:q},H$,f$){try{U$=Y$().i32(16).i32(80877102).i32(D).i32(q).end(16),await wV(),j.once("error",f$),j.once("close",H$)}catch(V4){f$(V4)}}function EX(D){if(t4)return tU(D,J4.connection("CONNECTION_DESTROYED",$));if(D.cancelled)return;try{return D.state=b,n?S.push(D):(n=D,n.active=!0),Ev(D),d4(Kv(D))&&!D.describeFirst&&!D.cursorFn&&S.length<M&&(!D.options.onexecute||D.options.onexecute(a4))}catch(q){return S.length===0&&d4(ST),p1(q),!0}}function Kv(D){if(D.parameters.length>=65534)throw J4.generic("MAX_PARAMETERS_EXCEEDED","Max number of parameters (65534) exceeded");return D.options.simple?Y$().Q().str(D.statement.string+Y$.N).end():D.describeFirst?Buffer.concat([$V(D),CJ]):D.prepare?D.prepared?iU(D):Buffer.concat([$V(D),iU(D)]):Av(D)}function $V(D){return Buffer.concat([zV(D.statement.string,D.parameters,D.statement.types,D.statement.name),Wq("S",D.statement.name)])}function iU(D){return Buffer.concat([Tq(D.parameters,D.statement.types,D.statement.name,D.cursorName),D.cursorFn?HV("",D.cursorRows):TB])}function Av(D){return Buffer.concat([zV(D.statement.string,D.parameters,D.statement.types),WB,iU(D)])}function Ev(D){let q=[],H$=[],f$=XQ(D,D.strings[0],D.args[0],q,H$,$);!D.tagged&&D.args.forEach((V4)=>h9(V4,q,H$,$)),D.prepare=$.prepare&&("prepare"in D.options?D.options.prepare:!0),D.string=f$,D.signature=D.prepare&&H$+f$,D.onlyDescribe&&delete h4[D.signature],D.parameters=D.parameters||q,D.prepared=D.prepare&&D.signature in h4,D.describeFirst=D.onlyDescribe||q.length&&!D.prepared,D.statement=D.prepared?h4[D.signature]:{string:f$,types:H$,name:D.prepare?n6+c++:""},typeof $.debug==="function"&&$.debug(x,f$,q,H$)}function d4(D,q){if(T4=T4?Buffer.concat([T4,D]):Buffer.from(D),q||T4.length>=1024)return TV(q);return $4===null&&($4=setImmediate(TV)),!0}function TV(D){let q=j.write(T4,D);return $4!==null&&clearImmediate($4),T4=$4=null,q}function Mv(){p1(J4.connection("CONNECT_TIMEOUT",$,j)),j.destroy()}async function WV(){if(d4($B),!await new Promise((q)=>j.once("data",(H$)=>q(H$[0]===83)))&&U==="prefer")return hW();j.removeAllListeners(),j=sI.connect({socket:j,servername:qJ.isIP(j.host)?void 0:j.host,...U==="require"||U==="allow"||U==="prefer"?{rejectUnauthorized:!1}:U==="verify-full"?{}:typeof U==="object"?U:{}}),j.on("secureConnect",hW),j.on("error",gW),j.on("close",YV),j.on("drain",XV)}function XV(){!n&&W(a4)}function Cz(D){if(l$){if(l$.push(D),g$-=D.length,g$>0)return}z$=l$?Buffer.concat(l$,L$-g$):z$.length===0?D:Buffer.concat([z$,D],z$.length+D.length);while(z$.length>4){if(L$=z$.readUInt32BE(1),L$>=z$.length){g$=L$-z$.length,l$=[z$];break}try{Dv(z$.subarray(0,L$+1))}catch(q){n&&(n.cursorFn||n.describeFirst)&&d4(ST),p1(q)}z$=z$.subarray(L$+1),g$=0,l$=null}}async function wV(){if(t4=!1,e$={},j||(j=await Zv()),!j)return;if(N$.start(),$.socket)return U?WV():hW();if(j.on("connect",U?WV:hW),$.path)return j.connect($.path);j.ssl=U,j.connect(z[Y4],H[Y4]),j.host=H[Y4],j.port=z[Y4],Y4=(Y4+1)%z.length}function UV(){setTimeout(wV,F$?F$+m$-PJ.now():0)}function hW(){try{h4={},B$=$.fetch_types,n6=Math.random().toString(36).slice(2),c=1,T$.start(),j.on("data",Cz),L&&j.setKeepAlive&&j.setKeepAlive(!0,1000*L);let D=wq();d4(D)}catch(D){gW(D)}}function gW(D){if(a4.queue===T.connecting&&$.host[_4+1])return;p1(D);while(S.length)tU(S.shift(),D)}function p1(D){k4&&(k4.destroy(D),k4=null),n&&tU(n,D),p4&&(tU(p4,D),p4=null)}function tU(D,q){if(D.reserve)return D.reject(q);if(!q||typeof q!=="object")q=new Error(q);"query"in q||"parameters"in q||Object.defineProperties(q,{stack:{value:q.stack+D.origin.replace(/.*\n/,`
|
|
83
|
+
`),enumerable:$.debug},query:{value:D.string,enumerable:$.debug},parameters:{value:D.parameters,enumerable:$.debug},args:{value:D.args,enumerable:$.debug},types:{value:D.statement&&D.statement.types,enumerable:$.debug}}),D.reject(q)}function Sz(){return a0||(!a4.reserved&&w(a4),!a4.reserved&&!p4&&!n&&S.length===0?(MX(),new Promise((D)=>j&&j.readyState!=="closed"?j.once("close",D):D())):a0=new Promise((D)=>P1=D))}function MX(){if(t4=!0,k4||n||p4||S.length)gW(J4.connection("CONNECTION_DESTROYED",$));if(clearImmediate($4),j)j.removeListener("data",Cz),j.removeListener("connect",hW),j.readyState==="open"&&j.end(Y$().X().end());P1&&(P1(),a0=P1=null)}async function YV(D){if(z$=Buffer.alloc(0),g$=0,l$=null,clearImmediate($4),j.removeListener("data",Cz),j.removeListener("connect",hW),g.cancel(),T$.cancel(),N$.cancel(),j.removeAllListeners(),j=null,p4)return UV();!D&&(n||S.length)&&gW(J4.connection("CONNECTION_CLOSED",$,j)),F$=PJ.now(),D&&$.shared.retries++,m$=(typeof R==="function"?R($.shared.retries):R)*1000,X(a4,J4.connection("CONNECTION_CLOSED",$,j))}function Dv(D,q=D[0]){(q===68?Nv:q===100?rv:q===65?cv:q===83?Lv:q===90?Jv:q===67?Rv:q===50?GV:q===49?_v:q===116?kv:q===84?vv:q===82?qv:q===110?Bv:q===75?xv:q===69?gv:q===115?uv:q===51?pv:q===71?dv:q===78?iv:q===72?ov:q===99?nv:q===73?tv:q===86?av:q===118?sv:q===87?lv:ev)(D)}function Nv(D){let q=7,H$,f$,V4,s4=n.isRaw?new Array(n.statement.columns.length):{};for(let Y6=0;Y6<n.statement.columns.length;Y6++)f$=n.statement.columns[Y6],H$=D.readInt32BE(q),q+=4,V4=H$===-1?null:n.isRaw===!0?D.subarray(q,q+=H$):f$.parser===void 0?D.toString("utf8",q,q+=H$):f$.parser.array===!0?f$.parser(D.toString("utf8",q+1,q+=H$)):f$.parser(D.toString("utf8",q,q+=H$)),n.isRaw?s4[Y6]=n.isRaw===!0?V4:Q.value.from?Q.value.from(V4,f$):V4:s4[f$.name]=Q.value.from?Q.value.from(V4,f$):V4;n.forEachFn?n.forEachFn(Q.row.from?Q.row.from(s4):s4,t):t[D4++]=Q.row.from?Q.row.from(s4):s4}function Lv(D){let[q,H$]=D.toString("utf8",5,D.length-1).split(Y$.N);if(e$[q]=H$,$.parameters[q]!==H$)$.parameters[q]=H$,E&&E(q,H$)}function Jv(D){if(n&&n.options.simple&&n.resolve(q1||t),n=q1=null,t=new CW,N$.cancel(),p4){if(_){if(!e$.in_hot_standby||!e$.default_transaction_read_only)return hv();else if(yv(_,e$))return MX()}if(B$)return p4.reserve&&(p4=null),fv();p4&&!p4.reserve&&EX(p4),$.shared.retries=_4=0,p4=null;return}while(S.length&&(n=S.shift())&&(n.active=!0,n.cancelled))jJ($).cancel(n.state,n.cancelled.resolve,n.cancelled.reject);if(n)return;a4.reserved?!a4.reserved.release&&D[5]===73?a0?MX():(a4.reserved=null,W(a4)):a4.reserved():a0?MX():W(a4)}function Rv(D){D4=0;for(let q=D.length-1;q>0;q--){if(D[q]===32&&D[q+1]<58&&t.count===null)t.count=+D.toString("utf8",q+1,D.length-1);if(D[q-1]>=65){t.command=D.toString("utf8",5,q),t.state=b;break}}if(AX&&(AX(),AX=null),t.command==="BEGIN"&&Y!==1&&!a4.reserved)return p1(J4.generic("UNSAFE_TRANSACTION","Only use sql.begin, sql.reserved or max: 1"));if(n.options.simple)return GV();if(n.cursorFn)t.count&&n.cursorFn(t),d4(ST);n.resolve(t)}function _v(){n.parsing=!1}function GV(){!t.statement&&(t.statement=n.statement),t.columns=n.statement.columns}function kv(D){let q=D.readUInt16BE(5);for(let H$=0;H$<q;++H$)!n.statement.types[H$]&&(n.statement.types[H$]=D.readUInt32BE(7+H$*4));n.prepare&&(h4[n.signature]=n.statement),n.describeFirst&&!n.onlyDescribe&&(d4(iU(n)),n.describeFirst=!1)}function vv(D){if(t.command)q1=q1||[t],q1.push(t=new CW),t.count=null,n.statement.columns=null;let q=D.readUInt16BE(5),H$=7,f$;n.statement.columns=Array(q);for(let V4=0;V4<q;++V4){f$=H$;while(D[H$++]!==0);let s4=D.readUInt32BE(H$),Y6=D.readUInt16BE(H$+4),s0=D.readUInt32BE(H$+6);n.statement.columns[V4]={name:Q.column.from?Q.column.from(D.toString("utf8",f$,H$-1)):D.toString("utf8",f$,H$-1),parser:O[s0],table:s4,number:Y6,type:s0},H$+=18}if(t.statement=n.statement,n.onlyDescribe)return n.resolve(n.statement),d4(ST)}async function qv(D,q=D.readUInt32BE(5)){(q===3?Pv:q===5?Cv:q===10?Sv:q===11?jv:q===12?Iv:q!==0?$q:r2)(D,q)}async function Pv(){let D=await jz();d4(Y$().p().str(D).z(1).end())}async function Cv(D){let q="md5"+await SJ(Buffer.concat([Buffer.from(await SJ(await jz()+G)),D.subarray(9)]));d4(Y$().p().str(q).z(1).end())}async function Sv(){u1=(await ZU.randomBytes(18)).toString("base64"),Y$().p().str("SCRAM-SHA-256"+Y$.N);let D=Y$.i;d4(Y$.inc(4).str("n,,n=*,r="+u1).i32(Y$.i-D-4,D).end())}async function jv(D){let q=D.toString("utf8",9).split(",").reduce((Y6,s0)=>(Y6[s0[0]]=s0.slice(2),Y6),{}),H$=await ZU.pbkdf2Sync(await jz(),Buffer.from(q.s,"base64"),parseInt(q.i),32,"sha256"),f$=await c9(H$,"Client Key"),V4="n=*,r="+u1+",r="+q.r+",s="+q.s+",i="+q.i+",c=biws,r="+q.r;G4=(await c9(await c9(H$,"Server Key"),V4)).toString("base64");let s4="c=biws,r="+q.r+",p="+YB(f$,Buffer.from(await c9(await UB(f$),V4))).toString("base64");d4(Y$().p().str(s4).end())}function Iv(D){if(D.toString("utf8",9).split(Y$.N,1)[0].slice(2)===G4)return;p1(J4.generic("SASL_SIGNATURE_MISMATCH","The server did not return the correct signature")),j.destroy()}function jz(){return Promise.resolve(typeof $.pass==="function"?$.pass():$.pass)}function Bv(){if(t.statement=n.statement,t.statement.columns=[],n.onlyDescribe)return n.resolve(n.statement),d4(ST)}function xv(D){b.pid=D.readUInt32BE(5),b.secret=D.readUInt32BE(9)}async function fv(){B$=!1,(await new J1([`
|
|
82
84
|
select b.oid, b.typarray
|
|
83
85
|
from pg_catalog.pg_type a
|
|
84
86
|
left join pg_catalog.pg_type b on b.oid = a.typelem
|
|
85
87
|
where a.typcategory = 'A'
|
|
86
88
|
group by b.oid, b.typarray
|
|
87
89
|
order by b.oid
|
|
88
|
-
`],[],
|
|
90
|
+
`],[],EX)).forEach(({oid:q,typarray:H$})=>bv(q,H$))}function bv(D,q){if(!!$.parsers[q]&&!!$.serializers[q])return;let H$=$.parsers[D];$.shared.typeArrayMap[D]=q,$.parsers[q]=(f$)=>kJ(f$,H$,q),$.parsers[q].array=!0,$.serializers[q]=(f$)=>_J(f$,$.serializers[D],$,q)}function yv(D,q){return D==="read-write"&&q.default_transaction_read_only==="on"||D==="read-only"&&q.default_transaction_read_only==="off"||D==="primary"&&q.in_hot_standby==="on"||D==="standby"&&q.in_hot_standby==="off"||D==="prefer-standby"&&q.in_hot_standby==="off"&&$.host[_4]}function hv(){let D=new J1([`
|
|
89
91
|
show transaction_read_only;
|
|
90
92
|
select pg_catalog.pg_is_in_recovery()
|
|
91
|
-
`],[],
|
|
93
|
+
`],[],EX,null,{simple:!0});D.resolve=([[q],[H$]])=>{e$.default_transaction_read_only=q.transaction_read_only,e$.in_hot_standby=H$.pg_is_in_recovery?"on":"off"},D.execute()}function gv(D){n&&(n.cursorFn||n.describeFirst)&&d4(ST);let q=J4.postgres(OQ(D));n&&n.retried?p1(n.retried):n&&n.prepared&&XB.has(q.routine)?mv(n,q):p1(q)}function mv(D,q){delete h4[D.signature],D.retried=q,EX(D)}function cv(D){if(!K)return;let q=9;while(D[q++]!==0);K(D.toString("utf8",9,q-1),D.toString("utf8",q,D.length-1))}async function uv(){try{let D=await Promise.resolve(n.cursorFn(t));D4=0,D===o2?d4(Xq(n.portal)):(t=new CW,d4(HV("",n.cursorRows)))}catch(D){d4(ST),n.reject(D)}}function pv(){t.count&&n.cursorFn(t),n.resolve(t)}function dv(){k4=new FQ.Writable({autoDestroy:!0,write(D,q,H$){j.write(Y$().d().raw(D).end(),H$)},destroy(D,q){q(D),j.write(Y$().f().str(D+Y$.N).end()),k4=null},final(D){j.write(Y$().c().end()),AX=D}}),n.resolve(k4)}function ov(){k4=new FQ.Readable({read(){j.resume()}}),n.resolve(k4)}function lv(){k4=new FQ.Duplex({autoDestroy:!0,read(){j.resume()},write(D,q,H$){j.write(Y$().d().raw(D).end(),H$)},destroy(D,q){q(D),j.write(Y$().f().str(D+Y$.N).end()),k4=null},final(D){j.write(Y$().c().end()),AX=D}}),n.resolve(k4)}function rv(D){k4&&(k4.push(D.subarray(5))||j.pause())}function nv(){k4&&k4.push(null),k4=null}function iv(D){Z?Z(OQ(D)):console.log(OQ(D))}function tv(){}function av(){p1(J4.notSupported("FunctionCallResponse"))}function sv(){p1(J4.notSupported("NegotiateProtocolVersion"))}function ev(D){console.error("Postgres.js : Unknown Message:",D[0])}function $q(D,q){console.error("Postgres.js : Unknown Auth:",q)}function Tq(D,q,H$="",f$=""){let V4,s4;return Y$().B().str(f$+Y$.N).str(H$+Y$.N).i16(0).i16(D.length),D.forEach((Y6,s0)=>{if(Y6===null)return Y$.i32(4294967295);s4=q[s0],D[s0]=Y6=s4 in $.serializers?$.serializers[s4](Y6):""+Y6,V4=Y$.i,Y$.inc(4).str(Y6).i32(Y$.i-V4-4,V4)}),Y$.i16(0),Y$.end()}function zV(D,q,H$,f$=""){return Y$().P().str(f$+Y$.N).str(D+Y$.N).i16(q.length),q.forEach((V4,s4)=>Y$.i32(H$[s4]||0)),Y$.end()}function Wq(D,q=""){return Y$().D().str(D).str(q+Y$.N).end()}function HV(D="",q=0){return Buffer.concat([Y$().E().str(D+Y$.N).i32(q).end(),CJ])}function Xq(D=""){return Buffer.concat([Y$().C().str("P").str(D+Y$.N).end(),Y$().S().end()])}function wq(){return U$||Y$().inc(4).i16(3).z(2).str(Object.entries(Object.assign({user:G,database:F,client_encoding:"UTF8"},$.connection)).filter(([,D])=>D).map(([D,q])=>D+Y$.N+q).join(Y$.N)).z(2).end(0)}}function OQ($){let T={},W=5;for(let w=5;w<$.length-1;w++)if($[w]===0)T[wB[$[W]]]=$.toString("utf8",W+1,w),W=w+1;return T}function SJ($){return ZU.createHash("md5").update($).digest("hex")}function c9($,T){return ZU.createHmac("sha256",$).update(T).digest()}function UB($){return ZU.createHash("sha256").update($).digest()}function YB($,T){let W=Math.max($.length,T.length),w=Buffer.allocUnsafe(W);for(let X=0;X<W;X++)w[X]=$[X]^T[X];return w}function QQ($,T){if(T=typeof T==="function"?T():T,!T)return{cancel:r2,start:r2};let W;return{cancel(){W&&(clearTimeout(W),W=null)},start(){W&&clearTimeout(W),W=setTimeout(w,T*1000,arguments)}};function w(X){$.apply(null,X),W=null}}var IJ=()=>{};function VQ($,T){let W=new Map,w="postgresjs_"+Math.random().toString(36).slice(2),X={},U,Y,G=!1,H=O.sql=$({...T,transform:{column:{},value:{},row:{}},max:1,fetch_types:!1,idle_timeout:null,max_lifetime:null,connection:{...T.connection,replication:"database"},onclose:async function(){if(G)return;Y=null,X.pid=X.secret=void 0,Q(await Z(H,w,T.publications)),W.forEach((E)=>E.forEach(({onsubscribe:M})=>M()))},no_subscribe:!0}),z=H.end,F=H.close;return H.end=async()=>{return G=!0,Y&&await new Promise((E)=>(Y.once("close",E),Y.end())),z()},H.close=async()=>{return Y&&await new Promise((E)=>(Y.once("close",E),Y.end())),F()},O;async function O(E,M,L=IJ,R=IJ){if(E=HB(E),!U)U=Z(H,w,T.publications);let _={fn:M,onsubscribe:L},S=W.has(E)?W.get(E).add(_):W.set(E,new Set([_])).get(E),x=()=>{S.delete(_),S.size===0&&W.delete(E)};return U.then((b)=>{return Q(b),L(),Y&&Y.on("error",R),{unsubscribe:x,state:X,sql:H}})}function Q(E){Y=E.stream,X.pid=E.state.pid,X.secret=E.state.secret}async function Z(E,M,L){if(!L)throw new Error("Missing publication names");let R=await E.unsafe(`CREATE_REPLICATION_SLOT ${M} TEMPORARY LOGICAL pgoutput NOEXPORT_SNAPSHOT`),[_]=R,S=await E.unsafe(`START_REPLICATION SLOT ${M} LOGICAL ${_.consistent_point} (proto_version '1', publication_names '${L}')`).writable(),x={lsn:Buffer.concat(_.consistent_point.split("/").map((j)=>Buffer.from(("00000000"+j).slice(-8),"hex")))};return S.on("data",g),S.on("error",b),S.on("close",E.close),{stream:S,state:R.state};function b(j){console.error("Unexpected error during logical streaming - reconnecting",j)}function g(j){if(j[0]===119)zB(j.subarray(25),x,E.options.parsers,T$,T.transform);else if(j[0]===107&&j[17])x.lsn=j.subarray(1,9),N$()}function T$(j,U$){let t=U$.relation.schema+"."+U$.relation.table;K("*",j,U$),K("*:"+t,j,U$),U$.relation.keys.length&&K("*:"+t+"="+U$.relation.keys.map((z$)=>j[z$.name]),j,U$),K(U$.command,j,U$),K(U$.command+":"+t,j,U$),U$.relation.keys.length&&K(U$.command+":"+t+"="+U$.relation.keys.map((z$)=>j[z$.name]),j,U$)}function N$(){let j=Buffer.alloc(34);j[0]=114,j.fill(x.lsn,1),j.writeBigInt64BE(BigInt(Date.now()-Date.UTC(2000,0,1))*BigInt(1000),25),S.write(j)}}function K(E,M,L){W.has(E)&&W.get(E).forEach(({fn:R})=>R(M,L,E))}}function GB($){return new Date(Date.UTC(2000,0,1)+Number($/BigInt(1000)))}function zB($,T,W,w,X){let U=(Y,[G,H])=>(Y[G.charCodeAt(0)]=H,Y);Object.entries({R:(Y)=>{let G=1,H=T[Y.readUInt32BE(G)]={schema:Y.toString("utf8",G+=4,G=Y.indexOf(0,G))||"pg_catalog",table:Y.toString("utf8",G+1,G=Y.indexOf(0,G+1)),columns:Array(Y.readUInt16BE(G+=2)),keys:[]};G+=2;let z=0,F;while(G<Y.length)F=H.columns[z++]={key:Y[G++],name:X.column.from?X.column.from(Y.toString("utf8",G,G=Y.indexOf(0,G))):Y.toString("utf8",G,G=Y.indexOf(0,G)),type:Y.readUInt32BE(G+=1),parser:W[Y.readUInt32BE(G)],atttypmod:Y.readUInt32BE(G+=4)},F.key&&H.keys.push(F),G+=4},Y:()=>{},O:()=>{},B:(Y)=>{T.date=GB(Y.readBigInt64BE(9)),T.lsn=Y.subarray(1,9)},I:(Y)=>{let G=1,H=T[Y.readUInt32BE(G)],{row:z}=u9(Y,H.columns,G+=7,X);w(z,{command:"insert",relation:H})},D:(Y)=>{let G=1,H=T[Y.readUInt32BE(G)];G+=4;let z=Y[G]===75;w(z||Y[G]===79?u9(Y,H.columns,G+=3,X).row:null,{command:"delete",relation:H,key:z})},U:(Y)=>{let G=1,H=T[Y.readUInt32BE(G)];G+=4;let z=Y[G]===75,F=z||Y[G]===79?u9(Y,H.columns,G+=3,X):null;F&&(G=F.i);let{row:O}=u9(Y,H.columns,G+3,X);w(O,{command:"update",relation:H,key:z,old:F&&F.row})},T:()=>{},C:()=>{}}).reduce(U,{})[$[0]]($)}function u9($,T,W,w){let X,U,Y,G=w.raw?new Array(T.length):{};for(let H=0;H<T.length;H++)X=$[W++],U=T[H],Y=X===110?null:X===117?void 0:U.parser===void 0?$.toString("utf8",W+4,W+=4+$.readUInt32BE(W)):U.parser.array===!0?U.parser($.toString("utf8",W+5,W+=4+$.readUInt32BE(W))):U.parser($.toString("utf8",W+4,W+=4+$.readUInt32BE(W))),w.raw?G[H]=w.raw===!0?Y:w.value.from?w.value.from(Y,U):Y:G[U.name]=w.value.from?w.value.from(Y,U):Y;return{i:W,row:w.row.from?w.row.from(G):G}}function HB($){let T=$.match(/^(\*|insert|update|delete)?:?([^.]+?\.?[^=]+)?=?(.+)?/i)||[];if(!T)throw new Error("Malformed subscribe pattern: "+$);let[,W,w,X]=T;return(W||"*")+(w?":"+(w.indexOf(".")===-1?"public."+w:w):"")+(X?"="+X:"")}import BJ from"stream";function KQ($,T,W=393216){return new Promise(async(w,X)=>{await $.begin(async(U)=>{let Y;!T&&([{oid:T}]=await U`select lo_creat(-1) as oid`);let[{fd:G}]=await U`select lo_open(${T}, ${W}) as fd`,H={writable:F,readable:z,close:()=>U`select lo_close(${G})`.then(Y),tell:()=>U`select lo_tell64(${G})`,read:(O)=>U`select loread(${G}, ${O}) as data`,write:(O)=>U`select lowrite(${G}, ${O})`,truncate:(O)=>U`select lo_truncate64(${G}, ${O})`,seek:(O,Q=0)=>U`select lo_lseek64(${G}, ${O}, ${Q})`,size:()=>U`
|
|
92
94
|
select
|
|
93
95
|
lo_lseek64(${G}, location, 0) as position,
|
|
94
96
|
seek.size
|
|
@@ -98,63 +100,63 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
98
100
|
tell.location
|
|
99
101
|
from (select lo_tell64($1) as location) tell
|
|
100
102
|
) seek
|
|
101
|
-
`};return U(H),new Promise(async(O)=>w=O);async function z({highWaterMark:O=16384,start:Q=0,end:Z=1/0}={}){let V=Z-Q;return Q&&await H.seek(Q),new u_.Readable({highWaterMark:O,async read(E){let N=E>V?E-V:E;V-=E;let[{data:J}]=await H.read(N);if(this.push(J),J.length<E)this.push(null)}})}async function F({highWaterMark:O=16384,start:Q=0}={}){return Q&&await H.seek(Q),new u_.Writable({highWaterMark:O,write(Z,V,E){H.write(Z).then(()=>E(),E)}})}}).catch(X)})}Object.assign(wz,{PostgresError:zU,toPascal:mW,pascal:BQ,toCamel:gW,camel:jQ,toKebab:cW,kebab:xQ,fromPascal:EY,fromCamel:KY,fromKebab:AY,BigInt:{to:20,from:[20],parse:($)=>BigInt($),serialize:($)=>$.toString()}});var FU=wz;function wz($,T){let W=Bf($,T),U=W.no_subscribe||hQ(wz,{...W}),X=!1,Y=O1(),w=O1(),G=O1(),H=O1(),z=O1(),F=O1(),O=O1(),Q=O1(),Z={connecting:w,reserved:G,closed:H,ended:z,open:F,busy:O,full:Q},V=[...Array(W.max)].map(()=>yQ(W,Z,{onopen:f4,onend:s$,onclose:n6})),E=N(a);return Object.assign(E,{get parameters(){return W.parameters},largeObject:gQ.bind(null,E),subscribe:U,CLOSE:GU,END:GU,PostgresError:zU,options:W,reserve:R,listen:J,begin:P,close:n,end:W$}),E;function N(g){return g.debug=W.debug,Object.entries(W.types).reduce((N$,[h$,M4])=>{return N$[h$]=(w4)=>new H0(w4,M4.to),N$},G$),Object.assign(y$,{types:G$,typed:G$,unsafe:Y4,notify:_,array:h,json:f,file:R4}),y$;function G$(N$,h$){return new H0(N$,h$)}function y$(N$,...h$){return N$&&Array.isArray(N$.raw)?new R1(N$,h$,g,S):typeof N$==="string"&&!h$.length?new MY(W.transform.column.to?W.transform.column.to(N$):N$):new $z(N$,h$)}function Y4(N$,h$=[],M4={}){return arguments.length===2&&!Array.isArray(h$)&&(M4=h$,h$=[]),new R1([N$],h$,g,S,{prepare:!1,...M4,simple:"simple"in M4?M4.simple:h$.length===0})}function R4(N$,h$=[],M4={}){return arguments.length===2&&!Array.isArray(h$)&&(M4=h$,h$=[]),new R1([],h$,(e$)=>{jf.readFile(N$,"utf8",(n4,o$)=>{if(n4)return e$.reject(n4);e$.strings=[o$],g(e$)})},S,{...M4,simple:"simple"in M4?M4.simple:h$.length===0})}}async function J(g,G$,y$){let Y4={fn:G$,onlisten:y$},R4=J.sql||(J.sql=wz({...W,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(J.channels).forEach(([e$,{listeners:n4}])=>{delete J.channels[e$],Promise.all(n4.map((o$)=>J(e$,o$.fn,o$.onlisten).catch(()=>{})))})},onnotify(e$,n4){e$ in J.channels&&J.channels[e$].listeners.forEach((o$)=>o$.fn(n4))}})),N$=J.channels||(J.channels={});if(g in N$){N$[g].listeners.push(Y4);let e$=await N$[g].result;return Y4.onlisten&&Y4.onlisten(),{state:e$.state,unlisten:w4}}N$[g]={result:R4`listen ${R4.unsafe('"'+g.replace(/"/g,'""')+'"')}`,listeners:[Y4]};let M4=await N$[g].result;return Y4.onlisten&&Y4.onlisten(),{state:M4.state,unlisten:w4};async function w4(){if(g in N$===!1)return;if(N$[g].listeners=N$[g].listeners.filter((e$)=>e$!==Y4),N$[g].listeners.length)return;return delete N$[g],R4`unlisten ${R4.unsafe('"'+g.replace(/"/g,'""')+'"')}`}}async function _(g,G$){return await E`select pg_notify(${g}, ${""+G$})`}async function R(){let g=O1(),G$=F.length?F.shift():await new Promise((R4,N$)=>{let h$={reserve:R4,reject:N$};Y.push(h$),H.length&&j$(H.shift(),h$)});x(G$,G),G$.reserved=()=>g.length?G$.execute(g.shift()):x(G$,G),G$.reserved.release=!0;let y$=N(Y4);return y$.release=()=>{G$.reserved=null,f4(G$)},y$;function Y4(R4){G$.queue===Q?g.push(R4):G$.execute(R4)||x(G$,Q)}}async function P(g,G$){!G$&&(G$=g,g="");let y$=O1(),Y4=0,R4,N$=null;try{return await E.unsafe("begin "+g.replace(/[^a-z ]/ig,""),[],{onexecute:M4}).execute(),await Promise.race([h$(R4,G$),new Promise((w4,e$)=>R4.onclose=e$)])}catch(w4){throw w4}async function h$(w4,e$,n4){let o$=N(k4);o$.savepoint=XT,o$.prepare=($4)=>N$=$4.replace(/[^a-z0-9$-_. ]/gi);let C1,c4;n4&&await o$`savepoint ${o$(n4)}`;try{if(c4=await new Promise(($4,S1)=>{let o1=e$(o$);Promise.resolve(Array.isArray(o1)?Promise.all(o1):o1).then($4,S1)}),C1)throw C1}catch($4){throw await(n4?o$`rollback to ${o$(n4)}`:o$`rollback`),$4 instanceof zU&&$4.code==="25P02"&&C1||$4}if(!n4)N$?await o$`prepare transaction '${o$.unsafe(N$)}'`:await o$`commit`;return c4;function XT($4,S1){if($4&&Array.isArray($4.raw))return XT((o1)=>o1.apply(o1,arguments));return arguments.length===1&&(S1=$4,$4=null),h$(w4,S1,"s"+Y4+++($4?"_"+$4:""))}function k4($4){$4.catch((S1)=>C1||(C1=S1)),w4.queue===Q?y$.push($4):w4.execute($4)||x(w4,Q)}}function M4(w4){R4=w4,x(w4,G),w4.reserved=()=>y$.length?w4.execute(y$.shift()):x(w4,G)}}function x(g,G$){return g.queue.remove(g),G$.push(g),g.queue=G$,G$===F?g.idleTimer.start():g.idleTimer.cancel(),g}function f(g){return new H0(g,3802)}function h(g,G$){if(!Array.isArray(g))return h(Array.from(arguments));return new H0(g,G$||(g.length?s9(g)||25:0),W.shared.typeArrayMap)}function a(g){if(X)return g.reject(J4.connection("CONNECTION_ENDED",W,W));if(F.length)return M$(F.shift(),g);if(H.length)return j$(H.shift(),g);O.length?M$(O.shift(),g):Y.push(g)}function M$(g,G$){return g.execute(G$)?x(g,O):x(g,Q)}function S(g){return new Promise((G$,y$)=>{g.state?g.active?yQ(W).cancel(g.state,G$,y$):g.cancelled={resolve:G$,reject:y$}:(Y.remove(g),g.cancelled=!0,g.reject(J4.generic("57014","canceling statement due to user request")),G$())})}async function W$({timeout:g=null}={}){if(X)return X;await 1;let G$;return X=Promise.race([new Promise((y$)=>g!==null&&(G$=setTimeout(Y$,g*1000,y$))),Promise.all(V.map((y$)=>y$.end()).concat(J.sql?J.sql.end({timeout:0}):[],U.sql?U.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(G$))}async function n(){await Promise.all(V.map((g)=>g.end()))}async function Y$(g){await Promise.all(V.map((G$)=>G$.terminate()));while(Y.length)Y.shift().reject(J4.connection("CONNECTION_DESTROYED",W));g()}function j$(g,G$){return x(g,w),g.connect(G$),g}function s$(g){x(g,z)}function f4(g){if(Y.length===0)return x(g,F);let G$=Math.ceil(Y.length/(w.length+1)),y$=!0;while(y$&&Y.length&&G$-- >0){let Y4=Y.shift();if(Y4.reserve)return Y4.reserve(g);y$=g.execute(Y4)}y$?x(g,O):x(g,Q)}function n6(g,G$){x(g,H),g.reserved=null,g.onclose&&(g.onclose(G$),g.onclose=null),W.onclose&&W.onclose(g.id),Y.length&&j$(g,Y.shift())}}function Bf($,T){if($&&$.shared)return $;let W=process.env,U=(!$||typeof $==="string"?T:$)||{},{url:X,multihost:Y}=yf($),w=[...X.searchParams].reduce((Q,[Z,V])=>(Q[Z]=V,Q),{}),G=U.hostname||U.host||Y||X.hostname||W.PGHOST||"localhost",H=U.port||X.port||W.PGPORT||5432,z=U.user||U.username||X.username||W.PGUSERNAME||W.PGUSER||hf();U.no_prepare&&(U.prepare=!1),w.sslmode&&(w.ssl=w.sslmode,delete w.sslmode),"timeout"in U&&(console.log("The timeout option is deprecated, use idle_timeout instead"),U.idle_timeout=U.timeout),w.sslrootcert==="system"&&(w.ssl="verify-full");let F=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],O={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:bf,max_pipeline:100,backoff:If,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(G)?G:G.split(",").map((Q)=>Q.split(":")[0]),port:Array.isArray(H)?H:G.split(",").map((Q)=>parseInt(Q.split(":")[1]||H)),path:U.path||G.indexOf("/")>-1&&G+"/.s.PGSQL."+H,database:U.database||U.db||(X.pathname||"").slice(1)||W.PGDATABASE||z,user:z,pass:U.pass||U.password||X.password||W.PGPASSWORD||"",...Object.entries(O).reduce((Q,[Z,V])=>{let E=Z in U?U[Z]:(Z in w)?w[Z]==="disable"||w[Z]==="false"?!1:w[Z]:W["PG"+Z.toUpperCase()]||V;return Q[Z]=typeof E==="string"&&F.includes(Z)?+E:E,Q},{}),connection:{application_name:W.PGAPPNAME||"postgres.js",...U.connection,...Object.entries(w).reduce((Q,[Z,V])=>((Z in O)||(Q[Z]=V),Q),{})},types:U.types||{},target_session_attrs:xf(U,X,W),onnotice:U.onnotice,onnotify:U.onnotify,onclose:U.onclose,onparameter:U.onparameter,socket:U.socket,transform:ff(U.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...j_(U.types)}}function xf($,T,W){let U=$.target_session_attrs||T.searchParams.get("target_session_attrs")||W.PGTARGETSESSIONATTRS;if(!U||["read-write","read-only","primary","standby","prefer-standby"].includes(U))return U;throw new Error("target_session_attrs "+U+" is not supported")}function If($){return(0.5+Math.random()/2)*Math.min(3**$/100,20)}function bf(){return 60*(30+Math.random()*30)}function ff($){return{undefined:$.undefined,column:{from:typeof $.column==="function"?$.column:$.column&&$.column.from,to:$.column&&$.column.to},value:{from:typeof $.value==="function"?$.value:$.value&&$.value.from,to:$.value&&$.value.to},row:{from:typeof $.row==="function"?$.row:$.row&&$.row.from,to:$.row&&$.row.to}}}function yf($){if(!$||typeof $!=="string")return{url:{searchParams:new Map}};let T=$;T=T.slice(T.indexOf("://")+3).split(/[?/]/)[0],T=decodeURIComponent(T.slice(T.indexOf("@")+1));let W=new URL($.replace(T,T.split(",")[0]));return{url:{username:decodeURIComponent(W.username),password:decodeURIComponent(W.password),host:W.host,hostname:W.hostname,port:W.port,pathname:W.pathname,searchParams:W.searchParams},multihost:T.indexOf(",")>-1&&T}}function hf(){try{return Sf.userInfo().username}catch($){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class E4{static[M]="SelectionProxyHandler";config;constructor($){this.config={...$}}get($,T){if(T==="_")return{...$._,selectedFields:new Proxy($._.selectedFields,this)};if(T===i$)return{...$[i$],selectedFields:new Proxy($[i$].selectedFields,this)};if(typeof T==="symbol")return $[T];let U=(j($,A4)?$._.selectedFields:j($,c6)?$[i$].selectedFields:$)[T];if(j(U,i.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!U.isSelectionField)return U.sql;let X=U.clone();return X.isSelectionField=!0,X}if(j(U,i)){if(this.config.sqlBehavior==="sql")return U;throw new Error(`You tried to reference "${T}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(j(U,u$)){if(this.config.alias)return new Proxy(U,new wU(new Proxy(U.table,new zY(this.config.alias,this.config.replaceOriginalName??!1))));return U}if(typeof U!=="object"||U===null)return U;return new Proxy(U,new E4(this.config))}}class p_{constructor($,T){this.unique=$,this.name=T}static[M]="PgIndexBuilderOn";on(...$){return new Gz($.map((T)=>{if(j(T,i))return T;T=T;let W=new XY(T.name,!!T.keyAsName,T.columnType,T.indexConfig);return T.indexConfig=JSON.parse(JSON.stringify(T.defaultConfig)),W}),this.unique,!1,this.name)}onOnly(...$){return new Gz($.map((T)=>{if(j(T,i))return T;T=T;let W=new XY(T.name,!!T.keyAsName,T.columnType,T.indexConfig);return T.indexConfig=T.defaultConfig,W}),this.unique,!0,this.name)}using($,...T){return new Gz(T.map((W)=>{if(j(W,i))return W;W=W;let U=new XY(W.name,!!W.keyAsName,W.columnType,W.indexConfig);return W.indexConfig=JSON.parse(JSON.stringify(W.defaultConfig)),U}),this.unique,!0,this.name,$)}}class Gz{static[M]="PgIndexBuilder";config;constructor($,T,W,U,X="btree"){this.config={name:U,columns:$,unique:T,only:W,method:X}}concurrently(){return this.config.concurrently=!0,this}with($){return this.config.with=$,this}where($){return this.config.where=$,this}build($){return new d_(this.config,$)}}class d_{static[M]="PgIndex";config;constructor($,T){this.config={...$,table:T}}}function mQ($){return new p_(!0,$)}function gf($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((W)=>W.toLowerCase()).join("_")}function mf($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((W,U,X)=>{let Y=X===0?U.toLowerCase():`${U[0].toUpperCase()}${U.slice(1)}`;return W+Y},"")}function cf($){return $}class cQ{static[M]="CasingCache";cache={};cachedTables={};convert;constructor($){this.convert=$==="snake_case"?gf:$==="camelCase"?mf:cf}getColumnCasing($){if(!$.keyAsName)return $.name;let T=$.table[p.Symbol.Schema]??"public",W=$.table[p.Symbol.OriginalName],U=`${T}.${W}.${$.name}`;if(!this.cache[U])this.cacheTable($.table);return this.cache[U]}cacheTable($){let T=$[p.Symbol.Schema]??"public",W=$[p.Symbol.OriginalName],U=`${T}.${W}`;if(!this.cachedTables[U]){for(let X of Object.values($[p.Symbol.Columns])){let Y=`${U}.${X.name}`;this.cache[Y]=this.convert(X.name)}this.cachedTables[U]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class LY extends c6{static[M]="PgViewBase"}class pW{static[M]="PgDialect";casing;constructor($){this.casing=new cQ($?.casing)}async migrate($,T,W){let U=typeof W==="string"?"__drizzle_migrations":W.migrationsTable??"__drizzle_migrations",X=typeof W==="string"?"drizzle":W.migrationsSchema??"drizzle",Y=L`
|
|
102
|
-
CREATE TABLE IF NOT EXISTS ${
|
|
103
|
+
`};return w(H),new Promise(async(O)=>Y=O);async function z({highWaterMark:O=16384,start:Q=0,end:Z=1/0}={}){let K=Z-Q;return Q&&await H.seek(Q),new BJ.Readable({highWaterMark:O,async read(E){let M=E>K?E-K:E;K-=E;let[{data:L}]=await H.read(M);if(this.push(L),L.length<E)this.push(null)}})}async function F({highWaterMark:O=16384,start:Q=0}={}){return Q&&await H.seek(Q),new BJ.Writable({highWaterMark:O,write(Z,K,E){H.write(Z).then(()=>E(),E)}})}}).catch(X)})}Object.assign(p9,{PostgresError:l2,toPascal:qW,pascal:zQ,toCamel:vW,camel:GQ,toKebab:PW,kebab:HQ,fromPascal:FU,fromCamel:HU,fromKebab:OU,BigInt:{to:20,from:[20],parse:($)=>BigInt($),serialize:($)=>$.toString()}});var n2=p9;function p9($,T){let W=QB($,T),w=W.no_subscribe||VQ(p9,{...W}),X=!1,U=O1(),Y=O1(),G=O1(),H=O1(),z=O1(),F=O1(),O=O1(),Q=O1(),Z={connecting:Y,reserved:G,closed:H,ended:z,open:F,busy:O,full:Q},K=[...Array(W.max)].map(()=>ZQ(W,Z,{onopen:h4,onend:e$,onclose:n6})),E=M(T$);return Object.assign(E,{get parameters(){return W.parameters},largeObject:KQ.bind(null,E),subscribe:w,CLOSE:o2,END:o2,PostgresError:l2,options:W,reserve:_,listen:L,begin:S,close:t,end:U$}),E;function M(c){return c.debug=W.debug,Object.entries(W.types).reduce((L$,[m$,D4])=>{return L$[m$]=(G4)=>new G0(G4,D4.to),L$},F$),Object.assign(g$,{types:F$,typed:F$,unsafe:Y4,notify:R,array:g,json:b,file:_4}),g$;function F$(L$,m$){return new G0(L$,m$)}function g$(L$,...m$){return L$&&Array.isArray(L$.raw)?new J1(L$,m$,c,j):typeof L$==="string"&&!m$.length?new QU(W.transform.column.to?W.transform.column.to(L$):L$):new y9(L$,m$)}function Y4(L$,m$=[],D4={}){return arguments.length===2&&!Array.isArray(m$)&&(D4=m$,m$=[]),new J1([L$],m$,c,j,{prepare:!1,...D4,simple:"simple"in D4?D4.simple:m$.length===0})}function _4(L$,m$=[],D4={}){return arguments.length===2&&!Array.isArray(m$)&&(D4=m$,m$=[]),new J1([],m$,($4)=>{OB.readFile(L$,"utf8",(t4,l$)=>{if(t4)return $4.reject(t4);$4.strings=[l$],c($4)})},j,{...D4,simple:"simple"in D4?D4.simple:m$.length===0})}}async function L(c,F$,g$){let Y4={fn:F$,onlisten:g$},_4=L.sql||(L.sql=p9({...W,max:1,idle_timeout:null,max_lifetime:null,fetch_types:!1,onclose(){Object.entries(L.channels).forEach(([$4,{listeners:t4}])=>{delete L.channels[$4],Promise.all(t4.map((l$)=>L($4,l$.fn,l$.onlisten).catch(()=>{})))})},onnotify($4,t4){$4 in L.channels&&L.channels[$4].listeners.forEach((l$)=>l$.fn(t4))}})),L$=L.channels||(L.channels={});if(c in L$){L$[c].listeners.push(Y4);let $4=await L$[c].result;return Y4.onlisten&&Y4.onlisten(),{state:$4.state,unlisten:G4}}L$[c]={result:_4`listen ${_4.unsafe('"'+c.replace(/"/g,'""')+'"')}`,listeners:[Y4]};let D4=await L$[c].result;return Y4.onlisten&&Y4.onlisten(),{state:D4.state,unlisten:G4};async function G4(){if(c in L$===!1)return;if(L$[c].listeners=L$[c].listeners.filter(($4)=>$4!==Y4),L$[c].listeners.length)return;return delete L$[c],_4`unlisten ${_4.unsafe('"'+c.replace(/"/g,'""')+'"')}`}}async function R(c,F$){return await E`select pg_notify(${c}, ${""+F$})`}async function _(){let c=O1(),F$=F.length?F.shift():await new Promise((_4,L$)=>{let m$={reserve:_4,reject:L$};U.push(m$),H.length&&B$(H.shift(),m$)});x(F$,G),F$.reserved=()=>c.length?F$.execute(c.shift()):x(F$,G),F$.reserved.release=!0;let g$=M(Y4);return g$.release=()=>{F$.reserved=null,h4(F$)},g$;function Y4(_4){F$.queue===Q?c.push(_4):F$.execute(_4)||x(F$,Q)}}async function S(c,F$){!F$&&(F$=c,c="");let g$=O1(),Y4=0,_4,L$=null;try{return await E.unsafe("begin "+c.replace(/[^a-z ]/ig,""),[],{onexecute:D4}).execute(),await Promise.race([m$(_4,F$),new Promise((G4,$4)=>_4.onclose=$4)])}catch(G4){throw G4}async function m$(G4,$4,t4){let l$=M(k4);l$.savepoint=a0,l$.prepare=(T4)=>L$=T4.replace(/[^a-z0-9$-_. ]/gi);let q1,p4;t4&&await l$`savepoint ${l$(t4)}`;try{if(p4=await new Promise((T4,P1)=>{let u1=$4(l$);Promise.resolve(Array.isArray(u1)?Promise.all(u1):u1).then(T4,P1)}),q1)throw q1}catch(T4){throw await(t4?l$`rollback to ${l$(t4)}`:l$`rollback`),T4 instanceof l2&&T4.code==="25P02"&&q1||T4}if(!t4)L$?await l$`prepare transaction '${l$.unsafe(L$)}'`:await l$`commit`;return p4;function a0(T4,P1){if(T4&&Array.isArray(T4.raw))return a0((u1)=>u1.apply(u1,arguments));return arguments.length===1&&(P1=T4,T4=null),m$(G4,P1,"s"+Y4+++(T4?"_"+T4:""))}function k4(T4){T4.catch((P1)=>q1||(q1=P1)),G4.queue===Q?g$.push(T4):G4.execute(T4)||x(G4,Q)}}function D4(G4){_4=G4,x(G4,G),G4.reserved=()=>g$.length?G4.execute(g$.shift()):x(G4,G)}}function x(c,F$){return c.queue.remove(c),F$.push(c),c.queue=F$,F$===F?c.idleTimer.start():c.idleTimer.cancel(),c}function b(c){return new G0(c,3802)}function g(c,F$){if(!Array.isArray(c))return g(Array.from(arguments));return new G0(c,F$||(c.length?f9(c)||25:0),W.shared.typeArrayMap)}function T$(c){if(X)return c.reject(J4.connection("CONNECTION_ENDED",W,W));if(F.length)return N$(F.shift(),c);if(H.length)return B$(H.shift(),c);O.length?N$(O.shift(),c):U.push(c)}function N$(c,F$){return c.execute(F$)?x(c,O):x(c,Q)}function j(c){return new Promise((F$,g$)=>{c.state?c.active?ZQ(W).cancel(c.state,F$,g$):c.cancelled={resolve:F$,reject:g$}:(U.remove(c),c.cancelled=!0,c.reject(J4.generic("57014","canceling statement due to user request")),F$())})}async function U$({timeout:c=null}={}){if(X)return X;await 1;let F$;return X=Promise.race([new Promise((g$)=>c!==null&&(F$=setTimeout(z$,c*1000,g$))),Promise.all(K.map((g$)=>g$.end()).concat(L.sql?L.sql.end({timeout:0}):[],w.sql?w.sql.end({timeout:0}):[]))]).then(()=>clearTimeout(F$))}async function t(){await Promise.all(K.map((c)=>c.end()))}async function z$(c){await Promise.all(K.map((F$)=>F$.terminate()));while(U.length)U.shift().reject(J4.connection("CONNECTION_DESTROYED",W));c()}function B$(c,F$){return x(c,Y),c.connect(F$),c}function e$(c){x(c,z)}function h4(c){if(U.length===0)return x(c,F);let F$=Math.ceil(U.length/(Y.length+1)),g$=!0;while(g$&&U.length&&F$-- >0){let Y4=U.shift();if(Y4.reserve)return Y4.reserve(c);g$=c.execute(Y4)}g$?x(c,O):x(c,Q)}function n6(c,F$){x(c,H),c.reserved=null,c.onclose&&(c.onclose(F$),c.onclose=null),W.onclose&&W.onclose(c.id),U.length&&B$(c,U.shift())}}function QB($,T){if($&&$.shared)return $;let W=process.env,w=(!$||typeof $==="string"?T:$)||{},{url:X,multihost:U}=EB($),Y=[...X.searchParams].reduce((Q,[Z,K])=>(Q[Z]=K,Q),{}),G=w.hostname||w.host||U||X.hostname||W.PGHOST||"localhost",H=w.port||X.port||W.PGPORT||5432,z=w.user||w.username||X.username||W.PGUSERNAME||W.PGUSER||MB();w.no_prepare&&(w.prepare=!1),Y.sslmode&&(Y.ssl=Y.sslmode,delete Y.sslmode),"timeout"in w&&(console.log("The timeout option is deprecated, use idle_timeout instead"),w.idle_timeout=w.timeout),Y.sslrootcert==="system"&&(Y.ssl="verify-full");let F=["idle_timeout","connect_timeout","max_lifetime","max_pipeline","backoff","keep_alive"],O={max:10,ssl:!1,idle_timeout:null,connect_timeout:30,max_lifetime:KB,max_pipeline:100,backoff:VB,keep_alive:60,prepare:!0,debug:!1,fetch_types:!0,publications:"alltables",target_session_attrs:null};return{host:Array.isArray(G)?G:G.split(",").map((Q)=>Q.split(":")[0]),port:Array.isArray(H)?H:G.split(",").map((Q)=>parseInt(Q.split(":")[1]||H)),path:w.path||G.indexOf("/")>-1&&G+"/.s.PGSQL."+H,database:w.database||w.db||(X.pathname||"").slice(1)||W.PGDATABASE||z,user:z,pass:w.pass||w.password||X.password||W.PGPASSWORD||"",...Object.entries(O).reduce((Q,[Z,K])=>{let E=Z in w?w[Z]:(Z in Y)?Y[Z]==="disable"||Y[Z]==="false"?!1:Y[Z]:W["PG"+Z.toUpperCase()]||K;return Q[Z]=typeof E==="string"&&F.includes(Z)?+E:E,Q},{}),connection:{application_name:W.PGAPPNAME||"postgres.js",...w.connection,...Object.entries(Y).reduce((Q,[Z,K])=>((Z in O)||(Q[Z]=K),Q),{})},types:w.types||{},target_session_attrs:ZB(w,X,W),onnotice:w.onnotice,onnotify:w.onnotify,onclose:w.onclose,onparameter:w.onparameter,socket:w.socket,transform:AB(w.transform||{undefined:void 0}),parameters:{},shared:{retries:0,typeArrayMap:{}},...JJ(w.types)}}function ZB($,T,W){let w=$.target_session_attrs||T.searchParams.get("target_session_attrs")||W.PGTARGETSESSIONATTRS;if(!w||["read-write","read-only","primary","standby","prefer-standby"].includes(w))return w;throw new Error("target_session_attrs "+w+" is not supported")}function VB($){return(0.5+Math.random()/2)*Math.min(3**$/100,20)}function KB(){return 60*(30+Math.random()*30)}function AB($){return{undefined:$.undefined,column:{from:typeof $.column==="function"?$.column:$.column&&$.column.from,to:$.column&&$.column.to},value:{from:typeof $.value==="function"?$.value:$.value&&$.value.from,to:$.value&&$.value.to},row:{from:typeof $.row==="function"?$.row:$.row&&$.row.from,to:$.row&&$.row.to}}}function EB($){if(!$||typeof $!=="string")return{url:{searchParams:new Map}};let T=$;T=T.slice(T.indexOf("://")+3).split(/[?/]/)[0],T=decodeURIComponent(T.slice(T.indexOf("@")+1));let W=new URL($.replace(T,T.split(",")[0]));return{url:{username:decodeURIComponent(W.username),password:decodeURIComponent(W.password),host:W.host,hostname:W.hostname,port:W.port,pathname:W.pathname,searchParams:W.searchParams},multihost:T.indexOf(",")>-1&&T}}function MB(){try{return FB.userInfo().username}catch($){return process.env.USERNAME||process.env.USER||process.env.LOGNAME}}class E4{static[N]="SelectionProxyHandler";config;constructor($){this.config={...$}}get($,T){if(T==="_")return{...$._,selectedFields:new Proxy($._.selectedFields,this)};if(T===t$)return{...$[t$],selectedFields:new Proxy($[t$].selectedFields,this)};if(typeof T==="symbol")return $[T];let w=(I($,M4)?$._.selectedFields:I($,c6)?$[t$].selectedFields:$)[T];if(I(w,s.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!w.isSelectionField)return w.sql;let X=w.clone();return X.isSelectionField=!0,X}if(I(w,s)){if(this.config.sqlBehavior==="sql")return w;throw new Error(`You tried to reference "${T}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(I(w,p$)){if(this.config.alias)return new Proxy(w,new d2(new Proxy(w.table,new TU(this.config.alias,this.config.replaceOriginalName??!1))));return w}if(typeof w!=="object"||w===null)return w;return new Proxy(w,new E4(this.config))}}class xJ{constructor($,T){this.unique=$,this.name=T}static[N]="PgIndexBuilderOn";on(...$){return new d9($.map((T)=>{if(I(T,s))return T;T=T;let W=new aw(T.name,!!T.keyAsName,T.columnType,T.indexConfig);return T.indexConfig=JSON.parse(JSON.stringify(T.defaultConfig)),W}),this.unique,!1,this.name)}onOnly(...$){return new d9($.map((T)=>{if(I(T,s))return T;T=T;let W=new aw(T.name,!!T.keyAsName,T.columnType,T.indexConfig);return T.indexConfig=T.defaultConfig,W}),this.unique,!0,this.name)}using($,...T){return new d9(T.map((W)=>{if(I(W,s))return W;W=W;let w=new aw(W.name,!!W.keyAsName,W.columnType,W.indexConfig);return W.indexConfig=JSON.parse(JSON.stringify(W.defaultConfig)),w}),this.unique,!0,this.name,$)}}class d9{static[N]="PgIndexBuilder";config;constructor($,T,W,w,X="btree"){this.config={name:w,columns:$,unique:T,only:W,method:X}}concurrently(){return this.config.concurrently=!0,this}with($){return this.config.with=$,this}where($){return this.config.where=$,this}build($){return new fJ(this.config,$)}}class fJ{static[N]="PgIndex";config;constructor($,T){this.config={...$,table:T}}}function AQ($){return new xJ(!0,$)}function DB($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((W)=>W.toLowerCase()).join("_")}function NB($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((W,w,X)=>{let U=X===0?w.toLowerCase():`${w[0].toUpperCase()}${w.slice(1)}`;return W+U},"")}function LB($){return $}class EQ{static[N]="CasingCache";cache={};cachedTables={};convert;constructor($){this.convert=$==="snake_case"?DB:$==="camelCase"?NB:LB}getColumnCasing($){if(!$.keyAsName)return $.name;let T=$.table[o.Symbol.Schema]??"public",W=$.table[o.Symbol.OriginalName],w=`${T}.${W}.${$.name}`;if(!this.cache[w])this.cacheTable($.table);return this.cache[w]}cacheTable($){let T=$[o.Symbol.Schema]??"public",W=$[o.Symbol.OriginalName],w=`${T}.${W}`;if(!this.cachedTables[w]){for(let X of Object.values($[o.Symbol.Columns])){let U=`${w}.${X.name}`;this.cache[U]=this.convert(X.name)}this.cachedTables[w]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class VU extends c6{static[N]="PgViewBase"}class SW{static[N]="PgDialect";casing;constructor($){this.casing=new EQ($?.casing)}async migrate($,T,W){let w=typeof W==="string"?"__drizzle_migrations":W.migrationsTable??"__drizzle_migrations",X=typeof W==="string"?"drizzle":W.migrationsSchema??"drizzle",U=J`
|
|
104
|
+
CREATE TABLE IF NOT EXISTS ${J.identifier(X)}.${J.identifier(w)} (
|
|
103
105
|
id SERIAL PRIMARY KEY,
|
|
104
106
|
hash text NOT NULL,
|
|
105
107
|
created_at bigint
|
|
106
108
|
)
|
|
107
|
-
`;await T.execute(L`CREATE SCHEMA IF NOT EXISTS ${L.identifier(X)}`),await T.execute(Y);let G=(await T.all(L`select id, hash, created_at from ${L.identifier(X)}.${L.identifier(U)} order by created_at desc limit 1`))[0];await T.transaction(async(H)=>{for await(let z of $)if(!G||Number(G.created_at)<z.folderMillis){for(let F of z.sql)await H.execute(L.raw(F));await H.execute(L`insert into ${L.identifier(X)}.${L.identifier(U)} ("hash", "created_at") values(${z.hash}, ${z.folderMillis})`)}})}escapeName($){return`"${$}"`}escapeParam($){return`$${$+1}`}escapeString($){return`'${$.replace(/'/g,"''")}'`}buildWithCTE($){if(!$?.length)return;let T=[L`with `];for(let[W,U]of $.entries())if(T.push(L`${L.identifier(U._.alias)} as (${U._.sql})`),W<$.length-1)T.push(L`, `);return T.push(L` `),L.join(T)}buildDeleteQuery({table:$,where:T,returning:W,withList:U}){let X=this.buildWithCTE(U),Y=W?L` returning ${this.buildSelection(W,{isSingleTable:!0})}`:void 0,w=T?L` where ${T}`:void 0;return L`${X}delete from ${$}${w}${Y}`}buildUpdateSet($,T){let W=$[p.Symbol.Columns],U=Object.keys(W).filter((Y)=>T[Y]!==void 0||W[Y]?.onUpdateFn!==void 0),X=U.length;return L.join(U.flatMap((Y,w)=>{let G=W[Y],H=T[Y]??L.param(G.onUpdateFn(),G),z=L`${L.identifier(this.casing.getColumnCasing(G))} = ${H}`;if(w<X-1)return[z,L.raw(", ")];return[z]}))}buildUpdateQuery({table:$,set:T,where:W,returning:U,withList:X,from:Y,joins:w}){let G=this.buildWithCTE(X),H=$[B4.Symbol.Name],z=$[B4.Symbol.Schema],F=$[B4.Symbol.OriginalName],O=H===F?void 0:H,Q=L`${z?L`${L.identifier(z)}.`:void 0}${L.identifier(F)}${O&&L` ${L.identifier(O)}`}`,Z=this.buildUpdateSet($,T),V=Y&&L.join([L.raw(" from "),this.buildFromTable(Y)]),E=this.buildJoins(w),N=U?L` returning ${this.buildSelection(U,{isSingleTable:!Y})}`:void 0,J=W?L` where ${W}`:void 0;return L`${G}update ${Q} set ${Z}${V}${E}${J}${N}`}buildSelection($,{isSingleTable:T=!1}={}){let W=$.length,U=$.flatMap(({field:X},Y)=>{let w=[];if(j(X,i.Aliased)&&X.isSelectionField)w.push(L.identifier(X.fieldAlias));else if(j(X,i.Aliased)||j(X,i)){let G=j(X,i.Aliased)?X.sql:X;if(T)w.push(new i(G.queryChunks.map((H)=>{if(j(H,u))return L.identifier(this.casing.getColumnCasing(H));return H})));else w.push(G);if(j(X,i.Aliased))w.push(L` as ${L.identifier(X.fieldAlias)}`)}else if(j(X,u$))if(T)w.push(L.identifier(this.casing.getColumnCasing(X)));else w.push(X);if(Y<W-1)w.push(L`, `);return w});return L.join(U)}buildJoins($){if(!$||$.length===0)return;let T=[];for(let[W,U]of $.entries()){if(W===0)T.push(L` `);let X=U.table,Y=U.lateral?L` lateral`:void 0,w=U.on?L` on ${U.on}`:void 0;if(j(X,B4)){let G=X[B4.Symbol.Name],H=X[B4.Symbol.Schema],z=X[B4.Symbol.OriginalName],F=G===z?void 0:U.alias;T.push(L`${L.raw(U.joinType)} join${Y} ${H?L`${L.identifier(H)}.`:void 0}${L.identifier(z)}${F&&L` ${L.identifier(F)}`}${w}`)}else if(j(X,c6)){let G=X[i$].name,H=X[i$].schema,z=X[i$].originalName,F=G===z?void 0:U.alias;T.push(L`${L.raw(U.joinType)} join${Y} ${H?L`${L.identifier(H)}.`:void 0}${L.identifier(z)}${F&&L` ${L.identifier(F)}`}${w}`)}else T.push(L`${L.raw(U.joinType)} join${Y} ${X}${w}`);if(W<$.length-1)T.push(L` `)}return L.join(T)}buildFromTable($){if(j($,p)&&$[p.Symbol.IsAlias]){let T=L`${L.identifier($[p.Symbol.OriginalName])}`;if($[p.Symbol.Schema])T=L`${L.identifier($[p.Symbol.Schema])}.${T}`;return L`${T} ${L.identifier($[p.Symbol.Name])}`}return $}buildSelectQuery({withList:$,fields:T,fieldsFlat:W,where:U,having:X,table:Y,joins:w,orderBy:G,groupBy:H,limit:z,offset:F,lockingClause:O,distinct:Q,setOperators:Z}){let V=W??J1(T);for(let Y$ of V)if(j(Y$.field,u$)&&m4(Y$.field.table)!==(j(Y,A4)?Y._.alias:j(Y,LY)?Y[i$].name:j(Y,i)?void 0:m4(Y))&&!((j$)=>w?.some(({alias:s$})=>s$===(j$[p.Symbol.IsAlias]?m4(j$):j$[p.Symbol.BaseName])))(Y$.field.table)){let j$=m4(Y$.field.table);throw new Error(`Your "${Y$.path.join("->")}" field references a column "${j$}"."${Y$.field.name}", but the table "${j$}" is not part of the query! Did you forget to join it?`)}let E=!w||w.length===0,N=this.buildWithCTE($),J;if(Q)J=Q===!0?L` distinct`:L` distinct on (${L.join(Q.on,L`, `)})`;let _=this.buildSelection(V,{isSingleTable:E}),R=this.buildFromTable(Y),P=this.buildJoins(w),x=U?L` where ${U}`:void 0,f=X?L` having ${X}`:void 0,h;if(G&&G.length>0)h=L` order by ${L.join(G,L`, `)}`;let a;if(H&&H.length>0)a=L` group by ${L.join(H,L`, `)}`;let M$=typeof z==="object"||typeof z==="number"&&z>=0?L` limit ${z}`:void 0,S=F?L` offset ${F}`:void 0,W$=L.empty();if(O){let Y$=L` for ${L.raw(O.strength)}`;if(O.config.of)Y$.append(L` of ${L.join(Array.isArray(O.config.of)?O.config.of:[O.config.of],L`, `)}`);if(O.config.noWait)Y$.append(L` nowait`);else if(O.config.skipLocked)Y$.append(L` skip locked`);W$.append(Y$)}let n=L`${N}select${J} ${_} from ${R}${P}${x}${a}${f}${h}${M$}${S}${W$}`;if(Z.length>0)return this.buildSetOperations(n,Z);return n}buildSetOperations($,T){let[W,...U]=T;if(!W)throw new Error("Cannot pass undefined values to any set operator");if(U.length===0)return this.buildSetOperationQuery({leftSelect:$,setOperator:W});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:$,setOperator:W}),U)}buildSetOperationQuery({leftSelect:$,setOperator:{type:T,isAll:W,rightSelect:U,limit:X,orderBy:Y,offset:w}}){let G=L`(${$.getSQL()}) `,H=L`(${U.getSQL()})`,z;if(Y&&Y.length>0){let Z=[];for(let V of Y)if(j(V,u))Z.push(L.identifier(V.name));else if(j(V,i)){for(let E=0;E<V.queryChunks.length;E++){let N=V.queryChunks[E];if(j(N,u))V.queryChunks[E]=L.identifier(N.name)}Z.push(L`${V}`)}else Z.push(L`${V}`);z=L` order by ${L.join(Z,L`, `)} `}let F=typeof X==="object"||typeof X==="number"&&X>=0?L` limit ${X}`:void 0,O=L.raw(`${T} ${W?"all ":""}`),Q=w?L` offset ${w}`:void 0;return L`${G}${O}${H}${z}${F}${Q}`}buildInsertQuery({table:$,values:T,onConflict:W,returning:U,withList:X,select:Y,overridingSystemValue_:w}){let G=[],H=$[p.Symbol.Columns],z=Object.entries(H).filter(([N,J])=>!J.shouldDisableInsert()),F=z.map(([,N])=>L.identifier(this.casing.getColumnCasing(N)));if(Y){let N=T;if(j(N,i))G.push(N);else G.push(N.getSQL())}else{let N=T;G.push(L.raw("values "));for(let[J,_]of N.entries()){let R=[];for(let[P,x]of z){let f=_[P];if(f===void 0||j(f,F1)&&f.value===void 0)if(x.defaultFn!==void 0){let h=x.defaultFn(),a=j(h,i)?h:L.param(h,x);R.push(a)}else if(!x.default&&x.onUpdateFn!==void 0){let h=x.onUpdateFn(),a=j(h,i)?h:L.param(h,x);R.push(a)}else R.push(L`default`);else R.push(f)}if(G.push(R),J<N.length-1)G.push(L`, `)}}let O=this.buildWithCTE(X),Q=L.join(G),Z=U?L` returning ${this.buildSelection(U,{isSingleTable:!0})}`:void 0,V=W?L` on conflict ${W}`:void 0,E=w===!0?L`overriding system value `:void 0;return L`${O}insert into ${$} ${F} ${E}${Q}${V}${Z}`}buildRefreshMaterializedViewQuery({view:$,concurrently:T,withNoData:W}){let U=T?L` concurrently`:void 0,X=W?L` with no data`:void 0;return L`refresh materialized view${U} ${$}${X}`}prepareTyping($){if(j($,c9)||j($,m9))return"json";else if(j($,u9))return"decimal";else if(j($,p9))return"time";else if(j($,d9)||j($,o9))return"timestamp";else if(j($,h9)||j($,g9))return"date";else if(j($,l9))return"uuid";else return"none"}sqlToQuery($,T){return $.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:T})}buildRelationalQueryWithoutPK({fullSchema:$,schema:T,tableNamesMap:W,table:U,tableConfig:X,queryConfig:Y,tableAlias:w,nestedQueryRelation:G,joinOn:H}){let z=[],F,O,Q=[],Z,V=[];if(Y===!0)z=Object.entries(X.columns).map(([J,_])=>({dbKey:_.name,tsKey:J,field:z0(_,w),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let N=Object.fromEntries(Object.entries(X.columns).map(([f,h])=>[f,z0(h,w)]));if(Y.where){let f=typeof Y.where==="function"?Y.where(N,A_()):Y.where;Z=f&&HY(f,w)}let J=[],_=[];if(Y.columns){let f=!1;for(let[h,a]of Object.entries(Y.columns)){if(a===void 0)continue;if(h in X.columns){if(!f&&a===!0)f=!0;_.push(h)}}if(_.length>0)_=f?_.filter((h)=>Y.columns?.[h]===!0):Object.keys(X.columns).filter((h)=>!_.includes(h))}else _=Object.keys(X.columns);for(let f of _){let h=X.columns[f];J.push({tsKey:f,value:h})}let R=[];if(Y.with)R=Object.entries(Y.with).filter((f)=>!!f[1]).map(([f,h])=>({tsKey:f,queryConfig:h,relation:X.relations[f]}));let P;if(Y.extras){P=typeof Y.extras==="function"?Y.extras(N,{sql:L}):Y.extras;for(let[f,h]of Object.entries(P))J.push({tsKey:f,value:VQ(h,w)})}for(let{tsKey:f,value:h}of J)z.push({dbKey:j(h,i.Aliased)?h.fieldAlias:X.columns[f].name,tsKey:f,field:j(h,u$)?z0(h,w):h,relationTableTsKey:void 0,isJson:!1,selection:[]});let x=typeof Y.orderBy==="function"?Y.orderBy(N,M_()):Y.orderBy??[];if(!Array.isArray(x))x=[x];Q=x.map((f)=>{if(j(f,u$))return z0(f,w);return HY(f,w)}),F=Y.limit,O=Y.offset;for(let{tsKey:f,queryConfig:h,relation:a}of R){let M$=L_(T,W,a),S=hW(a.referencedTable),W$=W[S],n=`${w}_${f}`,Y$=DY(...M$.fields.map((f4,n6)=>r9(z0(M$.references[n6],n),z0(f4,w)))),j$=this.buildRelationalQueryWithoutPK({fullSchema:$,schema:T,tableNamesMap:W,table:$[W$],tableConfig:T[W$],queryConfig:j(a,bT)?h===!0?{limit:1}:{...h,limit:1}:h,tableAlias:n,joinOn:Y$,nestedQueryRelation:a}),s$=L`${L.identifier(n)}.${L.identifier("data")}`.as(f);V.push({on:L`true`,table:new A4(j$.sql,{},n),alias:n,joinType:"left",lateral:!0}),z.push({dbKey:f,tsKey:f,field:s$,relationTableTsKey:W$,isJson:!0,selection:j$.selection})}}if(z.length===0)throw new f9({message:`No fields selected for table "${X.tsName}" ("${w}")`});let E;if(Z=DY(H,Z),G){let N=L`json_build_array(${L.join(z.map(({field:R,tsKey:P,isJson:x})=>x?L`${L.identifier(`${w}_${P}`)}.${L.identifier("data")}`:j(R,i.Aliased)?R.sql:R),L`, `)})`;if(j(G,VY))N=L`coalesce(json_agg(${N}${Q.length>0?L` order by ${L.join(Q,L`, `)}`:void 0}), '[]'::json)`;let J=[{dbKey:"data",tsKey:"data",field:N.as("data"),isJson:!0,relationTableTsKey:X.tsName,selection:z}];if(F!==void 0||O!==void 0||Q.length>0)E=this.buildSelectQuery({table:b9(U,w),fields:{},fieldsFlat:[{path:[],field:L.raw("*")}],where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]}),Z=void 0,F=void 0,O=void 0,Q=[];else E=b9(U,w);E=this.buildSelectQuery({table:j(E,B4)?E:new A4(E,{},w),fields:{},fieldsFlat:J.map(({field:R})=>({path:[],field:j(R,u$)?z0(R,w):R})),joins:V,where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]})}else E=this.buildSelectQuery({table:b9(U,w),fields:{},fieldsFlat:z.map(({field:N})=>({path:[],field:j(N,u$)?z0(N,w):N})),joins:V,where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]});return{tableTsKey:X.tsName,sql:E,selection:z}}}class uQ{static[M]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class v6{static[M]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor($){if(this.fields=$.fields,this.session=$.session,this.dialect=$.dialect,$.withList)this.withList=$.withList;this.distinct=$.distinct}authToken;setToken($){return this.authToken=$,this}from($){let T=!!this.fields,W=$,U;if(this.fields)U=this.fields;else if(j(W,A4))U=Object.fromEntries(Object.keys(W._.selectedFields).map((X)=>[X,W[X]]));else if(j(W,LY))U=W[i$].selectedFields;else if(j(W,i))U={};else U=aN(W);return new pQ({table:W,fields:U,isPartialSelect:T,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class o_ extends uQ{static[M]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:$,fields:T,isPartialSelect:W,session:U,dialect:X,withList:Y,distinct:w}){super();this.config={withList:Y,table:$,fields:{...T},distinct:w,setOperators:[]},this.isPartialSelect=W,this.session=U,this.dialect=X,this._={selectedFields:T,config:this.config},this.tableName=d0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let G of g1($))this.usedTables.add(G)}getUsedTables(){return[...this.usedTables]}createJoin($,T){return(W,U)=>{let X=this.tableName,Y=d0(W);for(let w of g1(W))this.usedTables.add(w);if(typeof Y==="string"&&this.config.joins?.some((w)=>w.alias===Y))throw new Error(`Alias "${Y}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof X==="string")this.config.fields={[X]:this.config.fields};if(typeof Y==="string"&&!j(W,i)){let w=j(W,A4)?W._.selectedFields:j(W,c6)?W[i$].selectedFields:W[p.Symbol.Columns];this.config.fields[Y]=w}}if(typeof U==="function")U=U(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:U,table:W,joinType:$,alias:Y,lateral:T}),typeof Y==="string")switch($){case"left":{this.joinsNotNullableMap[Y]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([w])=>[w,!1])),this.joinsNotNullableMap[Y]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[Y]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([w])=>[w,!1])),this.joinsNotNullableMap[Y]=!1;break}}return this}}leftJoin=this.createJoin("left",!1);leftJoinLateral=this.createJoin("left",!0);rightJoin=this.createJoin("right",!1);innerJoin=this.createJoin("inner",!1);innerJoinLateral=this.createJoin("inner",!0);fullJoin=this.createJoin("full",!1);crossJoin=this.createJoin("cross",!1);crossJoinLateral=this.createJoin("cross",!0);createSetOperator($,T){return(W)=>{let U=typeof W==="function"?W(uf()):W;if(!FY(this.getSelectedFields(),U.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:$,isAll:T,rightSelect:U}),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($){return this.config.setOperators.push(...$),this}where($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=$,this}having($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=$,this}groupBy(...$){if(typeof $[0]==="function"){let T=$[0](new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(T)?T:[T]}else this.config.groupBy=$;return this}orderBy(...$){if(typeof $[0]==="function"){let T=$[0](new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),W=Array.isArray(T)?T:[T];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=W;else this.config.orderBy=W}else{let T=$;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=T;else this.config.orderBy=T}return this}limit($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=$;else this.config.limit=$;return this}offset($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=$;else this.config.offset=$;return this}for($,T={}){return this.config.lockingClause={strength:$,config:T},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}as($){let T=[];if(T.push(...g1(this.config.table)),this.config.joins)for(let W of this.config.joins)T.push(...g1(W.table));return new Proxy(new A4(this.getSQL(),this.config.fields,$,!1,[...new Set(T)]),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new E4({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}$withCache($){return this.cacheConfig=$===void 0?{config:{},enable:!0,autoInvalidate:!0}:$===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...$},this}}class pQ extends o_{static[M]="PgSelect";_prepare($){let{session:T,config:W,dialect:U,joinsNotNullableMap:X,authToken:Y,cacheConfig:w,usedTables:G}=this;if(!T)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let{fields:H}=W;return p$.startActiveSpan("drizzle.prepareQuery",()=>{let z=J1(H),F=T.prepareQuery(U.sqlToQuery(this.getSQL()),z,$,!0,void 0,{type:"select",tables:[...G]},w);return F.joinsNotNullableMap=X,F.setToken(Y)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return p$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}tN(pQ,[k6]);function OU($,T){return(W,U,...X)=>{let Y=[U,...X].map((w)=>({type:$,isAll:T,rightSelect:w}));for(let w of Y)if(!FY(W.getSelectedFields(),w.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return W.addSetOperators(Y)}}var uf=()=>({union:pf,unionAll:df,intersect:of,intersectAll:lf,except:rf,exceptAll:nf}),pf=OU("union",!1),df=OU("union",!0),of=OU("intersect",!1),lf=OU("intersect",!0),rf=OU("except",!1),nf=OU("except",!0);class JY{static[M]="PgQueryBuilder";dialect;dialectConfig;constructor($){this.dialect=j($,pW)?$:void 0,this.dialectConfig=j($,pW)?void 0:$}$with=($,T)=>{let W=this;return{as:(X)=>{if(typeof X==="function")X=X(W);return new Proxy(new wY(X.getSQL(),T??("getSelectedFields"in X?X.getSelectedFields()??{}:{}),$,!0),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...$){let T=this;function W(Y){return new v6({fields:Y??void 0,session:void 0,dialect:T.getDialect(),withList:$})}function U(Y){return new v6({fields:Y??void 0,session:void 0,dialect:T.getDialect(),distinct:!0})}function X(Y,w){return new v6({fields:w??void 0,session:void 0,dialect:T.getDialect(),distinct:{on:Y}})}return{select:W,selectDistinct:U,selectDistinctOn:X}}select($){return new v6({fields:$??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct($){return new v6({fields:$??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn($,T){return new v6({fields:T??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:$}})}getDialect(){if(!this.dialect)this.dialect=new pW(this.dialectConfig);return this.dialect}}function g1($){if(j($,B4))return[$[yW]?`${$[yW]}.${$[p.Symbol.BaseName]}`:$[p.Symbol.BaseName]];if(j($,A4))return $._.usedTables??[];if(j($,i))return $.usedTables??[];return[]}class zz extends k6{constructor($,T,W,U){super();this.session=T,this.dialect=W,this.config={table:$,withList:U}}static[M]="PgDelete";config;cacheConfig;where($){return this.config.where=$,this}returning($=this.config.table[p.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=J1($),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return p$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"delete",tables:g1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return p$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:m4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class Hz{constructor($,T,W,U,X){this.table=$,this.session=T,this.dialect=W,this.withList=U,this.overridingSystemValue_=X}static[M]="PgInsertBuilder";authToken;setToken($){return this.authToken=$,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values($){if($=Array.isArray($)?$:[$],$.length===0)throw new Error("values() must be called with at least one value");let T=$.map((W)=>{let U={},X=this.table[p.Symbol.Columns];for(let Y of Object.keys(W)){let w=W[Y];U[Y]=j(w,i)?w:new F1(w,X[Y])}return U});return new dQ(this.table,T,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select($){let T=typeof $==="function"?$(new JY):$;if(!j(T,i)&&!FY(this.table[x9],T._.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 dQ(this.table,T,this.session,this.dialect,this.withList,!0)}}class dQ extends k6{constructor($,T,W,U,X,Y,w){super();this.session=W,this.dialect=U,this.config={table:$,values:T,withList:X,select:Y,overridingSystemValue_:w}}static[M]="PgInsert";config;cacheConfig;returning($=this.config.table[p.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=J1($),this}onConflictDoNothing($={}){if($.target===void 0)this.config.onConflict=L`do nothing`;else{let T="";T=Array.isArray($.target)?$.target.map((U)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(U))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target));let W=$.where?L` where ${$.where}`:void 0;this.config.onConflict=L`(${L.raw(T)})${W} do nothing`}return this}onConflictDoUpdate($){if($.where&&($.targetWhere||$.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 T=$.where?L` where ${$.where}`:void 0,W=$.targetWhere?L` where ${$.targetWhere}`:void 0,U=$.setWhere?L` where ${$.setWhere}`:void 0,X=this.dialect.buildUpdateSet(this.config.table,y9(this.config.table,$.set)),Y="";return Y=Array.isArray($.target)?$.target.map((w)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(w))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target)),this.config.onConflict=L`(${L.raw(Y)})${W} do update set ${X}${T}${U}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return p$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:g1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return p$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:m4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class oQ extends k6{constructor($,T,W){super();this.session=T,this.dialect=W,this.config={view:$}}static[M]="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:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return p$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,$,!0)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return p$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}class Fz{constructor($,T,W,U){this.table=$,this.session=T,this.dialect=W,this.withList=U}static[M]="PgUpdateBuilder";authToken;setToken($){return this.authToken=$,this}set($){return new l_(this.table,y9(this.table,$),this.session,this.dialect,this.withList).setToken(this.authToken)}}class l_ extends k6{constructor($,T,W,U,X){super();this.session=W,this.dialect=U,this.config={set:T,table:$,withList:X,joins:[]},this.tableName=d0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[M]="PgUpdate";config;tableName;joinsNotNullableMap;cacheConfig;from($){let T=$,W=d0(T);if(typeof W==="string")this.joinsNotNullableMap[W]=!0;return this.config.from=T,this}getTableLikeFields($){if(j($,B4))return $[p.Symbol.Columns];else if(j($,A4))return $._.selectedFields;return $[i$].selectedFields}createJoin($){return(T,W)=>{let U=d0(T);if(typeof U==="string"&&this.config.joins.some((X)=>X.alias===U))throw new Error(`Alias "${U}" is already used in this query`);if(typeof W==="function"){let X=this.config.from&&!j(this.config.from,i)?this.getTableLikeFields(this.config.from):void 0;W=W(new Proxy(this.config.table[p.Symbol.Columns],new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),X&&new Proxy(X,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:W,table:T,joinType:$,alias:U}),typeof U==="string")switch($){case"left":{this.joinsNotNullableMap[U]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([X])=>[X,!1])),this.joinsNotNullableMap[U]=!0;break}case"inner":{this.joinsNotNullableMap[U]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([X])=>[X,!1])),this.joinsNotNullableMap[U]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where($){return this.config.where=$,this}returning($){if(!$){if($=Object.assign({},this.config.table[p.Symbol.Columns]),this.config.from){let T=d0(this.config.from);if(typeof T==="string"&&this.config.from&&!j(this.config.from,i)){let W=this.getTableLikeFields(this.config.from);$[T]=W}for(let W of this.config.joins){let U=d0(W.table);if(typeof U==="string"&&!j(W.table,i)){let X=this.getTableLikeFields(W.table);$[U]=X}}}}return this.config.returningFields=$,this.config.returning=J1($),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){let T=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:g1(this.config.table)},this.cacheConfig);return T.joinsNotNullableMap=this.joinsNotNullableMap,T}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return this._prepare().execute($,this.authToken)};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:m4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class _Y extends i{constructor($){super(_Y.buildEmbeddedCount($.source,$.filters).queryChunks);this.params=$,this.mapWith(Number),this.session=$.session,this.sql=_Y.buildCount($.source,$.filters)}sql;token;static[M]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount($,T){return L`(select count(*) from ${$}${L.raw(" where ").if(T)}${T})`}static buildCount($,T){return L`select count(*) as count from ${$}${L.raw(" where ").if(T)}${T};`}setToken($){return this.token=$,this}then($,T){return Promise.resolve(this.session.count(this.sql,this.token)).then($,T)}catch($){return this.then(void 0,$)}finally($){return this.then((T)=>{return $?.(),T},(T)=>{throw $?.(),T})}}class rQ{constructor($,T,W,U,X,Y,w){this.fullSchema=$,this.schema=T,this.tableNamesMap=W,this.table=U,this.tableConfig=X,this.dialect=Y,this.session=w}static[M]="PgRelationalQueryBuilder";findMany($){return new lQ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?$:{},"many")}findFirst($){return new lQ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?{...$,limit:1}:{limit:1},"first")}}class lQ extends k6{constructor($,T,W,U,X,Y,w,G,H){super();this.fullSchema=$,this.schema=T,this.tableNamesMap=W,this.table=U,this.tableConfig=X,this.dialect=Y,this.session=w,this.config=G,this.mode=H}static[M]="PgRelationalQuery";_prepare($){return p$.startActiveSpan("drizzle.prepareQuery",()=>{let{query:T,builtQuery:W}=this._toSQL();return this.session.prepareQuery(W,void 0,$,!0,(U,X)=>{let Y=U.map((w)=>i9(this.schema,this.tableConfig,w,T.selection,X));if(this.mode==="first")return Y[0];return Y})})}prepare($){return this._prepare($)}_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 $=this._getQuery(),T=this.dialect.sqlToQuery($.sql);return{query:$,builtQuery:T}}toSQL(){return this._toSQL().builtQuery}authToken;setToken($){return this.authToken=$,this}execute(){return p$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class nQ extends k6{constructor($,T,W,U){super();this.execute=$,this.sql=T,this.query=W,this.mapBatchResult=U}static[M]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult($,T){return T?this.mapBatchResult($):$}_prepare(){return this}isResponseInArrayMode(){return!1}}class RY{constructor($,T,W){if(this.dialect=$,this.session=T,this._=W?{schema:W.schema,fullSchema:W.fullSchema,tableNamesMap:W.tableNamesMap,session:T}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:T},this.query={},this._.schema)for(let[U,X]of Object.entries(this._.schema))this.query[U]=new rQ(W.fullSchema,this._.schema,this._.tableNamesMap,W.fullSchema[U],X,$,T);this.$cache={invalidate:async(U)=>{}}}static[M]="PgDatabase";query;$with=($,T)=>{let W=this;return{as:(X)=>{if(typeof X==="function")X=X(new JY(W.dialect));return new Proxy(new wY(X.getSQL(),T??("getSelectedFields"in X?X.getSelectedFields()??{}:{}),$,!0),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count($,T){return new _Y({source:$,filters:T,session:this.session})}$cache;with(...$){let T=this;function W(H){return new v6({fields:H??void 0,session:T.session,dialect:T.dialect,withList:$})}function U(H){return new v6({fields:H??void 0,session:T.session,dialect:T.dialect,withList:$,distinct:!0})}function X(H,z){return new v6({fields:z??void 0,session:T.session,dialect:T.dialect,withList:$,distinct:{on:H}})}function Y(H){return new Fz(H,T.session,T.dialect,$)}function w(H){return new Hz(H,T.session,T.dialect,$)}function G(H){return new zz(H,T.session,T.dialect,$)}return{select:W,selectDistinct:U,selectDistinctOn:X,update:Y,insert:w,delete:G}}select($){return new v6({fields:$??void 0,session:this.session,dialect:this.dialect})}selectDistinct($){return new v6({fields:$??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn($,T){return new v6({fields:T??void 0,session:this.session,dialect:this.dialect,distinct:{on:$}})}update($){return new Fz($,this.session,this.dialect)}insert($){return new Hz($,this.session,this.dialect)}delete($){return new zz($,this.session,this.dialect)}refreshMaterializedView($){return new oQ($,this.session,this.dialect)}authToken;execute($){let T=typeof $==="string"?L.raw($):$.getSQL(),W=this.dialect.sqlToQuery(T),U=this.session.prepareQuery(W,void 0,void 0,!1);return new nQ(()=>U.execute(void 0,this.authToken),T,W,(X)=>U.mapResult(X,!0))}transaction($,T){return this.session.transaction($,T)}}class r_{static[M]="Cache"}class kY extends r_{strategy(){return"all"}static[M]="NoopCache";async get($){return}async put($,T,W,U){}async onMutate($){}}async function iQ($,T){let W=`${$}-${JSON.stringify(T)}`,X=new TextEncoder().encode(W),Y=await crypto.subtle.digest("SHA-256",X);return[...new Uint8Array(Y)].map((H)=>H.toString(16).padStart(2,"0")).join("")}class l0 extends Error{constructor($,T,W){super(`Failed query: ${$}
|
|
108
|
-
params: ${T}`);if(this.query=$,this.params=T,this.cause=W,Error.captureStackTrace(this,l0),W)this.cause=W}}class tQ{constructor($,T,W,U){if(this.query=$,this.cache=T,this.queryMetadata=W,this.cacheConfig=U,T&&T.strategy()==="all"&&U===void 0)this.cacheConfig={enable:!0,autoInvalidate:!0};if(!this.cacheConfig?.enable)this.cacheConfig=void 0}authToken;getQuery(){return this.query}mapResult($,T){return $}setToken($){return this.authToken=$,this}static[M]="PgPreparedQuery";joinsNotNullableMap;async queryWithCache($,T,W){if(this.cache===void 0||j(this.cache,kY)||this.queryMetadata===void 0)try{return await W()}catch(U){throw new l0($,T,U)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await W()}catch(U){throw new l0($,T,U)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[U]=await Promise.all([W(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return U}catch(U){throw new l0($,T,U)}if(!this.cacheConfig)try{return await W()}catch(U){throw new l0($,T,U)}if(this.queryMetadata.type==="select"){let U=await this.cache.get(this.cacheConfig.tag??await iQ($,T),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(U===void 0){let X;try{X=await W()}catch(Y){throw new l0($,T,Y)}return await this.cache.put(this.cacheConfig.tag??await iQ($,T),X,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),X}return U}try{return await W()}catch(U){throw new l0($,T,U)}}}class aQ{constructor($){this.dialect=$}static[M]="PgSession";execute($,T){return p$.startActiveSpan("drizzle.operation",()=>{return p$.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1)}).setToken(T).execute(void 0,T)})}all($){return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1).all()}async count($,T){let W=await this.execute($,T);return Number(W[0].count)}}class sQ extends RY{constructor($,T,W,U=0){super($,T,W);this.schema=W,this.nestedIndex=U}static[M]="PgTransaction";rollback(){throw new KQ}getTransactionConfigSQL($){let T=[];if($.isolationLevel)T.push(`isolation level ${$.isolationLevel}`);if($.accessMode)T.push($.accessMode);if(typeof $.deferrable==="boolean")T.push($.deferrable?"deferrable":"not deferrable");return L.raw(T.join(" "))}setTransaction($){return this.session.execute(L`set transaction ${this.getTransactionConfigSQL($)}`)}}class n_ extends tQ{constructor($,T,W,U,X,Y,w,G,H,z){super({sql:T,params:W},X,Y,w);this.client=$,this.queryString=T,this.params=W,this.logger=U,this.fields=G,this._isResponseInArrayMode=H,this.customResultMapper=z}static[M]="PostgresJsPreparedQuery";async execute($={}){return p$.startActiveSpan("drizzle.execute",async(T)=>{let W=DQ(this.params,$);T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.logger.logQuery(this.queryString,W);let{fields:U,queryString:X,client:Y,joinsNotNullableMap:w,customResultMapper:G}=this;if(!U&&!G)return p$.startActiveSpan("drizzle.driver.execute",()=>{return this.queryWithCache(X,W,async()=>{return await Y.unsafe(X,W)})});let H=await p$.startActiveSpan("drizzle.driver.execute",()=>{return T?.setAttributes({"drizzle.query.text":X,"drizzle.query.params":JSON.stringify(W)}),this.queryWithCache(X,W,async()=>{return await Y.unsafe(X,W).values()})});return p$.startActiveSpan("drizzle.mapResponse",()=>{return G?G(H):H.map((z)=>iN(U,z,w))})})}all($={}){return p$.startActiveSpan("drizzle.execute",async(T)=>{let W=DQ(this.params,$);return T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.logger.logQuery(this.queryString,W),p$.startActiveSpan("drizzle.driver.execute",()=>{return T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.queryWithCache(this.queryString,W,async()=>{return this.client.unsafe(this.queryString,W)})})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class vY extends aQ{constructor($,T,W,U={}){super(T);this.client=$,this.schema=W,this.options=U,this.logger=U.logger??new AQ,this.cache=U.cache??new kY}static[M]="PostgresJsSession";logger;cache;prepareQuery($,T,W,U,X,Y,w){return new n_(this.client,$.sql,$.params,this.logger,this.cache,Y,w,T,U,X)}query($,T){return this.logger.logQuery($,T),this.client.unsafe($,T).values()}queryObjects($,T){return this.client.unsafe($,T)}transaction($,T){return this.client.begin(async(W)=>{let U=new vY(W,this.dialect,this.schema,this.options),X=new eQ(this.dialect,U,this.schema);if(T)await X.setTransaction(T);return $(X)})}}class eQ extends sQ{constructor($,T,W,U=0){super($,T,W,U);this.session=T}static[M]="PostgresJsTransaction";transaction($){return this.session.client.savepoint((T)=>{let W=new vY(T,this.dialect,this.schema,this.session.options),U=new eQ(this.dialect,W,this.schema);return $(U)})}}class i_ extends RY{static[M]="PostgresJsDatabase"}function QU($,T={}){let W=(H)=>H;for(let H of["1184","1082","1083","1114","1182","1185","1115","1231"])$.options.parsers[H]=W,$.options.serializers[H]=W;$.options.serializers["114"]=W,$.options.serializers["3802"]=W;let U=new pW({casing:T.casing}),X;if(T.logger===!0)X=new EQ;else if(T.logger!==!1)X=T.logger;let Y;if(T.schema){let H=N_(T.schema,J_);Y={fullSchema:T.schema,schema:H.tables,tableNamesMap:H.tableNamesMap}}let w=new vY($,U,Y,{logger:X,cache:T.cache}),G=new i_(U,w,Y);if(G.$client=$,G.$cache=T.cache,G.$cache)G.$cache.invalidate=T.cache?.onMutate;return G}function Oz(...$){if(typeof $[0]==="string"){let T=FU($[0]);return QU(T,$[1])}if(sN($[0])){let{connection:T,client:W,...U}=$[0];if(W)return QU(W,U);if(typeof T==="object"&&T.url!==void 0){let{url:Y,...w}=T,G=FU(Y,w);return QU(G,U)}let X=FU(T);return QU(X,U)}return QU($[0],$[1])}(($)=>{function T(W){return QU({options:{parsers:{},serializers:{}}},W)}$.mock=T})(Oz||(Oz={}));function t_($,T){if($ instanceof Promise)throw new Error(T)}function tf($,T){let W={},U=[];for(let X in $){let Y=$[X]["~standard"].validate(T[X]);if(t_(Y,`Validation must be synchronous, but ${X} returned a Promise.`),Y.issues){U.push(...Y.issues.map((w)=>({...w,message:w.message,path:[X,...w.path??[]]})));continue}W[X]=Y.value}if(U.length)return{issues:U};return{value:W}}function $Z($){let T=$.runtimeEnvStrict??$.runtimeEnv??process.env;if($.emptyStringAsUndefined??!1){for(let[_,R]of Object.entries(T))if(R==="")delete T[_]}if(!!$.skipValidation)return T;let X=typeof $.client==="object"?$.client:{},Y=typeof $.server==="object"?$.server:{},w=typeof $.shared==="object"?$.shared:{},G=$.isServer??(typeof window==="undefined"||("Deno"in window)),H=G?{...Y,...w,...X}:{...X,...w},z=$.createFinalSchema?.(H,G)["~standard"].validate(T)??tf(H,T);t_(z,"Validation must be synchronous");let F=$.onValidationError??((_)=>{throw console.error("\u274C Invalid environment variables:",_),new Error("Invalid environment variables")}),O=$.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(z.issues)return F(z.issues);let Q=(_)=>{if(!$.clientPrefix)return!0;return!_.startsWith($.clientPrefix)&&!(_ in w)},Z=(_)=>{return G||!Q(_)},V=(_)=>{return _==="__esModule"||_==="$$typeof"},E=($.extends??[]).reduce((_,R)=>{return Object.assign(_,R)},{}),N=Object.assign(E,z.value);return new Proxy(N,{get(_,R){if(typeof R!=="string")return;if(V(R))return;if(!Z(R))return O(R);return Reflect.get(_,R)}})}var yT=($)=>Array.isArray($)?$:[$],a_=($,T)=>{let W=[[],[]];for(let U of $)if(T(U))W[0].push(U);else W[1].push(U);return W},Qz=Array,r0=($,T)=>$.includes(T),s_=($,T=0)=>[...new Array($)].map((W,U)=>U+T),q$=($,T,W)=>{if($===void 0)return T===void 0?[]:Array.isArray(T)?T:[T];if(W?.prepend)if(Array.isArray(T))$.unshift(...T);else $.unshift(T);else if(Array.isArray(T))$.push(...T);else $.push(T);return $},n0=($,T)=>{if(T===void 0||T===null)return $??[];if($===void 0||$===null)return yT(T);return $.concat(T)},e_=(...$)=>$.reduce(n0,[]),F0=($,T,W)=>{if($===void 0)return Array.isArray(T)?T:[T];let U=W?.isEqual??((X,Y)=>X===Y);for(let X of yT(T))if(!$.some((Y)=>U(Y,X)))$.push(X);return $},$R=($,T)=>$.reduce((W,U)=>{let X=U[T];return W[X]=q$(W[X],U),W},{}),i0=($,T,W)=>$.length===T.length&&$.every(W?.isEqual?(U,X)=>W.isEqual(U,T[X]):(U,X)=>U===T[X]);var p6=($,T)=>x4($)===T,x4=($)=>{let T=typeof $;return T==="object"?$===null?"null":"object":T==="function"?"object":T},d6={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},TR={...d6,function:"a function"};class WR extends Error{}var S$=($)=>dW($,WR),dW=($,T=Error)=>{throw new T($)};class qY extends Error{name="ParseError"}var B=($)=>dW($,qY),m1=($)=>` ${$}`;var K$=($,T)=>{let W={},U=Array.isArray($),X=!1;for(let[Y,w]of Object.entries($).entries()){let G=U?T(Y,w[1]):T(...w,Y);X||=typeof G[0]==="number";let H=Array.isArray(G[0])||G.length===0?G:[G];for(let[z,F]of H)if(typeof z==="object")W[z.group]=q$(W[z.group],F);else W[z]=F}return X?Object.values(W):W};var TZ=Object.entries;var I4=($,T)=>($ in T),ZU=($,T)=>(T in $);class WZ{constructor($){Object.assign(this,$)}}var UR=class{};class PY extends UR{}var af=($,T)=>{let W={},U={},X;for(X in $)if(X in T)W[X]=$[X];else U[X]=$[X];return[W,U]};var XR=($,T)=>af($,T)[1],O0=($)=>Object.keys($).length===0,oW=($)=>[...Object.entries($),...Object.getOwnPropertySymbols($).map((T)=>[T,$[T]])],YR=($,T)=>Object.defineProperties($,Object.getOwnPropertyDescriptors(T)),wR=($)=>{let T=Object.keys($).sort(),W={};for(let U=0;U<T.length;U++)W[T[U]]=$[T[U]];return W};var Q1=m1("represents an uninitialized value"),GR=($)=>Object.values($).filter((T)=>{if(typeof T==="number")return!0;return typeof $[T]!=="number"});var UZ={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},XZ=globalThis.File??Blob,YZ={ArrayBuffer,Blob,File:XZ,FormData,Headers,Request,Response,URL},sf={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},lW={...UZ,...YZ,...sf,String,Number,Boolean},CY=($)=>{let T=Object.getPrototypeOf($);while(T?.constructor&&(!I4(T.constructor.name,lW)||!($ instanceof lW[T.constructor.name])))T=Object.getPrototypeOf(T);let W=T?.constructor?.name;if(W===void 0||W==="Object")return;return W},SY=($)=>typeof $==="object"&&$!==null?CY($)??"object":x4($);var d$=Array.isArray,ef={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"},$y={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"},Ty={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"},zR={...ef,...$y,...Ty},jY=($)=>{let T=Object($).name??null;return T&&I4(T,lW)&&lW[T]===$?T:null};var wZ=($,T)=>{let W=$.prototype;while(W!==null){if(W===T.prototype)return!0;W=Object.getPrototypeOf(W)}return!1};var HR=($)=>FR($,new Map),FR=($,T)=>{if(typeof $!=="object"||$===null)return $;if(T?.has($))return T.get($);let W=jY($.constructor);if(W==="Date")return new Date($.getTime());if(W&&W!=="Array")return $;let U=Array.isArray($)?$.slice():Object.create(Object.getPrototypeOf($)),X=Object.getOwnPropertyDescriptors($);if(T){T.set($,U);for(let Y in X){let w=X[Y];if("get"in w||"set"in w)continue;w.value=FR(w.value,T)}}return Object.defineProperties(U,X),U};var Wy=($)=>{let T=Q1;return()=>T===Q1?T=$():T},hT=($)=>typeof $==="function"&&$.length===0;var OR=class extends Function{constructor(...$){let T=$.slice(0,-1),W=$.at(-1);try{super(...T,W)}catch(U){return S$(`Encountered an unexpected error while compiling your definition:
|
|
109
|
-
Message: ${
|
|
109
|
+
`;await T.execute(J`CREATE SCHEMA IF NOT EXISTS ${J.identifier(X)}`),await T.execute(U);let G=(await T.all(J`select id, hash, created_at from ${J.identifier(X)}.${J.identifier(w)} order by created_at desc limit 1`))[0];await T.transaction(async(H)=>{for await(let z of $)if(!G||Number(G.created_at)<z.folderMillis){for(let F of z.sql)await H.execute(J.raw(F));await H.execute(J`insert into ${J.identifier(X)}.${J.identifier(w)} ("hash", "created_at") values(${z.hash}, ${z.folderMillis})`)}})}escapeName($){return`"${$}"`}escapeParam($){return`$${$+1}`}escapeString($){return`'${$.replace(/'/g,"''")}'`}buildWithCTE($){if(!$?.length)return;let T=[J`with `];for(let[W,w]of $.entries())if(T.push(J`${J.identifier(w._.alias)} as (${w._.sql})`),W<$.length-1)T.push(J`, `);return T.push(J` `),J.join(T)}buildDeleteQuery({table:$,where:T,returning:W,withList:w}){let X=this.buildWithCTE(w),U=W?J` returning ${this.buildSelection(W,{isSingleTable:!0})}`:void 0,Y=T?J` where ${T}`:void 0;return J`${X}delete from ${$}${Y}${U}`}buildUpdateSet($,T){let W=$[o.Symbol.Columns],w=Object.keys(W).filter((U)=>T[U]!==void 0||W[U]?.onUpdateFn!==void 0),X=w.length;return J.join(w.flatMap((U,Y)=>{let G=W[U],H=T[U]??J.param(G.onUpdateFn(),G),z=J`${J.identifier(this.casing.getColumnCasing(G))} = ${H}`;if(Y<X-1)return[z,J.raw(", ")];return[z]}))}buildUpdateQuery({table:$,set:T,where:W,returning:w,withList:X,from:U,joins:Y}){let G=this.buildWithCTE(X),H=$[x4.Symbol.Name],z=$[x4.Symbol.Schema],F=$[x4.Symbol.OriginalName],O=H===F?void 0:H,Q=J`${z?J`${J.identifier(z)}.`:void 0}${J.identifier(F)}${O&&J` ${J.identifier(O)}`}`,Z=this.buildUpdateSet($,T),K=U&&J.join([J.raw(" from "),this.buildFromTable(U)]),E=this.buildJoins(Y),M=w?J` returning ${this.buildSelection(w,{isSingleTable:!U})}`:void 0,L=W?J` where ${W}`:void 0;return J`${G}update ${Q} set ${Z}${K}${E}${L}${M}`}buildSelection($,{isSingleTable:T=!1}={}){let W=$.length,w=$.flatMap(({field:X},U)=>{let Y=[];if(I(X,s.Aliased)&&X.isSelectionField)Y.push(J.identifier(X.fieldAlias));else if(I(X,s.Aliased)||I(X,s)){let G=I(X,s.Aliased)?X.sql:X;if(T)Y.push(new s(G.queryChunks.map((H)=>{if(I(H,d))return J.identifier(this.casing.getColumnCasing(H));return H})));else Y.push(G);if(I(X,s.Aliased))Y.push(J` as ${J.identifier(X.fieldAlias)}`)}else if(I(X,p$))if(T)Y.push(J.identifier(this.casing.getColumnCasing(X)));else Y.push(X);if(U<W-1)Y.push(J`, `);return Y});return J.join(w)}buildJoins($){if(!$||$.length===0)return;let T=[];for(let[W,w]of $.entries()){if(W===0)T.push(J` `);let X=w.table,U=w.lateral?J` lateral`:void 0,Y=w.on?J` on ${w.on}`:void 0;if(I(X,x4)){let G=X[x4.Symbol.Name],H=X[x4.Symbol.Schema],z=X[x4.Symbol.OriginalName],F=G===z?void 0:w.alias;T.push(J`${J.raw(w.joinType)} join${U} ${H?J`${J.identifier(H)}.`:void 0}${J.identifier(z)}${F&&J` ${J.identifier(F)}`}${Y}`)}else if(I(X,c6)){let G=X[t$].name,H=X[t$].schema,z=X[t$].originalName,F=G===z?void 0:w.alias;T.push(J`${J.raw(w.joinType)} join${U} ${H?J`${J.identifier(H)}.`:void 0}${J.identifier(z)}${F&&J` ${J.identifier(F)}`}${Y}`)}else T.push(J`${J.raw(w.joinType)} join${U} ${X}${Y}`);if(W<$.length-1)T.push(J` `)}return J.join(T)}buildFromTable($){if(I($,o)&&$[o.Symbol.IsAlias]){let T=J`${J.identifier($[o.Symbol.OriginalName])}`;if($[o.Symbol.Schema])T=J`${J.identifier($[o.Symbol.Schema])}.${T}`;return J`${T} ${J.identifier($[o.Symbol.Name])}`}return $}buildSelectQuery({withList:$,fields:T,fieldsFlat:W,where:w,having:X,table:U,joins:Y,orderBy:G,groupBy:H,limit:z,offset:F,lockingClause:O,distinct:Q,setOperators:Z}){let K=W??N1(T);for(let z$ of K)if(I(z$.field,p$)&&u4(z$.field.table)!==(I(U,M4)?U._.alias:I(U,VU)?U[t$].name:I(U,s)?void 0:u4(U))&&!((B$)=>Y?.some(({alias:e$})=>e$===(B$[o.Symbol.IsAlias]?u4(B$):B$[o.Symbol.BaseName])))(z$.field.table)){let B$=u4(z$.field.table);throw new Error(`Your "${z$.path.join("->")}" field references a column "${B$}"."${z$.field.name}", but the table "${B$}" is not part of the query! Did you forget to join it?`)}let E=!Y||Y.length===0,M=this.buildWithCTE($),L;if(Q)L=Q===!0?J` distinct`:J` distinct on (${J.join(Q.on,J`, `)})`;let R=this.buildSelection(K,{isSingleTable:E}),_=this.buildFromTable(U),S=this.buildJoins(Y),x=w?J` where ${w}`:void 0,b=X?J` having ${X}`:void 0,g;if(G&&G.length>0)g=J` order by ${J.join(G,J`, `)}`;let T$;if(H&&H.length>0)T$=J` group by ${J.join(H,J`, `)}`;let N$=typeof z==="object"||typeof z==="number"&&z>=0?J` limit ${z}`:void 0,j=F?J` offset ${F}`:void 0,U$=J.empty();if(O){let z$=J` for ${J.raw(O.strength)}`;if(O.config.of)z$.append(J` of ${J.join(Array.isArray(O.config.of)?O.config.of:[O.config.of],J`, `)}`);if(O.config.noWait)z$.append(J` nowait`);else if(O.config.skipLocked)z$.append(J` skip locked`);U$.append(z$)}let t=J`${M}select${L} ${R} from ${_}${S}${x}${T$}${b}${g}${N$}${j}${U$}`;if(Z.length>0)return this.buildSetOperations(t,Z);return t}buildSetOperations($,T){let[W,...w]=T;if(!W)throw new Error("Cannot pass undefined values to any set operator");if(w.length===0)return this.buildSetOperationQuery({leftSelect:$,setOperator:W});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:$,setOperator:W}),w)}buildSetOperationQuery({leftSelect:$,setOperator:{type:T,isAll:W,rightSelect:w,limit:X,orderBy:U,offset:Y}}){let G=J`(${$.getSQL()}) `,H=J`(${w.getSQL()})`,z;if(U&&U.length>0){let Z=[];for(let K of U)if(I(K,d))Z.push(J.identifier(K.name));else if(I(K,s)){for(let E=0;E<K.queryChunks.length;E++){let M=K.queryChunks[E];if(I(M,d))K.queryChunks[E]=J.identifier(M.name)}Z.push(J`${K}`)}else Z.push(J`${K}`);z=J` order by ${J.join(Z,J`, `)} `}let F=typeof X==="object"||typeof X==="number"&&X>=0?J` limit ${X}`:void 0,O=J.raw(`${T} ${W?"all ":""}`),Q=Y?J` offset ${Y}`:void 0;return J`${G}${O}${H}${z}${F}${Q}`}buildInsertQuery({table:$,values:T,onConflict:W,returning:w,withList:X,select:U,overridingSystemValue_:Y}){let G=[],H=$[o.Symbol.Columns],z=Object.entries(H).filter(([M,L])=>!L.shouldDisableInsert()),F=z.map(([,M])=>J.identifier(this.casing.getColumnCasing(M)));if(U){let M=T;if(I(M,s))G.push(M);else G.push(M.getSQL())}else{let M=T;G.push(J.raw("values "));for(let[L,R]of M.entries()){let _=[];for(let[S,x]of z){let b=R[S];if(b===void 0||I(b,F1)&&b.value===void 0)if(x.defaultFn!==void 0){let g=x.defaultFn(),T$=I(g,s)?g:J.param(g,x);_.push(T$)}else if(!x.default&&x.onUpdateFn!==void 0){let g=x.onUpdateFn(),T$=I(g,s)?g:J.param(g,x);_.push(T$)}else _.push(J`default`);else _.push(b)}if(G.push(_),L<M.length-1)G.push(J`, `)}}let O=this.buildWithCTE(X),Q=J.join(G),Z=w?J` returning ${this.buildSelection(w,{isSingleTable:!0})}`:void 0,K=W?J` on conflict ${W}`:void 0,E=Y===!0?J`overriding system value `:void 0;return J`${O}insert into ${$} ${F} ${E}${Q}${K}${Z}`}buildRefreshMaterializedViewQuery({view:$,concurrently:T,withNoData:W}){let w=T?J` concurrently`:void 0,X=W?J` with no data`:void 0;return J`refresh materialized view${w} ${$}${X}`}prepareTyping($){if(I($,_9)||I($,R9))return"json";else if(I($,k9))return"decimal";else if(I($,v9))return"time";else if(I($,q9)||I($,P9))return"timestamp";else if(I($,L9)||I($,J9))return"date";else if(I($,C9))return"uuid";else return"none"}sqlToQuery($,T){return $.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:T})}buildRelationalQueryWithoutPK({fullSchema:$,schema:T,tableNamesMap:W,table:w,tableConfig:X,queryConfig:U,tableAlias:Y,nestedQueryRelation:G,joinOn:H}){let z=[],F,O,Q=[],Z,K=[];if(U===!0)z=Object.entries(X.columns).map(([L,R])=>({dbKey:R.name,tsKey:L,field:Y0(R,Y),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let M=Object.fromEntries(Object.entries(X.columns).map(([b,g])=>[b,Y0(g,Y)]));if(U.where){let b=typeof U.where==="function"?U.where(M,HJ()):U.where;Z=b&&WU(b,Y)}let L=[],R=[];if(U.columns){let b=!1;for(let[g,T$]of Object.entries(U.columns)){if(T$===void 0)continue;if(g in X.columns){if(!b&&T$===!0)b=!0;R.push(g)}}if(R.length>0)R=b?R.filter((g)=>U.columns?.[g]===!0):Object.keys(X.columns).filter((g)=>!R.includes(g))}else R=Object.keys(X.columns);for(let b of R){let g=X.columns[b];L.push({tsKey:b,value:g})}let _=[];if(U.with)_=Object.entries(U.with).filter((b)=>!!b[1]).map(([b,g])=>({tsKey:b,queryConfig:g,relation:X.relations[b]}));let S;if(U.extras){S=typeof U.extras==="function"?U.extras(M,{sql:J}):U.extras;for(let[b,g]of Object.entries(S))L.push({tsKey:b,value:oO(g,Y)})}for(let{tsKey:b,value:g}of L)z.push({dbKey:I(g,s.Aliased)?g.fieldAlias:X.columns[b].name,tsKey:b,field:I(g,p$)?Y0(g,Y):g,relationTableTsKey:void 0,isJson:!1,selection:[]});let x=typeof U.orderBy==="function"?U.orderBy(M,FJ()):U.orderBy??[];if(!Array.isArray(x))x=[x];Q=x.map((b)=>{if(I(b,p$))return Y0(b,Y);return WU(b,Y)}),F=U.limit,O=U.offset;for(let{tsKey:b,queryConfig:g,relation:T$}of _){let N$=QJ(T,W,T$),j=kW(T$.referencedTable),U$=W[j],t=`${Y}_${b}`,z$=GU(...N$.fields.map((h4,n6)=>S9(Y0(N$.references[n6],t),Y0(h4,Y)))),B$=this.buildRelationalQueryWithoutPK({fullSchema:$,schema:T,tableNamesMap:W,table:$[U$],tableConfig:T[U$],queryConfig:I(T$,CT)?g===!0?{limit:1}:{...g,limit:1}:g,tableAlias:t,joinOn:z$,nestedQueryRelation:T$}),e$=J`${J.identifier(t)}.${J.identifier("data")}`.as(b);K.push({on:J`true`,table:new M4(B$.sql,{},t),alias:t,joinType:"left",lateral:!0}),z.push({dbKey:b,tsKey:b,field:e$,relationTableTsKey:U$,isJson:!0,selection:B$.selection})}}if(z.length===0)throw new D9({message:`No fields selected for table "${X.tsName}" ("${Y}")`});let E;if(Z=GU(H,Z),G){let M=J`json_build_array(${J.join(z.map(({field:_,tsKey:S,isJson:x})=>x?J`${J.identifier(`${Y}_${S}`)}.${J.identifier("data")}`:I(_,s.Aliased)?_.sql:_),J`, `)})`;if(I(G,zU))M=J`coalesce(json_agg(${M}${Q.length>0?J` order by ${J.join(Q,J`, `)}`:void 0}), '[]'::json)`;let L=[{dbKey:"data",tsKey:"data",field:M.as("data"),isJson:!0,relationTableTsKey:X.tsName,selection:z}];if(F!==void 0||O!==void 0||Q.length>0)E=this.buildSelectQuery({table:M9(w,Y),fields:{},fieldsFlat:[{path:[],field:J.raw("*")}],where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]}),Z=void 0,F=void 0,O=void 0,Q=[];else E=M9(w,Y);E=this.buildSelectQuery({table:I(E,x4)?E:new M4(E,{},Y),fields:{},fieldsFlat:L.map(({field:_})=>({path:[],field:I(_,p$)?Y0(_,Y):_})),joins:K,where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]})}else E=this.buildSelectQuery({table:M9(w,Y),fields:{},fieldsFlat:z.map(({field:M})=>({path:[],field:I(M,p$)?Y0(M,Y):M})),joins:K,where:Z,limit:F,offset:O,orderBy:Q,setOperators:[]});return{tableTsKey:X.tsName,sql:E,selection:z}}}class MQ{static[N]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class P6{static[N]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor($){if(this.fields=$.fields,this.session=$.session,this.dialect=$.dialect,$.withList)this.withList=$.withList;this.distinct=$.distinct}authToken;setToken($){return this.authToken=$,this}from($){let T=!!this.fields,W=$,w;if(this.fields)w=this.fields;else if(I(W,M4))w=Object.fromEntries(Object.keys(W._.selectedFields).map((X)=>[X,W[X]]));else if(I(W,VU))w=W[t$].selectedFields;else if(I(W,s))w={};else w=uD(W);return new DQ({table:W,fields:w,isPartialSelect:T,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class bJ extends MQ{static[N]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:$,fields:T,isPartialSelect:W,session:w,dialect:X,withList:U,distinct:Y}){super();this.config={withList:U,table:$,fields:{...T},distinct:Y,setOperators:[]},this.isPartialSelect=W,this.session=w,this.dialect=X,this._={selectedFields:T,config:this.config},this.tableName=y0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let G of b1($))this.usedTables.add(G)}getUsedTables(){return[...this.usedTables]}createJoin($,T){return(W,w)=>{let X=this.tableName,U=y0(W);for(let Y of b1(W))this.usedTables.add(Y);if(typeof U==="string"&&this.config.joins?.some((Y)=>Y.alias===U))throw new Error(`Alias "${U}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof X==="string")this.config.fields={[X]:this.config.fields};if(typeof U==="string"&&!I(W,s)){let Y=I(W,M4)?W._.selectedFields:I(W,c6)?W[t$].selectedFields:W[o.Symbol.Columns];this.config.fields[U]=Y}}if(typeof w==="function")w=w(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:w,table:W,joinType:$,alias:U,lateral:T}),typeof U==="string")switch($){case"left":{this.joinsNotNullableMap[U]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[U]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[U]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[U]=!1;break}}return this}}leftJoin=this.createJoin("left",!1);leftJoinLateral=this.createJoin("left",!0);rightJoin=this.createJoin("right",!1);innerJoin=this.createJoin("inner",!1);innerJoinLateral=this.createJoin("inner",!0);fullJoin=this.createJoin("full",!1);crossJoin=this.createJoin("cross",!1);crossJoinLateral=this.createJoin("cross",!0);createSetOperator($,T){return(W)=>{let w=typeof W==="function"?W(JB()):W;if(!XU(this.getSelectedFields(),w.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:$,isAll:T,rightSelect:w}),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($){return this.config.setOperators.push(...$),this}where($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=$,this}having($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=$,this}groupBy(...$){if(typeof $[0]==="function"){let T=$[0](new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(T)?T:[T]}else this.config.groupBy=$;return this}orderBy(...$){if(typeof $[0]==="function"){let T=$[0](new Proxy(this.config.fields,new E4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),W=Array.isArray(T)?T:[T];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=W;else this.config.orderBy=W}else{let T=$;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=T;else this.config.orderBy=T}return this}limit($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=$;else this.config.limit=$;return this}offset($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=$;else this.config.offset=$;return this}for($,T={}){return this.config.lockingClause={strength:$,config:T},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}as($){let T=[];if(T.push(...b1(this.config.table)),this.config.joins)for(let W of this.config.joins)T.push(...b1(W.table));return new Proxy(new M4(this.getSQL(),this.config.fields,$,!1,[...new Set(T)]),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new E4({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}$withCache($){return this.cacheConfig=$===void 0?{config:{},enable:!0,autoInvalidate:!0}:$===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...$},this}}class DQ extends bJ{static[N]="PgSelect";_prepare($){let{session:T,config:W,dialect:w,joinsNotNullableMap:X,authToken:U,cacheConfig:Y,usedTables:G}=this;if(!T)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let{fields:H}=W;return d$.startActiveSpan("drizzle.prepareQuery",()=>{let z=N1(H),F=T.prepareQuery(w.sqlToQuery(this.getSQL()),z,$,!0,void 0,{type:"select",tables:[...G]},Y);return F.joinsNotNullableMap=X,F.setToken(U)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}cD(DQ,[q6]);function i2($,T){return(W,w,...X)=>{let U=[w,...X].map((Y)=>({type:$,isAll:T,rightSelect:Y}));for(let Y of U)if(!XU(W.getSelectedFields(),Y.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return W.addSetOperators(U)}}var JB=()=>({union:RB,unionAll:_B,intersect:kB,intersectAll:vB,except:qB,exceptAll:PB}),RB=i2("union",!1),_B=i2("union",!0),kB=i2("intersect",!1),vB=i2("intersect",!0),qB=i2("except",!1),PB=i2("except",!0);class KU{static[N]="PgQueryBuilder";dialect;dialectConfig;constructor($){this.dialect=I($,SW)?$:void 0,this.dialectConfig=I($,SW)?void 0:$}$with=($,T)=>{let W=this;return{as:(X)=>{if(typeof X==="function")X=X(W);return new Proxy(new ew(X.getSQL(),T??("getSelectedFields"in X?X.getSelectedFields()??{}:{}),$,!0),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...$){let T=this;function W(U){return new P6({fields:U??void 0,session:void 0,dialect:T.getDialect(),withList:$})}function w(U){return new P6({fields:U??void 0,session:void 0,dialect:T.getDialect(),distinct:!0})}function X(U,Y){return new P6({fields:Y??void 0,session:void 0,dialect:T.getDialect(),distinct:{on:U}})}return{select:W,selectDistinct:w,selectDistinctOn:X}}select($){return new P6({fields:$??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct($){return new P6({fields:$??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn($,T){return new P6({fields:T??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:$}})}getDialect(){if(!this.dialect)this.dialect=new SW(this.dialectConfig);return this.dialect}}function b1($){if(I($,x4))return[$[_W]?`${$[_W]}.${$[o.Symbol.BaseName]}`:$[o.Symbol.BaseName]];if(I($,M4))return $._.usedTables??[];if(I($,s))return $.usedTables??[];return[]}class o9 extends q6{constructor($,T,W,w){super();this.session=T,this.dialect=W,this.config={table:$,withList:w}}static[N]="PgDelete";config;cacheConfig;where($){return this.config.where=$,this}returning($=this.config.table[o.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=N1($),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"delete",tables:b1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class l9{constructor($,T,W,w,X){this.table=$,this.session=T,this.dialect=W,this.withList=w,this.overridingSystemValue_=X}static[N]="PgInsertBuilder";authToken;setToken($){return this.authToken=$,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values($){if($=Array.isArray($)?$:[$],$.length===0)throw new Error("values() must be called with at least one value");let T=$.map((W)=>{let w={},X=this.table[o.Symbol.Columns];for(let U of Object.keys(W)){let Y=W[U];w[U]=I(Y,s)?Y:new F1(Y,X[U])}return w});return new NQ(this.table,T,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select($){let T=typeof $==="function"?$(new KU):$;if(!I(T,s)&&!XU(this.table[A9],T._.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 NQ(this.table,T,this.session,this.dialect,this.withList,!0)}}class NQ extends q6{constructor($,T,W,w,X,U,Y){super();this.session=W,this.dialect=w,this.config={table:$,values:T,withList:X,select:U,overridingSystemValue_:Y}}static[N]="PgInsert";config;cacheConfig;returning($=this.config.table[o.Symbol.Columns]){return this.config.returningFields=$,this.config.returning=N1($),this}onConflictDoNothing($={}){if($.target===void 0)this.config.onConflict=J`do nothing`;else{let T="";T=Array.isArray($.target)?$.target.map((w)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(w))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target));let W=$.where?J` where ${$.where}`:void 0;this.config.onConflict=J`(${J.raw(T)})${W} do nothing`}return this}onConflictDoUpdate($){if($.where&&($.targetWhere||$.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 T=$.where?J` where ${$.where}`:void 0,W=$.targetWhere?J` where ${$.targetWhere}`:void 0,w=$.setWhere?J` where ${$.setWhere}`:void 0,X=this.dialect.buildUpdateSet(this.config.table,N9(this.config.table,$.set)),U="";return U=Array.isArray($.target)?$.target.map((Y)=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(Y))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing($.target)),this.config.onConflict=J`(${J.raw(U)})${W} do update set ${X}${T}${w}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:b1(this.config.table)},this.cacheConfig)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class LQ extends q6{constructor($,T,W){super();this.session=T,this.dialect=W,this.config={view:$}}static[N]="PgRefreshMaterializedView";config;concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,$,!0)})}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute($,this.authToken)})}}class r9{constructor($,T,W,w){this.table=$,this.session=T,this.dialect=W,this.withList=w}static[N]="PgUpdateBuilder";authToken;setToken($){return this.authToken=$,this}set($){return new yJ(this.table,N9(this.table,$),this.session,this.dialect,this.withList).setToken(this.authToken)}}class yJ extends q6{constructor($,T,W,w,X){super();this.session=W,this.dialect=w,this.config={set:T,table:$,withList:X,joins:[]},this.tableName=y0($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{}}static[N]="PgUpdate";config;tableName;joinsNotNullableMap;cacheConfig;from($){let T=$,W=y0(T);if(typeof W==="string")this.joinsNotNullableMap[W]=!0;return this.config.from=T,this}getTableLikeFields($){if(I($,x4))return $[o.Symbol.Columns];else if(I($,M4))return $._.selectedFields;return $[t$].selectedFields}createJoin($){return(T,W)=>{let w=y0(T);if(typeof w==="string"&&this.config.joins.some((X)=>X.alias===w))throw new Error(`Alias "${w}" is already used in this query`);if(typeof W==="function"){let X=this.config.from&&!I(this.config.from,s)?this.getTableLikeFields(this.config.from):void 0;W=W(new Proxy(this.config.table[o.Symbol.Columns],new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),X&&new Proxy(X,new E4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:W,table:T,joinType:$,alias:w}),typeof w==="string")switch($){case"left":{this.joinsNotNullableMap[w]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([X])=>[X,!1])),this.joinsNotNullableMap[w]=!0;break}case"inner":{this.joinsNotNullableMap[w]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([X])=>[X,!1])),this.joinsNotNullableMap[w]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where($){return this.config.where=$,this}returning($){if(!$){if($=Object.assign({},this.config.table[o.Symbol.Columns]),this.config.from){let T=y0(this.config.from);if(typeof T==="string"&&this.config.from&&!I(this.config.from,s)){let W=this.getTableLikeFields(this.config.from);$[T]=W}for(let W of this.config.joins){let w=y0(W.table);if(typeof w==="string"&&!I(W.table,s)){let X=this.getTableLikeFields(W.table);$[w]=X}}}}return this.config.returningFields=$,this.config.returning=N1($),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:$,...T}=this.dialect.sqlToQuery(this.getSQL());return T}_prepare($){let T=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,$,!0,void 0,{type:"insert",tables:b1(this.config.table)},this.cacheConfig);return T.joinsNotNullableMap=this.joinsNotNullableMap,T}prepare($){return this._prepare($)}authToken;setToken($){return this.authToken=$,this}execute=($)=>{return this._prepare().execute($,this.authToken)};getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new E4({alias:u4(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class AU extends s{constructor($){super(AU.buildEmbeddedCount($.source,$.filters).queryChunks);this.params=$,this.mapWith(Number),this.session=$.session,this.sql=AU.buildCount($.source,$.filters)}sql;token;static[N]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount($,T){return J`(select count(*) from ${$}${J.raw(" where ").if(T)}${T})`}static buildCount($,T){return J`select count(*) as count from ${$}${J.raw(" where ").if(T)}${T};`}setToken($){return this.token=$,this}then($,T){return Promise.resolve(this.session.count(this.sql,this.token)).then($,T)}catch($){return this.then(void 0,$)}finally($){return this.then((T)=>{return $?.(),T},(T)=>{throw $?.(),T})}}class RQ{constructor($,T,W,w,X,U,Y){this.fullSchema=$,this.schema=T,this.tableNamesMap=W,this.table=w,this.tableConfig=X,this.dialect=U,this.session=Y}static[N]="PgRelationalQueryBuilder";findMany($){return new JQ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?$:{},"many")}findFirst($){return new JQ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?{...$,limit:1}:{limit:1},"first")}}class JQ extends q6{constructor($,T,W,w,X,U,Y,G,H){super();this.fullSchema=$,this.schema=T,this.tableNamesMap=W,this.table=w,this.tableConfig=X,this.dialect=U,this.session=Y,this.config=G,this.mode=H}static[N]="PgRelationalQuery";_prepare($){return d$.startActiveSpan("drizzle.prepareQuery",()=>{let{query:T,builtQuery:W}=this._toSQL();return this.session.prepareQuery(W,void 0,$,!0,(w,X)=>{let U=w.map((Y)=>I9(this.schema,this.tableConfig,Y,T.selection,X));if(this.mode==="first")return U[0];return U})})}prepare($){return this._prepare($)}_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 $=this._getQuery(),T=this.dialect.sqlToQuery($.sql);return{query:$,builtQuery:T}}toSQL(){return this._toSQL().builtQuery}authToken;setToken($){return this.authToken=$,this}execute(){return d$.startActiveSpan("drizzle.operation",()=>{return this._prepare().execute(void 0,this.authToken)})}}class _Q extends q6{constructor($,T,W,w){super();this.execute=$,this.sql=T,this.query=W,this.mapBatchResult=w}static[N]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult($,T){return T?this.mapBatchResult($):$}_prepare(){return this}isResponseInArrayMode(){return!1}}class EU{constructor($,T,W){if(this.dialect=$,this.session=T,this._=W?{schema:W.schema,fullSchema:W.fullSchema,tableNamesMap:W.tableNamesMap,session:T}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:T},this.query={},this._.schema)for(let[w,X]of Object.entries(this._.schema))this.query[w]=new RQ(W.fullSchema,this._.schema,this._.tableNamesMap,W.fullSchema[w],X,$,T);this.$cache={invalidate:async(w)=>{}}}static[N]="PgDatabase";query;$with=($,T)=>{let W=this;return{as:(X)=>{if(typeof X==="function")X=X(new KU(W.dialect));return new Proxy(new ew(X.getSQL(),T??("getSelectedFields"in X?X.getSelectedFields()??{}:{}),$,!0),new E4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count($,T){return new AU({source:$,filters:T,session:this.session})}$cache;with(...$){let T=this;function W(H){return new P6({fields:H??void 0,session:T.session,dialect:T.dialect,withList:$})}function w(H){return new P6({fields:H??void 0,session:T.session,dialect:T.dialect,withList:$,distinct:!0})}function X(H,z){return new P6({fields:z??void 0,session:T.session,dialect:T.dialect,withList:$,distinct:{on:H}})}function U(H){return new r9(H,T.session,T.dialect,$)}function Y(H){return new l9(H,T.session,T.dialect,$)}function G(H){return new o9(H,T.session,T.dialect,$)}return{select:W,selectDistinct:w,selectDistinctOn:X,update:U,insert:Y,delete:G}}select($){return new P6({fields:$??void 0,session:this.session,dialect:this.dialect})}selectDistinct($){return new P6({fields:$??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn($,T){return new P6({fields:T??void 0,session:this.session,dialect:this.dialect,distinct:{on:$}})}update($){return new r9($,this.session,this.dialect)}insert($){return new l9($,this.session,this.dialect)}delete($){return new o9($,this.session,this.dialect)}refreshMaterializedView($){return new LQ($,this.session,this.dialect)}authToken;execute($){let T=typeof $==="string"?J.raw($):$.getSQL(),W=this.dialect.sqlToQuery(T),w=this.session.prepareQuery(W,void 0,void 0,!1);return new _Q(()=>w.execute(void 0,this.authToken),T,W,(X)=>w.mapResult(X,!0))}transaction($,T){return this.session.transaction($,T)}}class hJ{static[N]="Cache"}class MU extends hJ{strategy(){return"all"}static[N]="NoopCache";async get($){return}async put($,T,W,w){}async onMutate($){}}async function kQ($,T){let W=`${$}-${JSON.stringify(T)}`,X=new TextEncoder().encode(W),U=await crypto.subtle.digest("SHA-256",X);return[...new Uint8Array(U)].map((H)=>H.toString(16).padStart(2,"0")).join("")}class g0 extends Error{constructor($,T,W){super(`Failed query: ${$}
|
|
110
|
+
params: ${T}`);if(this.query=$,this.params=T,this.cause=W,Error.captureStackTrace(this,g0),W)this.cause=W}}class vQ{constructor($,T,W,w){if(this.query=$,this.cache=T,this.queryMetadata=W,this.cacheConfig=w,T&&T.strategy()==="all"&&w===void 0)this.cacheConfig={enable:!0,autoInvalidate:!0};if(!this.cacheConfig?.enable)this.cacheConfig=void 0}authToken;getQuery(){return this.query}mapResult($,T){return $}setToken($){return this.authToken=$,this}static[N]="PgPreparedQuery";joinsNotNullableMap;async queryWithCache($,T,W){if(this.cache===void 0||I(this.cache,MU)||this.queryMetadata===void 0)try{return await W()}catch(w){throw new g0($,T,w)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await W()}catch(w){throw new g0($,T,w)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[w]=await Promise.all([W(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return w}catch(w){throw new g0($,T,w)}if(!this.cacheConfig)try{return await W()}catch(w){throw new g0($,T,w)}if(this.queryMetadata.type==="select"){let w=await this.cache.get(this.cacheConfig.tag??await kQ($,T),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(w===void 0){let X;try{X=await W()}catch(U){throw new g0($,T,U)}return await this.cache.put(this.cacheConfig.tag??await kQ($,T),X,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),X}return w}try{return await W()}catch(w){throw new g0($,T,w)}}}class qQ{constructor($){this.dialect=$}static[N]="PgSession";execute($,T){return d$.startActiveSpan("drizzle.operation",()=>{return d$.startActiveSpan("drizzle.prepareQuery",()=>{return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1)}).setToken(T).execute(void 0,T)})}all($){return this.prepareQuery(this.dialect.sqlToQuery($),void 0,void 0,!1).all()}async count($,T){let W=await this.execute($,T);return Number(W[0].count)}}class PQ extends EU{constructor($,T,W,w=0){super($,T,W);this.schema=W,this.nestedIndex=w}static[N]="PgTransaction";rollback(){throw new lO}getTransactionConfigSQL($){let T=[];if($.isolationLevel)T.push(`isolation level ${$.isolationLevel}`);if($.accessMode)T.push($.accessMode);if(typeof $.deferrable==="boolean")T.push($.deferrable?"deferrable":"not deferrable");return J.raw(T.join(" "))}setTransaction($){return this.session.execute(J`set transaction ${this.getTransactionConfigSQL($)}`)}}class gJ extends vQ{constructor($,T,W,w,X,U,Y,G,H,z){super({sql:T,params:W},X,U,Y);this.client=$,this.queryString=T,this.params=W,this.logger=w,this.fields=G,this._isResponseInArrayMode=H,this.customResultMapper=z}static[N]="PostgresJsPreparedQuery";async execute($={}){return d$.startActiveSpan("drizzle.execute",async(T)=>{let W=dO(this.params,$);T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.logger.logQuery(this.queryString,W);let{fields:w,queryString:X,client:U,joinsNotNullableMap:Y,customResultMapper:G}=this;if(!w&&!G)return d$.startActiveSpan("drizzle.driver.execute",()=>{return this.queryWithCache(X,W,async()=>{return await U.unsafe(X,W)})});let H=await d$.startActiveSpan("drizzle.driver.execute",()=>{return T?.setAttributes({"drizzle.query.text":X,"drizzle.query.params":JSON.stringify(W)}),this.queryWithCache(X,W,async()=>{return await U.unsafe(X,W).values()})});return d$.startActiveSpan("drizzle.mapResponse",()=>{return G?G(H):H.map((z)=>mD(w,z,Y))})})}all($={}){return d$.startActiveSpan("drizzle.execute",async(T)=>{let W=dO(this.params,$);return T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.logger.logQuery(this.queryString,W),d$.startActiveSpan("drizzle.driver.execute",()=>{return T?.setAttributes({"drizzle.query.text":this.queryString,"drizzle.query.params":JSON.stringify(W)}),this.queryWithCache(this.queryString,W,async()=>{return this.client.unsafe(this.queryString,W)})})})}isResponseInArrayMode(){return this._isResponseInArrayMode}}class DU extends qQ{constructor($,T,W,w={}){super(T);this.client=$,this.schema=W,this.options=w,this.logger=w.logger??new nO,this.cache=w.cache??new MU}static[N]="PostgresJsSession";logger;cache;prepareQuery($,T,W,w,X,U,Y){return new gJ(this.client,$.sql,$.params,this.logger,this.cache,U,Y,T,w,X)}query($,T){return this.logger.logQuery($,T),this.client.unsafe($,T).values()}queryObjects($,T){return this.client.unsafe($,T)}transaction($,T){return this.client.begin(async(W)=>{let w=new DU(W,this.dialect,this.schema,this.options),X=new CQ(this.dialect,w,this.schema);if(T)await X.setTransaction(T);return $(X)})}}class CQ extends PQ{constructor($,T,W,w=0){super($,T,W,w);this.session=T}static[N]="PostgresJsTransaction";transaction($){return this.session.client.savepoint((T)=>{let W=new DU(T,this.dialect,this.schema,this.session.options),w=new CQ(this.dialect,W,this.schema);return $(w)})}}class mJ extends EU{static[N]="PostgresJsDatabase"}function t2($,T={}){let W=(H)=>H;for(let H of["1184","1082","1083","1114","1182","1185","1115","1231"])$.options.parsers[H]=W,$.options.serializers[H]=W;$.options.serializers["114"]=W,$.options.serializers["3802"]=W;let w=new SW({casing:T.casing}),X;if(T.logger===!0)X=new rO;else if(T.logger!==!1)X=T.logger;let U;if(T.schema){let H=OJ(T.schema,ZJ);U={fullSchema:T.schema,schema:H.tables,tableNamesMap:H.tableNamesMap}}let Y=new DU($,w,U,{logger:X,cache:T.cache}),G=new mJ(w,Y,U);if(G.$client=$,G.$cache=T.cache,G.$cache)G.$cache.invalidate=T.cache?.onMutate;return G}function n9(...$){if(typeof $[0]==="string"){let T=n2($[0]);return t2(T,$[1])}if(pD($[0])){let{connection:T,client:W,...w}=$[0];if(W)return t2(W,w);if(typeof T==="object"&&T.url!==void 0){let{url:U,...Y}=T,G=n2(U,Y);return t2(G,w)}let X=n2(T);return t2(X,w)}return t2($[0],$[1])}(($)=>{function T(W){return t2({options:{parsers:{},serializers:{}}},W)}$.mock=T})(n9||(n9={}));function cJ($,T){if($ instanceof Promise)throw new Error(T)}function CB($,T){let W={},w=[];for(let X in $){let U=$[X]["~standard"].validate(T[X]);if(cJ(U,`Validation must be synchronous, but ${X} returned a Promise.`),U.issues){w.push(...U.issues.map((Y)=>({...Y,message:Y.message,path:[X,...Y.path??[]]})));continue}W[X]=U.value}if(w.length)return{issues:w};return{value:W}}function SQ($){let T=$.runtimeEnvStrict??$.runtimeEnv??process.env;if($.emptyStringAsUndefined??!1){for(let[R,_]of Object.entries(T))if(_==="")delete T[R]}if(!!$.skipValidation)return T;let X=typeof $.client==="object"?$.client:{},U=typeof $.server==="object"?$.server:{},Y=typeof $.shared==="object"?$.shared:{},G=$.isServer??(typeof window==="undefined"||("Deno"in window)),H=G?{...U,...Y,...X}:{...X,...Y},z=$.createFinalSchema?.(H,G)["~standard"].validate(T)??CB(H,T);cJ(z,"Validation must be synchronous");let F=$.onValidationError??((R)=>{throw console.error("\u274C Invalid environment variables:",R),new Error("Invalid environment variables")}),O=$.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(z.issues)return F(z.issues);let Q=(R)=>{if(!$.clientPrefix)return!0;return!R.startsWith($.clientPrefix)&&!(R in Y)},Z=(R)=>{return G||!Q(R)},K=(R)=>{return R==="__esModule"||R==="$$typeof"},E=($.extends??[]).reduce((R,_)=>{return Object.assign(R,_)},{}),M=Object.assign(E,z.value);return new Proxy(M,{get(R,_){if(typeof _!=="string")return;if(K(_))return;if(!Z(_))return O(_);return Reflect.get(R,_)}})}var jT=($)=>Array.isArray($)?$:[$],uJ=($,T)=>{let W=[[],[]];for(let w of $)if(T(w))W[0].push(w);else W[1].push(w);return W},i9=Array,m0=($,T)=>$.includes(T),pJ=($,T=0)=>[...new Array($)].map((W,w)=>w+T),C$=($,T,W)=>{if($===void 0)return T===void 0?[]:Array.isArray(T)?T:[T];if(W?.prepend)if(Array.isArray(T))$.unshift(...T);else $.unshift(T);else if(Array.isArray(T))$.push(...T);else $.push(T);return $},c0=($,T)=>{if(T===void 0||T===null)return $??[];if($===void 0||$===null)return jT(T);return $.concat(T)},dJ=(...$)=>$.reduce(c0,[]),z0=($,T,W)=>{if($===void 0)return Array.isArray(T)?T:[T];let w=W?.isEqual??((X,U)=>X===U);for(let X of jT(T))if(!$.some((U)=>w(U,X)))$.push(X);return $},oJ=($,T)=>$.reduce((W,w)=>{let X=w[T];return W[X]=C$(W[X],w),W},{}),u0=($,T,W)=>$.length===T.length&&$.every(W?.isEqual?(w,X)=>W.isEqual(w,T[X]):(w,X)=>w===T[X]);var p6=($,T)=>f4($)===T,f4=($)=>{let T=typeof $;return T==="object"?$===null?"null":"object":T==="function"?"object":T},d6={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},lJ={...d6,function:"a function"};class rJ extends Error{}var I$=($)=>jW($,rJ),jW=($,T=Error)=>{throw new T($)};class NU extends Error{name="ParseError"}var B=($)=>jW($,NU),y1=($)=>` ${$}`;var E$=($,T)=>{let W={},w=Array.isArray($),X=!1;for(let[U,Y]of Object.entries($).entries()){let G=w?T(U,Y[1]):T(...Y,U);X||=typeof G[0]==="number";let H=Array.isArray(G[0])||G.length===0?G:[G];for(let[z,F]of H)if(typeof z==="object")W[z.group]=C$(W[z.group],F);else W[z]=F}return X?Object.values(W):W};var jQ=Object.entries;var b4=($,T)=>($ in T),a2=($,T)=>(T in $);class IQ{constructor($){Object.assign(this,$)}}var nJ=class{};class LU extends nJ{}var SB=($,T)=>{let W={},w={},X;for(X in $)if(X in T)W[X]=$[X];else w[X]=$[X];return[W,w]};var iJ=($,T)=>SB($,T)[1],H0=($)=>Object.keys($).length===0,IW=($)=>[...Object.entries($),...Object.getOwnPropertySymbols($).map((T)=>[T,$[T]])],tJ=($,T)=>Object.defineProperties($,Object.getOwnPropertyDescriptors(T)),aJ=($)=>{let T=Object.keys($).sort(),W={};for(let w=0;w<T.length;w++)W[T[w]]=$[T[w]];return W};var Q1=y1("represents an uninitialized value"),sJ=($)=>Object.values($).filter((T)=>{if(typeof T==="number")return!0;return typeof $[T]!=="number"});var BQ={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},xQ=globalThis.File??Blob,fQ={ArrayBuffer,Blob,File:xQ,FormData,Headers,Request,Response,URL},jB={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},BW={...BQ,...fQ,...jB,String,Number,Boolean},JU=($)=>{let T=Object.getPrototypeOf($);while(T?.constructor&&(!b4(T.constructor.name,BW)||!($ instanceof BW[T.constructor.name])))T=Object.getPrototypeOf(T);let W=T?.constructor?.name;if(W===void 0||W==="Object")return;return W},RU=($)=>typeof $==="object"&&$!==null?JU($)??"object":f4($);var o$=Array.isArray,IB={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"},BB={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"},xB={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"},eJ={...IB,...BB,...xB},_U=($)=>{let T=Object($).name??null;return T&&b4(T,BW)&&BW[T]===$?T:null};var bQ=($,T)=>{let W=$.prototype;while(W!==null){if(W===T.prototype)return!0;W=Object.getPrototypeOf(W)}return!1};var $R=($)=>TR($,new Map),TR=($,T)=>{if(typeof $!=="object"||$===null)return $;if(T?.has($))return T.get($);let W=_U($.constructor);if(W==="Date")return new Date($.getTime());if(W&&W!=="Array")return $;let w=Array.isArray($)?$.slice():Object.create(Object.getPrototypeOf($)),X=Object.getOwnPropertyDescriptors($);if(T){T.set($,w);for(let U in X){let Y=X[U];if("get"in Y||"set"in Y)continue;Y.value=TR(Y.value,T)}}return Object.defineProperties(w,X),w};var fB=($)=>{let T=Q1;return()=>T===Q1?T=$():T},IT=($)=>typeof $==="function"&&$.length===0;var WR=class extends Function{constructor(...$){let T=$.slice(0,-1),W=$.at(-1);try{super(...T,W)}catch(w){return I$(`Encountered an unexpected error while compiling your definition:
|
|
111
|
+
Message: ${w}
|
|
110
112
|
Source: (${$.slice(0,-1)}) => {
|
|
111
113
|
${$.at(-1)}
|
|
112
|
-
}`)}}};class
|
|
113
|
-
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},
|
|
114
|
-
`+
|
|
115
|
-
${
|
|
116
|
-
${W}]`:`[${
|
|
117
|
-
${
|
|
114
|
+
}`)}}};class h1{constructor($,...[T]){return Object.assign(Object.setPrototypeOf($.bind(T?.bind??this),this.constructor.prototype),T?.attach)}}var XR=fB(()=>{try{return new Function("return false")()}catch{return!0}});var $T$=y1("brand");var wR=y1("arkInferred");var XT$=y1("args");class w6{constructor(){}}var bB=()=>{try{return((new Error().stack?.split(`
|
|
115
|
+
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},yB=globalThis.process?.env??{},UR={fileName:bB,env:yB};var YR=($)=>$[0].toUpperCase()+$.slice(1);var yQ=($)=>new RegExp(hB($),typeof $==="string"?"":$.flags);var hB=($)=>{return`^(?:${typeof $==="string"?$:$.source})$`};var p0={negativeLookahead:($)=>`(?!${$})`,nonCapturingGroup:($)=>`(?:${$})`},kU="\\",BT={" ":1,"\n":1,"\t":1};var gB=/^-0\.?0*$/.source,zR=/[1-9]\d*/.source,mB=/\.\d+/.source,cB=/\.\d*[1-9]/.source,HR=($)=>yQ(p0.negativeLookahead(gB)+p0.nonCapturingGroup("-?"+p0.nonCapturingGroup(p0.nonCapturingGroup("0|"+zR)+p0.nonCapturingGroup($.decimalPattern)+"?")+($.allowDecimalOnly?"|"+$.decimalPattern:"")+"?")),GR=HR({decimalPattern:cB,allowDecimalOnly:!1}),uB=GR.test.bind(GR),t9=HR({decimalPattern:mB,allowDecimalOnly:!0}),FT$=t9.test.bind(t9),pB=/^-?\d*\.?\d*$/,dB=($)=>$.length!==0&&pB.test($),vU=yQ(p0.negativeLookahead("^-0$")+"-?"+p0.nonCapturingGroup(p0.nonCapturingGroup("0|"+zR))),oB=vU.test.bind(vU),hQ=/^-?\d+$/,lB=hQ.test.bind(hQ),FR={number:"a number",bigint:"a bigint",integer:"an integer"},OR=($,T)=>`'${$}' was parsed as ${FR[T]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,rB=($,T)=>T==="number"?uB($):oB($),nB=($,T)=>T==="number"?Number($):Number.parseInt($),iB=($,T)=>T==="number"?dB($):lB($),QR=($,T)=>gQ($,"number",T),ZR=($,T)=>gQ($,"number",{...T,strict:!0}),VR=($,T)=>gQ($,"integer",T),gQ=($,T,W)=>{let w=nB($,T);if(!Number.isNaN(w)){if(iB($,T)){if(W?.strict)return rB($,T)?w:B(OR($,T));return w}}return W?.errorOnFail?B(W?.errorOnFail===!0?`Failed to parse ${FR[T]} from '${$}'`:W?.errorOnFail):void 0},KR=($)=>{if($[$.length-1]!=="n")return;let T=$.slice(0,-1),W;try{W=BigInt(T)}catch{return}if(vU.test(T))return W;if(hQ.test(T))return B(OR($,"bigint"))};var tB="0.46.0",aB={version:tB,filename:UR.fileName(),FileConstructor:xQ},xW=aB,AR=new Map,mQ=Object.create(null),qU=($)=>{let T=AR.get($);if(T)return T;let W=sB($);if(mQ[W])W=`${W}${mQ[W]++}`;else mQ[W]=1;return xW[W]=$,AR.set($,W),W},xT=($)=>/^[$A-Z_a-z][\w$]*$/.test($),sB=($)=>{switch(typeof $){case"object":{if($===null)break;let T=JU($)??"object";return T[0].toLowerCase()+T.slice(1)}case"function":return xT($.name)?$.name:"fn";case"symbol":return $.description&&xT($.description)?$.description:"symbol"}return I$(`Unexpected attempt to register serializable value of type ${f4($)}`)};var PU=($)=>typeof $==="string"?JSON.stringify($):typeof $==="bigint"?`${$}n`:`${$}`;var ER=($,T={})=>CU($,{onUndefined:"$ark.undefined",onBigInt:(W)=>`$ark.bigint-${W}`,...T},[]);var M$=($,T)=>{switch(f4($)){case"object":let W=$,w=W.constructor.name;return w==="Object"||w==="Array"?T?.quoteKeys===!1?a9(W,T?.indent??0,""):JSON.stringify(CU(W,s2,[]),null,T?.indent):a9(W,T?.indent??0,"");case"symbol":return s2.onSymbol($);default:return PU($)}},a9=($,T,W)=>{if(typeof $==="function")return s2.onFunction($);if(typeof $!=="object"||$===null)return PU($);let w=W+" ".repeat(T);if(Array.isArray($)){if($.length===0)return"[]";let U=$.map((Y)=>a9(Y,T,w)).join(`,
|
|
116
|
+
`+w);return T?`[
|
|
117
|
+
${w}${U}
|
|
118
|
+
${W}]`:`[${U}]`}let X=$.constructor.name;if(X==="Object"){let U=IW($).map(([Y,G])=>{let H=typeof Y==="symbol"?s2.onSymbol(Y):xT(Y)?Y:JSON.stringify(Y),z=a9(G,T,w);return`${w}${H}: ${z}`});if(U.length===0)return"{}";return T?`{
|
|
119
|
+
${U.join(`,
|
|
118
120
|
`)}
|
|
119
|
-
${W}}`:`{${
|
|
121
|
+
${W}}`:`{${U.join(", ")}}`}if($ instanceof Date)return fW($);if("expression"in $&&typeof $.expression==="string")return $.expression;return X},s2={onCycle:()=>"(cycle)",onSymbol:($)=>`Symbol(${qU($)})`,onFunction:($)=>`Function(${qU($)})`},CU=($,T,W)=>{switch(f4($)){case"object":{let w=$;if("toJSON"in w&&typeof w.toJSON==="function")return w.toJSON();if(typeof w==="function")return s2.onFunction(w);if(W.includes(w))return"(cycle)";let X=[...W,w];if(Array.isArray(w))return w.map((Y)=>CU(Y,T,X));if(w instanceof Date)return w.toDateString();let U={};for(let Y in w)U[Y]=CU(w[Y],T,X);for(let Y of Object.getOwnPropertySymbols(w))U[T.onSymbol?.(Y)??Y.toString()]=CU(w[Y],T,X);return U}case"symbol":return s2.onSymbol($);case"bigint":return T.onBigInt?.($)??`${$}n`;case"undefined":return T.onUndefined??"undefined";case"string":return $.replaceAll("\\","\\\\");default:return $}},fW=($)=>{let T=$.getFullYear(),W=$.getMonth(),w=$.getDate(),X=$.getHours(),U=$.getMinutes(),Y=$.getSeconds(),G=$.getMilliseconds();if(W===0&&w===1&&X===0&&U===0&&Y===0&&G===0)return`${T}`;let H=`${eB[W]} ${w}, ${T}`;if(X===0&&U===0&&Y===0&&G===0)return H;let z=$.toLocaleTimeString(),F=z.endsWith(" AM")||z.endsWith(" PM")?z.slice(-3):"";if(F)z=z.slice(0,-F.length);if(G)z+=`.${Tx(G,3)}`;else if($x.test(z))z=z.slice(0,-3);return`${z+F}, ${H}`},eB=["January","February","March","April","May","June","July","August","September","October","November","December"],$x=/:\d\d:00$/,Tx=($,T)=>String($).padStart(T,"0");var MR=($,T,...[W])=>{let w=W?.stringifySymbol??M$,X=$;switch(typeof T){case"string":X=xT(T)?$===""?T:`${$}.${T}`:`${$}[${JSON.stringify(T)}]`;break;case"number":X=`${$}[${T}]`;break;case"symbol":X=`${$}[${w(T)}]`;break;default:if(W?.stringifyNonKey)X=`${$}[${W.stringifyNonKey(T)}]`;else B(`${M$(T)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return X},d0=($,...T)=>$.reduce((W,w)=>MR(W,w,...T),"");class SU extends i9{cache={};constructor(...$){super();this.push(...$)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let $=0;$<this.length;$++)this.cache.json.push(typeof this[$]==="symbol"?M$(this[$]):this[$]);return this.cache.json}stringify(){if(this.cache.stringify)return this.cache.stringify;return this.cache.stringify=d0(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let $="",T=[$];for(let W of this)$=MR($,W),T.push($);return this.cache.stringifyAncestors=T}}class cQ{chars;i;def;constructor($){this.def=$,this.chars=[...$],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($){let T="";while(this.lookahead){if($(this,T))if(T[T.length-1]===kU)T=T.slice(0,-1);else break;T+=this.shift()}return T}shiftUntilLookahead($){return typeof $==="string"?this.shiftUntil((T)=>T.lookahead===$):this.shiftUntil((T)=>(T.lookahead in $))}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in BT))}jumpToIndex($){this.i=$<0?this.length+$:$}jumpForward($){this.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($,T){return this.chars.slice($,T).join("")}lookaheadIs($){return this.lookahead===$}lookaheadIsIn($){return this.lookahead in $}}var fT$=y1("implementedTraits");var uQ="$ark",Wx=2;while(uQ in globalThis)uQ=`$ark${Wx++}`;var DR=uQ;globalThis[DR]=xW;var y=xW,Xx=($)=>`${DR}.${$}`,Z4=($)=>Xx(qU($));class s9 extends LU{argNames;body="";constructor(...$){super();this.argNames=$;for(let T of $){if(T in this)throw new Error(`Arg name '${T}' would overwrite an existing property on FunctionBody`);this[T]=T}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop($,T=!1){return pQ($,T)}index($,T=!1){return NR(`${$}`,T)}line($){return this.body+=`${" ".repeat(this.indentation)}${$}
|
|
120
122
|
`,this}const($,T){return this.line(`const ${$} = ${T}`),this}let($,T){return this.line(`let ${$} = ${T}`)}set($,T){return this.line(`${$} = ${T}`)}if($,T){return this.block(`if (${$})`,T)}elseIf($,T){return this.block(`else if (${$})`,T)}else($){return this.block("else",$)}for($,T,W=0){return this.block(`for (let i = ${W}; ${$}; i++)`,T)}forIn($,T){return this.block(`for (const k in ${$})`,T)}block($,T,W=""){return this.line(`${$} {`),this.indent(),T(this),this.dedent(),this.line(`}${W}`)}return($=""){return this.line(`return ${$}`)}write($="anonymous",T=0){return`${$}(${this.argNames.join(", ")}) { ${T?this.body.split(`
|
|
121
123
|
`).map((W)=>" ".repeat(T)+`${W}`).join(`
|
|
122
|
-
`):this.body} }`}compile(){return new
|
|
123
|
-
`)}_add($){let T=this.byPath[$.propString];if(T){if(T.hasCode("union")&&T.errors.length===0)return;let W=$.hasCode("union")&&$.errors.length===0?$:new
|
|
124
|
-
`+$.map((T)=>` \u2022 ${
|
|
125
|
-
`));Object.defineProperty(this,"arkErrors",{value:$,enumerable:!1})}}var
|
|
124
|
+
`):this.body} }`}compile(){return new WR(...this.argNames,this.body)}}var o0=($)=>p6($,"object")||typeof $==="symbol"?Z4($):PU($),pQ=($,T=!1)=>{if(typeof $==="string"&&xT($))return`${T?"?":""}.${$}`;return NR(wx($),T)},wx=($)=>typeof $==="symbol"?Z4($):JSON.stringify($),NR=($,T=!1)=>`${T?"?.":""}[${$}]`;class jU extends s9{traversalKind;optimistic;constructor($){super("data","ctx");this.traversalKind=$.kind,this.optimistic=$.optimistic===!0}invoke($,T){let W=T?.arg??this.data,w=typeof $==="string"?!0:this.requiresContextFor($),X=typeof $==="string"?$:$.id;if(w)return`${this.referenceToId(X,T)}(${W}, ${this.ctx})`;return`${this.referenceToId(X,T)}(${W})`}referenceToId($,T){let W=T?.kind??this.traversalKind,w=`this.${$}${W}`;return T?.bind?`${w}.bind(${T?.bind})`:w}requiresContextFor($){return this.traversalKind==="Apply"||$.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($,T,W){let w=this.requiresContextFor(W);if(w)this.line(`${this.ctx}.path.push(${$})`);if(this.check(W,{arg:T}),w)this.line(`${this.ctx}.path.pop()`);return this}check($,T){return this.traversalKind==="Allows"?this.if(`!${this.invoke($,T)}`,()=>this.return(!1)):this.line(this.invoke($,T))}}var e9=($)=>E$($,(T,W)=>[T,o$(W)?[...W]:W]),C6=y1("arkKind"),W$=($,T)=>$?.[C6]===T,a$=($)=>W$($,"root")||W$($,"constraint");var LR=["unit","proto","domain"],e2=["required","optional","index","sequence"],dQ=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],$z=[...dQ,...e2,"structure","predicate"],$X=["alias","union","morph","unit","intersection","proto","domain"],Ux=[...$X,...$z],Tz=E$($z,($,T)=>[T,1]),JR=E$([...e2,"undeclared"],($,T)=>[T,1]),RR=E$(Ux,($,T)=>[T,$]),TX=($)=>typeof $==="string"&&($ in RR);var WX=($)=>RR[$],Wz=($)=>$X.slice(WX($)+1),MW$=[...Wz("union"),"alias"],DW$=[...Wz("morph"),"alias"],R1=($)=>{if(typeof $==="string"||typeof $==="boolean"||$===null)return $;if(typeof $==="number"){if(Number.isNaN($))return"NaN";if($===Number.POSITIVE_INFINITY)return"Infinity";if($===Number.NEGATIVE_INFINITY)return"-Infinity";return $}return o0($)},fT=($)=>{let T="{ ";for(let[W,w]of Object.entries($))T+=`${W}: ${o0(w)}, `;return T+" }"},D$=($)=>{let T=$;if(T.hasAssociatedError)T.defaults.expected??=(W)=>("description"in W)?W.description:T.defaults.description(W),T.defaults.actual??=(W)=>M$(W),T.defaults.problem??=(W)=>`must be ${W.expected}${W.actual?` (was ${W.actual})`:""}`,T.defaults.message??=(W)=>{if(W.path.length===0)return W.problem;let w=`${W.propString} ${W.problem}`;if(w[0]==="[")return`value at ${w}`;return w};return T};class _R extends Error{name="ToJsonSchemaError";code;context;constructor($,T){super(M$(T,{quoteKeys:!1,indent:4}));this.code=$,this.context=T}hasCode($){return this.code===$}}var Yx={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:($)=>w4.throw("arrayObject",$),arrayPostfix:($)=>w4.throw("arrayPostfix",$),defaultValue:($)=>w4.throw("defaultValue",$),domain:($)=>w4.throw("domain",$),morph:($)=>w4.throw("morph",$),patternIntersection:($)=>w4.throw("patternIntersection",$),predicate:($)=>w4.throw("predicate",$),proto:($)=>w4.throw("proto",$),symbolKey:($)=>w4.throw("symbolKey",$),unit:($)=>w4.throw("unit",$),date:($)=>w4.throw("date",$)}},w4={Error:_R,throw:(...$)=>{throw new w4.Error(...$)},throwInternalOperandError:($,T)=>I$(`Unexpected JSON Schema input for ${$}: ${M$(T)}`),defaultConfig:Yx};y.config??={};var IU=($,T)=>{if(!T)return $;let W={...$},w;for(w in T){let X={...$.keywords};if(w==="keywords"){for(let U in T[w]){let Y=T.keywords[U];if(Y===void 0)continue;X[U]=typeof Y==="string"?{description:Y}:Y}W.keywords=X}else if(w==="toJsonSchema")W[w]=oQ($.toJsonSchema,T.toJsonSchema);else if(TX(w))W[w]={...$[w],...T[w]};else W[w]=T[w]}return W},oQ=($,T)=>{if(!$)return T??{};if(!T)return $;let W={...$},w;for(w in T)if(w==="fallback")W.fallback=Gx($.fallback,T.fallback);else W[w]=T[w];return W},Gx=($,T)=>{$=kR($),T=kR(T);let W={},w;for(w in w4.defaultConfig.fallback)W[w]=T[w]??T.default??$[w]??$.default??w4.defaultConfig.fallback[w];return W},kR=($)=>typeof $==="function"?{default:$}:$??{};class bT extends LU{[C6]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:$,relativePath:T,...W},w){super();this.input=W,this.ctx=w,tJ(this,W);let X=w.data;if(W.code==="union")W.errors=W.errors.flatMap((Y)=>{let G=Y.hasCode("union")?Y.errors:[Y];if(!$&&!T)return G;return G.map((H)=>H.transform((z)=>({...z,path:dJ($,z.path,T)})))});this.nodeConfig=w.config[this.code];let U=[...W.path??w.path];if(T)U.push(...T);if($)U.unshift(...$);this.path=new SU(...U),this.data="data"in W?W.data:X}transform($){return new bT($({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode($){return this.code===$}get propString(){return d0(this.path)}get expected(){if(this.input.expected)return this.input.expected;let $=this.meta?.expected??this.nodeConfig.expected;return typeof $==="function"?$(this.input):$}get actual(){if(this.input.actual)return this.input.actual;let $=this.meta?.actual??this.nodeConfig.actual;return typeof $==="function"?$(this.data):$}get problem(){if(this.input.problem)return this.input.problem;let $=this.meta?.problem??this.nodeConfig.problem;return typeof $==="function"?$(this):$}get message(){if(this.input.message)return this.input.message;let $=this.meta?.message??this.nodeConfig.message;return typeof $==="function"?$(this):$}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 o6 extends i9{[C6]="errors";ctx;constructor($){super();this.ctx=$}byPath=Object.create(null);get flatByPath(){return E$(this.byPath,($,T)=>[$,T.flat])}get flatProblemsByPath(){return E$(this.byPath,($,T)=>[$,T.flat.map((W)=>W.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new lQ(this)}add($){if(this.includes($))return;this._add($)}transform($){let T=new o6(this.ctx);for(let W of this)T.add($(W));return T}merge($){for(let T of $){if(this.includes(T))continue;this._add(new bT({...T,path:[...this.ctx.path,...T.path]},this.ctx))}}affectsPath($){if(this.length===0)return!1;return $.stringifyAncestors().some((T)=>(T in this.byPath))||$.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(($)=>$.toJSON())]}toString(){return this.join(`
|
|
125
|
+
`)}_add($){let T=this.byPath[$.propString];if(T){if(T.hasCode("union")&&T.errors.length===0)return;let W=$.hasCode("union")&&$.errors.length===0?$:new bT({code:"intersection",errors:T.hasCode("intersection")?[...T.errors,$]:[T,$]},this.ctx),w=this.indexOf(T);this.mutable[w===-1?this.length:w]=W,this.byPath[$.propString]=W,this.addAncestorPaths($)}else this.byPath[$.propString]=$,this.addAncestorPaths($),this.mutable.push($);this.count++}addAncestorPaths($){for(let T of $.path.stringifyAncestors())this.byAncestorPath[T]=C$(this.byAncestorPath[T],$)}}class lQ extends Error{name="TraversalError";constructor($){if($.length===1)super($.summary);else super(`
|
|
126
|
+
`+$.map((T)=>` \u2022 ${zx(T)}`).join(`
|
|
127
|
+
`));Object.defineProperty(this,"arkErrors",{value:$,enumerable:!1})}}var zx=($)=>$.toString().split(`
|
|
126
128
|
`).join(`
|
|
127
|
-
`);class u1{path=[];errors=new o6(this);root;config;queuedMorphs=[];branches=[];seen={};constructor($,T){this.root=$,this.config=T}get data(){let $=this.root;for(let T of this.path)$=$?.[T];return $}get propString(){return a0(this.path)}reject($){return this.error($),!1}mustBe($){return this.error($),!1}error($){let T=typeof $==="object"?$.code?$:{...$,code:"predicate"}:{code:"predicate",expected:$};return this.errorFromContext(T)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs($){let T={path:new yY(...this.path),morphs:$};if(this.currentBranch)this.currentBranch.queuedMorphs.push(T);else this.queuedMorphs.push(T)}finalize($){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 $?$(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($){return this.errorFromContext($)}errorFromContext($){let T=new uT($,this);if(this.currentBranch)this.currentBranch.error=T;else this.errors.add(T);return T}applyQueuedMorphs(){while(this.queuedMorphs.length){let $=this.queuedMorphs;this.queuedMorphs=[];for(let{path:T,morphs:W}of $){if(this.errors.affectsPath(T))continue;this.applyMorphsAtPath(T,W)}}}applyMorphsAtPath($,T){let W=$.at(-1),U;if(W!==void 0){U=this.root;for(let X=0;X<$.length-1;X++)U=U[$[X]]}this.path=[...$];for(let X of T){let Y=t$(X),w=X(U===void 0?this.root:U[W],this);if(w instanceof uT){this.errors.add(w);break}if(w instanceof o6){if(!Y)this.errors.merge(w);break}if(U===void 0)this.root=w;else U[W]=w;this.applyQueuedMorphs()}}}var l6=($,T,W)=>{if(!W)return T();W.path.push($);let U=T();return W.path.pop(),U};class cY extends c1{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor($,T){super((U,X,Y=this.onFail)=>{if(X)return this.traverseApply(U,X),X.hasError()?X.errors:X.data;return this.rootApply(U,Y)},{attach:$});this.attachments=$,this.$=T,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((U,X)=>xy(U,X.shallowReferences),[this]);let W=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let U=0;U<this.children.length;U++){if(this.includesTransform||=this.children[U].includesTransform,this.includesContextualPredicate||=this.children[U].includesContextualPredicate,this.isCyclic||=this.children[U].isCyclic,!W){let X=this.children[U].flatRefs;for(let Y=0;Y<X.length;Y++){let w=X[Y];if(!this.flatRefs.some((G)=>fR(G,w))){this.flatRefs.push(w);for(let G of w.node.branches)if(G.hasKind("morph")||G.hasKind("intersection")&&G.structure?.structuralMorph!==void 0)this.flatMorphs.push({path:w.path,propString:w.propString,node:G})}}}Object.assign(this.referencesById,this.children[U].referencesById)}this.flatRefs.sort((U,X)=>U.path.length>X.path.length?1:U.path.length<X.path.length?-1:U.propString>X.propString?1:U.propString<X.propString?-1:U.node.expression<X.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((U)=>U.length===1||U.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some((U)=>U.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?(U)=>this.traverseAllows(U,new u1(U,this.$.resolvedConfig)):(U)=>this.traverseAllows(U)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(T,W)=>{if(this.allows(T))return T;let U=new u1(T,this.$.resolvedConfig);return this.traverseApply(T,U),U.finalize(W)};case"contextual":return(T,W)=>{let U=new u1(T,this.$.resolvedConfig);return this.traverseApply(T,U),U.finalize(W)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];let $=this.$.resolvedConfig.clone;return(T,W)=>{if(this.allows(T))return this.contextFreeMorph($&&(typeof T==="object"&&T!==null||typeof T==="function")?$(T):T);let U=new u1(T,this.$.resolvedConfig);return this.traverseApply(T,U),U.finalize(W)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,S$(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=By(this.metaJson);cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=AU(this.kind);precompilation;assert=($,T)=>this($,T,(W)=>W.throw());traverse($,T){return this($,T,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo($){if(!this.includesTransform)return this;let T={};for(let[W,U]of this.innerEntries){let X=this.impl.keys[W];if(X.reduceIo)X.reduceIo($,T,U);else if(X.child){let Y=U;T[W]=d$(Y)?Y.map((w)=>w[$]):Y[$]}else T[W]=U}return this.$.node(this.kind,T)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals($){let T=t$($)?$:this.$.parseDefinition($);return this.innerHash===T.innerHash}ifEquals($){return this.equals($)?this:void 0}hasKind($){return this.kind===$}assertHasKind($){if(this.kind!==$)dW(`${this.kind} node was not of asserted kind ${$}`);return this}hasKindIn(...$){return $.includes(this.kind)}assertHasKindIn(...$){if(!r0($,this.kind))dW(`${this.kind} node was not one of asserted kinds ${$}`);return this}isBasis(){return r0(SR,this.kind)}isConstraint(){return r0(Ez,this.kind)}isStructural(){return r0(VU,this.kind)}isRefinement(){return r0(DZ,this.kind)}isRoot(){return r0(KU,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit($){return this.hasKind("unit")&&this.allows($)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select($){let T=mY.normalize($);return this._select(T)}_select($){let T=mY.applyBoundary[$.boundary??"references"](this);if($.kind)T=T.filter((W)=>W.kind===$.kind);if($.where)T=T.filter($.where);return mY.applyMethod[$.method??"filter"](T,this,$)}transform($,T){return this._transform($,this._createTransformContext(T))}_createTransformContext($){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:$?.prereduced??!1},undeclaredKeyHandling:void 0,...$}}_transform($,T){let W=T.bindScope??this.$;if(T.seen[this.id])return this.$.lazilyResolve(T.seen[this.id]);if(T.shouldTransform?.(this,T)===!1)return this;let U;if(T.seen[this.id]=()=>U,this.hasKind("structure")&&this.undeclared!==T.undeclaredKeyHandling)T={...T,undeclaredKeyHandling:this.undeclared};let X=K$(this.inner,(z,F)=>{if(!this.impl.keys[z].child)return[z,F];let O=F;if(!d$(O)){let Z=O._transform($,T);return Z?[z,Z]:[]}if(O.length===0)return[z,F];let Q=O.flatMap((Z)=>{return Z._transform($,T)??[]});return Q.length?[z,Q]:[]});delete T.seen[this.id];let Y=Object.assign(X,{meta:this.meta}),w=T.selected&&!T.selected.includes(this)?Y:$(this.kind,Y,T);if(w===null)return null;if(t$(w))return U=w;let G=Object.keys(w);if((G.length===0||G.length===1&&G[0]==="meta")&&!O0(this.inner))return null;if((this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in w))return T.undeclaredKeyHandling?{...w,value:b.intrinsic.unknown}:null;if(this.kind==="morph")w.in??=b.intrinsic.unknown;return U=W.node(this.kind,w,T.parseOptions)}configureReferences($,T="references"){let W=mY.normalize(T),U=typeof $==="string"?(G,H)=>({...H,meta:{...H.meta,description:$}}):typeof $==="function"?(G,H)=>({...H,meta:$(H.meta)}):(G,H)=>({...H,meta:{...H.meta,...$}});if(W.boundary==="self")return this.$.node(this.kind,U(this.kind,{...this.inner,meta:this.meta}));let X=this._select(W),Y=X&&yT(X),w=W.boundary==="child"?(G,H)=>H.root.children.includes(G):W.boundary==="shallow"?(G)=>G.kind!=="structure":()=>!0;return this.$.finalize(this.transform(U,{shouldTransform:w,selected:Y}))}}var mY={applyBoundary:{self:($)=>[$],child:($)=>[...$.children],shallow:($)=>[...$.shallowReferences],references:($)=>[...$.references]},applyMethod:{filter:($)=>$,assertFilter:($,T,W)=>{if($.length===0)dW(bR(T,W));return $},find:($)=>$[0],assertFind:($,T,W)=>{if($.length===0)dW(bR(T,W));return $[0]}},normalize:($)=>typeof $==="function"?{boundary:"references",method:"filter",where:$}:typeof $==="string"?I4($,mY.applyBoundary)?{method:"filter",boundary:$}:{boundary:"references",method:"filter",kind:$}:{boundary:"references",method:"filter",...$}},bR=($,T)=>`${$} had no references matching ${E$(T)}.`,Sy=($)=>a0($,{stringifyNonKey:(T)=>T.expression}),jy=/"(\$ark\.[^"]+)"/g,By=($)=>JSON.stringify($).replaceAll(jy,"$1"),p1=($,T)=>({path:$,node:T,propString:Sy($)}),fR=($,T)=>$.propString===T.propString&&$.node.equals(T.node),EZ=($,T)=>F0($,T,{isEqual:fR}),xy=($,T)=>F0($,T,{isEqual:(W,U)=>W.equals(U)});class o extends Array{static init($,T,W,U){return new o({kind:$,l:T,r:W,path:U?.path??[],optional:U?.optional??!1})}add($,T,W,U){return this.push({kind:$,l:T,r:W,path:U?.path??[],optional:U?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:$,l:T,r:W}=this[0],U=a0($);return MZ(`Intersection${U&&` at ${U}`} of ${yR(T,W)}`)}return`The following intersections result in unsatisfiable types:
|
|
128
|
-
\u2022 ${this.map(({path:$,l:T,r:W})=>`${$}: ${
|
|
129
|
-
\u2022 `)}`}throw(){return B(this.describeReasons())}invert(){let $=this.map((T)=>({...T,l:T.r,r:T.l}));if(!($ instanceof o))return new o(...$);return $}withPrefixKey($,T){return this.map((W)=>({...W,path:[$,...W.path],optional:W.optional||T==="optional"}))}toNeverIfDisjoint(){return b.intrinsic.never}}var yR=($,T)=>`${AZ($)} and ${AZ(T)}`,AZ=($)=>t$($)?$.expression:d$($)?$.map(AZ).join(" | ")||"never":String($),MZ=($)=>`${$} results in an unsatisfiable type`;var MU={},r6=($,T,W)=>a$($,T,{$:W,invert:!1,pipe:!1}),uY=($,T,W)=>a$($,T,{$:W,invert:!1,pipe:!0}),a$=($,T,W)=>{let U=W.pipe?"|>":"&",X=`${$.hash}${U}${T.hash}`;if(MU[X]!==void 0)return MU[X];if(!W.pipe){let G=`${T.hash}${U}${$.hash}`;if(MU[G]!==void 0){let H=MU[G],z=H instanceof o?H.invert():H;return MU[X]=z,z}}let Y=!W.pipe||!$.includesTransform&&!T.includesTransform;if(Y&&$.equals(T))return $;let w=Y?NZ($,T,W):$.hasKindIn(...KU)?Iy($,T,W):NZ($,T,W);if(t$(w)){if($.equals(w))w=$;else if(T.equals(w))w=T}return MU[X]=w,w},NZ=($,T,W)=>{let U=$.precedence<T.precedence?$.kind:T.kind,X=$.impl.intersections[T.kind]??T.impl.intersections[$.kind];if(X===void 0)return null;else if(U===$.kind)return X($,T,W);else{let Y=X(T,$,{...W,invert:!W.invert});if(Y instanceof o)Y=Y.invert();return Y}},Iy=($,T,W)=>$.includesTransform||T.includesTransform?W.invert?hR(T,$,W):hR($,T,W):NZ($,T,W),hR=($,T,W)=>$.distribute((U)=>by(U,T,W),(U)=>{let X=U.filter(t$);if(X.length===0)return o.init("union",$.branches,T.branches);if(X.length<$.branches.length||!$.branches.every((G,H)=>G.in.equals(X[H].in)))return W.$.parseSchema(X);let Y;if(X.length===1){let G=X[0];if(!Y)return G;return W.$.node("morph",{...G.inner,in:G.in.configure(Y,"self")})}let w={branches:X};if(Y)w.meta=Y;return W.$.parseSchema(w)}),by=($,T,W)=>{if($.hasKind("morph")){let X=[...$.morphs];if($.lastMorphIfNode){let Y=a$($.lastMorphIfNode,T,W);if(Y instanceof o)return Y;X[X.length-1]=Y}else X.push(T);return W.$.node("morph",{morphs:X,in:$.inner.in})}if(T.hasKind("morph")){let X=a$($,T.in,W);if(X instanceof o)return X;return W.$.node("morph",{morphs:[T],in:X})}return W.$.node("morph",{morphs:[T],in:$})};class v1 extends cY{constructor($,T){super($,T);Object.defineProperty(this,q6,{value:"constraint",enumerable:!1})}impliedSiblings;intersect($){return r6(this,$,this.$)}}class e0 extends v1{traverseApply=($,T)=>{if(!this.traverseAllows($,T))T.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows")$.return(this.compiledCondition);else $.if(this.compiledNegation,()=>$.line(`${$.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return cT(this.errorContext)}}var X6=($)=>(T,W)=>{if(d$(T)){if(T.length===0)return;let X=T.map((Y)=>W.$.node($,Y));if($==="predicate")return X;return X.sort((Y,w)=>Y.hash<w.hash?-1:1)}let U=W.$.node($,T);return U.hasOpenIntersection()?[U]:U},NU=($)=>{let T=$.r.shift();if(!T){let U=$.l.length===0&&$.kind==="structure"?b.intrinsic.unknown.internal:$.ctx.$.node($.kind,Object.assign($.baseInner,fy($.l)),{prereduced:!0});for(let X of $.roots){if(U instanceof o)return U;U=a$(X,U,$.ctx)}return U}let W=!1;for(let U=0;U<$.l.length;U++){let X=a$($.l[U],T,$.ctx);if(X===null)continue;if(X instanceof o)return X;if(!W){if(X.isRoot())return $.roots.push(X),$.l.splice(U),NU($);$.l[U]=X,W=!0}else if(!$.l.includes(X))return S$(`Unexpectedly encountered multiple distinct intersection results for refinement ${X}`)}if(!W)$.l.push(T);if($.kind==="intersection"){if(T.impliedSiblings)for(let U of T.impliedSiblings)F0($.r,U)}return NU($)},LU=($)=>{return Object.entries($).flatMap(([W,U])=>(W in Az)?U:[]).sort((W,U)=>W.precedence<U.precedence?-1:W.precedence>U.precedence?1:W.kind==="predicate"&&U.kind==="predicate"?0:W.hash<U.hash?-1:1)},fy=($)=>{let T={};for(let W of $)if(W.hasOpenIntersection())T[W.kind]=q$(T[W.kind],W);else{if(T[W.kind])return S$(`Unexpected intersection of closed refinements of kind ${W.kind}`);T[W.kind]=W}return T},gR=(...$)=>B(mR(...$)),mR=($,T,W)=>{let U=W.hasKind("morph")?"a morph":W.isUnknown()?"unknown":W.exclude(T).defaultShortDescription;return`${VR($)} operand must be ${T.description} (was ${U})`};var cR=($,T,W)=>new pT($,T,W,W,null);class Nz extends c1{}class pT extends c1{[q6]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor($,T,W,U,X){super((...Y)=>{let w=K$(this.names,(G,H)=>{let z=this.arg$.parse(Y[G]);if(!z.extends(this.constraints[G]))B(yy(H,this.constraints[G].expression,z.expression));return[H,z]});if(this.defIsLazy()){let G=this.bodyDef(w);return this.$.parse(G)}return this.$.parse(T,{args:w})});this.paramDefs=$,this.bodyDef=T,this.$=W,this.arg$=U,this.hkt=X,this.description=X?new X().description??`a generic type for ${X.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof Nz}cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get json(){return this.cacheGetter("json",{params:this.params.map(($)=>$[1].isUnknown()?$[0]:[$[0],$[1].json]),body:vR(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(($)=>typeof $==="string"?[$,b.intrinsic.unknown]:[$[0],this.$.parse($[1])]))}get names(){return this.cacheGetter("names",this.params.map(($)=>$[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(($)=>$[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}var yy=($,T,W)=>`${$} must be assignable to ${T} (was ${W})`;var hy=A$({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:($)=>typeof $==="function"?{predicate:$}:$,defaults:{description:($)=>`valid according to ${$.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class uR extends v1{serializedPredicate=Z4(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=cT(this.errorContext);traverseApply=($,T)=>{if(!this.predicate($,T.external)&&!T.hasError())T.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows"){$.return(this.compiledCondition);return}$.if(`${this.compiledNegation} && !ctx.hasError()`,()=>$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema($,T){return T.fallback.predicate({code:"predicate",base:$,predicate:this.predicate})}}var LZ={implementation:hy,Node:uR};var gy=A$({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:($)=>Number.isInteger($)?$:B(my($))}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>$.rule===1?"an integer":$.rule===2?"even":`a multiple of ${$.rule}`},intersections:{divisor:($,T,W)=>W.$.node("divisor",{rule:Math.abs($.rule*T.rule/cy($.rule,T.rule))})},obviatesBasisDescription:!0});class pR extends e0{traverseAllows=($)=>$%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=b.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema($){if($.type="integer",this.rule===1)return $;return $.multipleOf=this.rule,$}}var JZ={implementation:gy,Node:pR};var my=($)=>`divisor must be an integer (was ${$})`,cy=($,T)=>{let W,U=$,X=T;while(X!==0)W=X,X=U%X,U=W;return U};class Z1 extends e0{boundOperandKind=oy[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=ly(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${uy[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?ry(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator["0"]==="<"?"upper":"lower";isStricterThan($){return(this.limitKind==="upper"?this.numericLimit<$.numericLimit:this.numericLimit>$.numericLimit)||this.numericLimit===$.numericLimit&&this.exclusive===!0&&!$.exclusive}overlapsRange($){if(this.isStricterThan($))return!1;if(this.numericLimit===$.numericLimit&&(this.exclusive||$.exclusive))return!1;return!0}overlapIsUnit($){return this.numericLimit===$.numericLimit&&!this.exclusive&&!$.exclusive}}var uy={"<":">=","<=":">",">":"<=",">=":"<"},py={min:"max",minLength:"maxLength",after:"before"},Lz={parse:($)=>$||void 0},Jz=($)=>(T)=>{if(typeof T==="number")return{rule:T};let{exclusive:W,...U}=T;return W?{...U,rule:$==="minLength"?U.rule+1:U.rule-1}:U},_z=($)=>(T)=>{if(typeof T==="number"||typeof T==="string"||T instanceof Date)return{rule:T};let{exclusive:W,...U}=T;if(!W)return U;let X=typeof U.rule==="number"?U.rule:typeof U.rule==="string"?new Date(U.rule).valueOf():U.rule.valueOf();return W?{...U,rule:$==="after"?X+1:X-1}:U},Rz=($)=>typeof $==="string"||typeof $==="number"?new Date($):$,dy=($,T)=>`${$} bound must be a positive integer (was ${T})`,JU=($)=>(T)=>{if(!Number.isInteger(T)||T<0)B(dy($,T));return T},oy={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},ly=($,T)=>`${I4($,py)?">":"<"}${T?"":"="}`,ry=($)=>typeof $==="string"?$:new Date($).toLocaleString(),dR=($)=>`Bounded expression ${$} must be exactly one of number, string, Array, or Date`;var ny=A$({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Rz,serialize:($)=>$.toISOString()}},normalize:_z("after"),defaults:{description:($)=>`${$.collapsibleLimitString} or later`,actual:nW},intersections:{after:($,T)=>$.isStricterThan(T)?$:T}});class oR extends Z1{impliedBasis=b.intrinsic.Date.internal;collapsibleLimitString=nW(this.rule);traverseAllows=($)=>$>=this.rule;reduceJsonSchema($,T){return T.fallback.date({code:"date",base:$,after:this.rule})}}var _Z={implementation:ny,Node:oR};var iy=A$({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Rz,serialize:($)=>$.toISOString()}},normalize:_z("before"),defaults:{description:($)=>`${$.collapsibleLimitString} or earlier`,actual:nW},intersections:{before:($,T)=>$.isStricterThan(T)?$:T,after:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("unit",{unit:$.rule}):null:o.init("range",$,T)}});class lR extends Z1{collapsibleLimitString=nW(this.rule);traverseAllows=($)=>$<=this.rule;impliedBasis=b.intrinsic.Date.internal;reduceJsonSchema($,T){return T.fallback.date({code:"date",base:$,before:this.rule})}}var RZ={implementation:iy,Node:lR};var ty=A$({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:JU("exactLength")}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>`exactly length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{exactLength:($,T,W)=>o.init("unit",W.$.node("unit",{unit:$.rule}),W.$.node("unit",{unit:T.rule}),{path:["length"]}),minLength:($,T)=>$.rule>=T.rule?$:o.init("range",$,T),maxLength:($,T)=>$.rule<=T.rule?$:o.init("range",$,T)}});class rR extends e0{traverseAllows=($)=>$.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=b.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$.maxLength=this.rule,$;case"array":return $.minItems=this.rule,$.maxItems=this.rule,$;default:return U4.throwInternalOperandError("exactLength",$)}}}var kZ={implementation:ty,Node:rR};var ay=A$({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:Lz},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"negative":"non-positive";return`${$.exclusive?"less than":"at most"} ${$.rule}`}},intersections:{max:($,T)=>$.isStricterThan(T)?$:T,min:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("unit",{unit:$.rule}):null:o.init("range",$,T)},obviatesBasisDescription:!0});class nR extends Z1{impliedBasis=b.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$<this.rule:($)=>$<=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMaximum=this.rule;else $.maximum=this.rule;return $}}var vZ={implementation:ay,Node:nR};var sy=A$({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:JU("maxLength")}},reduce:($,T)=>$.rule===0?T.node("exactLength",$):void 0,normalize:Jz("maxLength"),defaults:{description:($)=>`at most length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{maxLength:($,T)=>$.isStricterThan(T)?$:T,minLength:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("exactLength",{rule:$.rule}):null:o.init("range",$,T)}});class iR extends Z1{impliedBasis=b.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length<=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.maxLength=this.rule,$;case"array":return $.maxItems=this.rule,$;default:return U4.throwInternalOperandError("maxLength",$)}}}var qZ={implementation:sy,Node:iR};var ey=A$({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:Lz},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"positive":"non-negative";return`${$.exclusive?"more than":"at least"} ${$.rule}`}},intersections:{min:($,T)=>$.isStricterThan(T)?$:T},obviatesBasisDescription:!0});class tR extends Z1{impliedBasis=b.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$>this.rule:($)=>$>=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMinimum=this.rule;else $.minimum=this.rule;return $}}var PZ={implementation:ey,Node:tR};var $h=A$({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:JU("minLength")}},reduce:($)=>$.rule===0?b.intrinsic.unknown:void 0,normalize:Jz("minLength"),defaults:{description:($)=>$.rule===1?"non-empty":`at least length ${$.rule}`,actual:($)=>$.length===0?"":`${$.length}`},intersections:{minLength:($,T)=>$.isStricterThan(T)?$:T}});class aR extends Z1{impliedBasis=b.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length>=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$;case"array":return $.minItems=this.rule,$;default:return U4.throwInternalOperandError("minLength",$)}}}var CZ={implementation:$h,Node:aR};var sR={min:PZ.implementation,max:vZ.implementation,minLength:CZ.implementation,maxLength:qZ.implementation,exactLength:kZ.implementation,after:_Z.implementation,before:RZ.implementation},eR={min:PZ.Node,max:vZ.Node,minLength:CZ.Node,maxLength:qZ.Node,exactLength:kZ.Node,after:_Z.Node,before:RZ.Node};var Th=A$({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:($)=>typeof $==="string"?{rule:$}:$ instanceof RegExp?$.flags?{rule:$.source,flags:$.flags}:{rule:$.source}:$,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:($)=>`matched by ${$.rule}`},intersections:{pattern:()=>null}});class $k extends e0{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=b.intrinsic.string.internal;reduceJsonSchema($,T){if($.pattern)return T.fallback.patternIntersection({code:"patternIntersection",base:$,pattern:this.rule});return $.pattern=this.rule,$}}var SZ={implementation:Th,Node:$k};var pY=($,T)=>{let W=Wh($);if(T&&!T.includes(W))return B(`Root of kind ${W} should be one of ${T}`);return W},Wh=($)=>{if(s($,"root"))return $.kind;if(typeof $==="string")return $[0]==="$"?"alias":($ in d6)?"domain":"proto";if(typeof $==="function")return"proto";if(typeof $!=="object"||$===null)return B(Tk($));if("morphs"in $)return"morph";if("branches"in $||d$($))return"union";if("unit"in $)return"unit";if("reference"in $)return"alias";let T=Object.keys($);if(T.length===0||T.some((W)=>(W in Az)))return"intersection";if("proto"in $)return"proto";if("domain"in $)return"domain";return B(Tk($))},Tk=($)=>`${E$($)} is not a valid type schema`,Wk={},Uh=($)=>d$($)?$.map((T)=>T.collapsibleJson):$.collapsibleJson,P6={};b.nodesByRegisteredId=P6;var jZ=($)=>{return Wk[$]??=0,`${$}${++Wk[$]}`},BZ=($)=>{let T=_U[$.kind],W=T.applyConfig?.($.def,$.$.resolvedConfig)??$.def,U={},{meta:X,...Y}=W,w=X===void 0?{}:typeof X==="string"?{description:X}:X,G=TZ(Y).sort(([z],[F])=>EU(z)?EU(F)?AU(z)-AU(F):1:EU(F)?-1:z<F?-1:1).filter(([z,F])=>{if(z.startsWith("meta.")){let O=z.slice(5);return w[O]=F,!1}return!0});for(let z of G){let F=z[0],O=T.keys[F];if(!O)return B(`Key ${F} is not valid on ${$.kind} schema`);let Q=O.parse?O.parse(z[1],$):z[1];if(Q!==Q1&&(Q!==void 0||O.preserveUndefined))U[F]=Q}if(T.reduce&&!$.prereduced){let z=T.reduce(U,$.$);if(z){if(z instanceof o)return z.throw();return Xh(z,w)}}return xZ({id:$.id,kind:$.kind,inner:U,meta:w,$:$.$})},xZ=({id:$,kind:T,inner:W,meta:U,$:X,ignoreCache:Y})=>{let w=_U[T],G=TZ(W),H=[],z={};for(let[J,_]of G){let R=w.keys[J],P=R.serialize??(R.child?Uh:k1);if(z[J]=P(_),R.child===!0){let x=_;if(d$(x))H.push(...x);else H.push(x)}else if(typeof R.child==="function")H.push(...R.child(_))}if(w.finalizeInnerJson)z=w.finalizeInnerJson(z);let F={...z},O={};if(!O0(U))O=K$(U,(J,_)=>[J,J==="examples"?_:k1(_)]),F.meta=kz(O,"description",!0);z=kz(z,w.collapsibleKey,!1);let Q=JSON.stringify({kind:T,...z});F=kz(F,w.collapsibleKey,!1);let Z=kz(F,w.collapsibleKey,!0),V=JSON.stringify({kind:T,...F});if(X.nodesByHash[V]&&!Y)return X.nodesByHash[V];let E={id:$,kind:T,impl:w,inner:W,innerEntries:G,innerJson:z,innerHash:Q,meta:U,metaJson:O,json:F,hash:V,collapsibleJson:Z,children:H};if(T!=="intersection"){for(let J in W)if(J!=="in"&&J!=="out")E[J]=W[J]}let N=new Xk[T](E,X);return X.nodesByHash[V]=N},Uk=($,T)=>{if($.id===T)return $;if(t$(P6[T]))S$(`Unexpected attempt to overwrite node id ${T}`);return xZ({id:T,kind:$.kind,inner:$.inner,meta:$.meta,$:$.$,ignoreCache:!0})},Xh=($,T,W)=>{if(W&&t$(P6[W]))S$(`Unexpected attempt to overwrite node id ${W}`);return xZ({id:W??jZ(T.alias??$.kind),kind:$.kind,inner:$.inner,meta:T,$:$.$})},kz=($,T,W)=>{let U=Object.keys($);if(U.length===1&&U[0]===T){let X=$[T];if(W)return X;if(p6(X,"object")&&(Object.keys(X).length===1||Array.isArray(X)))return X}return $};var dY=($,T,W)=>{if($.key!==T.key)return null;let U=$.key,X=a$($.value,T.value,W),Y=$.required||T.required?"required":"optional";if(X instanceof o)if(Y==="optional")X=b.intrinsic.never.internal;else return X.withPrefixKey($.key,$.required&&T.required?"required":"optional");if(Y==="required")return W.$.node("required",{key:U,value:X});let w=$.hasDefault()?T.hasDefault()?$.default===T.default?$.default:B(IZ($.default,T.default)):$.default:T.hasDefault()?T.default:Q1;return W.$.node("optional",{key:U,value:X,default:w})};class oY extends v1{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=b.intrinsic.object.internal;serializedKey=s0(this.key);compiledKey=typeof this.key==="string"?this.key:this.serializedKey;flatRefs=q$(this.value.flatRefs.map(($)=>p1([this.key,...$.path],$.node)),p1([this.key],this.value));_transform($,T){T.path.push(this.key);let W=super._transform($,T);return T.path.pop(),W}hasDefault(){return"default"in this.inner}traverseAllows=($,T)=>{if(this.key in $)return l6(this.key,()=>this.value.traverseAllows($[this.key],T),T);return this.optional};traverseApply=($,T)=>{if(this.key in $)l6(this.key,()=>this.value.traverseApply($[this.key],T),T);else if(this.hasKind("required"))T.errorFromNodeContext(this.errorContext)};compile($){if($.if(`${this.serializedKey} in data`,()=>$.traverseKey(this.serializedKey,`data${$.prop(this.key)}`,this.value)),this.hasKind("required"))$.else(()=>$.traversalKind==="Apply"?$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):$.return(!1));if($.traversalKind==="Allows")$.return(!0)}}var IZ=($,T)=>`Invalid intersection of default values ${E$($)} & ${E$(T)}`;var Yh=A$({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,T)=>T.$.parseSchema($)},default:{preserveUndefined:!0}},normalize:($)=>$,reduce:($,T)=>{if(T.resolvedConfig.exactOptionalPropertyTypes===!1){if(!$.value.allows(void 0))return T.node("optional",{...$,value:$.value.or(X$.undefined)},{prereduced:!0})}},defaults:{description:($)=>`${$.compiledKey}?: ${$.value.description}`},intersections:{optional:dY}});class Yk extends oY{constructor(...$){super(...$);if("default"in this.inner)rY(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;let{default:$,...T}=this.inner;return this.cacheGetter("outProp",this.$.node("required",T,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${E$(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=Gh(this);defaultValueMorphRef=this.defaultValueMorph&&Z4(this.defaultValueMorph)}var lY={implementation:Yh,Node:Yk},wh={},Gh=($)=>{if(!$.hasDefault())return;let T=`{${$.compiledKey}: ${$.value.id} = ${k1($.default)}}`;return wh[T]??=bZ($.key,$.value,$.default)},bZ=($,T,W)=>{if(typeof W==="function")return T.includesTransform?(X,Y)=>{return l6($,()=>T(X[$]=W(),Y),Y),X}:(X)=>{return X[$]=W(),X};let U=T.includesTransform?T.assert(W):W;return p6(U,"object")?(X,Y)=>{return l6($,()=>T(X[$]=W,Y),Y),X}:(X)=>{return X[$]=U,X}},rY=($,T,W)=>{let U=hT(T);if(p6(T,"object")&&!U)B(zh(W));let X=$.in(U?T():T);if(X instanceof o6){if(W===null)B(`Default ${X.summary}`);let Y=X.transform((w)=>w.transform((G)=>({...G,prefixPath:[W]})));B(`Default for ${Y.summary}`)}return T},zh=($)=>{return`Non-primitive default ${$===null?"":typeof $==="number"?`for value at [${$}] `:`for ${s0($)} `}must be specified as a function like () => ({my: 'object'})`};class q1 extends cY{constructor($,T){super($,T);Object.defineProperty(this,q6,{value:"root",enumerable:!1})}get internal(){return this}get "~standard"(){return{vendor:"arktype",version:1,validate:($)=>{let T=this($);if(T instanceof o6)return T;return{value:T}}}}as(){return this}brand($){if($==="")return B(Hh);return this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute($,T){let W=this.branches.map($);return T?.(W)??W}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema($={}){let T=VZ(this.$.resolvedConfig.toJsonSchema,$);T.useRefs||=this.isCyclic;let W=typeof T.dialect==="string"?{$schema:T.dialect}:{};if(Object.assign(W,this.toJsonSchemaRecurse(T)),T.useRefs)W.$defs=K$(this.references,(U,X)=>X.isRoot()&&!X.alwaysExpandJsonSchema?[X.id,X.toResolvedJsonSchema(T)]:[]);return W}toJsonSchemaRecurse($){if($.useRefs&&!this.alwaysExpandJsonSchema)return{$ref:`#/$defs/${this.id}`};return this.toResolvedJsonSchema($)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema($){let T=this.innerToJsonSchema($);return Object.assign(T,this.metaJson)}intersect($){let T=this.$.parseDefinition($),W=this.rawIntersect(T);if(W instanceof o)return W;return this.$.finalize(W)}rawIntersect($){return r6(this,$,this.$)}toNeverIfDisjoint(){return this}and($){let T=this.intersect($);return T instanceof o?T.throw():T}rawAnd($){let T=this.rawIntersect($);return T instanceof o?T.throw():T}or($){let T=this.$.parseDefinition($);return this.$.finalize(this.rawOr(T))}rawOr($){let T=[...this.branches,...$.branches];return this.$.node("union",T)}map($){return this.$.schema(this.applyStructuralOperation("map",[$]))}pick(...$){return this.$.schema(this.applyStructuralOperation("pick",$))}omit(...$){return this.$.schema(this.applyStructuralOperation("omit",$))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;let $=this.applyStructuralOperation("keyof",[]).reduce((T,W)=>T.intersect(W).toNeverIfDisjoint(),b.intrinsic.unknown.internal);if($.branches.length===0)B(MZ(`keyof ${this.expression}`));return this._keyof=this.$.finalize($)}get props(){if(this.branches.length!==1)return B(Fh(this.expression));return[...this.applyStructuralOperation("props",[])[0]]}merge($){let T=this.$.parseDefinition($);return this.$.schema(T.distribute((W)=>this.applyStructuralOperation("merge",[wk(W)??B(Gk("merge",W.expression))])))}applyStructuralOperation($,T){return this.distribute((W)=>{if(W.equals(b.intrinsic.object)&&$!=="merge")return W;let U=wk(W);if(!U)B(Gk($,W.expression));if($==="keyof")return U.keyof();if($==="get")return U.get(...T);if($==="props")return U.props;let X=$==="required"?"require":$==="partial"?"optionalize":$;return this.$.node("intersection",{...W.inner,structure:U[X](...T)})})}get(...$){if($[0]===void 0)return this;return this.$.schema(this.applyStructuralOperation("get",$))}extract($){let T=this.$.parseDefinition($);return this.$.schema(this.branches.filter((W)=>W.extends(T)))}exclude($){let T=this.$.parseDefinition($);return this.$.schema(this.branches.filter((W)=>!W.extends(T)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps($){return!(this.intersect($)instanceof o)}extends($){let T=this.intersect($);return!(T instanceof o)&&this.equals(T)}ifExtends($){return this.extends($)?this:void 0}subsumes($){return this.$.parseDefinition($).extends(this)}configure($,T="shallow"){return this.configureReferences($,T)}describe($,T="shallow"){return this.configure({description:$},T)}optional(){return[this,"?"]}default($){return rY(this,$,null),[this,"=",$]}from($){return this.assert($)}_pipe(...$){let T=$.reduce((W,U)=>W.rawPipeOnce(U),this);return this.$.finalize(T)}tryPipe(...$){let T=$.reduce((W,U)=>W.rawPipeOnce(s(U,"root")?U:(X,Y)=>{try{return U(X,Y)}catch(w){return Y.error({code:"predicate",predicate:U,actual:`aborted due to error:
|
|
130
|
-
${
|
|
131
|
-
`})}}),this);return this.$.finalize(T)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to($){return this.$.finalize(this.toNode(this.$.parseDefinition($)))}toNode($){let T=
|
|
132
|
-
${$}`,
|
|
129
|
+
`);class g1{path=[];errors=new o6(this);root;config;queuedMorphs=[];branches=[];seen={};constructor($,T){this.root=$,this.config=T}get data(){let $=this.root;for(let T of this.path)$=$?.[T];return $}get propString(){return d0(this.path)}reject($){return this.error($),!1}mustBe($){return this.error($),!1}error($){let T=typeof $==="object"?$.code?$:{...$,code:"predicate"}:{code:"predicate",expected:$};return this.errorFromContext(T)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs($){let T={path:new SU(...this.path),morphs:$};if(this.currentBranch)this.currentBranch.queuedMorphs.push(T);else this.queuedMorphs.push(T)}finalize($){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 $?$(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($){return this.errorFromContext($)}errorFromContext($){let T=new bT($,this);if(this.currentBranch)this.currentBranch.error=T;else this.errors.add(T);return T}applyQueuedMorphs(){while(this.queuedMorphs.length){let $=this.queuedMorphs;this.queuedMorphs=[];for(let{path:T,morphs:W}of $){if(this.errors.affectsPath(T))continue;this.applyMorphsAtPath(T,W)}}}applyMorphsAtPath($,T){let W=$.at(-1),w;if(W!==void 0){w=this.root;for(let X=0;X<$.length-1;X++)w=w[$[X]]}this.path=[...$];for(let X of T){let U=a$(X),Y=X(w===void 0?this.root:w[W],this);if(Y instanceof bT){this.errors.add(Y);break}if(Y instanceof o6){if(!U)this.errors.merge(Y);break}if(w===void 0)this.root=Y;else w[W]=Y;this.applyQueuedMorphs()}}}var l6=($,T,W)=>{if(!W)return T();W.path.push($);let w=T();return W.path.pop(),w};class xU extends h1{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor($,T){super((w,X,U=this.onFail)=>{if(X)return this.traverseApply(w,X),X.hasError()?X.errors:X.data;return this.rootApply(w,U)},{attach:$});this.attachments=$,this.$=T,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((w,X)=>Qx(w,X.shallowReferences),[this]);let W=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let w=0;w<this.children.length;w++){if(this.includesTransform||=this.children[w].includesTransform,this.includesContextualPredicate||=this.children[w].includesContextualPredicate,this.isCyclic||=this.children[w].isCyclic,!W){let X=this.children[w].flatRefs;for(let U=0;U<X.length;U++){let Y=X[U];if(!this.flatRefs.some((G)=>qR(G,Y))){this.flatRefs.push(Y);for(let G of Y.node.branches)if(G.hasKind("morph")||G.hasKind("intersection")&&G.structure?.structuralMorph!==void 0)this.flatMorphs.push({path:Y.path,propString:Y.propString,node:G})}}}Object.assign(this.referencesById,this.children[w].referencesById)}this.flatRefs.sort((w,X)=>w.path.length>X.path.length?1:w.path.length<X.path.length?-1:w.propString>X.propString?1:w.propString<X.propString?-1:w.node.expression<X.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((w)=>w.length===1||w.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some((w)=>w.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?(w)=>this.traverseAllows(w,new g1(w,this.$.resolvedConfig)):(w)=>this.traverseAllows(w)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(T,W)=>{if(this.allows(T))return T;let w=new g1(T,this.$.resolvedConfig);return this.traverseApply(T,w),w.finalize(W)};case"contextual":return(T,W)=>{let w=new g1(T,this.$.resolvedConfig);return this.traverseApply(T,w),w.finalize(W)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];let $=this.$.resolvedConfig.clone;return(T,W)=>{if(this.allows(T))return this.contextFreeMorph($&&(typeof T==="object"&&T!==null||typeof T==="function")?$(T):T);let w=new g1(T,this.$.resolvedConfig);return this.traverseApply(T,w),w.finalize(W)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,I$(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=Ox(this.metaJson);cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=WX(this.kind);precompilation;assert=($,T)=>this($,T,(W)=>W.throw());traverse($,T){return this($,T,null)}get in(){return this.cacheGetter("in",this.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo($){if(!this.includesTransform)return this;let T={};for(let[W,w]of this.innerEntries){let X=this.impl.keys[W];if(X.reduceIo)X.reduceIo($,T,w);else if(X.child){let U=w;T[W]=o$(U)?U.map((Y)=>Y[$]):U[$]}else T[W]=w}return this.$.node(this.kind,T)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals($){let T=a$($)?$:this.$.parseDefinition($);return this.innerHash===T.innerHash}ifEquals($){return this.equals($)?this:void 0}hasKind($){return this.kind===$}assertHasKind($){if(this.kind!==$)jW(`${this.kind} node was not of asserted kind ${$}`);return this}hasKindIn(...$){return $.includes(this.kind)}assertHasKindIn(...$){if(!m0($,this.kind))jW(`${this.kind} node was not one of asserted kinds ${$}`);return this}isBasis(){return m0(LR,this.kind)}isConstraint(){return m0($z,this.kind)}isStructural(){return m0(e2,this.kind)}isRefinement(){return m0(dQ,this.kind)}isRoot(){return m0($X,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit($){return this.hasKind("unit")&&this.allows($)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select($){let T=BU.normalize($);return this._select(T)}_select($){let T=BU.applyBoundary[$.boundary??"references"](this);if($.kind)T=T.filter((W)=>W.kind===$.kind);if($.where)T=T.filter($.where);return BU.applyMethod[$.method??"filter"](T,this,$)}transform($,T){return this._transform($,this._createTransformContext(T))}_createTransformContext($){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:$?.prereduced??!1},undeclaredKeyHandling:void 0,...$}}_transform($,T){let W=T.bindScope??this.$;if(T.seen[this.id])return this.$.lazilyResolve(T.seen[this.id]);if(T.shouldTransform?.(this,T)===!1)return this;let w;if(T.seen[this.id]=()=>w,this.hasKind("structure")&&this.undeclared!==T.undeclaredKeyHandling)T={...T,undeclaredKeyHandling:this.undeclared};let X=E$(this.inner,(z,F)=>{if(!this.impl.keys[z].child)return[z,F];let O=F;if(!o$(O)){let Z=O._transform($,T);return Z?[z,Z]:[]}if(O.length===0)return[z,F];let Q=O.flatMap((Z)=>{return Z._transform($,T)??[]});return Q.length?[z,Q]:[]});delete T.seen[this.id];let U=Object.assign(X,{meta:this.meta}),Y=T.selected&&!T.selected.includes(this)?U:$(this.kind,U,T);if(Y===null)return null;if(a$(Y))return w=Y;let G=Object.keys(Y);if((G.length===0||G.length===1&&G[0]==="meta")&&!H0(this.inner))return null;if((this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in Y))return T.undeclaredKeyHandling?{...Y,value:y.intrinsic.unknown}:null;if(this.kind==="morph")Y.in??=y.intrinsic.unknown;return w=W.node(this.kind,Y,T.parseOptions)}configureReferences($,T="references"){let W=BU.normalize(T),w=typeof $==="string"?(G,H)=>({...H,meta:{...H.meta,description:$}}):typeof $==="function"?(G,H)=>({...H,meta:$(H.meta)}):(G,H)=>({...H,meta:{...H.meta,...$}});if(W.boundary==="self")return this.$.node(this.kind,w(this.kind,{...this.inner,meta:this.meta}));let X=this._select(W),U=X&&jT(X),Y=W.boundary==="child"?(G,H)=>H.root.children.includes(G):W.boundary==="shallow"?(G)=>G.kind!=="structure":()=>!0;return this.$.finalize(this.transform(w,{shouldTransform:Y,selected:U}))}}var BU={applyBoundary:{self:($)=>[$],child:($)=>[...$.children],shallow:($)=>[...$.shallowReferences],references:($)=>[...$.references]},applyMethod:{filter:($)=>$,assertFilter:($,T,W)=>{if($.length===0)jW(vR(T,W));return $},find:($)=>$[0],assertFind:($,T,W)=>{if($.length===0)jW(vR(T,W));return $[0]}},normalize:($)=>typeof $==="function"?{boundary:"references",method:"filter",where:$}:typeof $==="string"?b4($,BU.applyBoundary)?{method:"filter",boundary:$}:{boundary:"references",method:"filter",kind:$}:{boundary:"references",method:"filter",...$}},vR=($,T)=>`${$} had no references matching ${M$(T)}.`,Hx=($)=>d0($,{stringifyNonKey:(T)=>T.expression}),Fx=/"(\$ark\.[^"]+)"/g,Ox=($)=>JSON.stringify($).replaceAll(Fx,"$1"),m1=($,T)=>({path:$,node:T,propString:Hx($)}),qR=($,T)=>$.propString===T.propString&&$.node.equals(T.node),rQ=($,T)=>z0($,T,{isEqual:qR}),Qx=($,T)=>z0($,T,{isEqual:(W,w)=>W.equals(w)});class r extends Array{static init($,T,W,w){return new r({kind:$,l:T,r:W,path:w?.path??[],optional:w?.optional??!1})}add($,T,W,w){return this.push({kind:$,l:T,r:W,path:w?.path??[],optional:w?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){let{path:$,l:T,r:W}=this[0],w=d0($);return iQ(`Intersection${w&&` at ${w}`} of ${PR(T,W)}`)}return`The following intersections result in unsatisfiable types:
|
|
130
|
+
\u2022 ${this.map(({path:$,l:T,r:W})=>`${$}: ${PR(T,W)}`).join(`
|
|
131
|
+
\u2022 `)}`}throw(){return B(this.describeReasons())}invert(){let $=this.map((T)=>({...T,l:T.r,r:T.l}));if(!($ instanceof r))return new r(...$);return $}withPrefixKey($,T){return this.map((W)=>({...W,path:[$,...W.path],optional:W.optional||T==="optional"}))}toNeverIfDisjoint(){return y.intrinsic.never}}var PR=($,T)=>`${nQ($)} and ${nQ(T)}`,nQ=($)=>a$($)?$.expression:o$($)?$.map(nQ).join(" | ")||"never":String($),iQ=($)=>`${$} results in an unsatisfiable type`;var XX={},r6=($,T,W)=>s$($,T,{$:W,invert:!1,pipe:!1}),fU=($,T,W)=>s$($,T,{$:W,invert:!1,pipe:!0}),s$=($,T,W)=>{let w=W.pipe?"|>":"&",X=`${$.hash}${w}${T.hash}`;if(XX[X]!==void 0)return XX[X];if(!W.pipe){let G=`${T.hash}${w}${$.hash}`;if(XX[G]!==void 0){let H=XX[G],z=H instanceof r?H.invert():H;return XX[X]=z,z}}let U=!W.pipe||!$.includesTransform&&!T.includesTransform;if(U&&$.equals(T))return $;let Y=U?tQ($,T,W):$.hasKindIn(...$X)?Zx($,T,W):tQ($,T,W);if(a$(Y)){if($.equals(Y))Y=$;else if(T.equals(Y))Y=T}return XX[X]=Y,Y},tQ=($,T,W)=>{let w=$.precedence<T.precedence?$.kind:T.kind,X=$.impl.intersections[T.kind]??T.impl.intersections[$.kind];if(X===void 0)return null;else if(w===$.kind)return X($,T,W);else{let U=X(T,$,{...W,invert:!W.invert});if(U instanceof r)U=U.invert();return U}},Zx=($,T,W)=>$.includesTransform||T.includesTransform?W.invert?CR(T,$,W):CR($,T,W):tQ($,T,W),CR=($,T,W)=>$.distribute((w)=>Vx(w,T,W),(w)=>{let X=w.filter(a$);if(X.length===0)return r.init("union",$.branches,T.branches);if(X.length<$.branches.length||!$.branches.every((G,H)=>G.in.equals(X[H].in)))return W.$.parseSchema(X);let U;if(X.length===1){let G=X[0];if(!U)return G;return W.$.node("morph",{...G.inner,in:G.in.configure(U,"self")})}let Y={branches:X};if(U)Y.meta=U;return W.$.parseSchema(Y)}),Vx=($,T,W)=>{if($.hasKind("morph")){let X=[...$.morphs];if($.lastMorphIfNode){let U=s$($.lastMorphIfNode,T,W);if(U instanceof r)return U;X[X.length-1]=U}else X.push(T);return W.$.node("morph",{morphs:X,in:$.inner.in})}if(T.hasKind("morph")){let X=s$($,T.in,W);if(X instanceof r)return X;return W.$.node("morph",{morphs:[T],in:X})}return W.$.node("morph",{morphs:[T],in:$})};class _1 extends xU{constructor($,T){super($,T);Object.defineProperty(this,C6,{value:"constraint",enumerable:!1})}impliedSiblings;intersect($){return r6(this,$,this.$)}}class l0 extends _1{traverseApply=($,T)=>{if(!this.traverseAllows($,T))T.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows")$.return(this.compiledCondition);else $.if(this.compiledNegation,()=>$.line(`${$.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return fT(this.errorContext)}}var U6=($)=>(T,W)=>{if(o$(T)){if(T.length===0)return;let X=T.map((U)=>W.$.node($,U));if($==="predicate")return X;return X.sort((U,Y)=>U.hash<Y.hash?-1:1)}let w=W.$.node($,T);return w.hasOpenIntersection()?[w]:w},wX=($)=>{let T=$.r.shift();if(!T){let w=$.l.length===0&&$.kind==="structure"?y.intrinsic.unknown.internal:$.ctx.$.node($.kind,Object.assign($.baseInner,Kx($.l)),{prereduced:!0});for(let X of $.roots){if(w instanceof r)return w;w=s$(X,w,$.ctx)}return w}let W=!1;for(let w=0;w<$.l.length;w++){let X=s$($.l[w],T,$.ctx);if(X===null)continue;if(X instanceof r)return X;if(!W){if(X.isRoot())return $.roots.push(X),$.l.splice(w),wX($);$.l[w]=X,W=!0}else if(!$.l.includes(X))return I$(`Unexpectedly encountered multiple distinct intersection results for refinement ${X}`)}if(!W)$.l.push(T);if($.kind==="intersection"){if(T.impliedSiblings)for(let w of T.impliedSiblings)z0($.r,w)}return wX($)},UX=($)=>{return Object.entries($).flatMap(([W,w])=>(W in Tz)?w:[]).sort((W,w)=>W.precedence<w.precedence?-1:W.precedence>w.precedence?1:W.kind==="predicate"&&w.kind==="predicate"?0:W.hash<w.hash?-1:1)},Kx=($)=>{let T={};for(let W of $)if(W.hasOpenIntersection())T[W.kind]=C$(T[W.kind],W);else{if(T[W.kind])return I$(`Unexpected intersection of closed refinements of kind ${W.kind}`);T[W.kind]=W}return T},SR=(...$)=>B(jR(...$)),jR=($,T,W)=>{let w=W.hasKind("morph")?"a morph":W.isUnknown()?"unknown":W.exclude(T).defaultShortDescription;return`${YR($)} operand must be ${T.description} (was ${w})`};var IR=($,T,W)=>new yT($,T,W,W,null);class Xz extends h1{}class yT extends h1{[C6]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor($,T,W,w,X){super((...U)=>{let Y=E$(this.names,(G,H)=>{let z=this.arg$.parse(U[G]);if(!z.extends(this.constraints[G]))B(Ax(H,this.constraints[G].expression,z.expression));return[H,z]});if(this.defIsLazy()){let G=this.bodyDef(Y);return this.$.parse(G)}return this.$.parse(T,{args:Y})});this.paramDefs=$,this.bodyDef=T,this.$=W,this.arg$=w,this.hkt=X,this.description=X?new X().description??`a generic type for ${X.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof Xz}cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get json(){return this.cacheGetter("json",{params:this.params.map(($)=>$[1].isUnknown()?$[0]:[$[0],$[1].json]),body:ER(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(($)=>typeof $==="string"?[$,y.intrinsic.unknown]:[$[0],this.$.parse($[1])]))}get names(){return this.cacheGetter("names",this.params.map(($)=>$[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(($)=>$[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}var Ax=($,T,W)=>`${$} must be assignable to ${T} (was ${W})`;var Ex=D$({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:($)=>typeof $==="function"?{predicate:$}:$,defaults:{description:($)=>`valid according to ${$.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class BR extends _1{serializedPredicate=Z4(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=fT(this.errorContext);traverseApply=($,T)=>{if(!this.predicate($,T.external)&&!T.hasError())T.errorFromNodeContext(this.errorContext)};compile($){if($.traversalKind==="Allows"){$.return(this.compiledCondition);return}$.if(`${this.compiledNegation} && !ctx.hasError()`,()=>$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema($,T){return T.fallback.predicate({code:"predicate",base:$,predicate:this.predicate})}}var aQ={implementation:Ex,Node:BR};var Mx=D$({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:($)=>Number.isInteger($)?$:B(Dx($))}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>$.rule===1?"an integer":$.rule===2?"even":`a multiple of ${$.rule}`},intersections:{divisor:($,T,W)=>W.$.node("divisor",{rule:Math.abs($.rule*T.rule/Nx($.rule,T.rule))})},obviatesBasisDescription:!0});class xR extends l0{traverseAllows=($)=>$%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=y.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema($){if($.type="integer",this.rule===1)return $;return $.multipleOf=this.rule,$}}var sQ={implementation:Mx,Node:xR};var Dx=($)=>`divisor must be an integer (was ${$})`,Nx=($,T)=>{let W,w=$,X=T;while(X!==0)W=X,X=w%X,w=W;return w};class Z1 extends l0{boundOperandKind=_x[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=kx(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${Lx[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?vx(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator["0"]==="<"?"upper":"lower";isStricterThan($){return(this.limitKind==="upper"?this.numericLimit<$.numericLimit:this.numericLimit>$.numericLimit)||this.numericLimit===$.numericLimit&&this.exclusive===!0&&!$.exclusive}overlapsRange($){if(this.isStricterThan($))return!1;if(this.numericLimit===$.numericLimit&&(this.exclusive||$.exclusive))return!1;return!0}overlapIsUnit($){return this.numericLimit===$.numericLimit&&!this.exclusive&&!$.exclusive}}var Lx={"<":">=","<=":">",">":"<=",">=":"<"},Jx={min:"max",minLength:"maxLength",after:"before"},wz={parse:($)=>$||void 0},Uz=($)=>(T)=>{if(typeof T==="number")return{rule:T};let{exclusive:W,...w}=T;return W?{...w,rule:$==="minLength"?w.rule+1:w.rule-1}:w},Yz=($)=>(T)=>{if(typeof T==="number"||typeof T==="string"||T instanceof Date)return{rule:T};let{exclusive:W,...w}=T;if(!W)return w;let X=typeof w.rule==="number"?w.rule:typeof w.rule==="string"?new Date(w.rule).valueOf():w.rule.valueOf();return W?{...w,rule:$==="after"?X+1:X-1}:w},Gz=($)=>typeof $==="string"||typeof $==="number"?new Date($):$,Rx=($,T)=>`${$} bound must be a positive integer (was ${T})`,YX=($)=>(T)=>{if(!Number.isInteger(T)||T<0)B(Rx($,T));return T},_x={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},kx=($,T)=>`${b4($,Jx)?">":"<"}${T?"":"="}`,vx=($)=>typeof $==="string"?$:new Date($).toLocaleString(),fR=($)=>`Bounded expression ${$} must be exactly one of number, string, Array, or Date`;var qx=D$({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Gz,serialize:($)=>$.toISOString()}},normalize:Yz("after"),defaults:{description:($)=>`${$.collapsibleLimitString} or later`,actual:fW},intersections:{after:($,T)=>$.isStricterThan(T)?$:T}});class bR extends Z1{impliedBasis=y.intrinsic.Date.internal;collapsibleLimitString=fW(this.rule);traverseAllows=($)=>$>=this.rule;reduceJsonSchema($,T){return T.fallback.date({code:"date",base:$,after:this.rule})}}var eQ={implementation:qx,Node:bR};var Px=D$({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Gz,serialize:($)=>$.toISOString()}},normalize:Yz("before"),defaults:{description:($)=>`${$.collapsibleLimitString} or earlier`,actual:fW},intersections:{before:($,T)=>$.isStricterThan(T)?$:T,after:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("unit",{unit:$.rule}):null:r.init("range",$,T)}});class yR extends Z1{collapsibleLimitString=fW(this.rule);traverseAllows=($)=>$<=this.rule;impliedBasis=y.intrinsic.Date.internal;reduceJsonSchema($,T){return T.fallback.date({code:"date",base:$,before:this.rule})}}var $Z={implementation:Px,Node:yR};var Cx=D$({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:YX("exactLength")}},normalize:($)=>typeof $==="number"?{rule:$}:$,hasAssociatedError:!0,defaults:{description:($)=>`exactly length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{exactLength:($,T,W)=>r.init("unit",W.$.node("unit",{unit:$.rule}),W.$.node("unit",{unit:T.rule}),{path:["length"]}),minLength:($,T)=>$.rule>=T.rule?$:r.init("range",$,T),maxLength:($,T)=>$.rule<=T.rule?$:r.init("range",$,T)}});class hR extends l0{traverseAllows=($)=>$.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=y.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$.maxLength=this.rule,$;case"array":return $.minItems=this.rule,$.maxItems=this.rule,$;default:return w4.throwInternalOperandError("exactLength",$)}}}var TZ={implementation:Cx,Node:hR};var Sx=D$({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:wz},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"negative":"non-positive";return`${$.exclusive?"less than":"at most"} ${$.rule}`}},intersections:{max:($,T)=>$.isStricterThan(T)?$:T,min:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("unit",{unit:$.rule}):null:r.init("range",$,T)},obviatesBasisDescription:!0});class gR extends Z1{impliedBasis=y.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$<this.rule:($)=>$<=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMaximum=this.rule;else $.maximum=this.rule;return $}}var WZ={implementation:Sx,Node:gR};var jx=D$({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:YX("maxLength")}},reduce:($,T)=>$.rule===0?T.node("exactLength",$):void 0,normalize:Uz("maxLength"),defaults:{description:($)=>`at most length ${$.rule}`,actual:($)=>`${$.length}`},intersections:{maxLength:($,T)=>$.isStricterThan(T)?$:T,minLength:($,T,W)=>$.overlapsRange(T)?$.overlapIsUnit(T)?W.$.node("exactLength",{rule:$.rule}):null:r.init("range",$,T)}});class mR extends Z1{impliedBasis=y.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length<=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.maxLength=this.rule,$;case"array":return $.maxItems=this.rule,$;default:return w4.throwInternalOperandError("maxLength",$)}}}var XZ={implementation:jx,Node:mR};var Ix=D$({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:wz},normalize:($)=>typeof $==="number"?{rule:$}:$,defaults:{description:($)=>{if($.rule===0)return $.exclusive?"positive":"non-negative";return`${$.exclusive?"more than":"at least"} ${$.rule}`}},intersections:{min:($,T)=>$.isStricterThan(T)?$:T},obviatesBasisDescription:!0});class cR extends Z1{impliedBasis=y.intrinsic.number.internal;traverseAllows=this.exclusive?($)=>$>this.rule:($)=>$>=this.rule;reduceJsonSchema($){if(this.exclusive)$.exclusiveMinimum=this.rule;else $.minimum=this.rule;return $}}var wZ={implementation:Ix,Node:cR};var Bx=D$({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:YX("minLength")}},reduce:($)=>$.rule===0?y.intrinsic.unknown:void 0,normalize:Uz("minLength"),defaults:{description:($)=>$.rule===1?"non-empty":`at least length ${$.rule}`,actual:($)=>$.length===0?"":`${$.length}`},intersections:{minLength:($,T)=>$.isStricterThan(T)?$:T}});class uR extends Z1{impliedBasis=y.intrinsic.lengthBoundable.internal;traverseAllows=($)=>$.length>=this.rule;reduceJsonSchema($){switch($.type){case"string":return $.minLength=this.rule,$;case"array":return $.minItems=this.rule,$;default:return w4.throwInternalOperandError("minLength",$)}}}var UZ={implementation:Bx,Node:uR};var pR={min:wZ.implementation,max:WZ.implementation,minLength:UZ.implementation,maxLength:XZ.implementation,exactLength:TZ.implementation,after:eQ.implementation,before:$Z.implementation},dR={min:wZ.Node,max:WZ.Node,minLength:UZ.Node,maxLength:XZ.Node,exactLength:TZ.Node,after:eQ.Node,before:$Z.Node};var xx=D$({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:($)=>typeof $==="string"?{rule:$}:$ instanceof RegExp?$.flags?{rule:$.source,flags:$.flags}:{rule:$.source}:$,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:($)=>`matched by ${$.rule}`},intersections:{pattern:()=>null}});class oR extends l0{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=y.intrinsic.string.internal;reduceJsonSchema($,T){if($.pattern)return T.fallback.patternIntersection({code:"patternIntersection",base:$,pattern:this.rule});return $.pattern=this.rule,$}}var YZ={implementation:xx,Node:oR};var bU=($,T)=>{let W=fx($);if(T&&!T.includes(W))return B(`Root of kind ${W} should be one of ${T}`);return W},fx=($)=>{if(W$($,"root"))return $.kind;if(typeof $==="string")return $[0]==="$"?"alias":($ in d6)?"domain":"proto";if(typeof $==="function")return"proto";if(typeof $!=="object"||$===null)return B(lR($));if("morphs"in $)return"morph";if("branches"in $||o$($))return"union";if("unit"in $)return"unit";if("reference"in $)return"alias";let T=Object.keys($);if(T.length===0||T.some((W)=>(W in Tz)))return"intersection";if("proto"in $)return"proto";if("domain"in $)return"domain";return B(lR($))},lR=($)=>`${M$($)} is not a valid type schema`,rR={},bx=($)=>o$($)?$.map((T)=>T.collapsibleJson):$.collapsibleJson,S6={};y.nodesByRegisteredId=S6;var GZ=($)=>{return rR[$]??=0,`${$}${++rR[$]}`},zZ=($)=>{let T=GX[$.kind],W=T.applyConfig?.($.def,$.$.resolvedConfig)??$.def,w={},{meta:X,...U}=W,Y=X===void 0?{}:typeof X==="string"?{description:X}:X,G=jQ(U).sort(([z],[F])=>TX(z)?TX(F)?WX(z)-WX(F):1:TX(F)?-1:z<F?-1:1).filter(([z,F])=>{if(z.startsWith("meta.")){let O=z.slice(5);return Y[O]=F,!1}return!0});for(let z of G){let F=z[0],O=T.keys[F];if(!O)return B(`Key ${F} is not valid on ${$.kind} schema`);let Q=O.parse?O.parse(z[1],$):z[1];if(Q!==Q1&&(Q!==void 0||O.preserveUndefined))w[F]=Q}if(T.reduce&&!$.prereduced){let z=T.reduce(w,$.$);if(z){if(z instanceof r)return z.throw();return yx(z,Y)}}return HZ({id:$.id,kind:$.kind,inner:w,meta:Y,$:$.$})},HZ=({id:$,kind:T,inner:W,meta:w,$:X,ignoreCache:U})=>{let Y=GX[T],G=jQ(W),H=[],z={};for(let[L,R]of G){let _=Y.keys[L],S=_.serialize??(_.child?bx:R1);if(z[L]=S(R),_.child===!0){let x=R;if(o$(x))H.push(...x);else H.push(x)}else if(typeof _.child==="function")H.push(..._.child(R))}if(Y.finalizeInnerJson)z=Y.finalizeInnerJson(z);let F={...z},O={};if(!H0(w))O=E$(w,(L,R)=>[L,L==="examples"?R:R1(R)]),F.meta=zz(O,"description",!0);z=zz(z,Y.collapsibleKey,!1);let Q=JSON.stringify({kind:T,...z});F=zz(F,Y.collapsibleKey,!1);let Z=zz(F,Y.collapsibleKey,!0),K=JSON.stringify({kind:T,...F});if(X.nodesByHash[K]&&!U)return X.nodesByHash[K];let E={id:$,kind:T,impl:Y,inner:W,innerEntries:G,innerJson:z,innerHash:Q,meta:w,metaJson:O,json:F,hash:K,collapsibleJson:Z,children:H};if(T!=="intersection"){for(let L in W)if(L!=="in"&&L!=="out")E[L]=W[L]}let M=new iR[T](E,X);return X.nodesByHash[K]=M},nR=($,T)=>{if($.id===T)return $;if(a$(S6[T]))I$(`Unexpected attempt to overwrite node id ${T}`);return HZ({id:T,kind:$.kind,inner:$.inner,meta:$.meta,$:$.$,ignoreCache:!0})},yx=($,T,W)=>{if(W&&a$(S6[W]))I$(`Unexpected attempt to overwrite node id ${W}`);return HZ({id:W??GZ(T.alias??$.kind),kind:$.kind,inner:$.inner,meta:T,$:$.$})},zz=($,T,W)=>{let w=Object.keys($);if(w.length===1&&w[0]===T){let X=$[T];if(W)return X;if(p6(X,"object")&&(Object.keys(X).length===1||Array.isArray(X)))return X}return $};var yU=($,T,W)=>{if($.key!==T.key)return null;let w=$.key,X=s$($.value,T.value,W),U=$.required||T.required?"required":"optional";if(X instanceof r)if(U==="optional")X=y.intrinsic.never.internal;else return X.withPrefixKey($.key,$.required&&T.required?"required":"optional");if(U==="required")return W.$.node("required",{key:w,value:X});let Y=$.hasDefault()?T.hasDefault()?$.default===T.default?$.default:B(FZ($.default,T.default)):$.default:T.hasDefault()?T.default:Q1;return W.$.node("optional",{key:w,value:X,default:Y})};class hU extends _1{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=y.intrinsic.object.internal;serializedKey=o0(this.key);compiledKey=typeof this.key==="string"?this.key:this.serializedKey;flatRefs=C$(this.value.flatRefs.map(($)=>m1([this.key,...$.path],$.node)),m1([this.key],this.value));_transform($,T){T.path.push(this.key);let W=super._transform($,T);return T.path.pop(),W}hasDefault(){return"default"in this.inner}traverseAllows=($,T)=>{if(this.key in $)return l6(this.key,()=>this.value.traverseAllows($[this.key],T),T);return this.optional};traverseApply=($,T)=>{if(this.key in $)l6(this.key,()=>this.value.traverseApply($[this.key],T),T);else if(this.hasKind("required"))T.errorFromNodeContext(this.errorContext)};compile($){if($.if(`${this.serializedKey} in data`,()=>$.traverseKey(this.serializedKey,`data${$.prop(this.key)}`,this.value)),this.hasKind("required"))$.else(()=>$.traversalKind==="Apply"?$.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):$.return(!1));if($.traversalKind==="Allows")$.return(!0)}}var FZ=($,T)=>`Invalid intersection of default values ${M$($)} & ${M$(T)}`;var hx=D$({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,T)=>T.$.parseSchema($)},default:{preserveUndefined:!0}},normalize:($)=>$,reduce:($,T)=>{if(T.resolvedConfig.exactOptionalPropertyTypes===!1){if(!$.value.allows(void 0))return T.node("optional",{...$,value:$.value.or(G$.undefined)},{prereduced:!0})}},defaults:{description:($)=>`${$.compiledKey}?: ${$.value.description}`},intersections:{optional:yU}});class tR extends hU{constructor(...$){super(...$);if("default"in this.inner)mU(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;let{default:$,...T}=this.inner;return this.cacheGetter("outProp",this.$.node("required",T,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${M$(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=mx(this);defaultValueMorphRef=this.defaultValueMorph&&Z4(this.defaultValueMorph)}var gU={implementation:hx,Node:tR},gx={},mx=($)=>{if(!$.hasDefault())return;let T=`{${$.compiledKey}: ${$.value.id} = ${R1($.default)}}`;return gx[T]??=OZ($.key,$.value,$.default)},OZ=($,T,W)=>{if(typeof W==="function")return T.includesTransform?(X,U)=>{return l6($,()=>T(X[$]=W(),U),U),X}:(X)=>{return X[$]=W(),X};let w=T.includesTransform?T.assert(W):W;return p6(w,"object")?(X,U)=>{return l6($,()=>T(X[$]=W,U),U),X}:(X)=>{return X[$]=w,X}},mU=($,T,W)=>{let w=IT(T);if(p6(T,"object")&&!w)B(cx(W));let X=$.in(w?T():T);if(X instanceof o6){if(W===null)B(`Default ${X.summary}`);let U=X.transform((Y)=>Y.transform((G)=>({...G,prefixPath:[W]})));B(`Default for ${U.summary}`)}return T},cx=($)=>{return`Non-primitive default ${$===null?"":typeof $==="number"?`for value at [${$}] `:`for ${o0($)} `}must be specified as a function like () => ({my: 'object'})`};class k1 extends xU{constructor($,T){super($,T);Object.defineProperty(this,C6,{value:"root",enumerable:!1})}get internal(){return this}get "~standard"(){return{vendor:"arktype",version:1,validate:($)=>{let T=this($);if(T instanceof o6)return T;return{value:T}}}}as(){return this}brand($){if($==="")return B(ux);return this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute($,T){let W=this.branches.map($);return T?.(W)??W}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema($={}){let T=oQ(this.$.resolvedConfig.toJsonSchema,$);T.useRefs||=this.isCyclic;let W=typeof T.dialect==="string"?{$schema:T.dialect}:{};if(Object.assign(W,this.toJsonSchemaRecurse(T)),T.useRefs)W.$defs=E$(this.references,(w,X)=>X.isRoot()&&!X.alwaysExpandJsonSchema?[X.id,X.toResolvedJsonSchema(T)]:[]);return W}toJsonSchemaRecurse($){if($.useRefs&&!this.alwaysExpandJsonSchema)return{$ref:`#/$defs/${this.id}`};return this.toResolvedJsonSchema($)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema($){let T=this.innerToJsonSchema($);return Object.assign(T,this.metaJson)}intersect($){let T=this.$.parseDefinition($),W=this.rawIntersect(T);if(W instanceof r)return W;return this.$.finalize(W)}rawIntersect($){return r6(this,$,this.$)}toNeverIfDisjoint(){return this}and($){let T=this.intersect($);return T instanceof r?T.throw():T}rawAnd($){let T=this.rawIntersect($);return T instanceof r?T.throw():T}or($){let T=this.$.parseDefinition($);return this.$.finalize(this.rawOr(T))}rawOr($){let T=[...this.branches,...$.branches];return this.$.node("union",T)}map($){return this.$.schema(this.applyStructuralOperation("map",[$]))}pick(...$){return this.$.schema(this.applyStructuralOperation("pick",$))}omit(...$){return this.$.schema(this.applyStructuralOperation("omit",$))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;let $=this.applyStructuralOperation("keyof",[]).reduce((T,W)=>T.intersect(W).toNeverIfDisjoint(),y.intrinsic.unknown.internal);if($.branches.length===0)B(iQ(`keyof ${this.expression}`));return this._keyof=this.$.finalize($)}get props(){if(this.branches.length!==1)return B(px(this.expression));return[...this.applyStructuralOperation("props",[])[0]]}merge($){let T=this.$.parseDefinition($);return this.$.schema(T.distribute((W)=>this.applyStructuralOperation("merge",[aR(W)??B(sR("merge",W.expression))])))}applyStructuralOperation($,T){return this.distribute((W)=>{if(W.equals(y.intrinsic.object)&&$!=="merge")return W;let w=aR(W);if(!w)B(sR($,W.expression));if($==="keyof")return w.keyof();if($==="get")return w.get(...T);if($==="props")return w.props;let X=$==="required"?"require":$==="partial"?"optionalize":$;return this.$.node("intersection",{...W.inner,structure:w[X](...T)})})}get(...$){if($[0]===void 0)return this;return this.$.schema(this.applyStructuralOperation("get",$))}extract($){let T=this.$.parseDefinition($);return this.$.schema(this.branches.filter((W)=>W.extends(T)))}exclude($){let T=this.$.parseDefinition($);return this.$.schema(this.branches.filter((W)=>!W.extends(T)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps($){return!(this.intersect($)instanceof r)}extends($){let T=this.intersect($);return!(T instanceof r)&&this.equals(T)}ifExtends($){return this.extends($)?this:void 0}subsumes($){return this.$.parseDefinition($).extends(this)}configure($,T="shallow"){return this.configureReferences($,T)}describe($,T="shallow"){return this.configure({description:$},T)}optional(){return[this,"?"]}default($){return mU(this,$,null),[this,"=",$]}from($){return this.assert($)}_pipe(...$){let T=$.reduce((W,w)=>W.rawPipeOnce(w),this);return this.$.finalize(T)}tryPipe(...$){let T=$.reduce((W,w)=>W.rawPipeOnce(W$(w,"root")?w:(X,U)=>{try{return w(X,U)}catch(Y){return U.error({code:"predicate",predicate:w,actual:`aborted due to error:
|
|
132
|
+
${Y}
|
|
133
|
+
`})}}),this);return this.$.finalize(T)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to($){return this.$.finalize(this.toNode(this.$.parseDefinition($)))}toNode($){let T=fU(this,$,this.$);if(T instanceof r)return T.throw();return T}rawPipeOnce($){if(W$($,"root"))return this.toNode($);return this.distribute((T)=>T.hasKind("morph")?this.$.node("morph",{in:T.inner.in,morphs:[...T.morphs,$]}):this.$.node("morph",{in:T,morphs:[$]}),this.$.parseSchema)}narrow($){return this.constrainOut("predicate",$)}constrain($,T){return this._constrain("root",$,T)}constrainIn($,T){return this._constrain("in",$,T)}constrainOut($,T){return this._constrain("out",$,T)}_constrain($,T,W){let w=this.$.node(T,W);if(w.isRoot())return w.isUnknown()?this:I$(`Unexpected constraint node ${w}`);let X=$==="root"?this:this[$];if(X.hasKind("morph")||w.impliedBasis&&!X.extends(w.impliedBasis))return SR(T,w.impliedBasis,this);let U=this.$.node("intersection",{[w.kind]:w}),Y=$==="out"?fU(this,U,this.$):r6(this,U,this.$);if(Y instanceof r)Y.throw();return this.$.finalize(Y)}onUndeclaredKey($){let T=typeof $==="string"?$:$.rule,W=typeof $==="string"?!1:$.deep;return this.$.finalize(this.transform((w,X)=>w==="structure"?T==="ignore"?iJ(X,{undeclared:1}):{...X,undeclared:T}:X,W?void 0:{shouldTransform:(w)=>!m0(e2,w.kind)}))}hasEqualMorphs($){if(!this.includesTransform&&!$.includesTransform)return!0;if(!u0(this.shallowMorphs,$.shallowMorphs))return!1;if(!u0(this.flatMorphs,$.flatMorphs,{isEqual:(T,W)=>T.propString===W.propString&&(T.node.hasKind("morph")&&W.node.hasKind("morph")?T.node.hasEqualMorphs(W.node):T.node.hasKind("intersection")&&W.node.hasKind("intersection")?T.node.structure?.structuralMorphRef===W.node.structure?.structuralMorphRef:!1)}))return!1;return!0}onDeepUndeclaredKey($){return this.onUndeclaredKey({rule:$,deep:!0})}filter($){return this.constrainIn("predicate",$)}divisibleBy($){return this.constrain("divisor",$)}matching($){return this.constrain("pattern",$)}atLeast($){return this.constrain("min",$)}atMost($){return this.constrain("max",$)}moreThan($){return this.constrain("min",zX($))}lessThan($){return this.constrain("max",zX($))}atLeastLength($){return this.constrain("minLength",$)}atMostLength($){return this.constrain("maxLength",$)}moreThanLength($){return this.constrain("minLength",zX($))}lessThanLength($){return this.constrain("maxLength",zX($))}exactlyLength($){return this.constrain("exactLength",$)}atOrAfter($){return this.constrain("after",$)}atOrBefore($){return this.constrain("before",$)}laterThan($){return this.constrain("after",zX($))}earlierThan($){return this.constrain("before",zX($))}}var ux="Expected a non-empty brand name after #",zX=($)=>typeof $==="object"&&!($ instanceof Date)?{...$,exclusive:!0}:{rule:$,exclusive:!0},cU=($,T)=>W$(T,"root")?W$($,"root")?$.extends(T):T.allows($):W$($,"root")?$.hasUnit(T):T===$,aR=($)=>{if($.hasKind("morph"))return null;if($.hasKind("intersection"))return $.inner.structure??($.basis?.domain==="object"?$.$.bindReference(y.intrinsic.emptyStructure):null);if($.isBasis()&&$.domain==="object")return $.$.bindReference(y.intrinsic.emptyStructure);return null},px=($)=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
|
|
134
|
+
${$}`,sR=($,T)=>`${$} operand must be an object (was ${T})`;var F0=($,T)=>E$(Wz($),(W,w)=>[w,T]);var dx=($)=>typeof $==="string"?{reference:$}:$,eR=($)=>$ instanceof r?y.intrinsic.never.internal:$,ox=D$({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:($)=>$.startsWith("$")?$:`$ark.${$}`},resolve:{}},normalize:dx,defaults:{description:($)=>$.reference},intersections:{alias:($,T,W)=>W.$.lazilyResolve(()=>eR(s$($.resolution,T.resolution,W)),`${$.reference}${W.pipe?"=>":"&"}${T.reference}`),...F0("alias",($,T,W)=>{if(T.isUnknown())return $;if(T.isNever())return T;if(T.isBasis()&&!T.overlaps(y.intrinsic.object))return r.init("assignability",y.intrinsic.object,T);return W.$.lazilyResolve(()=>eR(s$($.resolution,T,W)),`${$.reference}${W.pipe?"=>":"&"}${T.id}`)})}});class $_ extends k1{expression=this.reference;structure=void 0;get resolution(){let $=this._resolve();return S6[this.id]=$}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));let $=this.reference,T=S6[$],W=[];while(W$(T,"context")){if(W.includes(T.id))return B(lx(T.id,W));W.push(T.id),T=S6[T.id]}if(!W$(T,"root"))return I$(`Unexpected resolution for reference ${this.reference}
|
|
133
135
|
Seen: [${W.join("->")}]
|
|
134
|
-
Resolution: ${
|
|
136
|
+
Resolution: ${M$(T)}`);return T}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;let $=this.reference.slice(1),T=this.$.resolutions[$];if(typeof T==="string")return T;if(W$(T,"root"))return T.id;return I$(`Unexpected resolution for reference ${this.reference}: ${M$(T)}`)}get defaultShortDescription(){return d6.object}innerToJsonSchema($){return this.resolution.toJsonSchemaRecurse($)}traverseAllows=($,T)=>{let W=T.seen[this.reference];if(W?.includes($))return!0;return T.seen[this.reference]=C$(W,$),this.resolution.traverseAllows($,T)};traverseApply=($,T)=>{let W=T.seen[this.reference];if(W?.includes($))return;T.seen[this.reference]=C$(W,$),this.resolution.traverseApply($,T)};compile($){let T=this.resolutionId;$.if(`ctx.seen.${T} && ctx.seen.${T}.includes(data)`,()=>$.return(!0)),$.if(`!ctx.seen.${T}`,()=>$.line(`ctx.seen.${T} = []`)),$.line(`ctx.seen.${T}.push(data)`),$.return($.invoke(T))}}var lx=($,T)=>`Alias '${$}' has a shallow resolution cycle: ${[...T,$].join("->")}`,uU={implementation:ox,Node:$_};class bW extends k1{traverseApply=($,T)=>{if(!this.traverseAllows($,T))T.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return fT(this.errorContext)}compile($){if($.traversalKind==="Allows")$.return(this.compiledCondition);else $.if(this.compiledNegation,()=>$.line(`${$.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}var rx=D$({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:($)=>typeof $==="string"?{domain:$}:a2($,"numberAllowsNaN")&&$.domain!=="number"?B(Hz.writeBadAllowNanMessage($.domain)):$,applyConfig:($,T)=>$.numberAllowsNaN===void 0&&$.domain==="number"&&T.numberAllowsNaN?{...$,numberAllowsNaN:!0}:$,defaults:{description:($)=>d6[$.domain],actual:($)=>Number.isNaN($)?"NaN":d6[f4($)]},intersections:{domain:($,T)=>$.domain==="number"&&T.domain==="number"?$.numberAllowsNaN?T:$:r.init("domain",$,T)}});class T_ extends bW{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?($)=>typeof $==="number"&&!Number.isNaN($):($)=>f4($)===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 d6[this.domain]}innerToJsonSchema($){if(this.domain==="bigint"||this.domain==="symbol")return $.fallback.domain({code:"domain",base:{},domain:this.domain});return{type:this.domain}}}var Hz={implementation:rx,Node:T_,writeBadAllowNanMessage:($)=>`numberAllowsNaN may only be specified with domain "number" (was ${$})`};var nx=D$({kind:"intersection",hasAssociatedError:!0,normalize:($)=>{if(a$($))return $;let{structure:T,...W}=$,w=!!T,X=T??{},U=E$(W,(Y,G)=>{if(b4(Y,JR)){if(w)B(`Flattened structure key ${Y} cannot be specified alongside a root 'structure' key.`);return X[Y]=G,[]}return[Y,G]});if(W$(X,"constraint")||!H0(X))U.structure=X;return U},finalizeInnerJson:({structure:$,...T})=>p6($,"object")?{...$,...T}:T,keys:{domain:{child:!0,parse:($,T)=>T.$.node("domain",$)},proto:{child:!0,parse:($,T)=>T.$.node("proto",$)},structure:{child:!0,parse:($,T)=>T.$.node("structure",$),serialize:($)=>{if(!$.sequence?.minLength)return $.collapsibleJson;let{sequence:T,...W}=$.collapsibleJson,{minVariadicLength:w,...X}=T,U=X.variadic&&Object.keys(X).length===1?X.variadic:X;return{...W,sequence:U}}},divisor:{child:!0,parse:U6("divisor")},max:{child:!0,parse:U6("max")},min:{child:!0,parse:U6("min")},maxLength:{child:!0,parse:U6("maxLength")},minLength:{child:!0,parse:U6("minLength")},exactLength:{child:!0,parse:U6("exactLength")},before:{child:!0,parse:U6("before")},after:{child:!0,parse:U6("after")},pattern:{child:!0,parse:U6("pattern")},predicate:{child:!0,parse:U6("predicate")}},reduce:($,T)=>W_({},$,{$:T,invert:!1,pipe:!1}),defaults:{description:($)=>{if($.children.length===0)return"unknown";if($.structure)return $.structure.description;let T=[];if($.basis&&!$.refinements.some((W)=>W.impl.obviatesBasisDescription))T.push($.basis.description);if($.refinements.length){let W=$.refinements.toSorted((w,X)=>w.kind==="min"&&X.kind==="max"?-1:0).map((w)=>w.description);T.push(...W)}if($.inner.predicate)T.push(...$.inner.predicate.map((W)=>W.description));return T.join(" and ")},expected:($)=>` \u25E6 ${$.errors.map((T)=>T.expected).join(`
|
|
135
137
|
\u25E6 `)}`,problem:($)=>`(${$.actual}) must be...
|
|
136
|
-
${$.expected}`},intersections:{intersection:($,T,W)=>
|
|
138
|
+
${$.expected}`},intersections:{intersection:($,T,W)=>W_($.inner,T.inner,W),...F0("intersection",($,T,W)=>{if($.children.length===0)return T;let{domain:w,proto:X,...U}=$.inner,Y=X??w,G=Y?s$(Y,T,W):T;return G instanceof r?G:$?.basis?.equals(G)?$:$.$.node("intersection",{...U,[G.kind]:G},{prereduced:!0})})}});class X_ extends k1{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter(($)=>$.isRefinement());structure=this.inner.structure;expression=ix(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??"present"}innerToJsonSchema($){return this.children.reduce((T,W)=>W.isBasis()?W.toJsonSchemaRecurse($):W.reduceJsonSchema(T,$),{})}traverseAllows=($,T)=>this.children.every((W)=>W.traverseAllows($,T));traverseApply=($,T)=>{let W=T.currentErrorCount;if(this.basis){if(this.basis.traverseApply($,T),T.currentErrorCount>W)return}if(this.refinements.length){for(let w=0;w<this.refinements.length-1;w++)if(this.refinements[w].traverseApply($,T),T.failFast&&T.currentErrorCount>W)return;if(this.refinements.at(-1).traverseApply($,T),T.currentErrorCount>W)return}if(this.structure){if(this.structure.traverseApply($,T),T.currentErrorCount>W)return}if(this.inner.predicate){for(let w=0;w<this.inner.predicate.length-1;w++)if(this.inner.predicate[w].traverseApply($,T),T.failFast&&T.currentErrorCount>W)return;this.inner.predicate.at(-1).traverseApply($,T)}};compile($){if($.traversalKind==="Allows"){for(let T of this.children)$.check(T);$.return(!0);return}if($.initializeErrorCount(),this.basis){if($.check(this.basis),this.children.length>1)$.returnIfFail()}if(this.refinements.length){for(let T=0;T<this.refinements.length-1;T++)$.check(this.refinements[T]),$.returnIfFailFast();if($.check(this.refinements.at(-1)),this.structure||this.inner.predicate)$.returnIfFail()}if(this.structure){if($.check(this.structure),this.inner.predicate)$.returnIfFail()}if(this.inner.predicate){for(let T=0;T<this.inner.predicate.length-1;T++)$.check(this.inner.predicate[T]),$.returnIfFail();$.check(this.inner.predicate.at(-1))}}}var QZ={implementation:nx,Node:X_},ix=($)=>{let T=$.structure?.expression||`${$.basis&&!$.refinements.some((W)=>W.impl.obviatesBasisExpression)?$.basis.nestableExpression+" ":""}${$.refinements.map((W)=>W.expression).join(" & ")}`||"unknown";if(T==="Array == 0")T="[]";return T},W_=($,T,W)=>{let w={},X=$.proto??$.domain,U=T.proto??T.domain,Y=X?U?s$(X,U,W):X:U;if(Y instanceof r)return Y;if(Y)w[Y.kind]=Y;return wX({kind:"intersection",baseInner:w,l:UX($),r:UX(T),roots:[],ctx:W})};var tx=D$({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:($,T)=>T.$.parseSchema($)},morphs:{parse:jT,serialize:($)=>$.map((T)=>W$(T,"root")?T.json:Z4(T))},declaredIn:{child:!1,serialize:($)=>$.json},declaredOut:{child:!1,serialize:($)=>$.json}},normalize:($)=>$,defaults:{description:($)=>`a morph from ${$.in.description} to ${$.out?.description??"unknown"}`},intersections:{morph:($,T,W)=>{if(!$.hasEqualMorphs(T))return B(ax($.expression,T.expression));let w=s$($.in,T.in,W);if(w instanceof r)return w;let X={morphs:$.morphs};if($.declaredIn||T.declaredIn){let U=s$($.in,T.in,W);if(U instanceof r)return U.throw();else X.declaredIn=U}if($.declaredOut||T.declaredOut){let U=s$($.out,T.out,W);if(U instanceof r)return U.throw();else X.declaredOut=U}return w.distribute((U)=>W.$.node("morph",{...X,in:U}),W.$.parseSchema)},...F0("morph",($,T,W)=>{let w=$.inner.in?s$($.inner.in,T,W):T;return w instanceof r?w:w.equals($.inner.in)?$:W.$.node("morph",{...$.inner,in:w})})}});class w_ extends k1{serializedMorphs=this.morphs.map(Z4);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=W$(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??y.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??y.intrinsic.unknown.internal}declareIn($){return this.$.node("morph",{...this.inner,declaredIn:$})}declareOut($){return this.$.node("morph",{...this.inner,declaredOut:$})}expression=`(In: ${this.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`;get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema($){return $.fallback.morph({code:"morph",base:this.in.toJsonSchemaRecurse($),out:this.introspectableOut?.toJsonSchemaRecurse($)??null})}compile($){if($.traversalKind==="Allows"){if(!this.introspectableIn)return;$.return($.invoke(this.introspectableIn));return}if(this.introspectableIn)$.line($.invoke(this.introspectableIn));$.line(`ctx.queueMorphs(${this.compiledMorphs})`)}traverseAllows=($,T)=>!this.introspectableIn||this.introspectableIn.traverseAllows($,T);traverseApply=($,T)=>{if(this.introspectableIn)this.introspectableIn.traverseApply($,T);T.queueMorphs(this.morphs)};hasEqualMorphs($){return u0(this.morphs,$.morphs,{isEqual:(T,W)=>T===W||W$(T,"root")&&W$(W,"root")&&T.equals(W)})}}var ZZ={implementation:tx,Node:w_},ax=($,T)=>`The intersection of distinct morphs at a single path is indeterminate:
|
|
137
139
|
Left: ${$}
|
|
138
|
-
Right: ${T}`;var
|
|
140
|
+
Right: ${T}`;var sx=D$({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:($)=>_U($)??R1($)},dateAllowsInvalid:{}},normalize:($)=>{let T=typeof $==="string"?{proto:BW[$]}:typeof $==="function"?a$($)?$:{proto:$}:typeof $.proto==="string"?{...$,proto:BW[$.proto]}:$;if(typeof T.proto!=="function")B(pU.writeInvalidSchemaMessage(T.proto));if(a2(T,"dateAllowsInvalid")&&T.proto!==Date)B(pU.writeBadInvalidDateMessage(T.proto));return T},applyConfig:($,T)=>{if($.dateAllowsInvalid===void 0&&$.proto===Date&&T.dateAllowsInvalid)return{...$,dateAllowsInvalid:!0};return $},defaults:{description:($)=>$.builtinName?eJ[$.builtinName]:`an instance of ${$.proto.name}`,actual:($)=>$ instanceof Date&&$.toString()==="Invalid Date"?"an invalid Date":RU($)},intersections:{proto:($,T)=>$.proto===Date&&T.proto===Date?$.dateAllowsInvalid?T:$:bQ($.proto,T.proto)?$:bQ(T.proto,$.proto)?T:r.init("proto",$,T),domain:($,T)=>T.domain==="object"?$:r.init("domain",y.intrinsic.object.internal,T)}});class U_ extends bW{builtinName=_U(this.proto);serializedConstructor=this.json.proto;requiresInvalidDateCheck=this.proto===Date&&!this.dateAllowsInvalid;traverseAllows=this.requiresInvalidDateCheck?($)=>$ instanceof Date&&$.toString()!=="Invalid Date":($)=>$ instanceof this.proto;compiledCondition=`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`;compiledNegation=`!(${this.compiledCondition})`;innerToJsonSchema($){switch(this.builtinName){case"Array":return{type:"array"};case"Date":return $.fallback.date?.({code:"date",base:{}})??$.fallback.proto({code:"proto",base:{},proto:this.proto});default:return $.fallback.proto({code:"proto",base:{},proto:this.proto})}}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 pU={implementation:sx,Node:U_,writeBadInvalidDateMessage:($)=>`dateAllowsInvalid may only be specified with constructor Date (was ${$.name})`,writeInvalidSchemaMessage:($)=>`instanceOf operand must be a function (was ${f4($)})`};var ex=D$({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:($,T)=>{let W=[];for(let w of $){let X=W$(w,"root")?w.branches:T.$.parseSchema(w).branches;for(let U of X)if(U.hasKind("morph")){let Y=W.findIndex((G)=>G.hasKind("morph")&&G.hasEqualMorphs(U));if(Y===-1)W.push(U);else{let G=W[Y];W[Y]=T.$.node("morph",{...G.inner,in:G.in.rawOr(U.in)})}}else W.push(U)}if(!T.def.ordered)W.sort((w,X)=>w.hash<X.hash?-1:1);return W}}},normalize:($)=>o$($)?{branches:$}:$,reduce:($,T)=>{let W=Hf($);if(W.length===1)return W[0];if(W.length===$.branches.length)return;return T.node("union",{...$,branches:W},{prereduced:!0})},defaults:{description:($)=>$.distribute((T)=>T.description,HX),expected:($)=>{let T=oJ($.errors,"propString"),W=Object.entries(T).map(([w,X])=>{let U=[];for(let H of X)z0(U,H.expected);let Y=HX(U),G=X.every((H)=>H.actual===X[0].actual)?X[0].actual:M$(X[0].data);return`${w&&`${w} `}must be ${Y}${G&&` (was ${G})`}`});return HX(W)},problem:($)=>$.expected,message:($)=>$.problem},intersections:{union:($,T,W)=>{if($.isNever!==T.isNever)return r.init("presence",$,T);let w;if($.ordered){if(T.ordered)B(Of($.expression,T.expression));if(w=VZ(T.branches,$.branches,W),w instanceof r)w.invert()}else w=VZ($.branches,T.branches,W);if(w instanceof r)return w;return W.$.parseSchema($.ordered||T.ordered?{branches:w,ordered:!0}:{branches:w})},...F0("union",($,T,W)=>{let w=VZ($.branches,[T],W);if(w instanceof r)return w;if(w.length===1)return w[0];return W.$.parseSchema($.ordered?{branches:w,ordered:!0}:{branches:w})})}});class z_ extends k1{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){let $=[],T=-1;for(let W of this.branches){if(W.hasKind("unit")&&W.domain==="boolean"){if(T===-1)T=$.length,$.push(W);else $[T]=y.intrinsic.boolean;continue}$.push(W)}return $}unitBranches=this.branches.filter(($)=>$.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?Yf(this.discriminant):null;expression=this.distribute(($)=>$.nestableExpression,zf);createBranchedOptimisticRootApply(){return($,T)=>{let W=this.traverseOptimistic($);if(W!==Q1)return W;let w=new g1($,this.$.resolvedConfig);return this.traverseApply($,w),w.finalize(T)}}get shallowMorphs(){return this.branches.reduce(($,T)=>z0($,T.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(($)=>$.defaultShortDescription,HX)}innerToJsonSchema($){if(this.branchGroups.length===1&&this.branchGroups[0].equals(y.intrinsic.boolean))return{type:"boolean"};let T=this.branchGroups.map((W)=>W.toJsonSchemaRecurse($));if(T.every((W)=>Object.keys(W).length===1&&a2(W,"const")))return{enum:T.map((W)=>W.const)};return{anyOf:T}}traverseAllows=($,T)=>this.branches.some((W)=>W.traverseAllows($,T));traverseApply=($,T)=>{let W=[];for(let w=0;w<this.branches.length;w++){if(T.pushBranch(),this.branches[w].traverseApply($,T),!T.hasError()){if(this.branches[w].includesTransform)return T.queuedMorphs.push(...T.popBranch().queuedMorphs);return T.popBranch()}W.push(T.popBranch().error)}T.errorFromNodeContext({code:"union",errors:W,meta:this.meta})};traverseOptimistic=($)=>{for(let T=0;T<this.branches.length;T++){let W=this.branches[T];if(W.traverseAllows($)){if(W.contextFreeMorph)return W.contextFreeMorph($);return $}}return Q1};compile($){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable($);let T=this.discriminant.optionallyChainedPropString;if(this.discriminant.kind==="domain")T=`typeof ${T} === "object" ? ${T} === null ? "null" : "object" : typeof ${T} === "function" ? "object" : typeof ${T}`;let W=this.discriminant.cases,w=Object.keys(W),{optimistic:X}=$;if($.optimistic=!1,$.block(`switch(${T})`,()=>{for(let z in W){let F=W[z],O=z==="default"?z:`case ${z}`;$.line(`${O}: return ${F===!0?X?$.data:F:X?`${$.invoke(F)} ? ${F.contextFreeMorph?`${Z4(F.contextFreeMorph)}(${$.data})`:$.data} : "${Q1}"`:$.invoke(F)}`)}return $}),$.traversalKind==="Allows"){$.return(X?`"${Q1}"`:!1);return}let U=HX(this.discriminant.kind==="domain"?w.map((z)=>{let F=z.slice(1,-1);return F==="function"?d6.object:d6[F]}):w),Y=this.discriminant.path.map((z)=>typeof z==="symbol"?Z4(z):JSON.stringify(z)),G=JSON.stringify(U),H=this.discriminant.kind==="domain"?`${wf}[${T}]`:`${Uf}(${T})`;$.line(`ctx.errorFromNodeContext({
|
|
139
141
|
code: "predicate",
|
|
140
142
|
expected: ${G},
|
|
141
143
|
actual: ${H},
|
|
142
|
-
relativePath: [${
|
|
144
|
+
relativePath: [${Y}],
|
|
143
145
|
meta: ${this.compiledMeta}
|
|
144
|
-
})`)}compileIndiscriminable($){if($.traversalKind==="Apply"){$.const("errors","[]");for(let T of this.branches)$.line("ctx.pushBranch()").line($.invoke(T)).if("!ctx.hasError()",()=>$.return(T.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");$.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{let{optimistic:T}=$;$.optimistic=!1;for(let W of this.branches)$.if(`${$.invoke(W)}`,()=>$.return(T?W.contextFreeMorph?`${Z4(W.contextFreeMorph)}(${$.data})`:$.data:!0));$.return(T?`"${Q1}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){if(this.branches.length<2||this.isCyclic)return null;if(this.unitBranches.length===this.branches.length){let X=
|
|
146
|
+
})`)}compileIndiscriminable($){if($.traversalKind==="Apply"){$.const("errors","[]");for(let T of this.branches)$.line("ctx.pushBranch()").line($.invoke(T)).if("!ctx.hasError()",()=>$.return(T.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");$.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{let{optimistic:T}=$;$.optimistic=!1;for(let W of this.branches)$.if(`${$.invoke(W)}`,()=>$.return(T?W.contextFreeMorph?`${Z4(W.contextFreeMorph)}(${$.data})`:$.data:!0));$.return(T?`"${Q1}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){if(this.branches.length<2||this.isCyclic)return null;if(this.unitBranches.length===this.branches.length){let X=E$(this.unitBranches,(U,Y)=>[`${Y.in.serializedValue}`,Y.hasKind("morph")?Y:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:X}}let $=[];for(let X=0;X<this.branches.length-1;X++){let U=this.branches[X];for(let Y=X+1;Y<this.branches.length;Y++){let G=this.branches[Y],H=r6(U.in,G.in,U.$);if(!(H instanceof r))continue;for(let z of H){if(!z.kind||z.optional)continue;let F,O;if(z.kind==="domain"){let{l:Z,r:K}=z;F=`"${typeof Z==="string"?Z:Z.domain}"`,O=`"${typeof K==="string"?K:K.domain}"`}else if(z.kind==="unit")F=z.l.serializedValue,O=z.r.serializedValue;else continue;let Q=$.find((Z)=>u0(Z.path,z.path)&&Z.kind===z.kind);if(!Q)$.push({kind:z.kind,cases:{[F]:{branchIndices:[X],condition:z.l},[O]:{branchIndices:[Y],condition:z.r}},path:z.path});else{if(Q.cases[F])Q.cases[F].branchIndices=z0(Q.cases[F].branchIndices,X);else Q.cases[F]??={branchIndices:[X],condition:z.l};if(Q.cases[O])Q.cases[O].branchIndices=z0(Q.cases[O].branchIndices,Y);else Q.cases[O]??={branchIndices:[Y],condition:z.r}}}}}let T=this.ordered?Wf($,this.branches):$;if(!T.length)return null;let W=$f(T,this),w={};for(let X in W.best.cases){let U=Tf(W,X);if(U===null){w[X]=!0;continue}if(U.length===this.branches.length)return null;if(this.ordered)U.sort((H,z)=>H.originalIndex-z.originalIndex);let Y=U.map((H)=>H.branch),G=Y.length===1?Y[0]:this.$.node("union",this.ordered?{branches:Y,ordered:!0}:Y);Object.assign(this.referencesById,G.referencesById),w[X]=G}if(W.defaultEntries.length){let X=W.defaultEntries.map((U)=>U.branch);w.default=this.$.node("union",this.ordered?{branches:X,ordered:!0}:X,{prereduced:!0}),Object.assign(this.referencesById,w.default.referencesById)}return Object.assign(W.location,{cases:w})}}var $f=($,T)=>{let W=$.sort((U,Y)=>Object.keys(Y.cases).length-Object.keys(U.cases).length)[0],w={kind:W.kind,path:W.path,optionallyChainedPropString:H_(W.path)},X=T.branches.map((U,Y)=>({originalIndex:Y,branch:U}));return{best:W,location:w,defaultEntries:X,node:T}},Tf=($,T)=>{let W=$.best.cases[T],w=Xf(W.condition,$.location.path,$.node.$),X=[],U=[];for(let Y=0;Y<$.defaultEntries.length;Y++){let G=$.defaultEntries[Y];if(W.branchIndices.includes(G.originalIndex)){let H=Y_($.node.branches[G.originalIndex],$.location);if(H===null)X=null;else X?.push({originalIndex:G.originalIndex,branch:H})}else if(G.branch.hasKind("alias")&&w.hasKind("domain")&&w.domain==="object")X?.push(G);else{if(G.branch.in.overlaps(w)){let H=Y_(G.branch,$.location);X?.push({originalIndex:G.originalIndex,branch:H})}U.push(G)}}return $.defaultEntries=U,X},Wf=($,T)=>{return $.filter((w)=>{let X=Object.values(w.cases).map((U)=>U.branchIndices);for(let U=0;U<X.length-1;U++){let Y=X[U];for(let G=U+1;G<X.length;G++){let H=X[G];for(let z of Y)for(let F of H)if(z>F){if(T[z].overlaps(T[F]))return!1}}}return!0})},Xf=($,T,W)=>{let w=$==="undefined"?W.node("unit",{unit:void 0}):$==="null"?W.node("unit",{unit:null}):$==="boolean"?W.units([!0,!1]):$;for(let X=T.length-1;X>=0;X--){let U=T[X];w=W.node("intersection",typeof U==="number"?{proto:"Array",sequence:[...pJ(U).map((Y)=>({})),w]}:{domain:"object",required:[{key:U,value:w}]})}return w},H_=($)=>$.reduce((T,W)=>T+pQ(W,!0),"data"),wf=Z4(lJ),Uf=Z4(M$),KZ={implementation:ex,Node:z_},Yf=($)=>({kind:$.kind,path:$.path.map((T)=>typeof T==="string"?T:o0(T)),cases:E$($.cases,(T,W)=>[T,W===!0?W:W.hasKind("union")&&W.discriminantJson?W.discriminantJson:W.json])}),Gf={delimiter:" | ",finalDelimiter:" | "},zf=($)=>HX($,Gf),HX=($,T)=>{let W=T?.delimiter??", ",w=T?.finalDelimiter??" or ";if($.length===0)return"never";if($.length===1)return $[0];if($.length===2&&$[0]==="false"&&$[1]==="true"||$[0]==="true"&&$[1]==="false")return"boolean";let X={},U=$.filter((G)=>X[G]?!1:X[G]=!0),Y=U.pop();return`${U.join(W)}${U.length?w:""}${Y}`},VZ=($,T,W)=>{let w=T.map(()=>[]);for(let U=0;U<$.length;U++){let Y={};for(let G=0;G<T.length;G++){if(w[G]===null)continue;if($[U].equals(T[G])){w[G]=null,Y={};break}let H=s$($[U],T[G],W);if(H instanceof r)continue;if(H.equals($[U])){w[G].push($[U]),Y={};break}if(H.equals(T[G]))w[G]=null;else Y[G]=H}for(let G in Y)w[G][U]=Y[G]}let X=w.flatMap((U,Y)=>U?.flatMap((G)=>G.branches)??T[Y]);return X.length===0?r.init("union",$,T):X},Hf=({branches:$,ordered:T})=>{if($.length<2)return $;let W=$.map(()=>!0);for(let w=0;w<$.length;w++)for(let X=w+1;X<$.length&&W[w]&&W[X];X++){if($[w].equals($[X])){W[X]=!1;continue}let U=r6($[w].in,$[X].in,$[0].$);if(U instanceof r)continue;if(!T)Ff($[w],$[X]);if(U.equals($[w].in))W[w]=!!T;else if(U.equals($[X].in))W[X]=!1}return $.filter((w,X)=>W[X])},Ff=($,T)=>{if(!$.includesTransform&&!T.includesTransform)return;if(!u0($.shallowMorphs,T.shallowMorphs))B(G_($.expression,T.expression));if(!u0($.flatMorphs,T.flatMorphs,{isEqual:(W,w)=>W.propString===w.propString&&(W.node.hasKind("morph")&&w.node.hasKind("morph")?W.node.hasEqualMorphs(w.node):W.node.hasKind("intersection")&&w.node.hasKind("intersection")?W.node.structure?.structuralMorphRef===w.node.structure?.structuralMorphRef:!1)}))B(G_($.expression,T.expression))},Y_=($,T)=>$.transform((W,w)=>{if(W==="domain"||W==="unit")return null;return w},{shouldTransform:(W,w)=>{let X=H_(w.path);if(!T.optionallyChainedPropString.startsWith(X))return!1;if(W.hasKind("domain")&&W.domain==="object")return!0;if((W.hasKind("domain")||T.kind==="unit")&&X===T.optionallyChainedPropString)return!0;return W.children.length!==0&&W.kind!=="index"}}),G_=($,T)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
|
|
145
147
|
Left: ${$}
|
|
146
|
-
Right: ${T}`,
|
|
148
|
+
Right: ${T}`,Of=($,T)=>`The intersection of two ordered unions is indeterminate:
|
|
147
149
|
Left: ${$}
|
|
148
|
-
Right: ${T}`;var xh=A$({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:($)=>$ instanceof Date?$.toISOString():k1($)}},normalize:($)=>$,defaults:{description:($)=>E$($.unit),problem:({expected:$,actual:T})=>`${$===T?`must be reference equal to ${$} (serialized to the same value)`:`must be ${$} (was ${T})`}`},intersections:{unit:($,T)=>o.init("unit",$,T),...Q0("unit",($,T)=>{if(T.allows($.unit))return $;let W=T.hasKind("intersection")?T.basis:T;if(W){let U=W.hasKind("domain")?W:b.intrinsic.object;if($.domain!==U.domain){let X=$.domain==="undefined"||$.domain==="null"||$.domain==="boolean"?$.domain:b.intrinsic[$.domain];return o.init("domain",X,U)}}return o.init("assignability",$,T.hasKind("intersection")?T.children.find((U)=>!U.allows($.unit)):T)})}});class Nk extends iW{compiledValue=this.json.unit;serializedValue=typeof this.unit==="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Mk(this.unit,this.serializedValue);compiledNegation=Mk(this.unit,this.serializedValue,"negated");expression=E$(this.unit);domain=x4(this.unit);get defaultShortDescription(){return this.domain==="object"?d6.object:this.description}innerToJsonSchema($){return this.unit===null?{type:"null"}:b.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:$.fallback.unit({code:"unit",base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?($)=>$ instanceof Date&&$.toISOString()===this.compiledValue:Number.isNaN(this.unit)?($)=>Number.isNaN($):($)=>$===this.unit}var mZ={implementation:xh,Node:Nk},Mk=($,T,W)=>{if($ instanceof Date){let U=`data instanceof Date && data.toISOString() === ${T}`;return W?`!(${U})`:U}if(Number.isNaN($))return`${W?"!":""}Number.isNaN(data)`;return`data ${W?"!":"="}== ${T}`};var Ih=A$({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:($,T)=>{let W=T.$.parseSchema($);if(!W.extends(b.intrinsic.key))return B(fh(W.expression));let U=W.branches.filter((X)=>X.hasKind("unit"));if(U.length)return B(bh(U.map((X)=>E$(X.unit))));return W}},value:{child:!0,parse:($,T)=>T.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`[${$.signature.expression}]: ${$.value.description}`},intersections:{index:($,T,W)=>{if($.signature.equals(T.signature)){let U=a$($.value,T.value,W),X=U instanceof o?b.intrinsic.never.internal:U;return W.$.node("index",{signature:$.signature,value:X})}if($.signature.extends(T.signature)&&$.value.subsumes(T.value))return T;if(T.signature.extends($.signature)&&T.value.subsumes($.value))return $;return null}}});class Lk extends v1{impliedBasis=b.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=q$(this.value.flatRefs.map(($)=>p1([this.signature,...$.path],$.node)),p1([this.signature],this.value));traverseAllows=($,T)=>oW($).every((W)=>{if(this.signature.traverseAllows(W[0],T))return l6(W[0],()=>this.value.traverseAllows(W[1],T),T);return!0});traverseApply=($,T)=>{for(let W of oW($))if(this.signature.traverseAllows(W[0],T))l6(W[0],()=>this.value.traverseApply(W[1],T),T)};_transform($,T){T.path.push(this.signature);let W=super._transform($,T);return T.path.pop(),W}compile(){}}var cZ={implementation:Ih,Node:Lk},bh=($)=>`Index keys ${$.join(", ")} should be specified as named props.`,fh=($)=>`Indexed key definition '${$}' must be a string or symbol`;var yh=A$({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,T)=>T.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`${$.compiledKey}: ${$.value.description}`,expected:($)=>$.missingValueDescription,actual:()=>"missing"},intersections:{required:dY,optional:dY}});class Jk extends oY{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=cT(this.errorContext)}var uZ={implementation:yh,Node:Jk};var hh=A$({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}},optionals:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}},defaultables:{child:($)=>$.map((T)=>T[0]),parse:($,T)=>{if($.length===0)return;return $.map((W)=>{let U=T.$.parseSchema(W[0]);return rY(U,W[1],null),[U,W[1]]})},serialize:($)=>$.map((T)=>[T[0].collapsibleJson,k1(T[1])])},variadic:{child:!0,parse:($,T)=>T.$.parseSchema($,T)},minVariadicLength:{parse:($)=>$===0?void 0:$},postfix:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}}},normalize:($)=>{if(typeof $==="string")return{variadic:$};if("variadic"in $||"prefix"in $||"defaultables"in $||"optionals"in $||"postfix"in $||"minVariadicLength"in $){if($.postfix?.length){if(!$.variadic)return B(uh);if($.optionals?.length||$.defaultables?.length)return B(dZ)}if($.minVariadicLength&&!$.variadic)return B("minVariadicLength may not be specified without a variadic element");return $}return{variadic:$}},reduce:($,T)=>{let W=$.minVariadicLength??0,U=$.prefix?.slice()??[],X=$.defaultables?.slice()??[],Y=$.optionals?.slice()??[],w=$.postfix?.slice()??[];if($.variadic){while(Y.at(-1)?.equals($.variadic))Y.pop();if(Y.length===0&&X.length===0)while(U.at(-1)?.equals($.variadic))U.pop(),W++;while(w[0]?.equals($.variadic))w.shift(),W++}else if(Y.length===0&&X.length===0)U.push(...w.splice(0));if(W!==$.minVariadicLength||$.prefix&&$.prefix.length!==U.length)return T.node("sequence",{...$,prefix:U,defaultables:X,optionals:Y,postfix:w,minVariadicLength:W},{prereduced:!0})},defaults:{description:($)=>{if($.isVariadicOnly)return`${$.variadic.nestableExpression}[]`;return`[${$.tuple.map((W)=>W.kind==="defaultables"?`${W.node.nestableExpression} = ${E$(W.default)}`:W.kind==="optionals"?`${W.node.nestableExpression}?`:W.kind==="variadic"?`...${W.node.nestableExpression}[]`:W.node.expression).join(", ")}]`}},intersections:{sequence:($,T,W)=>{let U=aY({l:$.tuple,r:T.tuple,disjoint:new o,result:[],fixedVariants:[],ctx:W}),X=U.disjoint.length===0?[U,...U.fixedVariants]:U.fixedVariants;return X.length===0?U.disjoint:X.length===1?W.$.node("sequence",_k(X[0].result)):W.$.node("union",X.map((Y)=>({proto:Array,sequence:_k(Y.result)})))}}});class Rk extends v1{impliedBasis=b.intrinsic.Array.internal;tuple=ch(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(($)=>{if($.kind==="defaultables"||$.kind==="optionals")return this.defaultablesAndOptionals.push($.node),!0;return $.kind==="prefix"});variadicOrPostfix=n0(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return EZ(this.flatRefs,this.prevariadic.flatMap(($,T)=>q$($.node.flatRefs.map((W)=>p1([`${T}`,...W.path],W.node)),p1([`${T}`],$.node)))),EZ(this.flatRefs,this.variadicOrPostfix.flatMap(($)=>q$($.flatRefs.map((T)=>p1([b.intrinsic.nonNegativeIntegerString.internal,...T.path],T.node)),p1([b.intrinsic.nonNegativeIntegerString.internal],$)))),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=mh(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Z4(this.defaultValueMorphs):void 0;elementAtIndex($,T){if(T<this.prevariadic.length)return this.tuple[T];let W=$.length-this.postfixLength;if(T>=W)return{kind:"postfix",node:this.postfix[T-W]};return{kind:"variadic",node:this.variadic??S$(`Unexpected attempt to access index ${T} on ${this}`)}}traverseAllows=($,T)=>{for(let W=0;W<$.length;W++)if(!this.elementAtIndex($,W).node.traverseAllows($[W],T))return!1;return!0};traverseApply=($,T)=>{let W=0;for(;W<$.length;W++)l6(W,()=>this.elementAtIndex($,W).node.traverseApply($[W],T),T)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile($){if(this.prefix)for(let[T,W]of this.prefix.entries())$.traverseKey(`${T}`,`data[${T}]`,W);for(let[T,W]of this.defaultablesAndOptionals.entries()){let U=`${T+this.prefixLength}`;$.if(`${U} >= ${$.data}.length`,()=>$.traversalKind==="Allows"?$.return(!0):$.return()),$.traverseKey(U,`data[${U}]`,W)}if(this.variadic){if(this.postfix)$.const("firstPostfixIndex",`${$.data}.length${this.postfix?`- ${this.postfix.length}`:""}`);if($.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>$.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix)for(let[T,W]of this.postfix.entries()){let U=`firstPostfixIndex + ${T}`;$.traverseKey(U,`data[${U}]`,W)}}if($.traversalKind==="Allows")$.return(!0)}_transform($,T){T.path.push(b.intrinsic.nonNegativeIntegerString.internal);let W=super._transform($,T);return T.path.pop(),W}expression=this.description;reduceJsonSchema($,T){if(this.prevariadic.length)$.prefixItems=this.prevariadic.map((W)=>{let U=W.node.toJsonSchemaRecurse(T);if(W.kind==="defaultables"){let X=typeof W.default==="function"?W.default():W.default;U.default=b.intrinsic.jsonData.allows(X)?X:T.fallback.defaultValue({code:"defaultValue",base:U,value:X})}return U});if(this.minLength)$.minItems=this.minLength;if(this.variadic){let W=Object.assign($,{items:this.variadic.toJsonSchemaRecurse(T)});if(this.maxLength)W.maxItems=this.maxLength;if(this.postfix){let U=this.postfix.map((X)=>X.toJsonSchemaRecurse(T));$=T.fallback.arrayPostfix({code:"arrayPostfix",base:W,elements:U})}}else $.items=!1,delete $.maxItems;return $}}var gh={},mh=($)=>{if(!$.defaultables)return[];let T=[],W="[",U=$.prefixLength+$.defaultablesLength-1;for(let X=$.prefixLength;X<=U;X++){let[Y,w]=$.defaultables[X-$.prefixLength];T.push(bZ(X,Y,w)),W+=`${X}: ${Y.id} = ${k1(w)}, `}return W+="]",gh[W]??=T},pZ={implementation:hh,Node:Rk},ch=($)=>{let T=[];if($.prefix)for(let W of $.prefix)T.push({kind:"prefix",node:W});if($.defaultables)for(let[W,U]of $.defaultables)T.push({kind:"defaultables",node:W,default:U});if($.optionals)for(let W of $.optionals)T.push({kind:"optionals",node:W});if($.variadic)T.push({kind:"variadic",node:$.variadic});if($.postfix)for(let W of $.postfix)T.push({kind:"postfix",node:W});return T},_k=($)=>$.reduce((T,W)=>{if(W.kind==="variadic")T.variadic=W.node;else if(W.kind==="defaultables")T.defaultables=q$(T.defaultables,[[W.node,W.default]]);else T[W.kind]=q$(T[W.kind],W.node);return T},{}),dZ="A postfix required element cannot follow an optional or defaultable element",uh="A postfix element requires a variadic element",aY=($)=>{let[T,...W]=$.l,[U,...X]=$.r;if(!T||!U)return $;let Y=W.at(-1)?.kind==="postfix",w=X.at(-1)?.kind==="postfix",G=T.kind==="prefix"||U.kind==="prefix"?"prefix":T.kind==="postfix"||U.kind==="postfix"?"postfix":T.kind==="variadic"&&U.kind==="variadic"?"variadic":Y||w?"prefix":T.kind==="defaultables"||U.kind==="defaultables"?"defaultables":"optionals";if(T.kind==="prefix"&&U.kind==="variadic"&&w){let O=aY({...$,fixedVariants:[],r:X.map((Q)=>({...Q,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}else if(U.kind==="prefix"&&T.kind==="variadic"&&Y){let O=aY({...$,fixedVariants:[],l:W.map((Q)=>({...Q,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}let H=a$(T.node,U.node,$.ctx);if(H instanceof o)if(G==="prefix"||G==="postfix")$.disjoint.push(...H.withPrefixKey(G==="prefix"?$.result.length:`-${W.length+1}`,"required")),$.result=[...$.result,{kind:G,node:b.intrinsic.never.internal}];else if(G==="optionals"||G==="defaultables")return $;else return aY({...$,fixedVariants:[],l:W.map((O)=>({...O,kind:"prefix"})),r:W.map((O)=>({...O,kind:"prefix"}))});else if(G==="defaultables"){if(T.kind==="defaultables"&&U.kind==="defaultables"&&T.default!==U.default)B(IZ(T.default,U.default));$.result=[...$.result,{kind:G,node:H,default:T.kind==="defaultables"?T.default:U.kind==="defaultables"?U.default:S$(`Unexpected defaultable intersection from ${T.kind} and ${U.kind} elements.`)}]}else $.result=[...$.result,{kind:G,node:H}];let z=$.l.length,F=$.r.length;if(T.kind!=="variadic"||z>=F&&(U.kind==="variadic"||F===1))$.l=W;if(U.kind!=="variadic"||F>=z&&(T.kind==="variadic"||z===1))$.r=X;return aY($)};var qk=($)=>(T)=>{if(T.props.length||T.index){let W=T.index?.map((X)=>X[$])??[];for(let X of T.props)W.push(X[$]);if(T.undeclared)W.push(`+ (undeclared): ${T.undeclared}`);let U=`{ ${W.join(", ")} }`;return T.sequence?`${U} & ${T.sequence.description}`:U}return T.sequence?.description??"{}"},ph=qk("description"),dh=qk("expression"),kk=($,T,W)=>{let U=$.required?"required":"optional";if(!T.signature.allows($.key))return null;let X=r6($.value,T.value,W);if(X instanceof o)return U==="optional"?W.node("optional",{key:$.key,value:b.intrinsic.never.internal}):X.withPrefixKey($.key,$.kind);return null},oh=A$({kind:"structure",hasAssociatedError:!1,normalize:($)=>$,applyConfig:($,T)=>{if(!$.undeclared&&T.onUndeclaredKey!=="ignore")return{...$,undeclared:T.onUndeclaredKey};return $},keys:{required:{child:!0,parse:X6("required"),reduceIo:($,T,W)=>{T.required=q$(T.required,W.map((U)=>U[$]));return}},optional:{child:!0,parse:X6("optional"),reduceIo:($,T,W)=>{if($==="in"){T.optional=W.map((U)=>U.in);return}for(let U of W)T[U.outProp.kind]=q$(T[U.outProp.kind],U.outProp.out)}},index:{child:!0,parse:X6("index")},sequence:{child:!0,parse:X6("sequence")},undeclared:{parse:($)=>$==="ignore"?void 0:$,reduceIo:($,T,W)=>{if(W!=="delete")return;if($==="in")delete T.undeclared;else T.undeclared="reject"}}},defaults:{description:ph},intersections:{structure:($,T,W)=>{let U={...$.inner},X={...T.inner},Y=new o;if($.undeclared){let H=$.keyof();for(let z of T.requiredKeys)if(!H.allows(z))Y.add("presence",b.intrinsic.never.internal,T.propsByKey[z].value,{path:[z]});if(X.optional)X.optional=X.optional.filter((z)=>H.allows(z.key));if(X.index)X.index=X.index.flatMap((z)=>{if(z.signature.extends(H))return z;let F=r6(H,z.signature,W.$);if(F instanceof o)return[];let O=qz(F,z.value,W.$);if(O.required)X.required=n0(X.required,O.required);if(O.optional)X.optional=n0(X.optional,O.optional);return O.index??[]})}if(T.undeclared){let H=T.keyof();for(let z of $.requiredKeys)if(!H.allows(z))Y.add("presence",$.propsByKey[z].value,b.intrinsic.never.internal,{path:[z]});if(U.optional)U.optional=U.optional.filter((z)=>H.allows(z.key));if(U.index)U.index=U.index.flatMap((z)=>{if(z.signature.extends(H))return z;let F=r6(H,z.signature,W.$);if(F instanceof o)return[];let O=qz(F,z.value,W.$);if(O.required)U.required=n0(U.required,O.required);if(O.optional)U.optional=n0(U.optional,O.optional);return O.index??[]})}let w={};if($.undeclared||T.undeclared)w.undeclared=$.undeclared==="reject"||T.undeclared==="reject"?"reject":"delete";let G=NU({kind:"structure",baseInner:w,l:LU(U),r:LU(X),roots:[],ctx:W});if(G instanceof o)Y.push(...G);if(Y.length)return Y;return G}},reduce:($,T)=>{if($.index){if(!($.required||$.optional))return;let W=!1,U=$.required??[],X=$.optional??[],Y=[...X];for(let w of $.index){for(let G of U){let H=kk(G,w,T);if(H instanceof o)return H}for(let[G,H]of X.entries()){let z=kk(H,w,T);if(z instanceof o)return z;if(z===null)continue;Y[G]=z,W=!0}}if(W)return T.node("structure",{...$,optional:Y},{prereduced:!0})}}});class Pk extends v1{impliedBasis=b.intrinsic.object.internal;impliedSiblings=this.children.flatMap(($)=>$.impliedSiblings??[]);props=n0(this.required,this.optional);propsByKey=K$(this.props,($,T)=>[T.key,T]);propsByKeyReference=Z4(this.propsByKey);expression=dh(this);requiredKeys=this.required?.map(($)=>$.key)??[];optionalKeys=this.optional?.map(($)=>$.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let $=this.$.units(this.literalKeys).branches;if(this.index)for(let{signature:T}of this.index)$=$.concat(T.branches);return this._keyof=this.$.node("union",$)}map($){return this.$.node("structure",this.props.flatMap($).reduce((T,W)=>{let U=this.propsByKey[W.key];if(t$(W)){if(W.kind!=="required"&&W.kind!=="optional")return B(`Map result must have kind "required" or "optional" (was ${W.kind})`);return T[W.kind]=q$(T[W.kind],W),T}let X=W.kind??U?.kind??"required",Y=K$(W,(w,G)=>(w in lY.implementation.keys)?[w,G]:[]);return T[X]=q$(T[X],this.$.node(X,Y)),T},{}))}assertHasKeys($){let T=$.filter((W)=>!nY(W,this.keyof()));if(T.length)return B(vk(this.expression,T))}get($,...T){let W,U=!1,X=ih($);if((typeof X==="string"||typeof X==="symbol")&&this.propsByKey[X])W=this.propsByKey[X].value,U=this.propsByKey[X].required;if(this.index){for(let w of this.index)if(nY(X,w.signature))W=W?.and(w.value)??w.value}if(this.sequence&&nY(X,b.intrinsic.nonNegativeIntegerString))if(s(X,"root")){if(this.sequence.variadic)W=W?.and(this.sequence.element)??this.sequence.element}else{let w=Number.parseInt(X);if(w<this.sequence.prevariadic.length){let G=this.sequence.prevariadic[w].node;W=W?.and(G)??G,U||=w<this.sequence.prefixLength}else if(this.sequence.variadic){let G=this.$.node("union",this.sequence.variadicOrPostfix);W=W?.and(G)??G}}if(!W){if(this.sequence?.variadic&&s(X,"root")&&X.extends(b.intrinsic.number))return B(th(X.expression,this.sequence.expression));return B(vk(this.expression,[X]))}let Y=W.get(...T);return U?Y:Y.or(b.intrinsic.undefined)}pick(...$){return this.assertHasKeys($),this.$.node("structure",this.filterKeys("pick",$))}omit(...$){return this.assertHasKeys($),this.$.node("structure",this.filterKeys("omit",$))}optionalize(){let{required:$,...T}=this.inner;return this.$.node("structure",{...T,optional:this.props.map((W)=>W.hasKind("required")?this.$.node("optional",W.inner):W)})}require(){let{optional:$,...T}=this.inner;return this.$.node("structure",{...T,required:this.props.map((W)=>W.hasKind("optional")?{key:W.key,value:W.value}:W)})}merge($){let T=this.filterKeys("omit",[$.keyof()]);if($.required)T.required=q$(T.required,$.required);if($.optional)T.optional=q$(T.optional,$.optional);if($.index)T.index=q$(T.index,$.index);if($.sequence)T.sequence=$.sequence;if($.undeclared)T.undeclared=$.undeclared;else delete T.undeclared;return this.$.node("structure",T)}filterKeys($,T){let W=Kz(this.inner),U=(X)=>{let Y=T.some((w)=>nY(X,w));return $==="pick"?Y:!Y};if(W.required)W.required=W.required.filter((X)=>U(X.key));if(W.optional)W.optional=W.optional.filter((X)=>U(X.key));if(W.index)W.index=W.index.filter((X)=>U(X.signature));return W}traverseAllows=($,T)=>this._traverse("Allows",$,T);traverseApply=($,T)=>this._traverse("Apply",$,T);_traverse=($,T,W)=>{let U=W?.currentErrorCount??0;for(let X=0;X<this.props.length;X++)if($==="Allows"){if(!this.props[X].traverseAllows(T,W))return!1}else if(this.props[X].traverseApply(T,W),W.failFast&&W.currentErrorCount>U)return!1;if(this.sequence){if($==="Allows"){if(!this.sequence.traverseAllows(T,W))return!1}else if(this.sequence.traverseApply(T,W),W.failFast&&W.currentErrorCount>U)return!1}if(this.index||this.undeclared==="reject"){let X=Object.keys(T);X.push(...Object.getOwnPropertySymbols(T));for(let Y=0;Y<X.length;Y++){let w=X[Y];if(this.index){for(let G of this.index)if(G.signature.traverseAllows(w,W)){if($==="Allows"){if(!l6(w,()=>G.value.traverseAllows(T[w],W),W))return!1}else if(l6(w,()=>G.value.traverseApply(T[w],W),W),W.failFast&&W.currentErrorCount>U)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(w)){if($==="Allows")return!1;if(W.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[w],meta:this.meta}),W.failFast)return!1}}}if(this.structuralMorph&&W&&!W.hasError())W.queueMorphs([this.structuralMorph]);return!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(($)=>$.hasDefault())??[])}declaresKey=($)=>($ in this.propsByKey)||this.index?.some((T)=>T.signature.allows($))||this.sequence!==void 0&&b.intrinsic.nonNegativeIntegerString.allows($);_compileDeclaresKey($){let T=[];if(this.props.length)T.push(`k in ${this.propsByKeyReference}`);if(this.index)for(let W of this.index)T.push($.invoke(W.signature,{kind:"Allows",arg:"k"}));if(this.sequence)T.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");return T.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",rh(this))}structuralMorphRef=this.structuralMorph&&Z4(this.structuralMorph);compile($){if($.traversalKind==="Apply")$.initializeErrorCount();for(let T of this.props)if($.check(T),$.traversalKind==="Apply")$.returnIfFailFast();if(this.sequence){if($.check(this.sequence),$.traversalKind==="Apply")$.returnIfFailFast()}if(this.index||this.undeclared==="reject")$.const("keys","Object.keys(data)"),$.line("keys.push(...Object.getOwnPropertySymbols(data))"),$.for("i < keys.length",()=>this.compileExhaustiveEntry($));if($.traversalKind==="Allows")return $.return(!0);if(this.structuralMorphRef)$.if("ctx && !ctx.hasError()",()=>{return $.line("ctx.queueMorphs(["),nh($,this),$.line("])")})}compileExhaustiveEntry($){if($.const("k","keys[i]"),this.index)for(let T of this.index)$.if(`${$.invoke(T.signature,{arg:"k",kind:"Allows"})}`,()=>$.traverseKey("k","data[k]",T.value));if(this.undeclared==="reject")$.if(`!(${this._compileDeclaresKey($)})`,()=>{if($.traversalKind==="Allows")return $.return(!1);return $.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>$.return())});return $}reduceJsonSchema($,T){switch($.type){case"object":return this.reduceObjectJsonSchema($,T);case"array":let W=this.sequence?.reduceJsonSchema($,T)??$;if(this.props.length||this.index)return T.fallback.arrayObject({code:"arrayObject",base:W,object:this.reduceObjectJsonSchema({type:"object"},T)});return W;default:return U4.throwInternalOperandError("structure",$)}}reduceObjectJsonSchema($,T){if(this.props.length){$.properties={};for(let W of this.props){let U=W.value.toJsonSchemaRecurse(T);if(typeof W.key==="symbol"){T.fallback.symbolKey({code:"symbolKey",base:$,key:W.key,value:U,optional:W.optional});continue}if(W.hasDefault()){let X=typeof W.default==="function"?W.default():W.default;U.default=b.intrinsic.jsonData.allows(X)?X:T.fallback.defaultValue({code:"defaultValue",base:U,value:X})}$.properties[W.key]=U}if(this.requiredKeys.length&&$.properties)$.required=this.requiredKeys.filter((W)=>typeof W==="string"&&(W in $.properties))}if(this.index)for(let W of this.index){let U=W.value.toJsonSchemaRecurse(T);if(W.signature.equals(b.intrinsic.string)){$.additionalProperties=U;continue}for(let X of W.signature.branches){if(!X.extends(b.intrinsic.string)){$=T.fallback.symbolKey({code:"symbolKey",base:$,key:null,value:U,optional:!1});continue}let Y={type:"string"};if(X.hasKind("morph"))Y=T.fallback.morph({code:"morph",base:X.in.toJsonSchemaRecurse(T),out:X.out.toJsonSchemaRecurse(T)});if(!X.hasKind("intersection"))return S$(`Unexpected index branch kind ${X.kind}.`);let{pattern:w}=X.inner;if(w){let G=Object.assign(Y,{pattern:w[0].rule});for(let H=1;H<w.length;H++)Y=T.fallback.patternIntersection({code:"patternIntersection",base:G,pattern:w[H].rule});$.patternProperties??={},$.patternProperties[G.pattern]=U}}}if(this.undeclared&&!$.additionalProperties)$.additionalProperties=!1;return $}}var oZ={},lh=($)=>{let T="";for(let W=0;W<$.defaultable.length;W++)T+=$.defaultable[W].defaultValueMorphRef;if($.sequence?.defaultValueMorphsReference)T+=$.sequence?.defaultValueMorphsReference;if($.undeclared==="delete"){if(T+="delete !(",$.required)for(let W of $.required)T+=W.compiledKey+" | ";if($.optional)for(let W of $.optional)T+=W.compiledKey+" | ";if($.index)for(let W of $.index)T+=W.signature.id+" | ";if($.sequence)if($.sequence.maxLength===null)T+=X$.nonNegativeIntegerString.id;else for(let W=0;W<$.sequence.tuple.length;W++)T+=W+" | ";T+=")"}return T},rh=($)=>{let T=lh($);if(!T)return;if(oZ[T])return oZ[T];let W=(U,X)=>{for(let Y=0;Y<$.defaultable.length;Y++)if(!($.defaultable[Y].key in U))$.defaultable[Y].defaultValueMorph(U,X);if($.sequence?.defaultables)for(let Y=U.length-$.sequence.prefixLength;Y<$.sequence.defaultables.length;Y++)$.sequence.defaultValueMorphs[Y](U,X);if($.undeclared==="delete"){for(let Y in U)if(!$.declaresKey(Y))delete U[Y]}return U};return oZ[T]=W},nh=($,T)=>{let U=`(data${T.defaultable.some((X)=>X.defaultValueMorph.length===2)||T.sequence?.defaultValueMorphs.some((X)=>X.length===2)?", ctx":""})`;return $.block(`${U} => `,(X)=>{for(let Y=0;Y<T.defaultable.length;Y++){let{serializedKey:w,defaultValueMorphRef:G}=T.defaultable[Y];X.if(`!(${w} in data)`,(H)=>H.line(`${G}${U}`))}if(T.sequence?.defaultables)X.for(`i < ${T.sequence.defaultables.length}`,(Y)=>Y.set("data[i]",5),`data.length - ${T.sequence.prefixLength}`);if(T.undeclared==="delete")X.forIn("data",(Y)=>Y.if(`!(${T._compileDeclaresKey(Y)})`,(w)=>w.line("delete data[k]")));return X.return("data")})},lZ={implementation:oh,Node:Pk},ih=($)=>{if(s($,"root")&&$.hasKind("unit"))$=$.unit;if(typeof $==="number")$=`${$}`;return $},th=($,T)=>`${$} is not allowed as an array index on ${T}. Use the 'nonNegativeIntegerString' keyword instead.`,qz=($,T,W)=>{let[U,X]=a_($.branches,(w)=>w.hasKind("unit"));if(!U.length)return{index:W.node("index",{signature:$,value:T})};let Y={};for(let w of U){let G=W.node("required",{key:w.unit,value:T});Y[G.kind]=q$(Y[G.kind],G)}if(X.length)Y.index=W.node("index",{signature:X,value:T});return Y},ah=($)=>s($,"root")?$.expression:E$($),vk=($,T)=>`Key${T.length===1?"":"s"} ${T.map(ah).join(", ")} ${T.length===1?"does":"do"} not exist on ${$}`;var _U={...sR,alias:iY.implementation,domain:vz.implementation,unit:mZ.implementation,proto:tY.implementation,union:gZ.implementation,morph:yZ.implementation,intersection:fZ.implementation,divisor:JZ.implementation,pattern:SZ.implementation,predicate:LZ.implementation,required:uZ.implementation,optional:lY.implementation,index:cZ.implementation,sequence:pZ.implementation,structure:lZ.implementation};b.defaultConfig=wR(Object.assign(K$(_U,($,T)=>[$,T.defaults]),{jitless:QR(),clone:HR,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:U4.defaultConfig}));b.resolvedConfig=gY(b.defaultConfig,b.config);var Xk={...eR,alias:iY.Node,domain:vz.Node,unit:mZ.Node,proto:tY.Node,union:gZ.Node,morph:yZ.Node,intersection:fZ.Node,divisor:JZ.Node,pattern:SZ.Node,predicate:LZ.Node,required:uZ.Node,optional:lY.Node,index:cZ.Node,sequence:pZ.Node,structure:lZ.Node};class vU extends WZ{get[q6](){return"module"}}var rZ=($,T)=>new vU(K$($,(W,U)=>[W,s(U,"module")?rZ(U,T):T.bindReference(U)]));var sh=($)=>d$($)?$:("branches"in $)&&d$($.branches)?$.branches:void 0,eh=($,T)=>B(`Node of kind ${T} is not valid as a ${$} definition`),Ck=($)=>`#${$} duplicates public alias ${$}`,nZ={};b.ambient??={};var Sk,Bk="function $",$g=($)=>xk($,Ik($)),xk=($,T)=>{let W=T.write(Bk,4),U=T.compile()();for(let X of $){if(X.precompilation)continue;if(X.traverseAllows=U[`${X.id}Allows`].bind(U),X.isRoot()&&!X.allowsRequiresContext)X.allows=X.traverseAllows;if(X.traverseApply=U[`${X.id}Apply`].bind(U),U[`${X.id}Optimistic`])X.traverseOptimistic=U[`${X.id}Optimistic`].bind(U);X.precompilation=W}},Ik=($)=>new Vz().return($.reduce((T,W)=>{let U=new hY({kind:"Allows"}).indent();W.compile(U);let X=U.write(`${W.id}Allows`),Y=new hY({kind:"Apply"}).indent();W.compile(Y);let w=Y.write(`${W.id}Apply`),G=`${T}${X},
|
|
149
|
-
${
|
|
150
|
-
`;if(!W.hasKind("union"))return G;let H=new
|
|
150
|
+
Right: ${T}`;var Qf=D$({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:($)=>$ instanceof Date?$.toISOString():R1($)}},normalize:($)=>$,defaults:{description:($)=>M$($.unit),problem:({expected:$,actual:T})=>`${$===T?`must be reference equal to ${$} (serialized to the same value)`:`must be ${$} (was ${T})`}`},intersections:{unit:($,T)=>r.init("unit",$,T),...F0("unit",($,T)=>{if(T.allows($.unit))return $;let W=T.hasKind("intersection")?T.basis:T;if(W){let w=W.hasKind("domain")?W:y.intrinsic.object;if($.domain!==w.domain){let X=$.domain==="undefined"||$.domain==="null"||$.domain==="boolean"?$.domain:y.intrinsic[$.domain];return r.init("domain",X,w)}}return r.init("assignability",$,T.hasKind("intersection")?T.children.find((w)=>!w.allows($.unit)):T)})}});class O_ extends bW{compiledValue=this.json.unit;serializedValue=typeof this.unit==="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=F_(this.unit,this.serializedValue);compiledNegation=F_(this.unit,this.serializedValue,"negated");expression=M$(this.unit);domain=f4(this.unit);get defaultShortDescription(){return this.domain==="object"?d6.object:this.description}innerToJsonSchema($){return this.unit===null?{type:"null"}:y.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:$.fallback.unit({code:"unit",base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?($)=>$ instanceof Date&&$.toISOString()===this.compiledValue:Number.isNaN(this.unit)?($)=>Number.isNaN($):($)=>$===this.unit}var AZ={implementation:Qf,Node:O_},F_=($,T,W)=>{if($ instanceof Date){let w=`data instanceof Date && data.toISOString() === ${T}`;return W?`!(${w})`:w}if(Number.isNaN($))return`${W?"!":""}Number.isNaN(data)`;return`data ${W?"!":"="}== ${T}`};var Zf=D$({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:($,T)=>{let W=T.$.parseSchema($);if(!W.extends(y.intrinsic.key))return B(Kf(W.expression));let w=W.branches.filter((X)=>X.hasKind("unit"));if(w.length)return B(Vf(w.map((X)=>M$(X.unit))));return W}},value:{child:!0,parse:($,T)=>T.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`[${$.signature.expression}]: ${$.value.description}`},intersections:{index:($,T,W)=>{if($.signature.equals(T.signature)){let w=s$($.value,T.value,W),X=w instanceof r?y.intrinsic.never.internal:w;return W.$.node("index",{signature:$.signature,value:X})}if($.signature.extends(T.signature)&&$.value.subsumes(T.value))return T;if(T.signature.extends($.signature)&&T.value.subsumes($.value))return $;return null}}});class Q_ extends _1{impliedBasis=y.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=C$(this.value.flatRefs.map(($)=>m1([this.signature,...$.path],$.node)),m1([this.signature],this.value));traverseAllows=($,T)=>IW($).every((W)=>{if(this.signature.traverseAllows(W[0],T))return l6(W[0],()=>this.value.traverseAllows(W[1],T),T);return!0});traverseApply=($,T)=>{for(let W of IW($))if(this.signature.traverseAllows(W[0],T))l6(W[0],()=>this.value.traverseApply(W[1],T),T)};_transform($,T){T.path.push(this.signature);let W=super._transform($,T);return T.path.pop(),W}compile(){}}var EZ={implementation:Zf,Node:Q_},Vf=($)=>`Index keys ${$.join(", ")} should be specified as named props.`,Kf=($)=>`Indexed key definition '${$}' must be a string or symbol`;var Af=D$({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:($,T)=>T.$.parseSchema($)}},normalize:($)=>$,defaults:{description:($)=>`${$.compiledKey}: ${$.value.description}`,expected:($)=>$.missingValueDescription,actual:()=>"missing"},intersections:{required:yU,optional:yU}});class Z_ extends hU{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=fT(this.errorContext)}var MZ={implementation:Af,Node:Z_};var Ef=D$({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}},optionals:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}},defaultables:{child:($)=>$.map((T)=>T[0]),parse:($,T)=>{if($.length===0)return;return $.map((W)=>{let w=T.$.parseSchema(W[0]);return mU(w,W[1],null),[w,W[1]]})},serialize:($)=>$.map((T)=>[T[0].collapsibleJson,R1(T[1])])},variadic:{child:!0,parse:($,T)=>T.$.parseSchema($,T)},minVariadicLength:{parse:($)=>$===0?void 0:$},postfix:{child:!0,parse:($,T)=>{if($.length===0)return;return $.map((W)=>T.$.parseSchema(W))}}},normalize:($)=>{if(typeof $==="string")return{variadic:$};if("variadic"in $||"prefix"in $||"defaultables"in $||"optionals"in $||"postfix"in $||"minVariadicLength"in $){if($.postfix?.length){if(!$.variadic)return B(Lf);if($.optionals?.length||$.defaultables?.length)return B(NZ)}if($.minVariadicLength&&!$.variadic)return B("minVariadicLength may not be specified without a variadic element");return $}return{variadic:$}},reduce:($,T)=>{let W=$.minVariadicLength??0,w=$.prefix?.slice()??[],X=$.defaultables?.slice()??[],U=$.optionals?.slice()??[],Y=$.postfix?.slice()??[];if($.variadic){while(U.at(-1)?.equals($.variadic))U.pop();if(U.length===0&&X.length===0)while(w.at(-1)?.equals($.variadic))w.pop(),W++;while(Y[0]?.equals($.variadic))Y.shift(),W++}else if(U.length===0&&X.length===0)w.push(...Y.splice(0));if(W!==$.minVariadicLength||$.prefix&&$.prefix.length!==w.length)return T.node("sequence",{...$,prefix:w,defaultables:X,optionals:U,postfix:Y,minVariadicLength:W},{prereduced:!0})},defaults:{description:($)=>{if($.isVariadicOnly)return`${$.variadic.nestableExpression}[]`;return`[${$.tuple.map((W)=>W.kind==="defaultables"?`${W.node.nestableExpression} = ${M$(W.default)}`:W.kind==="optionals"?`${W.node.nestableExpression}?`:W.kind==="variadic"?`...${W.node.nestableExpression}[]`:W.node.expression).join(", ")}]`}},intersections:{sequence:($,T,W)=>{let w=dU({l:$.tuple,r:T.tuple,disjoint:new r,result:[],fixedVariants:[],ctx:W}),X=w.disjoint.length===0?[w,...w.fixedVariants]:w.fixedVariants;return X.length===0?w.disjoint:X.length===1?W.$.node("sequence",V_(X[0].result)):W.$.node("union",X.map((U)=>({proto:Array,sequence:V_(U.result)})))}}});class K_ extends _1{impliedBasis=y.intrinsic.Array.internal;tuple=Nf(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(($)=>{if($.kind==="defaultables"||$.kind==="optionals")return this.defaultablesAndOptionals.push($.node),!0;return $.kind==="prefix"});variadicOrPostfix=c0(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return rQ(this.flatRefs,this.prevariadic.flatMap(($,T)=>C$($.node.flatRefs.map((W)=>m1([`${T}`,...W.path],W.node)),m1([`${T}`],$.node)))),rQ(this.flatRefs,this.variadicOrPostfix.flatMap(($)=>C$($.flatRefs.map((T)=>m1([y.intrinsic.nonNegativeIntegerString.internal,...T.path],T.node)),m1([y.intrinsic.nonNegativeIntegerString.internal],$)))),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=Df(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Z4(this.defaultValueMorphs):void 0;elementAtIndex($,T){if(T<this.prevariadic.length)return this.tuple[T];let W=$.length-this.postfixLength;if(T>=W)return{kind:"postfix",node:this.postfix[T-W]};return{kind:"variadic",node:this.variadic??I$(`Unexpected attempt to access index ${T} on ${this}`)}}traverseAllows=($,T)=>{for(let W=0;W<$.length;W++)if(!this.elementAtIndex($,W).node.traverseAllows($[W],T))return!1;return!0};traverseApply=($,T)=>{let W=0;for(;W<$.length;W++)l6(W,()=>this.elementAtIndex($,W).node.traverseApply($[W],T),T)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile($){if(this.prefix)for(let[T,W]of this.prefix.entries())$.traverseKey(`${T}`,`data[${T}]`,W);for(let[T,W]of this.defaultablesAndOptionals.entries()){let w=`${T+this.prefixLength}`;$.if(`${w} >= ${$.data}.length`,()=>$.traversalKind==="Allows"?$.return(!0):$.return()),$.traverseKey(w,`data[${w}]`,W)}if(this.variadic){if(this.postfix)$.const("firstPostfixIndex",`${$.data}.length${this.postfix?`- ${this.postfix.length}`:""}`);if($.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>$.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix)for(let[T,W]of this.postfix.entries()){let w=`firstPostfixIndex + ${T}`;$.traverseKey(w,`data[${w}]`,W)}}if($.traversalKind==="Allows")$.return(!0)}_transform($,T){T.path.push(y.intrinsic.nonNegativeIntegerString.internal);let W=super._transform($,T);return T.path.pop(),W}expression=this.description;reduceJsonSchema($,T){if(this.prevariadic.length)$.prefixItems=this.prevariadic.map((W)=>{let w=W.node.toJsonSchemaRecurse(T);if(W.kind==="defaultables"){let X=typeof W.default==="function"?W.default():W.default;w.default=y.intrinsic.jsonData.allows(X)?X:T.fallback.defaultValue({code:"defaultValue",base:w,value:X})}return w});if(this.minLength)$.minItems=this.minLength;if(this.variadic){let W=Object.assign($,{items:this.variadic.toJsonSchemaRecurse(T)});if(this.maxLength)W.maxItems=this.maxLength;if(this.postfix){let w=this.postfix.map((X)=>X.toJsonSchemaRecurse(T));$=T.fallback.arrayPostfix({code:"arrayPostfix",base:W,elements:w})}}else $.items=!1,delete $.maxItems;return $}}var Mf={},Df=($)=>{if(!$.defaultables)return[];let T=[],W="[",w=$.prefixLength+$.defaultablesLength-1;for(let X=$.prefixLength;X<=w;X++){let[U,Y]=$.defaultables[X-$.prefixLength];T.push(OZ(X,U,Y)),W+=`${X}: ${U.id} = ${R1(Y)}, `}return W+="]",Mf[W]??=T},DZ={implementation:Ef,Node:K_},Nf=($)=>{let T=[];if($.prefix)for(let W of $.prefix)T.push({kind:"prefix",node:W});if($.defaultables)for(let[W,w]of $.defaultables)T.push({kind:"defaultables",node:W,default:w});if($.optionals)for(let W of $.optionals)T.push({kind:"optionals",node:W});if($.variadic)T.push({kind:"variadic",node:$.variadic});if($.postfix)for(let W of $.postfix)T.push({kind:"postfix",node:W});return T},V_=($)=>$.reduce((T,W)=>{if(W.kind==="variadic")T.variadic=W.node;else if(W.kind==="defaultables")T.defaultables=C$(T.defaultables,[[W.node,W.default]]);else T[W.kind]=C$(T[W.kind],W.node);return T},{}),NZ="A postfix required element cannot follow an optional or defaultable element",Lf="A postfix element requires a variadic element",dU=($)=>{let[T,...W]=$.l,[w,...X]=$.r;if(!T||!w)return $;let U=W.at(-1)?.kind==="postfix",Y=X.at(-1)?.kind==="postfix",G=T.kind==="prefix"||w.kind==="prefix"?"prefix":T.kind==="postfix"||w.kind==="postfix"?"postfix":T.kind==="variadic"&&w.kind==="variadic"?"variadic":U||Y?"prefix":T.kind==="defaultables"||w.kind==="defaultables"?"defaultables":"optionals";if(T.kind==="prefix"&&w.kind==="variadic"&&Y){let O=dU({...$,fixedVariants:[],r:X.map((Q)=>({...Q,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}else if(w.kind==="prefix"&&T.kind==="variadic"&&U){let O=dU({...$,fixedVariants:[],l:W.map((Q)=>({...Q,kind:"prefix"}))});if(O.disjoint.length===0)$.fixedVariants.push(O)}let H=s$(T.node,w.node,$.ctx);if(H instanceof r)if(G==="prefix"||G==="postfix")$.disjoint.push(...H.withPrefixKey(G==="prefix"?$.result.length:`-${W.length+1}`,"required")),$.result=[...$.result,{kind:G,node:y.intrinsic.never.internal}];else if(G==="optionals"||G==="defaultables")return $;else return dU({...$,fixedVariants:[],l:W.map((O)=>({...O,kind:"prefix"})),r:W.map((O)=>({...O,kind:"prefix"}))});else if(G==="defaultables"){if(T.kind==="defaultables"&&w.kind==="defaultables"&&T.default!==w.default)B(FZ(T.default,w.default));$.result=[...$.result,{kind:G,node:H,default:T.kind==="defaultables"?T.default:w.kind==="defaultables"?w.default:I$(`Unexpected defaultable intersection from ${T.kind} and ${w.kind} elements.`)}]}else $.result=[...$.result,{kind:G,node:H}];let z=$.l.length,F=$.r.length;if(T.kind!=="variadic"||z>=F&&(w.kind==="variadic"||F===1))$.l=W;if(w.kind!=="variadic"||F>=z&&(T.kind==="variadic"||z===1))$.r=X;return dU($)};var M_=($)=>(T)=>{if(T.props.length||T.index){let W=T.index?.map((X)=>X[$])??[];for(let X of T.props)W.push(X[$]);if(T.undeclared)W.push(`+ (undeclared): ${T.undeclared}`);let w=`{ ${W.join(", ")} }`;return T.sequence?`${w} & ${T.sequence.description}`:w}return T.sequence?.description??"{}"},Jf=M_("description"),Rf=M_("expression"),A_=($,T,W)=>{let w=$.required?"required":"optional";if(!T.signature.allows($.key))return null;let X=r6($.value,T.value,W);if(X instanceof r)return w==="optional"?W.node("optional",{key:$.key,value:y.intrinsic.never.internal}):X.withPrefixKey($.key,$.kind);return null},_f=D$({kind:"structure",hasAssociatedError:!1,normalize:($)=>$,applyConfig:($,T)=>{if(!$.undeclared&&T.onUndeclaredKey!=="ignore")return{...$,undeclared:T.onUndeclaredKey};return $},keys:{required:{child:!0,parse:U6("required"),reduceIo:($,T,W)=>{T.required=C$(T.required,W.map((w)=>w[$]));return}},optional:{child:!0,parse:U6("optional"),reduceIo:($,T,W)=>{if($==="in"){T.optional=W.map((w)=>w.in);return}for(let w of W)T[w.outProp.kind]=C$(T[w.outProp.kind],w.outProp.out)}},index:{child:!0,parse:U6("index")},sequence:{child:!0,parse:U6("sequence")},undeclared:{parse:($)=>$==="ignore"?void 0:$,reduceIo:($,T,W)=>{if(W!=="delete")return;if($==="in")delete T.undeclared;else T.undeclared="reject"}}},defaults:{description:Jf},intersections:{structure:($,T,W)=>{let w={...$.inner},X={...T.inner},U=new r;if($.undeclared){let H=$.keyof();for(let z of T.requiredKeys)if(!H.allows(z))U.add("presence",y.intrinsic.never.internal,T.propsByKey[z].value,{path:[z]});if(X.optional)X.optional=X.optional.filter((z)=>H.allows(z.key));if(X.index)X.index=X.index.flatMap((z)=>{if(z.signature.extends(H))return z;let F=r6(H,z.signature,W.$);if(F instanceof r)return[];let O=Fz(F,z.value,W.$);if(O.required)X.required=c0(X.required,O.required);if(O.optional)X.optional=c0(X.optional,O.optional);return O.index??[]})}if(T.undeclared){let H=T.keyof();for(let z of $.requiredKeys)if(!H.allows(z))U.add("presence",$.propsByKey[z].value,y.intrinsic.never.internal,{path:[z]});if(w.optional)w.optional=w.optional.filter((z)=>H.allows(z.key));if(w.index)w.index=w.index.flatMap((z)=>{if(z.signature.extends(H))return z;let F=r6(H,z.signature,W.$);if(F instanceof r)return[];let O=Fz(F,z.value,W.$);if(O.required)w.required=c0(w.required,O.required);if(O.optional)w.optional=c0(w.optional,O.optional);return O.index??[]})}let Y={};if($.undeclared||T.undeclared)Y.undeclared=$.undeclared==="reject"||T.undeclared==="reject"?"reject":"delete";let G=wX({kind:"structure",baseInner:Y,l:UX(w),r:UX(X),roots:[],ctx:W});if(G instanceof r)U.push(...G);if(U.length)return U;return G}},reduce:($,T)=>{if($.index){if(!($.required||$.optional))return;let W=!1,w=$.required??[],X=$.optional??[],U=[...X];for(let Y of $.index){for(let G of w){let H=A_(G,Y,T);if(H instanceof r)return H}for(let[G,H]of X.entries()){let z=A_(H,Y,T);if(z instanceof r)return z;if(z===null)continue;U[G]=z,W=!0}}if(W)return T.node("structure",{...$,optional:U},{prereduced:!0})}}});class D_ extends _1{impliedBasis=y.intrinsic.object.internal;impliedSiblings=this.children.flatMap(($)=>$.impliedSiblings??[]);props=c0(this.required,this.optional);propsByKey=E$(this.props,($,T)=>[T.key,T]);propsByKeyReference=Z4(this.propsByKey);expression=Rf(this);requiredKeys=this.required?.map(($)=>$.key)??[];optionalKeys=this.optional?.map(($)=>$.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let $=this.$.units(this.literalKeys).branches;if(this.index)for(let{signature:T}of this.index)$=$.concat(T.branches);return this._keyof=this.$.node("union",$)}map($){return this.$.node("structure",this.props.flatMap($).reduce((T,W)=>{let w=this.propsByKey[W.key];if(a$(W)){if(W.kind!=="required"&&W.kind!=="optional")return B(`Map result must have kind "required" or "optional" (was ${W.kind})`);return T[W.kind]=C$(T[W.kind],W),T}let X=W.kind??w?.kind??"required",U=E$(W,(Y,G)=>(Y in gU.implementation.keys)?[Y,G]:[]);return T[X]=C$(T[X],this.$.node(X,U)),T},{}))}assertHasKeys($){let T=$.filter((W)=>!cU(W,this.keyof()));if(T.length)return B(E_(this.expression,T))}get($,...T){let W,w=!1,X=Pf($);if((typeof X==="string"||typeof X==="symbol")&&this.propsByKey[X])W=this.propsByKey[X].value,w=this.propsByKey[X].required;if(this.index){for(let Y of this.index)if(cU(X,Y.signature))W=W?.and(Y.value)??Y.value}if(this.sequence&&cU(X,y.intrinsic.nonNegativeIntegerString))if(W$(X,"root")){if(this.sequence.variadic)W=W?.and(this.sequence.element)??this.sequence.element}else{let Y=Number.parseInt(X);if(Y<this.sequence.prevariadic.length){let G=this.sequence.prevariadic[Y].node;W=W?.and(G)??G,w||=Y<this.sequence.prefixLength}else if(this.sequence.variadic){let G=this.$.node("union",this.sequence.variadicOrPostfix);W=W?.and(G)??G}}if(!W){if(this.sequence?.variadic&&W$(X,"root")&&X.extends(y.intrinsic.number))return B(Cf(X.expression,this.sequence.expression));return B(E_(this.expression,[X]))}let U=W.get(...T);return w?U:U.or(y.intrinsic.undefined)}pick(...$){return this.assertHasKeys($),this.$.node("structure",this.filterKeys("pick",$))}omit(...$){return this.assertHasKeys($),this.$.node("structure",this.filterKeys("omit",$))}optionalize(){let{required:$,...T}=this.inner;return this.$.node("structure",{...T,optional:this.props.map((W)=>W.hasKind("required")?this.$.node("optional",W.inner):W)})}require(){let{optional:$,...T}=this.inner;return this.$.node("structure",{...T,required:this.props.map((W)=>W.hasKind("optional")?{key:W.key,value:W.value}:W)})}merge($){let T=this.filterKeys("omit",[$.keyof()]);if($.required)T.required=C$(T.required,$.required);if($.optional)T.optional=C$(T.optional,$.optional);if($.index)T.index=C$(T.index,$.index);if($.sequence)T.sequence=$.sequence;if($.undeclared)T.undeclared=$.undeclared;else delete T.undeclared;return this.$.node("structure",T)}filterKeys($,T){let W=e9(this.inner),w=(X)=>{let U=T.some((Y)=>cU(X,Y));return $==="pick"?U:!U};if(W.required)W.required=W.required.filter((X)=>w(X.key));if(W.optional)W.optional=W.optional.filter((X)=>w(X.key));if(W.index)W.index=W.index.filter((X)=>w(X.signature));return W}traverseAllows=($,T)=>this._traverse("Allows",$,T);traverseApply=($,T)=>this._traverse("Apply",$,T);_traverse=($,T,W)=>{let w=W?.currentErrorCount??0;for(let X=0;X<this.props.length;X++)if($==="Allows"){if(!this.props[X].traverseAllows(T,W))return!1}else if(this.props[X].traverseApply(T,W),W.failFast&&W.currentErrorCount>w)return!1;if(this.sequence){if($==="Allows"){if(!this.sequence.traverseAllows(T,W))return!1}else if(this.sequence.traverseApply(T,W),W.failFast&&W.currentErrorCount>w)return!1}if(this.index||this.undeclared==="reject"){let X=Object.keys(T);X.push(...Object.getOwnPropertySymbols(T));for(let U=0;U<X.length;U++){let Y=X[U];if(this.index){for(let G of this.index)if(G.signature.traverseAllows(Y,W)){if($==="Allows"){if(!l6(Y,()=>G.value.traverseAllows(T[Y],W),W))return!1}else if(l6(Y,()=>G.value.traverseApply(T[Y],W),W),W.failFast&&W.currentErrorCount>w)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(Y)){if($==="Allows")return!1;if(W.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[Y],meta:this.meta}),W.failFast)return!1}}}if(this.structuralMorph&&W&&!W.hasError())W.queueMorphs([this.structuralMorph]);return!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(($)=>$.hasDefault())??[])}declaresKey=($)=>($ in this.propsByKey)||this.index?.some((T)=>T.signature.allows($))||this.sequence!==void 0&&y.intrinsic.nonNegativeIntegerString.allows($);_compileDeclaresKey($){let T=[];if(this.props.length)T.push(`k in ${this.propsByKeyReference}`);if(this.index)for(let W of this.index)T.push($.invoke(W.signature,{kind:"Allows",arg:"k"}));if(this.sequence)T.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)");return T.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",vf(this))}structuralMorphRef=this.structuralMorph&&Z4(this.structuralMorph);compile($){if($.traversalKind==="Apply")$.initializeErrorCount();for(let T of this.props)if($.check(T),$.traversalKind==="Apply")$.returnIfFailFast();if(this.sequence){if($.check(this.sequence),$.traversalKind==="Apply")$.returnIfFailFast()}if(this.index||this.undeclared==="reject")$.const("keys","Object.keys(data)"),$.line("keys.push(...Object.getOwnPropertySymbols(data))"),$.for("i < keys.length",()=>this.compileExhaustiveEntry($));if($.traversalKind==="Allows")return $.return(!0);if(this.structuralMorphRef)$.if("ctx && !ctx.hasError()",()=>{return $.line("ctx.queueMorphs(["),qf($,this),$.line("])")})}compileExhaustiveEntry($){if($.const("k","keys[i]"),this.index)for(let T of this.index)$.if(`${$.invoke(T.signature,{arg:"k",kind:"Allows"})}`,()=>$.traverseKey("k","data[k]",T.value));if(this.undeclared==="reject")$.if(`!(${this._compileDeclaresKey($)})`,()=>{if($.traversalKind==="Allows")return $.return(!1);return $.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>$.return())});return $}reduceJsonSchema($,T){switch($.type){case"object":return this.reduceObjectJsonSchema($,T);case"array":let W=this.sequence?.reduceJsonSchema($,T)??$;if(this.props.length||this.index)return T.fallback.arrayObject({code:"arrayObject",base:W,object:this.reduceObjectJsonSchema({type:"object"},T)});return W;default:return w4.throwInternalOperandError("structure",$)}}reduceObjectJsonSchema($,T){if(this.props.length){$.properties={};for(let W of this.props){let w=W.value.toJsonSchemaRecurse(T);if(typeof W.key==="symbol"){T.fallback.symbolKey({code:"symbolKey",base:$,key:W.key,value:w,optional:W.optional});continue}if(W.hasDefault()){let X=typeof W.default==="function"?W.default():W.default;w.default=y.intrinsic.jsonData.allows(X)?X:T.fallback.defaultValue({code:"defaultValue",base:w,value:X})}$.properties[W.key]=w}if(this.requiredKeys.length&&$.properties)$.required=this.requiredKeys.filter((W)=>typeof W==="string"&&(W in $.properties))}if(this.index)for(let W of this.index){let w=W.value.toJsonSchemaRecurse(T);if(W.signature.equals(y.intrinsic.string)){$.additionalProperties=w;continue}for(let X of W.signature.branches){if(!X.extends(y.intrinsic.string)){$=T.fallback.symbolKey({code:"symbolKey",base:$,key:null,value:w,optional:!1});continue}let U={type:"string"};if(X.hasKind("morph"))U=T.fallback.morph({code:"morph",base:X.in.toJsonSchemaRecurse(T),out:X.out.toJsonSchemaRecurse(T)});if(!X.hasKind("intersection"))return I$(`Unexpected index branch kind ${X.kind}.`);let{pattern:Y}=X.inner;if(Y){let G=Object.assign(U,{pattern:Y[0].rule});for(let H=1;H<Y.length;H++)U=T.fallback.patternIntersection({code:"patternIntersection",base:G,pattern:Y[H].rule});$.patternProperties??={},$.patternProperties[G.pattern]=w}}}if(this.undeclared&&!$.additionalProperties)$.additionalProperties=!1;return $}}var LZ={},kf=($)=>{let T="";for(let W=0;W<$.defaultable.length;W++)T+=$.defaultable[W].defaultValueMorphRef;if($.sequence?.defaultValueMorphsReference)T+=$.sequence?.defaultValueMorphsReference;if($.undeclared==="delete"){if(T+="delete !(",$.required)for(let W of $.required)T+=W.compiledKey+" | ";if($.optional)for(let W of $.optional)T+=W.compiledKey+" | ";if($.index)for(let W of $.index)T+=W.signature.id+" | ";if($.sequence)if($.sequence.maxLength===null)T+=G$.nonNegativeIntegerString.id;else for(let W=0;W<$.sequence.tuple.length;W++)T+=W+" | ";T+=")"}return T},vf=($)=>{let T=kf($);if(!T)return;if(LZ[T])return LZ[T];let W=(w,X)=>{for(let U=0;U<$.defaultable.length;U++)if(!($.defaultable[U].key in w))$.defaultable[U].defaultValueMorph(w,X);if($.sequence?.defaultables)for(let U=w.length-$.sequence.prefixLength;U<$.sequence.defaultables.length;U++)$.sequence.defaultValueMorphs[U](w,X);if($.undeclared==="delete"){for(let U in w)if(!$.declaresKey(U))delete w[U]}return w};return LZ[T]=W},qf=($,T)=>{let w=`(data${T.defaultable.some((X)=>X.defaultValueMorph.length===2)||T.sequence?.defaultValueMorphs.some((X)=>X.length===2)?", ctx":""})`;return $.block(`${w} => `,(X)=>{for(let U=0;U<T.defaultable.length;U++){let{serializedKey:Y,defaultValueMorphRef:G}=T.defaultable[U];X.if(`!(${Y} in data)`,(H)=>H.line(`${G}${w}`))}if(T.sequence?.defaultables)X.for(`i < ${T.sequence.defaultables.length}`,(U)=>U.set("data[i]",5),`data.length - ${T.sequence.prefixLength}`);if(T.undeclared==="delete")X.forIn("data",(U)=>U.if(`!(${T._compileDeclaresKey(U)})`,(Y)=>Y.line("delete data[k]")));return X.return("data")})},JZ={implementation:_f,Node:D_},Pf=($)=>{if(W$($,"root")&&$.hasKind("unit"))$=$.unit;if(typeof $==="number")$=`${$}`;return $},Cf=($,T)=>`${$} is not allowed as an array index on ${T}. Use the 'nonNegativeIntegerString' keyword instead.`,Fz=($,T,W)=>{let[w,X]=uJ($.branches,(Y)=>Y.hasKind("unit"));if(!w.length)return{index:W.node("index",{signature:$,value:T})};let U={};for(let Y of w){let G=W.node("required",{key:Y.unit,value:T});U[G.kind]=C$(U[G.kind],G)}if(X.length)U.index=W.node("index",{signature:X,value:T});return U},Sf=($)=>W$($,"root")?$.expression:M$($),E_=($,T)=>`Key${T.length===1?"":"s"} ${T.map(Sf).join(", ")} ${T.length===1?"does":"do"} not exist on ${$}`;var GX={...pR,alias:uU.implementation,domain:Hz.implementation,unit:AZ.implementation,proto:pU.implementation,union:KZ.implementation,morph:ZZ.implementation,intersection:QZ.implementation,divisor:sQ.implementation,pattern:YZ.implementation,predicate:aQ.implementation,required:MZ.implementation,optional:gU.implementation,index:EZ.implementation,sequence:DZ.implementation,structure:JZ.implementation};y.defaultConfig=aJ(Object.assign(E$(GX,($,T)=>[$,T.defaults]),{jitless:XR(),clone:$R,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:w4.defaultConfig}));y.resolvedConfig=IU(y.defaultConfig,y.config);var iR={...dR,alias:uU.Node,domain:Hz.Node,unit:AZ.Node,proto:pU.Node,union:KZ.Node,morph:ZZ.Node,intersection:QZ.Node,divisor:sQ.Node,pattern:YZ.Node,predicate:aQ.Node,required:MZ.Node,optional:gU.Node,index:EZ.Node,sequence:DZ.Node,structure:JZ.Node};class FX extends IQ{get[C6](){return"module"}}var RZ=($,T)=>new FX(E$($,(W,w)=>[W,W$(w,"module")?RZ(w,T):T.bindReference(w)]));var jf=($)=>o$($)?$:("branches"in $)&&o$($.branches)?$.branches:void 0,If=($,T)=>B(`Node of kind ${T} is not valid as a ${$} definition`),N_=($)=>`#${$} duplicates public alias ${$}`,_Z={};y.ambient??={};var L_,R_="function $",Bf=($)=>__($,k_($)),__=($,T)=>{let W=T.write(R_,4),w=T.compile()();for(let X of $){if(X.precompilation)continue;if(X.traverseAllows=w[`${X.id}Allows`].bind(w),X.isRoot()&&!X.allowsRequiresContext)X.allows=X.traverseAllows;if(X.traverseApply=w[`${X.id}Apply`].bind(w),w[`${X.id}Optimistic`])X.traverseOptimistic=w[`${X.id}Optimistic`].bind(w);X.precompilation=W}},k_=($)=>new s9().return($.reduce((T,W)=>{let w=new jU({kind:"Allows"}).indent();W.compile(w);let X=w.write(`${W.id}Allows`),U=new jU({kind:"Apply"}).indent();W.compile(U);let Y=U.write(`${W.id}Apply`),G=`${T}${X},
|
|
151
|
+
${Y},
|
|
152
|
+
`;if(!W.hasKind("union"))return G;let H=new jU({kind:"Allows",optimistic:!0}).indent();W.compile(H);let z=H.write(`${W.id}Optimistic`);return`${G}${z},
|
|
151
153
|
`},`{
|
|
152
|
-
`)+"}");class Pz{config;resolvedConfig;name;get[q6](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor($,T){if(this.config=gY(b.config,T),this.resolvedConfig=gY(b.resolvedConfig,T),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(nZ).length}`,this.name in nZ)B(`A Scope already named ${this.name} already exists`);nZ[this.name]=this;let W=Object.entries($).map((U)=>this.preparseOwnAliasEntry(...U));for(let[U,X]of W){let Y=U;if(U[0]==="#"){if(Y=U.slice(1),Y in this.aliases)B(Ck(Y));this.aliases[Y]=X}else{if(Y in this.aliases)B(Ck(U));this.aliases[Y]=X,this.exportedNames.push(Y)}if(!s(X,"module")&&!s(X,"generic")&&!hT(X)){let w=this.preparseOwnDefinitionFormat(X,{alias:Y});this.resolutions[Y]=s(w,"root")?this.bindReference(w):this.createParseContext(w).id}}Sk??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[Sk.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=b.intrinsic?K$(b.intrinsic,(U,X)=>U.startsWith("json")?[]:[U,this.bindReference(X)]):{}}cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get internal(){return this}_json;get json(){if(!this._json)this.export();return this._json}defineSchema($){return $}generic=(...$)=>{let T=this;return(W,U)=>new pT($,U?new Nz(W):W,T,T,U??null)};units=($,T)=>{let W=[];for(let X of $)if(!W.includes(X))W.push(X);let U=W.map((X)=>this.node("unit",{unit:X},T));return this.node("union",U,{...T,prereduced:!0})};lazyResolutions=[];lazilyResolve($,T){let W=this.node("alias",{reference:T??"synthetic",resolve:$},{prereduced:!0});if(!this.resolved)this.lazyResolutions.push(W);return W}schema=($,T)=>this.finalize(this.parseSchema($,T));parseSchema=($,T)=>this.node(pY($),$,T);preparseNode($,T,W){let U=typeof $==="string"?$:pY(T,$);if(t$(T)&&T.kind===U)return T;if(U==="alias"&&!W?.prereduced){let{reference:w}=iY.implementation.normalize(T,this);if(w.startsWith("$")){let G=this.resolveRoot(w.slice(1));T=G,U=G.kind}}else if(U==="union"&&p6(T,"object")){let w=sh(T);if(w?.length===1)T=w[0],U=pY(T)}if(t$(T)&&T.kind===U)return T;let Y=_U[U].normalize?.(T,this)??T;if(t$(Y))return Y.kind===U?Y:eh(U,Y.kind);return{...W,$:this,kind:U,def:Y,prefix:W.alias??U}}bindReference($){let T;if(t$($))T=$.$===this?$:new $.constructor($.attachments,this);else T=$.$===this?$:new pT($.params,$.bodyDef,$.$,this,$.hkt);if(!this.resolved)Object.assign(this.referencesById,T.referencesById);return T}resolveRoot($){return this.maybeResolveRoot($)??B(aZ($))}maybeResolveRoot($){let T=this.maybeResolve($);if(s(T,"generic"))return;return T}maybeResolveSubalias($){return iZ(this.aliases,$)??iZ(this.ambient,$)}get ambient(){return b.ambient}maybeResolve($){let T=this.resolutions[$];if(T){if(typeof T!=="string")return this.bindReference(T);let U=P6[T];if(s(U,"root"))return this.resolutions[$]=U;if(s(U,"context")){if(U.phase==="resolving")return this.node("alias",{reference:`$${$}`},{prereduced:!0});if(U.phase==="resolved")return S$(`Unexpected resolved context for was uncached by its scope: ${E$(U)}`);U.phase="resolving";let X=this.bindReference(this.parseOwnDefinitionFormat(U.def,U));return U.phase="resolved",P6[X.id]=X,P6[U.id]=X,this.resolutions[$]=X}return S$(`Unexpected nodesById entry for ${T}: ${E$(U)}`)}let W=this.aliases[$]??this.ambient?.[$];if(!W)return this.maybeResolveSubalias($);if(W=this.normalizeRootScopeValue(W),s(W,"generic"))return this.resolutions[$]=this.bindReference(W);if(s(W,"module")){if(!W.root)B(yk($));return this.resolutions[$]=this.bindReference(W.root)}return this.resolutions[$]=this.parse(W,{alias:$})}createParseContext($){let T=$.id??jZ($.prefix);return P6[T]=Object.assign($,{[q6]:"context",$:this,id:T,phase:"unresolved"})}traversal($){return new u1($,this.resolvedConfig)}import(...$){return new vU(K$(this.export(...$),(T,W)=>[`#${T}`,W]))}precompilation;_exportedResolutions;_exports;export(...$){if(!this._exports){this._exports={};for(let W of this.exportedNames){let U=this.aliases[W];this._exports[W]=s(U,"module")?rZ(U,this):jk(this.maybeResolve(W))}for(let W of this.lazyResolutions)W.resolution;if(this._exportedResolutions=fk(this,this._exports),this._json=bk(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let W=Ik(this.references);this.precompilation=W.write(Bk,4),xk(this.references,W)}this.resolved=!0}let T=$.length?$:this.exportedNames;return new vU(K$(T,(W,U)=>[U,this._exports[U]]))}resolve($){return this.export()[$]}node=($,T,W={})=>{let U=this.preparseNode($,T,W);if(t$(U))return this.bindReference(U);let X=this.createParseContext(U),Y=BZ(X),w=this.bindReference(Y);return P6[X.id]=w};parse=($,T={})=>this.finalize(this.parseDefinition($,T));parseDefinition($,T={}){if(s($,"root"))return this.bindReference($);let W=this.preparseOwnDefinitionFormat($,T);if(s(W,"root"))return this.bindReference(W);let U=this.createParseContext(W);P6[U.id]=U;let X=this.bindReference(this.parseOwnDefinitionFormat($,U));if(X.isCyclic)X=Uk(X,U.id);return P6[U.id]=X,X}finalize($){if(jk($),!$.precompilation&&!this.resolvedConfig.jitless)$g($.references);return $}}class tZ extends Pz{parseOwnDefinitionFormat($,T){return BZ(T)}preparseOwnDefinitionFormat($,T){return this.preparseNode(pY($),$,T)}preparseOwnAliasEntry($,T){return[$,T]}normalizeRootScopeValue($){return $}}var jk=($)=>{let T=$.references.filter((W)=>W.hasKind("alias"));for(let W of T){Object.assign(W.referencesById,W.resolution.referencesById);for(let U of $.references)if(W.id in U.referencesById)Object.assign(U.referencesById,W.referencesById)}return $},bk=($)=>K$($,(T,W)=>[T,s(W,"root")||s(W,"generic")?W.json:s(W,"module")?bk(W):S$(`Unexpected resolution ${E$(W)}`)]),iZ=($,T)=>{let W=T.indexOf(".");if(W===-1)return;let U=T.slice(0,W),X=$[U];if(X===void 0)return;if(!s(X,"module"))return B(Tg(U));let Y=T.slice(W+1),w=X[Y];if(w===void 0)return iZ(X,Y);if(s(w,"root")||s(w,"generic"))return w;if(s(w,"module"))return w.root??B(yk(T));S$(`Unexpected resolution for alias '${T}': ${E$(w)}`)},Cz=($,T)=>new tZ($,T),sY=new tZ({});var fk=($,T)=>{let W={};for(let U in T){let X=T[U];if(s(X,"module")){let Y=fk($,X),w=K$(Y,(G,H)=>[`${U}.${G}`,H]);Object.assign(W,w)}else if(s(X,"root")||s(X,"generic"))W[U]=X;else S$(`Unexpected scope resolution ${E$(X)}`)}return W},aZ=($)=>`'${$}' is unresolvable`,Tg=($)=>`'${$}' must reference a module to be accessed using dot syntax`,yk=($)=>`Reference to submodule '${$}' must specify an alias`;sY.export();var{schema:f$,node:qU,defineSchema:$G$,generic:P1}=sY;var sZ="^(?:0|[1-9]\\d*)$",Wg=new RegExp(sZ),UG$=Z4(Wg);var hk=Cz({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();b.intrinsic={...hk};var gk=Cz({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:sZ}},{prereducedAliases:!0}).export();Object.assign(b.intrinsic,gk);var Ug=Cz({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),X$={...hk,...gk,...Ug,emptyStructure:qU("structure",{},{prereduced:!0})};b.intrinsic={...X$};var ck=($)=>typeof $==="string"&&$[0]==="d"&&($[1]==="'"||$[1]==='"')&&$.at(-1)===$[1],mk=($)=>$.toString()!=="Invalid Date",uk=($)=>$.slice(2,-1),eZ=($)=>`'${$}' could not be parsed by the Date constructor`,pk=($,T)=>Xg($,T),Xg=($,T)=>{let W=new Date($);if(mk(W))return W;let U=LR($);if(U!==void 0){let X=new Date(U);if(mk(X))return X}return T?B(T===!0?eZ($):T):void 0};var $D=($,T)=>{let W=$.scanner.shiftUntil(Yg[ok[T]]);if($.scanner.lookahead==="")return $.error(Gg(W,T));if($.scanner.shift(),T==="/"){try{new RegExp(W)}catch(U){B(String(U))}$.root=$.ctx.$.node("intersection",{domain:"string",pattern:W},{prereduced:!0})}else if(I4(T,TD))$.root=$.ctx.$.node("unit",{unit:W});else{let U=pk(W,eZ(W));$.root=$.ctx.$.node("unit",{meta:W,unit:U})}},TD={"'":1,'"':1},dk={"/":1,"'":1,'"':1},ok={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},Yg={"'":($)=>$.lookahead==="'",'"':($)=>$.lookahead==='"',"/":($)=>$.lookahead==="/"},wg={'"':"double-quote","'":"single-quote","/":"forward slash"},Gg=($,T)=>`${T}${$} requires a closing ${wg[ok[T]]}`;var lk=($)=>`Private type references should not include '#'. Use '${$}' instead.`,Sz="Optional definitions like 'string?' are only valid as properties in an object or tuple",jz="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";var rk={">":!0,">=":!0},nk={"<":!0,"<=":!0};var PU={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},ik=($)=>`Unmatched )${$===""?"":` before ${$}`}`,Bz=($)=>`Missing ${$}`,tk=($,T)=>`Left bounds are only valid when paired with right bounds (try ...${T}${$})`,xz=($)=>`Left-bounded expressions must specify their limits using < or <= (was ${$})`,ak=($,T,W,U)=>`An expression may have at most one left bound (parsed ${$}${PU[T]}, ${W}${PU[U]})`;var sk=($,T,W)=>ek($,T,W,[]),ek=($,T,W,U)=>{let X=W.parseUntilFinalizer();if(U.push(X.root),X.finalizer===">"){if(U.length!==T.params.length)return W.error(WD($,T.names,U.map((Y)=>Y.expression)));return U}if(X.finalizer===",")return ek($,T,W,U);return X.error(Bz(">"))},WD=($,T,W)=>`${$}<${T.join(", ")}> requires exactly ${T.length} args (got ${W.length}${W.length===0?"":`: ${W.join(", ")}`})`;var UD=($)=>{let T=$.scanner.shiftUntilNextTerminator();if(T==="keyof")$.addPrefix("keyof");else $.root=Hg($,T)},zg=($,T,W)=>{if(W.scanner.shiftUntilNonWhitespace(),W.scanner.shift()!=="<")return W.error(WD($,T.names,[]));let X=sk($,T,W);return T(...X)},Hg=($,T)=>Fg($,T)??Og($,T)??$.error(T===""?$.scanner.lookahead==="#"?lk($.shiftedByOne().scanner.shiftUntilNextTerminator()):XD($):aZ(T)),Fg=($,T)=>{if($.ctx.args?.[T]){let U=$.ctx.args[T];if(typeof U!=="string")return U;return $.ctx.$.node("alias",{reference:U},{prereduced:!0})}let W=$.ctx.$.maybeResolve(T);if(s(W,"root"))return W;if(W===void 0)return;if(s(W,"generic"))return zg(T,W,$);return B(`Unexpected resolution ${E$(W)}`)},Og=($,T)=>{let W=JR(T);if(W!==void 0)return $.ctx.$.node("unit",{unit:W});let U=RR(T);if(U!==void 0)return $.ctx.$.node("unit",{unit:U})},XD=($)=>{let T=$.previousOperator();return T?YD(T,$.scanner.unscanned):Qg($.scanner.unscanned)},YD=($,T="")=>`Token '${$}' requires a right operand${T?` before '${T}'`:""}`,Qg=($)=>`Expected an expression${$?` before '${$}'`:""}`;var wD=($)=>$.scanner.lookahead===""?$.error(XD($)):$.scanner.lookahead==="("?$.shiftedByOne().reduceGroupOpen():$.scanner.lookaheadIsIn(dk)?$D($,$.scanner.shift()):$.scanner.lookaheadIsIn(gT)?wD($.shiftedByOne()):$.scanner.lookahead==="d"?$.scanner.nextLookahead in TD?$D($,`${$.scanner.shift()}${$.scanner.shift()}`):UD($):UD($);class $T extends OZ{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in $T.terminatingChars))}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...gT};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=($,T)=>$===">"?T[0]==="="?T[1]==="=":T.trimStart()===""||I4(T.trimStart()[0],$T.terminatingChars):$==="="?T[0]!=="=":$===","||$==="?"}var Tv=($,T)=>{let W=Zg($,T);if($.root.hasKind("unit")){if(typeof $.root.unit==="number"){$.reduceLeftBound($.root.unit,W),$.unsetRoot();return}if($.root.unit instanceof Date){let U=`d'${$.root.description??$.root.unit.toISOString()}'`;$.unsetRoot(),$.reduceLeftBound(U,W);return}}return Vg($,W)},Wv={"<":1,">":1,"=":1},Zg=($,T)=>$.scanner.lookaheadIs("=")?`${T}${$.scanner.shift()}`:T;var $v=($,T,W,U)=>{if(W.extends(b.intrinsic.number)){if(typeof T!=="number")return B(GD($,T,U));return $==="=="?["min","max"]:$[0]===">"?["min"]:["max"]}if(W.extends(b.intrinsic.lengthBoundable)){if(typeof T!=="number")return B(GD($,T,U));return $==="=="?["exactLength"]:$[0]===">"?["minLength"]:["maxLength"]}if(W.extends(b.intrinsic.Date))return $==="=="?["after","before"]:$[0]===">"?["after"]:["before"];return B(dR(W.expression))},Dg=($)=>({rule:ck($.limit)?uk($.limit):$.limit,exclusive:$.comparator.length===1}),Vg=($,T)=>{let W=$.unsetRoot(),U=$.scanner.location;$.parseOperand();let X=$.unsetRoot(),Y=$.scanner.sliceChars(U,$.scanner.location);if($.root=W,!X.hasKind("unit")||typeof X.unit!=="number"&&!(X.unit instanceof Date))return $.error(GD(T,Y,"right"));let w=X.unit,G=T.length===1,H=$v(T,typeof w==="number"?w:Y,W,"right");for(let F of H)$.constrainRoot(F,T==="=="?{rule:w}:{rule:w,exclusive:G});if(!$.branches.leftBound)return;if(!I4(T,nk))return $.error(xz(T));let z=$v($.branches.leftBound.comparator,$.branches.leftBound.limit,W,"left");$.constrainRoot(z[0],Dg($.branches.leftBound)),$.branches.leftBound=null},GD=($,T,W)=>`Comparator ${W==="left"?PU[$]:$} must be ${W==="left"?"preceded":"followed"} by a corresponding literal (was ${T})`;var Uv=($)=>{$.scanner.shiftUntilNonWhitespace();let T=$.scanner.shiftUntilNextTerminator();$.root=$.root.brand(T)};var Yv=($)=>{let T=$.scanner.shiftUntilNextTerminator(),W=_R(T,{errorOnFail:Xv(T)});if(W===0)$.error(Xv(0));$.root=$.root.constrain("divisor",W)},Xv=($)=>`% operator must be followed by a non-zero integer literal (was ${$})`;var zD=($)=>{let T=$.scanner.shift();return T===""?$.finalize(""):T==="["?$.scanner.shift()==="]"?$.setRoot($.root.array()):$.error(Kg):T==="|"?$.scanner.lookahead===">"?$.shiftedByOne().pushRootToBranch("|>"):$.pushRootToBranch(T):T==="&"?$.pushRootToBranch(T):T===")"?$.finalizeGroup():$T.lookaheadIsFinalizing(T,$.scanner.unscanned)?$.finalize(T):I4(T,Wv)?Tv($,T):T==="%"?Yv($):T==="#"?Uv($):(T in gT)?zD($):$.error(Iz(T))},Iz=($,T="")=>`'${$}' is not allowed here${T&&` (should be ${T})`}`,Kg="Missing expected ']'";var wv=($)=>{let T=$.unsetRoot();$.parseOperand();let W=$.unsetRoot();if(!W.hasKind("unit"))return $.error(Eg(W.expression));let U=W.unit instanceof Date?()=>new Date(W.unit):W.unit;return[T,"=",U]},Eg=($)=>`Default value '${$}' must a literal value`;var HD=($,T)=>{let W=T.$.maybeResolveRoot($);if(W)return W;if($.endsWith("[]")){let Y=T.$.maybeResolveRoot($.slice(0,-2));if(Y)return Y.array()}let U=new CU(new $T($),T),X=Ag(U);if(U.finalizer===">")B(Iz(">"));return X},Ag=($)=>{$.parseOperand();let T=eY($).root;if(!T)return S$(`Root was unexpectedly unset after parsing string '${$.scanner.scanned}'`);if($.finalizer==="=")T=wv($);else if($.finalizer==="?")T=[T,"?"];if($.scanner.shiftUntilNonWhitespace(),$.scanner.lookahead)B(Iz($.scanner.lookahead));return T},eY=($)=>{while($.finalizer===void 0)Mg($);return $},Mg=($)=>$.hasRoot()?$.parseOperator():$.parseOperand();class CU{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor($,T){this.scanner=$,this.ctx=T}error($){return B($)}hasRoot(){return this.root!==void 0}setRoot($){this.root=$}unsetRoot(){let $=this.root;return this.root=void 0,$}constrainRoot(...$){this.root=this.root.constrain($[0],$[1])}finalize($){if(this.groups.length)return this.error(Bz(")"));this.finalizeBranches(),this.finalizer=$}reduceLeftBound($,T){let W=PU[T];if(!I4(W,rk))return this.error(xz(T));if(this.branches.leftBound)return this.error(ak(this.branches.leftBound.limit,this.branches.leftBound.comparator,$,W));this.branches.leftBound={comparator:W,limit:$}}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 $=this.groups.pop();if(!$)return this.error(ik(this.scanner.unscanned));this.branches=$}addPrefix($){this.branches.prefixes.push($)}applyPrefixes(){while(this.branches.prefixes.length){let $=this.branches.prefixes.pop();this.root=$==="keyof"?this.root.keyof():S$(`Unexpected prefix '${$}'`)}}pushRootToBranch($){this.assertRangeUnset(),this.applyPrefixes();let T=this.root;if(this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(T)??T,$==="&")return;if(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,$==="|")return;this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null}parseUntilFinalizer(){return eY(new CU(this.scanner,this.ctx))}parseOperator(){return zD(this)}parseOperand(){return wD(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(tk(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 Ng="An empty string is not a valid generic parameter name",bz=($,T,W)=>{$.shiftUntilNonWhitespace();let U=$.shiftUntilNextTerminator();if(U===""){if($.lookahead===""&&T.length)return T;return B(Ng)}return $.shiftUntilNonWhitespace(),Lg($,U,T,W)},Gv="extends ",Lg=($,T,W,U)=>{if($.shiftUntilNonWhitespace(),$.unscanned.startsWith(Gv))$.jumpForward(Gv.length);else{if($.lookahead===",")$.shift();return W.push(T),bz($,W,U)}let X=eY(new CU($,U));return W.push([T,X.root]),bz($,W,U)};class FD extends c1{$;constructor($){super((...T)=>new $w($)(...T),{bind:$});this.$=$}in($){return new $w(this.$,$===void 0?void 0:this.$.parse($))}at($,T){return new $w(this.$).at($,T)}case($,T){return new $w(this.$).case($,T)}}class $w extends c1{$;in;key;branches=[];constructor($,T){super((W)=>this.caseEntries(Object.entries(W).map(([U,X])=>U==="default"?[U,X]:[this.$.parse(U),X])));this.$=$,this.in=T}at($,T){if(this.key)B(_g);if(this.branches.length)B(Jg);return this.key=$,T?this.match(T):this}case($,T){return this.caseEntry(this.$.parse($),T)}caseEntry($,T){let U=(this.key?this.$.parse({[this.key]:$}):$).pipe(T);return this.branches.push(U),this}match($){return this($)}strings($){return this.caseEntries(Object.entries($).map(([T,W])=>T==="default"?[T,W]:[this.$.node("unit",{unit:T}),W]))}caseEntries($){for(let T=0;T<$.length;T++){let[W,U]=$[T];if(W==="default"){if(T!==$.length-1)B("default may only be specified as the last key of a switch definition");return this.default(U)}if(typeof U!=="function")return B(`Value for case "${W}" must be a function (was ${x4(U)})`);this.caseEntry(W,U)}return this}default($){if(typeof $==="function")this.case(X$.unknown,$);let T={branches:this.branches,ordered:!0};if($==="never"||$==="assert")T.meta={onFail:zv};let W=this.$.node("union",T);if(!this.in)return this.$.finalize(W);let U=this.in.pipe(W);if($==="never"||$==="assert")U=U.configureReferences({onFail:zv},"self");return this.$.finalize(U)}}var zv=($)=>$.throw(),Jg="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",_g="At most one key matcher may be specified per expression";var fz=($,T)=>{if(d$($)){if($[1]==="=")return[T.$.parseOwnDefinitionFormat($[0],T),"=",$[2]];if($[1]==="?")return[T.$.parseOwnDefinitionFormat($[0],T),"?"]}return yz($,T)},Hv="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",Fv="Only required keys may specify default values, e.g. { value: 'number = 0' }";var Ov=($,T)=>{let W,U={},X=oW($);for(let[w,G]of X){let H=vg(w);if(H.kind==="spread"){if(!O0(U))return B(kg);let Z=T.$.parseOwnDefinitionFormat(G,T);if(Z.equals(X$.object))continue;if(!Z.hasKind("intersection")||!Z.basis?.equals(X$.object))return B(qg(Z.expression));W=Z.structure;continue}if(H.kind==="undeclared"){if(G!=="reject"&&G!=="delete"&&G!=="ignore")B(Rg(G));U.undeclared=G;continue}let z=fz(G,T),F=H;if(H.kind==="required"){if(!d$(z))OD(U,"required",{key:H.normalized,value:z},T);else OD(U,"optional",z[1]==="="?{key:H.normalized,value:z[0],default:z[2]}:{key:H.normalized,value:z[0]},T);continue}if(d$(z)){if(z[1]==="?")B(Hv);if(z[1]==="=")B(Fv)}if(H.kind==="optional"){OD(U,"optional",{key:H.normalized,value:z},T);continue}let O=T.$.parseOwnDefinitionFormat(F.normalized,T),Q=qz(O,z,T.$);if(Q.index)U.index=q$(U.index,Q.index);if(Q.required)U.required=q$(U.required,Q.required)}let Y=T.$.node("structure",U);return T.$.parseSchema({domain:"object",structure:W?.merge(Y)??Y})},OD=($,T,W,U)=>{$[T]=q$($[T],U.$.node(T,W))},Rg=($)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${E$($)})`,kg="Spread operator may only be used as the first key in an object",vg=($)=>typeof $==="symbol"?{kind:"required",normalized:$}:$.at(-1)==="?"?$.at(-2)===BY?{kind:"required",normalized:`${$.slice(0,-2)}?`}:{kind:"optional",normalized:$.slice(0,-1)}:$[0]==="["&&$.at(-1)==="]"?{kind:"index",normalized:$.slice(1,-1)}:$[0]===BY&&$[1]==="["&&$.at(-1)==="]"?{kind:"required",normalized:$.slice(1)}:$==="..."?{kind:"spread"}:$==="+"?{kind:"undeclared"}:{kind:"required",normalized:$==="\\..."?"...":$==="\\+"?"+":$},qg=($)=>`Spread operand must resolve to an object literal type (was ${$})`;var Zv=($,T)=>yg($)?Ev[$[0]]($,T):bg($)?Kv[$[1]]($,T):null,Pg=($,T)=>T.$.parseOwnDefinitionFormat($[1],T).keyof(),QD=($,T)=>{if($[2]===void 0)return B(YD($[1],""));let W=T.$.parseOwnDefinitionFormat($[0],T),U=T.$.parseOwnDefinitionFormat($[2],T);if($[1]==="|")return T.$.node("union",{branches:[W,U]});let X=$[1]==="&"?r6(W,U,T.$):uY(W,U,T.$);if(X instanceof o)return X.throw();return X},Cg=($,T)=>T.$.parseOwnDefinitionFormat($[0],T).array(),Sg=($,T)=>{if(typeof $[2]!=="function")return B(Dv("=>",$[2]));return T.$.parseOwnDefinitionFormat($[0],T).pipe($[2])},Dv=($,T)=>`${$===":"?"Narrow":"Morph"} expression requires a function following '${$}' (was ${typeof T})`,jg=($,T)=>{if(typeof $[2]!=="function")return B(Dv(":",$[2]));return T.$.parseOwnDefinitionFormat($[0],T).constrain("predicate",$[2])},Bg=($,T)=>T.$.parseOwnDefinitionFormat($[0],T).configureReferences($[2],"shallow"),Vv=($)=>$,xg=Vv({"[]":Cg,"?":()=>B(Sz)}),Ig=Vv({"|":QD,"&":QD,":":jg,"=>":Sg,"|>":QD,"@":Bg,"=":()=>B(jz)}),Kv={...xg,...Ig},bg=($)=>Kv[$[1]]!==void 0,fg=($)=>$,Ev=fg({keyof:Pg,instanceof:($,T)=>{if(typeof $[1]!=="function")return B(Qv(SY($[1])));let W=$.slice(1).map((U)=>typeof U==="function"?T.$.node("proto",{proto:U}):B(Qv(SY(U))));return W.length===1?W[0]:T.$.node("union",{branches:W})},"===":($,T)=>T.$.units($.slice(1))}),yg=($)=>Ev[$[0]]!==void 0,Qv=($)=>`Expected a constructor following 'instanceof' operator (was ${$})`;var Nv=($,T)=>{let W=[{}],U=0;while(U<$.length){let X=!1;if($[U]==="..."&&U<$.length-1)X=!0,U++;let Y=fz($[U],T),[w,G,H]=!d$(Y)?[Y]:Y;if(U++,X){if(!w.extends(b.intrinsic.Array))return B(mg(w.expression));W=W.flatMap((z)=>w.distribute((F)=>gg(Kz(z),F)))}else W=W.map((z)=>{if(G==="?")return Lv(z,w);if(G==="=")return hg(z,w,H);return ZD(z,w)})}return T.$.parseSchema(W.map((X)=>O0(X)?{proto:Array,exactLength:0}:{proto:Array,sequence:X}))},ZD=($,T)=>{if($.defaultables||$.optionals)return B($.variadic?dZ:cg);if($.variadic)$.postfix=q$($.postfix,T);else $.prefix=q$($.prefix,T);return $},Lv=($,T)=>{if($.variadic)return B(Jv);return $.optionals=q$($.optionals,T),$},hg=($,T,W)=>{if($.variadic)return B(Jv);if($.optionals)return B(ug);return $.defaultables=q$($.defaultables,[[T,W]]),$},Av=($,T)=>{if($.postfix)B(Mv);if($.variadic){if(!$.variadic.equals(T))B(Mv)}else $.variadic=T.internal;return $},gg=($,T)=>{let W=T.select({method:"find",kind:"sequence"});if(!W)return Av($,b.intrinsic.unknown);if(W.prefix)for(let U of W.prefix)ZD($,U);if(W.optionals)for(let U of W.optionals)Lv($,U);if(W.variadic)Av($,W.variadic);if(W.postfix)for(let U of W.postfix)ZD($,U);return $},mg=($)=>`Spread element must be an array (was ${$})`,Mv="A tuple may have at most one variadic element",cg="A required element may not follow an optional element",Jv="An optional element may not follow a variadic element";var ug="A defaultable element may not follow an optional element without a default";var pg={},yz=($,T)=>{if(typeof $==="string"){if(T.args&&Object.keys(T.args).some((U)=>$.includes(U)))return HD($,T);let W=pg[T.$.name]??={};return W[$]??=HD($,T)}return p6($,"object")?dg($,T):B(DD(x4($)))},dg=($,T)=>{let W=CY($);switch(W){case void 0:if(s($,"root"))return $;return Ov($,T);case"Array":return og($,T);case"RegExp":return T.$.node("intersection",{domain:"string",pattern:$},{prereduced:!0});case"Function":{let U=hT($)?$():$;if(s(U,"root"))return U;return B(DD("Function"))}default:return B(DD(W??E$($)))}},og=($,T)=>Zv($,T)??Nv($,T),DD=($)=>`Type definitions must be strings or objects (was ${$})`;class VD extends c1{constructor($){let T=Object.assign({errors:o6,hkt:U6,$,raw:$.parse,module:$.constructor.module,scope:$.constructor.scope,define:$.define,match:$.match,generic:$.generic,schema:$.schema,keywords:$.ambient,unit:$.unit,enumerated:$.enumerated,instanceOf:$.instanceOf,valueOf:$.valueOf,or:$.or,and:$.and,merge:$.merge,pipe:$.pipe},$.ambientAttachments);super((...W)=>{if(W.length===1)return $.parse(W[0]);if(W.length===2&&typeof W[0]==="string"&&W[0][0]==="<"&&W[0].at(-1)===">"){let U=W[0].slice(1,-1),X=$.parseGenericParams(U,{});return new pT(X,W[1],$,$,null)}return $.parse(W)},{bind:$,attach:T})}}var SU=b;class hz extends Pz{get ambientAttachments(){if(!SU.typeAttachments)return;return this.cacheGetter("ambientAttachments",K$(SU.typeAttachments,($,T)=>[$,this.bindReference(T)]))}preparseOwnAliasEntry($,T){let W=$.indexOf("<");if(W===-1){if(s(T,"module")||s(T,"generic"))return[$,T];let Y=this.name==="ark"?$:$==="root"?this.name:`${this.name}.${$}`,w=this.resolvedConfig.keywords?.[Y];if(w)T=[T,"@",w];return[$,T]}if($.at(-1)!==">")B("'>' must be the last character of a generic declaration in a scope");let U=$.slice(0,W),X=$.slice(W+1,-1);return[U,()=>{let Y=this.parseGenericParams(X,{alias:U});return cR(Y,T,this)}]}parseGenericParams($,T){return bz(new $T($),[],this.createParseContext({...T,def:$,prefix:"generic"}))}normalizeRootScopeValue($){if(hT($)&&!s($,"generic"))return $();return $}preparseOwnDefinitionFormat($,T){return{...T,def:$,prefix:T.alias??"type"}}parseOwnDefinitionFormat($,T){if(!(T.alias&&(T.alias in this.aliases))&&!T.args)T.args={this:T.id};let U=yz($,T);if(d$(U)){if(U[1]==="=")return B(jz);if(U[1]==="?")return B(Sz)}return U}unit=($)=>this.units([$]);valueOf=($)=>this.units(GR($));enumerated=(...$)=>this.units($);instanceOf=($)=>this.node("proto",{proto:$},{prereduced:!0});or=(...$)=>this.schema($.map((T)=>this.parse(T)));and=(...$)=>$.reduce((T,W)=>T.and(this.parse(W)),this.intrinsic.unknown);merge=(...$)=>$.reduce((T,W)=>T.merge(this.parse(W)),this.intrinsic.object);pipe=(...$)=>this.intrinsic.unknown.pipe(...$);match=new FD(this);declare=()=>({type:this.type});define($){return $}type=new VD(this);static scope=($,T={})=>new hz($,T);static module=($,T={})=>this.scope($,T).export()}var KD=Object.assign(hz.scope,{define:($)=>$}),k$=hz;class _v extends U6{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}var lg=P1(["base",X$.object],["props",X$.object])(($)=>$.base.merge($.props),_v),Rv=k$.module({Key:X$.key,Merge:lg});class kv extends U6{}var rg=P1("element")(($)=>{let T=$.element.exclude(X$.Array),W=T.array();return T.rawOr(W).pipe(yT).distribute((U)=>U.assertHasKind("morph").declareOut(W),f$)},kv),vv=k$.module({root:X$.Array,readonly:"root",index:X$.nonNegativeIntegerString,liftFrom:rg},{name:"Array"});var ED=f$(["string",rW.FileConstructor]),ng=ED.rawOr(ED.array()),qv=f$({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:ng}}),Pv=k$.module({root:["instanceof",FormData],value:ED,parsed:qv,parse:f$({in:FormData,morphs:($)=>{let T={};for(let[W,U]of $)if(W in T){let X=T[W];if(typeof X==="string"||X instanceof rW.FileConstructor)T[W]=[X,U];else X.push(U)}else T[W]=U;return T},declaredOut:qv})},{name:"FormData"});var Cv=k$.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 ig={Boolean:1,Number:1,String:1},Sv=k$.module({...K$({...UZ,...YZ},($,T)=>($ in ig)?[]:[$,["instanceof",T]]),Array:vv,TypedArray:Cv,FormData:Pv});var tg=f$({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"}),ag=f$({domain:"number",divisor:1}),gz=k$.module({root:X$.number,integer:ag,epoch:tg,safe:f$({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 X4=($,T,W)=>{let U={domain:"string",pattern:{rule:$.source,flags:$.flags,meta:T}};if(W)U.meta={format:W};return qU("intersection",U)},jv=X4(xY,"a well-formed integer string"),pv=k$.module({root:jv,parse:f$({in:jv,morphs:($,T)=>{let W=Number.parseInt($);return Number.isSafeInteger(W)?W:T.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:X$.integer})},{name:"string.integer"}),sg=X4(/^[\dA-Fa-f]+$/,"hex characters only"),eg=k$.module({root:X4(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:X4(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),Bv=X4(/^[A-Z].*$/,"capitalized"),$m=k$.module({root:f$({in:"string",morphs:($)=>$.charAt(0).toUpperCase()+$.slice(1),declaredOut:Bv}),preformatted:Bv},{name:"string.capitalize"}),Tm=($)=>{let T=$.replaceAll(/[ -]+/g,""),W=0,U,X,Y=!1;for(let w=T.length-1;w>=0;w--){if(U=T.substring(w,w+1),X=Number.parseInt(U,10),Y)X*=2,W+=X>=10?X%10+1:X;else W+=X;Y=!Y}return!!(W%10===0?T:!1)},Wm=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,Um=f$({domain:"string",pattern:{meta:"a credit card number",rule:Wm.source},predicate:{meta:"a credit card number",predicate:Tm}});var Xm=/^([+-]?\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 Ym=($)=>!Number.isNaN(new Date($).valueOf()),xv=f$({domain:"string",predicate:{meta:"a parsable date",predicate:Ym}}).assertHasKind("intersection"),Iv=pv.root.internal.narrow(($,T)=>{let W=Number.parseInt($),U=gz.epoch(W);if(U instanceof o6)return T.errors.merge(U),!1;return!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),wm=k$.module({root:Iv,parse:f$({in:Iv,morphs:($)=>new Date($),declaredOut:X$.Date})},{name:"string.date.epoch"}),bv=X4(Xm,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),Gm=k$.module({root:bv,parse:f$({in:bv,morphs:($)=>new Date($),declaredOut:X$.Date})},{name:"string.date.iso"}),zm=k$.module({root:xv,parse:f$({declaredIn:xv,in:"string",morphs:($,T)=>{let W=new Date($);if(Number.isNaN(W.valueOf()))return T.error("a parsable date");return W},declaredOut:X$.Date}),iso:Gm,epoch:wm},{name:"string.date"}),Hm=X4(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),fv="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",dT=`(${fv}[.]){3}${fv}`,Fm=new RegExp(`^${dT}$`),_4="(?:[0-9a-fA-F]{1,4})",Om=new RegExp(`^((?:${_4}:){7}(?:${_4}|:)|(?:${_4}:){6}(?:${dT}|:${_4}|:)|(?:${_4}:){5}(?::${dT}|(:${_4}){1,2}|:)|(?:${_4}:){4}(?:(:${_4}){0,1}:${dT}|(:${_4}){1,3}|:)|(?:${_4}:){3}(?:(:${_4}){0,2}:${dT}|(:${_4}){1,4}|:)|(?:${_4}:){2}(?:(:${_4}){0,3}:${dT}|(:${_4}){1,5}|:)|(?:${_4}:){1}(?:(:${_4}){0,4}:${dT}|(:${_4}){1,6}|:)|(?::((?::${_4}){0,5}:${dT}|(?::${_4}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),Qm=k$.module({root:["v4 | v6","@","an IP address"],v4:X4(Fm,"an IPv4 address","ipv4"),v6:X4(Om,"an IPv6 address","ipv6")},{name:"string.ip"}),jU="a JSON string",dv=($)=>{if(!($ instanceof SyntaxError))throw $;return`must be ${jU} (${$})`},Zm=f$({meta:jU,domain:"string",predicate:{meta:jU,predicate:($,T)=>{try{return JSON.parse($),!0}catch(W){return T.reject({code:"predicate",expected:jU,problem:dv(W)})}}}}),Dm=($,T)=>{if($.length===0)return T.error({code:"predicate",expected:jU,actual:"empty"});try{return JSON.parse($)}catch(W){return T.error({code:"predicate",expected:jU,problem:dv(W)})}},Vm=k$.module({root:Zm,parse:f$({meta:"safe JSON string parser",in:"string",morphs:Dm,declaredOut:X$.jsonObject})},{name:"string.json"}),yv=X4(/^[a-z]*$/,"only lowercase letters"),Km=k$.module({root:f$({in:"string",morphs:($)=>$.toLowerCase(),declaredOut:yv}),preformatted:yv},{name:"string.lower"}),ov=["NFC","NFD","NFKC","NFKD"],Tw=K$(ov,($,T)=>[T,f$({domain:"string",predicate:(W)=>W.normalize(T)===W,meta:`${T}-normalized unicode`})]),mz=K$(ov,($,T)=>[T,f$({in:"string",morphs:(W)=>W.normalize(T),declaredOut:Tw[T]})]),Em=k$.module({root:mz.NFC,preformatted:Tw.NFC},{name:"string.normalize.NFC"}),Am=k$.module({root:mz.NFD,preformatted:Tw.NFD},{name:"string.normalize.NFD"}),Mm=k$.module({root:mz.NFKC,preformatted:Tw.NFKC},{name:"string.normalize.NFKC"}),Nm=k$.module({root:mz.NFKD,preformatted:Tw.NFKD},{name:"string.normalize.NFKD"}),Lm=k$.module({root:"NFC",NFC:Em,NFD:Am,NFKC:Mm,NFKD:Nm},{name:"string.normalize"}),hv=X4(Zz,"a well-formed numeric string"),Jm=k$.module({root:hv,parse:f$({in:hv,morphs:($)=>Number.parseFloat($),declaredOut:X$.number})},{name:"string.numeric"}),gv="a regex pattern",_m=f$({domain:"string",predicate:{meta:gv,predicate:($,T)=>{try{return new RegExp($),!0}catch(W){return T.reject({code:"predicate",expected:gv,problem:String(W)})}}},meta:{format:"regex"}}),Rm=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,km=X4(Rm,"a semantic version (see https://semver.org/)"),mv=X4(/^\S.*\S$|^\S?$/,"trimmed"),vm=k$.module({root:f$({in:"string",morphs:($)=>$.trim(),declaredOut:mv}),preformatted:mv},{name:"string.trim"}),cv=X4(/^[A-Z]*$/,"only uppercase letters"),qm=k$.module({root:f$({in:"string",morphs:($)=>$.toUpperCase(),declaredOut:cv}),preformatted:cv},{name:"string.upper"}),Pm=($)=>{if(URL.canParse)return URL.canParse($);try{return new URL($),!0}catch{return!1}},uv=f$({domain:"string",predicate:{meta:"a URL string",predicate:Pm},meta:{format:"uri"}}),Cm=k$.module({root:uv,parse:f$({declaredIn:uv,in:"string",morphs:($,T)=>{try{return new URL($)}catch{return T.error("a URL string")}},declaredOut:f$(URL)})},{name:"string.url"}),Sm=k$.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:X4(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:X4(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:X4(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:X4(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:X4(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:X4(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:X4(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:X4(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),lv=k$.module({root:X$.string,alpha:X4(/^[A-Za-z]*$/,"only letters"),alphanumeric:X4(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:sg,base64:eg,capitalize:$m,creditCard:Um,date:zm,digits:X4(/^\d*$/,"only digits 0-9"),email:Hm,integer:pv,ip:Qm,json:Vm,lower:Km,normalize:Lm,numeric:Jm,regex:_m,semver:km,trim:vm,upper:qm,url:Cm,uuid:Sm},{name:"string"});var rv=k$.module({bigint:X$.bigint,boolean:X$.boolean,false:X$.false,never:X$.never,null:X$.null,number:X$.number,object:X$.object,string:X$.string,symbol:X$.symbol,true:X$.true,unknown:X$.unknown,undefined:X$.undefined}),nv=k$.module({root:X$.unknown,any:X$.unknown},{name:"unknown"}),jm=k$.module({root:X$.jsonObject,stringify:qU("morph",{in:X$.jsonObject,morphs:($)=>JSON.stringify($),declaredOut:X$.string})},{name:"object.json"}),iv=k$.module({root:X$.object,json:jm},{name:"object"});class tv extends U6{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var Bm=P1(["K",X$.key],"V")(($)=>({domain:"object",index:{signature:$.K,value:$.V}}),tv);class av extends U6{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var xm=P1(["T",X$.object],["K",X$.key])(($)=>$.T.pick($.K),av);class sv extends U6{description='omit a set of properties from an object like `Omit(User, "age")`'}var Im=P1(["T",X$.object],["K",X$.key])(($)=>$.T.omit($.K),sv);class ev extends U6{description="make all named properties of an object optional like `Partial(User)`"}var bm=P1(["T",X$.object])(($)=>$.T.partial(),ev);class $q extends U6{description="make all named properties of an object required like `Required(User)`"}var fm=P1(["T",X$.object])(($)=>$.T.required(),$q);class Tq extends U6{description='exclude branches of a union like `Exclude("boolean", "true")`'}var ym=P1("T","U")(($)=>$.T.exclude($.U),Tq);class Wq extends U6{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var hm=P1("T","U")(($)=>$.T.extract($.U),Wq),Uq=k$.module({Exclude:ym,Extract:hm,Omit:Im,Partial:bm,Pick:xm,Record:Bm,Required:fm});var oT=KD({...rv,...Uq,...Sv,...Rv,string:lv,number:gz,object:iv,unknown:nv},{prereducedAliases:!0,name:"ark"}),b4=oT.export();Object.assign(SU.ambient,b4);SU.typeAttachments={string:b4.string.root,number:b4.number.root,bigint:b4.bigint,boolean:b4.boolean,symbol:b4.symbol,undefined:b4.undefined,null:b4.null,object:b4.object.root,unknown:b4.unknown.root,false:b4.false,true:b4.true,never:b4.never,arrayIndex:b4.Array.index,Key:b4.Key,Record:b4.Record,Array:b4.Array.root,Date:b4.Date};var d1=Object.assign(oT.type,SU.typeAttachments),gm=oT.match,mm=oT.generic,k5$=oT.schema,cm=oT.define,um=oT.declare;var pm="__vite_start_time"in globalThis,dm=typeof window!=="undefined",p5$="vitest"in globalThis,TT=d1("string"),Xq=d1('"true" | "false" | undefined'),WT=$Z({isServer:!pm&&!dm,server:{CI:d1("string | undefined").pipe(Boolean),POSTGRES_USER:TT,POSTGRES_PASSWORD:TT,POSTGRES_DATABASE:TT,POSTGRES_HOST:TT,POSTGRES_PORT:TT.pipe(($)=>Number.parseInt($,10)),BACKEND_PORT:TT.pipe(($)=>Number.parseInt($,10)),RUN_WORKERS_FROM_SOURCE:Xq.pipe(($)=>$==="true"),FRONTEND_PORT:TT.pipe(($)=>Number.parseInt($,10)),FRONTEND_ORIGINS:TT.pipe.try(($)=>JSON.parse($),d1("string[]")),API_KEY_OPENAI:d1("string | undefined"),API_KEY_RESEND:d1("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:TT,VITE_DEV_FRONTEND_HOST:d1("string | undefined"),VITE_DEV_HTTPS:Xq.pipe(($)=>$==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var MD={};wT(MD,{users:()=>tW,untrackedUserColumnNames:()=>om,twoFactorMethod:()=>Hq,trackedUserColumnName:()=>lm,trackableUserColumnNames:()=>Gq,signInHistory:()=>nm,role:()=>wq,players:()=>AD,passwordResetAttempts:()=>im,games:()=>uz,banishedIps:()=>pz,accountActions:()=>rm,accountAction:()=>zq});function lT(){return T6({length:24}).$type()}function Yq($){return L`lower(${$})`}var cz=L`TO_CHAR(NOW() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`,wq=YY("role",["admin","user"]),tW=IT("users",{id:_1().primaryKey().defaultRandom(),username:T6({length:16}).notNull(),emailOffered:T6({length:254}).notNull(),emailVerified:T6({length:254}),password:T6({length:254}),createdAtIso:lT().notNull().default(cz),createdIp:T6({length:45}).notNull(),isActive:OY().notNull().default(!1),verifiedAtIso:lT(),userRole:wq().default("user")},($)=>[mQ("usernameUniqueIndex").on(Yq($.username)),mQ("emailVerifiedUniqueIndex").on(Yq($.emailVerified))]),om=["id","createdAtIso","createdIp","isActive","verifiedAtIso"],Gq=["username","emailOffered","emailVerified","password","userRole"],lm=YY("trackedUserColumnName",Gq),zq=YY("accountAction",["cooldown","confirmEmail","signIn","resetPassword"]),rm=IT("accountActions",{userId:_1().references(()=>tW.id).primaryKey(),action:zq().notNull(),code:T6({length:254}).notNull(),wrongCodeCount:QY().notNull().default(0),expiresAtIso:lT().notNull()}),uz=IT("games",{id:_1().primaryKey().defaultRandom()}),AD=IT("players",{userId:_1().notNull().references(()=>tW.id,{onDelete:"cascade"}),gameId:_1().notNull().references(()=>uz.id,{onDelete:"cascade"}),score:QY().notNull()},($)=>[iJ({name:"players_userId_gameId_pk",columns:[$.userId,$.gameId]})]),nm=IT("signInHistory",{id:_1().primaryKey().defaultRandom(),userId:_1().references(()=>tW.id,{onDelete:"cascade"}),signInTimeIso:lT().notNull().default(cz),ipAddress:T6({length:45}).notNull(),userAgent:T6({length:1024}),successful:OY().notNull().default(!1)}),Hq=YY("twoFactorMethod",["email","phone"]),im=IT("passwordResetAttempts",{id:_1().primaryKey().defaultRandom(),userId:_1().notNull().references(()=>tW.id,{onDelete:"cascade"}),requestedIp:T6({length:45}).notNull(),requestedAtIso:lT().notNull().default(cz),succeededIp:T6({length:45}),succeededAtIso:lT(),verificationMethod:Hq().notNull()}),pz=IT("banishedIps",{ip:T6({length:45}).primaryKey(),reason:T6({length:2048}).notNull(),banishedAtIso:lT().notNull().default(cz),banishedUntilIso:lT()});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class ND{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(tm.resolve(__dirname,"notify_update.sql"));let $=[m4(tW),m4(uz),m4(AD)];await this.sql`SELECT create_notify_triggers(${this.sql.array($)})`,await this.sql.listen("table_update",(T)=>{let W=T.split(","),U=W[0],X=W[1],Y=`${U}("${X}")`;if(this.observers.has(Y))this.observers.get(Y).next(Y)})}constructor($=!1,T={host:WT.POSTGRES_HOST,port:WT.POSTGRES_PORT,user:WT.POSTGRES_USER,password:WT.POSTGRES_PASSWORD,database:WT.POSTGRES_DATABASE}){this.options=T,this.sql=FU(T),this.drizzle=Oz(this.sql,{schema:MD,logger:$})}observe($,T){if(!this.observers.has($))this.observers.set($,new I$);this.observers.get($).subscribe("SINGLETON",T)}}import{resolve as em}from"path";import{existsSync as LD,mkdirSync as Fq,readFileSync as am,readdirSync as Oq,rmSync as Qq,statSync as Zq,writeFileSync as sm}from"fs";import{resolve as JD}from"path";var Dq=class{rootDir;get initialized(){return LD(this.rootDir)}initialize(){if(!this.initialized)Fq(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let T=JD(this.rootDir,$);if(LD(T))return am(T,"utf-8");return null}setItem($,T){this.initialize();let W=JD(this.rootDir,$);sm(W,T)}removeItem($){let T=JD(this.rootDir,$);if(LD(T))this.initialize(),Qq(T)}key($){return Oq(this.rootDir).sort((U,X)=>{let Y=Zq(U);return Zq(X).ctimeMs-Y.ctimeMs})[$]??null}clear(){Qq(this.rootDir,{recursive:!0}),Fq(this.rootDir,{recursive:!0})}get length(){return Oq(this.rootDir).length}};var _D=new Dq({path:em(process.cwd(),"storage")});function Vq($){return $.toString({smallestUnit:"millisecond"})}function H7$($){return C9.Instant.from($)}import*as dz from"fs";import*as Kq from"readline";function $c($){let W=$.replace(":","T").replace(" ","").replace(/(\d{2})\/(\w{3})\/(\d{4})T(.+)/,(U,X,Y,w,G)=>{let z={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"}[Y];return`${w}-${z}-${X}T${G}`});return new Date(W)}async function Eq($,T="/var/log/nginx/access.log",W=new Date){let U=new Map;if(!dz.existsSync(T))return $.error(`Log file not found: ${T}`),U;let X=dz.createReadStream(T),Y=Kq.createInterface({input:X,crlfDelay:Number.POSITIVE_INFINITY}),w=new Date(W.getTime()-3600000);return Y.on("line",(G)=>{let H=/^(?<ip>\S+) \S+ \S+ \[(?<dateTime>.*?)\]/,z=G.match(H);if(z?.groups){let F=z.groups.ip,O=z.groups.dateTime,Q=$c(O);if(!Number.isNaN(Q.getTime())){if(Q>=w&&Q<=W){let Z=U.get(F);if(!Z)Z=[],U.set(F,Z);Z.push(G)}}else $.error(`Failed to parse date: ${O}`)}}),new Promise((G,H)=>{Y.on("error",(z)=>{H(z)}),Y.on("close",()=>{G(U)})})}function Aq($){return $.toJsonSchema()}var Tc=["Network security adjudicator, your job is to determine if an IP address should be banned.","The IP address in question created the following logs on our server today:","```nginx.log\n"].join(`
|
|
153
|
-
`);function
|
|
154
|
+
`)+"}");class Oz{config;resolvedConfig;name;get[C6](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor($,T){if(this.config=IU(y.config,T),this.resolvedConfig=IU(y.resolvedConfig,T),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(_Z).length}`,this.name in _Z)B(`A Scope already named ${this.name} already exists`);_Z[this.name]=this;let W=Object.entries($).map((w)=>this.preparseOwnAliasEntry(...w));for(let[w,X]of W){let U=w;if(w[0]==="#"){if(U=w.slice(1),U in this.aliases)B(N_(U));this.aliases[U]=X}else{if(U in this.aliases)B(N_(w));this.aliases[U]=X,this.exportedNames.push(U)}if(!W$(X,"module")&&!W$(X,"generic")&&!IT(X)){let Y=this.preparseOwnDefinitionFormat(X,{alias:U});this.resolutions[U]=W$(Y,"root")?this.bindReference(Y):this.createParseContext(Y).id}}L_??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[L_.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=y.intrinsic?E$(y.intrinsic,(w,X)=>w.startsWith("json")?[]:[w,this.bindReference(X)]):{}}cacheGetter($,T){return Object.defineProperty(this,$,{value:T}),T}get internal(){return this}_json;get json(){if(!this._json)this.export();return this._json}defineSchema($){return $}generic=(...$)=>{let T=this;return(W,w)=>new yT($,w?new Xz(W):W,T,T,w??null)};units=($,T)=>{let W=[];for(let X of $)if(!W.includes(X))W.push(X);let w=W.map((X)=>this.node("unit",{unit:X},T));return this.node("union",w,{...T,prereduced:!0})};lazyResolutions=[];lazilyResolve($,T){let W=this.node("alias",{reference:T??"synthetic",resolve:$},{prereduced:!0});if(!this.resolved)this.lazyResolutions.push(W);return W}schema=($,T)=>this.finalize(this.parseSchema($,T));parseSchema=($,T)=>this.node(bU($),$,T);preparseNode($,T,W){let w=typeof $==="string"?$:bU(T,$);if(a$(T)&&T.kind===w)return T;if(w==="alias"&&!W?.prereduced){let{reference:Y}=uU.implementation.normalize(T,this);if(Y.startsWith("$")){let G=this.resolveRoot(Y.slice(1));T=G,w=G.kind}}else if(w==="union"&&p6(T,"object")){let Y=jf(T);if(Y?.length===1)T=Y[0],w=bU(T)}if(a$(T)&&T.kind===w)return T;let U=GX[w].normalize?.(T,this)??T;if(a$(U))return U.kind===w?U:If(w,U.kind);return{...W,$:this,kind:w,def:U,prefix:W.alias??w}}bindReference($){let T;if(a$($))T=$.$===this?$:new $.constructor($.attachments,this);else T=$.$===this?$:new yT($.params,$.bodyDef,$.$,this,$.hkt);if(!this.resolved)Object.assign(this.referencesById,T.referencesById);return T}resolveRoot($){return this.maybeResolveRoot($)??B(qZ($))}maybeResolveRoot($){let T=this.maybeResolve($);if(W$(T,"generic"))return;return T}maybeResolveSubalias($){return kZ(this.aliases,$)??kZ(this.ambient,$)}get ambient(){return y.ambient}maybeResolve($){let T=this.resolutions[$];if(T){if(typeof T!=="string")return this.bindReference(T);let w=S6[T];if(W$(w,"root"))return this.resolutions[$]=w;if(W$(w,"context")){if(w.phase==="resolving")return this.node("alias",{reference:`$${$}`},{prereduced:!0});if(w.phase==="resolved")return I$(`Unexpected resolved context for was uncached by its scope: ${M$(w)}`);w.phase="resolving";let X=this.bindReference(this.parseOwnDefinitionFormat(w.def,w));return w.phase="resolved",S6[X.id]=X,S6[w.id]=X,this.resolutions[$]=X}return I$(`Unexpected nodesById entry for ${T}: ${M$(w)}`)}let W=this.aliases[$]??this.ambient?.[$];if(!W)return this.maybeResolveSubalias($);if(W=this.normalizeRootScopeValue(W),W$(W,"generic"))return this.resolutions[$]=this.bindReference(W);if(W$(W,"module")){if(!W.root)B(P_($));return this.resolutions[$]=this.bindReference(W.root)}return this.resolutions[$]=this.parse(W,{alias:$})}createParseContext($){let T=$.id??GZ($.prefix);return S6[T]=Object.assign($,{[C6]:"context",$:this,id:T,phase:"unresolved"})}traversal($){return new g1($,this.resolvedConfig)}import(...$){return new FX(E$(this.export(...$),(T,W)=>[`#${T}`,W]))}precompilation;_exportedResolutions;_exports;export(...$){if(!this._exports){this._exports={};for(let W of this.exportedNames){let w=this.aliases[W];this._exports[W]=W$(w,"module")?RZ(w,this):J_(this.maybeResolve(W))}for(let W of this.lazyResolutions)W.resolution;if(this._exportedResolutions=q_(this,this._exports),this._json=v_(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let W=k_(this.references);this.precompilation=W.write(R_,4),__(this.references,W)}this.resolved=!0}let T=$.length?$:this.exportedNames;return new FX(E$(T,(W,w)=>[w,this._exports[w]]))}resolve($){return this.export()[$]}node=($,T,W={})=>{let w=this.preparseNode($,T,W);if(a$(w))return this.bindReference(w);let X=this.createParseContext(w),U=zZ(X),Y=this.bindReference(U);return S6[X.id]=Y};parse=($,T={})=>this.finalize(this.parseDefinition($,T));parseDefinition($,T={}){if(W$($,"root"))return this.bindReference($);let W=this.preparseOwnDefinitionFormat($,T);if(W$(W,"root"))return this.bindReference(W);let w=this.createParseContext(W);S6[w.id]=w;let X=this.bindReference(this.parseOwnDefinitionFormat($,w));if(X.isCyclic)X=nR(X,w.id);return S6[w.id]=X,X}finalize($){if(J_($),!$.precompilation&&!this.resolvedConfig.jitless)Bf($.references);return $}}class vZ extends Oz{parseOwnDefinitionFormat($,T){return zZ(T)}preparseOwnDefinitionFormat($,T){return this.preparseNode(bU($),$,T)}preparseOwnAliasEntry($,T){return[$,T]}normalizeRootScopeValue($){return $}}var J_=($)=>{let T=$.references.filter((W)=>W.hasKind("alias"));for(let W of T){Object.assign(W.referencesById,W.resolution.referencesById);for(let w of $.references)if(W.id in w.referencesById)Object.assign(w.referencesById,W.referencesById)}return $},v_=($)=>E$($,(T,W)=>[T,W$(W,"root")||W$(W,"generic")?W.json:W$(W,"module")?v_(W):I$(`Unexpected resolution ${M$(W)}`)]),kZ=($,T)=>{let W=T.indexOf(".");if(W===-1)return;let w=T.slice(0,W),X=$[w];if(X===void 0)return;if(!W$(X,"module"))return B(xf(w));let U=T.slice(W+1),Y=X[U];if(Y===void 0)return kZ(X,U);if(W$(Y,"root")||W$(Y,"generic"))return Y;if(W$(Y,"module"))return Y.root??B(P_(T));I$(`Unexpected resolution for alias '${T}': ${M$(Y)}`)},Qz=($,T)=>new vZ($,T),oU=new vZ({});var q_=($,T)=>{let W={};for(let w in T){let X=T[w];if(W$(X,"module")){let U=q_($,X),Y=E$(U,(G,H)=>[`${w}.${G}`,H]);Object.assign(W,Y)}else if(W$(X,"root")||W$(X,"generic"))W[w]=X;else I$(`Unexpected scope resolution ${M$(X)}`)}return W},qZ=($)=>`'${$}' is unresolvable`,xf=($)=>`'${$}' must reference a module to be accessed using dot syntax`,P_=($)=>`Reference to submodule '${$}' must specify an alias`;oU.export();var{schema:h$,node:OX,defineSchema:_U$,generic:v1}=oU;var PZ="^(?:0|[1-9]\\d*)$",ff=new RegExp(PZ),qU$=Z4(ff);var C_=Qz({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();y.intrinsic={...C_};var S_=Qz({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:PZ}},{prereducedAliases:!0}).export();Object.assign(y.intrinsic,S_);var bf=Qz({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),G$={...C_,...S_,...bf,emptyStructure:OX("structure",{},{prereduced:!0})};y.intrinsic={...G$};var I_=($)=>typeof $==="string"&&$[0]==="d"&&($[1]==="'"||$[1]==='"')&&$.at(-1)===$[1],j_=($)=>$.toString()!=="Invalid Date",B_=($)=>$.slice(2,-1),CZ=($)=>`'${$}' could not be parsed by the Date constructor`,x_=($,T)=>yf($,T),yf=($,T)=>{let W=new Date($);if(j_(W))return W;let w=QR($);if(w!==void 0){let X=new Date(w);if(j_(X))return X}return T?B(T===!0?CZ($):T):void 0};var SZ=($,T)=>{let W=$.scanner.shiftUntil(hf[b_[T]]);if($.scanner.lookahead==="")return $.error(mf(W,T));if($.scanner.shift(),T==="/"){try{new RegExp(W)}catch(w){B(String(w))}$.root=$.ctx.$.node("intersection",{domain:"string",pattern:W},{prereduced:!0})}else if(b4(T,jZ))$.root=$.ctx.$.node("unit",{unit:W});else{let w=x_(W,CZ(W));$.root=$.ctx.$.node("unit",{meta:W,unit:w})}},jZ={"'":1,'"':1},f_={"/":1,"'":1,'"':1},b_={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},hf={"'":($)=>$.lookahead==="'",'"':($)=>$.lookahead==='"',"/":($)=>$.lookahead==="/"},gf={'"':"double-quote","'":"single-quote","/":"forward slash"},mf=($,T)=>`${T}${$} requires a closing ${gf[b_[T]]}`;var y_=($)=>`Private type references should not include '#'. Use '${$}' instead.`,Zz="Optional definitions like 'string?' are only valid as properties in an object or tuple",Vz="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple";var h_={">":!0,">=":!0},g_={"<":!0,"<=":!0};var QX={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},m_=($)=>`Unmatched )${$===""?"":` before ${$}`}`,Kz=($)=>`Missing ${$}`,c_=($,T)=>`Left bounds are only valid when paired with right bounds (try ...${T}${$})`,Az=($)=>`Left-bounded expressions must specify their limits using < or <= (was ${$})`,u_=($,T,W,w)=>`An expression may have at most one left bound (parsed ${$}${QX[T]}, ${W}${QX[w]})`;var p_=($,T,W)=>d_($,T,W,[]),d_=($,T,W,w)=>{let X=W.parseUntilFinalizer();if(w.push(X.root),X.finalizer===">"){if(w.length!==T.params.length)return W.error(IZ($,T.names,w.map((U)=>U.expression)));return w}if(X.finalizer===",")return d_($,T,W,w);return X.error(Kz(">"))},IZ=($,T,W)=>`${$}<${T.join(", ")}> requires exactly ${T.length} args (got ${W.length}${W.length===0?"":`: ${W.join(", ")}`})`;var BZ=($)=>{let T=$.scanner.shiftUntilNextTerminator();if(T==="keyof")$.addPrefix("keyof");else $.root=uf($,T)},cf=($,T,W)=>{if(W.scanner.shiftUntilNonWhitespace(),W.scanner.shift()!=="<")return W.error(IZ($,T.names,[]));let X=p_($,T,W);return T(...X)},uf=($,T)=>pf($,T)??df($,T)??$.error(T===""?$.scanner.lookahead==="#"?y_($.shiftedByOne().scanner.shiftUntilNextTerminator()):xZ($):qZ(T)),pf=($,T)=>{if($.ctx.args?.[T]){let w=$.ctx.args[T];if(typeof w!=="string")return w;return $.ctx.$.node("alias",{reference:w},{prereduced:!0})}let W=$.ctx.$.maybeResolve(T);if(W$(W,"root"))return W;if(W===void 0)return;if(W$(W,"generic"))return cf(T,W,$);return B(`Unexpected resolution ${M$(W)}`)},df=($,T)=>{let W=ZR(T);if(W!==void 0)return $.ctx.$.node("unit",{unit:W});let w=KR(T);if(w!==void 0)return $.ctx.$.node("unit",{unit:w})},xZ=($)=>{let T=$.previousOperator();return T?fZ(T,$.scanner.unscanned):of($.scanner.unscanned)},fZ=($,T="")=>`Token '${$}' requires a right operand${T?` before '${T}'`:""}`,of=($)=>`Expected an expression${$?` before '${$}'`:""}`;var bZ=($)=>$.scanner.lookahead===""?$.error(xZ($)):$.scanner.lookahead==="("?$.shiftedByOne().reduceGroupOpen():$.scanner.lookaheadIsIn(f_)?SZ($,$.scanner.shift()):$.scanner.lookaheadIsIn(BT)?bZ($.shiftedByOne()):$.scanner.lookahead==="d"?$.scanner.nextLookahead in jZ?SZ($,`${$.scanner.shift()}${$.scanner.shift()}`):BZ($):BZ($);class r0 extends cQ{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>(this.lookahead in r0.terminatingChars))}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...BT};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=($,T)=>$===">"?T[0]==="="?T[1]==="=":T.trimStart()===""||b4(T.trimStart()[0],r0.terminatingChars):$==="="?T[0]!=="=":$===","||$==="?"}var l_=($,T)=>{let W=lf($,T);if($.root.hasKind("unit")){if(typeof $.root.unit==="number"){$.reduceLeftBound($.root.unit,W),$.unsetRoot();return}if($.root.unit instanceof Date){let w=`d'${$.root.description??$.root.unit.toISOString()}'`;$.unsetRoot(),$.reduceLeftBound(w,W);return}}return nf($,W)},r_={"<":1,">":1,"=":1},lf=($,T)=>$.scanner.lookaheadIs("=")?`${T}${$.scanner.shift()}`:T;var o_=($,T,W,w)=>{if(W.extends(y.intrinsic.number)){if(typeof T!=="number")return B(yZ($,T,w));return $==="=="?["min","max"]:$[0]===">"?["min"]:["max"]}if(W.extends(y.intrinsic.lengthBoundable)){if(typeof T!=="number")return B(yZ($,T,w));return $==="=="?["exactLength"]:$[0]===">"?["minLength"]:["maxLength"]}if(W.extends(y.intrinsic.Date))return $==="=="?["after","before"]:$[0]===">"?["after"]:["before"];return B(fR(W.expression))},rf=($)=>({rule:I_($.limit)?B_($.limit):$.limit,exclusive:$.comparator.length===1}),nf=($,T)=>{let W=$.unsetRoot(),w=$.scanner.location;$.parseOperand();let X=$.unsetRoot(),U=$.scanner.sliceChars(w,$.scanner.location);if($.root=W,!X.hasKind("unit")||typeof X.unit!=="number"&&!(X.unit instanceof Date))return $.error(yZ(T,U,"right"));let Y=X.unit,G=T.length===1,H=o_(T,typeof Y==="number"?Y:U,W,"right");for(let F of H)$.constrainRoot(F,T==="=="?{rule:Y}:{rule:Y,exclusive:G});if(!$.branches.leftBound)return;if(!b4(T,g_))return $.error(Az(T));let z=o_($.branches.leftBound.comparator,$.branches.leftBound.limit,W,"left");$.constrainRoot(z[0],rf($.branches.leftBound)),$.branches.leftBound=null},yZ=($,T,W)=>`Comparator ${W==="left"?QX[$]:$} must be ${W==="left"?"preceded":"followed"} by a corresponding literal (was ${T})`;var n_=($)=>{$.scanner.shiftUntilNonWhitespace();let T=$.scanner.shiftUntilNextTerminator();$.root=$.root.brand(T)};var t_=($)=>{let T=$.scanner.shiftUntilNextTerminator(),W=VR(T,{errorOnFail:i_(T)});if(W===0)$.error(i_(0));$.root=$.root.constrain("divisor",W)},i_=($)=>`% operator must be followed by a non-zero integer literal (was ${$})`;var hZ=($)=>{let T=$.scanner.shift();return T===""?$.finalize(""):T==="["?$.scanner.shift()==="]"?$.setRoot($.root.array()):$.error(tf):T==="|"?$.scanner.lookahead===">"?$.shiftedByOne().pushRootToBranch("|>"):$.pushRootToBranch(T):T==="&"?$.pushRootToBranch(T):T===")"?$.finalizeGroup():r0.lookaheadIsFinalizing(T,$.scanner.unscanned)?$.finalize(T):b4(T,r_)?l_($,T):T==="%"?t_($):T==="#"?n_($):(T in BT)?hZ($):$.error(Ez(T))},Ez=($,T="")=>`'${$}' is not allowed here${T&&` (should be ${T})`}`,tf="Missing expected ']'";var a_=($)=>{let T=$.unsetRoot();$.parseOperand();let W=$.unsetRoot();if(!W.hasKind("unit"))return $.error(af(W.expression));let w=W.unit instanceof Date?()=>new Date(W.unit):W.unit;return[T,"=",w]},af=($)=>`Default value '${$}' must a literal value`;var gZ=($,T)=>{let W=T.$.maybeResolveRoot($);if(W)return W;if($.endsWith("[]")){let U=T.$.maybeResolveRoot($.slice(0,-2));if(U)return U.array()}let w=new ZX(new r0($),T),X=sf(w);if(w.finalizer===">")B(Ez(">"));return X},sf=($)=>{$.parseOperand();let T=lU($).root;if(!T)return I$(`Root was unexpectedly unset after parsing string '${$.scanner.scanned}'`);if($.finalizer==="=")T=a_($);else if($.finalizer==="?")T=[T,"?"];if($.scanner.shiftUntilNonWhitespace(),$.scanner.lookahead)B(Ez($.scanner.lookahead));return T},lU=($)=>{while($.finalizer===void 0)ef($);return $},ef=($)=>$.hasRoot()?$.parseOperator():$.parseOperand();class ZX{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor($,T){this.scanner=$,this.ctx=T}error($){return B($)}hasRoot(){return this.root!==void 0}setRoot($){this.root=$}unsetRoot(){let $=this.root;return this.root=void 0,$}constrainRoot(...$){this.root=this.root.constrain($[0],$[1])}finalize($){if(this.groups.length)return this.error(Kz(")"));this.finalizeBranches(),this.finalizer=$}reduceLeftBound($,T){let W=QX[T];if(!b4(W,h_))return this.error(Az(T));if(this.branches.leftBound)return this.error(u_(this.branches.leftBound.limit,this.branches.leftBound.comparator,$,W));this.branches.leftBound={comparator:W,limit:$}}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 $=this.groups.pop();if(!$)return this.error(m_(this.scanner.unscanned));this.branches=$}addPrefix($){this.branches.prefixes.push($)}applyPrefixes(){while(this.branches.prefixes.length){let $=this.branches.prefixes.pop();this.root=$==="keyof"?this.root.keyof():I$(`Unexpected prefix '${$}'`)}}pushRootToBranch($){this.assertRangeUnset(),this.applyPrefixes();let T=this.root;if(this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(T)??T,$==="&")return;if(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,$==="|")return;this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null}parseUntilFinalizer(){return lU(new ZX(this.scanner,this.ctx))}parseOperator(){return hZ(this)}parseOperand(){return bZ(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(c_(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 $b="An empty string is not a valid generic parameter name",Mz=($,T,W)=>{$.shiftUntilNonWhitespace();let w=$.shiftUntilNextTerminator();if(w===""){if($.lookahead===""&&T.length)return T;return B($b)}return $.shiftUntilNonWhitespace(),Tb($,w,T,W)},s_="extends ",Tb=($,T,W,w)=>{if($.shiftUntilNonWhitespace(),$.unscanned.startsWith(s_))$.jumpForward(s_.length);else{if($.lookahead===",")$.shift();return W.push(T),Mz($,W,w)}let X=lU(new ZX($,w));return W.push([T,X.root]),Mz($,W,w)};class mZ extends h1{$;constructor($){super((...T)=>new rU($)(...T),{bind:$});this.$=$}in($){return new rU(this.$,$===void 0?void 0:this.$.parse($))}at($,T){return new rU(this.$).at($,T)}case($,T){return new rU(this.$).case($,T)}}class rU extends h1{$;in;key;branches=[];constructor($,T){super((W)=>this.caseEntries(Object.entries(W).map(([w,X])=>w==="default"?[w,X]:[this.$.parse(w),X])));this.$=$,this.in=T}at($,T){if(this.key)B(Xb);if(this.branches.length)B(Wb);return this.key=$,T?this.match(T):this}case($,T){return this.caseEntry(this.$.parse($),T)}caseEntry($,T){let w=(this.key?this.$.parse({[this.key]:$}):$).pipe(T);return this.branches.push(w),this}match($){return this($)}strings($){return this.caseEntries(Object.entries($).map(([T,W])=>T==="default"?[T,W]:[this.$.node("unit",{unit:T}),W]))}caseEntries($){for(let T=0;T<$.length;T++){let[W,w]=$[T];if(W==="default"){if(T!==$.length-1)B("default may only be specified as the last key of a switch definition");return this.default(w)}if(typeof w!=="function")return B(`Value for case "${W}" must be a function (was ${f4(w)})`);this.caseEntry(W,w)}return this}default($){if(typeof $==="function")this.case(G$.unknown,$);let T={branches:this.branches,ordered:!0};if($==="never"||$==="assert")T.meta={onFail:e_};let W=this.$.node("union",T);if(!this.in)return this.$.finalize(W);let w=this.in.pipe(W);if($==="never"||$==="assert")w=w.configureReferences({onFail:e_},"self");return this.$.finalize(w)}}var e_=($)=>$.throw(),Wb="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",Xb="At most one key matcher may be specified per expression";var Dz=($,T)=>{if(o$($)){if($[1]==="=")return[T.$.parseOwnDefinitionFormat($[0],T),"=",$[2]];if($[1]==="?")return[T.$.parseOwnDefinitionFormat($[0],T),"?"]}return Nz($,T)},$k="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",Tk="Only required keys may specify default values, e.g. { value: 'number = 0' }";var Wk=($,T)=>{let W,w={},X=IW($);for(let[Y,G]of X){let H=Yb(Y);if(H.kind==="spread"){if(!H0(w))return B(Ub);let Z=T.$.parseOwnDefinitionFormat(G,T);if(Z.equals(G$.object))continue;if(!Z.hasKind("intersection")||!Z.basis?.equals(G$.object))return B(Gb(Z.expression));W=Z.structure;continue}if(H.kind==="undeclared"){if(G!=="reject"&&G!=="delete"&&G!=="ignore")B(wb(G));w.undeclared=G;continue}let z=Dz(G,T),F=H;if(H.kind==="required"){if(!o$(z))cZ(w,"required",{key:H.normalized,value:z},T);else cZ(w,"optional",z[1]==="="?{key:H.normalized,value:z[0],default:z[2]}:{key:H.normalized,value:z[0]},T);continue}if(o$(z)){if(z[1]==="?")B($k);if(z[1]==="=")B(Tk)}if(H.kind==="optional"){cZ(w,"optional",{key:H.normalized,value:z},T);continue}let O=T.$.parseOwnDefinitionFormat(F.normalized,T),Q=Fz(O,z,T.$);if(Q.index)w.index=C$(w.index,Q.index);if(Q.required)w.required=C$(w.required,Q.required)}let U=T.$.node("structure",w);return T.$.parseSchema({domain:"object",structure:W?.merge(U)??U})},cZ=($,T,W,w)=>{$[T]=C$($[T],w.$.node(T,W))},wb=($)=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${M$($)})`,Ub="Spread operator may only be used as the first key in an object",Yb=($)=>typeof $==="symbol"?{kind:"required",normalized:$}:$.at(-1)==="?"?$.at(-2)===kU?{kind:"required",normalized:`${$.slice(0,-2)}?`}:{kind:"optional",normalized:$.slice(0,-1)}:$[0]==="["&&$.at(-1)==="]"?{kind:"index",normalized:$.slice(1,-1)}:$[0]===kU&&$[1]==="["&&$.at(-1)==="]"?{kind:"required",normalized:$.slice(1)}:$==="..."?{kind:"spread"}:$==="+"?{kind:"undeclared"}:{kind:"required",normalized:$==="\\..."?"...":$==="\\+"?"+":$},Gb=($)=>`Spread operand must resolve to an object literal type (was ${$})`;var wk=($,T)=>Eb($)?zk[$[0]]($,T):Kb($)?Gk[$[1]]($,T):null,zb=($,T)=>T.$.parseOwnDefinitionFormat($[1],T).keyof(),uZ=($,T)=>{if($[2]===void 0)return B(fZ($[1],""));let W=T.$.parseOwnDefinitionFormat($[0],T),w=T.$.parseOwnDefinitionFormat($[2],T);if($[1]==="|")return T.$.node("union",{branches:[W,w]});let X=$[1]==="&"?r6(W,w,T.$):fU(W,w,T.$);if(X instanceof r)return X.throw();return X},Hb=($,T)=>T.$.parseOwnDefinitionFormat($[0],T).array(),Fb=($,T)=>{if(typeof $[2]!=="function")return B(Uk("=>",$[2]));return T.$.parseOwnDefinitionFormat($[0],T).pipe($[2])},Uk=($,T)=>`${$===":"?"Narrow":"Morph"} expression requires a function following '${$}' (was ${typeof T})`,Ob=($,T)=>{if(typeof $[2]!=="function")return B(Uk(":",$[2]));return T.$.parseOwnDefinitionFormat($[0],T).constrain("predicate",$[2])},Qb=($,T)=>T.$.parseOwnDefinitionFormat($[0],T).configureReferences($[2],"shallow"),Yk=($)=>$,Zb=Yk({"[]":Hb,"?":()=>B(Zz)}),Vb=Yk({"|":uZ,"&":uZ,":":Ob,"=>":Fb,"|>":uZ,"@":Qb,"=":()=>B(Vz)}),Gk={...Zb,...Vb},Kb=($)=>Gk[$[1]]!==void 0,Ab=($)=>$,zk=Ab({keyof:zb,instanceof:($,T)=>{if(typeof $[1]!=="function")return B(Xk(RU($[1])));let W=$.slice(1).map((w)=>typeof w==="function"?T.$.node("proto",{proto:w}):B(Xk(RU(w))));return W.length===1?W[0]:T.$.node("union",{branches:W})},"===":($,T)=>T.$.units($.slice(1))}),Eb=($)=>zk[$[0]]!==void 0,Xk=($)=>`Expected a constructor following 'instanceof' operator (was ${$})`;var Ok=($,T)=>{let W=[{}],w=0;while(w<$.length){let X=!1;if($[w]==="..."&&w<$.length-1)X=!0,w++;let U=Dz($[w],T),[Y,G,H]=!o$(U)?[U]:U;if(w++,X){if(!Y.extends(y.intrinsic.Array))return B(Nb(Y.expression));W=W.flatMap((z)=>Y.distribute((F)=>Db(e9(z),F)))}else W=W.map((z)=>{if(G==="?")return Qk(z,Y);if(G==="=")return Mb(z,Y,H);return pZ(z,Y)})}return T.$.parseSchema(W.map((X)=>H0(X)?{proto:Array,exactLength:0}:{proto:Array,sequence:X}))},pZ=($,T)=>{if($.defaultables||$.optionals)return B($.variadic?NZ:Lb);if($.variadic)$.postfix=C$($.postfix,T);else $.prefix=C$($.prefix,T);return $},Qk=($,T)=>{if($.variadic)return B(Zk);return $.optionals=C$($.optionals,T),$},Mb=($,T,W)=>{if($.variadic)return B(Zk);if($.optionals)return B(Jb);return $.defaultables=C$($.defaultables,[[T,W]]),$},Hk=($,T)=>{if($.postfix)B(Fk);if($.variadic){if(!$.variadic.equals(T))B(Fk)}else $.variadic=T.internal;return $},Db=($,T)=>{let W=T.select({method:"find",kind:"sequence"});if(!W)return Hk($,y.intrinsic.unknown);if(W.prefix)for(let w of W.prefix)pZ($,w);if(W.optionals)for(let w of W.optionals)Qk($,w);if(W.variadic)Hk($,W.variadic);if(W.postfix)for(let w of W.postfix)pZ($,w);return $},Nb=($)=>`Spread element must be an array (was ${$})`,Fk="A tuple may have at most one variadic element",Lb="A required element may not follow an optional element",Zk="An optional element may not follow a variadic element";var Jb="A defaultable element may not follow an optional element without a default";var Rb={},Nz=($,T)=>{if(typeof $==="string"){if(T.args&&Object.keys(T.args).some((w)=>$.includes(w)))return gZ($,T);let W=Rb[T.$.name]??={};return W[$]??=gZ($,T)}return p6($,"object")?_b($,T):B(dZ(f4($)))},_b=($,T)=>{let W=JU($);switch(W){case void 0:if(W$($,"root"))return $;return Wk($,T);case"Array":return kb($,T);case"RegExp":return T.$.node("intersection",{domain:"string",pattern:$},{prereduced:!0});case"Function":{let w=IT($)?$():$;if(W$(w,"root"))return w;return B(dZ("Function"))}default:return B(dZ(W??M$($)))}},kb=($,T)=>wk($,T)??Ok($,T),dZ=($)=>`Type definitions must be strings or objects (was ${$})`;class oZ extends h1{constructor($){let T=Object.assign({errors:o6,hkt:w6,$,raw:$.parse,module:$.constructor.module,scope:$.constructor.scope,define:$.define,match:$.match,generic:$.generic,schema:$.schema,keywords:$.ambient,unit:$.unit,enumerated:$.enumerated,instanceOf:$.instanceOf,valueOf:$.valueOf,or:$.or,and:$.and,merge:$.merge,pipe:$.pipe},$.ambientAttachments);super((...W)=>{if(W.length===1)return $.parse(W[0]);if(W.length===2&&typeof W[0]==="string"&&W[0][0]==="<"&&W[0].at(-1)===">"){let w=W[0].slice(1,-1),X=$.parseGenericParams(w,{});return new yT(X,W[1],$,$,null)}return $.parse(W)},{bind:$,attach:T})}}var VX=y;class Lz extends Oz{get ambientAttachments(){if(!VX.typeAttachments)return;return this.cacheGetter("ambientAttachments",E$(VX.typeAttachments,($,T)=>[$,this.bindReference(T)]))}preparseOwnAliasEntry($,T){let W=$.indexOf("<");if(W===-1){if(W$(T,"module")||W$(T,"generic"))return[$,T];let U=this.name==="ark"?$:$==="root"?this.name:`${this.name}.${$}`,Y=this.resolvedConfig.keywords?.[U];if(Y)T=[T,"@",Y];return[$,T]}if($.at(-1)!==">")B("'>' must be the last character of a generic declaration in a scope");let w=$.slice(0,W),X=$.slice(W+1,-1);return[w,()=>{let U=this.parseGenericParams(X,{alias:w});return IR(U,T,this)}]}parseGenericParams($,T){return Mz(new r0($),[],this.createParseContext({...T,def:$,prefix:"generic"}))}normalizeRootScopeValue($){if(IT($)&&!W$($,"generic"))return $();return $}preparseOwnDefinitionFormat($,T){return{...T,def:$,prefix:T.alias??"type"}}parseOwnDefinitionFormat($,T){if(!(T.alias&&(T.alias in this.aliases))&&!T.args)T.args={this:T.id};let w=Nz($,T);if(o$(w)){if(w[1]==="=")return B(Vz);if(w[1]==="?")return B(Zz)}return w}unit=($)=>this.units([$]);valueOf=($)=>this.units(sJ($));enumerated=(...$)=>this.units($);instanceOf=($)=>this.node("proto",{proto:$},{prereduced:!0});or=(...$)=>this.schema($.map((T)=>this.parse(T)));and=(...$)=>$.reduce((T,W)=>T.and(this.parse(W)),this.intrinsic.unknown);merge=(...$)=>$.reduce((T,W)=>T.merge(this.parse(W)),this.intrinsic.object);pipe=(...$)=>this.intrinsic.unknown.pipe(...$);match=new mZ(this);declare=()=>({type:this.type});define($){return $}type=new oZ(this);static scope=($,T={})=>new Lz($,T);static module=($,T={})=>this.scope($,T).export()}var lZ=Object.assign(Lz.scope,{define:($)=>$}),P$=Lz;class Vk extends w6{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}var vb=v1(["base",G$.object],["props",G$.object])(($)=>$.base.merge($.props),Vk),Kk=P$.module({Key:G$.key,Merge:vb});class Ak extends w6{}var qb=v1("element")(($)=>{let T=$.element.exclude(G$.Array),W=T.array();return T.rawOr(W).pipe(jT).distribute((w)=>w.assertHasKind("morph").declareOut(W),h$)},Ak),Ek=P$.module({root:G$.Array,readonly:"root",index:G$.nonNegativeIntegerString,liftFrom:qb},{name:"Array"});var rZ=h$(["string",xW.FileConstructor]),Pb=rZ.rawOr(rZ.array()),Mk=h$({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:Pb}}),Dk=P$.module({root:["instanceof",FormData],value:rZ,parsed:Mk,parse:h$({in:FormData,morphs:($)=>{let T={};for(let[W,w]of $)if(W in T){let X=T[W];if(typeof X==="string"||X instanceof xW.FileConstructor)T[W]=[X,w];else X.push(w)}else T[W]=w;return T},declaredOut:Mk})},{name:"FormData"});var Nk=P$.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 Cb={Boolean:1,Number:1,String:1},Lk=P$.module({...E$({...BQ,...fQ},($,T)=>($ in Cb)?[]:[$,["instanceof",T]]),Array:Ek,TypedArray:Nk,FormData:Dk});var Sb=h$({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"}),jb=h$({domain:"number",divisor:1}),Jz=P$.module({root:G$.number,integer:jb,epoch:Sb,safe:h$({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 U4=($,T,W)=>{let w={domain:"string",pattern:{rule:$.source,flags:$.flags,meta:T}};if(W)w.meta={format:W};return OX("intersection",w)},Jk=U4(vU,"a well-formed integer string"),xk=P$.module({root:Jk,parse:h$({in:Jk,morphs:($,T)=>{let W=Number.parseInt($);return Number.isSafeInteger(W)?W:T.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:G$.integer})},{name:"string.integer"}),Ib=U4(/^[\dA-Fa-f]+$/,"hex characters only"),Bb=P$.module({root:U4(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:U4(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),Rk=U4(/^[A-Z].*$/,"capitalized"),xb=P$.module({root:h$({in:"string",morphs:($)=>$.charAt(0).toUpperCase()+$.slice(1),declaredOut:Rk}),preformatted:Rk},{name:"string.capitalize"}),fb=($)=>{let T=$.replaceAll(/[ -]+/g,""),W=0,w,X,U=!1;for(let Y=T.length-1;Y>=0;Y--){if(w=T.substring(Y,Y+1),X=Number.parseInt(w,10),U)X*=2,W+=X>=10?X%10+1:X;else W+=X;U=!U}return!!(W%10===0?T:!1)},bb=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,yb=h$({domain:"string",pattern:{meta:"a credit card number",rule:bb.source},predicate:{meta:"a credit card number",predicate:fb}});var hb=/^([+-]?\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 gb=($)=>!Number.isNaN(new Date($).valueOf()),_k=h$({domain:"string",predicate:{meta:"a parsable date",predicate:gb}}).assertHasKind("intersection"),kk=xk.root.internal.narrow(($,T)=>{let W=Number.parseInt($),w=Jz.epoch(W);if(w instanceof o6)return T.errors.merge(w),!1;return!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),mb=P$.module({root:kk,parse:h$({in:kk,morphs:($)=>new Date($),declaredOut:G$.Date})},{name:"string.date.epoch"}),vk=U4(hb,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),cb=P$.module({root:vk,parse:h$({in:vk,morphs:($)=>new Date($),declaredOut:G$.Date})},{name:"string.date.iso"}),ub=P$.module({root:_k,parse:h$({declaredIn:_k,in:"string",morphs:($,T)=>{let W=new Date($);if(Number.isNaN(W.valueOf()))return T.error("a parsable date");return W},declaredOut:G$.Date}),iso:cb,epoch:mb},{name:"string.date"}),pb=U4(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),qk="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",hT=`(${qk}[.]){3}${qk}`,db=new RegExp(`^${hT}$`),R4="(?:[0-9a-fA-F]{1,4})",ob=new RegExp(`^((?:${R4}:){7}(?:${R4}|:)|(?:${R4}:){6}(?:${hT}|:${R4}|:)|(?:${R4}:){5}(?::${hT}|(:${R4}){1,2}|:)|(?:${R4}:){4}(?:(:${R4}){0,1}:${hT}|(:${R4}){1,3}|:)|(?:${R4}:){3}(?:(:${R4}){0,2}:${hT}|(:${R4}){1,4}|:)|(?:${R4}:){2}(?:(:${R4}){0,3}:${hT}|(:${R4}){1,5}|:)|(?:${R4}:){1}(?:(:${R4}){0,4}:${hT}|(:${R4}){1,6}|:)|(?::((?::${R4}){0,5}:${hT}|(?::${R4}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),lb=P$.module({root:["v4 | v6","@","an IP address"],v4:U4(db,"an IPv4 address","ipv4"),v6:U4(ob,"an IPv6 address","ipv6")},{name:"string.ip"}),KX="a JSON string",fk=($)=>{if(!($ instanceof SyntaxError))throw $;return`must be ${KX} (${$})`},rb=h$({meta:KX,domain:"string",predicate:{meta:KX,predicate:($,T)=>{try{return JSON.parse($),!0}catch(W){return T.reject({code:"predicate",expected:KX,problem:fk(W)})}}}}),nb=($,T)=>{if($.length===0)return T.error({code:"predicate",expected:KX,actual:"empty"});try{return JSON.parse($)}catch(W){return T.error({code:"predicate",expected:KX,problem:fk(W)})}},ib=P$.module({root:rb,parse:h$({meta:"safe JSON string parser",in:"string",morphs:nb,declaredOut:G$.jsonObject})},{name:"string.json"}),Pk=U4(/^[a-z]*$/,"only lowercase letters"),tb=P$.module({root:h$({in:"string",morphs:($)=>$.toLowerCase(),declaredOut:Pk}),preformatted:Pk},{name:"string.lower"}),bk=["NFC","NFD","NFKC","NFKD"],nU=E$(bk,($,T)=>[T,h$({domain:"string",predicate:(W)=>W.normalize(T)===W,meta:`${T}-normalized unicode`})]),Rz=E$(bk,($,T)=>[T,h$({in:"string",morphs:(W)=>W.normalize(T),declaredOut:nU[T]})]),ab=P$.module({root:Rz.NFC,preformatted:nU.NFC},{name:"string.normalize.NFC"}),sb=P$.module({root:Rz.NFD,preformatted:nU.NFD},{name:"string.normalize.NFD"}),eb=P$.module({root:Rz.NFKC,preformatted:nU.NFKC},{name:"string.normalize.NFKC"}),$y=P$.module({root:Rz.NFKD,preformatted:nU.NFKD},{name:"string.normalize.NFKD"}),Ty=P$.module({root:"NFC",NFC:ab,NFD:sb,NFKC:eb,NFKD:$y},{name:"string.normalize"}),Ck=U4(t9,"a well-formed numeric string"),Wy=P$.module({root:Ck,parse:h$({in:Ck,morphs:($)=>Number.parseFloat($),declaredOut:G$.number})},{name:"string.numeric"}),Sk="a regex pattern",Xy=h$({domain:"string",predicate:{meta:Sk,predicate:($,T)=>{try{return new RegExp($),!0}catch(W){return T.reject({code:"predicate",expected:Sk,problem:String(W)})}}},meta:{format:"regex"}}),wy=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,Uy=U4(wy,"a semantic version (see https://semver.org/)"),jk=U4(/^\S.*\S$|^\S?$/,"trimmed"),Yy=P$.module({root:h$({in:"string",morphs:($)=>$.trim(),declaredOut:jk}),preformatted:jk},{name:"string.trim"}),Ik=U4(/^[A-Z]*$/,"only uppercase letters"),Gy=P$.module({root:h$({in:"string",morphs:($)=>$.toUpperCase(),declaredOut:Ik}),preformatted:Ik},{name:"string.upper"}),zy=($)=>{if(URL.canParse)return URL.canParse($);try{return new URL($),!0}catch{return!1}},Bk=h$({domain:"string",predicate:{meta:"a URL string",predicate:zy},meta:{format:"uri"}}),Hy=P$.module({root:Bk,parse:h$({declaredIn:Bk,in:"string",morphs:($,T)=>{try{return new URL($)}catch{return T.error("a URL string")}},declaredOut:h$(URL)})},{name:"string.url"}),Fy=P$.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:U4(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:U4(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:U4(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:U4(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:U4(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:U4(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:U4(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:U4(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),yk=P$.module({root:G$.string,alpha:U4(/^[A-Za-z]*$/,"only letters"),alphanumeric:U4(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:Ib,base64:Bb,capitalize:xb,creditCard:yb,date:ub,digits:U4(/^\d*$/,"only digits 0-9"),email:pb,integer:xk,ip:lb,json:ib,lower:tb,normalize:Ty,numeric:Wy,regex:Xy,semver:Uy,trim:Yy,upper:Gy,url:Hy,uuid:Fy},{name:"string"});var hk=P$.module({bigint:G$.bigint,boolean:G$.boolean,false:G$.false,never:G$.never,null:G$.null,number:G$.number,object:G$.object,string:G$.string,symbol:G$.symbol,true:G$.true,unknown:G$.unknown,undefined:G$.undefined}),gk=P$.module({root:G$.unknown,any:G$.unknown},{name:"unknown"}),Oy=P$.module({root:G$.jsonObject,stringify:OX("morph",{in:G$.jsonObject,morphs:($)=>JSON.stringify($),declaredOut:G$.string})},{name:"object.json"}),mk=P$.module({root:G$.object,json:Oy},{name:"object"});class ck extends w6{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}var Qy=v1(["K",G$.key],"V")(($)=>({domain:"object",index:{signature:$.K,value:$.V}}),ck);class uk extends w6{description='pick a set of properties from an object like `Pick(User, "name | age")`'}var Zy=v1(["T",G$.object],["K",G$.key])(($)=>$.T.pick($.K),uk);class pk extends w6{description='omit a set of properties from an object like `Omit(User, "age")`'}var Vy=v1(["T",G$.object],["K",G$.key])(($)=>$.T.omit($.K),pk);class dk extends w6{description="make all named properties of an object optional like `Partial(User)`"}var Ky=v1(["T",G$.object])(($)=>$.T.partial(),dk);class ok extends w6{description="make all named properties of an object required like `Required(User)`"}var Ay=v1(["T",G$.object])(($)=>$.T.required(),ok);class lk extends w6{description='exclude branches of a union like `Exclude("boolean", "true")`'}var Ey=v1("T","U")(($)=>$.T.exclude($.U),lk);class rk extends w6{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}var My=v1("T","U")(($)=>$.T.extract($.U),rk),nk=P$.module({Exclude:Ey,Extract:My,Omit:Vy,Partial:Ky,Pick:Zy,Record:Qy,Required:Ay});var gT=lZ({...hk,...nk,...Lk,...Kk,string:yk,number:Jz,object:mk,unknown:gk},{prereducedAliases:!0,name:"ark"}),y4=gT.export();Object.assign(VX.ambient,y4);VX.typeAttachments={string:y4.string.root,number:y4.number.root,bigint:y4.bigint,boolean:y4.boolean,symbol:y4.symbol,undefined:y4.undefined,null:y4.null,object:y4.object.root,unknown:y4.unknown.root,false:y4.false,true:y4.true,never:y4.never,arrayIndex:y4.Array.index,Key:y4.Key,Record:y4.Record,Array:y4.Array.root,Date:y4.Date};var c1=Object.assign(gT.type,VX.typeAttachments),Dy=gT.match,Ny=gT.generic,i9$=gT.schema,Ly=gT.define,Jy=gT.declare;var Ry="__vite_start_time"in globalThis,_y=typeof window!=="undefined",Zz$="vitest"in globalThis,n0=c1("string"),ik=c1('"true" | "false" | undefined'),i0=SQ({isServer:!Ry&&!_y,server:{CI:c1("string | undefined").pipe(Boolean),POSTGRES_USER:n0,POSTGRES_PASSWORD:n0,POSTGRES_DATABASE:n0,POSTGRES_HOST:n0,POSTGRES_PORT:n0.pipe(($)=>Number.parseInt($,10)),BACKEND_PORT:n0.pipe(($)=>Number.parseInt($,10)),RUN_WORKERS_FROM_SOURCE:ik.pipe(($)=>$==="true"),FRONTEND_PORT:n0.pipe(($)=>Number.parseInt($,10)),FRONTEND_ORIGINS:n0.pipe.try(($)=>JSON.parse($),c1("string[]")),API_KEY_OPENAI:c1("string | undefined"),API_KEY_RESEND:c1("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:n0,VITE_DEV_FRONTEND_HOST:c1("string | undefined"),VITE_DEV_HTTPS:ik.pipe(($)=>$==="true")},runtimeEnv:import.meta.env,emptyStringAsUndefined:!0});var iZ={};e0(iZ,{users:()=>yW,untrackedUserColumnNames:()=>ky,twoFactorMethod:()=>$v,trackedUserColumnName:()=>vy,trackableUserColumnNames:()=>sk,signInHistory:()=>Py,role:()=>ak,players:()=>nZ,passwordResetAttempts:()=>Cy,games:()=>kz,banishedIps:()=>vz,accountActions:()=>qy,accountAction:()=>ek});function mT(){return W6({length:24}).$type()}function tk($){return J`lower(${$})`}var _z=J`TO_CHAR(NOW() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`,ak=sw("role",["admin","user"]),yW=PT("users",{id:L1().primaryKey().defaultRandom(),username:W6({length:16}).notNull(),emailOffered:W6({length:254}).notNull(),emailVerified:W6({length:254}),password:W6({length:254}),createdAtIso:mT().notNull().default(_z),createdIp:W6({length:45}).notNull(),isActive:wU().notNull().default(!1),verifiedAtIso:mT(),userRole:ak().default("user")},($)=>[AQ("usernameUniqueIndex").on(tk($.username)),AQ("emailVerifiedUniqueIndex").on(tk($.emailVerified))]),ky=["id","createdAtIso","createdIp","isActive","verifiedAtIso"],sk=["username","emailOffered","emailVerified","password","userRole"],vy=sw("trackedUserColumnName",sk),ek=sw("accountAction",["cooldown","confirmEmail","signIn","resetPassword"]),qy=PT("accountActions",{userId:L1().references(()=>yW.id).primaryKey(),action:ek().notNull(),code:W6({length:254}).notNull(),wrongCodeCount:UU().notNull().default(0),expiresAtIso:mT().notNull()}),kz=PT("games",{id:L1().primaryKey().defaultRandom()}),nZ=PT("players",{userId:L1().notNull().references(()=>yW.id,{onDelete:"cascade"}),gameId:L1().notNull().references(()=>kz.id,{onDelete:"cascade"}),score:UU().notNull()},($)=>[mL({name:"players_userId_gameId_pk",columns:[$.userId,$.gameId]})]),Py=PT("signInHistory",{id:L1().primaryKey().defaultRandom(),userId:L1().references(()=>yW.id,{onDelete:"cascade"}),signInTimeIso:mT().notNull().default(_z),ipAddress:W6({length:45}).notNull(),userAgent:W6({length:1024}),successful:wU().notNull().default(!1)}),$v=sw("twoFactorMethod",["email","phone"]),Cy=PT("passwordResetAttempts",{id:L1().primaryKey().defaultRandom(),userId:L1().notNull().references(()=>yW.id,{onDelete:"cascade"}),requestedIp:W6({length:45}).notNull(),requestedAtIso:mT().notNull().default(_z),succeededIp:W6({length:45}),succeededAtIso:mT(),verificationMethod:$v().notNull()}),vz=PT("banishedIps",{ip:W6({length:45}).primaryKey(),reason:W6({length:2048}).notNull(),banishedAtIso:mT().notNull().default(_z),banishedUntilIso:mT()});var __dirname="/home/runner/work/wayforge/wayforge/apps/tempest.games/src/database";class tZ{options;sql;drizzle;observers=new Map;async setupTriggersAndNotifications(){await this.sql.file(Sy.resolve(__dirname,"notify_update.sql"));let $=[u4(yW),u4(kz),u4(nZ)];await this.sql`SELECT create_notify_triggers(${this.sql.array($)})`,await this.sql.listen("table_update",(T)=>{let W=T.split(","),w=W[0],X=W[1],U=`${w}("${X}")`;if(this.observers.has(U))this.observers.get(U).next(U)})}constructor($=!1,T={host:i0.POSTGRES_HOST,port:i0.POSTGRES_PORT,user:i0.POSTGRES_USER,password:i0.POSTGRES_PASSWORD,database:i0.POSTGRES_DATABASE}){this.options=T,this.sql=n2(T),this.drizzle=n9(this.sql,{schema:iZ,logger:$})}observe($,T){if(!this.observers.has($))this.observers.set($,new b$);this.observers.get($).subscribe("SINGLETON",T)}}import{resolve as By}from"path";import{existsSync as aZ,mkdirSync as Tv,readFileSync as jy,readdirSync as Wv,rmSync as Xv,statSync as wv,writeFileSync as Iy}from"fs";import{resolve as sZ}from"path";var Uv=class{rootDir;get initialized(){return aZ(this.rootDir)}initialize(){if(!this.initialized)Tv(this.rootDir,{recursive:!0})}constructor($){if(this.rootDir=$.path,$.eagerInit)this.initialize()}getItem($){let T=sZ(this.rootDir,$);if(aZ(T))return jy(T,"utf-8");return null}setItem($,T){this.initialize();let W=sZ(this.rootDir,$);Iy(W,T)}removeItem($){let T=sZ(this.rootDir,$);if(aZ(T))this.initialize(),Xv(T)}key($){return Wv(this.rootDir).sort((w,X)=>{let U=wv(w);return wv(X).ctimeMs-U.ctimeMs})[$]??null}clear(){Xv(this.rootDir,{recursive:!0}),Tv(this.rootDir,{recursive:!0})}get length(){return Wv(this.rootDir).length}};var eZ=new Uv({path:By(process.cwd(),"storage")});function Yv($){return $.toString({smallestUnit:"millisecond"})}function Bz$($){return Q9.Instant.from($)}import*as qz from"fs";import*as Gv from"readline";function xy($){let W=$.replace(":","T").replace(" ","").replace(/(\d{2})\/(\w{3})\/(\d{4})T(.+)/,(w,X,U,Y,G)=>{let z={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"}[U];return`${Y}-${z}-${X}T${G}`});return new Date(W)}async function zv($,T="/var/log/nginx/access.log",W=new Date){let w=new Map;if(!qz.existsSync(T))return $.error(`Log file not found: ${T}`),w;let X=qz.createReadStream(T),U=Gv.createInterface({input:X,crlfDelay:Number.POSITIVE_INFINITY}),Y=new Date(W.getTime()-3600000);return U.on("line",(G)=>{let H=/^(?<ip>\S+) \S+ \S+ \[(?<dateTime>.*?)\]/,z=G.match(H);if(z?.groups){let F=z.groups.ip,O=z.groups.dateTime,Q=xy(O);if(!Number.isNaN(Q.getTime())){if(Q>=Y&&Q<=W){let Z=w.get(F);if(!Z)Z=[],w.set(F,Z);Z.push(G)}}else $.error(`Failed to parse date: ${O}`)}}),new Promise((G,H)=>{U.on("error",(z)=>{H(z)}),U.on("close",()=>{G(w)})})}function Hv($){return $.toJsonSchema()}var fy=["Network security adjudicator, your job is to determine if an IP address should be banned.","The IP address in question created the following logs on our server today:","```nginx.log\n"].join(`
|
|
155
|
+
`);function Fv($){return fy+$.join(`
|
|
154
156
|
|
|
155
|
-
`)}var
|
|
156
|
-
`));let x=!1;for(let
|
|
157
|
-
`),x=!0;break}if(x)continue;if($.usdBudget>$.usdMinimum){let
|
|
158
|
-
`);else F++,W.info(` \uD83D\uDD4A\uFE0F not banning ${
|
|
159
|
-
`);z++}else{W.warn("\uD83D\uDCB0 insufficient funds to process all logs"),W.warn(`\uD83D\uDCB0 got through ${z}/${
|
|
160
|
-
`);break}}let O=G.length;if(G.length>0)await
|
|
157
|
+
`)}var Ov={schema:c1([{shouldBanIp:"false"},"|",{shouldBanIp:"true",veryConciseReason:"string"}]),toJsonSchema:Hv,fallback:{shouldBanIp:!1}};var yy=[".env","php"];async function Qv({generator:$,logFilePath:T,logger:W,now:w=new Date}){let X=$.usdBudget,U=new tZ({logQuery(_,S){W.info("\uD83D\uDCDD query",_,S)}}),Y=await zv(W,T,w),G=[],H=$.from(Ov),z=0,F=0;for(let[_,S]of Y){W.info(`\uD83D\uDD0D ruling on ${_}. logs:`),W.info(S.map((b)=>` ${b}`).join(`
|
|
158
|
+
`));let x=!1;for(let b of yy)if(S.some((g)=>g.includes(b))){G.push({ip:_,reason:`Always ban ${b}`}),W.info(` \uD83E\uDDD1\u200D\u2696\uFE0F banning ${_}--always ban ${b}
|
|
159
|
+
`),x=!0;break}if(x)continue;if($.usdBudget>$.usdMinimum){let b=Fv(S),g=await H(b);if(g.shouldBanIp)G.push({ip:_,reason:g.veryConciseReason}),W.info(` \uD83E\uDDD1\u200D\u2696\uFE0F banning ${_}--${g.veryConciseReason}
|
|
160
|
+
`);else F++,W.info(` \uD83D\uDD4A\uFE0F not banning ${_}
|
|
161
|
+
`);z++}else{W.warn("\uD83D\uDCB0 insufficient funds to process all logs"),W.warn(`\uD83D\uDCB0 got through ${z}/${Y.size} ips
|
|
162
|
+
`);break}}let O=G.length;if(G.length>0)await U.drizzle.insert(vz).values(G).onConflictDoNothing();let Q=[],Z=eZ.getItem("lastTribunalProcessedDate"),K=Yv(Q9.Instant.from(Z??"1970-01-01"));try{Q.push(...await U.drizzle.query.banishedIps.findMany({columns:{ip:!0},where:j9(vz.banishedAtIso,K)}))}catch(_){W.error(_)}try{if(process.env.EXPERIMENTAL_BAN_IPS)await Promise.all(Q.map((_)=>new Promise((S,x)=>by(`iptables -D INPUT -s ${_.ip} -j DROP`).on("exit",(b)=>{if(b===0)W.info(`\uD83E\uDDD1\u200D\u2696\uFE0F banned ${_.ip}`),S();else x(new Error(`iptables exited with code ${b}`))}))));else W.info("\uD83E\uDDD1\u200D\u2696\uFE0F skipping iptables update")}catch(_){if(_ instanceof Error)W.error(_.message);else{let S=ND(_);W.error("iptables exited with error",S)}}eZ.setItem("lastTribunalProcessedDate",w.toISOString()),W.info(`\u2728 banned ${O} ips, didn't ban ${F} ips`);let E=X-$.usdBudget,M=E.toLocaleString("en",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:6}),L=X.toLocaleString("en",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:6}),R=Math.round(E/X*100);W.info(`\uD83D\uDCB8 spent ${M}, ${R}% of ${L} budget`)}var t0=new oz;Object.assign(console,t0.logger,{log:t0.logger.info});process.on("SIGINT",()=>{t0.logger.info("\u2757 received SIGINT; exiting gracefully"),Pz()});process.on("SIGTERM",()=>{t0.logger.info("\u2757 received SIGTERM; exiting gracefully"),Pz()});process.on("exit",()=>{t0.logger.info("\u2757 received exit; exiting gracefully"),Pz()});t0.logger.info("\uD83D\uDEEB tribunal worker ready");var hy=new DE({usdBudget:0.01,usdMinimum:0,model:"gpt-4o-mini",apiKey:i0.API_KEY_OPENAI,cachingMode:"off",logger:t0.logger});if(i0.API_KEY_OPENAI===void 0&&!("VITEST"in import.meta.env))throw new Error("OPENAI_API_KEY is not set and vitest is not running.");await Qv({generator:hy,logFilePath:"/var/log/nginx/access.log",logger:t0.logger});Pz();function Pz(){t0.logger.info("\uD83D\uDEEC tribunal server exiting"),process.exit(0)}
|