@authhero/drizzle 0.51.0 → 0.51.2
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/dist/drizzle-adapter.cjs +35 -34
- package/dist/drizzle-adapter.mjs +18259 -12839
- package/package.json +7 -7
package/dist/drizzle-adapter.cjs
CHANGED
|
@@ -1,76 +1,77 @@
|
|
|
1
|
-
"use strict";var cc=Object.defineProperty;var uc=(e,t,n)=>t in e?cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var b=(e,t,n)=>uc(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const D=Symbol.for("drizzle:entityKind");function Ne(e,t){if(!e||typeof e!="object")return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,D))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 n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(D in n&&n[D]===t[D])return!0;n=Object.getPrototypeOf(n)}return!1}var ho;ho=D;class Kt{constructor(t,n){b(this,"name");b(this,"keyAsName");b(this,"primary");b(this,"notNull");b(this,"default");b(this,"defaultFn");b(this,"onUpdateFn");b(this,"hasDefault");b(this,"isUnique");b(this,"uniqueName");b(this,"uniqueType");b(this,"dataType");b(this,"columnType");b(this,"enumValues");b(this,"generated");b(this,"generatedIdentity");b(this,"config");this.table=t,this.config=n,this.name=n.name,this.keyAsName=n.keyAsName,this.notNull=n.notNull,this.default=n.default,this.defaultFn=n.defaultFn,this.onUpdateFn=n.onUpdateFn,this.hasDefault=n.hasDefault,this.primary=n.primaryKey,this.isUnique=n.isUnique,this.uniqueName=n.uniqueName,this.uniqueType=n.uniqueType,this.dataType=n.dataType,this.columnType=n.columnType,this.generated=n.generated,this.generatedIdentity=n.generatedIdentity}mapFromDriverValue(t){return t}mapToDriverValue(t){return t}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}b(Kt,ho,"Column");var mo;mo=D;class ta{constructor(t,n,i){b(this,"config");b(this,"$default",this.$defaultFn);b(this,"$onUpdate",this.$onUpdateFn);this.config={name:t,keyAsName:t==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:n,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(t){return this.config.default=t,this.config.hasDefault=!0,this}$defaultFn(t){return this.config.defaultFn=t,this.config.hasDefault=!0,this}$onUpdateFn(t){return this.config.onUpdateFn=t,this.config.hasDefault=!0,this}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(t){this.config.name===""&&(this.config.name=t)}}b(ta,mo,"ColumnBuilder");const It=Symbol.for("drizzle:Name"),Ri=Symbol.for("drizzle:isPgEnum");function dc(e){return!!e&&typeof e=="function"&&Ri in e&&e[Ri]===!0}var yo;yo=D;class ui{constructor(t,n,i,o=!1,a=[]){this._={brand:"Subquery",sql:t,selectedFields:n,alias:i,isWith:o,usedTables:a}}}b(ui,yo,"Subquery");const _c={startActiveSpan(e,t){return t()}},Pt=Symbol.for("drizzle:ViewBaseConfig"),bn=Symbol.for("drizzle:Schema"),Li=Symbol.for("drizzle:Columns"),Pi=Symbol.for("drizzle:ExtraConfigColumns"),Sn=Symbol.for("drizzle:OriginalName"),Nn=Symbol.for("drizzle:BaseName"),ln=Symbol.for("drizzle:IsAlias"),Ui=Symbol.for("drizzle:ExtraConfigBuilder"),pc=Symbol.for("drizzle:IsDrizzleTable");var wo,vo,bo,So,No,Eo,Oo,Io,ko,Ao;Ao=D,ko=It,Io=Sn,Oo=bn,Eo=Li,No=Pi,So=Nn,bo=ln,vo=pc,wo=Ui;class ge{constructor(t,n,i){b(this,ko);b(this,Io);b(this,Oo);b(this,Eo);b(this,No);b(this,So);b(this,bo,!1);b(this,vo,!0);b(this,wo);this[It]=this[Sn]=t,this[bn]=n,this[Nn]=i}}b(ge,Ao,"Table"),b(ge,"Symbol",{Name:It,Schema:bn,OriginalName:Sn,Columns:Li,ExtraConfigColumns:Pi,BaseName:Nn,IsAlias:ln,ExtraConfigBuilder:Ui});function na(e){return e!=null&&typeof e.getSQL=="function"}function fc(e){var n;const t={sql:"",params:[]};for(const i of e)t.sql+=i.sql,t.params.push(...i.params),(n=i.typings)!=null&&n.length&&(t.typings||(t.typings=[]),t.typings.push(...i.typings));return t}var To;To=D;class Ee{constructor(t){b(this,"value");this.value=Array.isArray(t)?t:[t]}getSQL(){return new de([this])}}b(Ee,To,"StringChunk");var Co;Co=D;const _t=class _t{constructor(t){b(this,"decoder",ia);b(this,"shouldInlineParams",!1);b(this,"usedTables",[]);this.queryChunks=t;for(const n of t)if(Ne(n,ge)){const i=n[ge.Symbol.Schema];this.usedTables.push(i===void 0?n[ge.Symbol.Name]:i+"."+n[ge.Symbol.Name])}}append(t){return this.queryChunks.push(...t.queryChunks),this}toQuery(t){return _c.startActiveSpan("drizzle.buildSQL",n=>{const i=this.buildQueryFromSourceParams(this.queryChunks,t);return n==null||n.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(t,n){const i=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:o,escapeName:a,escapeParam:s,prepareTyping:c,inlineParams:u,paramStartIndex:p}=i;return fc(t.map(d=>{var h;if(Ne(d,Ee))return{sql:d.value.join(""),params:[]};if(Ne(d,cn))return{sql:a(d.value),params:[]};if(d===void 0)return{sql:"",params:[]};if(Array.isArray(d)){const m=[new Ee("(")];for(const[y,S]of d.entries())m.push(S),y<d.length-1&&m.push(new Ee(", "));return m.push(new Ee(")")),this.buildQueryFromSourceParams(m,i)}if(Ne(d,_t))return this.buildQueryFromSourceParams(d.queryChunks,{...i,inlineParams:u||d.shouldInlineParams});if(Ne(d,ge)){const m=d[ge.Symbol.Schema],y=d[ge.Symbol.Name];return{sql:m===void 0||d[ln]?a(y):a(m)+"."+a(y),params:[]}}if(Ne(d,Kt)){const m=o.getColumnCasing(d);if(n.invokeSource==="indexes")return{sql:a(m),params:[]};const y=d.table[ge.Symbol.Schema];return{sql:d.table[ln]||y===void 0?a(d.table[ge.Symbol.Name])+"."+a(m):a(y)+"."+a(d.table[ge.Symbol.Name])+"."+a(m),params:[]}}if(Ne(d,di)){const m=d[Pt].schema,y=d[Pt].name;return{sql:m===void 0||d[Pt].isAlias?a(y):a(m)+"."+a(y),params:[]}}if(Ne(d,Ut)){if(Ne(d.value,Ft))return{sql:s(p.value++,d),params:[d],typings:["none"]};const m=d.value===null?null:d.encoder.mapToDriverValue(d.value);if(Ne(m,_t))return this.buildQueryFromSourceParams([m],i);if(u)return{sql:this.mapInlineParam(m,i),params:[]};let y=["none"];return c&&(y=[c(d.encoder)]),{sql:s(p.value++,m),params:[m],typings:y}}return Ne(d,Ft)?{sql:s(p.value++,d),params:[d],typings:["none"]}:Ne(d,_t.Aliased)&&d.fieldAlias!==void 0?{sql:a(d.fieldAlias),params:[]}:Ne(d,ui)?d._.isWith?{sql:a(d._.alias),params:[]}:this.buildQueryFromSourceParams([new Ee("("),d._.sql,new Ee(") "),new cn(d._.alias)],i):dc(d)?d.schema?{sql:a(d.schema)+"."+a(d.enumName),params:[]}:{sql:a(d.enumName),params:[]}:na(d)?(h=d.shouldOmitSQLParens)!=null&&h.call(d)?this.buildQueryFromSourceParams([d.getSQL()],i):this.buildQueryFromSourceParams([new Ee("("),d.getSQL(),new Ee(")")],i):u?{sql:this.mapInlineParam(d,i),params:[]}:{sql:s(p.value++,d),params:[d],typings:["none"]}}))}mapInlineParam(t,{escapeString:n}){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="string")return n(t);if(typeof t=="object"){const i=t.toString();return n(i==="[object Object]"?JSON.stringify(t):i)}throw new Error("Unexpected param value: "+t)}getSQL(){return this}as(t){return t===void 0?this:new _t.Aliased(this,t)}mapWith(t){return this.decoder=typeof t=="function"?{mapFromDriverValue:t}:t,this}inlineParams(){return this.shouldInlineParams=!0,this}if(t){return t?this:void 0}};b(_t,Co,"SQL");let de=_t;var zo;zo=D;class cn{constructor(t){b(this,"brand");this.value=t}getSQL(){return new de([this])}}b(cn,zo,"Name");function gc(e){return typeof e=="object"&&e!==null&&"mapToDriverValue"in e&&typeof e.mapToDriverValue=="function"}const ia={mapFromDriverValue:e=>e},oa={mapToDriverValue:e=>e};({...ia,...oa});var Do;Do=D;class Ut{constructor(t,n=oa){b(this,"brand");this.value=t,this.encoder=n}getSQL(){return new de([this])}}b(Ut,Do,"Param");function k(e,...t){const n=[];(t.length>0||e.length>0&&e[0]!=="")&&n.push(new Ee(e[0]));for(const[i,o]of t.entries())n.push(o,new Ee(e[i+1]));return new de(n)}(e=>{function t(){return new de([])}e.empty=t;function n(u){return new de(u)}e.fromList=n;function i(u){return new de([new Ee(u)])}e.raw=i;function o(u,p){const d=[];for(const[h,m]of u.entries())h>0&&p!==void 0&&d.push(p),d.push(m);return new de(d)}e.join=o;function a(u){return new cn(u)}e.identifier=a;function s(u){return new Ft(u)}e.placeholder=s;function c(u,p){return new Ut(u,p)}e.param=c})(k||(k={}));(e=>{var n;n=D;const i=class i{constructor(a,s){b(this,"isSelectionField",!1);this.sql=a,this.fieldAlias=s}getSQL(){return this.sql}clone(){return new i(this.sql,this.fieldAlias)}};b(i,n,"SQL.Aliased");let t=i;e.Aliased=t})(de||(de={}));var xo;xo=D;class Ft{constructor(t){this.name=t}getSQL(){return new de([this])}}b(Ft,xo,"Placeholder");const hc=Symbol.for("drizzle:IsDrizzleView");var $o,Ro,Lo;Lo=D,Ro=Pt,$o=hc;class di{constructor({name:t,schema:n,selectedFields:i,query:o}){b(this,Ro);b(this,$o,!0);this[Pt]={name:t,originalName:t,schema:n,selectedFields:i,query:o,isExisting:!o,isAlias:!1}}getSQL(){return new de([this])}}b(di,Lo,"View");Kt.prototype.getSQL=function(){return new de([this])};ge.prototype.getSQL=function(){return new de([this])};ui.prototype.getSQL=function(){return new de([this])};function Gt(e,t){return{name:typeof e=="string"&&e.length>0?e:"",config:typeof e=="object"?e:t}}const ra=typeof TextDecoder>"u"?null:new TextDecoder;function st(e,t){return gc(t)&&!na(e)&&!Ne(e,Ut)&&!Ne(e,Ft)&&!Ne(e,Kt)&&!Ne(e,ge)&&!Ne(e,di)?new Ut(e,t):e}const _=(e,t)=>k`${e} = ${st(t,e)}`,mc=(e,t)=>k`${e} <> ${st(t,e)}`;function w(...e){const t=e.filter(n=>n!==void 0);if(t.length!==0)return t.length===1?new de(t):new de([new Ee("("),k.join(t,new Ee(" and ")),new Ee(")")])}function Be(...e){const t=e.filter(n=>n!==void 0);if(t.length!==0)return t.length===1?new de(t):new de([new Ee("("),k.join(t,new Ee(" or ")),new Ee(")")])}const un=(e,t)=>k`${e} > ${st(t,e)}`,Tt=(e,t)=>k`${e} >= ${st(t,e)}`,Qe=(e,t)=>k`${e} < ${st(t,e)}`,pt=(e,t)=>k`${e} <= ${st(t,e)}`;function Re(e,t){return Array.isArray(t)?t.length===0?k`false`:k`${e} in ${t.map(n=>st(n,e))}`:k`${e} in ${st(t,e)}`}function xe(e){return k`${e} is null`}function rn(e){return k`${e} is not null`}function St(e,t){return k`${e} like ${t}`}function me(e){return k`${e} asc`}function le(e){return k`${e} desc`}function ye(e){return k`count(${k.raw("*")})`.mapWith(Number)}function yc(){const e=t=>{throw new Error(`Actions are not implemented in the Drizzle adapter (called ${t}). Use the Kysely adapter for tenants that require actions.`)};return{create:()=>e("create"),get:()=>e("get"),list:()=>e("list"),update:()=>e("update"),remove:()=>e("remove")}}function wc(){const e=t=>{throw new Error(`Action executions are not implemented in the Drizzle adapter (called ${t}). Use the Kysely adapter for tenants that require actions.`)};return{create:()=>e("create"),get:()=>e("get")}}function vc(){const e=t=>{throw new Error(`Action versions are not implemented in the Drizzle adapter (called ${t}). Use the Kysely adapter for tenants that require actions.`)};return{create:()=>e("create"),get:()=>e("get"),list:()=>e("list"),removeForAction:()=>e("removeForAction")}}var Po;Po=D;class aa{constructor(t,n){b(this,"reference");b(this,"_onUpdate");b(this,"_onDelete");this.reference=()=>{const{name:i,columns:o,foreignColumns:a}=t();return{name:i,columns:o,foreignTable:a[0].table,foreignColumns:a}},n&&(this._onUpdate=n.onUpdate,this._onDelete=n.onDelete)}onUpdate(t){return this._onUpdate=t,this}onDelete(t){return this._onDelete=t,this}build(t){return new sa(t,this)}}b(aa,Po,"SQLiteForeignKeyBuilder");var Uo;Uo=D;class sa{constructor(t,n){b(this,"reference");b(this,"onUpdate");b(this,"onDelete");this.table=t,this.reference=n.reference,this.onUpdate=n._onUpdate,this.onDelete=n._onDelete}getName(){const{name:t,columns:n,foreignColumns:i}=this.reference(),o=n.map(c=>c.name),a=i.map(c=>c.name),s=[this.table[It],...o,i[0].table[It],...a];return t??`${s.join("_")}_fk`}}b(sa,Uo,"SQLiteForeignKey");function bc(e,t){return`${e[It]}_${t.join("_")}_unique`}var Fo,Zo;class Je extends(Zo=ta,Fo=D,Zo){constructor(){super(...arguments);b(this,"foreignKeyConfigs",[])}references(n,i={}){return this.foreignKeyConfigs.push({ref:n,actions:i}),this}unique(n){return this.config.isUnique=!0,this.config.uniqueName=n,this}generatedAlwaysAs(n,i){return this.config.generated={as:n,type:"always",mode:(i==null?void 0:i.mode)??"virtual"},this}buildForeignKeys(n,i){return this.foreignKeyConfigs.map(({ref:o,actions:a})=>((s,c)=>{const u=new aa(()=>{const p=s();return{columns:[n],foreignColumns:[p]}});return c.onUpdate&&u.onUpdate(c.onUpdate),c.onDelete&&u.onDelete(c.onDelete),u.build(i)})(o,a))}}b(Je,Fo,"SQLiteColumnBuilder");var Mo,jo;class Ke extends(jo=Kt,Mo=D,jo){constructor(t,n){n.uniqueName||(n.uniqueName=bc(t,[n.name])),super(t,n),this.table=t}}b(Ke,Mo,"SQLiteColumn");var qo,Bo;class la extends(Bo=Je,qo=D,Bo){constructor(t){super(t,"bigint","SQLiteBigInt")}build(t){return new ca(t,this.config)}}b(la,qo,"SQLiteBigIntBuilder");var Jo,Ko;class ca extends(Ko=Ke,Jo=D,Ko){getSQLType(){return"blob"}mapFromDriverValue(t){if(typeof Buffer<"u"&&Buffer.from){const n=Buffer.isBuffer(t)?t:t instanceof ArrayBuffer?Buffer.from(t):t.buffer?Buffer.from(t.buffer,t.byteOffset,t.byteLength):Buffer.from(t);return BigInt(n.toString("utf8"))}return BigInt(ra.decode(t))}mapToDriverValue(t){return Buffer.from(t.toString())}}b(ca,Jo,"SQLiteBigInt");var Go,Vo;class ua extends(Vo=Je,Go=D,Vo){constructor(t){super(t,"json","SQLiteBlobJson")}build(t){return new da(t,this.config)}}b(ua,Go,"SQLiteBlobJsonBuilder");var Ho,Wo;class da extends(Wo=Ke,Ho=D,Wo){getSQLType(){return"blob"}mapFromDriverValue(t){if(typeof Buffer<"u"&&Buffer.from){const n=Buffer.isBuffer(t)?t:t instanceof ArrayBuffer?Buffer.from(t):t.buffer?Buffer.from(t.buffer,t.byteOffset,t.byteLength):Buffer.from(t);return JSON.parse(n.toString("utf8"))}return JSON.parse(ra.decode(t))}mapToDriverValue(t){return Buffer.from(JSON.stringify(t))}}b(da,Ho,"SQLiteBlobJson");var Qo,Xo;class _a extends(Xo=Je,Qo=D,Xo){constructor(t){super(t,"buffer","SQLiteBlobBuffer")}build(t){return new pa(t,this.config)}}b(_a,Qo,"SQLiteBlobBufferBuilder");var Yo,er;class pa extends(er=Ke,Yo=D,er){mapFromDriverValue(t){return Buffer.isBuffer(t)?t:Buffer.from(t)}getSQLType(){return"blob"}}b(pa,Yo,"SQLiteBlobBuffer");function Sc(e,t){const{name:n,config:i}=Gt(e,t);return(i==null?void 0:i.mode)==="json"?new ua(n):(i==null?void 0:i.mode)==="bigint"?new la(n):new _a(n)}var tr,nr;class fa extends(nr=Je,tr=D,nr){constructor(t,n,i){super(t,"custom","SQLiteCustomColumn"),this.config.fieldConfig=n,this.config.customTypeParams=i}build(t){return new ga(t,this.config)}}b(fa,tr,"SQLiteCustomColumnBuilder");var ir,or;class ga extends(or=Ke,ir=D,or){constructor(n,i){super(n,i);b(this,"sqlName");b(this,"mapTo");b(this,"mapFrom");this.sqlName=i.customTypeParams.dataType(i.fieldConfig),this.mapTo=i.customTypeParams.toDriver,this.mapFrom=i.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(n){return typeof this.mapFrom=="function"?this.mapFrom(n):n}mapToDriverValue(n){return typeof this.mapTo=="function"?this.mapTo(n):n}}b(ga,ir,"SQLiteCustomColumn");function Nc(e){return(t,n)=>{const{name:i,config:o}=Gt(t,n);return new fa(i,o,e)}}var rr,ar;class fn extends(ar=Je,rr=D,ar){constructor(t,n,i){super(t,n,i),this.config.autoIncrement=!1}primaryKey(t){return t!=null&&t.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}}b(fn,rr,"SQLiteBaseIntegerBuilder");var sr,lr;class gn extends(lr=Ke,sr=D,lr){constructor(){super(...arguments);b(this,"autoIncrement",this.config.autoIncrement)}getSQLType(){return"integer"}}b(gn,sr,"SQLiteBaseInteger");var cr,ur;class ha extends(ur=fn,cr=D,ur){constructor(t){super(t,"number","SQLiteInteger")}build(t){return new ma(t,this.config)}}b(ha,cr,"SQLiteIntegerBuilder");var dr,_r;class ma extends(_r=gn,dr=D,_r){}b(ma,dr,"SQLiteInteger");var pr,fr;class ya extends(fr=fn,pr=D,fr){constructor(t,n){super(t,"date","SQLiteTimestamp"),this.config.mode=n}defaultNow(){return this.default(k`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(t){return new wa(t,this.config)}}b(ya,pr,"SQLiteTimestampBuilder");var gr,hr;class wa extends(hr=gn,gr=D,hr){constructor(){super(...arguments);b(this,"mode",this.config.mode)}mapFromDriverValue(n){return this.config.mode==="timestamp"?new Date(n*1e3):new Date(n)}mapToDriverValue(n){const i=n.getTime();return this.config.mode==="timestamp"?Math.floor(i/1e3):i}}b(wa,gr,"SQLiteTimestamp");var mr,yr;class va extends(yr=fn,mr=D,yr){constructor(t,n){super(t,"boolean","SQLiteBoolean"),this.config.mode=n}build(t){return new ba(t,this.config)}}b(va,mr,"SQLiteBooleanBuilder");var wr,vr;class ba extends(vr=gn,wr=D,vr){constructor(){super(...arguments);b(this,"mode",this.config.mode)}mapFromDriverValue(n){return Number(n)===1}mapToDriverValue(n){return n?1:0}}b(ba,wr,"SQLiteBoolean");function N(e,t){const{name:n,config:i}=Gt(e,t);return(i==null?void 0:i.mode)==="timestamp"||(i==null?void 0:i.mode)==="timestamp_ms"?new ya(n,i.mode):(i==null?void 0:i.mode)==="boolean"?new va(n,i.mode):new ha(n)}var br,Sr;class Sa extends(Sr=Je,br=D,Sr){constructor(t){super(t,"string","SQLiteNumeric")}build(t){return new Na(t,this.config)}}b(Sa,br,"SQLiteNumericBuilder");var Nr,Er;class Na extends(Er=Ke,Nr=D,Er){mapFromDriverValue(t){return typeof t=="string"?t:String(t)}getSQLType(){return"numeric"}}b(Na,Nr,"SQLiteNumeric");var Or,Ir;class Ea extends(Ir=Je,Or=D,Ir){constructor(t){super(t,"number","SQLiteNumericNumber")}build(t){return new Oa(t,this.config)}}b(Ea,Or,"SQLiteNumericNumberBuilder");var kr,Ar;class Oa extends(Ar=Ke,kr=D,Ar){constructor(){super(...arguments);b(this,"mapToDriverValue",String)}mapFromDriverValue(n){return typeof n=="number"?n:Number(n)}getSQLType(){return"numeric"}}b(Oa,kr,"SQLiteNumericNumber");var Tr,Cr;class Ia extends(Cr=Je,Tr=D,Cr){constructor(t){super(t,"bigint","SQLiteNumericBigInt")}build(t){return new ka(t,this.config)}}b(Ia,Tr,"SQLiteNumericBigIntBuilder");var zr,Dr;class ka extends(Dr=Ke,zr=D,Dr){constructor(){super(...arguments);b(this,"mapFromDriverValue",BigInt);b(this,"mapToDriverValue",String)}getSQLType(){return"numeric"}}b(ka,zr,"SQLiteNumericBigInt");function Ec(e,t){const{name:n,config:i}=Gt(e,t),o=i==null?void 0:i.mode;return o==="number"?new Ea(n):o==="bigint"?new Ia(n):new Sa(n)}var xr,$r;class Aa extends($r=Je,xr=D,$r){constructor(t){super(t,"number","SQLiteReal")}build(t){return new Ta(t,this.config)}}b(Aa,xr,"SQLiteRealBuilder");var Rr,Lr;class Ta extends(Lr=Ke,Rr=D,Lr){getSQLType(){return"real"}}b(Ta,Rr,"SQLiteReal");function Oc(e){return new Aa(e??"")}var Pr,Ur;class Ca extends(Ur=Je,Pr=D,Ur){constructor(t,n){super(t,"string","SQLiteText"),this.config.enumValues=n.enum,this.config.length=n.length}build(t){return new za(t,this.config)}}b(Ca,Pr,"SQLiteTextBuilder");var Fr,Zr;class za extends(Zr=Ke,Fr=D,Zr){constructor(n,i){super(n,i);b(this,"enumValues",this.config.enumValues);b(this,"length",this.config.length)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}}b(za,Fr,"SQLiteText");var Mr,jr;class Da extends(jr=Je,Mr=D,jr){constructor(t){super(t,"json","SQLiteTextJson")}build(t){return new xa(t,this.config)}}b(Da,Mr,"SQLiteTextJsonBuilder");var qr,Br;class xa extends(Br=Ke,qr=D,Br){getSQLType(){return"text"}mapFromDriverValue(t){return JSON.parse(t)}mapToDriverValue(t){return JSON.stringify(t)}}b(xa,qr,"SQLiteTextJson");function l(e,t={}){const{name:n,config:i}=Gt(e,t);return i.mode==="json"?new Da(n):new Ca(n,i)}function Ic(){return{blob:Sc,customType:Nc,integer:N,numeric:Ec,real:Oc,text:l}}const qn=Symbol.for("drizzle:SQLiteInlineForeignKeys");var Jr,Kr,Gr,Vr,Hr;class Zt extends(Hr=ge,Vr=D,Gr=ge.Symbol.Columns,Kr=qn,Jr=ge.Symbol.ExtraConfigBuilder,Hr){constructor(){super(...arguments);b(this,Gr);b(this,Kr,[]);b(this,Jr)}}b(Zt,Vr,"SQLiteTable"),b(Zt,"Symbol",Object.assign({},ge.Symbol,{InlineForeignKeys:qn}));function kc(e,t,n,i,o=e){const a=new Zt(e,i,o),s=typeof t=="function"?t(Ic()):t,c=Object.fromEntries(Object.entries(s).map(([p,d])=>{const h=d;h.setName(p);const m=h.build(a);return a[qn].push(...h.buildForeignKeys(m,a)),[p,m]})),u=Object.assign(a,c);return u[ge.Symbol.Columns]=c,u[ge.Symbol.ExtraConfigColumns]=c,n&&(u[Zt.Symbol.ExtraConfigBuilder]=n),u}const Z=(e,t,n)=>kc(e,t,n);var Wr;Wr=D;class _i{constructor(t,n){this.name=t,this.unique=n}on(...t){return new $a(this.name,t,this.unique)}}b(_i,Wr,"SQLiteIndexBuilderOn");var Qr;Qr=D;class $a{constructor(t,n,i){b(this,"config");this.config={name:t,columns:n,unique:i,where:void 0}}where(t){return this.config.where=t,this}build(t){return new Ra(this.config,t)}}b($a,Qr,"SQLiteIndexBuilder");var Xr;Xr=D;class Ra{constructor(t,n){b(this,"config");this.config={...t,table:n}}}b(Ra,Xr,"SQLiteIndex");function z(e){return new _i(e,!1)}function gt(e){return new _i(e,!0)}function Ce(...e){return e[0].columns?new Bn(e[0].columns,e[0].name):new Bn(e)}var Yr;Yr=D;class Bn{constructor(t,n){b(this,"columns");b(this,"name");this.columns=t,this.name=n}build(t){return new La(t,this.columns,this.name)}}b(Bn,Yr,"SQLitePrimaryKeyBuilder");var ea;ea=D;class La{constructor(t,n,i){b(this,"columns");b(this,"name");this.table=t,this.columns=n,this.name=i}getName(){return this.name??`${this.table[Zt.Symbol.Name]}_${this.columns.map(t=>t.name).join("_")}_pk`}}b(La,ea,"SQLitePrimaryKey");const F=Z("tenants",{id:l("id",{length:191}).primaryKey(),name:l("name",{length:255}),audience:l("audience",{length:255}),sender_email:l("sender_email",{length:255}),sender_name:l("sender_name",{length:255}),language:l("language",{length:255}),logo:l("logo",{length:255}),primary_color:l("primary_color",{length:255}),secondary_color:l("secondary_color",{length:255}),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull(),support_url:l("support_url",{length:255}),idle_session_lifetime:N("idle_session_lifetime"),session_lifetime:N("session_lifetime"),session_cookie:l("session_cookie"),allowed_logout_urls:l("allowed_logout_urls"),ephemeral_session_lifetime:N("ephemeral_session_lifetime"),idle_ephemeral_session_lifetime:N("idle_ephemeral_session_lifetime"),default_redirection_uri:l("default_redirection_uri"),default_client_id:l("default_client_id",{length:255}),enabled_locales:l("enabled_locales"),default_directory:l("default_directory",{length:255}),error_page:l("error_page"),flags:l("flags"),friendly_name:l("friendly_name",{length:255}),picture_url:l("picture_url"),support_email:l("support_email",{length:255}),sandbox_version:l("sandbox_version",{length:50}),sandbox_versions_available:l("sandbox_versions_available"),legacy_sandbox_version:l("legacy_sandbox_version",{length:50}),change_password:l("change_password"),guardian_mfa_page:l("guardian_mfa_page"),device_flow:l("device_flow"),default_token_quota:l("default_token_quota"),default_audience:l("default_audience",{length:255}),default_organization:l("default_organization",{length:255}),sessions:l("sessions"),oidc_logout:l("oidc_logout"),allow_organization_name_in_authentication_api:N("allow_organization_name_in_authentication_api"),customize_mfa_in_postlogin_action:N("customize_mfa_in_postlogin_action"),acr_values_supported:l("acr_values_supported"),mtls:l("mtls"),pushed_authorization_requests_supported:N("pushed_authorization_requests_supported"),authorization_response_iss_parameter_supported:N("authorization_response_iss_parameter_supported")}),q=Z("users",{user_id:l("user_id",{length:255}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),email:l("email",{length:255}),given_name:l("given_name",{length:255}),family_name:l("family_name",{length:255}),nickname:l("nickname",{length:255}),name:l("name",{length:255}),picture:l("picture",{length:2083}),tags:l("tags",{length:255}),phone_number:l("phone_number",{length:17}),phone_verified:N("phone_verified",{mode:"boolean"}),username:l("username",{length:128}),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull(),linked_to:l("linked_to",{length:255}),last_ip:l("last_ip",{length:255}),login_count:N("login_count").notNull(),last_login:l("last_login",{length:255}),registration_completed_at:l("registration_completed_at",{length:35}),provider:l("provider",{length:255}).notNull(),connection:l("connection",{length:255}),email_verified:N("email_verified",{mode:"boolean"}).notNull(),is_social:N("is_social",{mode:"boolean"}).notNull(),app_metadata:l("app_metadata",{length:4096}).notNull().default("{}"),user_metadata:l("user_metadata").notNull().default("{}"),profileData:l("profileData",{length:2048}),locale:l("locale",{length:255}),middle_name:l("middle_name",{length:100}),preferred_username:l("preferred_username",{length:255}),profile:l("profile"),website:l("website"),gender:l("gender",{length:50}),birthdate:l("birthdate",{length:10}),zoneinfo:l("zoneinfo",{length:100}),address:l("address")},e=>[Ce({columns:[e.user_id,e.tenant_id],name:"users_tenants"}),gt("unique_email_provider").on(e.email,e.provider,e.tenant_id),gt("unique_phone_provider").on(e.phone_number,e.provider,e.tenant_id),gt("unique_username_provider").on(e.username,e.provider,e.tenant_id),z("users_email_index").on(e.email),z("users_linked_to_index").on(e.linked_to),z("users_name_index").on(e.name),z("users_phone_tenant_provider_index").on(e.tenant_id,e.phone_number,e.provider)]),oe=Z("passwords",{id:l("id",{length:21}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),user_id:l("user_id",{length:255}).notNull(),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull(),password:l("password",{length:255}).notNull(),algorithm:l("algorithm",{length:16}).notNull().default("bcrypt"),is_current:N("is_current").notNull().default(1)}),se=Z("sessions",{id:l("id",{length:21}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),user_id:l("user_id",{length:255}),created_at_ts:N("created_at_ts").notNull(),updated_at_ts:N("updated_at_ts").notNull(),expires_at_ts:N("expires_at_ts"),idle_expires_at_ts:N("idle_expires_at_ts"),authenticated_at_ts:N("authenticated_at_ts"),last_interaction_at_ts:N("last_interaction_at_ts"),used_at_ts:N("used_at_ts"),revoked_at_ts:N("revoked_at_ts"),device:l("device").notNull(),clients:l("clients").notNull(),login_session_id:l("login_session_id",{length:21})},e=>[Ce({columns:[e.tenant_id,e.id],name:"sessions_pk"}),z("IDX_sessions_login_session_id").on(e.login_session_id),z("idx_sessions_user_id").on(e.tenant_id,e.user_id),z("idx_sessions_expires_at_ts").on(e.expires_at_ts)]),J=Z("refresh_tokens",{id:l("id",{length:26}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),client_id:l("client_id",{length:191}).notNull(),login_id:l("login_id",{length:26}).notNull(),user_id:l("user_id",{length:255}),resource_servers:l("resource_servers").notNull(),device:l("device").notNull(),rotating:N("rotating",{mode:"boolean"}).notNull(),token_lookup:l("token_lookup",{length:16}),token_hash:l("token_hash",{length:64}),family_id:l("family_id",{length:26}),rotated_to:l("rotated_to",{length:26}),rotated_at_ts:N("rotated_at_ts"),created_at_ts:N("created_at_ts").notNull(),expires_at_ts:N("expires_at_ts"),idle_expires_at_ts:N("idle_expires_at_ts"),last_exchanged_at_ts:N("last_exchanged_at_ts"),revoked_at_ts:N("revoked_at_ts")},e=>[Ce({columns:[e.tenant_id,e.id],name:"refresh_tokens_pk"}),z("idx_refresh_tokens_user_id").on(e.tenant_id,e.user_id),z("idx_refresh_tokens_login_id").on(e.login_id),z("idx_refresh_tokens_expires_at_ts").on(e.expires_at_ts),z("idx_refresh_tokens_token_lookup").on(e.tenant_id,e.token_lookup),z("idx_refresh_tokens_family_id").on(e.tenant_id,e.family_id)]),Q=Z("login_sessions",{id:l("id",{length:21}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),session_id:l("session_id",{length:21}),csrf_token:l("csrf_token",{length:21}).notNull(),auth_params:l("auth_params"),authorization_url:l("authorization_url"),created_at_ts:N("created_at_ts").notNull(),updated_at_ts:N("updated_at_ts").notNull(),expires_at_ts:N("expires_at_ts").notNull(),ip:l("ip",{length:39}),useragent:l("useragent"),auth0Client:l("auth0Client",{length:255}),state:l("state",{length:50}).notNull().default("pending"),state_data:l("state_data"),failure_reason:l("failure_reason"),user_id:l("user_id",{length:255}),auth_connection:l("auth_connection",{length:255}),auth_strategy_strategy:l("auth_strategy_strategy",{length:64}),auth_strategy_strategy_type:l("auth_strategy_strategy_type",{length:64}),authenticated_at:l("authenticated_at",{length:35})},e=>[Ce({columns:[e.tenant_id,e.id],name:"login_sessions_pk"}),z("login_sessions_id_index").on(e.id),z("login_sessions_state_idx").on(e.state),z("login_sessions_state_updated_idx").on(e.state,e.updated_at_ts),z("login_sessions_tenant_user_idx").on(e.tenant_id,e.user_id),z("idx_login_sessions_expires_at_ts").on(e.expires_at_ts)]),ce=Z("codes",{code_id:l("code_id",{length:191}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),user_id:l("user_id",{length:255}),login_id:l("login_id",{length:255}),connection_id:l("connection_id",{length:255}),code_type:l("code_type",{length:255}).notNull(),created_at:l("created_at",{length:35}).notNull(),expires_at:l("expires_at",{length:35}).notNull(),used_at:l("used_at",{length:35}),code_verifier:l("code_verifier",{length:128}),code_challenge:l("code_challenge",{length:128}),code_challenge_method:l("code_challenge_method",{length:5}),redirect_uri:l("redirect_uri",{length:1024}),nonce:l("nonce",{length:1024}),state:l("state",{length:2048})},e=>[Ce({columns:[e.code_id,e.code_type],name:"PK_codes_code_id_code_type"}),z("codes_expires_at_index").on(e.expires_at)]),Ac=Z("authentication_codes",{tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),code:l("code",{length:255}).primaryKey(),client_id:l("client_id",{length:255}).notNull(),user_id:l("user_id",{length:255}).notNull(),nonce:l("nonce",{length:255}),state:l("state",{length:8192}),scope:l("scope",{length:1024}),response_type:l("response_type",{length:256}),response_mode:l("response_mode",{length:256}),redirect_uri:l("redirect_uri",{length:1024}),created_at:l("created_at",{length:35}).notNull(),expires_at:l("expires_at",{length:35}).notNull(),used_at:l("used_at",{length:35})}),Tc=Z("otps",{tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),id:l("id",{length:255}).primaryKey(),client_id:l("client_id",{length:255}).notNull(),code:l("code",{length:255}).notNull(),email:l("email",{length:255}).notNull(),user_id:l("user_id",{length:255}),send:l("send",{length:255}),nonce:l("nonce",{length:255}),state:l("state",{length:1024}),scope:l("scope",{length:1024}),response_type:l("response_type",{length:256}),response_mode:l("response_mode",{length:256}),redirect_uri:l("redirect_uri",{length:1024}),created_at:l("created_at",{length:35}).notNull(),expires_at:l("expires_at",{length:35}).notNull(),used_at:l("used_at",{length:35}),audience:l("audience",{length:255}),ip:l("ip",{length:64})},e=>[z("otps_email_index").on(e.email),z("otps_expires_at_index").on(e.expires_at)]),Cc=Z("tickets",{tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),id:l("id",{length:255}).primaryKey(),client_id:l("client_id",{length:255}).notNull(),email:l("email",{length:255}).notNull(),nonce:l("nonce",{length:255}),state:l("state",{length:1024}),scope:l("scope",{length:1024}),response_type:l("response_type",{length:256}),response_mode:l("response_mode",{length:256}),redirect_uri:l("redirect_uri",{length:1024}),created_at:l("created_at",{length:35}).notNull(),expires_at:l("expires_at",{length:35}).notNull(),used_at:l("used_at",{length:35})}),B=Z("clients",{client_id:l("client_id",{length:191}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),name:l("name",{length:255}).notNull(),description:l("description",{length:140}),global:N("global").notNull().default(0),client_secret:l("client_secret",{length:255}),app_type:l("app_type",{length:64}).default("regular_web"),logo_uri:l("logo_uri",{length:2083}),is_first_party:N("is_first_party").notNull().default(0),oidc_conformant:N("oidc_conformant").notNull().default(1),auth0_conformant:N("auth0_conformant").notNull().default(1),callbacks:l("callbacks").notNull(),allowed_origins:l("allowed_origins").notNull(),web_origins:l("web_origins").notNull(),client_aliases:l("client_aliases").notNull(),allowed_clients:l("allowed_clients").notNull(),allowed_logout_urls:l("allowed_logout_urls").notNull(),session_transfer:l("session_transfer").notNull(),oidc_logout:l("oidc_logout").notNull(),grant_types:l("grant_types").notNull(),jwt_configuration:l("jwt_configuration").notNull(),signing_keys:l("signing_keys").notNull(),encryption_key:l("encryption_key").notNull(),sso:N("sso").notNull().default(0),sso_disabled:N("sso_disabled").notNull().default(1),cross_origin_authentication:N("cross_origin_authentication").notNull().default(0),cross_origin_loc:l("cross_origin_loc",{length:2083}),custom_login_page_on:N("custom_login_page_on").notNull().default(0),custom_login_page:l("custom_login_page"),custom_login_page_preview:l("custom_login_page_preview"),form_template:l("form_template"),addons:l("addons").notNull(),token_endpoint_auth_method:l("token_endpoint_auth_method",{length:64}).default("client_secret_basic"),client_metadata:l("client_metadata").notNull(),mobile:l("mobile").notNull(),initiate_login_uri:l("initiate_login_uri",{length:2083}),native_social_login:l("native_social_login").notNull(),refresh_token:l("refresh_token").notNull(),default_organization:l("default_organization").notNull(),organization_usage:l("organization_usage",{length:32}).default("deny"),organization_require_behavior:l("organization_require_behavior",{length:32}).default("no_prompt"),client_authentication_methods:l("client_authentication_methods").notNull(),require_pushed_authorization_requests:N("require_pushed_authorization_requests").notNull().default(0),require_proof_of_possession:N("require_proof_of_possession").notNull().default(0),hide_sign_up_disabled_error:N("hide_sign_up_disabled_error").notNull().default(0),signed_request_object:l("signed_request_object").notNull(),compliance_level:l("compliance_level",{length:64}),par_request_expiry:N("par_request_expiry"),token_quota:l("token_quota").notNull(),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull(),connections:l("connections").notNull().default("[]"),owner_user_id:l("owner_user_id",{length:255}),registration_type:l("registration_type",{length:32}),registration_metadata:l("registration_metadata"),user_linking_mode:l("user_linking_mode",{length:16})},e=>[Ce({columns:[e.tenant_id,e.client_id],name:"clients_tenant_id_client_id"}),z("idx_clients_owner_user_id").on(e.tenant_id,e.owner_user_id)]),W=Z("client_registration_tokens",{id:l("id",{length:255}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),token_hash:l("token_hash",{length:64}).notNull(),type:l("type",{length:8}).notNull(),client_id:l("client_id",{length:191}),sub:l("sub",{length:255}),constraints:l("constraints"),single_use:N("single_use").notNull().default(0),used_at_ts:N("used_at_ts"),expires_at_ts:N("expires_at_ts"),created_at_ts:N("created_at_ts").notNull(),revoked_at_ts:N("revoked_at_ts")},e=>[gt("idx_client_registration_tokens_hash").on(e.tenant_id,e.token_hash),z("idx_client_registration_tokens_client").on(e.tenant_id,e.client_id)]),Se=Z("client_grants",{id:l("id",{length:21}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),client_id:l("client_id",{length:191}).notNull(),audience:l("audience",{length:191}).notNull(),scope:l("scope").default("[]"),organization_usage:l("organization_usage",{length:32}),allow_any_organization:N("allow_any_organization").default(0),is_system:N("is_system").default(0),subject_type:l("subject_type",{length:32}),authorization_details_types:l("authorization_details_types").default("[]"),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[Ce({columns:[e.tenant_id,e.id],name:"pk_client_grants"}),z("idx_client_grants_audience").on(e.audience)]),fe=Z("connections",{id:l("id",{length:255}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),name:l("name",{length:255}).notNull(),response_type:l("response_type",{length:255}),response_mode:l("response_mode",{length:255}),strategy:l("strategy",{length:64}),options:l("options",{length:8192}).notNull().default("{}"),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull(),display_name:l("display_name",{length:255}),is_domain_connection:N("is_domain_connection"),show_as_button:N("show_as_button"),is_system:N("is_system").notNull().default(0),metadata:l("metadata",{length:4096})},e=>[Ce({columns:[e.tenant_id,e.id]}),z("connections_tenant_id_index").on(e.tenant_id),gt("connections_id_unique").on(e.id)]),ze=Z("custom_domains",{custom_domain_id:l("custom_domain_id",{length:256}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),domain:l("domain",{length:255}).notNull(),primary:N("primary",{mode:"boolean"}).notNull(),status:l("status",{length:50}).notNull(),type:l("type",{length:50}).notNull(),origin_domain_name:l("origin_domain_name",{length:255}),verification:l("verification",{length:2048}),custom_client_ip_header:l("custom_client_ip_header",{length:50}),tls_policy:l("tls_policy",{length:50}),domain_metadata:l("domain_metadata",{length:2048}),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[gt("custom_domains_domain_unique").on(e.domain)]),zc=Z("domains",{id:l("id",{length:255}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),domain:l("domain",{length:255}).notNull(),email_service:l("email_service",{length:255}),email_api_key:l("email_api_key",{length:255}),dkim_private_key:l("dkim_private_key",{length:2048}),dkim_public_key:l("dkim_public_key",{length:2048}),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()}),Y=Z("organizations",{id:l("id",{length:21}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull(),name:l("name",{length:256}).notNull(),display_name:l("display_name",{length:256}),branding:l("branding"),metadata:l("metadata"),enabled_connections:l("enabled_connections"),token_quota:l("token_quota"),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[z("idx_organizations_tenant_id").on(e.tenant_id)]),ue=Z("user_organizations",{id:l("id",{length:21}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull(),user_id:l("user_id",{length:191}).notNull(),organization_id:l("organization_id",{length:21}).notNull(),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[gt("user_organizations_unique").on(e.tenant_id,e.user_id,e.organization_id),z("idx_user_organizations_tenant_id").on(e.tenant_id),z("idx_user_organizations_user_id").on(e.user_id),z("idx_user_organizations_organization_id").on(e.organization_id)]),ke=Z("invites",{id:l("id",{length:21}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull(),organization_id:l("organization_id",{length:21}).notNull(),inviter:l("inviter").notNull(),invitee:l("invitee").notNull(),client_id:l("client_id",{length:191}).notNull(),connection_id:l("connection_id",{length:21}),invitation_url:l("invitation_url").notNull(),created_at:l("created_at",{length:35}).notNull(),expires_at:l("expires_at",{length:35}).notNull(),app_metadata:l("app_metadata"),user_metadata:l("user_metadata"),roles:l("roles"),ticket_id:l("ticket_id",{length:191}),ttl_sec:N("ttl_sec"),send_invitation_email:N("send_invitation_email")},e=>[z("idx_invites_tenant_id").on(e.tenant_id),z("idx_invites_organization_id").on(e.organization_id),z("idx_invites_expires_at").on(e.expires_at),z("idx_invites_tenant_created").on(e.tenant_id,e.created_at)]),_e=Z("roles",{id:l("id",{length:21}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull(),name:l("name",{length:50}).notNull(),description:l("description",{length:255}),is_system:N("is_system").notNull().default(0),metadata:l("metadata",{length:4096}),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[Ce({columns:[e.tenant_id,e.id],name:"roles_pk"})]),Fe=Z("role_permissions",{tenant_id:l("tenant_id",{length:191}).notNull(),role_id:l("role_id",{length:21}).notNull(),resource_server_identifier:l("resource_server_identifier",{length:191}).notNull(),permission_name:l("permission_name",{length:191}).notNull(),created_at:l("created_at",{length:35}).notNull()},e=>[Ce({columns:[e.tenant_id,e.role_id,e.resource_server_identifier,e.permission_name],name:"role_permissions_pk"}),z("role_permissions_role_fk").on(e.tenant_id,e.role_id),z("role_permissions_permission_fk").on(e.tenant_id,e.resource_server_identifier,e.permission_name)]),je=Z("user_permissions",{tenant_id:l("tenant_id",{length:191}).notNull(),user_id:l("user_id",{length:191}).notNull(),resource_server_identifier:l("resource_server_identifier",{length:191}).notNull(),permission_name:l("permission_name",{length:191}).notNull(),organization_id:l("organization_id",{length:21}).notNull().default(""),created_at:l("created_at",{length:35}).notNull()},e=>[Ce({columns:[e.tenant_id,e.user_id,e.resource_server_identifier,e.permission_name,e.organization_id],name:"user_permissions_pk"}),z("user_permissions_user_fk").on(e.tenant_id,e.user_id),z("user_permissions_permission_fk").on(e.tenant_id,e.resource_server_identifier,e.permission_name),z("user_permissions_organization_fk").on(e.organization_id)]),qe=Z("user_roles",{tenant_id:l("tenant_id",{length:191}).notNull(),user_id:l("user_id",{length:191}).notNull(),role_id:l("role_id",{length:21}).notNull(),organization_id:l("organization_id",{length:191}).notNull().default(""),created_at:l("created_at",{length:35}).notNull()},e=>[Ce({columns:[e.tenant_id,e.user_id,e.role_id,e.organization_id],name:"user_roles_pk"}),z("user_roles_user_fk").on(e.tenant_id,e.user_id),z("user_roles_role_fk").on(e.tenant_id,e.role_id),z("user_roles_organization_fk").on(e.organization_id)]),ee=Z("resource_servers",{id:l("id",{length:21}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull(),identifier:l("identifier",{length:191}).notNull(),name:l("name",{length:255}).notNull(),scopes:l("scopes",{length:4096}),signing_alg:l("signing_alg",{length:64}),signing_secret:l("signing_secret",{length:2048}),token_lifetime:N("token_lifetime"),token_lifetime_for_web:N("token_lifetime_for_web"),skip_consent_for_verifiable_first_party_clients:N("skip_consent_for_verifiable_first_party_clients"),allow_offline_access:N("allow_offline_access"),verification_key:l("verification_key",{length:4096}),options:l("options",{length:4096}),is_system:N("is_system").notNull().default(0),metadata:l("metadata",{length:4096}),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[Ce({columns:[e.tenant_id,e.id],name:"resource_servers_pk"})]),$t=Z("branding",{tenant_id:l("tenant_id",{length:191}).primaryKey().references(()=>F.id,{onDelete:"cascade"}),logo_url:l("logo_url",{length:512}),favicon_url:l("favicon_url",{length:512}),font_url:l("font_url",{length:512}),colors_primary:l("colors_primary",{length:8}),colors_page_background_type:l("colors_page_background_type",{length:32}),colors_page_background_start:l("colors_page_background_start",{length:8}),colors_page_background_end:l("colors_page_background_end",{length:8}),colors_page_background_angle_dev:N("colors_page_background_angle_dev"),dark_mode:l("dark_mode",{length:8})}),ot=Z("universal_login_templates",{tenant_id:l("tenant_id",{length:191}).primaryKey().references(()=>F.id,{onDelete:"cascade"}),body:l("body").notNull(),created_at_ts:N("created_at_ts").notNull(),updated_at_ts:N("updated_at_ts").notNull()}),Ve=Z("themes",{tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),themeId:l("themeId",{length:255}).notNull(),displayName:l("displayName",{length:255}).notNull(),colors_primary_button_label:l("colors_primary_button_label",{length:24}).notNull(),colors_primary_button:l("colors_primary_button",{length:24}).notNull(),colors_secondary_button_border:l("colors_secondary_button_border",{length:24}).notNull(),colors_secondary_button_label:l("colors_secondary_button_label",{length:24}).notNull(),colors_base_focus_color:l("colors_base_focus_color",{length:24}).notNull(),colors_base_hover_color:l("colors_base_hover_color",{length:24}).notNull(),colors_body_text:l("colors_body_text",{length:24}).notNull(),colors_captcha_widget_theme:l("colors_captcha_widget_theme",{length:24}).notNull(),colors_error:l("colors_error",{length:24}).notNull(),colors_header:l("colors_header",{length:24}).notNull(),colors_icons:l("colors_icons",{length:24}).notNull(),colors_input_background:l("colors_input_background",{length:24}).notNull(),colors_input_border:l("colors_input_border",{length:24}).notNull(),colors_input_filled_text:l("colors_input_filled_text",{length:24}).notNull(),colors_input_labels_placeholders:l("colors_input_labels_placeholders",{length:24}).notNull(),colors_links_focused_components:l("colors_links_focused_components",{length:24}).notNull(),colors_success:l("colors_success",{length:24}).notNull(),colors_widget_background:l("colors_widget_background",{length:24}).notNull(),colors_widget_border:l("colors_widget_border",{length:24}).notNull(),borders_button_border_radius:N("borders_button_border_radius").notNull(),borders_button_border_weight:N("borders_button_border_weight").notNull(),borders_buttons_style:l("borders_buttons_style",{length:24}).notNull(),borders_input_border_radius:N("borders_input_border_radius").notNull(),borders_input_border_weight:N("borders_input_border_weight").notNull(),borders_inputs_style:l("borders_inputs_style",{length:24}).notNull(),borders_show_widget_shadow:N("borders_show_widget_shadow",{mode:"boolean"}).notNull(),borders_widget_border_weight:N("borders_widget_border_weight").notNull(),borders_widget_corner_radius:N("borders_widget_corner_radius").notNull(),fonts_body_text_bold:N("fonts_body_text_bold").notNull(),fonts_body_text_size:N("fonts_body_text_size").notNull(),fonts_buttons_text_bold:N("fonts_buttons_text_bold").notNull(),fonts_buttons_text_size:N("fonts_buttons_text_size").notNull(),fonts_font_url:l("fonts_font_url",{length:255}).notNull(),fonts_input_labels_bold:N("fonts_input_labels_bold").notNull(),fonts_input_labels_size:N("fonts_input_labels_size").notNull(),fonts_links_bold:N("fonts_links_bold",{mode:"boolean"}).notNull(),fonts_links_size:N("fonts_links_size").notNull(),fonts_links_style:l("fonts_links_style",{length:24}).notNull(),fonts_reference_text_size:N("fonts_reference_text_size").notNull(),fonts_subtitle_bold:N("fonts_subtitle_bold",{mode:"boolean"}).notNull(),fonts_subtitle_size:N("fonts_subtitle_size").notNull(),fonts_title_bold:N("fonts_title_bold",{mode:"boolean"}).notNull(),fonts_title_size:N("fonts_title_size").notNull(),page_background_background_color:l("page_background_background_color",{length:24}).notNull(),page_background_background_image_url:l("page_background_background_image_url",{length:255}).notNull(),page_background_page_layout:l("page_background_page_layout",{length:24}).notNull(),widget_header_text_alignment:l("widget_header_text_alignment",{length:24}).notNull(),widget_logo_height:N("widget_logo_height").notNull(),widget_logo_position:l("widget_logo_position",{length:24}).notNull(),widget_logo_url:l("widget_logo_url",{length:255}).notNull(),widget_social_buttons_layout:l("widget_social_buttons_layout",{length:24}).notNull(),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[Ce({columns:[e.tenant_id,e.themeId],name:"themes_pkey"}),z("themes_tenant_id_idx").on(e.tenant_id)]),Ae=Z("forms",{id:l("id",{length:255}).primaryKey(),name:l("name",{length:255}).notNull(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),messages:l("messages",{length:255}),languages:l("languages",{length:255}),translations:l("translations",{length:4096}),nodes:l("nodes",{length:4096}),start:l("start",{length:255}),ending:l("ending",{length:255}),style:l("style",{length:1042}),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[z("forms_tenant_id_idx").on(e.tenant_id)]),Te=Z("flows",{id:l("id",{length:24}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),name:l("name",{length:150}).notNull(),actions:l("actions"),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[z("flows_tenant_id_idx").on(e.tenant_id)]),Rt=Z("prompt_settings",{tenant_id:l("tenant_id",{length:191}).primaryKey(),universal_login_experience:l("universal_login_experience",{length:16}).notNull().default("new"),identifier_first:N("identifier_first",{mode:"boolean"}).notNull().default(!0),password_first:N("password_first",{mode:"boolean"}).notNull().default(!1),webauthn_platform_first_factor:N("webauthn_platform_first_factor",{mode:"boolean"}).notNull().default(!1)}),rt=Z("email_providers",{tenant_id:l("tenant_id",{length:191}).primaryKey(),name:l("name",{length:255}).notNull(),enabled:N("enabled",{mode:"boolean"}).notNull(),default_from_address:l("default_from_address",{length:255}),credentials:l("credentials",{length:2048}).notNull().default("{}"),settings:l("settings",{length:2048}).notNull().default("{}"),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()}),Ze=Z("email_templates",{tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),template:l("template",{length:64}).notNull(),body:l("body").notNull(),from:l("from",{length:255}).notNull(),subject:l("subject",{length:255}).notNull(),syntax:l("syntax",{length:16}).notNull().default("liquid"),result_url:l("result_url",{length:2048}),url_lifetime_in_seconds:N("url_lifetime_in_seconds"),include_email_in_redirect:N("include_email_in_redirect",{mode:"boolean"}).notNull().default(!1),enabled:N("enabled",{mode:"boolean"}).notNull().default(!0),created_at:l("created_at",{length:35}).notNull(),updated_at:l("updated_at",{length:35}).notNull()},e=>[Ce({columns:[e.tenant_id,e.template]})]),be=Z("hooks",{hook_id:l("hook_id",{length:21}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),url:l("url",{length:512}),trigger_id:l("trigger_id",{length:255}).notNull(),enabled:N("enabled",{mode:"boolean"}).notNull(),created_at_ts:N("created_at_ts").notNull(),updated_at_ts:N("updated_at_ts").notNull(),synchronous:N("synchronous",{mode:"boolean"}).notNull().default(!1),priority:N("priority"),form_id:l("form_id",{length:128}),template_id:l("template_id",{length:64}),code_id:l("code_id",{length:21}),metadata:l("metadata")},e=>[z("hooks_tenant_id_idx").on(e.tenant_id)]),He=Z("hook_code",{id:l("id",{length:21}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),code:l("code").notNull(),secrets:l("secrets"),created_at_ts:N("created_at_ts").notNull(),updated_at_ts:N("updated_at_ts").notNull()},e=>[z("hook_code_tenant_id_idx").on(e.tenant_id)]),We=Z("keys",{kid:l("kid",{length:255}).primaryKey(),tenant_id:l("tenant_id",{length:191}).references(()=>F.id,{onDelete:"cascade"}),created_at:l("created_at",{length:35}).notNull(),revoked_at:l("revoked_at",{length:35}),cert:l("cert",{length:4096}),pkcs7:l("pkcs7",{length:4096}),fingerprint:l("fingerprint",{length:256}),thumbprint:l("thumbprint",{length:256}),current_since:l("current_since",{length:35}),current_until:l("current_until",{length:35}),type:l("type",{length:50}).notNull().default("jwt_signing"),connection:l("connection",{length:255}).references(()=>fe.id,{onDelete:"cascade"})}),Oe=Z("custom_text",{tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),prompt:l("prompt",{length:64}).notNull(),language:l("language",{length:16}).notNull(),custom_text:l("custom_text").notNull(),created_at_ts:N("created_at_ts").notNull(),updated_at_ts:N("updated_at_ts").notNull()},e=>[Ce({columns:[e.tenant_id,e.prompt,e.language]})]),pe=Z("authentication_methods",{id:l("id",{length:26}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),user_id:l("user_id",{length:255}).notNull(),type:l("type",{length:32}).notNull(),phone_number:l("phone_number",{length:32}),totp_secret:l("totp_secret",{length:255}),credential_id:l("credential_id",{length:512}),public_key:l("public_key"),sign_count:N("sign_count"),credential_backed_up:N("credential_backed_up"),transports:l("transports",{length:512}),friendly_name:l("friendly_name",{length:255}),confirmed:N("confirmed").notNull().default(0),created_at_ts:N("created_at_ts").notNull(),updated_at_ts:N("updated_at_ts").notNull()},e=>[z("authentication_methods_tenant_user_idx").on(e.tenant_id,e.user_id),z("authentication_methods_credential_id_idx").on(e.credential_id)]),$=Z("logs",{log_id:l("log_id",{length:21}).primaryKey(),category:l("category",{length:255}),tenant_id:l("tenant_id",{length:64}),user_id:l("user_id",{length:64}),ip:l("ip",{length:255}),type:l("type",{length:8}).notNull(),date:l("date",{length:35}).notNull(),client_id:l("client_id",{length:255}),client_name:l("client_name",{length:255}),user_agent:l("user_agent",{length:255}),description:l("description",{length:255}),details:l("details",{length:2048}),isMobile:N("isMobile"),user_name:l("user_name",{length:255}),connection:l("connection",{length:255}),connection_id:l("connection_id",{length:255}),audience:l("audience",{length:255}),scope:l("scope",{length:255}),strategy:l("strategy",{length:255}),strategy_type:l("strategy_type",{length:255}),hostname:l("hostname",{length:255}),auth0_client:l("auth0_client",{length:8192}),session_connection:l("session_connection",{length:255}),country_code:l("country_code",{length:2}),city_name:l("city_name",{length:255}),latitude:l("latitude",{length:255}),longitude:l("longitude",{length:255}),time_zone:l("time_zone",{length:255}),continent_code:l("continent_code",{length:2})},e=>[z("logs_user_id").on(e.user_id),z("logs_tenant_id").on(e.tenant_id),z("logs_date").on(e.date),z("IDX_logs_tenant_date_type_user").on(e.tenant_id,e.date,e.type,e.user_id)]),U=Z("outbox_events",{id:l("id",{length:26}).primaryKey(),tenant_id:l("tenant_id",{length:191}).notNull().references(()=>F.id,{onDelete:"cascade"}),event_type:l("event_type",{length:64}).notNull(),log_type:l("log_type",{length:64}).notNull(),aggregate_type:l("aggregate_type",{length:64}).notNull(),aggregate_id:l("aggregate_id",{length:255}).notNull(),payload:l("payload").notNull(),created_at:l("created_at",{length:35}).notNull(),processed_at:l("processed_at",{length:35}),retry_count:N("retry_count").notNull().default(0),next_retry_at:l("next_retry_at",{length:35}),error:l("error"),claimed_by:l("claimed_by",{length:255}),claim_expires_at:l("claim_expires_at",{length:35}),dead_lettered_at:l("dead_lettered_at",{length:35}),final_error:l("final_error")},e=>[z("idx_outbox_events_tenant_id").on(e.tenant_id),z("idx_outbox_events_processed_at").on(e.processed_at),z("idx_outbox_events_claimed_by").on(e.claimed_by),z("idx_outbox_events_tenant_dead_lettered").on(e.tenant_id,e.dead_lettered_at)]),Dc=Object.freeze(Object.defineProperty({__proto__:null,authenticationCodes:Ac,authenticationMethods:pe,branding:$t,clientGrants:Se,clientRegistrationTokens:W,clients:B,codes:ce,connections:fe,customDomains:ze,customText:Oe,domains:zc,emailProviders:rt,emailTemplates:Ze,flows:Te,forms:Ae,hookCode:He,hooks:be,invites:ke,keys:We,loginSessions:Q,logs:$,organizations:Y,otps:Tc,outboxEvents:U,passwords:oe,promptSettings:Rt,refreshTokens:J,resourceServers:ee,rolePermissions:Fe,roles:_e,sessions:se,tenants:F,themes:Ve,tickets:Cc,universalLoginTemplates:ot,userOrganizations:ue,userPermissions:je,userRoles:qe,users:q},Symbol.toStringTag,{value:"Module"}));function K(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>n!==null&&typeof n=="object"?K(n):n);const t={...e};for(const n in t){const i=t[n];i===null?delete t[n]:i!==null&&typeof i=="object"&&(Array.isArray(i)?t[n]=i.map(o=>o!==null&&typeof o=="object"?K(o):o):t[n]=K(i))}return t}function xc(e,t,n={...e}){for(const i of t)e[i]!==void 0&&(n[i]=JSON.stringify(e[i]));return n}function $c(e,t,n=e){for(const i of t)e[i]!==void 0&&(n[i]=e[i]?1:0)}function Pa(e){const t={};for(const n in e)e[n]!==void 0&&e[n]!==null&&(t[n]=e[n]);return t}function R(e,t){if(e==null)return t;if(typeof e=="string")try{return JSON.parse(e)}catch{return t}return e}function Jn(e,t="",n={}){for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=t?`${t}_${i}`:i,a=e[i];typeof a=="object"&&a!==null&&!Array.isArray(a)?Jn(a,o,n):typeof a=="boolean"?n[o]=a?1:0:n[o]=a}return n}function Ua(e,t){const n={};for(const[i,o]of Object.entries(e)){const a=t.find(s=>i.startsWith(`${s}_`));if(!a)n[i]=o;else{const s=i.slice(a.length+1);n[a]={...n[a],[s]:o}}}return n}function Rc(e){return typeof e=="string"?parseInt(e,10):typeof e=="bigint"?Number(e):e}function Lc(e){return e==="dark"||e==="light"||e==="auto"}function Pc(e){return{async get(t){const n=await e.select().from($t).where(_($t.tenant_id,t)).get();if(!n)return null;const{tenant_id:i,colors_primary:o,colors_page_background_type:a,colors_page_background_start:s,colors_page_background_end:c,colors_page_background_angle_dev:u,font_url:p,dark_mode:d,...h}=n;return K({...h,colors:{primary:o,page_background:{type:a,start:s,end:c,angle_deg:u}},font:p?{url:p}:void 0,dark_mode:Lc(d)?d:void 0})},async set(t,n){const{colors:i,font:o,dark_mode:a,...s}=n,c=i==null?void 0:i.page_background,u=c&&typeof c=="object"?c:void 0,p={...s,colors_primary:i==null?void 0:i.primary,colors_page_background_type:u==null?void 0:u.type,colors_page_background_start:u==null?void 0:u.start,colors_page_background_end:u==null?void 0:u.end,colors_page_background_angle_dev:u==null?void 0:u.angle_deg,font_url:o==null?void 0:o.url,dark_mode:a};await e.insert($t).values({tenant_id:t,...p}).onConflictDoUpdate({target:$t.tenant_id,set:p})}}}var lt=class extends Error{constructor(t=500,n){super(n==null?void 0:n.message,{cause:n==null?void 0:n.cause});b(this,"res");b(this,"status");this.res=n==null?void 0:n.res,this.status=t}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}};function Ye(e,t,n){const i=t.split(/ OR /i);if(i.length>1){const p=i.map(d=>{const h=d.trim().match(/^([^:]+):(.+)$/);if(h){const[,m,y]=h;if(!m||!y)return null;const S=y.replace(/^"(.*)"$/,"$1"),C=e[m.trim()];return C?_(C,S.trim()):null}return null}).filter(Boolean);return p.length===0?void 0:Be(...p)}const o=[];let a="",s=!1;for(let p=0;p<t.length;p++){const d=t[p];d==='"'?(s=!s,a+=d):d===" "&&!s?a.trim()&&(o.push(a.trim()),a=""):a+=d}a.trim()&&o.push(a.trim());const c=o.filter(p=>p!=="AND").map(p=>p.replace(/^([^:]+)=/g,"$1:")).map(p=>{let d=p.startsWith("-"),h=null,m="",y=!1,S;if(p.startsWith("-_exists_:"))h=p.substring(10),y=!0,d=!0;else if(p.startsWith("_exists_:"))h=p.substring(9),y=!0,d=!1;else if(p.includes(":")){const C=d?p.substring(1):p,L=C.indexOf(":");h=C.substring(0,L),m=C.substring(L+1),y=!1,m.startsWith(">=")?(S=">=",m=m.substring(2)):m.startsWith(">")?(S=">",m=m.substring(1)):m.startsWith("<=")?(S="<=",m=m.substring(2)):m.startsWith("<")?(S="<",m=m.substring(1)):S="=",m.startsWith('"')&&m.endsWith('"')&&m.length>1&&(m=m.slice(1,-1))}else h=null,m=p,y=!1;return{key:h,value:m,isNegation:d,isExistsQuery:y,operator:S}}),u=[];for(const{key:p,value:d,isNegation:h,isExistsQuery:m,operator:y}of c)if(p){const S=e[p];if(!S){m?u.push(h?k`${k.identifier(p)} IS NULL`:k`${k.identifier(p)} IS NOT NULL`):u.push(k`${k.identifier(p)} ${k.raw(h?"!=":y??"=")} ${d}`);continue}if(m)u.push(h?xe(S):rn(S));else if(h)switch(y){case">":u.push(pt(S,d));break;case">=":u.push(Qe(S,d));break;case"<":u.push(Tt(S,d));break;case"<=":u.push(un(S,d));break;default:u.push(mc(S,d))}else switch(y){case">":u.push(un(S,d));break;case">=":u.push(Tt(S,d));break;case"<":u.push(Qe(S,d));break;case"<=":u.push(pt(S,d));break;default:u.push(_(S,d))}}else if(d){const C=(d.includes("|")?[...n,"user_id"]:n).map(L=>{const x=e[L];return x?L==="user_id"?_(x,d):St(x,`%${d}%`):null}).filter(Boolean);C.length>0&&u.push(Be(...C))}if(u.length!==0)return u.length===1?u[0]:w(...u)}const pi=["global","is_first_party","oidc_conformant","auth0_conformant","sso","sso_disabled","cross_origin_authentication","custom_login_page_on","require_pushed_authorization_requests","require_proof_of_possession","hide_sign_up_disabled_error"],fi=["callbacks","allowed_origins","web_origins","client_aliases","allowed_clients","allowed_logout_urls","grant_types","signing_keys"],gi=["session_transfer","oidc_logout","jwt_configuration","encryption_key","addons","client_metadata","mobile","native_social_login","refresh_token","default_organization","client_authentication_methods","signed_request_object","token_quota","registration_metadata"];function Wt(e){const{tenant_id:t,connections:n,...i}=e,o={...i};for(const a of pi)o[a]=!!i[a];for(const a of fi)o[a]=R(i[a],[]);for(const a of gi)o[a]=R(i[a],{});return o.connections=R(n,[]),K(o)}function Fi(e){const t={...e};$c(e,pi,t);for(const n of fi)e[n]!==void 0&&(t[n]=JSON.stringify(e[n]||[]));for(const n of gi)e[n]!==void 0&&(t[n]=JSON.stringify(e[n]||{}));return e.connections!==void 0&&(t.connections=JSON.stringify(e.connections||[])),Pa(t)}function Uc(e){return{async create(t,n){var s,c;const i=new Date().toISOString(),o={client_id:n.client_id,tenant_id:t,name:n.name,description:n.description,app_type:n.app_type??"regular_web",logo_uri:n.logo_uri,client_secret:n.client_secret,token_endpoint_auth_method:n.token_endpoint_auth_method??"client_secret_basic",cross_origin_loc:n.cross_origin_loc,custom_login_page:n.custom_login_page,custom_login_page_preview:n.custom_login_page_preview,form_template:n.form_template,initiate_login_uri:n.initiate_login_uri,organization_usage:n.organization_usage??"deny",organization_require_behavior:n.organization_require_behavior??"no_prompt",compliance_level:n.compliance_level,par_request_expiry:n.par_request_expiry,created_at:i,updated_at:i};for(const u of pi)o[u]=n[u]??!1;o.oidc_conformant=n.oidc_conformant??!0,o.auth0_conformant=n.auth0_conformant??!0,o.sso_disabled=n.sso_disabled??!1;for(const u of fi)o[u]=n[u]||[];for(const u of gi)o[u]=n[u]||{};o.connections=n.connections||[];const a=Fi(o);try{await e.insert(B).values({...a,tenant_id:t})}catch(u){throw(s=u==null?void 0:u.message)!=null&&s.includes("UNIQUE constraint failed")||(c=u==null?void 0:u.message)!=null&&c.includes("duplicate key")?new lt(409,{message:"Client already exists"}):u}return Wt({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(B).where(w(_(B.tenant_id,t),_(B.client_id,n))).get();return i?Wt(i):null},async getByClientId(t){const n=await e.select().from(B).where(_(B.client_id,t)).get();return n?{...Wt(n),tenant_id:n.tenant_id}:null},async update(t,n,i){const o=Fi({...i,updated_at:new Date().toISOString()});return delete o.client_id,delete o.tenant_id,await e.update(B).set(o).where(w(_(B.tenant_id,t),_(B.client_id,n))),!0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{};let u=e.select().from(B).where(_(B.tenant_id,t)).$dynamic();if(c){const m=Ye(B,c,["name","client_id"]);m&&(u=u.where(w(_(B.tenant_id,t),m)))}if(s!=null&&s.sort_by){const m=B[s.sort_by];m&&(u=u.orderBy(s.sort_order==="desc"?le(m):me(m)))}const d=(await u.offset(i*o).limit(o)).map(Wt);if(!a)return{clients:d};const[h]=await e.select({count:ye()}).from(B).where(_(B.tenant_id,t));return{clients:d,start:i*o,limit:o,length:Number((h==null?void 0:h.count)??0)}},async remove(t,n){return(await e.delete(B).where(w(_(B.tenant_id,t),_(B.client_id,n))).returning()).length>0}}}function Fc(e){const{tenant_id:t,is_system:n,options:i,metadata:o,...a}=e;return K({...a,options:R(i,{}),metadata:R(o),is_system:n?!0:void 0})}function Zc(e){return{async listByClient(t,n){const i=await e.select({connections:B.connections}).from(B).where(w(_(B.tenant_id,t),_(B.client_id,n))).get();if(!i)return[];const o=R(i.connections,[])||[];if(o.length===0)return[];const s=(await e.select().from(fe).where(w(_(fe.tenant_id,t),Re(fe.id,o))).all()).map(Fc);return o.map(c=>s.find(u=>u.id===c)).filter(Boolean)},async updateByClient(t,n,i){return(await e.update(B).set({connections:JSON.stringify([...new Set(i)])}).where(w(_(B.tenant_id,t),_(B.client_id,n))).returning()).length>0},async listByConnection(t,n){return(await e.select({client_id:B.client_id,connections:B.connections}).from(B).where(_(B.tenant_id,t)).all()).filter(o=>(R(o.connections,[])||[]).includes(n)).map(o=>o.client_id)},async addClientToConnection(t,n,i){var c;if(!await e.select({client_id:B.client_id}).from(B).where(w(_(B.tenant_id,t),_(B.client_id,i))).get())return!1;const a=await e.run(k`UPDATE clients SET connections = CASE
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>()=>(e&&(t=e(e=0)),t),a=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},o=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},s=t=>r.call(t,`module.exports`)?t[`module.exports`]:o(e({},`__esModule`,{value:!0}),t),c=Symbol.for(`drizzle:entityKind`);function l(e,t){if(!e||typeof e!=`object`)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,c))throw 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 n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(c in n&&n[c]===t[c])return!0;n=Object.getPrototypeOf(n)}return!1}var u=class{constructor(e,t){this.table=e,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[c]=`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(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!==`byDefault`}},d=class{static[c]=`ColumnBuilder`;config;constructor(e,t,n){this.config={name:e,keyAsName:e===``,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===``&&(this.config.name=e)}},f=Symbol.for(`drizzle:Name`),ee=Symbol.for(`drizzle:isPgEnum`);function te(e){return!!e&&typeof e==`function`&&ee in e&&e[ee]===!0}var ne=class{static[c]=`Subquery`;constructor(e,t,n,r=!1,i=[]){this._={brand:`Subquery`,sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}},re={startActiveSpan(e,t){return t()}},ie=Symbol.for(`drizzle:ViewBaseConfig`),ae=Symbol.for(`drizzle:Schema`),oe=Symbol.for(`drizzle:Columns`),se=Symbol.for(`drizzle:ExtraConfigColumns`),ce=Symbol.for(`drizzle:OriginalName`),le=Symbol.for(`drizzle:BaseName`),ue=Symbol.for(`drizzle:IsAlias`),de=Symbol.for(`drizzle:ExtraConfigBuilder`),fe=Symbol.for(`drizzle:IsDrizzleTable`),pe=class{static[c]=`Table`;static Symbol={Name:f,Schema:ae,OriginalName:ce,Columns:oe,ExtraConfigColumns:se,BaseName:le,IsAlias:ue,ExtraConfigBuilder:de};[f];[ce];[ae];[oe];[se];[le];[ue]=!1;[fe]=!0;[de]=void 0;constructor(e,t,n){this[f]=this[ce]=e,this[ae]=t,this[le]=n}};function me(e){return e!=null&&typeof e.getSQL==`function`}function he(e){let t={sql:``,params:[]};for(let n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||=[],t.typings.push(...n.typings));return t}var ge=class{static[c]=`StringChunk`;value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new _e([this])}},_e=class e{constructor(e){this.queryChunks=e;for(let t of e)if(l(t,pe)){let e=t[pe.Symbol.Schema];this.usedTables.push(e===void 0?t[pe.Symbol.Name]:e+`.`+t[pe.Symbol.Name])}}static[c]=`SQL`;decoder=be;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return re.startActiveSpan(`drizzle.buildSQL`,t=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(t,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:i,escapeName:a,escapeParam:o,prepareTyping:s,inlineParams:c,paramStartIndex:d}=r;return he(t.map(t=>{if(l(t,ge))return{sql:t.value.join(``),params:[]};if(l(t,ve))return{sql:a(t.value),params:[]};if(t===void 0)return{sql:``,params:[]};if(Array.isArray(t)){let e=[new ge(`(`)];for(let[n,r]of t.entries())e.push(r),n<t.length-1&&e.push(new ge(`, `));return e.push(new ge(`)`)),this.buildQueryFromSourceParams(e,r)}if(l(t,e))return this.buildQueryFromSourceParams(t.queryChunks,{...r,inlineParams:c||t.shouldInlineParams});if(l(t,pe)){let e=t[pe.Symbol.Schema],n=t[pe.Symbol.Name];return{sql:e===void 0||t[ue]?a(n):a(e)+`.`+a(n),params:[]}}if(l(t,u)){let e=i.getColumnCasing(t);if(n.invokeSource===`indexes`)return{sql:a(e),params:[]};let r=t.table[pe.Symbol.Schema];return{sql:t.table[ue]||r===void 0?a(t.table[pe.Symbol.Name])+`.`+a(e):a(r)+`.`+a(t.table[pe.Symbol.Name])+`.`+a(e),params:[]}}if(l(t,Te)){let e=t[ie].schema,n=t[ie].name;return{sql:e===void 0||t[ie].isAlias?a(n):a(e)+`.`+a(n),params:[]}}if(l(t,Se)){if(l(t.value,Ce))return{sql:o(d.value++,t),params:[t],typings:[`none`]};let n=t.value===null?null:t.encoder.mapToDriverValue(t.value);if(l(n,e))return this.buildQueryFromSourceParams([n],r);if(c)return{sql:this.mapInlineParam(n,r),params:[]};let i=[`none`];return s&&(i=[s(t.encoder)]),{sql:o(d.value++,n),params:[n],typings:i}}return l(t,Ce)?{sql:o(d.value++,t),params:[t],typings:[`none`]}:l(t,e.Aliased)&&t.fieldAlias!==void 0?{sql:a(t.fieldAlias),params:[]}:l(t,ne)?t._.isWith?{sql:a(t._.alias),params:[]}:this.buildQueryFromSourceParams([new ge(`(`),t._.sql,new ge(`) `),new ve(t._.alias)],r):te(t)?t.schema?{sql:a(t.schema)+`.`+a(t.enumName),params:[]}:{sql:a(t.enumName),params:[]}:me(t)?t.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([t.getSQL()],r):this.buildQueryFromSourceParams([new ge(`(`),t.getSQL(),new ge(`)`)],r):c?{sql:this.mapInlineParam(t,r),params:[]}:{sql:o(d.value++,t),params:[t],typings:[`none`]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return`null`;if(typeof e==`number`||typeof e==`boolean`)return e.toString();if(typeof e==`string`)return t(e);if(typeof e==`object`){let n=e.toString();return t(n===`[object Object]`?JSON.stringify(e):n)}throw Error(`Unexpected param value: `+e)}getSQL(){return this}as(t){return t===void 0?this:new e.Aliased(this,t)}mapWith(e){return this.decoder=typeof e==`function`?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}},ve=class{constructor(e){this.value=e}static[c]=`Name`;brand;getSQL(){return new _e([this])}};function ye(e){return typeof e==`object`&&!!e&&`mapToDriverValue`in e&&typeof e.mapToDriverValue==`function`}var be={mapFromDriverValue:e=>e},xe={mapToDriverValue:e=>e};({...be,...xe});var Se=class{constructor(e,t=xe){this.value=e,this.encoder=t}static[c]=`Param`;brand;getSQL(){return new _e([this])}};function p(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!==``)&&n.push(new ge(e[0]));for(let[r,i]of t.entries())n.push(i,new ge(e[r+1]));return new _e(n)}(e=>{function t(){return new _e([])}e.empty=t;function n(e){return new _e(e)}e.fromList=n;function r(e){return new _e([new ge(e)])}e.raw=r;function i(e,t){let n=[];for(let[r,i]of e.entries())r>0&&t!==void 0&&n.push(t),n.push(i);return new _e(n)}e.join=i;function a(e){return new ve(e)}e.identifier=a;function o(e){return new Ce(e)}e.placeholder=o;function s(e,t){return new Se(e,t)}e.param=s})(p||={}),(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static[c]=`SQL.Aliased`;isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(_e||={});var Ce=class{constructor(e){this.name=e}static[c]=`Placeholder`;getSQL(){return new _e([this])}},we=Symbol.for(`drizzle:IsDrizzleView`),Te=class{static[c]=`View`;[ie];[we]=!0;constructor({name:e,schema:t,selectedFields:n,query:r}){this[ie]={name:e,originalName:e,schema:t,selectedFields:n,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new _e([this])}};u.prototype.getSQL=function(){return new _e([this])},pe.prototype.getSQL=function(){return new _e([this])},ne.prototype.getSQL=function(){return new _e([this])};function Ee(e,t){return{name:typeof e==`string`&&e.length>0?e:``,config:typeof e==`object`?e:t}}var De=typeof TextDecoder>`u`?null:new TextDecoder;function Oe(e,t){return ye(t)&&!me(e)&&!l(e,Se)&&!l(e,Ce)&&!l(e,u)&&!l(e,pe)&&!l(e,Te)?new Se(e,t):e}var m=(e,t)=>p`${e} = ${Oe(t,e)}`,ke=(e,t)=>p`${e} <> ${Oe(t,e)}`;function h(...e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new _e(t):new _e([new ge(`(`),p.join(t,new ge(` and `)),new ge(`)`)])}function Ae(...e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new _e(t):new _e([new ge(`(`),p.join(t,new ge(` or `)),new ge(`)`)])}var je=(e,t)=>p`${e} > ${Oe(t,e)}`,Me=(e,t)=>p`${e} >= ${Oe(t,e)}`,Ne=(e,t)=>p`${e} < ${Oe(t,e)}`,Pe=(e,t)=>p`${e} <= ${Oe(t,e)}`;function Fe(e,t){return Array.isArray(t)?t.length===0?p`false`:p`${e} in ${t.map(t=>Oe(t,e))}`:p`${e} in ${Oe(t,e)}`}function Ie(e){return p`${e} is null`}function Le(e){return p`${e} is not null`}function Re(e,t){return p`${e} like ${t}`}function ze(e){return p`${e} asc`}function Be(e){return p`${e} desc`}function Ve(e){return p`count(${e||p.raw(`*`)})`.mapWith(Number)}function He(){let e=e=>{throw Error(`Actions are not implemented in the Drizzle adapter (called ${e}). Use the Kysely adapter for tenants that require actions.`)};return{create:()=>e(`create`),get:()=>e(`get`),list:()=>e(`list`),update:()=>e(`update`),remove:()=>e(`remove`)}}function Ue(){let e=e=>{throw Error(`Action executions are not implemented in the Drizzle adapter (called ${e}). Use the Kysely adapter for tenants that require actions.`)};return{create:()=>e(`create`),get:()=>e(`get`)}}function We(){let e=e=>{throw Error(`Action versions are not implemented in the Drizzle adapter (called ${e}). Use the Kysely adapter for tenants that require actions.`)};return{create:()=>e(`create`),get:()=>e(`get`),list:()=>e(`list`),removeForAction:()=>e(`removeForAction`)}}var Ge=class{static[c]=`SQLiteForeignKeyBuilder`;reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:n,foreignColumns:r}=e();return{name:t,columns:n,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new Ke(e,this)}},Ke=class{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[c]=`SQLiteForeignKey`;reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[f],...r,n[0].table[f],...i];return e??`${a.join(`_`)}_fk`}};function qe(e,t){return`${e[f]}_${t.join(`_`)}_unique`}var Je=class extends d{static[c]=`SQLiteColumnBuilder`;foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:`always`,mode:t?.mode??`virtual`},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>((n,r)=>{let i=new Ge(()=>{let t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)})(n,r))}},Ye=class extends u{constructor(e,t){t.uniqueName||=qe(e,[t.name]),super(e,t),this.table=e}static[c]=`SQLiteColumn`},Xe=class extends Je{static[c]=`SQLiteBigIntBuilder`;constructor(e){super(e,`bigint`,`SQLiteBigInt`)}build(e){return new Ze(e,this.config)}},Ze=class extends Ye{static[c]=`SQLiteBigInt`;getSQLType(){return`blob`}mapFromDriverValue(e){if(typeof Buffer<`u`&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return BigInt(t.toString(`utf8`))}return BigInt(De.decode(e))}mapToDriverValue(e){return Buffer.from(e.toString())}},Qe=class extends Je{static[c]=`SQLiteBlobJsonBuilder`;constructor(e){super(e,`json`,`SQLiteBlobJson`)}build(e){return new $e(e,this.config)}},$e=class extends Ye{static[c]=`SQLiteBlobJson`;getSQLType(){return`blob`}mapFromDriverValue(e){if(typeof Buffer<`u`&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return JSON.parse(t.toString(`utf8`))}return JSON.parse(De.decode(e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}},et=class extends Je{static[c]=`SQLiteBlobBufferBuilder`;constructor(e){super(e,`buffer`,`SQLiteBlobBuffer`)}build(e){return new tt(e,this.config)}},tt=class extends Ye{static[c]=`SQLiteBlobBuffer`;mapFromDriverValue(e){return Buffer.isBuffer(e)?e:Buffer.from(e)}getSQLType(){return`blob`}};function nt(e,t){let{name:n,config:r}=Ee(e,t);return r?.mode===`json`?new Qe(n):r?.mode===`bigint`?new Xe(n):new et(n)}var rt=class extends Je{static[c]=`SQLiteCustomColumnBuilder`;constructor(e,t,n){super(e,`custom`,`SQLiteCustomColumn`),this.config.fieldConfig=t,this.config.customTypeParams=n}build(e){return new it(e,this.config)}},it=class extends Ye{static[c]=`SQLiteCustomColumn`;sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom==`function`?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo==`function`?this.mapTo(e):e}};function at(e){return(t,n)=>{let{name:r,config:i}=Ee(t,n);return new rt(r,i,e)}}var ot=class extends Je{static[c]=`SQLiteBaseIntegerBuilder`;constructor(e,t,n){super(e,t,n),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}},st=class extends Ye{static[c]=`SQLiteBaseInteger`;autoIncrement=this.config.autoIncrement;getSQLType(){return`integer`}},ct=class extends ot{static[c]=`SQLiteIntegerBuilder`;constructor(e){super(e,`number`,`SQLiteInteger`)}build(e){return new lt(e,this.config)}},lt=class extends st{static[c]=`SQLiteInteger`},ut=class extends ot{static[c]=`SQLiteTimestampBuilder`;constructor(e,t){super(e,`date`,`SQLiteTimestamp`),this.config.mode=t}defaultNow(){return this.default(p`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new dt(e,this.config)}},dt=class extends st{static[c]=`SQLiteTimestamp`;mode=this.config.mode;mapFromDriverValue(e){return this.config.mode===`timestamp`?new Date(e*1e3):new Date(e)}mapToDriverValue(e){let t=e.getTime();return this.config.mode===`timestamp`?Math.floor(t/1e3):t}},ft=class extends ot{static[c]=`SQLiteBooleanBuilder`;constructor(e,t){super(e,`boolean`,`SQLiteBoolean`),this.config.mode=t}build(e){return new pt(e,this.config)}},pt=class extends st{static[c]=`SQLiteBoolean`;mode=this.config.mode;mapFromDriverValue(e){return Number(e)===1}mapToDriverValue(e){return+!!e}};function g(e,t){let{name:n,config:r}=Ee(e,t);return r?.mode===`timestamp`||r?.mode===`timestamp_ms`?new ut(n,r.mode):r?.mode===`boolean`?new ft(n,r.mode):new ct(n)}var mt=class extends Je{static[c]=`SQLiteNumericBuilder`;constructor(e){super(e,`string`,`SQLiteNumeric`)}build(e){return new ht(e,this.config)}},ht=class extends Ye{static[c]=`SQLiteNumeric`;mapFromDriverValue(e){return typeof e==`string`?e:String(e)}getSQLType(){return`numeric`}},gt=class extends Je{static[c]=`SQLiteNumericNumberBuilder`;constructor(e){super(e,`number`,`SQLiteNumericNumber`)}build(e){return new _t(e,this.config)}},_t=class extends Ye{static[c]=`SQLiteNumericNumber`;mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}mapToDriverValue=String;getSQLType(){return`numeric`}},vt=class extends Je{static[c]=`SQLiteNumericBigIntBuilder`;constructor(e){super(e,`bigint`,`SQLiteNumericBigInt`)}build(e){return new yt(e,this.config)}},yt=class extends Ye{static[c]=`SQLiteNumericBigInt`;mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return`numeric`}};function bt(e,t){let{name:n,config:r}=Ee(e,t),i=r?.mode;return i===`number`?new gt(n):i===`bigint`?new vt(n):new mt(n)}var xt=class extends Je{static[c]=`SQLiteRealBuilder`;constructor(e){super(e,`number`,`SQLiteReal`)}build(e){return new St(e,this.config)}},St=class extends Ye{static[c]=`SQLiteReal`;getSQLType(){return`real`}};function Ct(e){return new xt(e??``)}var wt=class extends Je{static[c]=`SQLiteTextBuilder`;constructor(e,t){super(e,`string`,`SQLiteText`),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new Tt(e,this.config)}},Tt=class extends Ye{static[c]=`SQLiteText`;enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:``}`}},Et=class extends Je{static[c]=`SQLiteTextJsonBuilder`;constructor(e){super(e,`json`,`SQLiteTextJson`)}build(e){return new Dt(e,this.config)}},Dt=class extends Ye{static[c]=`SQLiteTextJson`;getSQLType(){return`text`}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}};function _(e,t={}){let{name:n,config:r}=Ee(e,t);return r.mode===`json`?new Et(n):new wt(n,r)}function Ot(){return{blob:nt,customType:at,integer:g,numeric:bt,real:Ct,text:_}}var kt=Symbol.for(`drizzle:SQLiteInlineForeignKeys`),At=class extends pe{static[c]=`SQLiteTable`;static Symbol=Object.assign({},pe.Symbol,{InlineForeignKeys:kt});[pe.Symbol.Columns];[kt]=[];[pe.Symbol.ExtraConfigBuilder]=void 0};function jt(e,t,n,r,i=e){let a=new At(e,r,i),o=typeof t==`function`?t(Ot()):t,s=Object.fromEntries(Object.entries(o).map(([e,t])=>{let n=t;n.setName(e);let r=n.build(a);return a[kt].push(...n.buildForeignKeys(r,a)),[e,r]})),c=Object.assign(a,s);return c[pe.Symbol.Columns]=s,c[pe.Symbol.ExtraConfigColumns]=s,n&&(c[At.Symbol.ExtraConfigBuilder]=n),c}var v=(e,t,n)=>jt(e,t,n),Mt=class{constructor(e,t){this.name=e,this.unique=t}static[c]=`SQLiteIndexBuilderOn`;on(...e){return new Nt(this.name,e,this.unique)}},Nt=class{static[c]=`SQLiteIndexBuilder`;config;constructor(e,t,n){this.config={name:e,columns:t,unique:n,where:void 0}}where(e){return this.config.where=e,this}build(e){return new Pt(this.config,e)}},Pt=class{static[c]=`SQLiteIndex`;config;constructor(e,t){this.config={...e,table:t}}};function y(e){return new Mt(e,!1)}function Ft(e){return new Mt(e,!0)}function It(...e){return e[0].columns?new Lt(e[0].columns,e[0].name):new Lt(e)}var Lt=class{static[c]=`SQLitePrimaryKeyBuilder`;columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new Rt(e,this.columns,this.name)}},Rt=class{constructor(e,t,n){this.table=e,this.columns=t,this.name=n}static[c]=`SQLitePrimaryKey`;columns;name;getName(){return this.name??`${this.table[At.Symbol.Name]}_${this.columns.map(e=>e.name).join(`_`)}_pk`}},b=v(`tenants`,{id:_(`id`,{length:191}).primaryKey(),name:_(`name`,{length:255}),audience:_(`audience`,{length:255}),sender_email:_(`sender_email`,{length:255}),sender_name:_(`sender_name`,{length:255}),language:_(`language`,{length:255}),logo:_(`logo`,{length:255}),primary_color:_(`primary_color`,{length:255}),secondary_color:_(`secondary_color`,{length:255}),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull(),support_url:_(`support_url`,{length:255}),idle_session_lifetime:g(`idle_session_lifetime`),session_lifetime:g(`session_lifetime`),session_cookie:_(`session_cookie`),allowed_logout_urls:_(`allowed_logout_urls`),ephemeral_session_lifetime:g(`ephemeral_session_lifetime`),idle_ephemeral_session_lifetime:g(`idle_ephemeral_session_lifetime`),default_redirection_uri:_(`default_redirection_uri`),default_client_id:_(`default_client_id`,{length:255}),enabled_locales:_(`enabled_locales`),default_directory:_(`default_directory`,{length:255}),error_page:_(`error_page`),flags:_(`flags`),friendly_name:_(`friendly_name`,{length:255}),picture_url:_(`picture_url`),support_email:_(`support_email`,{length:255}),sandbox_version:_(`sandbox_version`,{length:50}),sandbox_versions_available:_(`sandbox_versions_available`),legacy_sandbox_version:_(`legacy_sandbox_version`,{length:50}),change_password:_(`change_password`),guardian_mfa_page:_(`guardian_mfa_page`),device_flow:_(`device_flow`),default_token_quota:_(`default_token_quota`),default_audience:_(`default_audience`,{length:255}),default_organization:_(`default_organization`,{length:255}),sessions:_(`sessions`),oidc_logout:_(`oidc_logout`),allow_organization_name_in_authentication_api:g(`allow_organization_name_in_authentication_api`),customize_mfa_in_postlogin_action:g(`customize_mfa_in_postlogin_action`),acr_values_supported:_(`acr_values_supported`),mtls:_(`mtls`),pushed_authorization_requests_supported:g(`pushed_authorization_requests_supported`),authorization_response_iss_parameter_supported:g(`authorization_response_iss_parameter_supported`)}),x=v(`users`,{user_id:_(`user_id`,{length:255}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),email:_(`email`,{length:255}),given_name:_(`given_name`,{length:255}),family_name:_(`family_name`,{length:255}),nickname:_(`nickname`,{length:255}),name:_(`name`,{length:255}),picture:_(`picture`,{length:2083}),tags:_(`tags`,{length:255}),phone_number:_(`phone_number`,{length:17}),phone_verified:g(`phone_verified`,{mode:`boolean`}),username:_(`username`,{length:128}),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull(),linked_to:_(`linked_to`,{length:255}),last_ip:_(`last_ip`,{length:255}),login_count:g(`login_count`).notNull(),last_login:_(`last_login`,{length:255}),registration_completed_at:_(`registration_completed_at`,{length:35}),provider:_(`provider`,{length:255}).notNull(),connection:_(`connection`,{length:255}),email_verified:g(`email_verified`,{mode:`boolean`}).notNull(),is_social:g(`is_social`,{mode:`boolean`}).notNull(),app_metadata:_(`app_metadata`,{length:4096}).notNull().default(`{}`),user_metadata:_(`user_metadata`).notNull().default(`{}`),profileData:_(`profileData`,{length:2048}),locale:_(`locale`,{length:255}),middle_name:_(`middle_name`,{length:100}),preferred_username:_(`preferred_username`,{length:255}),profile:_(`profile`),website:_(`website`),gender:_(`gender`,{length:50}),birthdate:_(`birthdate`,{length:10}),zoneinfo:_(`zoneinfo`,{length:100}),address:_(`address`)},e=>[It({columns:[e.user_id,e.tenant_id],name:`users_tenants`}),Ft(`unique_email_provider`).on(e.email,e.provider,e.tenant_id),Ft(`unique_phone_provider`).on(e.phone_number,e.provider,e.tenant_id),Ft(`unique_username_provider`).on(e.username,e.provider,e.tenant_id),y(`users_email_index`).on(e.email),y(`users_linked_to_index`).on(e.linked_to),y(`users_name_index`).on(e.name),y(`users_phone_tenant_provider_index`).on(e.tenant_id,e.phone_number,e.provider)]),zt=v(`passwords`,{id:_(`id`,{length:21}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),user_id:_(`user_id`,{length:255}).notNull(),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull(),password:_(`password`,{length:255}).notNull(),algorithm:_(`algorithm`,{length:16}).notNull().default(`bcrypt`),is_current:g(`is_current`).notNull().default(1)}),Bt=v(`sessions`,{id:_(`id`,{length:21}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),user_id:_(`user_id`,{length:255}),created_at_ts:g(`created_at_ts`).notNull(),updated_at_ts:g(`updated_at_ts`).notNull(),expires_at_ts:g(`expires_at_ts`),idle_expires_at_ts:g(`idle_expires_at_ts`),authenticated_at_ts:g(`authenticated_at_ts`),last_interaction_at_ts:g(`last_interaction_at_ts`),used_at_ts:g(`used_at_ts`),revoked_at_ts:g(`revoked_at_ts`),device:_(`device`).notNull(),clients:_(`clients`).notNull(),login_session_id:_(`login_session_id`,{length:21})},e=>[It({columns:[e.tenant_id,e.id],name:`sessions_pk`}),y(`IDX_sessions_login_session_id`).on(e.login_session_id),y(`idx_sessions_user_id`).on(e.tenant_id,e.user_id),y(`idx_sessions_expires_at_ts`).on(e.expires_at_ts)]),S=v(`refresh_tokens`,{id:_(`id`,{length:26}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),client_id:_(`client_id`,{length:191}).notNull(),login_id:_(`login_id`,{length:26}).notNull(),user_id:_(`user_id`,{length:255}),resource_servers:_(`resource_servers`).notNull(),device:_(`device`).notNull(),rotating:g(`rotating`,{mode:`boolean`}).notNull(),token_lookup:_(`token_lookup`,{length:16}),token_hash:_(`token_hash`,{length:64}),family_id:_(`family_id`,{length:26}),rotated_to:_(`rotated_to`,{length:26}),rotated_at_ts:g(`rotated_at_ts`),created_at_ts:g(`created_at_ts`).notNull(),expires_at_ts:g(`expires_at_ts`),idle_expires_at_ts:g(`idle_expires_at_ts`),last_exchanged_at_ts:g(`last_exchanged_at_ts`),revoked_at_ts:g(`revoked_at_ts`)},e=>[It({columns:[e.tenant_id,e.id],name:`refresh_tokens_pk`}),y(`idx_refresh_tokens_user_id`).on(e.tenant_id,e.user_id),y(`idx_refresh_tokens_login_id`).on(e.login_id),y(`idx_refresh_tokens_expires_at_ts`).on(e.expires_at_ts),y(`idx_refresh_tokens_token_lookup`).on(e.tenant_id,e.token_lookup),y(`idx_refresh_tokens_family_id`).on(e.tenant_id,e.family_id)]),C=v(`login_sessions`,{id:_(`id`,{length:21}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),session_id:_(`session_id`,{length:21}),csrf_token:_(`csrf_token`,{length:21}).notNull(),auth_params:_(`auth_params`),authorization_url:_(`authorization_url`),created_at_ts:g(`created_at_ts`).notNull(),updated_at_ts:g(`updated_at_ts`).notNull(),expires_at_ts:g(`expires_at_ts`).notNull(),ip:_(`ip`,{length:39}),useragent:_(`useragent`),auth0Client:_(`auth0Client`,{length:255}),state:_(`state`,{length:50}).notNull().default(`pending`),state_data:_(`state_data`),failure_reason:_(`failure_reason`),user_id:_(`user_id`,{length:255}),auth_connection:_(`auth_connection`,{length:255}),auth_strategy_strategy:_(`auth_strategy_strategy`,{length:64}),auth_strategy_strategy_type:_(`auth_strategy_strategy_type`,{length:64}),authenticated_at:_(`authenticated_at`,{length:35})},e=>[It({columns:[e.tenant_id,e.id],name:`login_sessions_pk`}),y(`login_sessions_id_index`).on(e.id),y(`login_sessions_state_idx`).on(e.state),y(`login_sessions_state_updated_idx`).on(e.state,e.updated_at_ts),y(`login_sessions_tenant_user_idx`).on(e.tenant_id,e.user_id),y(`idx_login_sessions_expires_at_ts`).on(e.expires_at_ts)]),Vt=v(`codes`,{code_id:_(`code_id`,{length:191}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),user_id:_(`user_id`,{length:255}),login_id:_(`login_id`,{length:255}),connection_id:_(`connection_id`,{length:255}),code_type:_(`code_type`,{length:255}).notNull(),created_at:_(`created_at`,{length:35}).notNull(),expires_at:_(`expires_at`,{length:35}).notNull(),used_at:_(`used_at`,{length:35}),code_verifier:_(`code_verifier`,{length:128}),code_challenge:_(`code_challenge`,{length:128}),code_challenge_method:_(`code_challenge_method`,{length:5}),redirect_uri:_(`redirect_uri`,{length:1024}),nonce:_(`nonce`,{length:1024}),state:_(`state`,{length:2048})},e=>[It({columns:[e.code_id,e.code_type],name:`PK_codes_code_id_code_type`}),y(`codes_expires_at_index`).on(e.expires_at)]),Ht=v(`authentication_codes`,{tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),code:_(`code`,{length:255}).primaryKey(),client_id:_(`client_id`,{length:255}).notNull(),user_id:_(`user_id`,{length:255}).notNull(),nonce:_(`nonce`,{length:255}),state:_(`state`,{length:8192}),scope:_(`scope`,{length:1024}),response_type:_(`response_type`,{length:256}),response_mode:_(`response_mode`,{length:256}),redirect_uri:_(`redirect_uri`,{length:1024}),created_at:_(`created_at`,{length:35}).notNull(),expires_at:_(`expires_at`,{length:35}).notNull(),used_at:_(`used_at`,{length:35})}),Ut=v(`otps`,{tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),id:_(`id`,{length:255}).primaryKey(),client_id:_(`client_id`,{length:255}).notNull(),code:_(`code`,{length:255}).notNull(),email:_(`email`,{length:255}).notNull(),user_id:_(`user_id`,{length:255}),send:_(`send`,{length:255}),nonce:_(`nonce`,{length:255}),state:_(`state`,{length:1024}),scope:_(`scope`,{length:1024}),response_type:_(`response_type`,{length:256}),response_mode:_(`response_mode`,{length:256}),redirect_uri:_(`redirect_uri`,{length:1024}),created_at:_(`created_at`,{length:35}).notNull(),expires_at:_(`expires_at`,{length:35}).notNull(),used_at:_(`used_at`,{length:35}),audience:_(`audience`,{length:255}),ip:_(`ip`,{length:64})},e=>[y(`otps_email_index`).on(e.email),y(`otps_expires_at_index`).on(e.expires_at)]),Wt=v(`tickets`,{tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),id:_(`id`,{length:255}).primaryKey(),client_id:_(`client_id`,{length:255}).notNull(),email:_(`email`,{length:255}).notNull(),nonce:_(`nonce`,{length:255}),state:_(`state`,{length:1024}),scope:_(`scope`,{length:1024}),response_type:_(`response_type`,{length:256}),response_mode:_(`response_mode`,{length:256}),redirect_uri:_(`redirect_uri`,{length:1024}),created_at:_(`created_at`,{length:35}).notNull(),expires_at:_(`expires_at`,{length:35}).notNull(),used_at:_(`used_at`,{length:35})}),w=v(`clients`,{client_id:_(`client_id`,{length:191}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),name:_(`name`,{length:255}).notNull(),description:_(`description`,{length:140}),global:g(`global`).notNull().default(0),client_secret:_(`client_secret`,{length:255}),app_type:_(`app_type`,{length:64}).default(`regular_web`),logo_uri:_(`logo_uri`,{length:2083}),is_first_party:g(`is_first_party`).notNull().default(0),oidc_conformant:g(`oidc_conformant`).notNull().default(1),auth0_conformant:g(`auth0_conformant`).notNull().default(1),callbacks:_(`callbacks`).notNull(),allowed_origins:_(`allowed_origins`).notNull(),web_origins:_(`web_origins`).notNull(),client_aliases:_(`client_aliases`).notNull(),allowed_clients:_(`allowed_clients`).notNull(),allowed_logout_urls:_(`allowed_logout_urls`).notNull(),session_transfer:_(`session_transfer`).notNull(),oidc_logout:_(`oidc_logout`).notNull(),grant_types:_(`grant_types`).notNull(),jwt_configuration:_(`jwt_configuration`).notNull(),signing_keys:_(`signing_keys`).notNull(),encryption_key:_(`encryption_key`).notNull(),sso:g(`sso`).notNull().default(0),sso_disabled:g(`sso_disabled`).notNull().default(1),cross_origin_authentication:g(`cross_origin_authentication`).notNull().default(0),cross_origin_loc:_(`cross_origin_loc`,{length:2083}),custom_login_page_on:g(`custom_login_page_on`).notNull().default(0),custom_login_page:_(`custom_login_page`),custom_login_page_preview:_(`custom_login_page_preview`),form_template:_(`form_template`),addons:_(`addons`).notNull(),token_endpoint_auth_method:_(`token_endpoint_auth_method`,{length:64}).default(`client_secret_basic`),client_metadata:_(`client_metadata`).notNull(),mobile:_(`mobile`).notNull(),initiate_login_uri:_(`initiate_login_uri`,{length:2083}),native_social_login:_(`native_social_login`).notNull(),refresh_token:_(`refresh_token`).notNull(),default_organization:_(`default_organization`).notNull(),organization_usage:_(`organization_usage`,{length:32}).default(`deny`),organization_require_behavior:_(`organization_require_behavior`,{length:32}).default(`no_prompt`),client_authentication_methods:_(`client_authentication_methods`).notNull(),require_pushed_authorization_requests:g(`require_pushed_authorization_requests`).notNull().default(0),require_proof_of_possession:g(`require_proof_of_possession`).notNull().default(0),hide_sign_up_disabled_error:g(`hide_sign_up_disabled_error`).notNull().default(0),signed_request_object:_(`signed_request_object`).notNull(),compliance_level:_(`compliance_level`,{length:64}),par_request_expiry:g(`par_request_expiry`),token_quota:_(`token_quota`).notNull(),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull(),connections:_(`connections`).notNull().default(`[]`),owner_user_id:_(`owner_user_id`,{length:255}),registration_type:_(`registration_type`,{length:32}),registration_metadata:_(`registration_metadata`),user_linking_mode:_(`user_linking_mode`,{length:16})},e=>[It({columns:[e.tenant_id,e.client_id],name:`clients_tenant_id_client_id`}),y(`idx_clients_owner_user_id`).on(e.tenant_id,e.owner_user_id)]),T=v(`client_registration_tokens`,{id:_(`id`,{length:255}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),token_hash:_(`token_hash`,{length:64}).notNull(),type:_(`type`,{length:8}).notNull(),client_id:_(`client_id`,{length:191}),sub:_(`sub`,{length:255}),constraints:_(`constraints`),single_use:g(`single_use`).notNull().default(0),used_at_ts:g(`used_at_ts`),expires_at_ts:g(`expires_at_ts`),created_at_ts:g(`created_at_ts`).notNull(),revoked_at_ts:g(`revoked_at_ts`)},e=>[Ft(`idx_client_registration_tokens_hash`).on(e.tenant_id,e.token_hash),y(`idx_client_registration_tokens_client`).on(e.tenant_id,e.client_id)]),Gt=v(`client_grants`,{id:_(`id`,{length:21}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),client_id:_(`client_id`,{length:191}).notNull(),audience:_(`audience`,{length:191}).notNull(),scope:_(`scope`).default(`[]`),organization_usage:_(`organization_usage`,{length:32}),allow_any_organization:g(`allow_any_organization`).default(0),is_system:g(`is_system`).default(0),subject_type:_(`subject_type`,{length:32}),authorization_details_types:_(`authorization_details_types`).default(`[]`),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[It({columns:[e.tenant_id,e.id],name:`pk_client_grants`}),y(`idx_client_grants_audience`).on(e.audience)]),Kt=v(`connections`,{id:_(`id`,{length:255}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),name:_(`name`,{length:255}).notNull(),response_type:_(`response_type`,{length:255}),response_mode:_(`response_mode`,{length:255}),strategy:_(`strategy`,{length:64}),options:_(`options`,{length:8192}).notNull().default(`{}`),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull(),display_name:_(`display_name`,{length:255}),is_domain_connection:g(`is_domain_connection`),show_as_button:g(`show_as_button`),is_system:g(`is_system`).notNull().default(0),metadata:_(`metadata`,{length:4096})},e=>[It({columns:[e.tenant_id,e.id]}),y(`connections_tenant_id_index`).on(e.tenant_id),Ft(`connections_id_unique`).on(e.id)]),qt=v(`custom_domains`,{custom_domain_id:_(`custom_domain_id`,{length:256}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),domain:_(`domain`,{length:255}).notNull(),primary:g(`primary`,{mode:`boolean`}).notNull(),status:_(`status`,{length:50}).notNull(),type:_(`type`,{length:50}).notNull(),origin_domain_name:_(`origin_domain_name`,{length:255}),verification:_(`verification`,{length:2048}),custom_client_ip_header:_(`custom_client_ip_header`,{length:50}),tls_policy:_(`tls_policy`,{length:50}),domain_metadata:_(`domain_metadata`,{length:2048}),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[Ft(`custom_domains_domain_unique`).on(e.domain)]),Jt=v(`domains`,{id:_(`id`,{length:255}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),domain:_(`domain`,{length:255}).notNull(),email_service:_(`email_service`,{length:255}),email_api_key:_(`email_api_key`,{length:255}),dkim_private_key:_(`dkim_private_key`,{length:2048}),dkim_public_key:_(`dkim_public_key`,{length:2048}),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()}),E=v(`organizations`,{id:_(`id`,{length:21}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull(),name:_(`name`,{length:256}).notNull(),display_name:_(`display_name`,{length:256}),branding:_(`branding`),metadata:_(`metadata`),enabled_connections:_(`enabled_connections`),token_quota:_(`token_quota`),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[y(`idx_organizations_tenant_id`).on(e.tenant_id)]),Yt=v(`user_organizations`,{id:_(`id`,{length:21}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull(),user_id:_(`user_id`,{length:191}).notNull(),organization_id:_(`organization_id`,{length:21}).notNull(),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[Ft(`user_organizations_unique`).on(e.tenant_id,e.user_id,e.organization_id),y(`idx_user_organizations_tenant_id`).on(e.tenant_id),y(`idx_user_organizations_user_id`).on(e.user_id),y(`idx_user_organizations_organization_id`).on(e.organization_id)]),Xt=v(`invites`,{id:_(`id`,{length:21}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull(),organization_id:_(`organization_id`,{length:21}).notNull(),inviter:_(`inviter`).notNull(),invitee:_(`invitee`).notNull(),client_id:_(`client_id`,{length:191}).notNull(),connection_id:_(`connection_id`,{length:21}),invitation_url:_(`invitation_url`).notNull(),created_at:_(`created_at`,{length:35}).notNull(),expires_at:_(`expires_at`,{length:35}).notNull(),app_metadata:_(`app_metadata`),user_metadata:_(`user_metadata`),roles:_(`roles`),ticket_id:_(`ticket_id`,{length:191}),ttl_sec:g(`ttl_sec`),send_invitation_email:g(`send_invitation_email`)},e=>[y(`idx_invites_tenant_id`).on(e.tenant_id),y(`idx_invites_organization_id`).on(e.organization_id),y(`idx_invites_expires_at`).on(e.expires_at),y(`idx_invites_tenant_created`).on(e.tenant_id,e.created_at)]),Zt=v(`roles`,{id:_(`id`,{length:21}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull(),name:_(`name`,{length:50}).notNull(),description:_(`description`,{length:255}),is_system:g(`is_system`).notNull().default(0),metadata:_(`metadata`,{length:4096}),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[It({columns:[e.tenant_id,e.id],name:`roles_pk`})]),Qt=v(`role_permissions`,{tenant_id:_(`tenant_id`,{length:191}).notNull(),role_id:_(`role_id`,{length:21}).notNull(),resource_server_identifier:_(`resource_server_identifier`,{length:191}).notNull(),permission_name:_(`permission_name`,{length:191}).notNull(),created_at:_(`created_at`,{length:35}).notNull()},e=>[It({columns:[e.tenant_id,e.role_id,e.resource_server_identifier,e.permission_name],name:`role_permissions_pk`}),y(`role_permissions_role_fk`).on(e.tenant_id,e.role_id),y(`role_permissions_permission_fk`).on(e.tenant_id,e.resource_server_identifier,e.permission_name)]),$t=v(`user_permissions`,{tenant_id:_(`tenant_id`,{length:191}).notNull(),user_id:_(`user_id`,{length:191}).notNull(),resource_server_identifier:_(`resource_server_identifier`,{length:191}).notNull(),permission_name:_(`permission_name`,{length:191}).notNull(),organization_id:_(`organization_id`,{length:21}).notNull().default(``),created_at:_(`created_at`,{length:35}).notNull()},e=>[It({columns:[e.tenant_id,e.user_id,e.resource_server_identifier,e.permission_name,e.organization_id],name:`user_permissions_pk`}),y(`user_permissions_user_fk`).on(e.tenant_id,e.user_id),y(`user_permissions_permission_fk`).on(e.tenant_id,e.resource_server_identifier,e.permission_name),y(`user_permissions_organization_fk`).on(e.organization_id)]),en=v(`user_roles`,{tenant_id:_(`tenant_id`,{length:191}).notNull(),user_id:_(`user_id`,{length:191}).notNull(),role_id:_(`role_id`,{length:21}).notNull(),organization_id:_(`organization_id`,{length:191}).notNull().default(``),created_at:_(`created_at`,{length:35}).notNull()},e=>[It({columns:[e.tenant_id,e.user_id,e.role_id,e.organization_id],name:`user_roles_pk`}),y(`user_roles_user_fk`).on(e.tenant_id,e.user_id),y(`user_roles_role_fk`).on(e.tenant_id,e.role_id),y(`user_roles_organization_fk`).on(e.organization_id)]),D=v(`resource_servers`,{id:_(`id`,{length:21}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull(),identifier:_(`identifier`,{length:191}).notNull(),name:_(`name`,{length:255}).notNull(),scopes:_(`scopes`,{length:4096}),signing_alg:_(`signing_alg`,{length:64}),signing_secret:_(`signing_secret`,{length:2048}),token_lifetime:g(`token_lifetime`),token_lifetime_for_web:g(`token_lifetime_for_web`),skip_consent_for_verifiable_first_party_clients:g(`skip_consent_for_verifiable_first_party_clients`),allow_offline_access:g(`allow_offline_access`),verification_key:_(`verification_key`,{length:4096}),options:_(`options`,{length:4096}),is_system:g(`is_system`).notNull().default(0),metadata:_(`metadata`,{length:4096}),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[It({columns:[e.tenant_id,e.id],name:`resource_servers_pk`})]),tn=v(`branding`,{tenant_id:_(`tenant_id`,{length:191}).primaryKey().references(()=>b.id,{onDelete:`cascade`}),logo_url:_(`logo_url`,{length:512}),favicon_url:_(`favicon_url`,{length:512}),font_url:_(`font_url`,{length:512}),colors_primary:_(`colors_primary`,{length:8}),colors_page_background_type:_(`colors_page_background_type`,{length:32}),colors_page_background_start:_(`colors_page_background_start`,{length:8}),colors_page_background_end:_(`colors_page_background_end`,{length:8}),colors_page_background_angle_dev:g(`colors_page_background_angle_dev`),dark_mode:_(`dark_mode`,{length:8})}),nn=v(`universal_login_templates`,{tenant_id:_(`tenant_id`,{length:191}).primaryKey().references(()=>b.id,{onDelete:`cascade`}),body:_(`body`).notNull(),created_at_ts:g(`created_at_ts`).notNull(),updated_at_ts:g(`updated_at_ts`).notNull()}),rn=v(`themes`,{tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),themeId:_(`themeId`,{length:255}).notNull(),displayName:_(`displayName`,{length:255}).notNull(),colors_primary_button_label:_(`colors_primary_button_label`,{length:24}).notNull(),colors_primary_button:_(`colors_primary_button`,{length:24}).notNull(),colors_secondary_button_border:_(`colors_secondary_button_border`,{length:24}).notNull(),colors_secondary_button_label:_(`colors_secondary_button_label`,{length:24}).notNull(),colors_base_focus_color:_(`colors_base_focus_color`,{length:24}).notNull(),colors_base_hover_color:_(`colors_base_hover_color`,{length:24}).notNull(),colors_body_text:_(`colors_body_text`,{length:24}).notNull(),colors_captcha_widget_theme:_(`colors_captcha_widget_theme`,{length:24}).notNull(),colors_error:_(`colors_error`,{length:24}).notNull(),colors_header:_(`colors_header`,{length:24}).notNull(),colors_icons:_(`colors_icons`,{length:24}).notNull(),colors_input_background:_(`colors_input_background`,{length:24}).notNull(),colors_input_border:_(`colors_input_border`,{length:24}).notNull(),colors_input_filled_text:_(`colors_input_filled_text`,{length:24}).notNull(),colors_input_labels_placeholders:_(`colors_input_labels_placeholders`,{length:24}).notNull(),colors_links_focused_components:_(`colors_links_focused_components`,{length:24}).notNull(),colors_success:_(`colors_success`,{length:24}).notNull(),colors_widget_background:_(`colors_widget_background`,{length:24}).notNull(),colors_widget_border:_(`colors_widget_border`,{length:24}).notNull(),borders_button_border_radius:g(`borders_button_border_radius`).notNull(),borders_button_border_weight:g(`borders_button_border_weight`).notNull(),borders_buttons_style:_(`borders_buttons_style`,{length:24}).notNull(),borders_input_border_radius:g(`borders_input_border_radius`).notNull(),borders_input_border_weight:g(`borders_input_border_weight`).notNull(),borders_inputs_style:_(`borders_inputs_style`,{length:24}).notNull(),borders_show_widget_shadow:g(`borders_show_widget_shadow`,{mode:`boolean`}).notNull(),borders_widget_border_weight:g(`borders_widget_border_weight`).notNull(),borders_widget_corner_radius:g(`borders_widget_corner_radius`).notNull(),fonts_body_text_bold:g(`fonts_body_text_bold`).notNull(),fonts_body_text_size:g(`fonts_body_text_size`).notNull(),fonts_buttons_text_bold:g(`fonts_buttons_text_bold`).notNull(),fonts_buttons_text_size:g(`fonts_buttons_text_size`).notNull(),fonts_font_url:_(`fonts_font_url`,{length:255}).notNull(),fonts_input_labels_bold:g(`fonts_input_labels_bold`).notNull(),fonts_input_labels_size:g(`fonts_input_labels_size`).notNull(),fonts_links_bold:g(`fonts_links_bold`,{mode:`boolean`}).notNull(),fonts_links_size:g(`fonts_links_size`).notNull(),fonts_links_style:_(`fonts_links_style`,{length:24}).notNull(),fonts_reference_text_size:g(`fonts_reference_text_size`).notNull(),fonts_subtitle_bold:g(`fonts_subtitle_bold`,{mode:`boolean`}).notNull(),fonts_subtitle_size:g(`fonts_subtitle_size`).notNull(),fonts_title_bold:g(`fonts_title_bold`,{mode:`boolean`}).notNull(),fonts_title_size:g(`fonts_title_size`).notNull(),page_background_background_color:_(`page_background_background_color`,{length:24}).notNull(),page_background_background_image_url:_(`page_background_background_image_url`,{length:255}).notNull(),page_background_page_layout:_(`page_background_page_layout`,{length:24}).notNull(),widget_header_text_alignment:_(`widget_header_text_alignment`,{length:24}).notNull(),widget_logo_height:g(`widget_logo_height`).notNull(),widget_logo_position:_(`widget_logo_position`,{length:24}).notNull(),widget_logo_url:_(`widget_logo_url`,{length:255}).notNull(),widget_social_buttons_layout:_(`widget_social_buttons_layout`,{length:24}).notNull(),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[It({columns:[e.tenant_id,e.themeId],name:`themes_pkey`}),y(`themes_tenant_id_idx`).on(e.tenant_id)]),an=v(`forms`,{id:_(`id`,{length:255}).primaryKey(),name:_(`name`,{length:255}).notNull(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),messages:_(`messages`,{length:255}),languages:_(`languages`,{length:255}),translations:_(`translations`,{length:4096}),nodes:_(`nodes`,{length:4096}),start:_(`start`,{length:255}),ending:_(`ending`,{length:255}),style:_(`style`,{length:1042}),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[y(`forms_tenant_id_idx`).on(e.tenant_id)]),on=v(`flows`,{id:_(`id`,{length:24}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),name:_(`name`,{length:150}).notNull(),actions:_(`actions`),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[y(`flows_tenant_id_idx`).on(e.tenant_id)]),sn=v(`prompt_settings`,{tenant_id:_(`tenant_id`,{length:191}).primaryKey(),universal_login_experience:_(`universal_login_experience`,{length:16}).notNull().default(`new`),identifier_first:g(`identifier_first`,{mode:`boolean`}).notNull().default(!0),password_first:g(`password_first`,{mode:`boolean`}).notNull().default(!1),webauthn_platform_first_factor:g(`webauthn_platform_first_factor`,{mode:`boolean`}).notNull().default(!1)}),cn=v(`email_providers`,{tenant_id:_(`tenant_id`,{length:191}).primaryKey(),name:_(`name`,{length:255}).notNull(),enabled:g(`enabled`,{mode:`boolean`}).notNull(),default_from_address:_(`default_from_address`,{length:255}),credentials:_(`credentials`,{length:2048}).notNull().default(`{}`),settings:_(`settings`,{length:2048}).notNull().default(`{}`),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()}),ln=v(`email_templates`,{tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),template:_(`template`,{length:64}).notNull(),body:_(`body`).notNull(),from:_(`from`,{length:255}).notNull(),subject:_(`subject`,{length:255}).notNull(),syntax:_(`syntax`,{length:16}).notNull().default(`liquid`),result_url:_(`result_url`,{length:2048}),url_lifetime_in_seconds:g(`url_lifetime_in_seconds`),include_email_in_redirect:g(`include_email_in_redirect`,{mode:`boolean`}).notNull().default(!1),enabled:g(`enabled`,{mode:`boolean`}).notNull().default(!0),created_at:_(`created_at`,{length:35}).notNull(),updated_at:_(`updated_at`,{length:35}).notNull()},e=>[It({columns:[e.tenant_id,e.template]})]),un=v(`hooks`,{hook_id:_(`hook_id`,{length:21}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),url:_(`url`,{length:512}),trigger_id:_(`trigger_id`,{length:255}).notNull(),enabled:g(`enabled`,{mode:`boolean`}).notNull(),created_at_ts:g(`created_at_ts`).notNull(),updated_at_ts:g(`updated_at_ts`).notNull(),synchronous:g(`synchronous`,{mode:`boolean`}).notNull().default(!1),priority:g(`priority`),form_id:_(`form_id`,{length:128}),template_id:_(`template_id`,{length:64}),code_id:_(`code_id`,{length:21}),metadata:_(`metadata`)},e=>[y(`hooks_tenant_id_idx`).on(e.tenant_id)]),dn=v(`hook_code`,{id:_(`id`,{length:21}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),code:_(`code`).notNull(),secrets:_(`secrets`),created_at_ts:g(`created_at_ts`).notNull(),updated_at_ts:g(`updated_at_ts`).notNull()},e=>[y(`hook_code_tenant_id_idx`).on(e.tenant_id)]),fn=v(`keys`,{kid:_(`kid`,{length:255}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).references(()=>b.id,{onDelete:`cascade`}),created_at:_(`created_at`,{length:35}).notNull(),revoked_at:_(`revoked_at`,{length:35}),cert:_(`cert`,{length:4096}),pkcs7:_(`pkcs7`,{length:4096}),fingerprint:_(`fingerprint`,{length:256}),thumbprint:_(`thumbprint`,{length:256}),current_since:_(`current_since`,{length:35}),current_until:_(`current_until`,{length:35}),type:_(`type`,{length:50}).notNull().default(`jwt_signing`),connection:_(`connection`,{length:255}).references(()=>Kt.id,{onDelete:`cascade`})}),pn=v(`custom_text`,{tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),prompt:_(`prompt`,{length:64}).notNull(),language:_(`language`,{length:16}).notNull(),custom_text:_(`custom_text`).notNull(),created_at_ts:g(`created_at_ts`).notNull(),updated_at_ts:g(`updated_at_ts`).notNull()},e=>[It({columns:[e.tenant_id,e.prompt,e.language]})]),mn=v(`authentication_methods`,{id:_(`id`,{length:26}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),user_id:_(`user_id`,{length:255}).notNull(),type:_(`type`,{length:32}).notNull(),phone_number:_(`phone_number`,{length:32}),totp_secret:_(`totp_secret`,{length:255}),credential_id:_(`credential_id`,{length:512}),public_key:_(`public_key`),sign_count:g(`sign_count`),credential_backed_up:g(`credential_backed_up`),transports:_(`transports`,{length:512}),friendly_name:_(`friendly_name`,{length:255}),confirmed:g(`confirmed`).notNull().default(0),created_at_ts:g(`created_at_ts`).notNull(),updated_at_ts:g(`updated_at_ts`).notNull()},e=>[y(`authentication_methods_tenant_user_idx`).on(e.tenant_id,e.user_id),y(`authentication_methods_credential_id_idx`).on(e.credential_id)]),O=v(`logs`,{log_id:_(`log_id`,{length:21}).primaryKey(),category:_(`category`,{length:255}),tenant_id:_(`tenant_id`,{length:64}),user_id:_(`user_id`,{length:64}),ip:_(`ip`,{length:255}),type:_(`type`,{length:8}).notNull(),date:_(`date`,{length:35}).notNull(),client_id:_(`client_id`,{length:255}),client_name:_(`client_name`,{length:255}),user_agent:_(`user_agent`,{length:255}),description:_(`description`,{length:255}),details:_(`details`,{length:2048}),isMobile:g(`isMobile`),user_name:_(`user_name`,{length:255}),connection:_(`connection`,{length:255}),connection_id:_(`connection_id`,{length:255}),audience:_(`audience`,{length:255}),scope:_(`scope`,{length:255}),strategy:_(`strategy`,{length:255}),strategy_type:_(`strategy_type`,{length:255}),hostname:_(`hostname`,{length:255}),auth0_client:_(`auth0_client`,{length:8192}),session_connection:_(`session_connection`,{length:255}),country_code:_(`country_code`,{length:2}),city_name:_(`city_name`,{length:255}),latitude:_(`latitude`,{length:255}),longitude:_(`longitude`,{length:255}),time_zone:_(`time_zone`,{length:255}),continent_code:_(`continent_code`,{length:2})},e=>[y(`logs_user_id`).on(e.user_id),y(`logs_tenant_id`).on(e.tenant_id),y(`logs_date`).on(e.date),y(`IDX_logs_tenant_date_type_user`).on(e.tenant_id,e.date,e.type,e.user_id)]),k=v(`outbox_events`,{id:_(`id`,{length:26}).primaryKey(),tenant_id:_(`tenant_id`,{length:191}).notNull().references(()=>b.id,{onDelete:`cascade`}),event_type:_(`event_type`,{length:64}).notNull(),log_type:_(`log_type`,{length:64}).notNull(),aggregate_type:_(`aggregate_type`,{length:64}).notNull(),aggregate_id:_(`aggregate_id`,{length:255}).notNull(),payload:_(`payload`).notNull(),created_at:_(`created_at`,{length:35}).notNull(),processed_at:_(`processed_at`,{length:35}),retry_count:g(`retry_count`).notNull().default(0),next_retry_at:_(`next_retry_at`,{length:35}),error:_(`error`),claimed_by:_(`claimed_by`,{length:255}),claim_expires_at:_(`claim_expires_at`,{length:35}),dead_lettered_at:_(`dead_lettered_at`,{length:35}),final_error:_(`final_error`)},e=>[y(`idx_outbox_events_tenant_id`).on(e.tenant_id),y(`idx_outbox_events_processed_at`).on(e.processed_at),y(`idx_outbox_events_claimed_by`).on(e.claimed_by),y(`idx_outbox_events_tenant_dead_lettered`).on(e.tenant_id,e.dead_lettered_at)]),hn=a({authenticationCodes:()=>Ht,authenticationMethods:()=>mn,branding:()=>tn,clientGrants:()=>Gt,clientRegistrationTokens:()=>T,clients:()=>w,codes:()=>Vt,connections:()=>Kt,customDomains:()=>qt,customText:()=>pn,domains:()=>Jt,emailProviders:()=>cn,emailTemplates:()=>ln,flows:()=>on,forms:()=>an,hookCode:()=>dn,hooks:()=>un,invites:()=>Xt,keys:()=>fn,loginSessions:()=>C,logs:()=>O,organizations:()=>E,otps:()=>Ut,outboxEvents:()=>k,passwords:()=>zt,promptSettings:()=>sn,refreshTokens:()=>S,resourceServers:()=>D,rolePermissions:()=>Qt,roles:()=>Zt,sessions:()=>Bt,tenants:()=>b,themes:()=>rn,tickets:()=>Wt,universalLoginTemplates:()=>nn,userOrganizations:()=>Yt,userPermissions:()=>$t,userRoles:()=>en,users:()=>x});function A(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>typeof e==`object`&&e?A(e):e);let t={...e};for(let e in t){let n=t[e];n===null?delete t[e]:typeof n==`object`&&n&&(Array.isArray(n)?t[e]=n.map(e=>typeof e==`object`&&e?A(e):e):t[e]=A(n))}return t}function gn(e,t,n={...e}){for(let r of t)e[r]!==void 0&&(n[r]=JSON.stringify(e[r]));return n}function _n(e,t,n=e){for(let r of t)e[r]!==void 0&&(n[r]=+!!e[r])}function vn(e){let t={};for(let n in e)e[n]!==void 0&&e[n]!==null&&(t[n]=e[n]);return t}function j(e,t){if(e==null)return t;if(typeof e==`string`)try{return JSON.parse(e)}catch{return t}return e}function yn(e,t=``,n={}){for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=t?`${t}_${r}`:r,a=e[r];typeof a==`object`&&a&&!Array.isArray(a)?yn(a,i,n):typeof a==`boolean`?n[i]=+!!a:n[i]=a}return n}function bn(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t.find(e=>r.startsWith(`${e}_`));if(!e)n[r]=i;else{let t=r.slice(e.length+1);n[e]={...n[e],[t]:i}}}return n}function xn(e){return typeof e==`string`?parseInt(e,10):typeof e==`bigint`?Number(e):e}function Sn(e){return e===`dark`||e===`light`||e===`auto`}function Cn(e){return{async get(t){let n=await e.select().from(tn).where(m(tn.tenant_id,t)).get();if(!n)return null;let{tenant_id:r,colors_primary:i,colors_page_background_type:a,colors_page_background_start:o,colors_page_background_end:s,colors_page_background_angle_dev:c,font_url:l,dark_mode:u,...d}=n;return A({...d,colors:{primary:i,page_background:{type:a,start:o,end:s,angle_deg:c}},font:l?{url:l}:void 0,dark_mode:Sn(u)?u:void 0})},async set(t,n){let{colors:r,font:i,dark_mode:a,...o}=n,s=r?.page_background,c=s&&typeof s==`object`?s:void 0,l={...o,colors_primary:r?.primary,colors_page_background_type:c?.type,colors_page_background_start:c?.start,colors_page_background_end:c?.end,colors_page_background_angle_dev:c?.angle_deg,font_url:i?.url,dark_mode:a};await e.insert(tn).values({tenant_id:t,...l}).onConflictDoUpdate({target:tn.tenant_id,set:l})}}}var wn=class extends Error{res;status;constructor(e=500,t){super(t?.message,{cause:t?.cause}),this.res=t?.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}};function Tn(e,t,n){let r=t.split(/ OR /i);if(r.length>1){let t=r.map(t=>{let n=t.trim().match(/^([^:]+):(.+)$/);if(n){let[,t,r]=n;if(!t||!r)return null;let i=r.replace(/^"(.*)"$/,`$1`),a=e[t.trim()];return a?m(a,i.trim()):null}return null}).filter(Boolean);return t.length===0?void 0:Ae(...t)}let i=[],a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];n===`"`?(o=!o,a+=n):n===` `&&!o?a.trim()&&(i.push(a.trim()),a=``):a+=n}a.trim()&&i.push(a.trim());let s=i.filter(e=>e!==`AND`).map(e=>e.replace(/^([^:]+)=/g,`$1:`)).map(e=>{let t=e.startsWith(`-`),n=null,r=``,i=!1,a;if(e.startsWith(`-_exists_:`))n=e.substring(10),i=!0,t=!0;else if(e.startsWith(`_exists_:`))n=e.substring(9),i=!0,t=!1;else if(e.includes(`:`)){let o=t?e.substring(1):e,s=o.indexOf(`:`);n=o.substring(0,s),r=o.substring(s+1),i=!1,r.startsWith(`>=`)?(a=`>=`,r=r.substring(2)):r.startsWith(`>`)?(a=`>`,r=r.substring(1)):r.startsWith(`<=`)?(a=`<=`,r=r.substring(2)):r.startsWith(`<`)?(a=`<`,r=r.substring(1)):a=`=`,r.startsWith(`"`)&&r.endsWith(`"`)&&r.length>1&&(r=r.slice(1,-1))}else n=null,r=e,i=!1;return{key:n,value:r,isNegation:t,isExistsQuery:i,operator:a}}),c=[];for(let{key:t,value:r,isNegation:i,isExistsQuery:a,operator:o}of s)if(t){let n=e[t];if(!n){a?c.push(i?p`${p.identifier(t)} IS NULL`:p`${p.identifier(t)} IS NOT NULL`):c.push(p`${p.identifier(t)} ${p.raw(i?`!=`:o??`=`)} ${r}`);continue}if(a)c.push(i?Ie(n):Le(n));else if(i)switch(o){case`>`:c.push(Pe(n,r));break;case`>=`:c.push(Ne(n,r));break;case`<`:c.push(Me(n,r));break;case`<=`:c.push(je(n,r));break;default:c.push(ke(n,r))}else switch(o){case`>`:c.push(je(n,r));break;case`>=`:c.push(Me(n,r));break;case`<`:c.push(Ne(n,r));break;case`<=`:c.push(Pe(n,r));break;default:c.push(m(n,r))}}else if(r){let t=(r.includes(`|`)?[...n,`user_id`]:n).map(t=>{let n=e[t];return n?t===`user_id`?m(n,r):Re(n,`%${r}%`):null}).filter(Boolean);t.length>0&&c.push(Ae(...t))}if(c.length!==0)return c.length===1?c[0]:h(...c)}var En=[`global`,`is_first_party`,`oidc_conformant`,`auth0_conformant`,`sso`,`sso_disabled`,`cross_origin_authentication`,`custom_login_page_on`,`require_pushed_authorization_requests`,`require_proof_of_possession`,`hide_sign_up_disabled_error`],Dn=[`callbacks`,`allowed_origins`,`web_origins`,`client_aliases`,`allowed_clients`,`allowed_logout_urls`,`grant_types`,`signing_keys`],On=[`session_transfer`,`oidc_logout`,`jwt_configuration`,`encryption_key`,`addons`,`client_metadata`,`mobile`,`native_social_login`,`refresh_token`,`default_organization`,`client_authentication_methods`,`signed_request_object`,`token_quota`,`registration_metadata`];function kn(e){let{tenant_id:t,connections:n,...r}=e,i={...r};for(let e of En)i[e]=!!r[e];for(let e of Dn)i[e]=j(r[e],[]);for(let e of On)i[e]=j(r[e],{});return i.connections=j(n,[]),A(i)}function An(e){let t={...e};_n(e,En,t);for(let n of Dn)e[n]!==void 0&&(t[n]=JSON.stringify(e[n]||[]));for(let n of On)e[n]!==void 0&&(t[n]=JSON.stringify(e[n]||{}));return e.connections!==void 0&&(t.connections=JSON.stringify(e.connections||[])),vn(t)}function jn(e){return{async create(t,n){let r=new Date().toISOString(),i={client_id:n.client_id,tenant_id:t,name:n.name,description:n.description,app_type:n.app_type??`regular_web`,logo_uri:n.logo_uri,client_secret:n.client_secret,token_endpoint_auth_method:n.token_endpoint_auth_method??`client_secret_basic`,cross_origin_loc:n.cross_origin_loc,custom_login_page:n.custom_login_page,custom_login_page_preview:n.custom_login_page_preview,form_template:n.form_template,initiate_login_uri:n.initiate_login_uri,organization_usage:n.organization_usage??`deny`,organization_require_behavior:n.organization_require_behavior??`no_prompt`,compliance_level:n.compliance_level,par_request_expiry:n.par_request_expiry,created_at:r,updated_at:r};for(let e of En)i[e]=n[e]??!1;i.oidc_conformant=n.oidc_conformant??!0,i.auth0_conformant=n.auth0_conformant??!0,i.sso_disabled=n.sso_disabled??!1;for(let e of Dn)i[e]=n[e]||[];for(let e of On)i[e]=n[e]||{};i.connections=n.connections||[];let a=An(i);try{await e.insert(w).values({...a,tenant_id:t})}catch(e){throw e?.message?.includes(`UNIQUE constraint failed`)||e?.message?.includes(`duplicate key`)?new wn(409,{message:`Client already exists`}):e}return kn({...a,tenant_id:t})},async get(t,n){let r=await e.select().from(w).where(h(m(w.tenant_id,t),m(w.client_id,n))).get();return r?kn(r):null},async getByClientId(t){let n=await e.select().from(w).where(m(w.client_id,t)).get();return n?{...kn(n),tenant_id:n.tenant_id}:null},async update(t,n,r){let i=An({...r,updated_at:new Date().toISOString()});return delete i.client_id,delete i.tenant_id,await e.update(w).set(i).where(h(m(w.tenant_id,t),m(w.client_id,n))),!0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=e.select().from(w).where(m(w.tenant_id,t)).$dynamic();if(s){let e=Tn(w,s,[`name`,`client_id`]);e&&(c=c.where(h(m(w.tenant_id,t),e)))}if(o?.sort_by){let e=w[o.sort_by];e&&(c=c.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let l=(await c.offset(r*i).limit(i)).map(kn);if(!a)return{clients:l};let[u]=await e.select({count:Ve()}).from(w).where(m(w.tenant_id,t));return{clients:l,start:r*i,limit:i,length:Number(u?.count??0)}},async remove(t,n){return(await e.delete(w).where(h(m(w.tenant_id,t),m(w.client_id,n))).returning()).length>0}}}function Mn(e){let{tenant_id:t,is_system:n,options:r,metadata:i,...a}=e;return A({...a,options:j(r,{}),metadata:j(i),is_system:n?!0:void 0})}function Nn(e){return{async listByClient(t,n){let r=await e.select({connections:w.connections}).from(w).where(h(m(w.tenant_id,t),m(w.client_id,n))).get();if(!r)return[];let i=j(r.connections,[])||[];if(i.length===0)return[];let a=(await e.select().from(Kt).where(h(m(Kt.tenant_id,t),Fe(Kt.id,i))).all()).map(Mn);return i.map(e=>a.find(t=>t.id===e)).filter(Boolean)},async updateByClient(t,n,r){return(await e.update(w).set({connections:JSON.stringify([...new Set(r)])}).where(h(m(w.tenant_id,t),m(w.client_id,n))).returning()).length>0},async listByConnection(t,n){return(await e.select({client_id:w.client_id,connections:w.connections}).from(w).where(m(w.tenant_id,t)).all()).filter(e=>(j(e.connections,[])||[]).includes(n)).map(e=>e.client_id)},async addClientToConnection(t,n,r){if(!await e.select({client_id:w.client_id}).from(w).where(h(m(w.tenant_id,t),m(w.client_id,r))).get())return!1;let i=await e.run(p`UPDATE clients SET connections = CASE
|
|
2
2
|
WHEN connections IS NULL OR connections = '[]' OR connections = ''
|
|
3
3
|
THEN json_array(${n})
|
|
4
4
|
WHEN EXISTS (SELECT 1 FROM json_each(connections) WHERE value = ${n})
|
|
5
5
|
THEN connections
|
|
6
6
|
ELSE json_insert(connections, '$[#]', ${n})
|
|
7
7
|
END
|
|
8
|
-
WHERE tenant_id = ${t} AND client_id = ${
|
|
8
|
+
WHERE tenant_id = ${t} AND client_id = ${r}`);return(i.changes??i.meta?.changes??0)>0},async removeClientFromConnection(t,n,r){let i=await e.run(p`UPDATE clients SET connections = (
|
|
9
9
|
SELECT COALESCE(json_group_array(je.value), '[]')
|
|
10
10
|
FROM json_each(COALESCE(connections, '[]')) AS je
|
|
11
11
|
WHERE je.value != ${n}
|
|
12
12
|
)
|
|
13
|
-
WHERE tenant_id = ${t} AND client_id = ${i}`);return(o.changes??((s=o.meta)==null?void 0:s.changes)??0)>0}}}let Mc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",jc=e=>crypto.getRandomValues(new Uint8Array(e)),qc=(e,t,n)=>{let i=256-256%e.length;if(i===256){let a=e.length-1;return(s=t)=>{if(!s)return"";let c="";for(;;){let u=n(s),p=s;for(;p--;)if(c+=e[u[p]&a],c.length>=s)return c}}}let o=Math.ceil(1.6*256*t/i);return(a=t)=>{if(!a)return"";let s="";for(;;){let c=n(o),u=o;for(;u--;)if(c[u]<i&&(s+=e[c[u]%e.length],s.length>=a))return s}}},Bc=(e,t=21)=>qc(e,t|0,jc),Le=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Mc[n[e]&63];return t};function En(e){const{tenant_id:t,scope:n,authorization_details_types:i,allow_any_organization:o,is_system:a,...s}=e;return K({...s,scope:R(n,[]),authorization_details_types:R(i,[]),allow_any_organization:!!o,is_system:!!a})}function Jc(e){return{async create(t,n){const i=new Date().toISOString(),a={id:n.id||Le(),tenant_id:t,client_id:n.client_id,audience:n.audience,scope:JSON.stringify(n.scope||[]),organization_usage:n.organization_usage,allow_any_organization:n.allow_any_organization?1:0,is_system:n.is_system?1:0,subject_type:n.subject_type,authorization_details_types:JSON.stringify(n.authorization_details_types||[]),created_at:i,updated_at:i};return await e.insert(Se).values(a),En({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(Se).where(w(_(Se.tenant_id,t),_(Se.id,n))).get();return i?En(i):null},async update(t,n,i){const{scope:o,authorization_details_types:a,allow_any_organization:s,is_system:c,...u}=i,p={...u,updated_at:new Date().toISOString()};return o!==void 0&&(p.scope=JSON.stringify(o)),a!==void 0&&(p.authorization_details_types=JSON.stringify(a)),s!==void 0&&(p.allow_any_organization=s?1:0),c!==void 0&&(p.is_system=c?1:0),(await e.update(Se).set(p).where(w(_(Se.tenant_id,t),_(Se.id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{},u=c?Ye(Se,c,["client_id","audience"]):void 0,p=u?w(_(Se.tenant_id,t),u):_(Se.tenant_id,t);let d=e.select().from(Se).where(p).$dynamic();if(s!=null&&s.sort_by){const S=Se[s.sort_by];S&&(d=d.orderBy(s.sort_order==="desc"?le(S):me(S)))}else d=d.orderBy(me(Se.created_at));const m=(await d.offset(i*o).limit(o)).map(En);if(!a)return{client_grants:m};const[y]=await e.select({count:ye()}).from(Se).where(p);return{client_grants:m,start:i*o,limit:o,length:Number((y==null?void 0:y.count)??0)}},async remove(t,n){return(await e.delete(Se).where(w(_(Se.tenant_id,t),_(Se.id,n))).returning()).length>0}}}function kt(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]]);return n}const Kc={ZodAny:"any",ZodArray:"array",ZodBigInt:"bigint",ZodBoolean:"boolean",ZodDefault:"default",ZodPrefault:"prefault",ZodTransform:"transform",ZodEnum:"enum",ZodIntersection:"intersection",ZodLazy:"lazy",ZodLiteral:"literal",ZodNever:"never",ZodNull:"null",ZodNullable:"nullable",ZodNumber:"number",ZodNonOptional:"nonoptional",ZodObject:"object",ZodOptional:"optional",ZodPipe:"pipe",ZodReadonly:"readonly",ZodRecord:"record",ZodString:"string",ZodTuple:"tuple",ZodType:"type",ZodUnion:"union",ZodDiscriminatedUnion:"union",ZodUnknown:"unknown",ZodVoid:"void",ZodDate:"date",ZodTemplateLiteral:"template_literal"};function tt(e,t){return(Array.isArray(t)?t:[t]).some(i=>{var o;const a=((o=e==null?void 0:e.def)===null||o===void 0?void 0:o.type)===Kc[i];return i==="ZodDiscriminatedUnion"?a&&"discriminator"in e.def:a})}function vt(e){return e&&"def"in e}let Gc=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const i=n[0];if(this._map.set(t,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const i={...this.get(n)??{}};return delete i.id,{...i,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function Vc(){return new Gc}function On(e){return e===void 0}function Hc(e,t){const n={};return Object.entries(e).forEach(([i,o])=>{t.some(a=>a===i)||(n[i]=o)}),n}function In(e,t){const n={};return Object.entries(e).forEach(([i,o])=>{t(o,i)||(n[i]=o)}),n}const Zi=Vc();class at{static collectMetadata(t,n){const i=this.getMetadataFromRegistry(t),o=Object.assign(Object.assign({},i==null?void 0:i._internal),n==null?void 0:n._internal),a=Object.assign(Object.assign({},i==null?void 0:i.param),n==null?void 0:n.param),s=Object.assign(Object.assign(Object.assign(Object.assign({},Object.keys(o).length>0?{_internal:o}:{}),i),n),Object.keys(a).length>0?{param:a}:{});if(tt(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&vt(t._zod.def.innerType))return this.collectMetadata(t._zod.def.innerType,s);if(tt(t,"ZodPipe")){const c=t._zod.def.in,u=t._zod.def.out;if(tt(c,"ZodTransform")&&vt(u))return this.collectMetadata(u,s);if(vt(c))return this.collectMetadata(c,s)}return s}static getMetadata(t){return this.collectMetadata(t)}static getOpenApiMetadata(t){const n=this.collectMetadata(t),i=n??{},{_internal:o}=i;return kt(i,["_internal"])}static getInternalMetadata(t){var n;return(n=this.collectMetadata(t))===null||n===void 0?void 0:n._internal}static getParamMetadata(t){const n=this.collectMetadata(t);return Object.assign(Object.assign({},n),{param:Object.assign(Object.assign({},n!=null&&n.description?{description:n.description}:{}),n==null?void 0:n.param)})}static buildSchemaMetadata(t){return In(Hc(t,["param","_internal"]),On)}static buildParameterMetadata(t){return In(t,On)}static applySchemaMetadata(t,n){return In(Object.assign(Object.assign({},t),this.buildSchemaMetadata(n)),On)}static getRefId(t){var n;return(n=this.getInternalMetadata(t))===null||n===void 0?void 0:n.refId}static unwrapChained(t){return this.unwrapUntil(t)}static getDefaultValue(t){var n;const i=(n=this.unwrapUntil(t,"ZodDefault"))!==null&&n!==void 0?n:this.unwrapUntil(t,"ZodPrefault");return i==null?void 0:i._zod.def.defaultValue}static unwrapUntil(t,n){if(n&&tt(t,n))return t;if(tt(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&vt(t._zod.def.innerType))return this.unwrapUntil(t._zod.def.innerType,n);if(tt(t,"ZodPipe")){const i=t._zod.def.in,o=t._zod.def.out;if(tt(i,"ZodTransform")&&vt(o))return this.unwrapUntil(o,n);if(vt(i))return this.unwrapUntil(i,n)}return n?void 0:t}static getMetadataFromInternalRegistry(t){return Zi.get(t)}static getMetadataFromRegistry(t){const n=this.getMetadataFromInternalRegistry(t),i=t.meta();if(!n)return i;const{_internal:o}=n,a=kt(n,["_internal"]),s=i??{},{id:c,title:u}=s,p=kt(s,["id","title"]);return Object.assign(Object.assign(Object.assign({_internal:Object.assign(Object.assign({},c?{refId:c}:{}),o)},a),u?{description:u}:{}),p)}static setMetadataInRegistry(t,n){Zi.add(t,n)}}function et(e,t){const n=e[t];typeof n=="function"&&(e[t]=function(...i){const o=n.apply(this,i),a=at.getMetadataFromRegistry(this);return a&&at.setMetadataInRegistry(o,a),o})}function Wc(e){typeof e.ZodType.prototype.openapi<"u"||(e.ZodType.prototype.openapi=function(...t){const{refId:n,metadata:i,options:o}=Qc(...t),a=i??{},{param:s}=a,c=kt(a,["param"]),u=at.getMetadataFromRegistry(this),p=u??{},{_internal:d}=p,h=kt(p,["_internal"]),m=Object.assign(Object.assign(Object.assign({},d),o),n?{refId:n}:void 0),y=Object.assign(Object.assign(Object.assign({},h),c),h!=null&&h.param||s?{param:Object.assign(Object.assign({},h==null?void 0:h.param),s)}:void 0),S=new this.constructor(this._def);function C(x){at.setMetadataInRegistry(x,Object.assign(Object.assign({},Object.keys(m).length>0?{_internal:m}:void 0),y))}if(C(S),tt(S,"ZodLazy")&&C(this),tt(S,"ZodObject")){const x=at.getMetadataFromRegistry(S),G=S.extend;S.extend=function(...X){const V=G.apply(S,X),we=x??{},{_internal:j}=we,ve=kt(we,["_internal"]);return at.setMetadataInRegistry(V,{_internal:{extendedFrom:j!=null&&j.refId?{refId:j.refId,schema:S}:j==null?void 0:j.extendedFrom}}),V.openapi(ve)},et(S,"catchall")}et(S,"optional"),et(S,"nullable"),et(S,"default"),et(S,"transform"),et(S,"refine"),et(S,"length"),et(S,"min"),et(S,"max");const L=S.meta;return S.meta=function(...x){const G=L.apply(this,x);if(x[0]){const X=at.getMetadataFromInternalRegistry(this);X&&at.setMetadataInRegistry(G,Object.assign(Object.assign({},X),x[0]))}return G},S})}function Qc(e,t,n){return typeof e=="string"?{refId:e,metadata:t,options:n}:{refId:void 0,metadata:e,options:t}}new Set(".\\+*[^]$()");var Mi;function v(e,t,n){function i(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const p=s.prototype,d=Object.keys(p);for(let h=0;h<d.length;h++){const m=d[h];m in c||(c[m]=p[m].bind(c))}}const o=(n==null?void 0:n.Parent)??Object;class a extends o{}Object.defineProperty(a,"name",{value:e});function s(c){var u;const p=n!=null&&n.Parent?new a:this;i(p,c),(u=p._zod).deferred??(u.deferred=[]);for(const d of p._zod.deferred)d();return p}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>{var u,p;return n!=null&&n.Parent&&c instanceof n.Parent?!0:(p=(u=c==null?void 0:c._zod)==null?void 0:u.traits)==null?void 0:p.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class At extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Fa extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Mi=globalThis).__zod_globalConfig??(Mi.__zod_globalConfig={});const dn=globalThis.__zod_globalConfig;function Xe(e){return e&&Object.assign(dn,e),dn}function Za(e){const t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,o])=>t.indexOf(+i)===-1).map(([i,o])=>o)}function ji(e,t="|"){return e.map(n=>qa(n)).join(t)}function Kn(e,t){return typeof t=="bigint"?t.toString():t}function hn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hi(e){return e==null}function mi(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Xc(e,t){const n=e/t,i=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<o?0:n-i}const qi=Symbol("evaluating");function H(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==qi)return i===void 0&&(i=qi,i=n()),i},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function mt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ct(...e){const t={};for(const n of e){const i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function Bi(e){return JSON.stringify(e)}function Yc(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ma="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const eu=hn(()=>{var e;if(dn.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Ct(e){if(Mt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Mt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ja(e){return Ct(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const tu=new Set(["string","number","symbol"]);function zt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function it(e,t,n){const i=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(i._zod.parent=e),i}function T(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function qa(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function nu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const iu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ou(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const a=ct(e._zod.def,{get shape(){const s={};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(s[c]=n.shape[c])}return mt(this,"shape",s),s},checks:[]});return it(e,a)}function ru(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=ct(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete s[c]}return mt(this,"shape",s),s},checks:[]});return it(e,a)}function au(e,t){if(!Ct(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const a=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(a,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=ct(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return mt(this,"shape",a),a}});return it(e,o)}function su(e,t){if(!Ct(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ct(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return mt(this,"shape",i),i}});return it(e,n)}function lu(e,t){var i;if((i=e._zod.def.checks)!=null&&i.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=ct(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return mt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return it(e,n)}function cu(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=ct(t._zod.def,{get shape(){const c=t._zod.def.shape,u={...c};if(n)for(const p in n){if(!(p in c))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(u[p]=e?new e({type:"optional",innerType:c[p]}):c[p])}else for(const p in c)u[p]=e?new e({type:"optional",innerType:c[p]}):c[p];return mt(this,"shape",u),u},checks:[]});return it(t,s)}function uu(e,t,n){const i=ct(t._zod.def,{get shape(){const o=t._zod.def.shape,a={...o};if(n)for(const s in n){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(a[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)a[s]=new e({type:"nonoptional",innerType:o[s]});return mt(this,"shape",a),a}});return it(t,i)}function Nt(e,t=0){var n;if(e.aborted===!0)return!0;for(let i=t;i<e.issues.length;i++)if(((n=e.issues[i])==null?void 0:n.continue)!==!0)return!0;return!1}function du(e,t=0){var n;if(e.aborted===!0)return!0;for(let i=t;i<e.issues.length;i++)if(((n=e.issues[i])==null?void 0:n.continue)===!1)return!0;return!1}function Et(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Qt(e){return typeof e=="string"?e:e==null?void 0:e.message}function nt(e,t,n){var u,p,d,h,m,y;const i=e.message?e.message:Qt((d=(p=(u=e.inst)==null?void 0:u._zod.def)==null?void 0:p.error)==null?void 0:d.call(p,e))??Qt((h=t==null?void 0:t.error)==null?void 0:h.call(t,e))??Qt((m=n.customError)==null?void 0:m.call(n,e))??Qt((y=n.localeError)==null?void 0:y.call(n,e))??"Invalid input",{inst:o,continue:a,input:s,...c}=e;return c.path??(c.path=[]),c.message=i,t!=null&&t.reportInput&&(c.input=s),c}function yi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _u(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";const n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function jt(...e){const[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}const Ba=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Kn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ja=v("$ZodError",Ba),Ka=v("$ZodError",Ba,{Parent:Error});function Ga(e,t=n=>n.message){const n={},i=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):i.push(t(o));return{formErrors:i,fieldErrors:n}}function Va(e,t=n=>n.message){const n={_errors:[]},i=(o,a=[])=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>i({issues:c},[...a,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...a,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...a,...s.path]);else{const c=[...a,...s.path];if(c.length===0)n._errors.push(t(s));else{let u=n,p=0;for(;p<c.length;){const d=c[p];p===c.length-1?(u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(s))):u[d]=u[d]||{_errors:[]},u=u[d],p++}}}};return i(e),n}const wi=e=>(t,n,i,o)=>{const a=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new At;if(s.issues.length){const c=new((o==null?void 0:o.Err)??e)(s.issues.map(u=>nt(u,a,Xe())));throw Ma(c,o==null?void 0:o.callee),c}return s.value},vi=e=>async(t,n,i,o)=>{const a=i?{...i,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){const c=new((o==null?void 0:o.Err)??e)(s.issues.map(u=>nt(u,a,Xe())));throw Ma(c,o==null?void 0:o.callee),c}return s.value},mn=e=>(t,n,i)=>{const o=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new At;return a.issues.length?{success:!1,error:new(e??Ja)(a.issues.map(s=>nt(s,o,Xe())))}:{success:!0,data:a.value}},pu=mn(Ka),yn=e=>async(t,n,i)=>{const o=i?{...i,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(s=>nt(s,o,Xe())))}:{success:!0,data:a.value}},fu=yn(Ka),gu=e=>(t,n,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return wi(e)(t,n,o)},hu=e=>(t,n,i)=>wi(e)(t,n,i),mu=e=>async(t,n,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return vi(e)(t,n,o)},yu=e=>async(t,n,i)=>vi(e)(t,n,i),wu=e=>(t,n,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return mn(e)(t,n,o)},vu=e=>(t,n,i)=>mn(e)(t,n,i),bu=e=>async(t,n,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return yn(e)(t,n,o)},Su=e=>async(t,n,i)=>yn(e)(t,n,i),Nu=/^[cC][0-9a-z]{6,}$/,Eu=/^[0-9a-z]+$/,Ou=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Iu=/^[0-9a-vA-V]{20}$/,ku=/^[A-Za-z0-9]{27}$/,Au=/^[a-zA-Z0-9_-]{21}$/,Tu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Cu=/^([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})$/,Ji=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,zu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Du="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function xu(){return new RegExp(Du,"u")}const $u=/^(?:(?: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])$/,Ru=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Lu=/^((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])$/,Pu=/^(([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])$/,Uu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ha=/^[A-Za-z0-9_-]*$/,Fu=/^https?$/,Zu=/^\+[1-9]\d{6,14}$/,Wa="(?:(?:\\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])))",Mu=new RegExp(`^${Wa}$`);function Qa(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ju(e){return new RegExp(`^${Qa(e)}$`)}function qu(e){const t=Qa({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${Wa}T(?:${i})$`)}const Bu=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ju=/^-?\d+$/,Xa=/^-?\d+(?:\.\d+)?$/,Ku=/^(?:true|false)$/i,Gu=/^null$/i,Vu=/^[^A-Z]*$/,Hu=/^[^a-z]*$/,Pe=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ya={number:"number",bigint:"bigint",object:"date"},es=v("$ZodCheckLessThan",(e,t)=>{Pe.init(e,t);const n=Ya[typeof t.value];e._zod.onattach.push(i=>{const o=i._zod.bag,a=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ts=v("$ZodCheckGreaterThan",(e,t)=>{Pe.init(e,t);const n=Ya[typeof t.value];e._zod.onattach.push(i=>{const o=i._zod.bag,a=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wu=v("$ZodCheckMultipleOf",(e,t)=>{Pe.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Xc(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Qu=v("$ZodCheckNumberFormat",(e,t)=>{var s;Pe.init(e,t),t.format=t.format||"float64";const n=(s=t.format)==null?void 0:s.includes("int"),i=n?"int":"number",[o,a]=iu[t.format];e._zod.onattach.push(c=>{const u=c._zod.bag;u.format=t.format,u.minimum=o,u.maximum=a,n&&(u.pattern=Ju)}),e._zod.check=c=>{const u=c.value;if(n){if(!Number.isInteger(u)){c.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?c.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):c.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}u<o&&c.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>a&&c.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Xu=v("$ZodCheckMaxLength",(e,t)=>{var n;Pe.init(e,t),(n=e._zod.def).when??(n.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{const o=i.value;if(o.length<=t.maximum)return;const s=yi(o);i.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Yu=v("$ZodCheckMinLength",(e,t)=>{var n;Pe.init(e,t),(n=e._zod.def).when??(n.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const o=i.value;if(o.length>=t.minimum)return;const s=yi(o);i.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ed=v("$ZodCheckLengthEquals",(e,t)=>{var n;Pe.init(e,t),(n=e._zod.def).when??(n.when=i=>{const o=i.value;return!hi(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=i=>{const o=i.value,a=o.length;if(a===t.length)return;const s=yi(o),c=a>t.length;i.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),wn=v("$ZodCheckStringFormat",(e,t)=>{var n,i;Pe.init(e,t),e._zod.onattach.push(o=>{const a=o._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),td=v("$ZodCheckRegex",(e,t)=>{wn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),nd=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Vu),wn.init(e,t)}),id=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Hu),wn.init(e,t)}),od=v("$ZodCheckIncludes",(e,t)=>{Pe.init(e,t);const n=zt(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(o=>{const a=o._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(i)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),rd=v("$ZodCheckStartsWith",(e,t)=>{Pe.init(e,t);const n=new RegExp(`^${zt(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),ad=v("$ZodCheckEndsWith",(e,t)=>{Pe.init(e,t);const n=new RegExp(`.*${zt(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}}),sd=v("$ZodCheckOverwrite",(e,t)=>{Pe.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class ld{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const i=t.split(`
|
|
14
|
-
`).filter(s=>s),o=Math.min(...i.map(s=>s.length-s.trimStart().length)),a=i.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of a)this.content.push(s)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(a=>` ${a}`)];return new t(...n,o.join(`
|
|
15
|
-
`))}}const cd={major:4,minor:4,patch:3},ie=v("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=cd;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const a of i)for(const s of a._zod.onattach)s(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const a=(c,u,p)=>{let d=Nt(c),h;for(const m of u){if(m._zod.def.when){if(du(c)||!m._zod.def.when(c))continue}else if(d)continue;const y=c.issues.length,S=m._zod.check(c);if(S instanceof Promise&&(p==null?void 0:p.async)===!1)throw new At;if(h||S instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await S,c.issues.length!==y&&(d||(d=Nt(c,y)))});else{if(c.issues.length===y)continue;d||(d=Nt(c,y))}}return h?h.then(()=>c):c},s=(c,u,p)=>{if(Nt(c))return c.aborted=!0,c;const d=a(u,i,p);if(d instanceof Promise){if(p.async===!1)throw new At;return d.then(h=>e._zod.parse(h,p))}return e._zod.parse(d,p)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){const d=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});return d instanceof Promise?d.then(h=>s(h,c,u)):s(d,c,u)}const p=e._zod.parse(c,u);if(p instanceof Promise){if(u.async===!1)throw new At;return p.then(d=>a(d,i,u))}return a(p,i,u)}}H(e,"~standard",()=>({validate:a=>{var s;try{const c=pu(e,a);return c.success?{value:c.data}:{issues:(s=c.error)==null?void 0:s.issues}}catch{return fu(e,a).then(u=>{var p;return u.success?{value:u.data}:{issues:(p=u.error)==null?void 0:p.issues}})}},vendor:"zod",version:1}))}),bi=v("$ZodString",(e,t)=>{var n;ie.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Bu(e._zod.bag),e._zod.parse=(i,o)=>{if(t.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),re=v("$ZodStringFormat",(e,t)=>{wn.init(e,t),bi.init(e,t)}),ud=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Cu),re.init(e,t)}),dd=v("$ZodUUID",(e,t)=>{if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ji(i))}else t.pattern??(t.pattern=Ji());re.init(e,t)}),_d=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zu),re.init(e,t)}),pd=v("$ZodURL",(e,t)=>{re.init(e,t),e._zod.check=n=>{var i;try{const o=n.value.trim();if(!t.normalize&&((i=t.protocol)==null?void 0:i.source)===Fu.source&&!/^https?:\/\//i.test(o)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const a=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),fd=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=xu()),re.init(e,t)}),gd=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Au),re.init(e,t)}),hd=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Nu),re.init(e,t)}),md=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Eu),re.init(e,t)}),yd=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ou),re.init(e,t)}),wd=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Iu),re.init(e,t)}),vd=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ku),re.init(e,t)}),bd=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=qu(t)),re.init(e,t)}),Sd=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Mu),re.init(e,t)}),Nd=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ju(t)),re.init(e,t)}),Ed=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Tu),re.init(e,t)}),Od=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$u),re.init(e,t),e._zod.bag.format="ipv4"}),Id=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ru),re.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),kd=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Lu),re.init(e,t)}),Ad=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Pu),re.init(e,t),e._zod.check=n=>{const i=n.value.split("/");try{if(i.length!==2)throw new Error;const[o,a]=i;if(!a)throw new Error;const s=Number(a);if(`${s}`!==a)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ns(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Td=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Uu),re.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{ns(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Cd(e){if(!Ha.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ns(n)}const zd=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ha),re.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Cd(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Dd=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Zu),re.init(e,t)});function xd(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[i]=n;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const $d=v("$ZodJWT",(e,t)=>{re.init(e,t),e._zod.check=n=>{xd(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),is=v("$ZodNumber",(e,t)=>{ie.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xa,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const a=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...a?{received:a}:{}}),n}}),Rd=v("$ZodNumberFormat",(e,t)=>{Qu.init(e,t),is.init(e,t)}),Ld=v("$ZodBoolean",(e,t)=>{ie.init(e,t),e._zod.pattern=Ku,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Pd=v("$ZodNull",(e,t)=>{ie.init(e,t),e._zod.pattern=Gu,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Ud=v("$ZodAny",(e,t)=>{ie.init(e,t),e._zod.parse=n=>n}),Fd=v("$ZodUnknown",(e,t)=>{ie.init(e,t),e._zod.parse=n=>n}),Zd=v("$ZodNever",(e,t)=>{ie.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ki(e,t,n){e.issues.length&&t.issues.push(...Et(n,e.issues)),t.value[n]=e.value}const Md=v("$ZodArray",(e,t)=>{ie.init(e,t),e._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const a=[];for(let s=0;s<o.length;s++){const c=o[s],u=t.element._zod.run({value:c,issues:[]},i);u instanceof Promise?a.push(u.then(p=>Ki(p,n,s))):Ki(u,n,s)}return a.length?Promise.all(a).then(()=>n):n}});function _n(e,t,n,i,o,a){const s=n in i;if(e.issues.length){if(o&&a&&!s)return;t.issues.push(...Et(n,e.issues))}if(!s&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function os(e){var i,o,a,s;const t=Object.keys(e.shape);for(const c of t)if(!((s=(a=(o=(i=e.shape)==null?void 0:i[c])==null?void 0:o._zod)==null?void 0:a.traits)!=null&&s.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const n=nu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function rs(e,t,n,i,o,a){const s=[],c=o.keySet,u=o.catchall._zod,p=u.def.type,d=u.optin==="optional",h=u.optout==="optional";for(const m in t){if(m==="__proto__"||c.has(m))continue;if(p==="never"){s.push(m);continue}const y=u.run({value:t[m],issues:[]},i);y instanceof Promise?e.push(y.then(S=>_n(S,n,m,t,d,h))):_n(y,n,m,t,d,h)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const jd=v("$ZodObject",(e,t)=>{ie.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}const i=hn(()=>os(t));H(e._zod,"propValues",()=>{const c=t.shape,u={};for(const p in c){const d=c[p]._zod;if(d.values){u[p]??(u[p]=new Set);for(const h of d.values)u[p].add(h)}}return u});const o=Mt,a=t.catchall;let s;e._zod.parse=(c,u)=>{s??(s=i.value);const p=c.value;if(!o(p))return c.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),c;c.value={};const d=[],h=s.shape;for(const m of s.keys){const y=h[m],S=y._zod.optin==="optional",C=y._zod.optout==="optional",L=y._zod.run({value:p[m],issues:[]},u);L instanceof Promise?d.push(L.then(x=>_n(x,c,m,p,S,C))):_n(L,c,m,p,S,C)}return a?rs(d,p,c,u,i.value,e):d.length?Promise.all(d).then(()=>c):c}}),qd=v("$ZodObjectJIT",(e,t)=>{jd.init(e,t);const n=e._zod.parse,i=hn(()=>os(t)),o=m=>{var X,V;const y=new ld(["shape","payload","ctx"]),S=i.value,C=we=>{const j=Bi(we);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};y.write("const input = payload.value;");const L=Object.create(null);let x=0;for(const we of S.keys)L[we]=`key_${x++}`;y.write("const newResult = {};");for(const we of S.keys){const j=L[we],ve=Bi(we),wt=m[we],$i=((X=wt==null?void 0:wt._zod)==null?void 0:X.optin)==="optional",lc=((V=wt==null?void 0:wt._zod)==null?void 0:V.optout)==="optional";y.write(`const ${j} = ${C(we)};`),$i&&lc?y.write(`
|
|
16
|
-
if (${j}.issues.length) {
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
WHERE tenant_id = ${t} AND client_id = ${r}`);return(i.changes??i.meta?.changes??0)>0}}}var Pn,Fn=i((()=>{Pn=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`})),In=a({customAlphabet:()=>zn,customRandom:()=>Rn,nanoid:()=>Bn,random:()=>Ln,urlAlphabet:()=>Pn}),Ln,Rn,zn,Bn,Vn=i((()=>{Fn(),Ln=e=>crypto.getRandomValues(new Uint8Array(e)),Rn=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(1.6*256*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},zn=(e,t=21)=>Rn(e,t|0,Ln),Bn=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Pn[n[e]&63];return t}}));Vn();function Hn(e){let{tenant_id:t,scope:n,authorization_details_types:r,allow_any_organization:i,is_system:a,...o}=e;return A({...o,scope:j(n,[]),authorization_details_types:j(r,[]),allow_any_organization:!!i,is_system:!!a})}function Un(e){return{async create(t,n){let r=new Date().toISOString(),i={id:n.id||Bn(),tenant_id:t,client_id:n.client_id,audience:n.audience,scope:JSON.stringify(n.scope||[]),organization_usage:n.organization_usage,allow_any_organization:+!!n.allow_any_organization,is_system:+!!n.is_system,subject_type:n.subject_type,authorization_details_types:JSON.stringify(n.authorization_details_types||[]),created_at:r,updated_at:r};return await e.insert(Gt).values(i),Hn({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(Gt).where(h(m(Gt.tenant_id,t),m(Gt.id,n))).get();return r?Hn(r):null},async update(t,n,r){let{scope:i,authorization_details_types:a,allow_any_organization:o,is_system:s,...c}=r,l={...c,updated_at:new Date().toISOString()};return i!==void 0&&(l.scope=JSON.stringify(i)),a!==void 0&&(l.authorization_details_types=JSON.stringify(a)),o!==void 0&&(l.allow_any_organization=+!!o),s!==void 0&&(l.is_system=+!!s),(await e.update(Gt).set(l).where(h(m(Gt.tenant_id,t),m(Gt.id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=s?Tn(Gt,s,[`client_id`,`audience`]):void 0,l=c?h(m(Gt.tenant_id,t),c):m(Gt.tenant_id,t),u=e.select().from(Gt).where(l).$dynamic();if(o?.sort_by){let e=Gt[o.sort_by];e&&(u=u.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}else u=u.orderBy(ze(Gt.created_at));let d=(await u.offset(r*i).limit(i)).map(Hn);if(!a)return{client_grants:d};let[f]=await e.select({count:Ve()}).from(Gt).where(l);return{client_grants:d,start:r*i,limit:i,length:Number(f?.count??0)}},async remove(t,n){return(await e.delete(Gt).where(h(m(Gt.tenant_id,t),m(Gt.id,n))).returning()).length>0}}}function Wn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}var Gn={ZodAny:`any`,ZodArray:`array`,ZodBigInt:`bigint`,ZodBoolean:`boolean`,ZodDefault:`default`,ZodPrefault:`prefault`,ZodTransform:`transform`,ZodEnum:`enum`,ZodIntersection:`intersection`,ZodLazy:`lazy`,ZodLiteral:`literal`,ZodNever:`never`,ZodNull:`null`,ZodNullable:`nullable`,ZodNumber:`number`,ZodNonOptional:`nonoptional`,ZodObject:`object`,ZodOptional:`optional`,ZodPipe:`pipe`,ZodReadonly:`readonly`,ZodRecord:`record`,ZodString:`string`,ZodTuple:`tuple`,ZodType:`type`,ZodUnion:`union`,ZodDiscriminatedUnion:`union`,ZodUnknown:`unknown`,ZodVoid:`void`,ZodDate:`date`,ZodTemplateLiteral:`template_literal`};function Kn(e,t){return(Array.isArray(t)?t:[t]).some(t=>{let n=e?.def?.type===Gn[t];return t===`ZodDiscriminatedUnion`?n&&`discriminator`in e.def:n})}function qn(e){return e&&`def`in e}var Jn=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Yn(){return new Jn}function Xn(e){return e===void 0}function Zn(e,t){let n={};return Object.entries(e).forEach(([e,r])=>{t.some(t=>t===e)||(n[e]=r)}),n}function Qn(e,t){let n={};return Object.entries(e).forEach(([e,r])=>{t(r,e)||(n[e]=r)}),n}var $n=Yn(),er=class{static collectMetadata(e,t){let n=this.getMetadataFromRegistry(e),r=Object.assign(Object.assign({},n?._internal),t?._internal),i=Object.assign(Object.assign({},n?.param),t?.param),a=Object.assign(Object.assign(Object.assign(Object.assign({},Object.keys(r).length>0?{_internal:r}:{}),n),t),Object.keys(i).length>0?{param:i}:{});if(Kn(e,[`ZodOptional`,`ZodNullable`,`ZodDefault`,`ZodPrefault`,`ZodReadonly`,`ZodNonOptional`])&&qn(e._zod.def.innerType))return this.collectMetadata(e._zod.def.innerType,a);if(Kn(e,`ZodPipe`)){let t=e._zod.def.in,n=e._zod.def.out;if(Kn(t,`ZodTransform`)&&qn(n))return this.collectMetadata(n,a);if(qn(t))return this.collectMetadata(t,a)}return a}static getMetadata(e){return this.collectMetadata(e)}static getOpenApiMetadata(e){let t=this.collectMetadata(e)??{},{_internal:n}=t;return Wn(t,[`_internal`])}static getInternalMetadata(e){return this.collectMetadata(e)?._internal}static getParamMetadata(e){let t=this.collectMetadata(e);return Object.assign(Object.assign({},t),{param:Object.assign(Object.assign({},t?.description?{description:t.description}:{}),t?.param)})}static buildSchemaMetadata(e){return Qn(Zn(e,[`param`,`_internal`]),Xn)}static buildParameterMetadata(e){return Qn(e,Xn)}static applySchemaMetadata(e,t){return Qn(Object.assign(Object.assign({},e),this.buildSchemaMetadata(t)),Xn)}static getRefId(e){return this.getInternalMetadata(e)?.refId}static unwrapChained(e){return this.unwrapUntil(e)}static getDefaultValue(e){return(this.unwrapUntil(e,`ZodDefault`)??this.unwrapUntil(e,`ZodPrefault`))?._zod.def.defaultValue}static unwrapUntil(e,t){if(t&&Kn(e,t))return e;if(Kn(e,[`ZodOptional`,`ZodNullable`,`ZodDefault`,`ZodPrefault`,`ZodReadonly`,`ZodNonOptional`])&&qn(e._zod.def.innerType))return this.unwrapUntil(e._zod.def.innerType,t);if(Kn(e,`ZodPipe`)){let n=e._zod.def.in,r=e._zod.def.out;if(Kn(n,`ZodTransform`)&&qn(r))return this.unwrapUntil(r,t);if(qn(n))return this.unwrapUntil(n,t)}return t?void 0:e}static getMetadataFromInternalRegistry(e){return $n.get(e)}static getMetadataFromRegistry(e){let t=this.getMetadataFromInternalRegistry(e),n=e.meta();if(!t)return n;let{_internal:r}=t,i=Wn(t,[`_internal`]),a=n??{},{id:o,title:s}=a,c=Wn(a,[`id`,`title`]);return Object.assign(Object.assign(Object.assign({_internal:Object.assign(Object.assign({},o?{refId:o}:{}),r)},i),s?{description:s}:{}),c)}static setMetadataInRegistry(e,t){$n.add(e,t)}};function tr(e,t){let n=e[t];typeof n==`function`&&(e[t]=function(...e){let t=n.apply(this,e),r=er.getMetadataFromRegistry(this);return r&&er.setMetadataInRegistry(t,r),t})}function nr(e){e.ZodType.prototype.openapi===void 0&&(e.ZodType.prototype.openapi=function(...e){let{refId:t,metadata:n,options:r}=rr(...e),i=n??{},{param:a}=i,o=Wn(i,[`param`]),s=er.getMetadataFromRegistry(this)??{},{_internal:c}=s,l=Wn(s,[`_internal`]),u=Object.assign(Object.assign(Object.assign({},c),r),t?{refId:t}:void 0),d=Object.assign(Object.assign(Object.assign({},l),o),l?.param||a?{param:Object.assign(Object.assign({},l?.param),a)}:void 0),f=new this.constructor(this._def);function ee(e){er.setMetadataInRegistry(e,Object.assign(Object.assign({},Object.keys(u).length>0?{_internal:u}:void 0),d))}if(ee(f),Kn(f,`ZodLazy`)&&ee(this),Kn(f,`ZodObject`)){let e=er.getMetadataFromRegistry(f),t=f.extend;f.extend=function(...n){let r=t.apply(f,n),i=e??{},{_internal:a}=i,o=Wn(i,[`_internal`]);return er.setMetadataInRegistry(r,{_internal:{extendedFrom:a?.refId?{refId:a.refId,schema:f}:a?.extendedFrom}}),r.openapi(o)},tr(f,`catchall`)}tr(f,`optional`),tr(f,`nullable`),tr(f,`default`),tr(f,`transform`),tr(f,`refine`),tr(f,`length`),tr(f,`min`),tr(f,`max`);let te=f.meta;return f.meta=function(...e){let t=te.apply(this,e);if(e[0]){let n=er.getMetadataFromInternalRegistry(this);n&&er.setMetadataInRegistry(t,Object.assign(Object.assign({},n),e[0]))}return t},f})}function rr(e,t,n){return typeof e==`string`?{refId:e,metadata:t,options:n}:{refId:void 0,metadata:e,options:t}}var ir,ar=Object.freeze({status:`aborted`});function M(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var or=Symbol(`zod_brand`),sr=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},cr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ir=globalThis).__zod_globalConfig??(ir.__zod_globalConfig={});var lr=globalThis.__zod_globalConfig;function ur(e){return e&&Object.assign(lr,e),lr}var dr=a({BIGINT_FORMAT_RANGES:()=>qr,Class:()=>gi,NUMBER_FORMAT_RANGES:()=>Kr,aborted:()=>ti,allowsEval:()=>Fr,assert:()=>gr,assertEqual:()=>fr,assertIs:()=>mr,assertNever:()=>hr,assertNotEqual:()=>pr,assignProp:()=>Tr,base64ToUint8Array:()=>ui,base64urlToUint8Array:()=>fi,cached:()=>yr,captureStackTrace:()=>Nr,cleanEnum:()=>li,cleanRegex:()=>xr,clone:()=>Ur,cloneDef:()=>Dr,createTransparentProxy:()=>Wr,defineLazy:()=>P,esc:()=>jr,escapeRegex:()=>Hr,explicitlyAborted:()=>ni,extend:()=>Xr,finalizeIssue:()=>ai,floatSafeRemainder:()=>Sr,getElementAtPath:()=>Or,getEnumValues:()=>_r,getLengthableOrigin:()=>si,getParsedType:()=>zr,getSizableOrigin:()=>oi,hexToUint8Array:()=>mi,isObject:()=>Pr,isPlainObject:()=>Ir,issue:()=>ci,joinValues:()=>N,jsonStringifyReplacer:()=>vr,merge:()=>Qr,mergeDefs:()=>Er,normalizeParams:()=>F,nullish:()=>br,numKeys:()=>Rr,objectClone:()=>wr,omit:()=>Yr,optionalKeys:()=>Gr,parsedType:()=>L,partial:()=>$r,pick:()=>Jr,prefixIssues:()=>ri,primitiveTypes:()=>Vr,promiseAllObject:()=>kr,propertyKeyTypes:()=>Br,randomString:()=>Ar,required:()=>ei,safeExtend:()=>Zr,shallowClone:()=>Lr,slugify:()=>Mr,stringifyPrimitive:()=>I,uint8ArrayToBase64:()=>di,uint8ArrayToBase64url:()=>pi,uint8ArrayToHex:()=>hi,unwrapMessage:()=>ii});function fr(e){return e}function pr(e){return e}function mr(e){}function hr(e){throw Error(`Unexpected value in exhaustive check`)}function gr(e){}function _r(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function N(e,t=`|`){return e.map(e=>I(e)).join(t)}function vr(e,t){return typeof t==`bigint`?t.toString():t}function yr(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function br(e){return e==null}function xr(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Sr(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Cr=Symbol(`evaluating`);function P(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Cr)return r===void 0&&(r=Cr,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function wr(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Tr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Er(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Dr(e){return Er(e._zod.def)}function Or(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function kr(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function Ar(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function jr(e){return JSON.stringify(e)}function Mr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Nr=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Pr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Fr=yr(()=>{if(lr.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ir(e){if(Pr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Pr(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Lr(e){return Ir(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Rr(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var zr=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},Br=new Set([`string`,`number`,`symbol`]),Vr=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function Hr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ur(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function F(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Wr(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function I(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Gr(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Kr={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},qr={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Jr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Ur(e,Er(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Tr(this,`shape`,e),e},checks:[]}))}function Yr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Ur(e,Er(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Tr(this,`shape`,r),r},checks:[]}))}function Xr(e,t){if(!Ir(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ur(e,Er(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Tr(this,`shape`,n),n}}))}function Zr(e,t){if(!Ir(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ur(e,Er(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Tr(this,`shape`,n),n}}))}function Qr(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Ur(e,Er(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Tr(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $r(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Ur(t,Er(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Tr(this,`shape`,i),i},checks:[]}))}function ei(e,t,n){return Ur(t,Er(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Tr(this,`shape`,i),i}}))}function ti(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ni(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ri(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ii(e){return typeof e==`string`?e:e?.message}function ai(e,t,n){let r=e.message?e.message:ii(e.inst?._zod.def?.error?.(e))??ii(t?.error?.(e))??ii(n.customError?.(e))??ii(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function oi(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function si(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function L(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function ci(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function li(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ui(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function di(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function fi(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return ui(t+`=`.repeat((4-t.length%4)%4))}function pi(e){return di(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function mi(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function hi(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var gi=class{constructor(...e){}},_i=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},vi=M(`$ZodError`,_i),yi=M(`$ZodError`,_i,{Parent:Error});function bi(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function xi(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}function Si(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a,o;for(let s of e.issues)if(s.code===`invalid_union`&&s.errors.length)s.errors.map(e=>r({issues:e},[...i,...s.path]));else if(s.code===`invalid_key`)r({issues:s.issues},[...i,...s.path]);else if(s.code===`invalid_element`)r({issues:s.issues},[...i,...s.path]);else{let e=[...i,...s.path];if(e.length===0){n.errors.push(t(s));continue}let r=n,c=0;for(;c<e.length;){let n=e[c],i=c===e.length-1;typeof n==`string`?(r.properties??={},(a=r.properties)[n]??(a[n]={errors:[]}),r=r.properties[n]):(r.items??=[],(o=r.items)[n]??(o[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(s)),c++}}};return r(e),n}function Ci(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function wi(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${Ci(e.path)}`);return t.join(`
|
|
14
|
+
`)}var Ti=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new sr;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>ai(e,a,ur())));throw Nr(t,i?.callee),t}return o.value},Ei=Ti(yi),Di=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>ai(e,a,ur())));throw Nr(t,i?.callee),t}return o.value},Oi=Di(yi),ki=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new sr;return a.issues.length?{success:!1,error:new(e??vi)(a.issues.map(e=>ai(e,i,ur())))}:{success:!0,data:a.value}},Ai=ki(yi),ji=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>ai(e,i,ur())))}:{success:!0,data:a.value}},Mi=ji(yi),Ni=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ti(e)(t,n,i)},Pi=Ni(yi),Fi=e=>(t,n,r)=>Ti(e)(t,n,r),Ii=Fi(yi),Li=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Di(e)(t,n,i)},Ri=Li(yi),zi=e=>async(t,n,r)=>Di(e)(t,n,r),Bi=zi(yi),Vi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ki(e)(t,n,i)},Hi=Vi(yi),Ui=e=>(t,n,r)=>ki(e)(t,n,r),Wi=Ui(yi),Gi=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ji(e)(t,n,i)},Ki=Gi(yi),qi=e=>async(t,n,r)=>ji(e)(t,n,r),Ji=qi(yi),Yi=a({base64:()=>Sa,base64url:()=>Ca,bigint:()=>Pa,boolean:()=>La,browserEmail:()=>ma,cidrv4:()=>ba,cidrv6:()=>xa,cuid:()=>Xi,cuid2:()=>Zi,date:()=>ka,datetime:()=>Ma,domain:()=>Ta,duration:()=>na,e164:()=>Da,email:()=>la,emoji:()=>ga,extendedDuration:()=>ra,guid:()=>ia,hex:()=>Ha,hostname:()=>wa,html5Email:()=>ua,httpProtocol:()=>Ea,idnEmail:()=>pa,integer:()=>Fa,ipv4:()=>_a,ipv6:()=>va,ksuid:()=>ea,lowercase:()=>Ba,mac:()=>ya,md5_base64:()=>Ka,md5_base64url:()=>qa,md5_hex:()=>Ga,nanoid:()=>ta,null:()=>Ra,number:()=>Ia,rfc5322Email:()=>da,sha1_base64:()=>Ya,sha1_base64url:()=>Xa,sha1_hex:()=>Ja,sha256_base64:()=>Qa,sha256_base64url:()=>$a,sha256_hex:()=>Za,sha384_base64:()=>to,sha384_base64url:()=>no,sha384_hex:()=>eo,sha512_base64:()=>io,sha512_base64url:()=>ao,sha512_hex:()=>ro,string:()=>Na,time:()=>ja,ulid:()=>Qi,undefined:()=>za,unicodeEmail:()=>fa,uppercase:()=>Va,uuid:()=>aa,uuid4:()=>oa,uuid6:()=>sa,uuid7:()=>ca,xid:()=>$i}),Xi=/^[cC][0-9a-z]{6,}$/,Zi=/^[0-9a-z]+$/,Qi=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$i=/^[0-9a-vA-V]{20}$/,ea=/^[A-Za-z0-9]{27}$/,ta=/^[a-zA-Z0-9_-]{21}$/,na=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ra=/^[-+]?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)?)??$/,ia=/^([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})$/,aa=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,oa=aa(4),sa=aa(6),ca=aa(7),la=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ua=/^[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])?)*$/,da=/^(([^<>()\[\]\\.,;:\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,}))$/,fa=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,pa=fa,ma=/^[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])?)*$/,ha=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ga(){return new RegExp(ha,`u`)}var _a=/^(?:(?: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])$/,va=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ya=e=>{let t=Hr(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},ba=/^((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])$/,xa=/^(([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])$/,Sa=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ca=/^[A-Za-z0-9_-]*$/,wa=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Ta=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ea=/^https?$/,Da=/^\+[1-9]\d{6,14}$/,Oa=`(?:(?:\\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])))`,ka=RegExp(`^${Oa}$`);function Aa(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ja(e){return RegExp(`^${Aa(e)}$`)}function Ma(e){let t=Aa({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Oa}T(?:${r})$`)}var Na=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Pa=/^-?\d+n?$/,Fa=/^-?\d+$/,Ia=/^-?\d+(?:\.\d+)?$/,La=/^(?:true|false)$/i,Ra=/^null$/i,za=/^undefined$/i,Ba=/^[^A-Z]*$/,Va=/^[^a-z]*$/,Ha=/^[0-9a-fA-F]*$/;function Ua(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Wa(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ga=/^[0-9a-fA-F]{32}$/,Ka=Ua(22,`==`),qa=Wa(22),Ja=/^[0-9a-fA-F]{40}$/,Ya=Ua(27,`=`),Xa=Wa(27),Za=/^[0-9a-fA-F]{64}$/,Qa=Ua(43,`=`),$a=Wa(43),eo=/^[0-9a-fA-F]{96}$/,to=Ua(64,``),no=Wa(64),ro=/^[0-9a-fA-F]{128}$/,io=Ua(86,`==`),ao=Wa(86),oo=M(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),so={number:`number`,bigint:`bigint`,object:`date`},co=M(`$ZodCheckLessThan`,(e,t)=>{oo.init(e,t);let n=so[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lo=M(`$ZodCheckGreaterThan`,(e,t)=>{oo.init(e,t);let n=so[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),uo=M(`$ZodCheckMultipleOf`,(e,t)=>{oo.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Sr(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),fo=M(`$ZodCheckNumberFormat`,(e,t)=>{oo.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Kr[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Fa)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),po=M(`$ZodCheckBigIntFormat`,(e,t)=>{oo.init(e,t);let[n,r]=qr[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),mo=M(`$ZodCheckMaxSize`,(e,t)=>{var n;oo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!br(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:oi(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ho=M(`$ZodCheckMinSize`,(e,t)=>{var n;oo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!br(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:oi(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),go=M(`$ZodCheckSizeEquals`,(e,t)=>{var n;oo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!br(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:oi(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),_o=M(`$ZodCheckMaxLength`,(e,t)=>{var n;oo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!br(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=si(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),vo=M(`$ZodCheckMinLength`,(e,t)=>{var n;oo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!br(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=si(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yo=M(`$ZodCheckLengthEquals`,(e,t)=>{var n;oo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!br(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=si(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bo=M(`$ZodCheckStringFormat`,(e,t)=>{var n,r;oo.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),xo=M(`$ZodCheckRegex`,(e,t)=>{bo.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),So=M(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ba,bo.init(e,t)}),Co=M(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Va,bo.init(e,t)}),wo=M(`$ZodCheckIncludes`,(e,t)=>{oo.init(e,t);let n=Hr(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),To=M(`$ZodCheckStartsWith`,(e,t)=>{oo.init(e,t);let n=RegExp(`^${Hr(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Eo=M(`$ZodCheckEndsWith`,(e,t)=>{oo.init(e,t);let n=RegExp(`.*${Hr(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Do(e,t,n){e.issues.length&&t.issues.push(...ri(n,e.issues))}var Oo=M(`$ZodCheckProperty`,(e,t)=>{oo.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>Do(n,e,t.property));Do(n,e,t.property)}}),ko=M(`$ZodCheckMimeType`,(e,t)=>{oo.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Ao=M(`$ZodCheckOverwrite`,(e,t)=>{oo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),jo=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
15
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
16
|
+
`))}},Mo={major:4,minor:4,patch:3},R=M(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mo;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ti(e),i;for(let a of t){if(a._zod.def.when){if(ni(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new sr;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ti(e,t))});else{if(e.issues.length===t)continue;r||=ti(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ti(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new sr;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new sr;return o.then(e=>t(e,r,a))}return t(o,r,a)}}P(e,`~standard`,()=>({validate:t=>{try{let n=Ai(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Mi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),No=M(`$ZodString`,(e,t)=>{R.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Na(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),z=M(`$ZodStringFormat`,(e,t)=>{bo.init(e,t),No.init(e,t)}),Po=M(`$ZodGUID`,(e,t)=>{t.pattern??=ia,z.init(e,t)}),Fo=M(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=aa(e)}else t.pattern??=aa();z.init(e,t)}),Io=M(`$ZodEmail`,(e,t)=>{t.pattern??=la,z.init(e,t)}),Lo=M(`$ZodURL`,(e,t)=>{z.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Ea.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ro=M(`$ZodEmoji`,(e,t)=>{t.pattern??=ga(),z.init(e,t)}),zo=M(`$ZodNanoID`,(e,t)=>{t.pattern??=ta,z.init(e,t)}),Bo=M(`$ZodCUID`,(e,t)=>{t.pattern??=Xi,z.init(e,t)}),Vo=M(`$ZodCUID2`,(e,t)=>{t.pattern??=Zi,z.init(e,t)}),Ho=M(`$ZodULID`,(e,t)=>{t.pattern??=Qi,z.init(e,t)}),Uo=M(`$ZodXID`,(e,t)=>{t.pattern??=$i,z.init(e,t)}),Wo=M(`$ZodKSUID`,(e,t)=>{t.pattern??=ea,z.init(e,t)}),Go=M(`$ZodISODateTime`,(e,t)=>{t.pattern??=Ma(t),z.init(e,t)}),Ko=M(`$ZodISODate`,(e,t)=>{t.pattern??=ka,z.init(e,t)}),qo=M(`$ZodISOTime`,(e,t)=>{t.pattern??=ja(t),z.init(e,t)}),Jo=M(`$ZodISODuration`,(e,t)=>{t.pattern??=na,z.init(e,t)}),Yo=M(`$ZodIPv4`,(e,t)=>{t.pattern??=_a,z.init(e,t),e._zod.bag.format=`ipv4`}),Xo=M(`$ZodIPv6`,(e,t)=>{t.pattern??=va,z.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Zo=M(`$ZodMAC`,(e,t)=>{t.pattern??=ya(t.delimiter),z.init(e,t),e._zod.bag.format=`mac`}),Qo=M(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ba,z.init(e,t)}),$o=M(`$ZodCIDRv6`,(e,t)=>{t.pattern??=xa,z.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function es(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ts=M(`$ZodBase64`,(e,t)=>{t.pattern??=Sa,z.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{es(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ns(e){if(!Ca.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return es(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var rs=M(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ca,z.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ns(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),is=M(`$ZodE164`,(e,t)=>{t.pattern??=Da,z.init(e,t)});function as(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var os=M(`$ZodJWT`,(e,t)=>{z.init(e,t),e._zod.check=n=>{as(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ss=M(`$ZodCustomStringFormat`,(e,t)=>{z.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),cs=M(`$ZodNumber`,(e,t)=>{R.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ia,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ls=M(`$ZodNumberFormat`,(e,t)=>{fo.init(e,t),cs.init(e,t)}),us=M(`$ZodBoolean`,(e,t)=>{R.init(e,t),e._zod.pattern=La,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ds=M(`$ZodBigInt`,(e,t)=>{R.init(e,t),e._zod.pattern=Pa,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),fs=M(`$ZodBigIntFormat`,(e,t)=>{po.init(e,t),ds.init(e,t)}),ps=M(`$ZodSymbol`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),ms=M(`$ZodUndefined`,(e,t)=>{R.init(e,t),e._zod.pattern=za,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),hs=M(`$ZodNull`,(e,t)=>{R.init(e,t),e._zod.pattern=Ra,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),gs=M(`$ZodAny`,(e,t)=>{R.init(e,t),e._zod.parse=e=>e}),_s=M(`$ZodUnknown`,(e,t)=>{R.init(e,t),e._zod.parse=e=>e}),vs=M(`$ZodNever`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),ys=M(`$ZodVoid`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),bs=M(`$ZodDate`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function xs(e,t,n){e.issues.length&&t.issues.push(...ri(n,e.issues)),t.value[n]=e.value}var Ss=M(`$ZodArray`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>xs(t,n,e))):xs(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Cs(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...ri(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function ws(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Gr(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ts(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Cs(e,n,i,t,u,d))):Cs(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Es=M(`$ZodObject`,(e,t)=>{if(R.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=yr(()=>ws(t));P(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Pr,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Cs(n,t,e,s,r,i))):Cs(a,t,e,s,r,i)}return i?Ts(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ds=M(`$ZodObjectJIT`,(e,t)=>{Es.init(e,t);let n=e._zod.parse,r=yr(()=>ws(t)),i=e=>{let t=new jo([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=jr(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=jr(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
17
|
+
if (${n}.issues.length) {
|
|
18
|
+
if (${o} in input) {
|
|
19
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
19
20
|
...iss,
|
|
20
|
-
path: iss.path ? [${
|
|
21
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
21
22
|
})));
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
if (${
|
|
26
|
-
if (${
|
|
27
|
-
newResult[${
|
|
26
|
+
if (${n}.value === undefined) {
|
|
27
|
+
if (${o} in input) {
|
|
28
|
+
newResult[${o}] = undefined;
|
|
28
29
|
}
|
|
29
30
|
} else {
|
|
30
|
-
newResult[${
|
|
31
|
+
newResult[${o}] = ${n}.value;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
`)
|
|
34
|
-
if (${
|
|
35
|
-
payload.issues = payload.issues.concat(${
|
|
34
|
+
`):c?t.write(`
|
|
35
|
+
if (${n}.issues.length) {
|
|
36
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
36
37
|
...iss,
|
|
37
|
-
path: iss.path ? [${
|
|
38
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
38
39
|
})));
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
if (${
|
|
42
|
-
if (${
|
|
43
|
-
newResult[${
|
|
42
|
+
if (${n}.value === undefined) {
|
|
43
|
+
if (${o} in input) {
|
|
44
|
+
newResult[${o}] = undefined;
|
|
44
45
|
}
|
|
45
46
|
} else {
|
|
46
|
-
newResult[${
|
|
47
|
+
newResult[${o}] = ${n}.value;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
`):
|
|
50
|
-
const ${
|
|
51
|
-
if (${
|
|
52
|
-
payload.issues = payload.issues.concat(${
|
|
50
|
+
`):t.write(`
|
|
51
|
+
const ${n}_present = ${o} in input;
|
|
52
|
+
if (${n}.issues.length) {
|
|
53
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
53
54
|
...iss,
|
|
54
|
-
path: iss.path ? [${
|
|
55
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
55
56
|
})));
|
|
56
57
|
}
|
|
57
|
-
if (!${
|
|
58
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
58
59
|
payload.issues.push({
|
|
59
60
|
code: "invalid_type",
|
|
60
61
|
expected: "nonoptional",
|
|
61
62
|
input: undefined,
|
|
62
|
-
path: [${
|
|
63
|
+
path: [${o}]
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
if (${
|
|
67
|
-
if (${
|
|
68
|
-
newResult[${
|
|
67
|
+
if (${n}_present) {
|
|
68
|
+
if (${n}.value === undefined) {
|
|
69
|
+
newResult[${o}] = undefined;
|
|
69
70
|
} else {
|
|
70
|
-
newResult[${
|
|
71
|
+
newResult[${o}] = ${n}.value;
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
`)}y.write("payload.value = newResult;"),y.write("return payload;");const G=y.compile();return(we,j)=>G(m,we,j)};let a;const s=Mt,c=!dn.jitless,p=c&&eu.value,d=t.catchall;let h;e._zod.parse=(m,y)=>{h??(h=i.value);const S=m.value;return s(S)?c&&p&&(y==null?void 0:y.async)===!1&&y.jitless!==!0?(a||(a=o(t.shape)),m=a(m,y),d?rs([],S,m,y,h,e):m):n(m,y):(m.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),m)}});function Gi(e,t,n,i){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;const o=e.filter(a=>!Nt(a));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(a=>a.issues.map(s=>nt(s,i,Xe())))}),t)}const as=v("$ZodUnion",(e,t)=>{ie.init(e,t),H(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),H(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),H(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),H(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>mi(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,o)=>{if(n)return n(i,o);let a=!1;const s=[];for(const c of t.options){const u=c._zod.run({value:i.value,issues:[]},o);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Gi(c,i,e,o)):Gi(s,i,e,o)}}),Bd=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,as.init(e,t);const n=e._zod.parse;H(e._zod,"propValues",()=>{const o={};for(const a of t.options){const s=a._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const[c,u]of Object.entries(s)){o[c]||(o[c]=new Set);for(const p of u)o[c].add(p)}}return o});const i=hn(()=>{var s;const o=t.options,a=new Map;for(const c of o){const u=(s=c._zod.propValues)==null?void 0:s[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(c)}"`);for(const p of u){if(a.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);a.set(p,c)}}return a});e._zod.parse=(o,a)=>{const s=o.value;if(!Mt(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const c=i.value.get(s==null?void 0:s[t.discriminator]);return c?c._zod.run(o,a):t.unionFallback||a.direction==="backward"?n(o,a):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(i.value.keys()),input:s,path:[t.discriminator],inst:e}),o)}}),Jd=v("$ZodIntersection",(e,t)=>{ie.init(e,t),e._zod.parse=(n,i)=>{const o=n.value,a=t.left._zod.run({value:o,issues:[]},i),s=t.right._zod.run({value:o,issues:[]},i);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([u,p])=>Vi(n,u,p)):Vi(n,a,s)}});function Gn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ct(e)&&Ct(t)){const n=Object.keys(t),i=Object.keys(e).filter(a=>n.indexOf(a)!==-1),o={...e,...t};for(const a of i){const s=Gn(e[a],t[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};o[a]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const o=e[i],a=t[i],s=Gn(o,a);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Vi(e,t,n){const i=new Map;let o;for(const c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(const u of c.keys)i.has(u)||i.set(u,{}),i.get(u).l=!0}else e.issues.push(c);for(const c of n.issues)if(c.code==="unrecognized_keys")for(const u of c.keys)i.has(u)||i.set(u,{}),i.get(u).r=!0;else e.issues.push(c);const a=[...i].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(a.length&&o&&e.issues.push({...o,keys:a}),Nt(e))return e;const s=Gn(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const Kd=v("$ZodRecord",(e,t)=>{ie.init(e,t),e._zod.parse=(n,i)=>{const o=n.value;if(!Ct(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const a=[],s=t.keyType._zod.values;if(s){n.value={};const c=new Set;for(const p of s)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){c.add(typeof p=="number"?p.toString():p);const d=t.keyType._zod.run({value:p,issues:[]},i);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(y=>nt(y,i,Xe())),input:p,path:[p],inst:e});continue}const h=d.value,m=t.valueType._zod.run({value:o[p],issues:[]},i);m instanceof Promise?a.push(m.then(y=>{y.issues.length&&n.issues.push(...Et(p,y.issues)),n.value[h]=y.value})):(m.issues.length&&n.issues.push(...Et(p,m.issues)),n.value[h]=m.value)}let u;for(const p in o)c.has(p)||(u=u??[],u.push(p));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const c of Reflect.ownKeys(o)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,c))continue;let u=t.keyType._zod.run({value:c,issues:[]},i);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&Xa.test(c)&&u.issues.length){const h=t.keyType._zod.run({value:Number(c),issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(u=h)}if(u.issues.length){t.mode==="loose"?n.value[c]=o[c]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(h=>nt(h,i,Xe())),input:c,path:[c],inst:e});continue}const d=t.valueType._zod.run({value:o[c],issues:[]},i);d instanceof Promise?a.push(d.then(h=>{h.issues.length&&n.issues.push(...Et(c,h.issues)),n.value[u.value]=h.value})):(d.issues.length&&n.issues.push(...Et(c,d.issues)),n.value[u.value]=d.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Gd=v("$ZodEnum",(e,t)=>{ie.init(e,t);const n=Za(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(o=>tu.has(typeof o)).map(o=>typeof o=="string"?zt(o):o.toString()).join("|")})$`),e._zod.parse=(o,a)=>{const s=o.value;return i.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),Vd=v("$ZodLiteral",(e,t)=>{if(ie.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(i=>typeof i=="string"?zt(i):i?zt(i.toString()):String(i)).join("|")})$`),e._zod.parse=(i,o)=>{const a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),i}}),Hd=v("$ZodTransform",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Fa(e.constructor.name);const o=t.transform(n.value,n);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n.fallback=!0,n));if(o instanceof Promise)throw new At;return n.value=o,n.fallback=!0,n}});function Hi(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const ss=v("$ZodOptional",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.optout="optional",H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),H(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${mi(n.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,a=t.innerType._zod.run(n,i);return a instanceof Promise?a.then(s=>Hi(s,o)):Hi(a,o)}return n.value===void 0?n:t.innerType._zod.run(n,i)}}),Wd=v("$ZodExactOptional",(e,t)=>{ss.init(e,t),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),Qd=v("$ZodNullable",(e,t)=>{ie.init(e,t),H(e._zod,"optin",()=>t.innerType._zod.optin),H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${mi(n.source)}|null)$`):void 0}),H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)}),Xd=v("$ZodDefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(a=>Wi(a,t)):Wi(o,t)}});function Wi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Yd=v("$ZodPrefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))}),e_=v("$ZodNonOptional",(e,t)=>{ie.init(e,t),H(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),e._zod.parse=(n,i)=>{const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(a=>Qi(a,e)):Qi(o,e)}});function Qi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const t_=v("$ZodCatch",(e,t)=>{ie.init(e,t),e._zod.optin="optional",H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(a=>(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(s=>nt(s,i,Xe()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(a=>nt(a,i,Xe()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),ls=v("$ZodPipe",(e,t)=>{ie.init(e,t),H(e._zod,"values",()=>t.in._zod.values),H(e._zod,"optin",()=>t.in._zod.optin),H(e._zod,"optout",()=>t.out._zod.optout),H(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){const a=t.out._zod.run(n,i);return a instanceof Promise?a.then(s=>Xt(s,t.in,i)):Xt(a,t.in,i)}const o=t.in._zod.run(n,i);return o instanceof Promise?o.then(a=>Xt(a,t.out,i)):Xt(o,t.out,i)}});function Xt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const n_=v("$ZodPreprocess",(e,t)=>{ls.init(e,t)}),i_=v("$ZodReadonly",(e,t)=>{ie.init(e,t),H(e._zod,"propValues",()=>t.innerType._zod.propValues),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"optin",()=>{var n,i;return(i=(n=t.innerType)==null?void 0:n._zod)==null?void 0:i.optin}),H(e._zod,"optout",()=>{var n,i;return(i=(n=t.innerType)==null?void 0:n._zod)==null?void 0:i.optout}),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(Xi):Xi(o)}});function Xi(e){return e.value=Object.freeze(e.value),e}const o_=v("$ZodCustom",(e,t)=>{Pe.init(e,t),ie.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{const i=n.value,o=t.fn(i);if(o instanceof Promise)return o.then(a=>Yi(a,n,i,e));Yi(o,n,i,e)}});function Yi(e,t,n,i){if(!e){const o={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(o.params=i._zod.def.params),t.issues.push(jt(o))}}const r_=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}const n={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",mac:"MAC 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"},i={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{const a=i[o.expected]??o.expected,s=_u(o.input),c=i[s]??s;return`Invalid input: expected ${a}, received ${c}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${qa(o.values[0])}`:`Invalid option: expected one of ${ji(o.values,"|")}`;case"too_big":{const a=o.inclusive?"<=":"<",s=t(o.origin);return s?`Too big: expected ${o.origin??"value"} to have ${a}${o.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${a}${o.maximum.toString()}`}case"too_small":{const a=o.inclusive?">=":">",s=t(o.origin);return s?`Too small: expected ${o.origin} to have ${a}${o.minimum.toString()} ${s.unit}`:`Too small: expected ${o.origin} to be ${a}${o.minimum.toString()}`}case"invalid_format":{const a=o;return a.format==="starts_with"?`Invalid string: must start with "${a.prefix}"`:a.format==="ends_with"?`Invalid string: must end with "${a.suffix}"`:a.format==="includes"?`Invalid string: must include "${a.includes}"`:a.format==="regex"?`Invalid string: must match pattern ${a.pattern}`:`Invalid ${n[a.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${ji(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(s=>`'${s}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function a_(){return{localeError:r_()}}var eo;class s_{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const i=n[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const o={...i,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function cs(){return new s_}(eo=globalThis).__zod_globalRegistry??(eo.__zod_globalRegistry=cs());const Ot=globalThis.__zod_globalRegistry;function l_(e,t){return new e({type:"string",...T(t)})}function c_(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...T(t)})}function to(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...T(t)})}function u_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...T(t)})}function d_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(t)})}function __(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(t)})}function p_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(t)})}function f_(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...T(t)})}function g_(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...T(t)})}function h_(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(t)})}function m_(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...T(t)})}function y_(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(t)})}function w_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...T(t)})}function v_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...T(t)})}function b_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(t)})}function S_(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(t)})}function N_(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(t)})}function E_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(t)})}function O_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(t)})}function I_(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...T(t)})}function k_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...T(t)})}function A_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...T(t)})}function T_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...T(t)})}function C_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(t)})}function z_(e,t){return new e({type:"string",format:"date",check:"string_format",...T(t)})}function D_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...T(t)})}function x_(e,t){return new e({type:"string",format:"duration",check:"string_format",...T(t)})}function $_(e,t){return new e({type:"number",checks:[],...T(t)})}function R_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...T(t)})}function L_(e,t){return new e({type:"boolean",...T(t)})}function P_(e,t){return new e({type:"null",...T(t)})}function U_(e){return new e({type:"any"})}function F_(e){return new e({type:"unknown"})}function Z_(e,t){return new e({type:"never",...T(t)})}function Vn(e,t){return new es({check:"less_than",...T(t),value:e,inclusive:!1})}function an(e,t){return new es({check:"less_than",...T(t),value:e,inclusive:!0})}function Hn(e,t){return new ts({check:"greater_than",...T(t),value:e,inclusive:!1})}function sn(e,t){return new ts({check:"greater_than",...T(t),value:e,inclusive:!0})}function Wn(e,t){return new Wu({check:"multiple_of",...T(t),value:e})}function Si(e,t){return new Xu({check:"max_length",...T(t),maximum:e})}function qt(e,t){return new Yu({check:"min_length",...T(t),minimum:e})}function Ni(e,t){return new ed({check:"length_equals",...T(t),length:e})}function us(e,t){return new td({check:"string_format",format:"regex",...T(t),pattern:e})}function ds(e){return new nd({check:"string_format",format:"lowercase",...T(e)})}function _s(e){return new id({check:"string_format",format:"uppercase",...T(e)})}function ps(e,t){return new od({check:"string_format",format:"includes",...T(t),includes:e})}function fs(e,t){return new rd({check:"string_format",format:"starts_with",...T(t),prefix:e})}function gs(e,t){return new ad({check:"string_format",format:"ends_with",...T(t),suffix:e})}function yt(e){return new sd({check:"overwrite",tx:e})}function hs(e){return yt(t=>t.normalize(e))}function ms(){return yt(e=>e.trim())}function ys(){return yt(e=>e.toLowerCase())}function ws(){return yt(e=>e.toUpperCase())}function vs(){return yt(e=>Yc(e))}function M_(e,t,n){return new e({type:"array",element:t,...T(n)})}function j_(e,t,n){const i=T(n);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function q_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...T(n)})}function B_(e,t){const n=J_(i=>(i.addIssue=o=>{if(typeof o=="string")i.issues.push(jt(o,i.value,n._zod.def));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=i.value),a.inst??(a.inst=n),a.continue??(a.continue=!n._zod.def.abort),i.issues.push(jt(a))}},e(i.value,i)),t);return n}function J_(e,t){const n=new Pe({check:"custom",...T(t)});return n._zod.check=e,n}function bs(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Ot,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function he(e,t,n={path:[],schemaPath:[]}){var d,h;var i;const o=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const c=(h=(d=e._zod).toJSONSchema)==null?void 0:h.call(d);if(c)s.schema=c;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,m);else{const S=s.schema,C=t.processors[o.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);C(e,t,S,m)}const y=e._zod.parent;y&&(s.ref||(s.ref=y),he(y,t,m),t.seen.get(y).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&De(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Ss(e,t){var s,c,u,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const d of e.seen.entries()){const h=(s=e.metadataRegistry.get(d[0]))==null?void 0:s.id;if(h){const m=i.get(h);if(m&&m!==d[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(h,d[0])}}const o=d=>{var C;const h=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const L=(C=e.external.registry.get(d[0]))==null?void 0:C.id,x=e.external.uri??(X=>X);if(L)return{ref:x(L)};const G=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=G,{defId:G,ref:`${x("__shared")}#/${h}/${G}`}}if(d[1]===n)return{ref:"#"};const y=`#/${h}/`,S=d[1].schema.id??`__schema${e.counter++}`;return{defId:S,ref:y+S}},a=d=>{if(d[1].schema.$ref)return;const h=d[1],{ref:m,defId:y}=o(d);h.def={...h.schema},y&&(h.defId=y);const S=h.schema;for(const C in S)delete S[C];S.$ref=m};if(e.cycles==="throw")for(const d of e.seen.entries()){const h=d[1];if(h.cycle)throw new Error(`Cycle detected: #/${(c=h.cycle)==null?void 0:c.join("/")}/<root>
|
|
75
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Pr,s=!lr.jitless,c=s&&Fr.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let ee=d.value;return o(ee)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Ts([],ee,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:ee,inst:e}),d)}});function Os(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ti(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ai(e,r,ur())))}),t)}var ks=M(`$ZodUnion`,(e,t)=>{R.init(e,t),P(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),P(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),P(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),P(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>xr(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Os(t,r,e,i)):Os(o,r,e,i)}});function As(e,t,n,r){let i=e.filter(e=>e.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ai(e,r,ur())))}):t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:[],inclusive:!1}),t)}var js=M(`$ZodXor`,(e,t)=>{ks.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);t instanceof Promise?(o.push(t),a=!0):o.push(t)}return a?Promise.all(o).then(t=>As(t,r,e,i)):As(o,r,e,i)}}),Ms=M(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ks.init(e,t);let n=e._zod.parse;P(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=yr(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Pr(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Ns=M(`$ZodIntersection`,(e,t)=>{R.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Fs(e,t,n)):Fs(e,i,a)}});function Ps(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ir(e)&&Ir(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ps(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ps(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Fs(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ti(e))return e;let o=Ps(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Is=M(`$ZodTuple`,(e,t)=>{R.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Ls(n,`optin`),c=Ls(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Rs(t,r,e))):Rs(a,r,e)}}return o.length?Promise.all(o).then(()=>zs(l,r,n,a,c)):zs(l,r,n,a,c)}});function Ls(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Rs(e,t,n){e.issues.length&&t.issues.push(...ri(n,e.issues)),t.value[n]=e.value}function zs(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...ri(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Bs=M(`$ZodRecord`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Ir(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>ai(e,r,ur())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...ri(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...ri(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Ia.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>ai(e,r,ur())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...ri(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...ri(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Vs=M(`$ZodMap`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:`map`,code:`invalid_type`,input:i,inst:e}),n;let a=[];n.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},r),l=t.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{Hs(t,a,n,o,i,e,r)})):Hs(c,l,n,o,i,e,r)}return a.length?Promise.all(a).then(()=>n):n}});function Hs(e,t,n,r,i,a,o){e.issues.length&&(Br.has(typeof r)?n.issues.push(...ri(r,e.issues)):n.issues.push({code:`invalid_key`,origin:`map`,input:i,inst:a,issues:e.issues.map(e=>ai(e,o,ur()))})),t.issues.length&&(Br.has(typeof r)?n.issues.push(...ri(r,t.issues)):n.issues.push({origin:`map`,code:`invalid_element`,input:i,inst:a,key:r,issues:t.issues.map(e=>ai(e,o,ur()))})),n.value.set(e.value,t.value)}var Us=M(`$ZodSet`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:`set`,code:`invalid_type`}),n;let a=[];n.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?a.push(i.then(e=>Ws(e,n))):Ws(i,n)}return a.length?Promise.all(a).then(()=>n):n}});function Ws(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Gs=M(`$ZodEnum`,(e,t)=>{R.init(e,t);let n=_r(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Br.has(typeof e)).map(e=>typeof e==`string`?Hr(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ks=M(`$ZodLiteral`,(e,t)=>{if(R.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Hr(e):e?Hr(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),qs=M(`$ZodFile`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:`file`,code:`invalid_type`,input:r,inst:e}),t}}),Js=M(`$ZodTransform`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new cr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new sr;return n.value=i,n.fallback=!0,n}});function Ys(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Xs=M(`$ZodOptional`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,P(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${xr(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Ys(e,r)):Ys(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Zs=M(`$ZodExactOptional`,(e,t)=>{Xs.init(e,t),P(e._zod,`values`,()=>t.innerType._zod.values),P(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Qs=M(`$ZodNullable`,(e,t)=>{R.init(e,t),P(e._zod,`optin`,()=>t.innerType._zod.optin),P(e._zod,`optout`,()=>t.innerType._zod.optout),P(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${xr(e.source)}|null)$`):void 0}),P(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),$s=M(`$ZodDefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,P(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ec(e,t)):ec(r,t)}});function ec(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var tc=M(`$ZodPrefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,P(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),nc=M(`$ZodNonOptional`,(e,t)=>{R.init(e,t),P(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>rc(t,e)):rc(i,e)}});function rc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var ic=M(`$ZodSuccess`,(e,t)=>{R.init(e,t),e._zod.parse=(e,n)=>{if(n.direction===`backward`)throw new cr(`ZodSuccess`);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=t.issues.length===0,e)):(e.value=r.issues.length===0,e)}}),ac=M(`$ZodCatch`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,P(e._zod,`optout`,()=>t.innerType._zod.optout),P(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ai(e,n,ur()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ai(e,n,ur()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),oc=M(`$ZodNaN`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>((typeof t.value!=`number`||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:e,expected:`nan`,code:`invalid_type`}),t)}),sc=M(`$ZodPipe`,(e,t)=>{R.init(e,t),P(e._zod,`values`,()=>t.in._zod.values),P(e._zod,`optin`,()=>t.in._zod.optin),P(e._zod,`optout`,()=>t.out._zod.optout),P(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>cc(e,t.in,n)):cc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>cc(e,t.out,n)):cc(r,t.out,n)}});function cc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var lc=M(`$ZodCodec`,(e,t)=>{R.init(e,t),P(e._zod,`values`,()=>t.in._zod.values),P(e._zod,`optin`,()=>t.in._zod.optin),P(e._zod,`optout`,()=>t.out._zod.optout),P(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>uc(e,t,n)):uc(r,t,n)}else{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>uc(e,t,n)):uc(r,t,n)}}});function uc(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>dc(e,r,t.out,n)):dc(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>dc(e,r,t.in,n)):dc(e,r,t.in,n)}}function dc(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var fc=M(`$ZodPreprocess`,(e,t)=>{sc.init(e,t)}),pc=M(`$ZodReadonly`,(e,t)=>{R.init(e,t),P(e._zod,`propValues`,()=>t.innerType._zod.propValues),P(e._zod,`values`,()=>t.innerType._zod.values),P(e._zod,`optin`,()=>t.innerType?._zod?.optin),P(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(mc):mc(r)}});function mc(e){return e.value=Object.freeze(e.value),e}var hc=M(`$ZodTemplateLiteral`,(e,t)=>{R.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith(`^`),i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||Vr.has(typeof e))n.push(Hr(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),gc=M(`$ZodFunction`,(e,t)=>(R.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?Ei(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?Ei(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await Oi(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await Oi(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new Is({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),_c=M(`$ZodPromise`,(e,t)=>{R.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),vc=M(`$ZodLazy`,(e,t)=>{R.init(e,t),P(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),P(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),P(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),P(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),P(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),yc=M(`$ZodCustom`,(e,t)=>{oo.init(e,t),R.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>bc(t,n,r,e));bc(i,n,r,e)}});function bc(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ci(e))}}var xc=()=>{let e={string:{unit:`حرف`,verb:`أن يحوي`},file:{unit:`بايت`,verb:`أن يحوي`},array:{unit:`عنصر`,verb:`أن يحوي`},set:{unit:`عنصر`,verb:`أن يحوي`}};function t(t){return e[t]??null}let n={regex:`مدخل`,email:`بريد إلكتروني`,url:`رابط`,emoji:`إيموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاريخ ووقت بمعيار ISO`,date:`تاريخ بمعيار ISO`,time:`وقت بمعيار ISO`,duration:`مدة بمعيار ISO`,ipv4:`عنوان IPv4`,ipv6:`عنوان IPv6`,cidrv4:`مدى عناوين بصيغة IPv4`,cidrv6:`مدى عناوين بصيغة IPv6`,base64:`نَص بترميز base64-encoded`,base64url:`نَص بترميز base64url-encoded`,json_string:`نَص على هيئة JSON`,e164:`رقم هاتف بمعيار E.164`,jwt:`JWT`,template_literal:`مدخل`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${e.expected}، ولكن تم إدخال ${i}`:`مدخلات غير مقبولة: يفترض إدخال ${t}، ولكن تم إدخال ${i}`}case`invalid_value`:return e.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${I(e.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?` أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()} ${r.unit??`عنصر`}`:`أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()} ${r.unit}`:`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`نَص غير مقبول: يجب أن يبدأ بـ "${e.prefix}"`:t.format===`ends_with`?`نَص غير مقبول: يجب أن ينتهي بـ "${t.suffix}"`:t.format===`includes`?`نَص غير مقبول: يجب أن يتضمَّن "${t.includes}"`:t.format===`regex`?`نَص غير مقبول: يجب أن يطابق النمط ${t.pattern}`:`${n[t.format]??e.format} غير مقبول`}case`not_multiple_of`:return`رقم غير مقبول: يجب أن يكون من مضاعفات ${e.divisor}`;case`unrecognized_keys`:return`معرف${e.keys.length>1?`ات`:``} غريب${e.keys.length>1?`ة`:``}: ${N(e.keys,`، `)}`;case`invalid_key`:return`معرف غير مقبول في ${e.origin}`;case`invalid_union`:return`مدخل غير مقبول`;case`invalid_element`:return`مدخل غير مقبول في ${e.origin}`;default:return`مدخل غير مقبول`}}};function Sc(){return{localeError:xc()}}var Cc=()=>{let e={string:{unit:`simvol`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`element`,verb:`olmalıdır`},set:{unit:`element`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={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`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Yanlış dəyər: gözlənilən instanceof ${e.expected}, daxil olan ${i}`:`Yanlış dəyər: gözlənilən ${t}, daxil olan ${i}`}case`invalid_value`:return e.values.length===1?`Yanlış dəyər: gözlənilən ${I(e.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()} ${r.unit??`element`}`:`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Yanlış mətn: "${t.prefix}" ilə başlamalıdır`:t.format===`ends_with`?`Yanlış mətn: "${t.suffix}" ilə bitməlidir`:t.format===`includes`?`Yanlış mətn: "${t.includes}" daxil olmalıdır`:t.format===`regex`?`Yanlış mətn: ${t.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${n[t.format]??e.format}`}case`not_multiple_of`:return`Yanlış ədəd: ${e.divisor} ilə bölünə bilən olmalıdır`;case`unrecognized_keys`:return`Tanınmayan açar${e.keys.length>1?`lar`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} daxilində yanlış açar`;case`invalid_union`:return`Yanlış dəyər`;case`invalid_element`:return`${e.origin} daxilində yanlış dəyər`;default:return`Yanlış dəyər`}}};function wc(){return{localeError:Cc()}}function Tc(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}var Ec=()=>{let e={string:{unit:{one:`сімвал`,few:`сімвалы`,many:`сімвалаў`},verb:`мець`},array:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},set:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},file:{unit:{one:`байт`,few:`байты`,many:`байтаў`},verb:`мець`}};function t(t){return e[t]??null}let n={regex:`увод`,email:`email адрас`,url:`URL`,emoji:`эмодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата і час`,date:`ISO дата`,time:`ISO час`,duration:`ISO працягласць`,ipv4:`IPv4 адрас`,ipv6:`IPv6 адрас`,cidrv4:`IPv4 дыяпазон`,cidrv6:`IPv6 дыяпазон`,base64:`радок у фармаце base64`,base64url:`радок у фармаце base64url`,json_string:`JSON радок`,e164:`нумар E.164`,jwt:`JWT`,template_literal:`увод`},r={nan:`NaN`,number:`лік`,array:`масіў`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Няправільны ўвод: чакаўся instanceof ${e.expected}, атрымана ${i}`:`Няправільны ўвод: чакаўся ${t}, атрымана ${i}`}case`invalid_value`:return e.values.length===1?`Няправільны ўвод: чакалася ${I(e.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=Tc(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна ${r.verb} ${n}${e.maximum.toString()} ${t}`}return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна быць ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=Tc(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Занадта малы: чакалася, што ${e.origin} павінна ${r.verb} ${n}${e.minimum.toString()} ${t}`}return`Занадта малы: чакалася, што ${e.origin} павінна быць ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Няправільны радок: павінен пачынацца з "${t.prefix}"`:t.format===`ends_with`?`Няправільны радок: павінен заканчвацца на "${t.suffix}"`:t.format===`includes`?`Няправільны радок: павінен змяшчаць "${t.includes}"`:t.format===`regex`?`Няправільны радок: павінен адпавядаць шаблону ${t.pattern}`:`Няправільны ${n[t.format]??e.format}`}case`not_multiple_of`:return`Няправільны лік: павінен быць кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспазнаны ${e.keys.length>1?`ключы`:`ключ`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Няправільны ключ у ${e.origin}`;case`invalid_union`:return`Няправільны ўвод`;case`invalid_element`:return`Няправільнае значэнне ў ${e.origin}`;default:return`Няправільны ўвод`}}};function Dc(){return{localeError:Ec()}}var Oc=()=>{let e={string:{unit:`символа`,verb:`да съдържа`},file:{unit:`байта`,verb:`да съдържа`},array:{unit:`елемента`,verb:`да съдържа`},set:{unit:`елемента`,verb:`да съдържа`}};function t(t){return e[t]??null}let n={regex:`вход`,email:`имейл адрес`,url:`URL`,emoji:`емоджи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO време`,date:`ISO дата`,time:`ISO време`,duration:`ISO продължителност`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`base64-кодиран низ`,base64url:`base64url-кодиран низ`,json_string:`JSON низ`,e164:`E.164 номер`,jwt:`JWT`,template_literal:`вход`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Невалиден вход: очакван instanceof ${e.expected}, получен ${i}`:`Невалиден вход: очакван ${t}, получен ${i}`}case`invalid_value`:return e.values.length===1?`Невалиден вход: очакван ${I(e.values[0])}`:`Невалидна опция: очаквано едно от ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Твърде голямо: очаква се ${e.origin??`стойност`} да съдържа ${n}${e.maximum.toString()} ${r.unit??`елемента`}`:`Твърде голямо: очаква се ${e.origin??`стойност`} да бъде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Твърде малко: очаква се ${e.origin} да съдържа ${n}${e.minimum.toString()} ${r.unit}`:`Твърде малко: очаква се ${e.origin} да бъде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;if(t.format===`starts_with`)return`Невалиден низ: трябва да започва с "${t.prefix}"`;if(t.format===`ends_with`)return`Невалиден низ: трябва да завършва с "${t.suffix}"`;if(t.format===`includes`)return`Невалиден низ: трябва да включва "${t.includes}"`;if(t.format===`regex`)return`Невалиден низ: трябва да съвпада с ${t.pattern}`;let r=`Невалиден`;return t.format===`emoji`&&(r=`Невалидно`),t.format===`datetime`&&(r=`Невалидно`),t.format===`date`&&(r=`Невалидна`),t.format===`time`&&(r=`Невалидно`),t.format===`duration`&&(r=`Невалидна`),`${r} ${n[t.format]??e.format}`}case`not_multiple_of`:return`Невалидно число: трябва да бъде кратно на ${e.divisor}`;case`unrecognized_keys`:return`Неразпознат${e.keys.length>1?`и`:``} ключ${e.keys.length>1?`ове`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Невалиден ключ в ${e.origin}`;case`invalid_union`:return`Невалиден вход`;case`invalid_element`:return`Невалидна стойност в ${e.origin}`;default:return`Невалиден вход`}}};function kc(){return{localeError:Oc()}}var Ac=()=>{let e={string:{unit:`caràcters`,verb:`contenir`},file:{unit:`bytes`,verb:`contenir`},array:{unit:`elements`,verb:`contenir`},set:{unit:`elements`,verb:`contenir`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`adreça electrònica`,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ça IPv4`,ipv6:`adreça IPv6`,cidrv4:`rang IPv4`,cidrv6:`rang IPv6`,base64:`cadena codificada en base64`,base64url:`cadena codificada en base64url`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipus invàlid: s'esperava instanceof ${e.expected}, s'ha rebut ${i}`:`Tipus invàlid: s'esperava ${t}, s'ha rebut ${i}`}case`invalid_value`:return e.values.length===1?`Valor invàlid: s'esperava ${I(e.values[0])}`:`Opció invàlida: s'esperava una de ${N(e.values,` o `)}`;case`too_big`:{let n=e.inclusive?`com a màxim`:`menys de`,r=t(e.origin);return r?`Massa gran: s'esperava que ${e.origin??`el valor`} contingués ${n} ${e.maximum.toString()} ${r.unit??`elements`}`:`Massa gran: s'esperava que ${e.origin??`el valor`} fos ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`com a mínim`:`més de`,r=t(e.origin);return r?`Massa petit: s'esperava que ${e.origin} contingués ${n} ${e.minimum.toString()} ${r.unit}`:`Massa petit: s'esperava que ${e.origin} fos ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Format invàlid: ha de començar amb "${t.prefix}"`:t.format===`ends_with`?`Format invàlid: ha d'acabar amb "${t.suffix}"`:t.format===`includes`?`Format invàlid: ha d'incloure "${t.includes}"`:t.format===`regex`?`Format invàlid: ha de coincidir amb el patró ${t.pattern}`:`Format invàlid per a ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número invàlid: ha de ser múltiple de ${e.divisor}`;case`unrecognized_keys`:return`Clau${e.keys.length>1?`s`:``} no reconeguda${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Clau invàlida a ${e.origin}`;case`invalid_union`:return`Entrada invàlida`;case`invalid_element`:return`Element invàlid a ${e.origin}`;default:return`Entrada invàlida`}}};function jc(){return{localeError:Ac()}}var Mc=()=>{let e={string:{unit:`znaků`,verb:`mít`},file:{unit:`bajtů`,verb:`mít`},array:{unit:`prvků`,verb:`mít`},set:{unit:`prvků`,verb:`mít`}};function t(t){return e[t]??null}let n={regex:`regulární výraz`,email:`e-mailová 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 čas ve formátu ISO`,date:`datum ve formátu ISO`,time:`čas ve formátu ISO`,duration:`doba trvání ISO`,ipv4:`IPv4 adresa`,ipv6:`IPv6 adresa`,cidrv4:`rozsah IPv4`,cidrv6:`rozsah IPv6`,base64:`řetězec zakódovaný ve formátu base64`,base64url:`řetězec zakódovaný ve formátu base64url`,json_string:`řetězec ve formátu JSON`,e164:`číslo E.164`,jwt:`JWT`,template_literal:`vstup`},r={nan:`NaN`,number:`číslo`,string:`řetězec`,function:`funkce`,array:`pole`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neplatný vstup: očekáváno instanceof ${e.expected}, obdrženo ${i}`:`Neplatný vstup: očekáváno ${t}, obdrženo ${i}`}case`invalid_value`:return e.values.length===1?`Neplatný vstup: očekáváno ${I(e.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Hodnota je příliš velká: ${e.origin??`hodnota`} musí mít ${n}${e.maximum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš velká: ${e.origin??`hodnota`} musí být ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Hodnota je příliš malá: ${e.origin??`hodnota`} musí mít ${n}${e.minimum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš malá: ${e.origin??`hodnota`} musí být ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neplatný řetězec: musí začínat na "${t.prefix}"`:t.format===`ends_with`?`Neplatný řetězec: musí končit na "${t.suffix}"`:t.format===`includes`?`Neplatný řetězec: musí obsahovat "${t.includes}"`:t.format===`regex`?`Neplatný řetězec: musí odpovídat vzoru ${t.pattern}`:`Neplatný formát ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neplatné číslo: musí být násobkem ${e.divisor}`;case`unrecognized_keys`:return`Neznámé klíče: ${N(e.keys,`, `)}`;case`invalid_key`:return`Neplatný klíč v ${e.origin}`;case`invalid_union`:return`Neplatný vstup`;case`invalid_element`:return`Neplatná hodnota v ${e.origin}`;default:return`Neplatný vstup`}}};function Nc(){return{localeError:Mc()}}var Pc=()=>{let e={string:{unit:`tegn`,verb:`havde`},file:{unit:`bytes`,verb:`havde`},array:{unit:`elementer`,verb:`indeholdt`},set:{unit:`elementer`,verb:`indeholdt`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-mailadresse`,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 klokkeslæt`,date:`ISO-dato`,time:`ISO-klokkeslæt`,duration:`ISO-varighed`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodet streng`,base64url:`base64url-kodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,string:`streng`,number:`tal`,boolean:`boolean`,array:`liste`,object:`objekt`,set:`sæt`,file:`fil`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldigt input: forventede instanceof ${e.expected}, fik ${i}`:`Ugyldigt input: forventede ${t}, fik ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig værdi: forventede ${I(e.values[0])}`:`Ugyldigt valg: forventede en af følgende ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For stor: forventede ${a??`value`} ${i.verb} ${n} ${e.maximum.toString()} ${i.unit??`elementer`}`:`For stor: forventede ${a??`value`} havde ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For lille: forventede ${a} ${i.verb} ${n} ${e.minimum.toString()} ${i.unit}`:`For lille: forventede ${a} havde ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: skal starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: skal ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: skal indeholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: skal matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldigt tal: skal være deleligt med ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukendte nøgler`:`Ukendt nøgle`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøgle i ${e.origin}`;case`invalid_union`:return`Ugyldigt input: matcher ingen af de tilladte typer`;case`invalid_element`:return`Ugyldig værdi i ${e.origin}`;default:return`Ugyldigt input`}}};function Fc(){return{localeError:Pc()}}var Ic=()=>{let e={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(t){return e[t]??null}let n={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`},r={nan:`NaN`,number:`Zahl`,array:`Array`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ungültige Eingabe: erwartet instanceof ${e.expected}, erhalten ${i}`:`Ungültige Eingabe: erwartet ${t}, erhalten ${i}`}case`invalid_value`:return e.values.length===1?`Ungültige Eingabe: erwartet ${I(e.values[0])}`:`Ungültige Option: erwartet eine von ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ${r.unit??`Elemente`} hat`:`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ist`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ${r.unit} hat`:`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ist`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ungültiger String: muss mit "${t.prefix}" beginnen`:t.format===`ends_with`?`Ungültiger String: muss mit "${t.suffix}" enden`:t.format===`includes`?`Ungültiger String: muss "${t.includes}" enthalten`:t.format===`regex`?`Ungültiger String: muss dem Muster ${t.pattern} entsprechen`:`Ungültig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ungültige Zahl: muss ein Vielfaches von ${e.divisor} sein`;case`unrecognized_keys`:return`${e.keys.length>1?`Unbekannte Schlüssel`:`Unbekannter Schlüssel`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Ungültiger Schlüssel in ${e.origin}`;case`invalid_union`:return`Ungültige Eingabe`;case`invalid_element`:return`Ungültiger Wert in ${e.origin}`;default:return`Ungültige Eingabe`}}};function Lc(){return{localeError:Ic()}}var Rc=()=>{let e={string:{unit:`χαρακτήρες`,verb:`να έχει`},file:{unit:`bytes`,verb:`να έχει`},array:{unit:`στοιχεία`,verb:`να έχει`},set:{unit:`στοιχεία`,verb:`να έχει`},map:{unit:`καταχωρήσεις`,verb:`να έχει`}};function t(t){return e[t]??null}let n={regex:`είσοδος`,email:`διεύθυνση 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:`ISO ημερομηνία και ώρα`,date:`ISO ημερομηνία`,time:`ISO ώρα`,duration:`ISO διάρκεια`,ipv4:`διεύθυνση IPv4`,ipv6:`διεύθυνση IPv6`,mac:`διεύθυνση MAC`,cidrv4:`εύρος IPv4`,cidrv6:`εύρος IPv6`,base64:`συμβολοσειρά κωδικοποιημένη σε base64`,base64url:`συμβολοσειρά κωδικοποιημένη σε base64url`,json_string:`συμβολοσειρά JSON`,e164:`αριθμός E.164`,jwt:`JWT`,template_literal:`είσοδος`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return typeof e.expected==`string`&&/^[A-Z]/.test(e.expected)?`Μη έγκυρη είσοδος: αναμενόταν instanceof ${e.expected}, λήφθηκε ${i}`:`Μη έγκυρη είσοδος: αναμενόταν ${t}, λήφθηκε ${i}`}case`invalid_value`:return e.values.length===1?`Μη έγκυρη είσοδος: αναμενόταν ${I(e.values[0])}`:`Μη έγκυρη επιλογή: αναμενόταν ένα από ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Πολύ μεγάλο: αναμενόταν ${e.origin??`τιμή`} να έχει ${n}${e.maximum.toString()} ${r.unit??`στοιχεία`}`:`Πολύ μεγάλο: αναμενόταν ${e.origin??`τιμή`} να είναι ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Πολύ μικρό: αναμενόταν ${e.origin} να έχει ${n}${e.minimum.toString()} ${r.unit}`:`Πολύ μικρό: αναμενόταν ${e.origin} να είναι ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${t.prefix}"`:t.format===`ends_with`?`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${t.suffix}"`:t.format===`includes`?`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${t.includes}"`:t.format===`regex`?`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${t.pattern}`:`Μη έγκυρο: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${e.divisor}`;case`unrecognized_keys`:return`Άγνωστ${e.keys.length>1?`α`:`ο`} κλειδ${e.keys.length>1?`ιά`:`ί`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Μη έγκυρο κλειδί στο ${e.origin}`;case`invalid_union`:return`Μη έγκυρη είσοδος`;case`invalid_element`:return`Μη έγκυρη τιμή στο ${e.origin}`;default:return`Μη έγκυρη είσοδος`}}};function zc(){return{localeError:Rc()}}var Bc=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={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`,mac:`MAC 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`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input);return`Invalid input: expected ${t}, received ${r[n]??n}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${I(e.values[0])}`:`Invalid option: expected one of ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Vc(){return{localeError:Bc()}}var Hc=()=>{let e={string:{unit:`karaktrojn`,verb:`havi`},file:{unit:`bajtojn`,verb:`havi`},array:{unit:`elementojn`,verb:`havi`},set:{unit:`elementojn`,verb:`havi`}};function t(t){return e[t]??null}let n={regex:`enigo`,email:`retadreso`,url:`URL`,emoji:`emoĝio`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-datotempo`,date:`ISO-dato`,time:`ISO-tempo`,duration:`ISO-daŭro`,ipv4:`IPv4-adreso`,ipv6:`IPv6-adreso`,cidrv4:`IPv4-rango`,cidrv6:`IPv6-rango`,base64:`64-ume kodita karaktraro`,base64url:`URL-64-ume kodita karaktraro`,json_string:`JSON-karaktraro`,e164:`E.164-nombro`,jwt:`JWT`,template_literal:`enigo`},r={nan:`NaN`,number:`nombro`,array:`tabelo`,null:`senvalora`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nevalida enigo: atendiĝis instanceof ${e.expected}, riceviĝis ${i}`:`Nevalida enigo: atendiĝis ${t}, riceviĝis ${i}`}case`invalid_value`:return e.values.length===1?`Nevalida enigo: atendiĝis ${I(e.values[0])}`:`Nevalida opcio: atendiĝis unu el ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()} ${r.unit??`elementojn`}`:`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Tro malgranda: atendiĝis ke ${e.origin} havu ${n}${e.minimum.toString()} ${r.unit}`:`Tro malgranda: atendiĝis ke ${e.origin} estu ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nevalida karaktraro: devas komenciĝi per "${t.prefix}"`:t.format===`ends_with`?`Nevalida karaktraro: devas finiĝi per "${t.suffix}"`:t.format===`includes`?`Nevalida karaktraro: devas inkluzivi "${t.includes}"`:t.format===`regex`?`Nevalida karaktraro: devas kongrui kun la modelo ${t.pattern}`:`Nevalida ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nevalida nombro: devas esti oblo de ${e.divisor}`;case`unrecognized_keys`:return`Nekonata${e.keys.length>1?`j`:``} ŝlosilo${e.keys.length>1?`j`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Nevalida ŝlosilo en ${e.origin}`;case`invalid_union`:return`Nevalida enigo`;case`invalid_element`:return`Nevalida valoro en ${e.origin}`;default:return`Nevalida enigo`}}};function Uc(){return{localeError:Hc()}}var Wc=()=>{let e={string:{unit:`caracteres`,verb:`tener`},file:{unit:`bytes`,verb:`tener`},array:{unit:`elementos`,verb:`tener`},set:{unit:`elementos`,verb:`tener`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`dirección de correo electrónico`,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ón ISO`,ipv4:`dirección IPv4`,ipv6:`dirección IPv6`,cidrv4:`rango IPv4`,cidrv6:`rango IPv6`,base64:`cadena codificada en base64`,base64url:`URL codificada en base64`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,string:`texto`,number:`número`,boolean:`booleano`,array:`arreglo`,object:`objeto`,set:`conjunto`,file:`archivo`,date:`fecha`,bigint:`número grande`,symbol:`símbolo`,undefined:`indefinido`,null:`nulo`,function:`función`,map:`mapa`,record:`registro`,tuple:`tupla`,enum:`enumeración`,union:`unión`,literal:`literal`,promise:`promesa`,void:`vacío`,never:`nunca`,unknown:`desconocido`,any:`cualquiera`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrada inválida: se esperaba instanceof ${e.expected}, recibido ${i}`:`Entrada inválida: se esperaba ${t}, recibido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: se esperaba ${I(e.values[0])}`:`Opción inválida: se esperaba una de ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado grande: se esperaba que ${a??`valor`} tuviera ${n}${e.maximum.toString()} ${i.unit??`elementos`}`:`Demasiado grande: se esperaba que ${a??`valor`} fuera ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado pequeño: se esperaba que ${a} tuviera ${n}${e.minimum.toString()} ${i.unit}`:`Demasiado pequeño: se esperaba que ${a} fuera ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Cadena inválida: debe comenzar con "${t.prefix}"`:t.format===`ends_with`?`Cadena inválida: debe terminar en "${t.suffix}"`:t.format===`includes`?`Cadena inválida: debe incluir "${t.includes}"`:t.format===`regex`?`Cadena inválida: debe coincidir con el patrón ${t.pattern}`:`Inválido ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número inválido: debe ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Llave${e.keys.length>1?`s`:``} desconocida${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Llave inválida en ${r[e.origin]??e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido en ${r[e.origin]??e.origin}`;default:return`Entrada inválida`}}};function Gc(){return{localeError:Wc()}}var Kc=()=>{let e={string:{unit:`کاراکتر`,verb:`داشته باشد`},file:{unit:`بایت`,verb:`داشته باشد`},array:{unit:`آیتم`,verb:`داشته باشد`},set:{unit:`آیتم`,verb:`داشته باشد`}};function t(t){return e[t]??null}let n={regex:`ورودی`,email:`آدرس ایمیل`,url:`URL`,emoji:`ایموجی`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاریخ و زمان ایزو`,date:`تاریخ ایزو`,time:`زمان ایزو`,duration:`مدت زمان ایزو`,ipv4:`IPv4 آدرس`,ipv6:`IPv6 آدرس`,cidrv4:`IPv4 دامنه`,cidrv6:`IPv6 دامنه`,base64:`base64-encoded رشته`,base64url:`base64url-encoded رشته`,json_string:`JSON رشته`,e164:`E.164 عدد`,jwt:`JWT`,template_literal:`ورودی`},r={nan:`NaN`,number:`عدد`,array:`آرایه`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ورودی نامعتبر: میبایست instanceof ${e.expected} میبود، ${i} دریافت شد`:`ورودی نامعتبر: میبایست ${t} میبود، ${i} دریافت شد`}case`invalid_value`:return e.values.length===1?`ورودی نامعتبر: میبایست ${I(e.values[0])} میبود`:`گزینه نامعتبر: میبایست یکی از ${N(e.values,`|`)} میبود`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصر`} باشد`:`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} باشد`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} باشد`:`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} باشد`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`رشته نامعتبر: باید با "${t.prefix}" شروع شود`:t.format===`ends_with`?`رشته نامعتبر: باید با "${t.suffix}" تمام شود`:t.format===`includes`?`رشته نامعتبر: باید شامل "${t.includes}" باشد`:t.format===`regex`?`رشته نامعتبر: باید با الگوی ${t.pattern} مطابقت داشته باشد`:`${n[t.format]??e.format} نامعتبر`}case`not_multiple_of`:return`عدد نامعتبر: باید مضرب ${e.divisor} باشد`;case`unrecognized_keys`:return`کلید${e.keys.length>1?`های`:``} ناشناس: ${N(e.keys,`, `)}`;case`invalid_key`:return`کلید ناشناس در ${e.origin}`;case`invalid_union`:return`ورودی نامعتبر`;case`invalid_element`:return`مقدار نامعتبر در ${e.origin}`;default:return`ورودی نامعتبر`}}};function qc(){return{localeError:Kc()}}var Jc=()=>{let e={string:{unit:`merkkiä`,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äivämäärän`}};function t(t){return e[t]??null}let n={regex:`säännöllinen lauseke`,email:`sähköpostiosoite`,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äivämäärä`,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`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Virheellinen tyyppi: odotettiin instanceof ${e.expected}, oli ${i}`:`Virheellinen tyyppi: odotettiin ${t}, oli ${i}`}case`invalid_value`:return e.values.length===1?`Virheellinen syöte: täytyy olla ${I(e.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Liian suuri: ${r.subject} täytyy olla ${n}${e.maximum.toString()} ${r.unit}`.trim():`Liian suuri: arvon täytyy olla ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Liian pieni: ${r.subject} täytyy olla ${n}${e.minimum.toString()} ${r.unit}`.trim():`Liian pieni: arvon täytyy olla ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Virheellinen syöte: täytyy alkaa "${t.prefix}"`:t.format===`ends_with`?`Virheellinen syöte: täytyy loppua "${t.suffix}"`:t.format===`includes`?`Virheellinen syöte: täytyy sisältää "${t.includes}"`:t.format===`regex`?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${t.pattern}`:`Virheellinen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Virheellinen luku: täytyy olla luvun ${e.divisor} monikerta`;case`unrecognized_keys`:return`${e.keys.length>1?`Tuntemattomat avaimet`:`Tuntematon avain`}: ${N(e.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öte`}}};function Yc(){return{localeError:Jc()}}var Xc=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,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ée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={string:`chaîne`,number:`nombre`,int:`entier`,boolean:`booléen`,bigint:`grand entier`,symbol:`symbole`,undefined:`indéfini`,null:`null`,never:`jamais`,void:`vide`,date:`date`,array:`tableau`,object:`objet`,tuple:`tuple`,record:`enregistrement`,map:`carte`,set:`ensemble`,file:`fichier`,nonoptional:`non-optionnel`,nan:`NaN`,function:`fonction`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : instanceof ${e.expected} attendu, ${i} reçu`:`Entrée invalide : ${t} attendu, ${i} reçu`}case`invalid_value`:return e.values.length===1?`Entrée invalide : ${I(e.values[0])} attendu`:`Option invalide : une valeur parmi ${N(e.values,`|`)} attendue`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin);return i?`Trop grand : ${r[e.origin]??`valeur`} doit ${i.verb} ${n}${e.maximum.toString()} ${i.unit??`élément(s)`}`:`Trop grand : ${r[e.origin]??`valeur`} doit être ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin);return i?`Trop petit : ${r[e.origin]??`valeur`} doit ${i.verb} ${n}${e.minimum.toString()} ${i.unit}`:`Trop petit : ${r[e.origin]??`valeur`} doit être ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au modèle ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${N(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function Zc(){return{localeError:Xc()}}var Qc=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,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ée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : attendu instanceof ${e.expected}, reçu ${i}`:`Entrée invalide : attendu ${t}, reçu ${i}`}case`invalid_value`:return e.values.length===1?`Entrée invalide : attendu ${I(e.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`≤`:`<`,r=t(e.origin);return r?`Trop grand : attendu que ${e.origin??`la valeur`} ait ${n}${e.maximum.toString()} ${r.unit}`:`Trop grand : attendu que ${e.origin??`la valeur`} soit ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`≥`:`>`,r=t(e.origin);return r?`Trop petit : attendu que ${e.origin} ait ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : attendu que ${e.origin} soit ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au motif ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${N(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function $c(){return{localeError:Qc()}}var el=()=>{let e={string:{label:`מחרוזת`,gender:`f`},number:{label:`מספר`,gender:`m`},boolean:{label:`ערך בוליאני`,gender:`m`},bigint:{label:`BigInt`,gender:`m`},date:{label:`תאריך`,gender:`m`},array:{label:`מערך`,gender:`m`},object:{label:`אובייקט`,gender:`m`},null:{label:`ערך ריק (null)`,gender:`m`},undefined:{label:`ערך לא מוגדר (undefined)`,gender:`m`},symbol:{label:`סימבול (Symbol)`,gender:`m`},function:{label:`פונקציה`,gender:`f`},map:{label:`מפה (Map)`,gender:`f`},set:{label:`קבוצה (Set)`,gender:`f`},file:{label:`קובץ`,gender:`m`},promise:{label:`Promise`,gender:`m`},NaN:{label:`NaN`,gender:`m`},unknown:{label:`ערך לא ידוע`,gender:`m`},value:{label:`ערך`,gender:`m`}},t={string:{unit:`תווים`,shortLabel:`קצר`,longLabel:`ארוך`},file:{unit:`בייטים`,shortLabel:`קטן`,longLabel:`גדול`},array:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},set:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},number:{unit:``,shortLabel:`קטן`,longLabel:`גדול`}},n=t=>t?e[t]:void 0,r=t=>{let r=n(t);return r?r.label:t??e.unknown.label},i=e=>`ה${r(e)}`,a=e=>(n(e)?.gender??`m`)===`f`?`צריכה להיות`:`צריך להיות`,o=e=>e?t[e]??null:null,s={regex:{label:`קלט`,gender:`m`},email:{label:`כתובת אימייל`,gender:`f`},url:{label:`כתובת רשת`,gender:`f`},emoji:{label:`אימוג'י`,gender:`m`},uuid:{label:`UUID`,gender:`m`},nanoid:{label:`nanoid`,gender:`m`},guid:{label:`GUID`,gender:`m`},cuid:{label:`cuid`,gender:`m`},cuid2:{label:`cuid2`,gender:`m`},ulid:{label:`ULID`,gender:`m`},xid:{label:`XID`,gender:`m`},ksuid:{label:`KSUID`,gender:`m`},datetime:{label:`תאריך וזמן ISO`,gender:`m`},date:{label:`תאריך ISO`,gender:`m`},time:{label:`זמן ISO`,gender:`m`},duration:{label:`משך זמן ISO`,gender:`m`},ipv4:{label:`כתובת IPv4`,gender:`f`},ipv6:{label:`כתובת IPv6`,gender:`f`},cidrv4:{label:`טווח IPv4`,gender:`m`},cidrv6:{label:`טווח IPv6`,gender:`m`},base64:{label:`מחרוזת בבסיס 64`,gender:`f`},base64url:{label:`מחרוזת בבסיס 64 לכתובות רשת`,gender:`f`},json_string:{label:`מחרוזת JSON`,gender:`f`},e164:{label:`מספר E.164`,gender:`m`},jwt:{label:`JWT`,gender:`m`},ends_with:{label:`קלט`,gender:`m`},includes:{label:`קלט`,gender:`m`},lowercase:{label:`קלט`,gender:`m`},starts_with:{label:`קלט`,gender:`m`},uppercase:{label:`קלט`,gender:`m`}},c={nan:`NaN`};return t=>{switch(t.code){case`invalid_type`:{let n=t.expected,i=c[n??``]??r(n),a=L(t.input),o=c[a]??e[a]?.label??a;return/^[A-Z]/.test(t.expected)?`קלט לא תקין: צריך להיות instanceof ${t.expected}, התקבל ${o}`:`קלט לא תקין: צריך להיות ${i}, התקבל ${o}`}case`invalid_value`:{if(t.values.length===1)return`ערך לא תקין: הערך חייב להיות ${I(t.values[0])}`;let e=t.values.map(e=>I(e));if(t.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${e[0]} או ${e[1]}`;let n=e[e.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${e.slice(0,-1).join(`, `)} או ${n}`}case`too_big`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.longLabel??`ארוך`} מדי: ${n} צריכה להכיל ${t.maximum.toString()} ${e?.unit??``} ${t.inclusive?`או פחות`:`לכל היותר`}`.trim();if(t.origin===`number`)return`גדול מדי: ${n} צריך להיות ${t.inclusive?`קטן או שווה ל-${t.maximum}`:`קטן מ-${t.maximum}`}`;if(t.origin===`array`||t.origin===`set`)return`גדול מדי: ${n} ${t.origin===`set`?`צריכה`:`צריך`} להכיל ${t.inclusive?`${t.maximum} ${e?.unit??``} או פחות`:`פחות מ-${t.maximum} ${e?.unit??``}`}`.trim();let r=t.inclusive?`<=`:`<`,s=a(t.origin??`value`);return e?.unit?`${e.longLabel} מדי: ${n} ${s} ${r}${t.maximum.toString()} ${e.unit}`:`${e?.longLabel??`גדול`} מדי: ${n} ${s} ${r}${t.maximum.toString()}`}case`too_small`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.shortLabel??`קצר`} מדי: ${n} צריכה להכיל ${t.minimum.toString()} ${e?.unit??``} ${t.inclusive?`או יותר`:`לפחות`}`.trim();if(t.origin===`number`)return`קטן מדי: ${n} צריך להיות ${t.inclusive?`גדול או שווה ל-${t.minimum}`:`גדול מ-${t.minimum}`}`;if(t.origin===`array`||t.origin===`set`){let r=t.origin===`set`?`צריכה`:`צריך`;return t.minimum===1&&t.inclusive?`קטן מדי: ${n} ${r} להכיל ${t.origin,`לפחות פריט אחד`}`:`קטן מדי: ${n} ${r} להכיל ${t.inclusive?`${t.minimum} ${e?.unit??``} או יותר`:`יותר מ-${t.minimum} ${e?.unit??``}`}`.trim()}let r=t.inclusive?`>=`:`>`,s=a(t.origin??`value`);return e?.unit?`${e.shortLabel} מדי: ${n} ${s} ${r}${t.minimum.toString()} ${e.unit}`:`${e?.shortLabel??`קטן`} מדי: ${n} ${s} ${r}${t.minimum.toString()}`}case`invalid_format`:{let e=t;if(e.format===`starts_with`)return`המחרוזת חייבת להתחיל ב "${e.prefix}"`;if(e.format===`ends_with`)return`המחרוזת חייבת להסתיים ב "${e.suffix}"`;if(e.format===`includes`)return`המחרוזת חייבת לכלול "${e.includes}"`;if(e.format===`regex`)return`המחרוזת חייבת להתאים לתבנית ${e.pattern}`;let n=s[e.format];return`${n?.label??e.format} לא ${(n?.gender??`m`)===`f`?`תקינה`:`תקין`}`}case`not_multiple_of`:return`מספר לא תקין: חייב להיות מכפלה של ${t.divisor}`;case`unrecognized_keys`:return`מפתח${t.keys.length>1?`ות`:``} לא מזוה${t.keys.length>1?`ים`:`ה`}: ${N(t.keys,`, `)}`;case`invalid_key`:return`שדה לא תקין באובייקט`;case`invalid_union`:return`קלט לא תקין`;case`invalid_element`:return`ערך לא תקין ב${i(t.origin??`array`)}`;default:return`קלט לא תקין`}}};function tl(){return{localeError:el()}}var nl=()=>{let e={string:{unit:`znakova`,verb:`imati`},file:{unit:`bajtova`,verb:`imati`},array:{unit:`stavki`,verb:`imati`},set:{unit:`stavki`,verb:`imati`}};function t(t){return e[t]??null}let n={regex:`unos`,email:`email 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:`ISO datum i vrijeme`,date:`ISO datum`,time:`ISO vrijeme`,duration:`ISO trajanje`,ipv4:`IPv4 adresa`,ipv6:`IPv6 adresa`,cidrv4:`IPv4 raspon`,cidrv6:`IPv6 raspon`,base64:`base64 kodirani tekst`,base64url:`base64url kodirani tekst`,json_string:`JSON tekst`,e164:`E.164 broj`,jwt:`JWT`,template_literal:`unos`},r={nan:`NaN`,string:`tekst`,number:`broj`,boolean:`boolean`,array:`niz`,object:`objekt`,set:`skup`,file:`datoteka`,date:`datum`,bigint:`bigint`,symbol:`simbol`,undefined:`undefined`,null:`null`,function:`funkcija`,map:`mapa`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neispravan unos: očekuje se instanceof ${e.expected}, a primljeno je ${i}`:`Neispravan unos: očekuje se ${t}, a primljeno je ${i}`}case`invalid_value`:return e.values.length===1?`Neispravna vrijednost: očekivano ${I(e.values[0])}`:`Neispravna opcija: očekivano jedno od ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Preveliko: očekivano da ${a??`vrijednost`} ima ${n}${e.maximum.toString()} ${i.unit??`elemenata`}`:`Preveliko: očekivano da ${a??`vrijednost`} bude ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Premalo: očekivano da ${a} ima ${n}${e.minimum.toString()} ${i.unit}`:`Premalo: očekivano da ${a} bude ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neispravan tekst: mora započinjati s "${t.prefix}"`:t.format===`ends_with`?`Neispravan tekst: mora završavati s "${t.suffix}"`:t.format===`includes`?`Neispravan tekst: mora sadržavati "${t.includes}"`:t.format===`regex`?`Neispravan tekst: mora odgovarati uzorku ${t.pattern}`:`Neispravna ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neispravan broj: mora biti višekratnik od ${e.divisor}`;case`unrecognized_keys`:return`Neprepoznat${e.keys.length>1?`i ključevi`:` ključ`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Neispravan ključ u ${r[e.origin]??e.origin}`;case`invalid_union`:return`Neispravan unos`;case`invalid_element`:return`Neispravna vrijednost u ${r[e.origin]??e.origin}`;default:return`Neispravan unos`}}};function rl(){return{localeError:nl()}}var il=()=>{let e={string:{unit:`karakter`,verb:`legyen`},file:{unit:`byte`,verb:`legyen`},array:{unit:`elem`,verb:`legyen`},set:{unit:`elem`,verb:`legyen`}};function t(t){return e[t]??null}let n={regex:`bemenet`,email:`email cím`,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őbélyeg`,date:`ISO dátum`,time:`ISO idő`,duration:`ISO időintervallum`,ipv4:`IPv4 cím`,ipv6:`IPv6 cím`,cidrv4:`IPv4 tartomány`,cidrv6:`IPv6 tartomány`,base64:`base64-kódolt string`,base64url:`base64url-kódolt string`,json_string:`JSON string`,e164:`E.164 szám`,jwt:`JWT`,template_literal:`bemenet`},r={nan:`NaN`,number:`szám`,array:`tömb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Érvénytelen bemenet: a várt érték instanceof ${e.expected}, a kapott érték ${i}`:`Érvénytelen bemenet: a várt érték ${t}, a kapott érték ${i}`}case`invalid_value`:return e.values.length===1?`Érvénytelen bemenet: a várt érték ${I(e.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Túl nagy: ${e.origin??`érték`} mérete túl nagy ${n}${e.maximum.toString()} ${r.unit??`elem`}`:`Túl nagy: a bemeneti érték ${e.origin??`érték`} túl nagy: ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Túl kicsi: a bemeneti érték ${e.origin} mérete túl kicsi ${n}${e.minimum.toString()} ${r.unit}`:`Túl kicsi: a bemeneti érték ${e.origin} túl kicsi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Érvénytelen string: "${t.prefix}" értékkel kell kezdődnie`:t.format===`ends_with`?`Érvénytelen string: "${t.suffix}" értékkel kell végződnie`:t.format===`includes`?`Érvénytelen string: "${t.includes}" értéket kell tartalmaznia`:t.format===`regex`?`Érvénytelen string: ${t.pattern} mintának kell megfelelnie`:`Érvénytelen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Érvénytelen szám: ${e.divisor} többszörösének kell lennie`;case`unrecognized_keys`:return`Ismeretlen kulcs${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Érvénytelen kulcs ${e.origin}`;case`invalid_union`:return`Érvénytelen bemenet`;case`invalid_element`:return`Érvénytelen érték: ${e.origin}`;default:return`Érvénytelen bemenet`}}};function al(){return{localeError:il()}}function ol(e,t,n){return Math.abs(e)===1?t:n}function sl(e){if(!e)return``;let t=[`ա`,`ե`,`ը`,`ի`,`ո`,`ու`,`օ`],n=e[e.length-1];return e+(t.includes(n)?`ն`:`ը`)}var cl=()=>{let e={string:{unit:{one:`նշան`,many:`նշաններ`},verb:`ունենալ`},file:{unit:{one:`բայթ`,many:`բայթեր`},verb:`ունենալ`},array:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`},set:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`}};function t(t){return e[t]??null}let n={regex:`մուտք`,email:`էլ. հասցե`,url:`URL`,emoji:`էմոջի`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO ամսաթիվ և ժամ`,date:`ISO ամսաթիվ`,time:`ISO ժամ`,duration:`ISO տևողություն`,ipv4:`IPv4 հասցե`,ipv6:`IPv6 հասցե`,cidrv4:`IPv4 միջակայք`,cidrv6:`IPv6 միջակայք`,base64:`base64 ձևաչափով տող`,base64url:`base64url ձևաչափով տող`,json_string:`JSON տող`,e164:`E.164 համար`,jwt:`JWT`,template_literal:`մուտք`},r={nan:`NaN`,number:`թիվ`,array:`զանգված`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${e.expected}, ստացվել է ${i}`:`Սխալ մուտքագրում․ սպասվում էր ${t}, ստացվել է ${i}`}case`invalid_value`:return e.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${I(e.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=ol(Number(e.maximum),r.unit.one,r.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${sl(e.origin??`արժեք`)} կունենա ${n}${e.maximum.toString()} ${t}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${sl(e.origin??`արժեք`)} լինի ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=ol(Number(e.minimum),r.unit.one,r.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${sl(e.origin)} կունենա ${n}${e.minimum.toString()} ${t}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${sl(e.origin)} լինի ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Սխալ տող․ պետք է սկսվի "${t.prefix}"-ով`:t.format===`ends_with`?`Սխալ տող․ պետք է ավարտվի "${t.suffix}"-ով`:t.format===`includes`?`Սխալ տող․ պետք է պարունակի "${t.includes}"`:t.format===`regex`?`Սխալ տող․ պետք է համապատասխանի ${t.pattern} ձևաչափին`:`Սխալ ${n[t.format]??e.format}`}case`not_multiple_of`:return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${e.divisor}-ի`;case`unrecognized_keys`:return`Չճանաչված բանալի${e.keys.length>1?`ներ`:``}. ${N(e.keys,`, `)}`;case`invalid_key`:return`Սխալ բանալի ${sl(e.origin)}-ում`;case`invalid_union`:return`Սխալ մուտքագրում`;case`invalid_element`:return`Սխալ արժեք ${sl(e.origin)}-ում`;default:return`Սխալ մուտքագրում`}}};function ll(){return{localeError:cl()}}var ul=()=>{let e={string:{unit:`karakter`,verb:`memiliki`},file:{unit:`byte`,verb:`memiliki`},array:{unit:`item`,verb:`memiliki`},set:{unit:`item`,verb:`memiliki`}};function t(t){return e[t]??null}let n={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`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak valid: diharapkan instanceof ${e.expected}, diterima ${i}`:`Input tidak valid: diharapkan ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak valid: diharapkan ${I(e.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: diharapkan ${e.origin??`value`} memiliki ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: diharapkan ${e.origin??`value`} menjadi ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: diharapkan ${e.origin} memiliki ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: diharapkan ${e.origin} menjadi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak valid: harus dimulai dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak valid: harus berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak valid: harus menyertakan "${t.includes}"`:t.format===`regex`?`String tidak valid: harus sesuai pola ${t.pattern}`:`${n[t.format]??e.format} tidak valid`}case`not_multiple_of`:return`Angka tidak valid: harus kelipatan dari ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali ${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak valid di ${e.origin}`;case`invalid_union`:return`Input tidak valid`;case`invalid_element`:return`Nilai tidak valid di ${e.origin}`;default:return`Input tidak valid`}}};function dl(){return{localeError:ul()}}var fl=()=>{let e={string:{unit:`stafi`,verb:`að hafa`},file:{unit:`bæti`,verb:`að hafa`},array:{unit:`hluti`,verb:`að hafa`},set:{unit:`hluti`,verb:`að hafa`}};function t(t){return e[t]??null}let n={regex:`gildi`,email:`netfang`,url:`vefslóð`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dagsetning og tími`,date:`ISO dagsetning`,time:`ISO tími`,duration:`ISO tímalengd`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded strengur`,base64url:`base64url-encoded strengur`,json_string:`JSON strengur`,e164:`E.164 tölugildi`,jwt:`JWT`,template_literal:`gildi`},r={nan:`NaN`,number:`númer`,array:`fylki`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Rangt gildi: Þú slóst inn ${i} þar sem á að vera instanceof ${e.expected}`:`Rangt gildi: Þú slóst inn ${i} þar sem á að vera ${t}`}case`invalid_value`:return e.values.length===1?`Rangt gildi: gert ráð fyrir ${I(e.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} hafi ${n}${e.maximum.toString()} ${r.unit??`hluti`}`:`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} sé ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Of lítið: gert er ráð fyrir að ${e.origin} hafi ${n}${e.minimum.toString()} ${r.unit}`:`Of lítið: gert er ráð fyrir að ${e.origin} sé ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ógildur strengur: verður að byrja á "${t.prefix}"`:t.format===`ends_with`?`Ógildur strengur: verður að enda á "${t.suffix}"`:t.format===`includes`?`Ógildur strengur: verður að innihalda "${t.includes}"`:t.format===`regex`?`Ógildur strengur: verður að fylgja mynstri ${t.pattern}`:`Rangt ${n[t.format]??e.format}`}case`not_multiple_of`:return`Röng tala: verður að vera margfeldi af ${e.divisor}`;case`unrecognized_keys`:return`Óþekkt ${e.keys.length>1?`ir lyklar`:`ur lykill`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Rangur lykill í ${e.origin}`;case`invalid_union`:return`Rangt gildi`;case`invalid_element`:return`Rangt gildi í ${e.origin}`;default:return`Rangt gildi`}}};function pl(){return{localeError:fl()}}var ml=()=>{let e={string:{unit:`caratteri`,verb:`avere`},file:{unit:`byte`,verb:`avere`},array:{unit:`elementi`,verb:`avere`},set:{unit:`elementi`,verb:`avere`}};function t(t){return e[t]??null}let n={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`},r={nan:`NaN`,number:`numero`,array:`vettore`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input non valido: atteso instanceof ${e.expected}, ricevuto ${i}`:`Input non valido: atteso ${t}, ricevuto ${i}`}case`invalid_value`:return e.values.length===1?`Input non valido: atteso ${I(e.values[0])}`:`Opzione non valida: atteso uno tra ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Troppo grande: ${e.origin??`valore`} deve avere ${n}${e.maximum.toString()} ${r.unit??`elementi`}`:`Troppo grande: ${e.origin??`valore`} deve essere ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Troppo piccolo: ${e.origin} deve avere ${n}${e.minimum.toString()} ${r.unit}`:`Troppo piccolo: ${e.origin} deve essere ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Stringa non valida: deve iniziare con "${t.prefix}"`:t.format===`ends_with`?`Stringa non valida: deve terminare con "${t.suffix}"`:t.format===`includes`?`Stringa non valida: deve includere "${t.includes}"`:t.format===`regex`?`Stringa non valida: deve corrispondere al pattern ${t.pattern}`:`Input non valido: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Numero non valido: deve essere un multiplo di ${e.divisor}`;case`unrecognized_keys`:return`Chiav${e.keys.length>1?`i`:`e`} non riconosciut${e.keys.length>1?`e`:`a`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Chiave non valida in ${e.origin}`;case`invalid_union`:return`Input non valido`;case`invalid_element`:return`Valore non valido in ${e.origin}`;default:return`Input non valido`}}};function hl(){return{localeError:ml()}}var gl=()=>{let e={string:{unit:`文字`,verb:`である`},file:{unit:`バイト`,verb:`である`},array:{unit:`要素`,verb:`である`},set:{unit:`要素`,verb:`である`}};function t(t){return e[t]??null}let n={regex:`入力値`,email:`メールアドレス`,url:`URL`,emoji:`絵文字`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日時`,date:`ISO日付`,time:`ISO時刻`,duration:`ISO期間`,ipv4:`IPv4アドレス`,ipv6:`IPv6アドレス`,cidrv4:`IPv4範囲`,cidrv6:`IPv6範囲`,base64:`base64エンコード文字列`,base64url:`base64urlエンコード文字列`,json_string:`JSON文字列`,e164:`E.164番号`,jwt:`JWT`,template_literal:`入力値`},r={nan:`NaN`,number:`数値`,array:`配列`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無効な入力: instanceof ${e.expected}が期待されましたが、${i}が入力されました`:`無効な入力: ${t}が期待されましたが、${i}が入力されました`}case`invalid_value`:return e.values.length===1?`無効な入力: ${I(e.values[0])}が期待されました`:`無効な選択: ${N(e.values,`、`)}のいずれかである必要があります`;case`too_big`:{let n=e.inclusive?`以下である`:`より小さい`,r=t(e.origin);return r?`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${r.unit??`要素`}${n}必要があります`:`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${n}必要があります`}case`too_small`:{let n=e.inclusive?`以上である`:`より大きい`,r=t(e.origin);return r?`小さすぎる値: ${e.origin}は${e.minimum.toString()}${r.unit}${n}必要があります`:`小さすぎる値: ${e.origin}は${e.minimum.toString()}${n}必要があります`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無効な文字列: "${t.prefix}"で始まる必要があります`:t.format===`ends_with`?`無効な文字列: "${t.suffix}"で終わる必要があります`:t.format===`includes`?`無効な文字列: "${t.includes}"を含む必要があります`:t.format===`regex`?`無効な文字列: パターン${t.pattern}に一致する必要があります`:`無効な${n[t.format]??e.format}`}case`not_multiple_of`:return`無効な数値: ${e.divisor}の倍数である必要があります`;case`unrecognized_keys`:return`認識されていないキー${e.keys.length>1?`群`:``}: ${N(e.keys,`、`)}`;case`invalid_key`:return`${e.origin}内の無効なキー`;case`invalid_union`:return`無効な入力`;case`invalid_element`:return`${e.origin}内の無効な値`;default:return`無効な入力`}}};function _l(){return{localeError:gl()}}var vl=()=>{let e={string:{unit:`სიმბოლო`,verb:`უნდა შეიცავდეს`},file:{unit:`ბაიტი`,verb:`უნდა შეიცავდეს`},array:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`},set:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`}};function t(t){return e[t]??null}let n={regex:`შეყვანა`,email:`ელ-ფოსტის მისამართი`,url:`URL`,emoji:`ემოჯი`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`თარიღი-დრო`,date:`თარიღი`,time:`დრო`,duration:`ხანგრძლივობა`,ipv4:`IPv4 მისამართი`,ipv6:`IPv6 მისამართი`,cidrv4:`IPv4 დიაპაზონი`,cidrv6:`IPv6 დიაპაზონი`,base64:`base64-კოდირებული ველი`,base64url:`base64url-კოდირებული ველი`,json_string:`JSON ველი`,e164:`E.164 ნომერი`,jwt:`JWT`,template_literal:`შეყვანა`},r={nan:`NaN`,number:`რიცხვი`,string:`ველი`,boolean:`ბულეანი`,function:`ფუნქცია`,array:`მასივი`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${e.expected}, მიღებული ${i}`:`არასწორი შეყვანა: მოსალოდნელი ${t}, მიღებული ${i}`}case`invalid_value`:return e.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${I(e.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${N(e.values,`|`)}-დან`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} იყოს ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ზედმეტად პატარა: მოსალოდნელი ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${e.origin} იყოს ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`არასწორი ველი: უნდა იწყებოდეს "${t.prefix}"-ით`:t.format===`ends_with`?`არასწორი ველი: უნდა მთავრდებოდეს "${t.suffix}"-ით`:t.format===`includes`?`არასწორი ველი: უნდა შეიცავდეს "${t.includes}"-ს`:t.format===`regex`?`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${t.pattern}`:`არასწორი ${n[t.format]??e.format}`}case`not_multiple_of`:return`არასწორი რიცხვი: უნდა იყოს ${e.divisor}-ის ჯერადი`;case`unrecognized_keys`:return`უცნობი გასაღებ${e.keys.length>1?`ები`:`ი`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`არასწორი გასაღები ${e.origin}-ში`;case`invalid_union`:return`არასწორი შეყვანა`;case`invalid_element`:return`არასწორი მნიშვნელობა ${e.origin}-ში`;default:return`არასწორი შეყვანა`}}};function yl(){return{localeError:vl()}}var bl=()=>{let e={string:{unit:`តួអក្សរ`,verb:`គួរមាន`},file:{unit:`បៃ`,verb:`គួរមាន`},array:{unit:`ធាតុ`,verb:`គួរមាន`},set:{unit:`ធាតុ`,verb:`គួរមាន`}};function t(t){return e[t]??null}let n={regex:`ទិន្នន័យបញ្ចូល`,email:`អាសយដ្ឋានអ៊ីមែល`,url:`URL`,emoji:`សញ្ញាអារម្មណ៍`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`កាលបរិច្ឆេទ និងម៉ោង ISO`,date:`កាលបរិច្ឆេទ ISO`,time:`ម៉ោង ISO`,duration:`រយៈពេល ISO`,ipv4:`អាសយដ្ឋាន IPv4`,ipv6:`អាសយដ្ឋាន IPv6`,cidrv4:`ដែនអាសយដ្ឋាន IPv4`,cidrv6:`ដែនអាសយដ្ឋាន IPv6`,base64:`ខ្សែអក្សរអ៊ិកូដ base64`,base64url:`ខ្សែអក្សរអ៊ិកូដ base64url`,json_string:`ខ្សែអក្សរ JSON`,e164:`លេខ E.164`,jwt:`JWT`,template_literal:`ទិន្នន័យបញ្ចូល`},r={nan:`NaN`,number:`លេខ`,array:`អារេ (Array)`,null:`គ្មានតម្លៃ (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${e.expected} ប៉ុន្តែទទួលបាន ${i}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${t} ប៉ុន្តែទទួលបាន ${i}`}case`invalid_value`:return e.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${I(e.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()} ${r.unit??`ធាតុ`}`:`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()} ${r.unit}`:`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${t.prefix}"`:t.format===`ends_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${t.suffix}"`:t.format===`includes`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${t.includes}"`:t.format===`regex`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${t.pattern}`:`មិនត្រឹមត្រូវ៖ ${n[t.format]??e.format}`}case`not_multiple_of`:return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${e.divisor}`;case`unrecognized_keys`:return`រកឃើញសោមិនស្គាល់៖ ${N(e.keys,`, `)}`;case`invalid_key`:return`សោមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;case`invalid_union`:return`ទិន្នន័យមិនត្រឹមត្រូវ`;case`invalid_element`:return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;default:return`ទិន្នន័យមិនត្រឹមត្រូវ`}}};function xl(){return{localeError:bl()}}function Sl(){return xl()}var Cl=()=>{let e={string:{unit:`문자`,verb:`to have`},file:{unit:`바이트`,verb:`to have`},array:{unit:`개`,verb:`to have`},set:{unit:`개`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`입력`,email:`이메일 주소`,url:`URL`,emoji:`이모지`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO 날짜시간`,date:`ISO 날짜`,time:`ISO 시간`,duration:`ISO 기간`,ipv4:`IPv4 주소`,ipv6:`IPv6 주소`,cidrv4:`IPv4 범위`,cidrv6:`IPv6 범위`,base64:`base64 인코딩 문자열`,base64url:`base64url 인코딩 문자열`,json_string:`JSON 문자열`,e164:`E.164 번호`,jwt:`JWT`,template_literal:`입력`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`잘못된 입력: 예상 타입은 instanceof ${e.expected}, 받은 타입은 ${i}입니다`:`잘못된 입력: 예상 타입은 ${t}, 받은 타입은 ${i}입니다`}case`invalid_value`:return e.values.length===1?`잘못된 입력: 값은 ${I(e.values[0])} 이어야 합니다`:`잘못된 옵션: ${N(e.values,`또는 `)} 중 하나여야 합니다`;case`too_big`:{let n=e.inclusive?`이하`:`미만`,r=n===`미만`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()} ${n}${r}`}case`too_small`:{let n=e.inclusive?`이상`:`초과`,r=n===`이상`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()} ${n}${r}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`잘못된 문자열: "${t.prefix}"(으)로 시작해야 합니다`:t.format===`ends_with`?`잘못된 문자열: "${t.suffix}"(으)로 끝나야 합니다`:t.format===`includes`?`잘못된 문자열: "${t.includes}"을(를) 포함해야 합니다`:t.format===`regex`?`잘못된 문자열: 정규식 ${t.pattern} 패턴과 일치해야 합니다`:`잘못된 ${n[t.format]??e.format}`}case`not_multiple_of`:return`잘못된 숫자: ${e.divisor}의 배수여야 합니다`;case`unrecognized_keys`:return`인식할 수 없는 키: ${N(e.keys,`, `)}`;case`invalid_key`:return`잘못된 키: ${e.origin}`;case`invalid_union`:return`잘못된 입력`;case`invalid_element`:return`잘못된 값: ${e.origin}`;default:return`잘못된 입력`}}};function wl(){return{localeError:Cl()}}var Tl=e=>e.charAt(0).toUpperCase()+e.slice(1);function El(e){let t=Math.abs(e),n=t%10,r=t%100;return r>=11&&r<=19||n===0?`many`:n===1?`one`:`few`}var Dl=()=>{let e={string:{unit:{one:`simbolis`,few:`simboliai`,many:`simbolių`},verb:{smaller:{inclusive:`turi būti ne ilgesnė kaip`,notInclusive:`turi būti trumpesnė kaip`},bigger:{inclusive:`turi būti ne trumpesnė kaip`,notInclusive:`turi būti ilgesnė kaip`}}},file:{unit:{one:`baitas`,few:`baitai`,many:`baitų`},verb:{smaller:{inclusive:`turi būti ne didesnis kaip`,notInclusive:`turi būti mažesnis kaip`},bigger:{inclusive:`turi būti ne mažesnis kaip`,notInclusive:`turi būti didesnis kaip`}}},array:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}},set:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}}};function t(t,n,r,i){let a=e[t]??null;return a===null?a:{unit:a.unit[n],verb:a.verb[i][r?`inclusive`:`notInclusive`]}}let n={regex:`įvestis`,email:`el. pašto adresas`,url:`URL`,emoji:`jaustukas`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO data ir laikas`,date:`ISO data`,time:`ISO laikas`,duration:`ISO trukmė`,ipv4:`IPv4 adresas`,ipv6:`IPv6 adresas`,cidrv4:`IPv4 tinklo prefiksas (CIDR)`,cidrv6:`IPv6 tinklo prefiksas (CIDR)`,base64:`base64 užkoduota eilutė`,base64url:`base64url užkoduota eilutė`,json_string:`JSON eilutė`,e164:`E.164 numeris`,jwt:`JWT`,template_literal:`įvestis`},r={nan:`NaN`,number:`skaičius`,bigint:`sveikasis skaičius`,string:`eilutė`,boolean:`loginė reikšmė`,undefined:`neapibrėžta reikšmė`,function:`funkcija`,symbol:`simbolis`,array:`masyvas`,object:`objektas`,null:`nulinė reikšmė`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Gautas tipas ${i}, o tikėtasi - instanceof ${e.expected}`:`Gautas tipas ${i}, o tikėtasi - ${t}`}case`invalid_value`:return e.values.length===1?`Privalo būti ${I(e.values[0])}`:`Privalo būti vienas iš ${N(e.values,`|`)} pasirinkimų`;case`too_big`:{let n=r[e.origin]??e.origin,i=t(e.origin,El(Number(e.maximum)),e.inclusive??!1,`smaller`);if(i?.verb)return`${Tl(n??e.origin??`reikšmė`)} ${i.verb} ${e.maximum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne didesnis kaip`:`mažesnis kaip`;return`${Tl(n??e.origin??`reikšmė`)} turi būti ${a} ${e.maximum.toString()} ${i?.unit}`}case`too_small`:{let n=r[e.origin]??e.origin,i=t(e.origin,El(Number(e.minimum)),e.inclusive??!1,`bigger`);if(i?.verb)return`${Tl(n??e.origin??`reikšmė`)} ${i.verb} ${e.minimum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne mažesnis kaip`:`didesnis kaip`;return`${Tl(n??e.origin??`reikšmė`)} turi būti ${a} ${e.minimum.toString()} ${i?.unit}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Eilutė privalo prasidėti "${t.prefix}"`:t.format===`ends_with`?`Eilutė privalo pasibaigti "${t.suffix}"`:t.format===`includes`?`Eilutė privalo įtraukti "${t.includes}"`:t.format===`regex`?`Eilutė privalo atitikti ${t.pattern}`:`Neteisingas ${n[t.format]??e.format}`}case`not_multiple_of`:return`Skaičius privalo būti ${e.divisor} kartotinis.`;case`unrecognized_keys`:return`Neatpažint${e.keys.length>1?`i`:`as`} rakt${e.keys.length>1?`ai`:`as`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Rastas klaidingas raktas`;case`invalid_union`:return`Klaidinga įvestis`;case`invalid_element`:return`${Tl(r[e.origin]??e.origin??e.origin??`reikšmė`)} turi klaidingą įvestį`;default:return`Klaidinga įvestis`}}};function Ol(){return{localeError:Dl()}}var kl=()=>{let e={string:{unit:`знаци`,verb:`да имаат`},file:{unit:`бајти`,verb:`да имаат`},array:{unit:`ставки`,verb:`да имаат`},set:{unit:`ставки`,verb:`да имаат`}};function t(t){return e[t]??null}let n={regex:`внес`,email:`адреса на е-пошта`,url:`URL`,emoji:`емоџи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO датум и време`,date:`ISO датум`,time:`ISO време`,duration:`ISO времетраење`,ipv4:`IPv4 адреса`,ipv6:`IPv6 адреса`,cidrv4:`IPv4 опсег`,cidrv6:`IPv6 опсег`,base64:`base64-енкодирана низа`,base64url:`base64url-енкодирана низа`,json_string:`JSON низа`,e164:`E.164 број`,jwt:`JWT`,template_literal:`внес`},r={nan:`NaN`,number:`број`,array:`низа`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Грешен внес: се очекува instanceof ${e.expected}, примено ${i}`:`Грешен внес: се очекува ${t}, примено ${i}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${I(e.values[0])}`:`Грешана опција: се очекува една ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Премногу голем: се очекува ${e.origin??`вредноста`} да има ${n}${e.maximum.toString()} ${r.unit??`елементи`}`:`Премногу голем: се очекува ${e.origin??`вредноста`} да биде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Премногу мал: се очекува ${e.origin} да има ${n}${e.minimum.toString()} ${r.unit}`:`Премногу мал: се очекува ${e.origin} да биде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неважечка низа: мора да започнува со "${t.prefix}"`:t.format===`ends_with`?`Неважечка низа: мора да завршува со "${t.suffix}"`:t.format===`includes`?`Неважечка низа: мора да вклучува "${t.includes}"`:t.format===`regex`?`Неважечка низа: мора да одгоара на патернот ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Грешен број: мора да биде делив со ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Непрепознаени клучеви`:`Непрепознаен клуч`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Грешен клуч во ${e.origin}`;case`invalid_union`:return`Грешен внес`;case`invalid_element`:return`Грешна вредност во ${e.origin}`;default:return`Грешен внес`}}};function Al(){return{localeError:kl()}}var jl=()=>{let e={string:{unit:`aksara`,verb:`mempunyai`},file:{unit:`bait`,verb:`mempunyai`},array:{unit:`elemen`,verb:`mempunyai`},set:{unit:`elemen`,verb:`mempunyai`}};function t(t){return e[t]??null}let n={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`},r={nan:`NaN`,number:`nombor`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak sah: dijangka instanceof ${e.expected}, diterima ${i}`:`Input tidak sah: dijangka ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak sah: dijangka ${I(e.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: dijangka ${e.origin??`nilai`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: dijangka ${e.origin??`nilai`} adalah ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: dijangka ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: dijangka ${e.origin} adalah ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak sah: mesti bermula dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak sah: mesti berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak sah: mesti mengandungi "${t.includes}"`:t.format===`regex`?`String tidak sah: mesti sepadan dengan corak ${t.pattern}`:`${n[t.format]??e.format} tidak sah`}case`not_multiple_of`:return`Nombor tidak sah: perlu gandaan ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali: ${N(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak sah dalam ${e.origin}`;case`invalid_union`:return`Input tidak sah`;case`invalid_element`:return`Nilai tidak sah dalam ${e.origin}`;default:return`Input tidak sah`}}};function Ml(){return{localeError:jl()}}var Nl=()=>{let e={string:{unit:`tekens`,verb:`heeft`},file:{unit:`bytes`,verb:`heeft`},array:{unit:`elementen`,verb:`heeft`},set:{unit:`elementen`,verb:`heeft`}};function t(t){return e[t]??null}let n={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`},r={nan:`NaN`,number:`getal`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ongeldige invoer: verwacht instanceof ${e.expected}, ontving ${i}`:`Ongeldige invoer: verwacht ${t}, ontving ${i}`}case`invalid_value`:return e.values.length===1?`Ongeldige invoer: verwacht ${I(e.values[0])}`:`Ongeldige optie: verwacht één van ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin),i=e.origin===`date`?`laat`:e.origin===`string`?`lang`:`groot`;return r?`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} ${r.unit??`elementen`} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} is`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin),i=e.origin===`date`?`vroeg`:e.origin===`string`?`kort`:`klein`;return r?`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} is`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ongeldige tekst: moet met "${t.prefix}" beginnen`:t.format===`ends_with`?`Ongeldige tekst: moet op "${t.suffix}" eindigen`:t.format===`includes`?`Ongeldige tekst: moet "${t.includes}" bevatten`:t.format===`regex`?`Ongeldige tekst: moet overeenkomen met patroon ${t.pattern}`:`Ongeldig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ongeldig getal: moet een veelvoud van ${e.divisor} zijn`;case`unrecognized_keys`:return`Onbekende key${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Ongeldige key in ${e.origin}`;case`invalid_union`:return`Ongeldige invoer`;case`invalid_element`:return`Ongeldige waarde in ${e.origin}`;default:return`Ongeldige invoer`}}};function Pl(){return{localeError:Nl()}}var Fl=()=>{let e={string:{unit:`tegn`,verb:`å ha`},file:{unit:`bytes`,verb:`å ha`},array:{unit:`elementer`,verb:`å inneholde`},set:{unit:`elementer`,verb:`å inneholde`}};function t(t){return e[t]??null}let n={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åde`,ipv6:`IPv6-område`,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`},r={nan:`NaN`,number:`tall`,array:`liste`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldig input: forventet instanceof ${e.expected}, fikk ${i}`:`Ugyldig input: forventet ${t}, fikk ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig verdi: forventet ${I(e.values[0])}`:`Ugyldig valg: forventet en av ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()} ${r.unit??`elementer`}`:`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()} ${r.unit}`:`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: må starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: må ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: må inneholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: må matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldig tall: må være et multiplum av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukjente nøkler`:`Ukjent nøkkel`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøkkel i ${e.origin}`;case`invalid_union`:return`Ugyldig input`;case`invalid_element`:return`Ugyldig verdi i ${e.origin}`;default:return`Ugyldig input`}}};function Il(){return{localeError:Fl()}}var Ll=()=>{let e={string:{unit:`harf`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`unsur`,verb:`olmalıdır`},set:{unit:`unsur`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={regex:`giren`,email:`epostagâh`,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âmı`,date:`ISO tarihi`,time:`ISO zamanı`,duration:`ISO müddeti`,ipv4:`IPv4 nişânı`,ipv6:`IPv6 nişânı`,cidrv4:`IPv4 menzili`,cidrv6:`IPv6 menzili`,base64:`base64-şifreli metin`,base64url:`base64url-şifreli metin`,json_string:`JSON metin`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`giren`},r={nan:`NaN`,number:`numara`,array:`saf`,null:`gayb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Fâsit giren: umulan instanceof ${e.expected}, alınan ${i}`:`Fâsit giren: umulan ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Fâsit giren: umulan ${I(e.values[0])}`:`Fâsit tercih: mûteberler ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} ${r.unit??`elements`} sahip olmalıydı.`:`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} olmalıydı.`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} ${r.unit} sahip olmalıydı.`:`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} olmalıydı.`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Fâsit metin: "${t.prefix}" ile başlamalı.`:t.format===`ends_with`?`Fâsit metin: "${t.suffix}" ile bitmeli.`:t.format===`includes`?`Fâsit metin: "${t.includes}" ihtivâ etmeli.`:t.format===`regex`?`Fâsit metin: ${t.pattern} nakşına uymalı.`:`Fâsit ${n[t.format]??e.format}`}case`not_multiple_of`:return`Fâsit sayı: ${e.divisor} katı olmalıydı.`;case`unrecognized_keys`:return`Tanınmayan anahtar ${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} için tanınmayan anahtar var.`;case`invalid_union`:return`Giren tanınamadı.`;case`invalid_element`:return`${e.origin} için tanınmayan kıymet var.`;default:return`Kıymet tanınamadı.`}}};function Rl(){return{localeError:Ll()}}var zl=()=>{let e={string:{unit:`توکي`,verb:`ولري`},file:{unit:`بایټس`,verb:`ولري`},array:{unit:`توکي`,verb:`ولري`},set:{unit:`توکي`,verb:`ولري`}};function t(t){return e[t]??null}let n={regex:`ورودي`,email:`بریښنالیک`,url:`یو آر ال`,emoji:`ایموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`نیټه او وخت`,date:`نېټه`,time:`وخت`,duration:`موده`,ipv4:`د IPv4 پته`,ipv6:`د IPv6 پته`,cidrv4:`د IPv4 ساحه`,cidrv6:`د IPv6 ساحه`,base64:`base64-encoded متن`,base64url:`base64url-encoded متن`,json_string:`JSON متن`,e164:`د E.164 شمېره`,jwt:`JWT`,template_literal:`ورودي`},r={nan:`NaN`,number:`عدد`,array:`ارې`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ناسم ورودي: باید instanceof ${e.expected} وای, مګر ${i} ترلاسه شو`:`ناسم ورودي: باید ${t} وای, مګر ${i} ترلاسه شو`}case`invalid_value`:return e.values.length===1?`ناسم ورودي: باید ${I(e.values[0])} وای`:`ناسم انتخاب: باید یو له ${N(e.values,`|`)} څخه وای`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصرونه`} ولري`:`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} وي`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} ولري`:`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} وي`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ناسم متن: باید د "${t.prefix}" سره پیل شي`:t.format===`ends_with`?`ناسم متن: باید د "${t.suffix}" سره پای ته ورسيږي`:t.format===`includes`?`ناسم متن: باید "${t.includes}" ولري`:t.format===`regex`?`ناسم متن: باید د ${t.pattern} سره مطابقت ولري`:`${n[t.format]??e.format} ناسم دی`}case`not_multiple_of`:return`ناسم عدد: باید د ${e.divisor} مضرب وي`;case`unrecognized_keys`:return`ناسم ${e.keys.length>1?`کلیډونه`:`کلیډ`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`ناسم کلیډ په ${e.origin} کې`;case`invalid_union`:return`ناسمه ورودي`;case`invalid_element`:return`ناسم عنصر په ${e.origin} کې`;default:return`ناسمه ورودي`}}};function Bl(){return{localeError:zl()}}var Vl=()=>{let e={string:{unit:`znaków`,verb:`mieć`},file:{unit:`bajtów`,verb:`mieć`},array:{unit:`elementów`,verb:`mieć`},set:{unit:`elementów`,verb:`mieć`}};function t(t){return e[t]??null}let n={regex:`wyrażenie`,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ąg znaków zakodowany w formacie base64`,base64url:`ciąg znaków zakodowany w formacie base64url`,json_string:`ciąg znaków w formacie JSON`,e164:`liczba E.164`,jwt:`JWT`,template_literal:`wejście`},r={nan:`NaN`,number:`liczba`,array:`tablica`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${e.expected}, otrzymano ${i}`:`Nieprawidłowe dane wejściowe: oczekiwano ${t}, otrzymano ${i}`}case`invalid_value`:return e.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${I(e.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Za duża wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.maximum.toString()} ${r.unit??`elementów`}`:`Zbyt duż(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Za mała wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.minimum.toString()} ${r.unit??`elementów`}`:`Zbyt mał(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${t.prefix}"`:t.format===`ends_with`?`Nieprawidłowy ciąg znaków: musi kończyć się na "${t.suffix}"`:t.format===`includes`?`Nieprawidłowy ciąg znaków: musi zawierać "${t.includes}"`:t.format===`regex`?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${t.pattern}`:`Nieprawidłow(y/a/e) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nieprawidłowa liczba: musi być wielokrotnością ${e.divisor}`;case`unrecognized_keys`:return`Nierozpoznane klucze${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Nieprawidłowy klucz w ${e.origin}`;case`invalid_union`:return`Nieprawidłowe dane wejściowe`;case`invalid_element`:return`Nieprawidłowa wartość w ${e.origin}`;default:return`Nieprawidłowe dane wejściowe`}}};function Hl(){return{localeError:Vl()}}var Ul=()=>{let e={string:{unit:`caracteres`,verb:`ter`},file:{unit:`bytes`,verb:`ter`},array:{unit:`itens`,verb:`ter`},set:{unit:`itens`,verb:`ter`}};function t(t){return e[t]??null}let n={regex:`padrão`,email:`endereço 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ção ISO`,ipv4:`endereço IPv4`,ipv6:`endereço 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úmero E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,number:`número`,null:`nulo`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipo inválido: esperado instanceof ${e.expected}, recebido ${i}`:`Tipo inválido: esperado ${t}, recebido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: esperado ${I(e.values[0])}`:`Opção inválida: esperada uma das ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Muito grande: esperado que ${e.origin??`valor`} tivesse ${n}${e.maximum.toString()} ${r.unit??`elementos`}`:`Muito grande: esperado que ${e.origin??`valor`} fosse ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Muito pequeno: esperado que ${e.origin} tivesse ${n}${e.minimum.toString()} ${r.unit}`:`Muito pequeno: esperado que ${e.origin} fosse ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Texto inválido: deve começar com "${t.prefix}"`:t.format===`ends_with`?`Texto inválido: deve terminar com "${t.suffix}"`:t.format===`includes`?`Texto inválido: deve incluir "${t.includes}"`:t.format===`regex`?`Texto inválido: deve corresponder ao padrão ${t.pattern}`:`${n[t.format]??e.format} inválido`}case`not_multiple_of`:return`Número inválido: deve ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Chave${e.keys.length>1?`s`:``} desconhecida${e.keys.length>1?`s`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Chave inválida em ${e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido em ${e.origin}`;default:return`Campo inválido`}}};function Wl(){return{localeError:Ul()}}var Gl=()=>{let e={string:{unit:`caractere`,verb:`să aibă`},file:{unit:`octeți`,verb:`să aibă`},array:{unit:`elemente`,verb:`să aibă`},set:{unit:`elemente`,verb:`să aibă`},map:{unit:`intrări`,verb:`să aibă`}};function t(t){return e[t]??null}let n={regex:`intrare`,email:`adresă de 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:`dată și oră ISO`,date:`dată ISO`,time:`oră ISO`,duration:`durată ISO`,ipv4:`adresă IPv4`,ipv6:`adresă IPv6`,mac:`adresă MAC`,cidrv4:`interval IPv4`,cidrv6:`interval IPv6`,base64:`șir codat base64`,base64url:`șir codat base64url`,json_string:`șir JSON`,e164:`număr E.164`,jwt:`JWT`,template_literal:`intrare`},r={nan:`NaN`,string:`șir`,number:`număr`,boolean:`boolean`,function:`funcție`,array:`matrice`,object:`obiect`,undefined:`nedefinit`,symbol:`simbol`,bigint:`număr mare`,void:`void`,never:`never`,map:`hartă`,set:`set`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input);return`Intrare invalidă: așteptat ${t}, primit ${r[n]??n}`}case`invalid_value`:return e.values.length===1?`Intrare invalidă: așteptat ${I(e.values[0])}`:`Opțiune invalidă: așteptat una dintre ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Prea mare: așteptat ca ${e.origin??`valoarea`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`elemente`}`:`Prea mare: așteptat ca ${e.origin??`valoarea`} să fie ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Prea mic: așteptat ca ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Prea mic: așteptat ca ${e.origin} să fie ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Șir invalid: trebuie să înceapă cu "${t.prefix}"`:t.format===`ends_with`?`Șir invalid: trebuie să se termine cu "${t.suffix}"`:t.format===`includes`?`Șir invalid: trebuie să includă "${t.includes}"`:t.format===`regex`?`Șir invalid: trebuie să se potrivească cu modelul ${t.pattern}`:`Format invalid: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Număr invalid: trebuie să fie multiplu de ${e.divisor}`;case`unrecognized_keys`:return`Chei nerecunoscute: ${N(e.keys,`, `)}`;case`invalid_key`:return`Cheie invalidă în ${e.origin}`;case`invalid_union`:return`Intrare invalidă`;case`invalid_element`:return`Valoare invalidă în ${e.origin}`;default:return`Intrare invalidă`}}};function Kl(){return{localeError:Gl()}}function ql(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}var Jl=()=>{let e={string:{unit:{one:`символ`,few:`символа`,many:`символов`},verb:`иметь`},file:{unit:{one:`байт`,few:`байта`,many:`байт`},verb:`иметь`},array:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`},set:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`}};function t(t){return e[t]??null}let n={regex:`ввод`,email:`email адрес`,url:`URL`,emoji:`эмодзи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата и время`,date:`ISO дата`,time:`ISO время`,duration:`ISO длительность`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`строка в формате base64`,base64url:`строка в формате base64url`,json_string:`JSON строка`,e164:`номер E.164`,jwt:`JWT`,template_literal:`ввод`},r={nan:`NaN`,number:`число`,array:`массив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неверный ввод: ожидалось instanceof ${e.expected}, получено ${i}`:`Неверный ввод: ожидалось ${t}, получено ${i}`}case`invalid_value`:return e.values.length===1?`Неверный ввод: ожидалось ${I(e.values[0])}`:`Неверный вариант: ожидалось одно из ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=ql(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет иметь ${n}${e.maximum.toString()} ${t}`}return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=ql(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Слишком маленькое значение: ожидалось, что ${e.origin} будет иметь ${n}${e.minimum.toString()} ${t}`}return`Слишком маленькое значение: ожидалось, что ${e.origin} будет ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неверная строка: должна начинаться с "${t.prefix}"`:t.format===`ends_with`?`Неверная строка: должна заканчиваться на "${t.suffix}"`:t.format===`includes`?`Неверная строка: должна содержать "${t.includes}"`:t.format===`regex`?`Неверная строка: должна соответствовать шаблону ${t.pattern}`:`Неверный ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неверное число: должно быть кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспознанн${e.keys.length>1?`ые`:`ый`} ключ${e.keys.length>1?`и`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Неверный ключ в ${e.origin}`;case`invalid_union`:return`Неверные входные данные`;case`invalid_element`:return`Неверное значение в ${e.origin}`;default:return`Неверные входные данные`}}};function Yl(){return{localeError:Jl()}}var Xl=()=>{let e={string:{unit:`znakov`,verb:`imeti`},file:{unit:`bajtov`,verb:`imeti`},array:{unit:`elementov`,verb:`imeti`},set:{unit:`elementov`,verb:`imeti`}};function t(t){return e[t]??null}let n={regex:`vnos`,email:`e-poštni 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 čas`,date:`ISO datum`,time:`ISO čas`,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 številka`,jwt:`JWT`,template_literal:`vnos`},r={nan:`NaN`,number:`število`,array:`tabela`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neveljaven vnos: pričakovano instanceof ${e.expected}, prejeto ${i}`:`Neveljaven vnos: pričakovano ${t}, prejeto ${i}`}case`invalid_value`:return e.values.length===1?`Neveljaven vnos: pričakovano ${I(e.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} imelo ${n}${e.maximum.toString()} ${r.unit??`elementov`}`:`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Premajhno: pričakovano, da bo ${e.origin} imelo ${n}${e.minimum.toString()} ${r.unit}`:`Premajhno: pričakovano, da bo ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neveljaven niz: mora se začeti z "${t.prefix}"`:t.format===`ends_with`?`Neveljaven niz: mora se končati z "${t.suffix}"`:t.format===`includes`?`Neveljaven niz: mora vsebovati "${t.includes}"`:t.format===`regex`?`Neveljaven niz: mora ustrezati vzorcu ${t.pattern}`:`Neveljaven ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neveljavno število: mora biti večkratnik ${e.divisor}`;case`unrecognized_keys`:return`Neprepoznan${e.keys.length>1?`i ključi`:` ključ`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Neveljaven ključ v ${e.origin}`;case`invalid_union`:return`Neveljaven vnos`;case`invalid_element`:return`Neveljavna vrednost v ${e.origin}`;default:return`Neveljaven vnos`}}};function Zl(){return{localeError:Xl()}}var Ql=()=>{let e={string:{unit:`tecken`,verb:`att ha`},file:{unit:`bytes`,verb:`att ha`},array:{unit:`objekt`,verb:`att innehålla`},set:{unit:`objekt`,verb:`att innehålla`}};function t(t){return e[t]??null}let n={regex:`reguljärt 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äng`,base64url:`base64url-kodad sträng`,json_string:`JSON-sträng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`mall-literal`},r={nan:`NaN`,number:`antal`,array:`lista`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ogiltig inmatning: förväntat instanceof ${e.expected}, fick ${i}`:`Ogiltig inmatning: förväntat ${t}, fick ${i}`}case`invalid_value`:return e.values.length===1?`Ogiltig inmatning: förväntat ${I(e.values[0])}`:`Ogiltigt val: förväntade en av ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`För stor(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()} ${r.unit??`element`}`:`För stor(t): förväntat ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()} ${r.unit}`:`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ogiltig sträng: måste börja med "${t.prefix}"`:t.format===`ends_with`?`Ogiltig sträng: måste sluta med "${t.suffix}"`:t.format===`includes`?`Ogiltig sträng: måste innehålla "${t.includes}"`:t.format===`regex`?`Ogiltig sträng: måste matcha mönstret "${t.pattern}"`:`Ogiltig(t) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ogiltigt tal: måste vara en multipel av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Okända nycklar`:`Okänd nyckel`}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Ogiltig nyckel i ${e.origin??`värdet`}`;case`invalid_union`:return`Ogiltig input`;case`invalid_element`:return`Ogiltigt värde i ${e.origin??`värdet`}`;default:return`Ogiltig input`}}};function $l(){return{localeError:Ql()}}var eu=()=>{let e={string:{unit:`எழுத்துக்கள்`,verb:`கொண்டிருக்க வேண்டும்`},file:{unit:`பைட்டுகள்`,verb:`கொண்டிருக்க வேண்டும்`},array:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`},set:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`}};function t(t){return e[t]??null}let n={regex:`உள்ளீடு`,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:`ISO தேதி நேரம்`,date:`ISO தேதி`,time:`ISO நேரம்`,duration:`ISO கால அளவு`,ipv4:`IPv4 முகவரி`,ipv6:`IPv6 முகவரி`,cidrv4:`IPv4 வரம்பு`,cidrv6:`IPv6 வரம்பு`,base64:`base64-encoded சரம்`,base64url:`base64url-encoded சரம்`,json_string:`JSON சரம்`,e164:`E.164 எண்`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`எண்`,array:`அணி`,null:`வெறுமை`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${e.expected}, பெறப்பட்டது ${i}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${t}, பெறப்பட்டது ${i}`}case`invalid_value`:return e.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${I(e.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${N(e.values,`|`)} இல் ஒன்று`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ${r.unit??`உறுப்புகள்`} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ஆக இருக்க வேண்டும்`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ஆக இருக்க வேண்டும்`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`தவறான சரம்: "${t.prefix}" இல் தொடங்க வேண்டும்`:t.format===`ends_with`?`தவறான சரம்: "${t.suffix}" இல் முடிவடைய வேண்டும்`:t.format===`includes`?`தவறான சரம்: "${t.includes}" ஐ உள்ளடக்க வேண்டும்`:t.format===`regex`?`தவறான சரம்: ${t.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${n[t.format]??e.format}`}case`not_multiple_of`:return`தவறான எண்: ${e.divisor} இன் பலமாக இருக்க வேண்டும்`;case`unrecognized_keys`:return`அடையாளம் தெரியாத விசை${e.keys.length>1?`கள்`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} இல் தவறான விசை`;case`invalid_union`:return`தவறான உள்ளீடு`;case`invalid_element`:return`${e.origin} இல் தவறான மதிப்பு`;default:return`தவறான உள்ளீடு`}}};function tu(){return{localeError:eu()}}var nu=()=>{let e={string:{unit:`ตัวอักษร`,verb:`ควรมี`},file:{unit:`ไบต์`,verb:`ควรมี`},array:{unit:`รายการ`,verb:`ควรมี`},set:{unit:`รายการ`,verb:`ควรมี`}};function t(t){return e[t]??null}let n={regex:`ข้อมูลที่ป้อน`,email:`ที่อยู่อีเมล`,url:`URL`,emoji:`อิโมจิ`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`วันที่เวลาแบบ ISO`,date:`วันที่แบบ ISO`,time:`เวลาแบบ ISO`,duration:`ช่วงเวลาแบบ ISO`,ipv4:`ที่อยู่ IPv4`,ipv6:`ที่อยู่ IPv6`,cidrv4:`ช่วง IP แบบ IPv4`,cidrv6:`ช่วง IP แบบ IPv6`,base64:`ข้อความแบบ Base64`,base64url:`ข้อความแบบ Base64 สำหรับ URL`,json_string:`ข้อความแบบ JSON`,e164:`เบอร์โทรศัพท์ระหว่างประเทศ (E.164)`,jwt:`โทเคน JWT`,template_literal:`ข้อมูลที่ป้อน`},r={nan:`NaN`,number:`ตัวเลข`,array:`อาร์เรย์ (Array)`,null:`ไม่มีค่า (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${e.expected} แต่ได้รับ ${i}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${t} แต่ได้รับ ${i}`}case`invalid_value`:return e.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${I(e.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`ไม่เกิน`:`น้อยกว่า`,r=t(e.origin);return r?`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()} ${r.unit??`รายการ`}`:`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`อย่างน้อย`:`มากกว่า`,r=t(e.origin);return r?`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()} ${r.unit}`:`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${t.prefix}"`:t.format===`ends_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${t.suffix}"`:t.format===`includes`?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${t.includes}" อยู่ในข้อความ`:t.format===`regex`?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${t.pattern}`:`รูปแบบไม่ถูกต้อง: ${n[t.format]??e.format}`}case`not_multiple_of`:return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${e.divisor} ได้ลงตัว`;case`unrecognized_keys`:return`พบคีย์ที่ไม่รู้จัก: ${N(e.keys,`, `)}`;case`invalid_key`:return`คีย์ไม่ถูกต้องใน ${e.origin}`;case`invalid_union`:return`ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้`;case`invalid_element`:return`ข้อมูลไม่ถูกต้องใน ${e.origin}`;default:return`ข้อมูลไม่ถูกต้อง`}}};function ru(){return{localeError:nu()}}var iu=()=>{let e={string:{unit:`karakter`,verb:`olmalı`},file:{unit:`bayt`,verb:`olmalı`},array:{unit:`öğe`,verb:`olmalı`},set:{unit:`öğe`,verb:`olmalı`}};function t(t){return e[t]??null}let n={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üre`,ipv4:`IPv4 adresi`,ipv6:`IPv6 adresi`,cidrv4:`IPv4 aralığı`,cidrv6:`IPv6 aralığı`,base64:`base64 ile şifrelenmiş metin`,base64url:`base64url ile şifrelenmiş metin`,json_string:`JSON dizesi`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`Şablon dizesi`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Geçersiz değer: beklenen instanceof ${e.expected}, alınan ${i}`:`Geçersiz değer: beklenen ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Geçersiz değer: beklenen ${I(e.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()} ${r.unit??`öğe`}`:`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Geçersiz metin: "${t.prefix}" ile başlamalı`:t.format===`ends_with`?`Geçersiz metin: "${t.suffix}" ile bitmeli`:t.format===`includes`?`Geçersiz metin: "${t.includes}" içermeli`:t.format===`regex`?`Geçersiz metin: ${t.pattern} desenine uymalı`:`Geçersiz ${n[t.format]??e.format}`}case`not_multiple_of`:return`Geçersiz sayı: ${e.divisor} ile tam bölünebilmeli`;case`unrecognized_keys`:return`Tanınmayan anahtar${e.keys.length>1?`lar`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} içinde geçersiz anahtar`;case`invalid_union`:return`Geçersiz değer`;case`invalid_element`:return`${e.origin} içinde geçersiz değer`;default:return`Geçersiz değer`}}};function au(){return{localeError:iu()}}var ou=()=>{let e={string:{unit:`символів`,verb:`матиме`},file:{unit:`байтів`,verb:`матиме`},array:{unit:`елементів`,verb:`матиме`},set:{unit:`елементів`,verb:`матиме`}};function t(t){return e[t]??null}let n={regex:`вхідні дані`,email:`адреса електронної пошти`,url:`URL`,emoji:`емодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`дата та час ISO`,date:`дата ISO`,time:`час ISO`,duration:`тривалість ISO`,ipv4:`адреса IPv4`,ipv6:`адреса IPv6`,cidrv4:`діапазон IPv4`,cidrv6:`діапазон IPv6`,base64:`рядок у кодуванні base64`,base64url:`рядок у кодуванні base64url`,json_string:`рядок JSON`,e164:`номер E.164`,jwt:`JWT`,template_literal:`вхідні дані`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неправильні вхідні дані: очікується instanceof ${e.expected}, отримано ${i}`:`Неправильні вхідні дані: очікується ${t}, отримано ${i}`}case`invalid_value`:return e.values.length===1?`Неправильні вхідні дані: очікується ${I(e.values[0])}`:`Неправильна опція: очікується одне з ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Занадто велике: очікується, що ${e.origin??`значення`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`елементів`}`:`Занадто велике: очікується, що ${e.origin??`значення`} буде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Занадто мале: очікується, що ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Занадто мале: очікується, що ${e.origin} буде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неправильний рядок: повинен починатися з "${t.prefix}"`:t.format===`ends_with`?`Неправильний рядок: повинен закінчуватися на "${t.suffix}"`:t.format===`includes`?`Неправильний рядок: повинен містити "${t.includes}"`:t.format===`regex`?`Неправильний рядок: повинен відповідати шаблону ${t.pattern}`:`Неправильний ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неправильне число: повинно бути кратним ${e.divisor}`;case`unrecognized_keys`:return`Нерозпізнаний ключ${e.keys.length>1?`і`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`Неправильний ключ у ${e.origin}`;case`invalid_union`:return`Неправильні вхідні дані`;case`invalid_element`:return`Неправильне значення у ${e.origin}`;default:return`Неправильні вхідні дані`}}};function su(){return{localeError:ou()}}function cu(){return su()}var lu=()=>{let e={string:{unit:`حروف`,verb:`ہونا`},file:{unit:`بائٹس`,verb:`ہونا`},array:{unit:`آئٹمز`,verb:`ہونا`},set:{unit:`آئٹمز`,verb:`ہونا`}};function t(t){return e[t]??null}let n={regex:`ان پٹ`,email:`ای میل ایڈریس`,url:`یو آر ایل`,emoji:`ایموجی`,uuid:`یو یو آئی ڈی`,uuidv4:`یو یو آئی ڈی وی 4`,uuidv6:`یو یو آئی ڈی وی 6`,nanoid:`نینو آئی ڈی`,guid:`جی یو آئی ڈی`,cuid:`سی یو آئی ڈی`,cuid2:`سی یو آئی ڈی 2`,ulid:`یو ایل آئی ڈی`,xid:`ایکس آئی ڈی`,ksuid:`کے ایس یو آئی ڈی`,datetime:`آئی ایس او ڈیٹ ٹائم`,date:`آئی ایس او تاریخ`,time:`آئی ایس او وقت`,duration:`آئی ایس او مدت`,ipv4:`آئی پی وی 4 ایڈریس`,ipv6:`آئی پی وی 6 ایڈریس`,cidrv4:`آئی پی وی 4 رینج`,cidrv6:`آئی پی وی 6 رینج`,base64:`بیس 64 ان کوڈڈ سٹرنگ`,base64url:`بیس 64 یو آر ایل ان کوڈڈ سٹرنگ`,json_string:`جے ایس او این سٹرنگ`,e164:`ای 164 نمبر`,jwt:`جے ڈبلیو ٹی`,template_literal:`ان پٹ`},r={nan:`NaN`,number:`نمبر`,array:`آرے`,null:`نل`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`غلط ان پٹ: instanceof ${e.expected} متوقع تھا، ${i} موصول ہوا`:`غلط ان پٹ: ${t} متوقع تھا، ${i} موصول ہوا`}case`invalid_value`:return e.values.length===1?`غلط ان پٹ: ${I(e.values[0])} متوقع تھا`:`غلط آپشن: ${N(e.values,`|`)} میں سے ایک متوقع تھا`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`بہت بڑا: ${e.origin??`ویلیو`} کے ${n}${e.maximum.toString()} ${r.unit??`عناصر`} ہونے متوقع تھے`:`بہت بڑا: ${e.origin??`ویلیو`} کا ${n}${e.maximum.toString()} ہونا متوقع تھا`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`بہت چھوٹا: ${e.origin} کے ${n}${e.minimum.toString()} ${r.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${e.origin} کا ${n}${e.minimum.toString()} ہونا متوقع تھا`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`غلط سٹرنگ: "${t.prefix}" سے شروع ہونا چاہیے`:t.format===`ends_with`?`غلط سٹرنگ: "${t.suffix}" پر ختم ہونا چاہیے`:t.format===`includes`?`غلط سٹرنگ: "${t.includes}" شامل ہونا چاہیے`:t.format===`regex`?`غلط سٹرنگ: پیٹرن ${t.pattern} سے میچ ہونا چاہیے`:`غلط ${n[t.format]??e.format}`}case`not_multiple_of`:return`غلط نمبر: ${e.divisor} کا مضاعف ہونا چاہیے`;case`unrecognized_keys`:return`غیر تسلیم شدہ کی${e.keys.length>1?`ز`:``}: ${N(e.keys,`، `)}`;case`invalid_key`:return`${e.origin} میں غلط کی`;case`invalid_union`:return`غلط ان پٹ`;case`invalid_element`:return`${e.origin} میں غلط ویلیو`;default:return`غلط ان پٹ`}}};function uu(){return{localeError:lu()}}var du=()=>{let e={string:{unit:`belgi`,verb:`bo‘lishi kerak`},file:{unit:`bayt`,verb:`bo‘lishi kerak`},array:{unit:`element`,verb:`bo‘lishi kerak`},set:{unit:`element`,verb:`bo‘lishi kerak`},map:{unit:`yozuv`,verb:`bo‘lishi kerak`}};function t(t){return e[t]??null}let n={regex:`kirish`,email:`elektron pochta manzili`,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 sana va vaqti`,date:`ISO sana`,time:`ISO vaqt`,duration:`ISO davomiylik`,ipv4:`IPv4 manzil`,ipv6:`IPv6 manzil`,mac:`MAC manzil`,cidrv4:`IPv4 diapazon`,cidrv6:`IPv6 diapazon`,base64:`base64 kodlangan satr`,base64url:`base64url kodlangan satr`,json_string:`JSON satr`,e164:`E.164 raqam`,jwt:`JWT`,template_literal:`kirish`},r={nan:`NaN`,number:`raqam`,array:`massiv`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${e.expected}, qabul qilingan ${i}`:`Noto‘g‘ri kirish: kutilgan ${t}, qabul qilingan ${i}`}case`invalid_value`:return e.values.length===1?`Noto‘g‘ri kirish: kutilgan ${I(e.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()} ${r.unit} ${r.verb}`:`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Noto‘g‘ri satr: "${t.prefix}" bilan boshlanishi kerak`:t.format===`ends_with`?`Noto‘g‘ri satr: "${t.suffix}" bilan tugashi kerak`:t.format===`includes`?`Noto‘g‘ri satr: "${t.includes}" ni o‘z ichiga olishi kerak`:t.format===`regex`?`Noto‘g‘ri satr: ${t.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${n[t.format]??e.format}`}case`not_multiple_of`:return`Noto‘g‘ri raqam: ${e.divisor} ning karralisi bo‘lishi kerak`;case`unrecognized_keys`:return`Noma’lum kalit${e.keys.length>1?`lar`:``}: ${N(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} dagi kalit noto‘g‘ri`;case`invalid_union`:return`Noto‘g‘ri kirish`;case`invalid_element`:return`${e.origin} da noto‘g‘ri qiymat`;default:return`Noto‘g‘ri kirish`}}};function fu(){return{localeError:du()}}var pu=()=>{let e={string:{unit:`ký tự`,verb:`có`},file:{unit:`byte`,verb:`có`},array:{unit:`phần tử`,verb:`có`},set:{unit:`phần tử`,verb:`có`}};function t(t){return e[t]??null}let n={regex:`đầu vào`,email:`địa chỉ 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ày giờ ISO`,date:`ngày ISO`,time:`giờ ISO`,duration:`khoảng thời gian ISO`,ipv4:`địa chỉ IPv4`,ipv6:`địa chỉ IPv6`,cidrv4:`dải IPv4`,cidrv6:`dải IPv6`,base64:`chuỗi mã hóa base64`,base64url:`chuỗi mã hóa base64url`,json_string:`chuỗi JSON`,e164:`số E.164`,jwt:`JWT`,template_literal:`đầu vào`},r={nan:`NaN`,number:`số`,array:`mảng`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${e.expected}, nhận được ${i}`:`Đầu vào không hợp lệ: mong đợi ${t}, nhận được ${i}`}case`invalid_value`:return e.values.length===1?`Đầu vào không hợp lệ: mong đợi ${I(e.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Quá lớn: mong đợi ${e.origin??`giá trị`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`phần tử`}`:`Quá lớn: mong đợi ${e.origin??`giá trị`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Quá nhỏ: mong đợi ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Quá nhỏ: mong đợi ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chuỗi không hợp lệ: phải bắt đầu bằng "${t.prefix}"`:t.format===`ends_with`?`Chuỗi không hợp lệ: phải kết thúc bằng "${t.suffix}"`:t.format===`includes`?`Chuỗi không hợp lệ: phải bao gồm "${t.includes}"`:t.format===`regex`?`Chuỗi không hợp lệ: phải khớp với mẫu ${t.pattern}`:`${n[t.format]??e.format} không hợp lệ`}case`not_multiple_of`:return`Số không hợp lệ: phải là bội số của ${e.divisor}`;case`unrecognized_keys`:return`Khóa không được nhận dạng: ${N(e.keys,`, `)}`;case`invalid_key`:return`Khóa không hợp lệ trong ${e.origin}`;case`invalid_union`:return`Đầu vào không hợp lệ`;case`invalid_element`:return`Giá trị không hợp lệ trong ${e.origin}`;default:return`Đầu vào không hợp lệ`}}};function mu(){return{localeError:pu()}}var hu=()=>{let e={string:{unit:`字符`,verb:`包含`},file:{unit:`字节`,verb:`包含`},array:{unit:`项`,verb:`包含`},set:{unit:`项`,verb:`包含`}};function t(t){return e[t]??null}let n={regex:`输入`,email:`电子邮件`,url:`URL`,emoji:`表情符号`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日期时间`,date:`ISO日期`,time:`ISO时间`,duration:`ISO时长`,ipv4:`IPv4地址`,ipv6:`IPv6地址`,cidrv4:`IPv4网段`,cidrv6:`IPv6网段`,base64:`base64编码字符串`,base64url:`base64url编码字符串`,json_string:`JSON字符串`,e164:`E.164号码`,jwt:`JWT`,template_literal:`输入`},r={nan:`NaN`,number:`数字`,array:`数组`,null:`空值(null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`无效输入:期望 instanceof ${e.expected},实际接收 ${i}`:`无效输入:期望 ${t},实际接收 ${i}`}case`invalid_value`:return e.values.length===1?`无效输入:期望 ${I(e.values[0])}`:`无效选项:期望以下之一 ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()} ${r.unit??`个元素`}`:`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`无效字符串:必须以 "${t.prefix}" 开头`:t.format===`ends_with`?`无效字符串:必须以 "${t.suffix}" 结尾`:t.format===`includes`?`无效字符串:必须包含 "${t.includes}"`:t.format===`regex`?`无效字符串:必须满足正则表达式 ${t.pattern}`:`无效${n[t.format]??e.format}`}case`not_multiple_of`:return`无效数字:必须是 ${e.divisor} 的倍数`;case`unrecognized_keys`:return`出现未知的键(key): ${N(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} 中的键(key)无效`;case`invalid_union`:return`无效输入`;case`invalid_element`:return`${e.origin} 中包含无效值(value)`;default:return`无效输入`}}};function gu(){return{localeError:hu()}}var _u=()=>{let e={string:{unit:`字元`,verb:`擁有`},file:{unit:`位元組`,verb:`擁有`},array:{unit:`項目`,verb:`擁有`},set:{unit:`項目`,verb:`擁有`}};function t(t){return e[t]??null}let n={regex:`輸入`,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:`ISO 日期時間`,date:`ISO 日期`,time:`ISO 時間`,duration:`ISO 期間`,ipv4:`IPv4 位址`,ipv6:`IPv6 位址`,cidrv4:`IPv4 範圍`,cidrv6:`IPv6 範圍`,base64:`base64 編碼字串`,base64url:`base64url 編碼字串`,json_string:`JSON 字串`,e164:`E.164 數值`,jwt:`JWT`,template_literal:`輸入`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無效的輸入值:預期為 instanceof ${e.expected},但收到 ${i}`:`無效的輸入值:預期為 ${t},但收到 ${i}`}case`invalid_value`:return e.values.length===1?`無效的輸入值:預期為 ${I(e.values[0])}`:`無效的選項:預期為以下其中之一 ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()} ${r.unit??`個元素`}`:`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()} ${r.unit}`:`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無效的字串:必須以 "${t.prefix}" 開頭`:t.format===`ends_with`?`無效的字串:必須以 "${t.suffix}" 結尾`:t.format===`includes`?`無效的字串:必須包含 "${t.includes}"`:t.format===`regex`?`無效的字串:必須符合格式 ${t.pattern}`:`無效的 ${n[t.format]??e.format}`}case`not_multiple_of`:return`無效的數字:必須為 ${e.divisor} 的倍數`;case`unrecognized_keys`:return`無法識別的鍵值${e.keys.length>1?`們`:``}:${N(e.keys,`、`)}`;case`invalid_key`:return`${e.origin} 中有無效的鍵值`;case`invalid_union`:return`無效的輸入值`;case`invalid_element`:return`${e.origin} 中有無效的值`;default:return`無效的輸入值`}}};function vu(){return{localeError:_u()}}var yu=()=>{let e={string:{unit:`àmi`,verb:`ní`},file:{unit:`bytes`,verb:`ní`},array:{unit:`nkan`,verb:`ní`},set:{unit:`nkan`,verb:`ní`}};function t(t){return e[t]??null}let n={regex:`ẹ̀rọ ìbáwọlé`,email:`àdírẹ́sì ìmẹ́lì`,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:`àkókò ISO`,date:`ọjọ́ ISO`,time:`àkókò ISO`,duration:`àkókò tó pé ISO`,ipv4:`àdírẹ́sì IPv4`,ipv6:`àdírẹ́sì IPv6`,cidrv4:`àgbègbè IPv4`,cidrv6:`àgbègbè IPv6`,base64:`ọ̀rọ̀ tí a kọ́ ní base64`,base64url:`ọ̀rọ̀ base64url`,json_string:`ọ̀rọ̀ JSON`,e164:`nọ́mbà E.164`,jwt:`JWT`,template_literal:`ẹ̀rọ ìbáwọlé`},r={nan:`NaN`,number:`nọ́mbà`,array:`akopọ`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=L(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${e.expected}, àmọ̀ a rí ${i}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${t}, àmọ̀ a rí ${i}`}case`invalid_value`:return e.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${I(e.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${N(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tó pọ̀ jù: a ní láti jẹ́ pé ${e.origin??`iye`} ${r.verb} ${n}${e.maximum} ${r.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${n}${e.maximum}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Kéré ju: a ní láti jẹ́ pé ${e.origin} ${r.verb} ${n}${e.minimum} ${r.unit}`:`Kéré ju: a ní láti jẹ́ ${n}${e.minimum}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${t.prefix}"`:t.format===`ends_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${t.suffix}"`:t.format===`includes`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${t.includes}"`:t.format===`regex`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${t.pattern}`:`Aṣìṣe: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${e.divisor}`;case`unrecognized_keys`:return`Bọtìnì àìmọ̀: ${N(e.keys,`, `)}`;case`invalid_key`:return`Bọtìnì aṣìṣe nínú ${e.origin}`;case`invalid_union`:return`Ìbáwọlé aṣìṣe`;case`invalid_element`:return`Iye aṣìṣe nínú ${e.origin}`;default:return`Ìbáwọlé aṣìṣe`}}};function bu(){return{localeError:yu()}}var xu=a({ar:()=>Sc,az:()=>wc,be:()=>Dc,bg:()=>kc,ca:()=>jc,cs:()=>Nc,da:()=>Fc,de:()=>Lc,el:()=>zc,en:()=>Vc,eo:()=>Uc,es:()=>Gc,fa:()=>qc,fi:()=>Yc,fr:()=>Zc,frCA:()=>$c,he:()=>tl,hr:()=>rl,hu:()=>al,hy:()=>ll,id:()=>dl,is:()=>pl,it:()=>hl,ja:()=>_l,ka:()=>yl,kh:()=>Sl,km:()=>xl,ko:()=>wl,lt:()=>Ol,mk:()=>Al,ms:()=>Ml,nl:()=>Pl,no:()=>Il,ota:()=>Rl,pl:()=>Hl,ps:()=>Bl,pt:()=>Wl,ro:()=>Kl,ru:()=>Yl,sl:()=>Zl,sv:()=>$l,ta:()=>tu,th:()=>ru,tr:()=>au,ua:()=>cu,uk:()=>su,ur:()=>uu,uz:()=>fu,vi:()=>mu,yo:()=>bu,zhCN:()=>gu,zhTW:()=>vu}),Su,Cu=Symbol(`ZodOutput`),wu=Symbol(`ZodInput`),Tu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Eu(){return new Tu}(Su=globalThis).__zod_globalRegistry??(Su.__zod_globalRegistry=Eu());var Du=globalThis.__zod_globalRegistry;function Ou(e,t){return new e({type:`string`,...F(t)})}function ku(e,t){return new e({type:`string`,coerce:!0,...F(t)})}function Au(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...F(t)})}function ju(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...F(t)})}function Mu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...F(t)})}function Nu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...F(t)})}function Pu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...F(t)})}function Fu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...F(t)})}function Iu(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...F(t)})}function Lu(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...F(t)})}function Ru(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...F(t)})}function zu(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...F(t)})}function Bu(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...F(t)})}function Vu(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...F(t)})}function Hu(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...F(t)})}function Uu(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...F(t)})}function Wu(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...F(t)})}function Gu(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...F(t)})}function Ku(e,t){return new e({type:`string`,format:`mac`,check:`string_format`,abort:!1,...F(t)})}function qu(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...F(t)})}function Ju(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...F(t)})}function Yu(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...F(t)})}function Xu(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...F(t)})}function Zu(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...F(t)})}function Qu(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...F(t)})}var $u={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function ed(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...F(t)})}function td(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...F(t)})}function nd(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...F(t)})}function rd(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...F(t)})}function id(e,t){return new e({type:`number`,checks:[],...F(t)})}function ad(e,t){return new e({type:`number`,coerce:!0,checks:[],...F(t)})}function od(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...F(t)})}function sd(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float32`,...F(t)})}function cd(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float64`,...F(t)})}function ld(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`int32`,...F(t)})}function ud(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`uint32`,...F(t)})}function dd(e,t){return new e({type:`boolean`,...F(t)})}function fd(e,t){return new e({type:`boolean`,coerce:!0,...F(t)})}function pd(e,t){return new e({type:`bigint`,...F(t)})}function md(e,t){return new e({type:`bigint`,coerce:!0,...F(t)})}function hd(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`int64`,...F(t)})}function gd(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`uint64`,...F(t)})}function _d(e,t){return new e({type:`symbol`,...F(t)})}function vd(e,t){return new e({type:`undefined`,...F(t)})}function yd(e,t){return new e({type:`null`,...F(t)})}function bd(e){return new e({type:`any`})}function xd(e){return new e({type:`unknown`})}function Sd(e,t){return new e({type:`never`,...F(t)})}function Cd(e,t){return new e({type:`void`,...F(t)})}function wd(e,t){return new e({type:`date`,...F(t)})}function Td(e,t){return new e({type:`date`,coerce:!0,...F(t)})}function Ed(e,t){return new e({type:`nan`,...F(t)})}function Dd(e,t){return new co({check:`less_than`,...F(t),value:e,inclusive:!1})}function Od(e,t){return new co({check:`less_than`,...F(t),value:e,inclusive:!0})}function kd(e,t){return new lo({check:`greater_than`,...F(t),value:e,inclusive:!1})}function Ad(e,t){return new lo({check:`greater_than`,...F(t),value:e,inclusive:!0})}function jd(e){return kd(0,e)}function Md(e){return Dd(0,e)}function Nd(e){return Od(0,e)}function Pd(e){return Ad(0,e)}function Fd(e,t){return new uo({check:`multiple_of`,...F(t),value:e})}function Id(e,t){return new mo({check:`max_size`,...F(t),maximum:e})}function Ld(e,t){return new ho({check:`min_size`,...F(t),minimum:e})}function Rd(e,t){return new go({check:`size_equals`,...F(t),size:e})}function zd(e,t){return new _o({check:`max_length`,...F(t),maximum:e})}function Bd(e,t){return new vo({check:`min_length`,...F(t),minimum:e})}function Vd(e,t){return new yo({check:`length_equals`,...F(t),length:e})}function Hd(e,t){return new xo({check:`string_format`,format:`regex`,...F(t),pattern:e})}function Ud(e){return new So({check:`string_format`,format:`lowercase`,...F(e)})}function Wd(e){return new Co({check:`string_format`,format:`uppercase`,...F(e)})}function Gd(e,t){return new wo({check:`string_format`,format:`includes`,...F(t),includes:e})}function Kd(e,t){return new To({check:`string_format`,format:`starts_with`,...F(t),prefix:e})}function qd(e,t){return new Eo({check:`string_format`,format:`ends_with`,...F(t),suffix:e})}function Jd(e,t,n){return new Oo({check:`property`,property:e,schema:t,...F(n)})}function Yd(e,t){return new ko({check:`mime_type`,mime:e,...F(t)})}function Xd(e){return new Ao({check:`overwrite`,tx:e})}function Zd(e){return Xd(t=>t.normalize(e))}function Qd(){return Xd(e=>e.trim())}function $d(){return Xd(e=>e.toLowerCase())}function ef(){return Xd(e=>e.toUpperCase())}function tf(){return Xd(e=>Mr(e))}function nf(e,t,n){return new e({type:`array`,element:t,...F(n)})}function rf(e,t,n){return new e({type:`union`,options:t,...F(n)})}function af(e,t,n){return new e({type:`union`,options:t,inclusive:!1,...F(n)})}function of(e,t,n,r){return new e({type:`union`,options:n,discriminator:t,...F(r)})}function sf(e,t,n){return new e({type:`intersection`,left:t,right:n})}function cf(e,t,n,r){let i=n instanceof R;return new e({type:`tuple`,items:t,rest:i?n:null,...F(i?r:n)})}function lf(e,t,n,r){return new e({type:`record`,keyType:t,valueType:n,...F(r)})}function uf(e,t,n,r){return new e({type:`map`,keyType:t,valueType:n,...F(r)})}function df(e,t,n){return new e({type:`set`,valueType:t,...F(n)})}function ff(e,t,n){return new e({type:`enum`,entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,...F(n)})}function pf(e,t,n){return new e({type:`enum`,entries:t,...F(n)})}function mf(e,t,n){return new e({type:`literal`,values:Array.isArray(t)?t:[t],...F(n)})}function hf(e,t){return new e({type:`file`,...F(t)})}function gf(e,t){return new e({type:`transform`,transform:t})}function _f(e,t){return new e({type:`optional`,innerType:t})}function vf(e,t){return new e({type:`nullable`,innerType:t})}function yf(e,t,n){return new e({type:`default`,innerType:t,get defaultValue(){return typeof n==`function`?n():Lr(n)}})}function bf(e,t,n){return new e({type:`nonoptional`,innerType:t,...F(n)})}function xf(e,t){return new e({type:`success`,innerType:t})}function Sf(e,t,n){return new e({type:`catch`,innerType:t,catchValue:typeof n==`function`?n:()=>n})}function Cf(e,t,n){return new e({type:`pipe`,in:t,out:n})}function wf(e,t){return new e({type:`readonly`,innerType:t})}function Tf(e,t,n){return new e({type:`template_literal`,parts:t,...F(n)})}function Ef(e,t){return new e({type:`lazy`,getter:t})}function Df(e,t){return new e({type:`promise`,innerType:t})}function Of(e,t,n){let r=F(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function kf(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...F(n)})}function Af(e,t){let n=jf(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ci(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ci(r))}},e(t.value,t)),t);return n}function jf(e,t){let n=new oo({check:`custom`,...F(t)});return n._zod.check=e,n}function Mf(e){let t=new oo({check:`describe`});return t._zod.onattach=[t=>{let n=Du.get(t)??{};Du.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function Nf(e){let t=new oo({check:`meta`});return t._zod.onattach=[t=>{let n=Du.get(t)??{};Du.add(t,{...n,...e})}],t._zod.check=()=>{},t}function Pf(e,t){let n=F(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??lc,c=e.Boolean??us,l=new s({type:`pipe`,in:new(e.String??No)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:o.has(r)?!1:(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l}function Ff(e,t,n,r={}){let i=F(r),a={...F(r),check:`string_format`,type:`string`,format:t,fn:typeof n==`function`?n:e=>n.test(e),...i};return n instanceof RegExp&&(a.pattern=n),new e(a)}function If(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Du,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function B(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,B(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&zf(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Lf(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
75
76
|
|
|
76
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const h=d[1];if(t===d[0]){a(d);continue}if(e.external){const y=(u=e.external.registry.get(d[0]))==null?void 0:u.id;if(t!==d[0]&&y){a(d);continue}}if((p=e.metadataRegistry.get(d[0]))==null?void 0:p.id){a(d);continue}if(h.cycle){a(d);continue}if(h.count>1&&e.reused==="ref"){a(d);continue}}}function Ns(e,t){var c,u,p,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=h=>{const m=e.seen.get(h);if(m.ref===null)return;const y=m.def??m.schema,S={...y},C=m.ref;if(m.ref=null,C){i(C);const x=e.seen.get(C),G=x.schema;if(G.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(y.allOf=y.allOf??[],y.allOf.push(G)):Object.assign(y,G),Object.assign(y,S),h._zod.parent===C)for(const V in y)V==="$ref"||V==="allOf"||V in S||delete y[V];if(G.$ref&&x.def)for(const V in y)V==="$ref"||V==="allOf"||V in x.def&&JSON.stringify(y[V])===JSON.stringify(x.def[V])&&delete y[V]}const L=h._zod.parent;if(L&&L!==C){i(L);const x=e.seen.get(L);if(x!=null&&x.schema.$ref&&(y.$ref=x.schema.$ref,x.def))for(const G in y)G==="$ref"||G==="allOf"||G in x.def&&JSON.stringify(y[G])===JSON.stringify(x.def[G])&&delete y[G]}e.override({zodSchema:h,jsonSchema:y,path:m.path??[]})};for(const h of[...e.seen.entries()].reverse())i(h[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(u=e.external.registry.get(t))==null?void 0:u.id;if(!h)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(h)}Object.assign(o,n.def??n.schema);const a=(p=e.metadataRegistry.get(t))==null?void 0:p.id;a!==void 0&&o.id===a&&delete o.id;const s=((d=e.external)==null?void 0:d.defs)??{};for(const h of e.seen.entries()){const m=h[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,s[m.defId]=m.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const h=JSON.parse(JSON.stringify(o));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:pn(t,"input",e.processors),output:pn(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function De(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return De(i.element,n);if(i.type==="set")return De(i.valueType,n);if(i.type==="lazy")return De(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return De(i.innerType,n);if(i.type==="intersection")return De(i.left,n)||De(i.right,n);if(i.type==="record"||i.type==="map")return De(i.keyType,n)||De(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:De(i.in,n)||De(i.out,n);if(i.type==="object"){for(const o in i.shape)if(De(i.shape[o],n))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(De(o,n))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(De(o,n))return!0;return!!(i.rest&&De(i.rest,n))}return!1}const K_=(e,t={})=>n=>{const i=bs({...n,processors:t});return he(e,i),Ss(i,e),Ns(i,e)},pn=(e,t,n={})=>i=>{const{libraryOptions:o,target:a}=i??{},s=bs({...o??{},target:a,io:t,processors:n});return he(e,s),Ss(s,e),Ns(s,e)},G_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},V_=(e,t,n,i)=>{const o=n;o.type="string";const{minimum:a,maximum:s,format:c,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof a=="number"&&(o.minLength=a),typeof s=="number"&&(o.maxLength=s),c&&(o.format=G_[c]??c,o.format===""&&delete o.format,c==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const d=[...u];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},H_=(e,t,n,i)=>{const o=n,{minimum:a,maximum:s,format:c,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:d}=e._zod.bag;typeof c=="string"&&c.includes("int")?o.type="integer":o.type="number";const h=typeof d=="number"&&d>=(a??Number.NEGATIVE_INFINITY),m=typeof p=="number"&&p<=(s??Number.POSITIVE_INFINITY),y=t.target==="draft-04"||t.target==="openapi-3.0";h?y?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d:typeof a=="number"&&(o.minimum=a),m?y?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p:typeof s=="number"&&(o.maximum=s),typeof u=="number"&&(o.multipleOf=u)},W_=(e,t,n,i)=>{n.type="boolean"},Q_=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},X_=(e,t,n,i)=>{n.not={}},Y_=(e,t,n,i)=>{},ep=(e,t,n,i)=>{},tp=(e,t,n,i)=>{const o=e._zod.def,a=Za(o.entries);a.every(s=>typeof s=="number")&&(n.type="number"),a.every(s=>typeof s=="string")&&(n.type="string"),n.enum=a},np=(e,t,n,i)=>{const o=e._zod.def,a=[];for(const s of o.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(s))}else a.push(s);if(a.length!==0)if(a.length===1){const s=a[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else a.every(s=>typeof s=="number")&&(n.type="number"),a.every(s=>typeof s=="string")&&(n.type="string"),a.every(s=>typeof s=="boolean")&&(n.type="boolean"),a.every(s=>s===null)&&(n.type="null"),n.enum=a},ip=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},op=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},rp=(e,t,n,i)=>{const o=n,a=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=he(a.element,t,{...i,path:[...i.path,"items"]})},ap=(e,t,n,i)=>{var p;const o=n,a=e._zod.def;o.type="object",o.properties={};const s=a.shape;for(const d in s)o.properties[d]=he(s[d],t,{...i,path:[...i.path,"properties",d]});const c=new Set(Object.keys(s)),u=new Set([...c].filter(d=>{const h=a.shape[d]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=a.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:a.catchall?a.catchall&&(o.additionalProperties=he(a.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},sp=(e,t,n,i)=>{const o=e._zod.def,a=o.inclusive===!1,s=o.options.map((c,u)=>he(c,t,{...i,path:[...i.path,a?"oneOf":"anyOf",u]}));a?n.oneOf=s:n.anyOf=s},lp=(e,t,n,i)=>{const o=e._zod.def,a=he(o.left,t,{...i,path:[...i.path,"allOf",0]}),s=he(o.right,t,{...i,path:[...i.path,"allOf",1]}),c=p=>"allOf"in p&&Object.keys(p).length===1,u=[...c(a)?a.allOf:[a],...c(s)?s.allOf:[s]];n.allOf=u},cp=(e,t,n,i)=>{const o=n,a=e._zod.def;o.type="object";const s=a.keyType,c=s._zod.bag,u=c==null?void 0:c.patterns;if(a.mode==="loose"&&u&&u.size>0){const d=he(a.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});o.patternProperties={};for(const h of u)o.patternProperties[h.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=he(a.keyType,t,{...i,path:[...i.path,"propertyNames"]})),o.additionalProperties=he(a.valueType,t,{...i,path:[...i.path,"additionalProperties"]});const p=s._zod.values;if(p){const d=[...p].filter(h=>typeof h=="string"||typeof h=="number");d.length>0&&(o.required=d)}},up=(e,t,n,i)=>{const o=e._zod.def,a=he(o.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},dp=(e,t,n,i)=>{const o=e._zod.def;he(o.innerType,t,i);const a=t.seen.get(e);a.ref=o.innerType},_p=(e,t,n,i)=>{const o=e._zod.def;he(o.innerType,t,i);const a=t.seen.get(e);a.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},pp=(e,t,n,i)=>{const o=e._zod.def;he(o.innerType,t,i);const a=t.seen.get(e);a.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},fp=(e,t,n,i)=>{const o=e._zod.def;he(o.innerType,t,i);const a=t.seen.get(e);a.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},gp=(e,t,n,i)=>{const o=e._zod.def,a=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?a?o.out:o.in:o.out;he(s,t,i);const c=t.seen.get(e);c.ref=s},hp=(e,t,n,i)=>{const o=e._zod.def;he(o.innerType,t,i);const a=t.seen.get(e);a.ref=o.innerType,n.readOnly=!0},Es=(e,t,n,i)=>{const o=e._zod.def;he(o.innerType,t,i);const a=t.seen.get(e);a.ref=o.innerType},Os=v("ZodISODateTime",(e,t)=>{bd.init(e,t),ae.init(e,t)});function mp(e){return C_(Os,e)}const Is=v("ZodISODate",(e,t)=>{Sd.init(e,t),ae.init(e,t)});function yp(e){return z_(Is,e)}const ks=v("ZodISOTime",(e,t)=>{Nd.init(e,t),ae.init(e,t)});function wp(e){return D_(ks,e)}const As=v("ZodISODuration",(e,t)=>{Ed.init(e,t),ae.init(e,t)});function vp(e){return x_(As,e)}const bp=(e,t)=>{Ja.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Va(e,n)},flatten:{value:n=>Ga(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Kn,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Kn,2)}},isEmpty:{get(){return e.issues.length===0}}})},Me=v("ZodError",bp,{Parent:Error}),Ts=wi(Me),Cs=vi(Me),zs=mn(Me),Ds=yn(Me),xs=gu(Me),$s=hu(Me),Rs=mu(Me),Ls=yu(Me),Ps=wu(Me),Us=vu(Me),Fs=bu(Me),Zs=Su(Me),no=new WeakMap;function Vt(e,t,n){const i=Object.getPrototypeOf(e);let o=no.get(i);if(o||(o=new Set,no.set(i,o)),!o.has(t)){o.add(t);for(const a in n){const s=n[a];Object.defineProperty(i,a,{configurable:!0,enumerable:!1,get(){const c=s.bind(this);return Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const ne=v("ZodType",(e,t)=>(ie.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:pn(e,"input"),output:pn(e,"output")}}),e.toJSONSchema=K_(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,i)=>Ts(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>zs(e,n,i),e.parseAsync=async(n,i)=>Cs(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>Ds(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>xs(e,n,i),e.decode=(n,i)=>$s(e,n,i),e.encodeAsync=async(n,i)=>Rs(e,n,i),e.decodeAsync=async(n,i)=>Ls(e,n,i),e.safeEncode=(n,i)=>Ps(e,n,i),e.safeDecode=(n,i)=>Us(e,n,i),e.safeEncodeAsync=async(n,i)=>Fs(e,n,i),e.safeDecodeAsync=async(n,i)=>Zs(e,n,i),Vt(e,"ZodType",{check(...n){const i=this.def;return this.clone(ct(i,{checks:[...i.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return it(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(xl(n,i))},superRefine(n,i){return this.check($l(n,i))},overwrite(n){return this.check(yt(n))},optional(){return ei(this)},exactOptional(){return bl(this)},nullable(){return ti(this)},nullish(){return ei(ti(this))},nonoptional(n){return kl(this,n)},array(){return E(this)},or(n){return Ue([this,n])},and(n){return ml(this,n)},transform(n){return ni(this,ki(n))},default(n){return El(this,n)},prefault(n){return Il(this,n)},catch(n){return Tl(this,n)},pipe(n){return ni(this,n)},readonly(){return Dl(this)},describe(n){const i=this.clone();return Ot.add(i,{description:n}),i},meta(...n){if(n.length===0)return Ot.get(this);const i=this.clone();return Ot.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){var n;return(n=Ot.get(e))==null?void 0:n.description},configurable:!0}),e)),Ei=v("_ZodString",(e,t)=>{bi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,o,a)=>V_(e,i,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Vt(e,"_ZodString",{regex(...i){return this.check(us(...i))},includes(...i){return this.check(ps(...i))},startsWith(...i){return this.check(fs(...i))},endsWith(...i){return this.check(gs(...i))},min(...i){return this.check(qt(...i))},max(...i){return this.check(Si(...i))},length(...i){return this.check(Ni(...i))},nonempty(...i){return this.check(qt(1,...i))},lowercase(i){return this.check(ds(i))},uppercase(i){return this.check(_s(i))},trim(){return this.check(ms())},normalize(...i){return this.check(hs(...i))},toLowerCase(){return this.check(ys())},toUpperCase(){return this.check(ws())},slugify(){return this.check(vs())}})}),Ms=v("ZodString",(e,t)=>{bi.init(e,t),Ei.init(e,t),e.email=n=>e.check(c_(js,n)),e.url=n=>e.check(f_(qs,n)),e.jwt=n=>e.check(T_(ol,n)),e.emoji=n=>e.check(g_(Bs,n)),e.guid=n=>e.check(to(Qn,n)),e.uuid=n=>e.check(u_(Lt,n)),e.uuidv4=n=>e.check(d_(Lt,n)),e.uuidv6=n=>e.check(__(Lt,n)),e.uuidv7=n=>e.check(p_(Lt,n)),e.nanoid=n=>e.check(h_(Js,n)),e.guid=n=>e.check(to(Qn,n)),e.cuid=n=>e.check(m_(Ks,n)),e.cuid2=n=>e.check(y_(Gs,n)),e.ulid=n=>e.check(w_(Vs,n)),e.base64=n=>e.check(I_(tl,n)),e.base64url=n=>e.check(k_(nl,n)),e.xid=n=>e.check(v_(Hs,n)),e.ksuid=n=>e.check(b_(Ws,n)),e.ipv4=n=>e.check(S_(Qs,n)),e.ipv6=n=>e.check(N_(Xs,n)),e.cidrv4=n=>e.check(E_(Ys,n)),e.cidrv6=n=>e.check(O_(el,n)),e.e164=n=>e.check(A_(il,n)),e.datetime=n=>e.check(mp(n)),e.date=n=>e.check(yp(n)),e.time=n=>e.check(wp(n)),e.duration=n=>e.check(vp(n))});function r(e){return l_(Ms,e)}const ae=v("ZodStringFormat",(e,t)=>{re.init(e,t),Ei.init(e,t)}),js=v("ZodEmail",(e,t)=>{_d.init(e,t),ae.init(e,t)}),Qn=v("ZodGUID",(e,t)=>{ud.init(e,t),ae.init(e,t)}),Lt=v("ZodUUID",(e,t)=>{dd.init(e,t),ae.init(e,t)}),qs=v("ZodURL",(e,t)=>{pd.init(e,t),ae.init(e,t)}),Bs=v("ZodEmoji",(e,t)=>{fd.init(e,t),ae.init(e,t)}),Js=v("ZodNanoID",(e,t)=>{gd.init(e,t),ae.init(e,t)}),Ks=v("ZodCUID",(e,t)=>{hd.init(e,t),ae.init(e,t)}),Gs=v("ZodCUID2",(e,t)=>{md.init(e,t),ae.init(e,t)}),Vs=v("ZodULID",(e,t)=>{yd.init(e,t),ae.init(e,t)}),Hs=v("ZodXID",(e,t)=>{wd.init(e,t),ae.init(e,t)}),Ws=v("ZodKSUID",(e,t)=>{vd.init(e,t),ae.init(e,t)}),Qs=v("ZodIPv4",(e,t)=>{Od.init(e,t),ae.init(e,t)}),Xs=v("ZodIPv6",(e,t)=>{Id.init(e,t),ae.init(e,t)}),Ys=v("ZodCIDRv4",(e,t)=>{kd.init(e,t),ae.init(e,t)}),el=v("ZodCIDRv6",(e,t)=>{Ad.init(e,t),ae.init(e,t)}),tl=v("ZodBase64",(e,t)=>{Td.init(e,t),ae.init(e,t)}),nl=v("ZodBase64URL",(e,t)=>{zd.init(e,t),ae.init(e,t)}),il=v("ZodE164",(e,t)=>{Dd.init(e,t),ae.init(e,t)}),ol=v("ZodJWT",(e,t)=>{$d.init(e,t),ae.init(e,t)}),Oi=v("ZodNumber",(e,t)=>{is.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,o,a)=>H_(e,i,o),Vt(e,"ZodNumber",{gt(i,o){return this.check(Hn(i,o))},gte(i,o){return this.check(sn(i,o))},min(i,o){return this.check(sn(i,o))},lt(i,o){return this.check(Vn(i,o))},lte(i,o){return this.check(an(i,o))},max(i,o){return this.check(an(i,o))},int(i){return this.check(Xn(i))},safe(i){return this.check(Xn(i))},positive(i){return this.check(Hn(0,i))},nonnegative(i){return this.check(sn(0,i))},negative(i){return this.check(Vn(0,i))},nonpositive(i){return this.check(an(0,i))},multipleOf(i,o){return this.check(Wn(i,o))},step(i,o){return this.check(Wn(i,o))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return $_(Oi,e)}const rl=v("ZodNumberFormat",(e,t)=>{Rd.init(e,t),Oi.init(e,t)});function Xn(e){return R_(rl,e)}const al=v("ZodBoolean",(e,t)=>{Ld.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>W_(e,n,i)});function g(e){return L_(al,e)}const sl=v("ZodNull",(e,t)=>{Pd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Q_(e,n,i)});function ll(e){return P_(sl,e)}const cl=v("ZodAny",(e,t)=>{Ud.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Y_()});function M(){return U_(cl)}const ul=v("ZodUnknown",(e,t)=>{Fd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>ep()});function $e(){return F_(ul)}const dl=v("ZodNever",(e,t)=>{Zd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>X_(e,n,i)});function _l(e){return Z_(dl,e)}const pl=v("ZodArray",(e,t)=>{Md.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>rp(e,n,i,o),e.element=t.element,Vt(e,"ZodArray",{min(n,i){return this.check(qt(n,i))},nonempty(n){return this.check(qt(1,n))},max(n,i){return this.check(Si(n,i))},length(n,i){return this.check(Ni(n,i))},unwrap(){return this.element}})});function E(e,t){return M_(pl,e,t)}const fl=v("ZodObject",(e,t)=>{qd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>ap(e,n,i,o),H(e,"shape",()=>t.shape),Vt(e,"ZodObject",{keyof(){return O(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:$e()})},loose(){return this.clone({...this._zod.def,catchall:$e()})},strict(){return this.clone({...this._zod.def,catchall:_l()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return au(this,n)},safeExtend(n){return su(this,n)},merge(n){return lu(this,n)},pick(n){return ou(this,n)},omit(n){return ru(this,n)},partial(...n){return cu(Ai,this,n[0])},required(...n){return uu(Ti,this,n[0])}})});function f(e,t){const n={type:"object",shape:e??{},...T(t)};return new fl(n)}const Ii=v("ZodUnion",(e,t)=>{as.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>sp(e,n,i,o),e.options=t.options});function Ue(e,t){return new Ii({type:"union",options:e,...T(t)})}const gl=v("ZodDiscriminatedUnion",(e,t)=>{Ii.init(e,t),Bd.init(e,t)});function Dt(e,t,n){return new gl({type:"union",options:t,discriminator:e,...T(n)})}const hl=v("ZodIntersection",(e,t)=>{Jd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>lp(e,n,i,o)});function ml(e,t){return new hl({type:"intersection",left:e,right:t})}const Yn=v("ZodRecord",(e,t)=>{Kd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>cp(e,n,i,o),e.keyType=t.keyType,e.valueType=t.valueType});function P(e,t,n){return!t||!t._zod?new Yn({type:"record",keyType:r(),valueType:e,...T(t)}):new Yn({type:"record",keyType:e,valueType:t,...T(n)})}const Bt=v("ZodEnum",(e,t)=>{Gd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(i,o,a)=>tp(e,i,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(i,o)=>{const a={};for(const s of i)if(n.has(s))a[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Bt({...t,checks:[],...T(o),entries:a})},e.exclude=(i,o)=>{const a={...t.entries};for(const s of i)if(n.has(s))delete a[s];else throw new Error(`Key ${s} not found in enum`);return new Bt({...t,checks:[],...T(o),entries:a})}});function O(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Bt({type:"enum",entries:n,...T(t)})}function ht(e,t){return new Bt({type:"enum",entries:e,...T(t)})}const yl=v("ZodLiteral",(e,t)=>{Vd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>np(e,n,i),e.values=new Set(t.values),Object.defineProperty(e,"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 A(e,t){return new yl({type:"literal",values:Array.isArray(e)?e:[e],...T(t)})}const wl=v("ZodTransform",(e,t)=>{Hd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>op(e,n),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Fa(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(jt(a,n.value,t));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(jt(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(a=>(n.value=a,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function ki(e){return new wl({type:"transform",transform:e})}const Ai=v("ZodOptional",(e,t)=>{ss.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Es(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function ei(e){return new Ai({type:"optional",innerType:e})}const vl=v("ZodExactOptional",(e,t)=>{Wd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Es(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function bl(e){return new vl({type:"optional",innerType:e})}const Sl=v("ZodNullable",(e,t)=>{Qd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>up(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function ti(e){return new Sl({type:"nullable",innerType:e})}const Nl=v("ZodDefault",(e,t)=>{Xd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>_p(e,n,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function El(e,t){return new Nl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ja(t)}})}const Ol=v("ZodPrefault",(e,t)=>{Yd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>pp(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function Il(e,t){return new Ol({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ja(t)}})}const Ti=v("ZodNonOptional",(e,t)=>{e_.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>dp(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function kl(e,t){return new Ti({type:"nonoptional",innerType:e,...T(t)})}const Al=v("ZodCatch",(e,t)=>{t_.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>fp(e,n,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tl(e,t){return new Al({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ci=v("ZodPipe",(e,t)=>{ls.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>gp(e,n,i,o),e.in=t.in,e.out=t.out});function ni(e,t){return new Ci({type:"pipe",in:e,out:t})}const Cl=v("ZodPreprocess",(e,t)=>{Ci.init(e,t),n_.init(e,t)}),zl=v("ZodReadonly",(e,t)=>{i_.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>hp(e,n,i,o),e.unwrap=()=>e._zod.def.innerType});function Dl(e){return new zl({type:"readonly",innerType:e})}const zi=v("ZodCustom",(e,t)=>{o_.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,i,o)=>ip(e,n)});function ii(e,t){return j_(zi,()=>!0,t)}function xl(e,t={}){return q_(zi,e,t)}function $l(e,t){return B_(e,t)}function Rl(e,t){return new Cl({type:"pipe",in:ki(e),out:t})}const ft={custom:"custom"};Xe(a_());const Sp=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:cl,ZodArray:pl,ZodBase64:tl,ZodBase64URL:nl,ZodBoolean:al,ZodCIDRv4:Ys,ZodCIDRv6:el,ZodCUID:Ks,ZodCUID2:Gs,ZodCatch:Al,ZodCustom:zi,ZodDefault:Nl,ZodDiscriminatedUnion:gl,ZodE164:il,ZodEmail:js,ZodEmoji:Bs,ZodEnum:Bt,ZodExactOptional:vl,ZodGUID:Qn,ZodIPv4:Qs,ZodIPv6:Xs,ZodISODate:Is,ZodISODateTime:Os,ZodISODuration:As,ZodISOTime:ks,ZodIntersection:hl,ZodIssueCode:ft,ZodJWT:ol,ZodKSUID:Ws,ZodLiteral:yl,ZodNanoID:Js,ZodNever:dl,ZodNonOptional:Ti,ZodNull:sl,ZodNullable:Sl,ZodNumber:Oi,ZodNumberFormat:rl,ZodObject:fl,ZodOptional:Ai,ZodPipe:Ci,ZodPrefault:Ol,ZodPreprocess:Cl,ZodReadonly:zl,ZodRealError:Me,ZodRecord:Yn,ZodString:Ms,ZodStringFormat:ae,ZodTransform:wl,ZodType:ne,ZodULID:Vs,ZodURL:qs,ZodUUID:Lt,ZodUnion:Ii,ZodUnknown:ul,ZodXID:Hs,_ZodString:Ei,_default:El,any:M,array:E,boolean:g,catch:Tl,clone:it,config:Xe,custom:ii,decode:$s,decodeAsync:Ls,discriminatedUnion:Dt,encode:xs,encodeAsync:Rs,endsWith:gs,enum:O,exactOptional:bl,flattenError:Ga,formatError:Va,globalRegistry:Ot,gt:Hn,gte:sn,includes:ps,int:Xn,intersection:ml,length:Ni,literal:A,lowercase:ds,lt:Vn,lte:an,maxLength:Si,minLength:qt,multipleOf:Wn,nativeEnum:ht,never:_l,nonoptional:kl,normalize:hs,null:ll,nullable:ti,number:I,object:f,optional:ei,overwrite:yt,parse:Ts,parseAsync:Cs,pipe:ni,prefault:Il,preprocess:Rl,readonly:Dl,record:P,refine:xl,regex:us,registry:cs,safeDecode:Us,safeDecodeAsync:Zs,safeEncode:Ps,safeEncodeAsync:Fs,safeParse:zs,safeParseAsync:Ds,slugify:vs,startsWith:fs,string:r,superRefine:$l,toLowerCase:ys,toUpperCase:ws,transform:ki,trim:ms,union:Ue,unknown:$e,uppercase:_s},Symbol.toStringTag,{value:"Module"}));Wc(Sp);const Ge=f({created_at:r(),updated_at:r()}),Ll=f({id:r(),version:r().optional()}),Pl=f({name:r(),version:r()}),Ul=f({name:r(),value:r().optional()}),Fl=f({name:r().max(255),code:r().max(1e5),supported_triggers:E(Ll).optional(),runtime:r().max(50).optional(),dependencies:E(Pl).optional(),secrets:E(Ul).optional(),is_system:g().optional(),inherit:g().optional()});Fl.partial().extend({status:O(["draft","built"]).optional(),deployed_at:r().optional()});Fl.extend({id:r(),tenant_id:r(),status:O(["draft","built"]).default("built"),deployed_at:r().optional(),secrets:E(f({name:r(),value:r().optional()})).optional()}).extend(Ge.shape);const Np=r(),Ep=O(["unspecified","pending","final","partial","canceled","suspended"]),Op=f({id:r(),msg:r(),url:r().optional()}),Ip=f({action_name:r(),error:Op.nullable(),started_at:r(),ended_at:r()}),kp=f({level:O(["log","info","warn","error","debug"]),message:r()}),Ap=E(f({action_name:r(),lines:E(kp)})),Tp=f({id:r(),tenant_id:r(),trigger_id:Np,status:Ep,results:E(Ip),logs:Ap.optional(),created_at:r(),updated_at:r()});Tp.omit({tenant_id:!0,created_at:!0,updated_at:!0});const Cp=f({action_id:r(),code:r().max(1e5),runtime:r().max(50).optional(),dependencies:E(Pl).optional(),secrets:E(Ul).optional(),supported_triggers:E(Ll).optional(),deployed:g().default(!0)});Cp.extend({id:r(),tenant_id:r(),number:I().int()}).extend(Ge.shape);const zp=O(["user_action","admin_action","system","api"]),Dp=f({type:O(["user","admin","system","api_key","client_credentials"]),id:r().optional(),email:r().optional(),org_id:r().optional(),org_name:r().optional(),scopes:E(r()).optional(),client_id:r().optional()}),xp=f({type:r(),id:r(),before:P(r(),$e()).optional(),after:P(r(),$e()).optional(),diff:P(r(),f({old:$e(),new:$e()})).optional()}),$p=f({method:r(),path:r(),query:P(r(),r()).optional(),body:$e().optional(),ip:r(),user_agent:r().optional(),correlation_id:r().optional()}),Rp=f({status_code:I(),body:$e().optional()}),Lp=f({country_code:r(),city_name:r(),latitude:r(),longitude:r(),time_zone:r(),continent_code:r()}),Pp=f({name:r(),version:r(),env:P(r(),r()).optional()}),Up=f({tenant_id:r(),event_type:r(),log_type:r(),description:r().optional(),category:zp,actor:Dp,target:xp,request:$p,response:Rp.optional(),connection:r().optional(),strategy:r().optional(),strategy_type:r().optional(),audience:r().optional(),scope:r().optional(),location:Lp.optional(),auth0_client:Pp.optional(),hostname:r(),is_mobile:g().optional(),timestamp:r()});Up.extend({id:r()});O(["AUTH0","EMAIL","REDIRECT"]);O(["CREATE_USER","GET_USER","UPDATE_USER","SEND_REQUEST","SEND_EMAIL"]);O(["VERIFY_EMAIL"]);const Fp=f({require_mx_record:g().optional(),block_aliases:g().optional(),block_free_emails:g().optional(),block_disposable_emails:g().optional(),blocklist:E(r()).optional(),allowlist:E(r()).optional()}),Zp=f({id:r(),alias:r().max(100).optional(),type:A("AUTH0"),action:A("UPDATE_USER"),allow_failure:g().optional(),mask_output:g().optional(),params:f({connection_id:r().optional(),user_id:r(),changes:P(r(),M())})}),Mp=f({id:r(),alias:r().max(100).optional(),type:A("EMAIL"),action:A("VERIFY_EMAIL"),allow_failure:g().optional(),mask_output:g().optional(),params:f({email:r(),rules:Fp.optional()})}),jp=O(["change-email","account","custom"]),qp=f({id:r(),alias:r().max(100).optional(),type:A("REDIRECT"),action:A("REDIRECT_USER"),allow_failure:g().optional(),mask_output:g().optional(),params:f({target:jp.openapi({description:"The predefined target to redirect to, or 'custom' for a custom URL"}),custom_url:r().optional().openapi({description:"Custom URL to redirect to when target is 'custom'"})})}),Bp=Ue([Zp,Mp,qp]),Jp=f({name:r().min(1).max(150).openapi({description:"The name of the flow"}),actions:E(Bp).optional().default([]).openapi({description:"The list of actions to execute in sequence"})});Jp.extend(Ge.shape).extend({id:r().openapi({description:"Unique identifier for the flow",example:"af_12tMpdJ3iek7svMyZkSh5M"})});f({page:r().min(0).optional().default("0").transform(e=>parseInt(e,10)).openapi({description:"The page number where 0 is the first page"}),per_page:r().min(1).optional().default("10").transform(e=>parseInt(e,10)).openapi({description:"The number of items per page"}),include_totals:r().optional().default("false").transform(e=>e==="true").openapi({description:"If the total number of items should be included in the response"}),sort:r().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:r().optional().openapi({description:"A lucene query string used to filter the results"})});f({start:I(),limit:I(),length:I(),total:I().optional()});const Kp=f({email:r().optional(),email_verified:g().optional(),name:r().optional(),username:r().optional(),given_name:r().optional(),phone_number:r().optional(),phone_verified:g().optional(),family_name:r().optional()}).catchall(M()),Gp=f({connection:r(),user_id:r(),provider:r(),isSocial:g(),email:r().optional(),email_verified:g().optional(),phone_number:r().optional(),phone_verified:g().optional(),username:r().optional(),access_token:r().optional(),access_token_secret:r().optional(),refresh_token:r().optional(),profileData:Kp.optional()}),Vp=f({formatted:r().optional(),street_address:r().optional(),locality:r().optional(),region:r().optional(),postal_code:r().optional(),country:r().optional()}).optional(),Zl=f({email:r().transform(e=>e.toLowerCase()).optional(),username:r().refine(e=>!e.includes("@"),{message:'Usernames must not contain "@". Use the email field for email addresses.'}).optional(),phone_number:r().optional(),phone_verified:g().optional(),given_name:r().optional(),family_name:r().optional(),nickname:r().optional(),name:r().optional(),picture:r().optional(),locale:r().optional(),linked_to:r().optional(),profileData:r().optional(),user_id:r().optional(),app_metadata:M().default({}).optional(),user_metadata:M().default({}).optional(),middle_name:r().optional(),preferred_username:r().optional(),profile:r().optional(),website:r().optional(),gender:r().optional(),birthdate:r().optional(),zoneinfo:r().optional(),address:Vp}),Hp=Zl.extend({email_verified:g().default(!1),verify_email:g().optional(),last_ip:r().optional(),last_login:r().optional(),user_id:r().optional(),provider:r().optional(),connection:r(),is_social:g().optional(),registration_completed_at:r().optional(),password:f({hash:r(),algorithm:r()}).optional()}),Wp=Hp.omit({password:!0}).extend(Ge.shape).extend({user_id:r(),provider:r(),is_social:g(),email:r().optional(),login_count:I().default(0),identities:E(Gp).optional()});Wp.omit({registration_completed_at:!0});Zl.extend({login_count:I(),multifactor:E(r()).optional(),last_ip:r().optional(),last_login:r().optional(),user_id:r()}).catchall(M());let Qp="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Xp=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Qp[n[e]&63];return t};const Yp=f({client_id:r().optional().openapi({description:"ID of this client. Generated server-side if omitted (Auth0 behavior)."}),name:r().min(1).openapi({description:"Name of this client (min length: 1 character, does not allow < or >)."}),description:r().max(140).optional().openapi({description:"Free text description of this client (max length: 140 characters)."}),global:g().default(!1).openapi({description:"Whether this is your global 'All Applications' client representing legacy tenant settings (true) or a regular client (false)."}),client_secret:r().default(()=>Xp()).optional().openapi({description:"Client secret (which you must not make public)."}),app_type:O(["native","spa","regular_web","non_interactive","resource_server","express_configuration","rms","box","cloudbees","concur","dropbox","mscrm","echosign","egnyte","newrelic","office365","salesforce","sentry","sharepoint","slack","springcm","zendesk","zoom","sso_integration","oag"]).default("regular_web").optional().openapi({description:"The type of application this client represents"}),logo_uri:r().url().optional().openapi({description:"URL of the logo to display for this client. Recommended size is 150x150 pixels."}),is_first_party:g().default(!1).openapi({description:"Whether this client a first party client (true) or not (false)."}),oidc_conformant:g().default(!0).openapi({description:"Whether this client conforms to strict OIDC specifications (true) or uses legacy features (false)."}),auth0_conformant:g().default(!0).openapi({description:"Whether this client follows Auth0-compatible behavior (true) or strict OIDC behavior (false). When true, profile/email claims are included in the ID token when scopes are requested. When false, these claims are only available from the userinfo endpoint (strict OIDC 5.4 compliance)."}),callbacks:E(r()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted for Auth0 to use as a callback to the client after authentication."}),allowed_origins:E(r()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level (e.g., https://*.contoso.com). Query strings and hash information are not taken into account when validating these URLs."}),web_origins:E(r()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),client_aliases:E(r()).default([]).optional().openapi({description:"List of audiences/realms for SAML protocol. Used by the wsfed addon."}),allowed_clients:E(r()).default([]).optional().openapi({description:"List of allow clients and API ids that are allowed to make delegation requests. Empty means all all your clients are allowed."}),connections:E(r()).default([]).optional().openapi({description:"List of connection IDs enabled for this client. The order determines the display order on the login page."}),allowed_logout_urls:E(r()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),session_transfer:P(r(),M()).default({}).optional().openapi({description:"Native to Web SSO Configuration"}),oidc_logout:P(r(),M()).default({}).optional().openapi({description:"Configuration for OIDC backchannel logout"}),grant_types:E(r()).default([]).optional().openapi({description:"List of grant types supported for this application. Can include authorization_code, implicit, refresh_token, client_credentials, password, http://auth0.com/oauth/grant-type/password-realm, http://auth0.com/oauth/grant-type/mfa-oob, http://auth0.com/oauth/grant-type/mfa-otp, http://auth0.com/oauth/grant-type/mfa-recovery-code, urn:openid:params:grant-type:ciba, and urn:ietf:params:oauth:grant-type:device_code."}),jwt_configuration:P(r(),M()).default({}).optional().openapi({description:"Configuration related to JWTs for the client."}),signing_keys:E(P(r(),M())).default([]).optional().openapi({description:"Signing certificates associated with this client."}),encryption_key:P(r(),M()).default({}).optional().openapi({description:"Encryption used for WsFed responses with this client."}),sso:g().default(!1).openapi({description:"Applies only to SSO clients and determines whether Auth0 will handle Single Sign On (true) or whether the Identity Provider will (false)."}),sso_disabled:g().default(!1).openapi({description:"Whether Single Sign On is disabled for this client. When true, existing SSO sessions will not be reused and users must authenticate every time."}),cross_origin_authentication:g().default(!1).openapi({description:"Whether this client can be used to make cross-origin authentication requests (true) or it is not allowed to make such requests (false)."}),cross_origin_loc:r().url().optional().openapi({description:"URL of the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page."}),custom_login_page_on:g().default(!1).openapi({description:"Whether a custom login page is to be used (true) or the default provided login page (false)."}),custom_login_page:r().optional().openapi({description:"The content (HTML, CSS, JS) of the custom login page."}),custom_login_page_preview:r().optional().openapi({description:"The content (HTML, CSS, JS) of the custom login page. (Used on Previews)"}),form_template:r().optional().openapi({description:"HTML form template to be used for WS-Federation."}),addons:P(r(),M()).default({}).optional().openapi({description:"Addons enabled for this client and their associated configurations."}),token_endpoint_auth_method:O(["none","client_secret_post","client_secret_basic","client_secret_jwt","private_key_jwt"]).default("client_secret_basic").optional().openapi({description:"Defines the requested authentication method for the token endpoint. `none` (public client), `client_secret_post` / `client_secret_basic` (HTTP POST / Basic), `client_secret_jwt` (RFC 7523 HMAC assertion using client_secret), or `private_key_jwt` (RFC 7523 asymmetric assertion verified against the client's `jwks` / `jwks_uri`)."}),client_metadata:P(r(),r().max(255)).default({}).optional().openapi({description:'Metadata associated with the client, in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed. Field names (max 255 chars) are alphanumeric and may only include the following special characters: :,-+=_*?"/()<>@ [Tab][Space]'}),hide_sign_up_disabled_error:g().default(!1).optional().openapi({description:"Enumeration-safe variant of the connection-level `disable_signup` flag. When a signup is blocked by the password connection and this is true, the identifier screen does not reveal that an email is unknown — it advances to the OTP/password challenge as if the account existed and fails at credential check. Mitigates email enumeration at the cost of UX: users without an account see a generic credential failure instead of an explicit signup-disabled message."}),mobile:P(r(),M()).default({}).optional().openapi({description:"Additional configuration for native mobile apps."}),initiate_login_uri:r().url().optional().openapi({description:"Initiate login uri, must be https"}),native_social_login:P(r(),M()).default({}).optional(),refresh_token:f({rotation_type:O(["rotating","non-rotating"]).optional().openapi({description:"Whether refresh tokens for this client are rotated on every exchange (Auth0 'rotating' behavior) or kept stable (legacy non-rotating). Defaults to 'non-rotating' when unset."}),leeway:I().int().min(0).max(600).optional().openapi({description:"Seconds after a parent token's first rotation during which presenting it again still mints a fresh sibling child instead of triggering reuse-detection. Defaults to 30s when unset."}),expiration_type:O(["expiring","non-expiring"]).optional().openapi({description:"Auth0-compatible: whether refresh tokens expire."}),token_lifetime:I().int().min(0).optional().openapi({description:"Auth0-compatible: refresh-token absolute lifetime in seconds."}),infinite_token_lifetime:g().optional().openapi({description:"Auth0-compatible: when true, refresh tokens have no absolute expiry."}),idle_token_lifetime:I().int().min(0).optional().openapi({description:"Auth0-compatible: refresh-token idle (sliding) lifetime in seconds."}),infinite_idle_token_lifetime:g().optional().openapi({description:"Auth0-compatible: when true, refresh tokens have no idle expiry."})}).default({}).optional().openapi({description:"Refresh token configuration"}),default_organization:P(r(),M()).default({}).optional().openapi({description:"Defines the default Organization ID and flows"}),organization_usage:O(["deny","allow","require"]).default("deny").optional().openapi({description:"Defines how to proceed during an authentication transaction with regards an organization. Can be deny (default), allow or require."}),organization_require_behavior:O(["no_prompt","pre_login_prompt","post_login_prompt"]).default("no_prompt").optional().openapi({description:"Defines how to proceed during an authentication transaction when client.organization_usage: 'require'. Can be no_prompt (default), pre_login_prompt or post_login_prompt. post_login_prompt requires oidc_conformant: true."}),client_authentication_methods:P(r(),M()).default({}).optional().openapi({description:"Defines client authentication methods."}),require_pushed_authorization_requests:g().default(!1).openapi({description:"Makes the use of Pushed Authorization Requests mandatory for this client"}),require_proof_of_possession:g().default(!1).openapi({description:"Makes the use of Proof-of-Possession mandatory for this client"}),signed_request_object:P(r(),M()).default({}).optional().openapi({description:"JWT-secured Authorization Requests (JAR) settings."}),compliance_level:O(["none","fapi1_adv_pkj_par","fapi1_adv_mtls_par","fapi2_sp_pkj_mtls","fapi2_sp_mtls_mtls"]).optional().openapi({description:"Defines the compliance level for this client, which may restrict it's capabilities"}),par_request_expiry:I().optional().openapi({description:"Specifies how long, in seconds, a Pushed Authorization Request URI remains valid"}),token_quota:P(r(),M()).default({}).optional(),owner_user_id:r().optional().openapi({description:"User ID of the consenting user when this client was created via IAT-gated Dynamic Client Registration. NULL for clients created via the Management API or open DCR."}),registration_type:O(["manual","open_dcr","iat_dcr"]).optional().openapi({description:"Provenance of this client. `manual` = Management API; `open_dcr` = RFC 7591 without IAT; `iat_dcr` = RFC 7591 with an Initial Access Token."}),registration_metadata:P(r(),M()).default({}).optional().openapi({description:"Arbitrary metadata captured at Dynamic Client Registration time that isn't a first-class client field (e.g. integration_type, domain). Also stores `iat_constraints` for clients created via IAT so RFC 7592 PUT can enforce field immutability."}),user_linking_mode:O(["builtin","off"]).optional().openapi({description:"Per-client override for the built-in email-based user-linking path. `builtin` runs the legacy in-process linking at user creation/email update. `off` disables the legacy path; linking only happens if the tenant has enabled the `account-linking` template hook. When unset, the service-level `userLinkingMode` default applies."})});f({created_at:r(),updated_at:r()}).extend(Yp.shape).extend({client_id:r()});const ef=f({client_id:r().min(1).openapi({description:"ID of the client."}),audience:r().min(1).openapi({description:"The audience (API identifier) of this client grant."}),scope:E(r()).optional().openapi({description:"Scopes allowed for this client grant."}),organization_usage:O(["deny","allow","require"]).optional().openapi({description:"Defines whether organizations can be used with client credentials exchanges for this grant."}),allow_any_organization:g().optional().openapi({description:"If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations."}),is_system:g().optional().openapi({description:"If enabled, this grant is a special grant created by Auth0. It cannot be modified or deleted directly."}),subject_type:O(["client","user"]).optional().openapi({description:"The type of application access the client grant allows. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement."}),authorization_details_types:E(r()).optional().openapi({description:"Types of authorization_details allowed for this client grant. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement."})});f({id:r().openapi({description:"ID of the client grant."})}).extend(ef.shape).extend({created_at:r().optional(),updated_at:r().optional()});const Ml=O(["iat","rat"]),tf=f({id:r(),token_hash:r(),type:Ml,client_id:r().optional(),sub:r().optional(),constraints:P(r(),$e()).optional(),single_use:g().default(!1),expires_at:r().optional()});f({created_at:r(),used_at:r().optional(),revoked_at:r().optional()}).extend(tf.shape);const xt=f({x:I(),y:I()});var jl=(e=>(e.RICH_TEXT="RICH_TEXT",e.NEXT_BUTTON="NEXT_BUTTON",e.BACK_BUTTON="BACK_BUTTON",e.SUBMIT_BUTTON="SUBMIT_BUTTON",e.DIVIDER="DIVIDER",e.TEXT="TEXT",e.EMAIL="EMAIL",e.PASSWORD="PASSWORD",e.NUMBER="NUMBER",e.PHONE="PHONE",e.DATE="DATE",e.CHECKBOX="CHECKBOX",e.RADIO="RADIO",e.SELECT="SELECT",e.HIDDEN="HIDDEN",e.LEGAL="LEGAL",e))(jl||{}),ql=(e=>(e.BLOCK="BLOCK",e.FIELD="FIELD",e))(ql||{});const vn=f({id:r(),category:ht(ql),type:ht(jl)}),nf=vn.extend({category:A("BLOCK"),type:A("RICH_TEXT"),config:f({content:r()}).passthrough()}),of=vn.extend({category:A("BLOCK"),type:Ue([A("NEXT_BUTTON"),A("BACK_BUTTON"),A("SUBMIT_BUTTON")]),config:f({text:r()}).passthrough()}),rf=vn.extend({category:A("FIELD"),type:A("LEGAL"),required:g().optional(),sensitive:g().optional(),config:f({text:r()}).passthrough()}),af=vn.extend({category:A("FIELD"),type:Ue([A("TEXT"),A("EMAIL"),A("PASSWORD"),A("NUMBER"),A("PHONE"),A("DATE"),A("CHECKBOX"),A("RADIO"),A("SELECT"),A("HIDDEN")]),required:g().optional(),sensitive:g().optional(),config:f({label:r().optional(),placeholder:r().optional()}).passthrough()}),sf=f({id:r(),category:r(),type:r()}).passthrough(),lf=Ue([nf,of,rf,af,sf]),cf=f({id:r(),type:A("STEP"),coordinates:xt,alias:r().optional(),config:f({components:E(lf),next_node:r()}).passthrough()}),uf=f({id:r(),type:A("FLOW"),coordinates:xt,alias:r().optional(),config:f({flow_id:r(),next_node:r()})}),df=f({id:r(),type:A("ACTION"),coordinates:xt,alias:r().optional(),config:f({action_type:O(["REDIRECT"]).openapi({description:"The type of action to perform"}),target:O(["change-email","account","custom"]).openapi({description:"The predefined target to redirect to"}),custom_url:r().optional().openapi({description:"Custom URL when target is 'custom'"}),next_node:r().openapi({description:"The next node to navigate to after action (for non-redirect actions)"})}).passthrough()}),_f=f({id:r(),type:r(),coordinates:xt}).passthrough(),pf=Ue([cf,uf,df,_f]),ff=f({next_node:r(),coordinates:xt}).passthrough(),gf=f({resume_flow:g().optional(),coordinates:xt}).passthrough(),hf=f({id:r(),name:r(),languages:f({primary:r()}).passthrough(),nodes:E(pf),start:ff,ending:gf,created_at:r(),updated_at:r(),links:f({sdkSrc:r().optional(),sdk_src:r().optional()}).passthrough()}).passthrough();hf.omit({id:!0,created_at:!0,updated_at:!0});var Bl=(e=>(e.TOKEN="token",e.ID_TOKEN="id_token",e.TOKEN_ID_TOKEN="id_token token",e.CODE="code",e.CODE_ID_TOKEN="code id_token",e.CODE_TOKEN="code token",e.CODE_ID_TOKEN_TOKEN="code id_token token",e))(Bl||{}),Jl=(e=>(e.QUERY="query",e.FRAGMENT="fragment",e.FORM_POST="form_post",e.WEB_MESSAGE="web_message",e.SAML_POST="saml_post",e))(Jl||{}),Kl=(e=>(e.S256="S256",e.Plain="plain",e))(Kl||{});const io=Ue([ll(),f({essential:g().optional(),value:$e().optional(),values:E($e()).optional()})]).nullable(),mf=f({userinfo:P(r(),io).optional(),id_token:P(r(),io).optional()}),yf=f({client_id:r(),act_as:r().optional(),response_type:ht(Bl).optional(),response_mode:ht(Jl).optional(),redirect_uri:r().optional(),audience:r().optional(),organization:r().optional(),state:r().optional(),nonce:r().optional(),scope:r().optional(),prompt:r().optional(),code_challenge_method:ht(Kl).optional(),code_challenge:r().optional(),username:r().optional(),ui_locales:r().optional(),max_age:I().optional(),acr_values:r().optional(),claims:mf.optional(),vendor_id:r().optional()});f({colors:f({primary:r(),page_background:Ue([r(),f({type:r().optional(),start:r().optional(),end:r().optional(),angle_deg:I().optional()})]).optional()}).optional(),logo_url:r().optional(),favicon_url:r().optional(),powered_by_logo_url:r().optional(),font:f({url:r()}).optional(),dark_mode:O(["dark","light","auto"]).optional()});const wf=O(["password_reset","email_verification","otp","mfa_otp","authorization_code","oauth2_state","ticket"]),vf=f({code_id:r().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:r().openapi({description:"The id of the login session that the code is connected to"}),connection_id:r().optional().openapi({description:"The connection that the code is connected to"}),code_type:wf,code_verifier:r().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:r().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:O(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:r().optional().openapi({description:"The redirect URI associated with the code"}),otp:r().optional().openapi({description:"The one-time password value for OTP-based flows"}),nonce:r().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:r().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:r(),used_at:r().optional(),user_id:r().optional()});vf.extend({created_at:r()});const bf=f({kid:r().optional(),team_id:r().optional(),realms:r().optional(),authentication_method:r().optional(),client_id:r().optional(),client_secret:r().optional(),app_secret:r().optional(),scope:r().optional(),authorization_endpoint:r().optional(),token_endpoint:r().optional(),userinfo_endpoint:r().optional(),jwks_uri:r().optional(),discovery_url:r().optional(),issuer:r().optional(),token_endpoint_auth_method:O(["client_secret_basic","client_secret_post"]).optional(),provider:r().optional(),from:r().optional(),twilio_sid:r().optional(),twilio_token:r().optional(),icon_url:r().optional(),domain_aliases:E(r()).optional(),callback_url:r().url().optional(),passwordPolicy:O(["none","low","fair","good","excellent"]).optional(),password_complexity_options:f({min_length:I().optional()}).optional(),password_history:f({enable:g().optional(),size:I().optional()}).optional(),password_no_personal_info:f({enable:g().optional()}).optional(),password_dictionary:f({enable:g().optional(),dictionary:E(r()).optional()}).optional(),disable_signup:g().optional(),brute_force_protection:g().optional(),import_mode:g().optional(),configuration:f({token_endpoint:r().optional(),userinfo_endpoint:r().optional(),client_id:r().optional(),client_secret:r().optional(),realm:r().optional()}).optional(),attributes:f({email:f({identifier:f({active:g().optional()}).optional(),signup:f({status:O(["required","optional","disabled"]).optional(),verification:f({active:g().optional()}).optional()}).optional(),validation:f({allowed:g().optional()}).optional(),unique:g().optional(),profile_required:g().optional(),verification_method:O(["link","code"]).optional()}).optional(),username:f({identifier:f({active:g().optional()}).optional(),signup:f({status:O(["required","optional","disabled"]).optional()}).optional(),validation:f({max_length:I().optional(),min_length:I().optional(),allowed_types:f({email:g().optional(),phone_number:g().optional()}).optional()}).optional(),profile_required:g().optional()}).optional(),phone_number:f({identifier:f({active:g().optional()}).optional(),signup:f({status:O(["required","optional","disabled"]).optional()}).optional()}).optional()}).optional(),authentication_methods:f({password:f({enabled:g().optional()}).optional(),passkey:f({enabled:g().optional()}).optional()}).optional(),passkey_options:f({challenge_ui:O(["both","autofill","button"]).optional(),local_enrollment_enabled:g().optional(),progressive_enrollment_enabled:g().optional()}).optional(),requires_username:g().optional(),validation:f({username:f({min:I().optional(),max:I().optional()}).optional()}).optional(),set_user_root_attributes:O(["on_each_login","on_first_login","never_on_login"]).optional()});function oi(e){if(e!==null){if(Array.isArray(e))return e.filter(t=>t!==null).map(oi);if(e&&typeof e=="object"){const t={};for(const[n,i]of Object.entries(e))i!==null&&(t[n]=oi(i));return t}return e}}const Sf=f({id:r().optional(),name:r(),display_name:r().optional(),strategy:r(),options:Rl(e=>e===null?{}:oi(e),bf).default({}),enabled_clients:E(r()).default([]).optional(),response_type:ii().optional(),response_mode:ii().optional(),is_domain_connection:g().optional(),show_as_button:g().optional(),metadata:P(r(),M()).optional(),is_system:g().optional()});f({id:r(),created_at:r().transform(e=>e===null?"":e),updated_at:r().transform(e=>e===null?"":e)}).extend(Sf.shape);const Nf=f({domain:r(),custom_domain_id:r().optional(),type:O(["auth0_managed_certs","self_managed_certs"]),verification_method:O(["txt"]).optional(),tls_policy:O(["recommended"]).optional(),custom_client_ip_header:O(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:P(r(),r().max(255)).optional()}),Ef=Dt("name",[f({name:A("txt"),record:r(),domain:r()}),f({name:A("http"),http_body:r(),http_url:r()})]),Of=Nf.extend({custom_domain_id:r(),primary:g(),status:O(["disabled","pending","pending_verification","ready"]),origin_domain_name:r().optional(),verification:f({methods:E(Ef)}).optional(),tls_policy:r().optional()});Of.extend({tenant_id:r()});const Di=f({id:r(),order:I().optional(),visible:g().optional().default(!0)}),ut=Di.extend({category:A("BLOCK").optional()}),If=ut.extend({type:A("DIVIDER"),config:f({text:r().optional()}).optional()}),kf=ut.extend({type:A("HTML"),config:f({content:r().optional()}).optional()}),Af=ut.extend({type:A("IMAGE"),config:f({src:r().optional(),alt:r().optional(),width:I().optional(),height:I().optional()}).optional()}),Tf=ut.extend({type:A("JUMP_BUTTON"),config:f({text:r().optional(),target_step:r().optional()})}),Cf=ut.extend({type:A("RESEND_BUTTON"),config:f({text:r().optional(),resend_action:r().optional()})}),zf=ut.extend({type:A("NEXT_BUTTON"),config:f({text:r().optional()})}),Df=ut.extend({type:A("PREVIOUS_BUTTON"),config:f({text:r().optional()})}),xf=ut.extend({type:A("RICH_TEXT"),config:f({content:r().optional()}).optional()}),xi=Di.extend({category:A("WIDGET").optional(),label:r().min(1).optional(),hint:r().min(1).max(500).optional(),required:g().optional(),sensitive:g().optional()}),$f=xi.extend({type:A("AUTH0_VERIFIABLE_CREDENTIALS"),config:f({credential_type:r().optional()})}),Rf=xi.extend({type:A("GMAPS_ADDRESS"),config:f({api_key:r().optional()})}),Lf=xi.extend({type:A("RECAPTCHA"),config:f({site_key:r().optional()})}),Ie=Di.extend({category:A("FIELD").optional(),label:r().min(1).optional(),hint:r().min(1).max(500).optional(),messages:E(f({id:I().optional(),text:r(),type:O(["info","error","success","warning"])})).optional(),required:g().optional(),sensitive:g().optional()}),Pf=Ie.extend({type:A("BOOLEAN"),config:f({default_value:g().optional()}).optional()}),Uf=Ie.extend({type:A("CARDS"),config:f({options:E(f({value:r(),label:r(),description:r().optional(),image:r().optional()})).optional(),multi_select:g().optional()}).optional()}),Ff=Ie.extend({type:A("CHOICE"),config:f({options:E(f({value:r(),label:r()})).optional(),display:O(["radio","checkbox"]).optional(),multiple:g().optional(),default_value:Ue([r(),E(r())]).optional()}).optional()}),Zf=Ie.extend({type:A("CUSTOM"),config:f({component:r().optional(),props:P(r(),M()).optional(),schema:P(r(),M()).optional(),code:r().optional()})}),Mf=Ie.extend({type:A("DATE"),config:f({format:r().optional(),min:r().optional(),max:r().optional(),default_value:r().optional()}).optional()}),jf=Ie.extend({type:A("DROPDOWN"),config:f({options:E(f({value:r(),label:r()})).optional(),placeholder:r().optional(),searchable:g().optional(),multiple:g().optional(),default_value:Ue([r(),E(r())]).optional()}).optional()}),qf=Ie.extend({type:A("EMAIL"),config:f({placeholder:r().optional(),default_value:r().optional()}).optional()}),Bf=Ie.extend({type:A("FILE"),config:f({accept:r().optional(),max_size:I().optional(),multiple:g().optional()}).optional()}),Jf=Ie.extend({type:A("LEGAL"),config:f({text:r(),html:g().optional()}).optional()}),Kf=Ie.extend({type:A("NUMBER"),config:f({placeholder:r().optional(),min:I().optional(),max:I().optional(),step:I().optional(),default_value:r().optional()}).optional()}),Gf=Ie.extend({type:A("PASSWORD"),config:f({placeholder:r().optional(),min_length:I().optional(),show_toggle:g().optional(),forgot_password_link:r().optional(),default_value:r().optional()}).optional()}),Vf=Ie.extend({type:A("PAYMENT"),config:f({provider:r().optional(),currency:r().optional()}).optional()}),Hf=Ie.extend({type:A("SOCIAL"),config:f({providers:E(r()).optional(),provider_details:E(f({name:r(),strategy:r().optional(),display_name:r().optional(),icon_url:r().optional(),href:r().optional()})).optional()}).optional()}),Wf=Ie.extend({type:A("TEL"),config:f({placeholder:r().optional(),default_country:r().optional(),default_value:r().optional(),allow_email:g().optional()}).optional()}),Qf=Ie.extend({type:A("TEXT"),config:f({placeholder:r().optional(),multiline:g().optional(),max_length:I().optional(),default_value:r().optional()}).optional()}),Xf=Ie.extend({type:A("COUNTRY"),config:f({placeholder:r().optional(),default_value:r().optional()}).optional()}),Yf=Ie.extend({type:A("URL"),config:f({placeholder:r().optional(),default_value:r().optional()}).optional()}),eg=Dt("type",[If,kf,Af,Tf,Cf,zf,Df,xf]),tg=Dt("type",[$f,Rf,Lf]),ng=Dt("type",[Pf,Uf,Ff,Xf,Zf,Mf,jf,qf,Bf,Jf,Kf,Gf,Vf,Hf,Wf,Qf,Yf]),Gl=Ue([eg,tg,ng]);f({id:r(),type:A("submit"),label:r(),className:r().optional(),disabled:g().optional().default(!1),order:I().optional(),visible:g().optional().default(!0),customizations:P(r(),M()).optional()});const Jt=f({x:I(),y:I()}),ig=f({id:r(),type:A("FLOW"),coordinates:Jt,alias:r().min(1).max(150).optional(),config:f({flow_id:r().max(30),next_node:r().optional()})}),og=f({id:r(),type:A("ROUTER"),coordinates:Jt,alias:r().min(1).max(150),config:f({rules:E(f({id:r(),alias:r().min(1).max(150).optional(),condition:M(),next_node:r()})),fallback:r()})}),rg=f({id:r(),type:A("STEP"),coordinates:Jt,alias:r().min(1).max(150).optional(),config:f({components:E(Gl),next_node:r().optional()})}),ag=Dt("type",[ig,og,rg]),sg=f({name:r().openapi({description:"The name of the form"}),messages:f({errors:P(r(),M()).optional(),custom:P(r(),M()).optional()}).optional(),languages:f({primary:r().optional(),default:r().optional()}).optional(),translations:P(r(),M()).optional(),nodes:E(ag).optional(),start:f({hidden_fields:E(f({key:r(),value:r()})).optional(),next_node:r().optional(),coordinates:Jt.optional()}).optional(),ending:f({redirection:f({delay:I().optional(),target:r().optional()}).optional(),after_submit:f({flow_id:r().optional()}).optional(),coordinates:Jt.optional(),resume_flow:g().optional()}).optional(),style:f({css:r().optional()}).optional(),links:f({sdkSrc:r().optional(),sdk_src:r().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches Auth0 Forms structure)"});Ge.extend(sg.shape).extend({id:r()});const lg=f({id:I().optional(),text:r(),type:O(["info","error","success","warning"])}),cg=f({id:r().optional(),text:r(),href:r(),linkText:r().optional()});f({name:r().optional(),action:r(),method:O(["POST","GET"]),title:r().optional(),description:r().optional(),components:E(Gl),messages:E(lg).optional(),links:E(cg).optional(),footer:r().optional()});const Vl=O(["pre-user-registration","post-user-registration","post-user-login","post-user-update","validate-registration-username","pre-user-deletion","post-user-deletion"]),Hl=O(["pre-user-registration","post-user-registration","post-user-login","validate-registration-username","pre-user-deletion","post-user-deletion"]),Wl=O(["post-user-login","post-user-registration","post-user-update","credentials-exchange"]),Ql=O(["post-user-login","credentials-exchange","pre-user-registration","post-user-registration"]),Xl=O(["ensure-username","set-preferred-username","account-linking"]),dt={enabled:g().default(!1),synchronous:g().default(!1),priority:I().optional(),hook_id:r().optional(),metadata:P(r(),$e()).optional()},ug=f({...dt,trigger_id:Vl,url:r()}),dg=f({...dt,trigger_id:Hl,form_id:r()}),_g=f({...dt,trigger_id:Wl,template_id:Xl}),pg=f({...dt,trigger_id:Ql,code_id:r()});Ue([ug,dg,_g,pg]);const fg=f({...dt,trigger_id:Vl}).extend(Ge.shape).extend({hook_id:r(),url:r()}),gg=f({...dt,trigger_id:Hl}).extend(Ge.shape).extend({hook_id:r(),form_id:r()}),hg=f({...dt,trigger_id:Wl}).extend(Ge.shape).extend({hook_id:r(),template_id:Xl}),mg=f({...dt,trigger_id:Ql}).extend(Ge.shape).extend({hook_id:r(),code_id:r()});Ue([fg,gg,hg,mg]);const yg=f({code:r().max(1e5),secrets:P(r(),r()).optional()});yg.extend({id:r(),tenant_id:r()}).extend(Ge.shape);const wg=f({name:r().optional()}),vg=f({email:r().optional()}),bg=f({id:r().optional(),organization_id:r().max(50),inviter:wg,invitee:vg,invitation_url:r().url(),client_id:r(),connection_id:r().optional(),app_metadata:P(r(),M()).default({}).optional(),user_metadata:P(r(),M()).default({}).optional(),ttl_sec:I().int().max(2592e3).default(604800).optional(),roles:E(r()).default([]).optional(),send_invitation_email:g().default(!0).optional()});f({id:r(),organization_id:r().max(50),created_at:r().datetime(),expires_at:r().datetime(),ticket_id:r().optional()}).extend(bg.omit({id:!0}).shape);const Sg=f({alg:O(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),kid:r(),kty:O(["RSA","EC","oct"]),use:O(["sig","enc"]).optional(),n:r().optional(),e:r().optional(),crv:r().optional(),x:r().optional(),y:r().optional(),x5t:r().optional(),x5c:E(r()).optional()}).superRefine((e,t)=>{if(e.kty==="RSA")for(const n of["n","e"])e[n]||t.addIssue({code:ft.custom,path:[n],message:`RSA JWK is missing required member '${n}'`});else if(e.kty==="EC")for(const n of["crv","x","y"])e[n]||t.addIssue({code:ft.custom,path:[n],message:`EC JWK is missing required member '${n}'`})});f({keys:E(Sg)});f({issuer:r(),authorization_endpoint:r(),token_endpoint:r(),userinfo_endpoint:r(),jwks_uri:r(),registration_endpoint:r().optional(),revocation_endpoint:r(),end_session_endpoint:r().optional(),scopes_supported:E(r()),response_types_supported:E(r()),grant_types_supported:E(r()).optional(),code_challenge_methods_supported:E(r()),response_modes_supported:E(r()),subject_types_supported:E(r()),id_token_signing_alg_values_supported:E(r()),token_endpoint_auth_methods_supported:E(r()),claims_supported:E(r()),request_uri_parameter_supported:g(),request_parameter_supported:g(),claims_parameter_supported:g().optional(),request_object_signing_alg_values_supported:E(r()).optional(),token_endpoint_auth_signing_alg_values_supported:E(r())});var Yl=(e=>(e.PENDING="pending",e.AUTHENTICATED="authenticated",e.AWAITING_EMAIL_VERIFICATION="awaiting_email_verification",e.AWAITING_MFA="awaiting_mfa",e.AWAITING_HOOK="awaiting_hook",e.AWAITING_CONTINUATION="awaiting_continuation",e.COMPLETED="completed",e.FAILED="failed",e.EXPIRED="expired",e))(Yl||{});const Ng=ht(Yl),Eg=f({strategy:r(),strategy_type:r()}),Og=f({csrf_token:r(),auth0Client:r().optional(),authParams:yf,expires_at:r(),deleted_at:r().optional(),ip:r().optional(),useragent:r().optional(),session_id:r().optional(),authorization_url:r().optional(),state:Ng.optional().default("pending"),state_data:r().optional(),failure_reason:r().optional(),user_id:r().optional(),auth_connection:r().optional(),auth_strategy:Eg.optional(),authenticated_at:r().optional()}).openapi({description:"This represents a login sesion"});Og.extend({id:r().openapi({description:"This is is used as the state in the universal login"}),created_at:r(),updated_at:r()});const ec={ACLS_SUMMARY:"acls_summary",ACTIONS_EXECUTION_FAILED:"actions_execution_failed",API_LIMIT:"api_limit",API_LIMIT_WARNING:"api_limit_warning",APPI:"appi",CIBA_EXCHANGE_FAILED:"ciba_exchange_failed",CIBA_EXCHANGE_SUCCEEDED:"ciba_exchange_succeeded",CIBA_START_FAILED:"ciba_start_failed",CIBA_START_SUCCEEDED:"ciba_start_succeeded",CODE_LINK_SENT:"cls",CODE_SENT:"cs",DEPRECATION_NOTICE:"depnote",FAILED_LOGIN:"f",FAILED_BY_CONNECTOR:"fc",FAILED_CHANGE_EMAIL:"fce",FAILED_BY_CORS:"fco",FAILED_CROSS_ORIGIN_AUTHENTICATION:"fcoa",FAILED_CHANGE_PASSWORD:"fcp",FAILED_POST_CHANGE_PASSWORD_HOOK:"fcph",FAILED_CHANGE_PHONE_NUMBER:"fcpn",FAILED_CHANGE_PASSWORD_REQUEST:"fcpr",FAILED_CONNECTOR_PROVISIONING:"fcpro",FAILED_CHANGE_USERNAME:"fcu",FAILED_DELEGATION:"fd",FAILED_DEVICE_ACTIVATION:"fdeac",FAILED_DEVICE_AUTHORIZATION_REQUEST:"fdeaz",USER_CANCELED_DEVICE_CONFIRMATION:"fdecc",FAILED_USER_DELETION:"fdu",FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"feacft",FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"feccft",FAILED_EXCHANGE_CUSTOM_TOKEN:"fecte",FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"fede",FAILED_FEDERATED_LOGOUT:"federated_logout_failed",FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:"fens",FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"feoobft",FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"feotpft",FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"fepft",FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:"fepotpft",FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"fercft",FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:"ferrt",FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"fertft",FAILED_HOOK:"fh",FAILED_IMPERSONATION:"fimp",FAILED_INVITE_ACCEPT:"fi",FAILED_LOGOUT:"flo",FLOWS_EXECUTION_COMPLETED:"flows_execution_completed",FLOWS_EXECUTION_FAILED:"flows_execution_failed",FAILED_SENDING_NOTIFICATION:"fn",FORMS_SUBMISSION_FAILED:"forms_submission_failed",FORMS_SUBMISSION_SUCCEEDED:"forms_submission_succeeded",FAILED_LOGIN_INCORRECT_PASSWORD:"fp",FAILED_PUSHED_AUTHORIZATION_REQUEST:"fpar",FAILED_POST_USER_REGISTRATION_HOOK:"fpurh",FAILED_SIGNUP:"fs",FAILED_SILENT_AUTH:"fsa",FAILED_LOGIN_INVALID_EMAIL_USERNAME:"fu",FAILED_USERS_IMPORT:"fui",FAILED_VERIFICATION_EMAIL:"fv",FAILED_VERIFICATION_EMAIL_REQUEST:"fvr",EMAIL_VERIFICATION_CONFIRMED:"gd_auth_email_verification",EMAIL_VERIFICATION_FAILED:"gd_auth_fail_email_verification",MFA_AUTH_FAILED:"gd_auth_failed",MFA_AUTH_REJECTED:"gd_auth_rejected",MFA_AUTH_SUCCESS:"gd_auth_succeed",MFA_ENROLLMENT_COMPLETE:"gd_enrollment_complete",TOO_MANY_MFA_FAILURES:"gd_otp_rate_limit_exceed",MFA_RECOVERY_FAILED:"gd_recovery_failed",MFA_RECOVERY_RATE_LIMIT_EXCEED:"gd_recovery_rate_limit_exceed",MFA_RECOVERY_SUCCESS:"gd_recovery_succeed",MFA_EMAIL_SENT:"gd_send_email",EMAIL_VERIFICATION_SENT:"gd_send_email_verification",EMAIL_VERIFICATION_SEND_FAILURE:"gd_send_email_verification_failure",PUSH_NOTIFICATION_SENT:"gd_send_pn",ERROR_SENDING_MFA_PUSH_NOTIFICATION:"gd_send_pn_failure",MFA_SMS_SENT:"gd_send_sms",ERROR_SENDING_MFA_SMS:"gd_send_sms_failure",MFA_VOICE_CALL_SUCCESS:"gd_send_voice",MFA_VOICE_CALL_FAILED:"gd_send_voice_failure",SECOND_FACTOR_STARTED:"gd_start_auth",MFA_ENROLL_STARTED:"gd_start_enroll",MFA_ENROLLMENT_FAILED:"gd_start_enroll_failed",GUARDIAN_TENANT_UPDATE:"gd_tenant_update",UNENROLL_DEVICE_ACCOUNT:"gd_unenroll",UPDATE_DEVICE_ACCOUNT:"gd_update_device_account",WEBAUTHN_CHALLENGE_FAILED:"gd_webauthn_challenge_failed",WEBAUTHN_ENROLLMENT_FAILED:"gd_webauthn_enrollment_failed",FAILED_KMS_API_OPERATION:"kms_key_management_failure",SUCCESS_KMS_API_OPERATION:"kms_key_management_success",KMS_KEY_STATE_CHANGED:"kms_key_state_changed",TOO_MANY_CALLS_TO_DELEGATION:"limit_delegation",BLOCKED_IP_ADDRESS:"limit_mu",BLOCKED_ACCOUNT_IP:"limit_sul",BLOCKED_ACCOUNT_EMAIL:"limit_wc",INFORMATION:"i",MFA_REQUIRED:"mfar",MANAGEMENT_API_READ_OPERATION:"mgmt_api_read",FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_failed",SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_succeeded",FAILED_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_failed",SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_succeeded",ORGANIZATION_MEMBER_ADDED:"organization_member_added",PASSKEY_CHALLENGE_FAILED:"passkey_challenge_failed",PASSKEY_CHALLENGE_STARTED:"passkey_challenge_started",PRE_LOGIN_ASSESSMENT:"pla",BREACHED_PASSWORD:"pwd_leak",BREACHED_PASSWORD_ON_RESET:"reset_pwd_leak",SUCCESS_RESOURCE_CLEANUP:"resource_cleanup",RICH_CONSENTS_ACCESS_ERROR:"rich_consents_access_error",SUCCESS_LOGIN:"s",SUCCESS_API_OPERATION:"sapi",FAILED_API_OPERATION:"fapi",SUCCESS_CHANGE_EMAIL:"sce",SUCCESS_CROSS_ORIGIN_AUTHENTICATION:"scoa",SUCCESS_CHANGE_PASSWORD:"scp",SUCCESS_CHANGE_PHONE_NUMBER:"scpn",SUCCESS_CHANGE_PASSWORD_REQUEST:"scpr",SUCCESS_CHANGE_USERNAME:"scu",SUCCESS_CREDENTIAL_VALIDATION:"scv",SUCCESS_DELEGATION:"sd",SUCCESS_USER_DELETION:"sdu",SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"seacft",SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"seccft",SUCCESS_EXCHANGE_CUSTOM_TOKEN:"secte",SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"sede",SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:"sens",SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"seoobft",SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"seotpft",SUCCESS_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:"sepotpft",SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"sepft",SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:"sepkoobft",SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:"sepkotpft",SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sepkrcft",SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sercft",SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"sertft",SUCCESS_IMPERSONATION:"simp",SUCCESSFULLY_ACCEPTED_USER_INVITE:"si",BREACHED_PASSWORD_ON_SIGNUP:"signup_pwd_leak",SUCCESS_LOGOUT:"slo",SUCCESS_HOOK:"sh",SUCCESS_PASSWORD_MIGRATION:"spm",SUCCESS_REVOCATION:"srrt",SUCCESS_SIGNUP:"ss",FAILED_SS_SSO_OPERATION:"ss_sso_failure",INFORMATION_FROM_SS_SSO_OPERATION:"ss_sso_info",SUCCESS_SS_SSO_OPERATION:"ss_sso_success",SUCCESS_SILENT_AUTH:"ssa",SUCCESSFUL_SCIM_OPERATION:"sscim",SUCCESSFULLY_IMPORTED_USERS:"sui",SUCCESS_VERIFICATION_EMAIL:"sv",SUCCESS_VERIFICATION_EMAIL_REQUEST:"svr",MAX_AMOUNT_OF_AUTHENTICATORS:"too_many_records",USER_LOGIN_BLOCK_RELEASED:"ublkdu",FAILED_UNIVERSAL_LOGOUT:"universal_logout_failed",SUCCESSFUL_UNIVERSAL_LOGOUT:"universal_logout_succeeded",WARNING_DURING_LOGIN:"w",WARNING_SENDING_NOTIFICATION:"wn",WARNING_USER_MANAGEMENT:"wum"},Ig=r().refine(e=>Object.values(ec).includes(e),{message:"Invalid log type"});(()=>{const e={};for(const[t,n]of Object.entries(ec))t.startsWith("SUCCESS_")||t.startsWith("SUCCESSFUL_")||t.startsWith("SUCCESSFULLY_")||t.endsWith("_SUCCEEDED")||t.endsWith("_COMPLETED")?e[n]="success":t.startsWith("FAILED_")||t.startsWith("ERROR_")||t.startsWith("BREACHED_")||t.startsWith("BLOCKED_")||t==="MFA_AUTH_FAILED"||t==="MFA_AUTH_REJECTED"||t==="MFA_RECOVERY_FAILED"||t==="MFA_ENROLLMENT_FAILED"||t==="EMAIL_VERIFICATION_FAILED"||t==="WEBAUTHN_CHALLENGE_FAILED"||t==="WEBAUTHN_ENROLLMENT_FAILED"||t==="PASSKEY_CHALLENGE_FAILED"||t==="FLOWS_EXECUTION_FAILED"||t==="FORMS_SUBMISSION_FAILED"||t==="CIBA_EXCHANGE_FAILED"||t==="CIBA_START_FAILED"||t==="ACTIONS_EXECUTION_FAILED"||t==="RICH_CONSENTS_ACCESS_ERROR"||t==="USER_CANCELED_DEVICE_CONFIRMATION"||t==="TOO_MANY_MFA_FAILURES"||t==="MFA_RECOVERY_RATE_LIMIT_EXCEED"||t==="API_LIMIT"||t==="MAX_AMOUNT_OF_AUTHENTICATORS"?e[n]="failure":t.startsWith("WARNING_")||t==="API_LIMIT_WARNING"||t==="DEPRECATION_NOTICE"||t==="PRE_LOGIN_ASSESSMENT"?e[n]="warning":t==="CODE_SENT"||t==="CODE_LINK_SENT"||t==="MFA_EMAIL_SENT"||t==="MFA_SMS_SENT"||t==="EMAIL_VERIFICATION_SENT"||t==="PUSH_NOTIFICATION_SENT"?e[n]="code_sent":t==="INFORMATION"||t==="INFORMATION_FROM_SS_SSO_OPERATION"||t==="MANAGEMENT_API_READ_OPERATION"||t==="APPI"||t==="ACLS_SUMMARY"||t==="ORGANIZATION_MEMBER_ADDED"?e[n]="info":e[n]="other";return e})();const kg=f({name:r(),version:r(),env:f({node:r().optional()}).optional()}),Ag=f({country_code:r().length(2),city_name:r(),latitude:r(),longitude:r(),time_zone:r(),continent_code:r()}),Tg=f({type:Ig,date:r(),description:r().optional(),ip:r().optional(),user_agent:r().optional(),details:M().optional(),isMobile:g(),user_id:r().optional(),user_name:r().optional(),connection:r().optional(),connection_id:r().optional(),client_id:r().optional(),client_name:r().optional(),audience:r().optional(),scope:r().optional(),strategy:r().optional(),strategy_type:r().optional(),hostname:r().optional(),auth0_client:kg.optional(),log_id:r().optional(),location_info:Ag.optional()});Tg.extend({log_id:r()});const Cg=O(["http","eventbridge","eventgrid","splunk","datadog","sumo"]),tc=O(["active","paused","suspended"]),zg=f({type:r(),name:r()}),Dg=f({name:r(),type:Cg,status:tc.optional(),sink:P(r(),$e()),filters:E(zg).optional(),isPriority:g().optional()});Dg.extend({id:r(),status:tc,created_at:r().optional(),updated_at:r().optional()});const xg=O(["auth0","cognito","okta","oidc"]),$g=f({domain:r(),client_id:r(),client_secret:r(),audience:r().optional(),scope:r().optional()}),Rg=f({id:r().optional(),name:r(),provider:xg,connection:r(),enabled:g().default(!0),credentials:$g});f({id:r(),created_at:r(),updated_at:r()}).extend(Rg.shape);const Lg=f({enabled:g().optional(),shields:E(r()).optional(),admin_notification_frequency:E(r()).optional(),method:r().optional(),stage:f({"pre-user-registration":f({shields:E(r()).optional()}).optional(),"pre-change-password":f({shields:E(r()).optional()}).optional()}).optional()}),Pg=f({enabled:g().optional(),shields:E(r()).optional(),allowlist:E(r()).optional(),mode:r().optional(),max_attempts:I().optional()}),Ug=f({enabled:g().optional(),shields:E(r()).optional(),allowlist:E(r()).optional(),stage:f({"pre-login":f({max_attempts:I().optional(),rate:I().optional()}).optional(),"pre-user-registration":f({max_attempts:I().optional(),rate:I().optional()}).optional()}).optional()}),Fg=f({breached_password_detection:Lg.optional(),brute_force_protection:Pg.optional(),suspicious_ip_throttling:Ug.optional()}),Zg=f({id:r().optional(),user_id:r(),password:r(),algorithm:O(["bcrypt","argon2id"]).default("argon2id"),is_current:g().default(!0)});Zg.extend({id:r(),created_at:r(),updated_at:r()});const nc=f({initial_user_agent:r().describe("First user agent of the device from which this user logged in"),initial_ip:r().describe("First IP address associated with this session"),initial_asn:r().describe("First autonomous system number associated with this session"),last_user_agent:r().describe("Last user agent of the device from which this user logged in"),last_ip:r().describe("Last IP address from which this user logged in"),last_asn:r().describe("Last autonomous system number from which this user logged in")}),Mg=f({id:r(),revoked_at:r().optional(),used_at:r().optional(),user_id:r().describe("The user ID associated with the session"),expires_at:r().optional(),login_session_id:r(),idle_expires_at:r().optional(),device:nc.describe("Metadata related to the device used in the session"),clients:E(r()).describe("List of client details for the session")});f({created_at:r(),updated_at:r(),authenticated_at:r(),last_interaction_at:r()}).extend(Mg.shape);f({kid:r().openapi({description:"The key id of the signing key"}),tenant_id:r().optional().openapi({description:"The tenant the key belongs to. Omitted means the key is shared / control-plane scoped."}),cert:r().openapi({description:"The public certificate of the signing key"}),fingerprint:r().openapi({description:"The cert fingerprint"}),thumbprint:r().openapi({description:"The cert thumbprint"}),pkcs7:r().optional().openapi({description:"The private key in pkcs7 format"}),current:g().optional().openapi({description:"True if the key is the current key"}),next:g().optional().openapi({description:"True if the key is the next key"}),previous:g().optional().openapi({description:"True if the key is the previous key"}),current_since:r().optional().openapi({description:"The date and time when the key became the current key"}),current_until:r().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:g().optional().openapi({description:"True if the key is revoked"}),revoked_at:r().optional().openapi({description:"The date and time when the key was revoked"}),connection:r().optional().openapi({description:"The connection identifier associated with the key"}),type:O(["jwt_signing","saml_encryption"]).openapi({description:"The type of the signing key"})});const jg=f({id:r().optional(),audience:r(),friendly_name:r(),picture_url:r().optional(),support_email:r().optional(),support_url:r().optional(),sender_email:r().email(),sender_name:r(),session_lifetime:I().optional(),idle_session_lifetime:I().optional(),ephemeral_session_lifetime:I().optional(),idle_ephemeral_session_lifetime:I().optional(),session_cookie:f({mode:O(["persistent","non-persistent"]).optional()}).optional(),allowed_logout_urls:E(r()).optional(),default_redirection_uri:r().optional(),default_client_id:r().optional(),enabled_locales:E(r()).optional(),default_directory:r().optional(),error_page:f({html:r().optional(),show_log_link:g().optional(),url:r().optional()}).nullish(),flags:f({allow_changing_enable_sso:g().optional(),allow_legacy_delegation_grant_types:g().optional(),allow_legacy_ro_grant_types:g().optional(),allow_legacy_tokeninfo_endpoint:g().optional(),change_pwd_flow_v1:g().optional(),custom_domains_provisioning:g().optional(),dashboard_insights_view:g().optional(),dashboard_log_streams_next:g().optional(),disable_clickjack_protection_headers:g().optional(),disable_fields_map_fix:g().optional(),disable_impersonation:g().optional(),disable_management_api_sms_obfuscation:g().optional(),enable_adfs_waad_email_verification:g().optional(),enable_apis_section:g().optional(),enable_client_connections:g().optional(),enable_custom_domain_in_emails:g().optional(),enable_dynamic_client_registration:g().optional(),dcr_require_initial_access_token:g().optional(),dcr_allowed_grant_types:E(r()).optional(),allow_http_return_to:E(r().refine(e=>{try{const t=new URL(e);return t.protocol==="http:"&&(t.pathname===""||t.pathname==="/")&&!t.search&&!t.hash&&e===t.origin}catch{return!1}},{message:"must be a fully-qualified http origin (scheme + host + port, no path)"})).optional(),enable_idtoken_api2:g().optional(),enable_legacy_logs_search_v2:g().optional(),enable_legacy_profile:g().optional(),enable_pipeline2:g().optional(),enable_public_signup_user_exists_error:g().optional(),enable_sso:g().optional(),enforce_client_authentication_on_passwordless_start:g().optional(),genai_trial:g().optional(),improved_signup_bot_detection_in_classic:g().optional(),mfa_show_factor_list_on_enrollment:g().optional(),no_disclose_enterprise_connections:g().optional(),remove_alg_from_jwks:g().optional(),revoke_refresh_token_grant:g().optional(),trust_azure_adfs_email_verified_connection_property:g().optional(),use_scope_descriptions_for_consent:g().optional(),inherit_global_permissions_in_organizations:g().optional()}).optional(),sandbox_version:r().optional(),legacy_sandbox_version:r().optional(),sandbox_versions_available:E(r()).optional(),change_password:f({enabled:g().optional(),html:r().optional()}).optional(),guardian_mfa_page:f({enabled:g().optional(),html:r().optional()}).optional(),device_flow:f({charset:O(["base20","digits"]).optional(),mask:r().max(20).optional()}).optional(),default_token_quota:f({clients:f({client_credentials:P(r(),M()).optional()}).optional(),organizations:f({client_credentials:P(r(),M()).optional()}).optional()}).nullish(),default_audience:r().optional(),default_organization:r().optional(),sessions:f({oidc_logout_prompt_enabled:g().optional()}).optional(),oidc_logout:f({rp_logout_end_session_endpoint_discovery:g().optional()}).optional(),allow_organization_name_in_authentication_api:g().optional(),customize_mfa_in_postlogin_action:g().optional(),acr_values_supported:E(r()).optional(),mtls:f({enable_endpoint_aliases:g().optional()}).nullish(),pushed_authorization_requests_supported:g().optional(),authorization_response_iss_parameter_supported:g().optional(),attack_protection:Fg.optional(),mfa:f({policy:O(["never","always"]).default("never").optional(),factors:f({sms:g().default(!1),otp:g().default(!1),email:g().default(!1),push_notification:g().default(!1),webauthn_roaming:g().default(!1),webauthn_platform:g().default(!1),recovery_code:g().default(!1),duo:g().default(!1)}).optional(),sms_provider:f({provider:O(["twilio","vonage","aws_sns","phone_message_hook"]).optional()}).optional(),twilio:f({sid:r().optional(),auth_token:r().optional(),from:r().optional(),messaging_service_sid:r().optional()}).optional(),phone_message:f({message:r().optional()}).optional()}).optional()});f({created_at:r().nullable().transform(e=>e??""),updated_at:r().nullable().transform(e=>e??"")}).extend(jg.shape).extend({id:r(),is_control_plane:g().optional()});f({access_token:r(),id_token:r().optional(),scope:r().optional(),state:r().optional(),refresh_token:r().optional(),token_type:r(),expires_in:I()});f({code:r(),state:r().optional()});const qg=f({button_border_radius:I(),button_border_weight:I(),buttons_style:O(["pill","rounded","sharp"]),input_border_radius:I(),input_border_weight:I(),inputs_style:O(["pill","rounded","sharp"]),show_widget_shadow:g(),widget_border_weight:I(),widget_corner_radius:I()}),Bg=f({base_focus_color:r(),base_hover_color:r(),body_text:r(),captcha_widget_theme:O(["auto","dark","light"]),error:r(),header:r(),icons:r(),input_background:r(),input_border:r(),input_filled_text:r(),input_labels_placeholders:r(),links_focused_components:r(),primary_button:r(),primary_button_label:r(),secondary_button_border:r(),secondary_button_label:r(),success:r(),widget_background:r(),widget_border:r()}),bt=f({bold:g(),size:I()}),Jg=f({body_text:bt,buttons_text:bt,font_url:r(),input_labels:bt,links:bt,links_style:O(["normal","underlined"]),reference_text_size:I(),subtitle:bt,title:bt}),Kg=f({background_color:r(),background_image_url:r(),page_layout:O(["center","left","right"]),logo_placement:O(["widget","chip","none"]).optional()}),Gg=f({header_text_alignment:O(["center","left","right"]),logo_height:I(),logo_position:O(["center","left","none","right"]),logo_url:r(),social_buttons_layout:O(["bottom","top"])}),Vg=f({borders:qg,colors:Bg,displayName:r(),fonts:Jg,page_background:Kg,widget:Gg});Vg.extend({themeId:r()});f({universal_login_experience:O(["new","classic"]).default("new"),identifier_first:g().default(!0),password_first:g().default(!1),webauthn_platform_first_factor:g()});f({name:r(),enabled:g().optional().default(!0),default_from_address:r().optional(),credentials:P(r(),$e()),settings:f({}).optional()});const Hg=O(["verify_email","verify_email_by_code","reset_email","reset_email_by_code","welcome_email","blocked_account","stolen_credentials","enrollment_email","mfa_oob_code","change_password","password_reset","user_invitation"]);f({template:Hg,body:r(),from:r(),subject:r(),syntax:A("liquid").default("liquid"),resultUrl:r().optional(),urlLifetimeInSeconds:I().int().nonnegative().optional(),includeEmailInRedirect:g().default(!1),enabled:g().default(!0)});const Wg=f({id:r(),login_id:r(),user_id:r(),client_id:r(),expires_at:r().optional(),idle_expires_at:r().optional(),last_exchanged_at:r().optional(),device:nc,resource_servers:E(f({audience:r(),scopes:r()})),rotating:g(),token_lookup:r().optional(),token_hash:r().optional(),family_id:r().optional(),rotated_to:r().optional(),rotated_at:r().optional()});Wg.extend({created_at:r(),revoked_at:r().optional()});f({to:r(),message:r()});f({name:r(),options:f({})});const Qg=f({value:r(),description:r().optional()}),Xg=f({token_dialect:O(["access_token","access_token_authz"]).optional(),enforce_policies:g().optional(),allow_skipping_userinfo:g().optional(),skip_userinfo:g().optional(),persist_client_authorization:g().optional(),enable_introspection_endpoint:g().optional(),mtls:f({bound_access_tokens:g().optional()}).optional()}),Yg=f({id:r().optional(),name:r(),identifier:r(),scopes:E(Qg).optional(),signing_alg:r().optional(),signing_secret:r().optional(),token_lifetime:I().default(86400),token_lifetime_for_web:I().default(7200),skip_consent_for_verifiable_first_party_clients:g().optional(),allow_offline_access:g().optional(),verificationKey:r().optional(),options:Xg.optional(),is_system:g().optional(),metadata:P(r(),M()).optional()});Yg.extend({created_at:r().optional(),updated_at:r().optional()});const eh=f({role_id:r(),resource_server_identifier:r(),permission_name:r()});eh.extend({created_at:r()});const th=f({user_id:r(),resource_server_identifier:r(),permission_name:r(),organization_id:r().optional()});th.extend({tenant_id:r(),created_at:r().optional()});f({user_id:r(),resource_server_identifier:r(),resource_server_name:r(),permission_name:r(),description:r().nullable().optional(),created_at:r().optional(),organization_id:r().optional()});const nh=f({user_id:r(),role_id:r(),organization_id:r().optional()});nh.extend({tenant_id:r(),created_at:r().optional()});const ih=f({id:r().optional().openapi({description:"The unique identifier of the role. If not provided, one will be generated."}),name:r().min(1).max(50).openapi({description:"The name of the role. Cannot include '<' or '>'"}),description:r().max(255).optional().openapi({description:"The description of the role"}),is_system:g().optional(),metadata:P(r(),M()).optional().openapi({description:"Metadata associated with the role. Can be used to control sync behavior in multi-tenancy scenarios."})});ih.extend({id:r().openapi({description:"The unique identifier of the role"}),created_at:r().optional(),updated_at:r().optional()});const oh=f({logo_url:r().optional().openapi({description:"URL of the organization's logo"}),colors:f({primary:r().optional().openapi({description:"Primary color in hex format (e.g., #FF0000)"}),page_background:r().optional().openapi({description:"Page background color in hex format (e.g., #FFFFFF)"})}).optional()}).optional(),rh=f({connection_id:r().openapi({description:"ID of the connection"}),assign_membership_on_login:g().default(!1).openapi({description:"Whether to assign membership to the organization on login"}),show_as_button:g().default(!0).openapi({description:"Whether to show this connection as a button in the login screen"}),is_signup_enabled:g().default(!0).openapi({description:"Whether signup is enabled for this connection"})}),ah=f({client_credentials:f({enforce:g().default(!1).openapi({description:"Whether to enforce token quota limits"}),per_day:I().min(0).default(0).openapi({description:"Maximum tokens per day (0 = unlimited)"}),per_hour:I().min(0).default(0).openapi({description:"Maximum tokens per hour (0 = unlimited)"})}).optional()}).optional(),sh=f({id:r().optional(),name:r().min(1).regex(/^[a-z0-9_-]+$/,{message:"Organization name must be lowercase and can only contain letters, numbers, hyphens, and underscores"}).openapi({description:"The name of the organization. Must be lowercase and can only contain letters, numbers, hyphens, and underscores."}),display_name:r().optional().openapi({description:"The display name of the organization"}),branding:oh,metadata:P(r(),M()).default({}).optional().openapi({description:"Custom metadata for the organization"}),enabled_connections:E(rh).default([]).optional().openapi({description:"List of enabled connections for the organization"}),token_quota:ah});sh.extend(Ge.shape).extend({id:r(),name:r().min(1).openapi({description:"The name of the organization"})});const lh=f({connection_id:r().openapi({description:"ID of the tenant-level connection to enable for the org."}),assign_membership_on_login:g().optional().default(!1),show_as_button:g().optional().default(!0),is_signup_enabled:g().optional().default(!0)});lh.extend({connection:f({name:r().optional(),strategy:r().optional()}).optional(),created_at:r().optional(),updated_at:r().optional()});const ch=f({user_id:r().openapi({description:"ID of the user"}),organization_id:r().openapi({description:"ID of the organization"})});ch.extend(Ge.shape).extend({id:r()});f({idle_session_lifetime:I().default(72),session_lifetime:I().default(168),session_cookie:f({mode:O(["persistent","non-persistent"]).optional()}).optional(),enable_client_connections:g().optional(),default_redirection_uri:r().optional(),enabled_locales:E(r()).optional(),default_directory:r().optional(),error_page:f({html:r().optional(),show_log_link:g().optional(),url:r().optional()}).optional(),flags:f({allow_legacy_delegation_grant_types:g().optional(),allow_legacy_ro_grant_types:g().optional(),allow_legacy_tokeninfo_endpoint:g().optional(),disable_clickjack_protection_headers:g().optional(),enable_apis_section:g().optional(),enable_client_connections:g().optional(),enable_custom_domain_in_emails:g().optional(),enable_dynamic_client_registration:g().optional(),enable_idtoken_api2:g().optional(),enable_legacy_logs_search_v2:g().optional(),enable_legacy_profile:g().optional(),enable_pipeline2:g().optional(),enable_public_signup_user_exists_error:g().optional(),use_scope_descriptions_for_consent:g().optional(),disable_management_api_sms_obfuscation:g().optional(),enable_adfs_waad_email_verification:g().optional(),revoke_refresh_token_grant:g().optional(),dashboard_log_streams_next:g().optional(),dashboard_insights_view:g().optional(),disable_fields_map_fix:g().optional(),mfa_show_factor_list_on_enrollment:g().optional()}).optional(),friendly_name:r().optional(),picture_url:r().optional(),support_email:r().optional(),support_url:r().optional(),sandbox_version:r().optional(),sandbox_versions_available:E(r()).optional(),change_password:f({enabled:g(),html:r()}).optional(),guardian_mfa_page:f({enabled:g(),html:r()}).optional(),default_audience:r().optional(),default_organization:r().optional(),sessions:f({oidc_logout_prompt_enabled:g().optional()}).optional(),mfa:f({policy:O(["never","always"]).default("never").optional(),factors:f({sms:g().default(!1),otp:g().default(!1),email:g().default(!1),push_notification:g().default(!1),webauthn_roaming:g().default(!1),webauthn_platform:g().default(!1),recovery_code:g().default(!1),duo:g().default(!1)}).optional(),sms_provider:f({provider:O(["twilio","vonage","aws_sns","phone_message_hook"]).optional()}).optional(),twilio:f({sid:r().optional(),auth_token:r().optional(),from:r().optional(),messaging_service_sid:r().optional()}).optional(),phone_message:f({message:r().optional()}).optional()}).optional()});f({date:r().openapi({description:"Date these events occurred in ISO 8601 format",example:"2025-12-19"}),logins:I().openapi({description:"Number of logins on this date",example:150}),signups:I().openapi({description:"Number of signups on this date",example:25}),leaked_passwords:I().openapi({description:"Number of breached-password detections on this date (subscription required)",example:0}),updated_at:r().openapi({description:"Date and time this stats entry was last updated in ISO 8601 format",example:"2025-12-19T10:30:00.000Z"}),created_at:r().openapi({description:"Approximate date and time the first event occurred in ISO 8601 format",example:"2025-12-19T00:00:00.000Z"})});I().openapi({description:"Number of active users in the last 30 days",example:1234});O(["active-users","logins","signups","refresh-tokens","sessions"]);O(["hour","day","week","month"]);O(["time","connection","client_id","user_type","event"]);O(["password","social","passwordless","enterprise"]);const uh=f({name:r(),type:r()}),dh=f({elapsed:I(),rows_read:I().optional(),bytes_read:I().optional()});f({meta:E(uh),data:E(P(r(),M())),rows:I(),rows_before_limit_at_least:I().optional(),statistics:dh.optional()});const _h=O(["login","login-id","login-password","signup","signup-id","signup-password","reset-password","consent","mfa","mfa-push","mfa-otp","mfa-voice","mfa-phone","mfa-webauthn","mfa-email","mfa-recovery-code","status","device-flow","email-verification","email-otp-challenge","organizations","invitation","common","passkeys","captcha","custom-form","login-passwordless","mfa-login-options"]),ph=P(r(),P(r(),r())).openapi({type:"object",additionalProperties:{type:"object",additionalProperties:{type:"string"}}});f({prompt:_h,language:r(),custom_text:ph});const fh=O(["phone","totp","email","push","webauthn-roaming","webauthn-platform","passkey"]),ic=f({user_id:r(),type:fh,phone_number:r().optional(),totp_secret:r().optional(),credential_id:r().optional(),public_key:r().optional(),sign_count:I().int().nonnegative().optional(),credential_backed_up:g().optional(),transports:E(r()).optional(),friendly_name:r().optional(),confirmed:g().default(!1)});function oc(e,t){e.type==="phone"&&!e.phone_number&&t.addIssue({code:ft.custom,message:"phone_number is required when type is 'phone'",path:["phone_number"]}),e.type==="totp"&&!e.totp_secret&&t.addIssue({code:ft.custom,message:"totp_secret is required when type is 'totp'",path:["totp_secret"]}),["webauthn-roaming","webauthn-platform","passkey"].includes(e.type)&&(e.credential_id||t.addIssue({code:ft.custom,message:`credential_id is required when type is '${e.type}'`,path:["credential_id"]}),e.public_key||t.addIssue({code:ft.custom,message:`public_key is required when type is '${e.type}'`,path:["public_key"]}))}ic.superRefine(oc);ic.extend({id:r(),created_at:r(),updated_at:r()}).superRefine(oc);function gh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function hh(e){if(!e)return;const t=JSON.parse(e);return gh(t)?t:void 0}function kn(e){return e==null?void 0:new Date(e).toISOString()}function Yt(e){if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?null:t.getTime()}function An(e){const t=Ml.parse(e.type);return{id:e.id,token_hash:e.token_hash,type:t,client_id:e.client_id??void 0,sub:e.sub??void 0,constraints:hh(e.constraints),single_use:!!e.single_use,expires_at:kn(e.expires_at_ts),used_at:kn(e.used_at_ts),revoked_at:kn(e.revoked_at_ts),created_at:new Date(e.created_at_ts).toISOString()}}function mh(e){return{async create(t,n){const i=Date.now();return await e.insert(W).values({id:n.id,tenant_id:t,token_hash:n.token_hash,type:n.type,client_id:n.client_id??null,sub:n.sub??null,constraints:n.constraints?JSON.stringify(n.constraints):null,single_use:n.single_use?1:0,expires_at_ts:Yt(n.expires_at),created_at_ts:i}),{id:n.id,token_hash:n.token_hash,type:n.type,client_id:n.client_id,sub:n.sub,constraints:n.constraints,single_use:n.single_use,expires_at:n.expires_at,created_at:new Date(i).toISOString()}},async get(t,n){const i=await e.select().from(W).where(w(_(W.tenant_id,t),_(W.id,n))).get();return i?An(i):null},async getByHash(t,n){const i=await e.select().from(W).where(w(_(W.tenant_id,t),_(W.token_hash,n))).get();return i?An(i):null},async listByClient(t,n){return(await e.select().from(W).where(w(_(W.tenant_id,t),_(W.client_id,n))).orderBy(le(W.created_at_ts))).map(An)},async markUsed(t,n,i){return(await e.update(W).set({used_at_ts:Yt(i)}).where(w(_(W.tenant_id,t),_(W.id,n),xe(W.used_at_ts))).returning()).length>0},async revoke(t,n,i){return(await e.update(W).set({revoked_at_ts:Yt(i)}).where(w(_(W.tenant_id,t),_(W.id,n),xe(W.revoked_at_ts))).returning()).length>0},async revokeByClient(t,n,i){return(await e.update(W).set({revoked_at_ts:Yt(i)}).where(w(_(W.tenant_id,t),_(W.client_id,n),xe(W.revoked_at_ts))).returning()).length},async remove(t,n){return(await e.delete(W).where(w(_(W.tenant_id,t),_(W.id,n))).returning()).length>0}}}function Tn(e){const{tenant_id:t,...n}=e;return K(n)}function yh(e){return{async create(t,n){const i={...n,tenant_id:t,created_at:n.created_at||new Date().toISOString(),expires_at:n.expires_at};return await e.insert(ce).values(i),Tn(i)},async get(t,n,i){if(!t)throw new Error("tenant_id is required");const o=await e.select().from(ce).where(w(_(ce.tenant_id,t),_(ce.code_id,n),_(ce.code_type,i))).get();return o?Tn(o):null},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s}=n||{};let c=e.select().from(ce).where(_(ce.tenant_id,t)).$dynamic();if(s!=null&&s.sort_by){const h=ce[s.sort_by];h&&(c=c.orderBy(s.sort_order==="desc"?le(h):me(h)))}const p=(await c.offset(i*o).limit(o)).map(Tn);if(!a)return{codes:p};const[d]=await e.select({count:ye()}).from(ce).where(_(ce.tenant_id,t));return{codes:p,start:i*o,limit:o,length:Number((d==null?void 0:d.count)??0)}},async used(t,n){return(await e.update(ce).set({used_at:new Date().toISOString()}).where(w(_(ce.tenant_id,t),_(ce.code_id,n))).returning()).length>0},async consume(t,n){return(await e.update(ce).set({used_at:new Date().toISOString()}).where(w(_(ce.tenant_id,t),_(ce.code_id,n),xe(ce.used_at))).returning()).length>0},async remove(t,n){return(await e.delete(ce).where(w(_(ce.tenant_id,t),_(ce.code_id,n))).returning()).length>0}}}function wh(){const{customAlphabet:e}=require("nanoid");return`con_${e("0123456789abcdefghijklmnopqrstuvwxyz",17)()}`}function Cn(e){const{tenant_id:t,is_system:n,options:i,metadata:o,...a}=e;return K({...a,options:R(i,{}),metadata:R(o),is_system:n?!0:void 0})}function vh(e){return{async create(t,n){var a,s;const i=new Date().toISOString(),o={id:n.id||wh(),...n,tenant_id:t,options:JSON.stringify(n.options||{}),metadata:n.metadata?JSON.stringify(n.metadata):void 0,is_system:n.is_system?1:0,created_at:i,updated_at:i};try{await e.insert(fe).values(o)}catch(c){throw(a=c==null?void 0:c.message)!=null&&a.includes("UNIQUE constraint failed")||(s=c==null?void 0:c.message)!=null&&s.includes("duplicate key")?new lt(409,{message:"Connection already exists"}):c}return Cn(o)},async get(t,n){const i=await e.select().from(fe).where(w(_(fe.tenant_id,t),_(fe.id,n))).get();return i?Cn(i):null},async update(t,n,i){const o={updated_at:new Date().toISOString()};return i.name!==void 0&&(o.name=i.name),i.strategy!==void 0&&(o.strategy=i.strategy),i.options!==void 0&&(o.options=JSON.stringify(i.options)),i.metadata!==void 0&&(o.metadata=JSON.stringify(i.metadata)),i.display_name!==void 0&&(o.display_name=i.display_name),i.response_type!==void 0&&(o.response_type=i.response_type),i.response_mode!==void 0&&(o.response_mode=i.response_mode),await e.update(fe).set(o).where(w(_(fe.tenant_id,t),_(fe.id,n))),!0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{};let u=_(fe.tenant_id,t);if(c){const y=Ye(fe,c,["name"]);y&&(u=w(u,y))}let p=e.select().from(fe).where(u).$dynamic();if(s!=null&&s.sort_by){const y=fe[s.sort_by];y&&(p=p.orderBy(s.sort_order==="desc"?le(y):me(y)))}const h=(await p.offset(i*o).limit(o)).map(Cn);if(!a)return{connections:h};const[m]=await e.select({count:ye()}).from(fe).where(u);return{connections:h,start:i*o,limit:o,length:Number((m==null?void 0:m.count)??0)}},async remove(t,n){return(await e.delete(fe).where(w(_(fe.tenant_id,t),_(fe.id,n))).returning()).length>0}}}function en(e){const{tenant_id:t,domain_metadata:n,...i}=e;return K({...i,primary:!!i.primary,domain_metadata:R(n)})}function bh(e){return{async create(t,n){const i=new Date().toISOString(),a={custom_domain_id:n.custom_domain_id||Le(),tenant_id:t,domain:n.domain,primary:n.primary??!1,status:n.status||"pending",type:n.type,origin_domain_name:n.origin_domain_name,verification:n.verification,custom_client_ip_header:n.custom_client_ip_header,tls_policy:n.tls_policy,domain_metadata:n.domain_metadata?JSON.stringify(n.domain_metadata):void 0,created_at:i,updated_at:i};return await e.insert(ze).values(a),en({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(ze).where(w(_(ze.tenant_id,t),_(ze.custom_domain_id,n))).get();return i?en(i):null},async getByDomain(t){const n=await e.select().from(ze).where(_(ze.domain,t)).get();return n?{...en(n),tenant_id:n.tenant_id}:null},async list(t){return(await e.select().from(ze).where(_(ze.tenant_id,t)).all()).map(en)},async update(t,n,i){const o={updated_at:new Date().toISOString()};return i.domain!==void 0&&(o.domain=i.domain),i.primary!==void 0&&(o.primary=i.primary),i.status!==void 0&&(o.status=i.status),i.type!==void 0&&(o.type=i.type),i.origin_domain_name!==void 0&&(o.origin_domain_name=i.origin_domain_name),i.verification!==void 0&&(o.verification=i.verification),i.custom_client_ip_header!==void 0&&(o.custom_client_ip_header=i.custom_client_ip_header),i.tls_policy!==void 0&&(o.tls_policy=i.tls_policy),i.domain_metadata!==void 0&&(o.domain_metadata=JSON.stringify(i.domain_metadata)),(await e.update(ze).set(o).where(w(_(ze.tenant_id,t),_(ze.custom_domain_id,n))).returning()).length>0},async remove(t,n){return(await e.delete(ze).where(w(_(ze.tenant_id,t),_(ze.custom_domain_id,n))).returning()).length>0}}}function Sh(e){return{async get(t,n,i){const o=await e.select().from(Oe).where(w(_(Oe.tenant_id,t),_(Oe.prompt,n),_(Oe.language,i))).get();if(!o)return null;try{return JSON.parse(o.custom_text)}catch{return null}},async set(t,n,i,o){const a=Date.now(),s=JSON.stringify(o);await e.insert(Oe).values({tenant_id:t,prompt:n,language:i,custom_text:s,created_at_ts:a,updated_at_ts:a}).onConflictDoUpdate({target:[Oe.tenant_id,Oe.prompt,Oe.language],set:{custom_text:s,updated_at_ts:a}})},async delete(t,n,i){await e.delete(Oe).where(w(_(Oe.tenant_id,t),_(Oe.prompt,n),_(Oe.language,i)))},async list(t){return await e.select({prompt:Oe.prompt,language:Oe.language}).from(Oe).where(_(Oe.tenant_id,t)).all()}}}function Nh(e){return{async create(t,n){const i=new Date().toISOString();await e.insert(rt).values({tenant_id:t,name:n.name,enabled:n.enabled,default_from_address:n.default_from_address,credentials:JSON.stringify(n.credentials||{}),settings:JSON.stringify(n.settings||{}),created_at:i,updated_at:i})},async get(t){const n=await e.select().from(rt).where(_(rt.tenant_id,t)).get();if(!n)return null;const{tenant_id:i,...o}=n;return K({...o,enabled:!!o.enabled,credentials:R(o.credentials,{}),settings:R(o.settings,{})})},async update(t,n){const i={updated_at:new Date().toISOString()};n.name!==void 0&&(i.name=n.name),n.enabled!==void 0&&(i.enabled=n.enabled),n.default_from_address!==void 0&&(i.default_from_address=n.default_from_address),n.credentials!==void 0&&(i.credentials=JSON.stringify(n.credentials)),n.settings!==void 0&&(i.settings=JSON.stringify(n.settings)),await e.update(rt).set(i).where(_(rt.tenant_id,t))},async remove(t){await e.delete(rt).where(_(rt.tenant_id,t))}}}function oo(e){const t={template:e.template,body:e.body,from:e.from,subject:e.subject,syntax:"liquid",includeEmailInRedirect:!!e.include_email_in_redirect,enabled:!!e.enabled};return K({...t,resultUrl:e.result_url??void 0,urlLifetimeInSeconds:e.url_lifetime_in_seconds??void 0})}function Eh(e){return{async get(t,n){const i=await e.select().from(Ze).where(w(_(Ze.tenant_id,t),_(Ze.template,n))).get();return i?oo(i):null},async list(t){return(await e.select().from(Ze).where(_(Ze.tenant_id,t)).all()).map(oo)},async create(t,n){const i=new Date().toISOString();return await e.insert(Ze).values({tenant_id:t,template:n.template,body:n.body,from:n.from,subject:n.subject,syntax:n.syntax,result_url:n.resultUrl??null,url_lifetime_in_seconds:n.urlLifetimeInSeconds??null,include_email_in_redirect:n.includeEmailInRedirect,enabled:n.enabled,created_at:i,updated_at:i}),n},async update(t,n,i){const o={updated_at:new Date().toISOString()};i.body!==void 0&&(o.body=i.body),i.from!==void 0&&(o.from=i.from),i.subject!==void 0&&(o.subject=i.subject),i.syntax!==void 0&&(o.syntax=i.syntax),i.resultUrl!==void 0&&(o.result_url=i.resultUrl),i.urlLifetimeInSeconds!==void 0&&(o.url_lifetime_in_seconds=i.urlLifetimeInSeconds),i.includeEmailInRedirect!==void 0&&(o.include_email_in_redirect=i.includeEmailInRedirect),i.enabled!==void 0&&(o.enabled=i.enabled);const a=await e.update(Ze).set(o).where(w(_(Ze.tenant_id,t),_(Ze.template,n))).run();return Number(a.changes??0)>0},async remove(t,n){const i=await e.delete(Ze).where(w(_(Ze.tenant_id,t),_(Ze.template,n))).run();return Number(i.changes??0)>0}}}function Oh(e){return{async create(t,n){const i=new Date().toISOString(),o=`af_${Le()}`;return await e.insert(Te).values({id:o,tenant_id:t,name:n.name,actions:JSON.stringify(n.actions||[]),created_at:i,updated_at:i}),{id:o,name:n.name,actions:n.actions||[],created_at:i,updated_at:i}},async get(t,n){const i=await e.select().from(Te).where(w(_(Te.tenant_id,t),_(Te.id,n))).get();if(!i)return null;const{tenant_id:o,actions:a,...s}=i;return K({...s,actions:R(a,[])})},async update(t,n,i){const o={updated_at:new Date().toISOString()};return i.name!==void 0&&(o.name=i.name),i.actions!==void 0&&(o.actions=JSON.stringify(i.actions)),(await e.update(Te).set(o).where(w(_(Te.tenant_id,t),_(Te.id,n))).returning()).length===0?null:this.get(t,n)},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s}=n||{};let c=e.select().from(Te).where(_(Te.tenant_id,t)).$dynamic();if(s!=null&&s.sort_by){const h=Te[s.sort_by];h&&(c=c.orderBy(s.sort_order==="desc"?le(h):me(h)))}const p=(await c.offset(i*o).limit(o)).map(h=>{const{tenant_id:m,actions:y,...S}=h;return K({...S,actions:R(y,[])})});if(!a)return{flows:p};const[d]=await e.select({count:ye()}).from(Te).where(_(Te.tenant_id,t));return{flows:p,start:i*o,limit:o,length:Number((d==null?void 0:d.count)??0)}},async remove(t,n){return(await e.delete(Te).where(w(_(Te.tenant_id,t),_(Te.id,n))).returning()).length>0}}}const tn=["nodes","start","ending"];function Ih(e){return{async create(t,n){const i=new Date().toISOString(),o=Le(),a={id:o,tenant_id:t,name:n.name,messages:n.messages,languages:n.languages,translations:n.translations,style:n.style,created_at:i,updated_at:i};for(const s of tn)a[s]=JSON.stringify(n[s]||(s==="nodes"?[]:{}));return await e.insert(Ae).values(a),{id:o,...n,created_at:i,updated_at:i}},async get(t,n){const i=await e.select().from(Ae).where(w(_(Ae.tenant_id,t),_(Ae.id,n))).get();if(!i)return null;const{tenant_id:o,...a}=i,s={...a};for(const c of tn)s[c]=R(a[c]);return K(s)},async update(t,n,i){const o={updated_at:new Date().toISOString()};for(const[s,c]of Object.entries(i))c!==void 0&&(tn.includes(s)?o[s]=JSON.stringify(c):o[s]=c);return(await e.update(Ae).set(o).where(w(_(Ae.tenant_id,t),_(Ae.id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s}=n||{};let c=e.select().from(Ae).where(_(Ae.tenant_id,t)).$dynamic();if(s!=null&&s.sort_by){const h=Ae[s.sort_by];h&&(c=c.orderBy(s.sort_order==="desc"?le(h):me(h)))}const p=(await c.offset(i*o).limit(o)).map(h=>{const{tenant_id:m,...y}=h,S={...y};for(const C of tn)S[C]=R(y[C]);return K(S)});if(!a)return{forms:p};const[d]=await e.select({count:ye()}).from(Ae).where(_(Ae.tenant_id,t));return{forms:p,start:i*o,limit:o,length:Number((d==null?void 0:d.count)??0)}},async remove(t,n){return(await e.delete(Ae).where(w(_(Ae.tenant_id,t),_(Ae.id,n))).returning()).length>0}}}function rc(e){if(e!=null){if(typeof e=="number")return new Date(e).toISOString();if(typeof e=="string"){if(e==="")return;const t=parseFloat(e);return!isNaN(t)&&/^\d+(\.\d+)?$/.test(e)?new Date(t).toISOString():e}}}function ri(e,t=new Date(0).toISOString()){return rc(e)??t}function te(e){if(!e||e==="")return null;const t=new Date(e);return isNaN(t.getTime())?null:t.getTime()}function Ht(e,t,n=[]){const i={};for(const o of t){const a=o.replace(/_ts$/,"");i[a]=ri(e[o])}for(const o of n){const a=o.replace(/_ts$/,"");i[a]=rc(e[o])}return i}const kh=Bc("0123456789abcdefghijklmnopqrstuvwxyz",17);function Ah(){return`hc_${kh()}`}function ro(e){const{created_at_ts:t,updated_at_ts:n,secrets:i,...o}=e,a=Ht({created_at_ts:t,updated_at_ts:n},["created_at_ts","updated_at_ts"]);return{...o,...a,secrets:i?JSON.parse(i):void 0}}function Th(e){return{async create(t,n){const i=Date.now(),a={id:Ah(),tenant_id:t,code:n.code,secrets:n.secrets?JSON.stringify(n.secrets):null,created_at_ts:i,updated_at_ts:i};return await e.insert(He).values(a),ro({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(He).where(w(_(He.tenant_id,t),_(He.id,n))).get();return i?ro(i):null},async update(t,n,i){const o={updated_at_ts:Date.now()};return i.code!==void 0&&(o.code=i.code),i.secrets!==void 0&&(o.secrets=JSON.stringify(i.secrets)),(await e.update(He).set(o).where(w(_(He.tenant_id,t),_(He.id,n))).returning()).length>0},async remove(t,n){return(await e.delete(He).where(w(_(He.tenant_id,t),_(He.id,n))).returning()).length>0}}}function Ch(){const{customAlphabet:e}=require("nanoid");return`h_${e("0123456789abcdefghijklmnopqrstuvwxyz",17)()}`}function zh(e){if(!(typeof e!="string"||!e))try{const t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}}function zn(e){const{tenant_id:t,created_at_ts:n,updated_at_ts:i,metadata:o,...a}=e,s=Ht({created_at_ts:n,updated_at_ts:i},["created_at_ts","updated_at_ts"]);return K({...a,enabled:!!a.enabled,synchronous:!!a.synchronous,metadata:zh(o),...s})}function Dh(e){return{async create(t,n){const i=Date.now(),a={hook_id:n.hook_id||Ch(),tenant_id:t,trigger_id:n.trigger_id,url:n.url,enabled:n.enabled??!0,synchronous:n.synchronous??!1,priority:n.priority,form_id:n.form_id,template_id:n.template_id,code_id:n.code_id,metadata:n.metadata?JSON.stringify(n.metadata):null,created_at_ts:i,updated_at_ts:i};return await e.insert(be).values(a),zn({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(be).where(w(_(be.tenant_id,t),_(be.hook_id,n))).get();return i?zn(i):null},async update(t,n,i){const o={updated_at_ts:Date.now()};return i.trigger_id!==void 0&&(o.trigger_id=i.trigger_id),i.url!==void 0&&(o.url=i.url),i.enabled!==void 0&&(o.enabled=i.enabled),i.synchronous!==void 0&&(o.synchronous=i.synchronous),i.priority!==void 0&&(o.priority=i.priority),i.form_id!==void 0&&(o.form_id=i.form_id),i.template_id!==void 0&&(o.template_id=i.template_id),i.code_id!==void 0&&(o.code_id=i.code_id),i.metadata!==void 0&&(o.metadata=i.metadata===null?null:JSON.stringify(i.metadata)),(await e.update(be).set(o).where(w(_(be.tenant_id,t),_(be.hook_id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{},u=c?Ye(be,c,["url","form_id","template_id","code_id"]):void 0,p=u?w(_(be.tenant_id,t),u):_(be.tenant_id,t);let d=e.select().from(be).where(p).$dynamic();const h=s!=null&&s.sort_by?be[s.sort_by]:void 0;h?d=d.orderBy((s==null?void 0:s.sort_order)==="desc"?le(h):me(h)):d=d.orderBy(le(be.priority),me(be.created_at_ts));const y=(await d.offset(i*o).limit(o)).map(zn);if(!a)return{hooks:y};const[S]=await e.select({count:ye()}).from(be).where(p);return{hooks:y,start:i*o,limit:o,length:Number((S==null?void 0:S.count)??0)}},async remove(t,n){return(await e.delete(be).where(w(_(be.tenant_id,t),_(be.hook_id,n))).returning()).length>0}}}function xh(){const{customAlphabet:e}=require("nanoid");return`inv_${e("0123456789abcdefghijklmnopqrstuvwxyz",17)()}`}const ai=["inviter","invitee","app_metadata","user_metadata","roles"];function Dn(e){const{tenant_id:t,send_invitation_email:n,...i}=e,o={...i};for(const a of ai)o[a]=R(i[a],a==="roles"?[]:{});return o.send_invitation_email=!!n,K(o)}function $h(e){return{async create(t,n){var u,p;const i=n.id||xh(),o=n.ttl_sec||604800,a=new Date,s=new Date(a.getTime()+o*1e3).toISOString(),c={id:i,tenant_id:t,organization_id:n.organization_id,client_id:n.client_id,connection_id:n.connection_id,invitation_url:n.invitation_url,ticket_id:n.ticket_id,ttl_sec:o,send_invitation_email:n.send_invitation_email!==!1?1:0,created_at:a.toISOString(),expires_at:s};for(const d of ai)n[d]!==void 0&&(c[d]=JSON.stringify(n[d]));try{await e.insert(ke).values(c)}catch(d){throw(u=d==null?void 0:d.message)!=null&&u.includes("UNIQUE constraint failed")||(p=d==null?void 0:d.message)!=null&&p.includes("duplicate key")?new lt(409,{message:"Invite already exists"}):d}return Dn({...c,tenant_id:t})},async get(t,n){const i=await e.select().from(ke).where(w(_(ke.tenant_id,t),_(ke.id,n))).get();return i?Dn(i):null},async update(t,n,i){const o={};for(const s of ai)i[s]!==void 0&&(o[s]=JSON.stringify(i[s]));return i.connection_id!==void 0&&(o.connection_id=i.connection_id),i.ttl_sec!==void 0&&(o.ttl_sec=i.ttl_sec,o.expires_at=new Date(Date.now()+i.ttl_sec*1e3).toISOString()),(await e.update(ke).set(o).where(w(_(ke.tenant_id,t),_(ke.id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s}=n||{};let c=e.select().from(ke).where(_(ke.tenant_id,t)).$dynamic();if(s!=null&&s.sort_by){const h=ke[s.sort_by];h&&(c=c.orderBy(s.sort_order==="desc"?le(h):me(h)))}const p=(await c.offset(i*o).limit(o)).map(Dn);if(!a)return{invites:p};const[d]=await e.select({count:ye()}).from(ke).where(_(ke.tenant_id,t));return{invites:p,start:i*o,limit:o,length:Number((d==null?void 0:d.count)??0)}},async remove(t,n){return(await e.delete(ke).where(w(_(ke.tenant_id,t),_(ke.id,n))).returning()).length>0}}}function Rh(e){return{async create(t){await e.insert(We).values({...t,created_at:new Date().toDateString()})},async list(t){const{page:n=0,per_page:i=50,include_totals:o=!1,sort:a}=t||{},s=new Date().toISOString();let c=e.select().from(We).where(Be(un(We.revoked_at,s),xe(We.revoked_at))).$dynamic();if(a!=null&&a.sort_by){const h=We[a.sort_by];h&&(c=c.orderBy(a.sort_order==="desc"?le(h):me(h)))}const p=(await c.offset(n*i).limit(i)).map(h=>{const{created_at:m,...y}=h;return K(y)});if(!o)return{signingKeys:p};const[d]=await e.select({count:ye()}).from(We).where(Be(un(We.revoked_at,s),xe(We.revoked_at)));return{signingKeys:p,start:n*i,limit:i,length:Rc((d==null?void 0:d.count)??0)}},async update(t,n){return(await e.update(We).set(n).where(_(We.kid,t)).returning()).length>0}}}const si="0123456789ABCDEFGHJKMNPQRSTVWXYZ",xn=si.length;function Lh(){let n=Date.now(),i="";for(let a=10;a>0;a--)i=si.charAt(n%xn)+i,n=Math.floor(n/xn);const o=new Uint8Array(16);crypto.getRandomValues(o);for(let a=0;a<16;a++)i+=si.charAt(o[a]%xn);return i}function ao(e){const{tenant_id:t,created_at_ts:n,updated_at_ts:i,expires_at_ts:o,state_data:a,auth_params:s,...c}=e,u=Ht({created_at_ts:n,updated_at_ts:i,expires_at_ts:o},["created_at_ts","updated_at_ts","expires_at_ts"]),p={};for(const[h,m]of Object.entries(c))m!=null&&(p[h]=m);const d=Ua(p,["auth_strategy"]);return K({...d,authParams:typeof s=="string"&&s.length>0?JSON.parse(s):{},...u,state_data:R(a)})}function Ph(e){return{async create(t,n){var s,c;const i=Date.now(),a={id:Lh(),tenant_id:t,session_id:n.session_id,csrf_token:n.csrf_token,auth_params:JSON.stringify(n.authParams||{}),authorization_url:n.authorization_url?n.authorization_url.substring(0,1024):void 0,ip:n.ip,useragent:n.useragent,auth0Client:n.auth0Client,state:n.state||"pending",state_data:n.state_data?JSON.stringify(n.state_data):void 0,failure_reason:n.failure_reason,user_id:n.user_id,auth_connection:n.auth_connection,auth_strategy_strategy:(s=n.auth_strategy)==null?void 0:s.strategy,auth_strategy_strategy_type:(c=n.auth_strategy)==null?void 0:c.strategy_type,authenticated_at:n.authenticated_at,created_at_ts:i,updated_at_ts:i,expires_at_ts:n.expires_at?te(n.expires_at):i+1e3*60*60*24};return await e.insert(Q).values(a),ao({...a,tenant_id:t})},async get(t,n){const i=t?w(_(Q.tenant_id,t),_(Q.id,n)):_(Q.id,n),o=await e.select().from(Q).where(i).get();return o?ao(o):null},async update(t,n,i){var a,s,c;const o={updated_at_ts:Date.now()};if(i.session_id!==void 0&&(o.session_id=i.session_id),i.state!==void 0&&(o.state=i.state),i.state_data!==void 0&&(o.state_data=JSON.stringify(i.state_data)),i.failure_reason!==void 0&&(o.failure_reason=i.failure_reason),i.user_id!==void 0&&(o.user_id=i.user_id),i.auth_connection!==void 0&&(o.auth_connection=i.auth_connection),i.auth_strategy!==void 0&&(o.auth_strategy_strategy=(a=i.auth_strategy)==null?void 0:a.strategy,o.auth_strategy_strategy_type=(s=i.auth_strategy)==null?void 0:s.strategy_type),i.authenticated_at!==void 0&&(o.authenticated_at=i.authenticated_at),i.authorization_url!==void 0&&(o.authorization_url=(c=i.authorization_url)==null?void 0:c.substring(0,1024)),i.expires_at!==void 0&&(o.expires_at_ts=te(i.expires_at)),i.authParams!==void 0){const u=await e.select({auth_params:Q.auth_params}).from(Q).where(w(_(Q.tenant_id,t),_(Q.id,n))).get(),p=u!=null&&u.auth_params&&typeof u.auth_params=="string"&&u.auth_params.length>0?JSON.parse(u.auth_params):{};o.auth_params=JSON.stringify({...p,...i.authParams})}return await e.update(Q).set(o).where(w(_(Q.tenant_id,t),_(Q.id,n))),!0},async remove(t,n){return(await e.delete(Q).where(w(_(Q.tenant_id,t),_(Q.id,n))).returning()).length>0}}}function $n(e){const{tenant_id:t,isMobile:n,auth0_client:i,details:o,country_code:a,city_name:s,latitude:c,longitude:u,time_zone:p,continent_code:d,scope:h,...m}=e,y={...m,isMobile:!!n,auth0_client:R(i),details:R(o),scope:h?h.split(","):void 0};return a&&(y.location_info=K({country_code:a,city_name:s,latitude:c,longitude:u,time_zone:p,continent_code:d})),K(y)}function Uh(e){return{async create(t,n){var a,s;const o={log_id:n.log_id||Le(),tenant_id:t,type:n.type,date:n.date||new Date().toISOString(),category:n.category,user_id:n.user_id,ip:n.ip,client_id:n.client_id,client_name:n.client_name,user_agent:(a=n.user_agent)==null?void 0:a.substring(0,256),description:(s=n.description)==null?void 0:s.substring(0,256),isMobile:n.isMobile?1:0,user_name:n.user_name,connection:n.connection,connection_id:n.connection_id,audience:n.audience,scope:Array.isArray(n.scope)?n.scope.join(","):n.scope,strategy:n.strategy,strategy_type:n.strategy_type,hostname:n.hostname,session_connection:n.session_connection};return n.auth0_client&&(o.auth0_client=JSON.stringify(n.auth0_client)),n.details&&(o.details=JSON.stringify(n.details).substring(0,8192)),n.location_info&&(o.country_code=n.location_info.country_code,o.city_name=n.location_info.city_name,o.latitude=n.location_info.latitude,o.longitude=n.location_info.longitude,o.time_zone=n.location_info.time_zone,o.continent_code=n.location_info.continent_code),await e.insert($).values(o),$n({...o,tenant_id:t})},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c,from_date:u,to_date:p}=n||{},d=[_($.tenant_id,t)];if(c){const L=Ye($,c,["user_id","ip","type","client_id"]);L&&d.push(L)}typeof u=="number"&&Number.isFinite(u)&&d.push(Tt($.date,new Date(Math.floor(u)*1e3).toISOString())),typeof p=="number"&&Number.isFinite(p)&&d.push(Qe($.date,new Date((Math.floor(p)+1)*1e3).toISOString()));const h=w(...d);let m=e.select().from($).where(h).$dynamic();if(s!=null&&s.sort_by){const L=$[s.sort_by];L&&(m=m.orderBy(s.sort_order==="desc"?le(L):me(L)))}else m=m.orderBy(le($.date));const S=(await m.offset(i*o).limit(o)).map($n);if(!a)return{logs:S};const[C]=await e.select({count:ye()}).from($).where(h);return{logs:S,start:i*o,limit:o,length:Number((C==null?void 0:C.count)??0)}},async get(t,n){const i=await e.select().from($).where(w(_($.tenant_id,t),_($.log_id,n))).get();return i?$n(i):null}}}const li="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Rn=li.length;function Fh(){let n=Date.now(),i="";for(let a=10;a>0;a--)i=li.charAt(n%Rn)+i,n=Math.floor(n/Rn);const o=new Uint8Array(16);crypto.getRandomValues(o);for(let a=0;a<16;a++)i+=li.charAt(o[a]%Rn);return i}function nn(e){const{tenant_id:t,created_at_ts:n,updated_at_ts:i,credential_backed_up:o,confirmed:a,transports:s,...c}=e;return K({...c,confirmed:!!a,credential_backed_up:o!=null?!!o:void 0,transports:R(s),created_at:ri(n),updated_at:ri(i)})}function Zh(e){return{async create(t,n){const i=Date.now(),a={id:n.id||Fh(),tenant_id:t,user_id:n.user_id,type:n.type,phone_number:n.phone_number,totp_secret:n.totp_secret,credential_id:n.credential_id,public_key:n.public_key,sign_count:n.sign_count,credential_backed_up:n.credential_backed_up!=null?n.credential_backed_up?1:0:null,transports:n.transports?JSON.stringify(n.transports):null,friendly_name:n.friendly_name,confirmed:n.confirmed?1:0,created_at_ts:i,updated_at_ts:i};return await e.insert(pe).values(a),nn({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(pe).where(w(_(pe.tenant_id,t),_(pe.id,n))).get();return i?nn(i):null},async getByCredentialId(t,n){const i=await e.select().from(pe).where(w(_(pe.tenant_id,t),_(pe.credential_id,n))).get();return i?nn(i):null},async list(t,n){return(await e.select().from(pe).where(w(_(pe.tenant_id,t),_(pe.user_id,n))).all()).map(nn)},async update(t,n,i){const o={updated_at_ts:Date.now()};i.type!==void 0&&(o.type=i.type),i.phone_number!==void 0&&(o.phone_number=i.phone_number),i.totp_secret!==void 0&&(o.totp_secret=i.totp_secret),i.credential_id!==void 0&&(o.credential_id=i.credential_id),i.public_key!==void 0&&(o.public_key=i.public_key),i.sign_count!==void 0&&(o.sign_count=i.sign_count),i.credential_backed_up!==void 0&&(o.credential_backed_up=i.credential_backed_up?1:0),i.transports!==void 0&&(o.transports=JSON.stringify(i.transports)),i.friendly_name!==void 0&&(o.friendly_name=i.friendly_name),i.confirmed!==void 0&&(o.confirmed=i.confirmed?1:0),await e.update(pe).set(o).where(w(_(pe.tenant_id,t),_(pe.id,n)));const a=await this.get(t,n);if(!a)throw new Error(`Authentication method ${n} not found after update`);return a},async remove(t,n){return(await e.delete(pe).where(w(_(pe.tenant_id,t),_(pe.id,n))).returning()).length>0}}}function Mh(){const{customAlphabet:e}=require("nanoid");return`org_${e("0123456789abcdefghijklmnopqrstuvwxyz",17)()}`}function Ln(e){const{tenant_id:t,branding:n,metadata:i,enabled_connections:o,token_quota:a,...s}=e;return K({...s,branding:R(n,{}),metadata:R(i,{}),enabled_connections:R(o,[]),token_quota:R(a,{})})}function jh(e){return{async create(t,n){var s,c;const i=new Date().toISOString(),a={id:n.id||Mh(),tenant_id:t,name:n.name,display_name:n.display_name,branding:JSON.stringify(n.branding||{}),metadata:JSON.stringify(n.metadata||{}),enabled_connections:JSON.stringify(n.enabled_connections||[]),token_quota:JSON.stringify(n.token_quota||{}),created_at:i,updated_at:i};try{await e.insert(Y).values(a)}catch(u){throw(s=u==null?void 0:u.message)!=null&&s.includes("UNIQUE constraint failed")||(c=u==null?void 0:u.message)!=null&&c.includes("AlreadyExists")?new lt(409,{message:"Organization already exists"}):u}return Ln({...a,tenant_id:t})},async get(t,n){let i=await e.select().from(Y).where(w(_(Y.tenant_id,t),_(Y.id,n))).get();return i||(i=await e.select().from(Y).where(w(_(Y.tenant_id,t),_(Y.name,n))).get()),i?Ln(i):null},async update(t,n,i){const o={updated_at:new Date().toISOString()};return i.name!==void 0&&(o.name=i.name),i.display_name!==void 0&&(o.display_name=i.display_name),i.branding!==void 0&&(o.branding=JSON.stringify(i.branding)),i.metadata!==void 0&&(o.metadata=JSON.stringify(i.metadata)),i.enabled_connections!==void 0&&(o.enabled_connections=JSON.stringify(i.enabled_connections)),i.token_quota!==void 0&&(o.token_quota=JSON.stringify(i.token_quota)),(await e.update(Y).set(o).where(w(_(Y.tenant_id,t),_(Y.id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{};let u=e.select().from(Y).where(_(Y.tenant_id,t)).$dynamic();if(c&&(u=u.where(Be(St(Y.name,`%${c}%`),St(Y.display_name,`%${c}%`)))),s!=null&&s.sort_by){const y=Y[s.sort_by];y&&(u=u.orderBy(s.sort_order==="desc"?le(y):me(y)))}const d=(await u.offset(i*o).limit(o)).map(Ln);if(!a)return{organizations:d};const h=[_(Y.tenant_id,t)];c&&h.push(Be(St(Y.name,`%${c}%`),St(Y.display_name,`%${c}%`)));const[m]=await e.select({count:ye()}).from(Y).where(w(...h));return{organizations:d,start:i*o,limit:o,length:Number((m==null?void 0:m.count)??0)}},async remove(t,n){return(await e.delete(Y).where(w(_(Y.tenant_id,t),_(Y.id,n))).returning()).length>0}}}function Pn(e){const{tenant_id:t,is_current:n,...i}=e;return{...i,is_current:!!n}}function qh(e){return{async create(t,n){const i=new Date().toISOString(),o=n.id||Le();n.is_current!==!1&&await e.update(oe).set({is_current:0}).where(w(_(oe.tenant_id,t),_(oe.user_id,n.user_id)));const a={id:o,tenant_id:t,user_id:n.user_id,password:n.password,algorithm:n.algorithm||"bcrypt",is_current:n.is_current!==!1?1:0,created_at:i,updated_at:i};return await e.insert(oe).values(a),Pn({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(oe).where(w(_(oe.tenant_id,t),_(oe.user_id,n),_(oe.is_current,1))).get();return i?Pn(i):null},async list(t,n,i){let o=e.select().from(oe).where(w(_(oe.tenant_id,t),_(oe.user_id,n))).orderBy(le(oe.created_at)).$dynamic();return i&&(o=o.limit(i)),(await o).map(Pn)},async update(t,n){const i={updated_at:new Date().toISOString()};return n.password!==void 0&&(i.password=n.password),n.algorithm!==void 0&&(i.algorithm=n.algorithm),n.is_current!==void 0&&(i.is_current=n.is_current?1:0),n.id?await e.update(oe).set(i).where(w(_(oe.tenant_id,t),_(oe.id,n.id))):await e.update(oe).set(i).where(w(_(oe.tenant_id,t),_(oe.user_id,n.user_id),_(oe.is_current,1))),!0}}}function Bh(e){return{async get(t){const n=await e.select().from(Rt).where(_(Rt.tenant_id,t)).get();return n?{universal_login_experience:n.universal_login_experience,identifier_first:!!n.identifier_first,password_first:!!n.password_first,webauthn_platform_first_factor:!!n.webauthn_platform_first_factor}:{universal_login_experience:"new",identifier_first:!0,password_first:!1,webauthn_platform_first_factor:!1}},async set(t,n){await e.insert(Rt).values({tenant_id:t,universal_login_experience:n.universal_login_experience,identifier_first:n.identifier_first,password_first:n.password_first,webauthn_platform_first_factor:n.webauthn_platform_first_factor}).onConflictDoUpdate({target:Rt.tenant_id,set:{universal_login_experience:n.universal_login_experience,identifier_first:n.identifier_first,password_first:n.password_first,webauthn_platform_first_factor:n.webauthn_platform_first_factor}})}}}function on(e){const{tenant_id:t,created_at_ts:n,expires_at_ts:i,idle_expires_at_ts:o,last_exchanged_at_ts:a,revoked_at_ts:s,rotated_at_ts:c,device:u,resource_servers:p,rotating:d,...h}=e,m=Ht({created_at_ts:n,expires_at_ts:i,idle_expires_at_ts:o,last_exchanged_at_ts:a,revoked_at_ts:s,rotated_at_ts:c},["created_at_ts"],["expires_at_ts","idle_expires_at_ts","last_exchanged_at_ts","revoked_at_ts","rotated_at_ts"]);return K({...h,...m,rotating:!!d,device:R(u,{}),resource_servers:R(p,[])})}function Jh(e,t){return Math.max(e??0,t??0)}function Kh(e){return{async create(t,n){const i=Date.now(),o={id:n.id||Le(),tenant_id:t,client_id:n.client_id,login_id:n.login_id,user_id:n.user_id,device:JSON.stringify(n.device||{}),resource_servers:JSON.stringify(n.resource_servers||[]),rotating:n.rotating??!1,token_lookup:n.token_lookup??null,token_hash:n.token_hash??null,family_id:n.family_id??null,rotated_to:n.rotated_to??null,rotated_at_ts:te(n.rotated_at),created_at_ts:i,expires_at_ts:te(n.expires_at),idle_expires_at_ts:te(n.idle_expires_at),last_exchanged_at_ts:te(n.last_exchanged_at)};await e.run(k`BEGIN`);try{await e.insert(J).values(o);const a=Jh(o.expires_at_ts,o.idle_expires_at_ts);a>0&&o.login_id&&await e.update(Q).set({expires_at_ts:a,updated_at_ts:i}).where(w(_(Q.tenant_id,t),_(Q.id,o.login_id),Qe(Q.expires_at_ts,a))),await e.run(k`COMMIT`)}catch(a){throw await e.run(k`ROLLBACK`),a}return on({...o,tenant_id:t})},async get(t,n){const i=await e.select().from(J).where(w(_(J.tenant_id,t),_(J.id,n))).get();return i?on(i):null},async getByLookup(t,n){const i=await e.select().from(J).where(w(_(J.tenant_id,t),_(J.token_lookup,n))).get();return i?on(i):null},async update(t,n,i,o){const a={};i.device!==void 0&&(a.device=JSON.stringify(i.device)),i.resource_servers!==void 0&&(a.resource_servers=JSON.stringify(i.resource_servers)),i.rotating!==void 0&&(a.rotating=i.rotating),i.token_lookup!==void 0&&(a.token_lookup=i.token_lookup),i.token_hash!==void 0&&(a.token_hash=i.token_hash),i.family_id!==void 0&&(a.family_id=i.family_id),i.rotated_to!==void 0&&(a.rotated_to=i.rotated_to),i.rotated_at!==void 0&&(a.rotated_at_ts=te(i.rotated_at)),i.expires_at!==void 0&&(a.expires_at_ts=te(i.expires_at)),i.idle_expires_at!==void 0&&(a.idle_expires_at_ts=te(i.idle_expires_at)),i.last_exchanged_at!==void 0&&(a.last_exchanged_at_ts=te(i.last_exchanged_at)),i.revoked_at!==void 0&&(a.revoked_at_ts=te(i.revoked_at));const s=o==null?void 0:o.loginSessionBump,c=s?te(s.expires_at):null,u=await e.update(J).set(a).where(w(_(J.tenant_id,t),_(J.id,n))).returning();return s!=null&&s.login_id&&c&&c>0&&await e.update(Q).set({expires_at_ts:c,updated_at_ts:Date.now()}).where(w(_(Q.tenant_id,t),_(Q.id,s.login_id),Qe(Q.expires_at_ts,c))).catch(()=>{}),u.length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{};let u=e.select().from(J).where(_(J.tenant_id,t)).$dynamic();if(c){const m=Ye(J,c,["user_id"]);m&&(u=u.where(w(_(J.tenant_id,t),m)))}if(s!=null&&s.sort_by){const m=J[s.sort_by];m&&(u=u.orderBy(s.sort_order==="desc"?le(m):me(m)))}const d=(await u.offset(i*o).limit(o)).map(on);if(!a)return{refresh_tokens:d};const[h]=await e.select({count:ye()}).from(J).where(_(J.tenant_id,t));return{refresh_tokens:d,start:i*o,limit:o,length:Number((h==null?void 0:h.count)??0)}},async remove(t,n){return(await e.delete(J).where(w(_(J.tenant_id,t),_(J.id,n))).returning()).length>0},async revokeByLoginSession(t,n,i){return(await e.update(J).set({revoked_at_ts:te(i)}).where(w(_(J.tenant_id,t),_(J.login_id,n),xe(J.revoked_at_ts))).returning()).length},async revokeFamily(t,n,i){return(await e.update(J).set({revoked_at_ts:te(i)}).where(w(_(J.tenant_id,t),_(J.family_id,n),xe(J.revoked_at_ts))).returning()).length}}}function Gh(){const{customAlphabet:e}=require("nanoid");return`api_${e("0123456789abcdefghijklmnopqrstuvwxyz",17)()}`}const ci=["skip_consent_for_verifiable_first_party_clients","allow_offline_access","is_system"],so=new Set(["id","tenant_id","identifier","name","scopes","signing_alg","signing_secret","token_lifetime","token_lifetime_for_web","skip_consent_for_verifiable_first_party_clients","allow_offline_access","verification_key","options","is_system","metadata","created_at","updated_at"]);function Un(e){const{tenant_id:t,verification_key:n,scopes:i,options:o,metadata:a,...s}=e,c={...s};c.scopes=R(i,[]),c.options=R(o,{}),c.metadata=R(a),n!==void 0&&(c.verificationKey=n);for(const u of ci)s[u]!==void 0&&s[u]!==null&&(c[u]=!!s[u]);return K(c)}function Vh(e){return{async create(t,n){const i=new Date().toISOString(),a={id:n.id||Gh(),tenant_id:t,identifier:n.identifier,name:n.name,signing_alg:n.signing_alg,signing_secret:n.signing_secret,token_lifetime:n.token_lifetime,token_lifetime_for_web:n.token_lifetime_for_web,scopes:JSON.stringify(n.scopes||[]),options:JSON.stringify(n.options||{}),metadata:n.metadata?JSON.stringify(n.metadata):void 0,verification_key:n.verificationKey||n.verification_key,created_at:i,updated_at:i};for(const s of ci)n[s]!==void 0&&(a[s]=n[s]?1:0);return a.is_system===void 0&&(a.is_system=0),await e.insert(ee).values(a),Un({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(ee).where(w(_(ee.tenant_id,t),_(ee.id,n))).get();return i?Un(i):null},async update(t,n,i){const o={updated_at:new Date().toISOString()};i.name!==void 0&&(o.name=i.name),i.identifier!==void 0&&(o.identifier=i.identifier),i.signing_alg!==void 0&&(o.signing_alg=i.signing_alg),i.signing_secret!==void 0&&(o.signing_secret=i.signing_secret),i.token_lifetime!==void 0&&(o.token_lifetime=i.token_lifetime),i.token_lifetime_for_web!==void 0&&(o.token_lifetime_for_web=i.token_lifetime_for_web),i.scopes!==void 0&&(o.scopes=JSON.stringify(i.scopes)),i.options!==void 0&&(o.options=k`json_patch(COALESCE(${ee.options}, '{}'), ${JSON.stringify(i.options)})`),i.metadata!==void 0&&(o.metadata=JSON.stringify(i.metadata)),i.verificationKey!==void 0&&(o.verification_key=i.verificationKey);for(const s of ci)i[s]!==void 0&&(o[s]=i[s]?1:0);return(await e.update(ee).set(o).where(w(_(ee.tenant_id,t),_(ee.id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{},u=Math.max(0,Math.floor(Number(i)||0)),p=Math.min(Math.max(1,Math.floor(Number(o)||50)),500),d=[_(ee.tenant_id,t)];if(c){const C=c.match(/^([^:]+):(.+)$/);if(C){const[,L,x]=C,G=L==null?void 0:L.startsWith("-"),X=G?L==null?void 0:L.substring(1):L;if(X&&so.has(X)&&!G){const V=ee[X];d.push(St(V,`%${x}%`))}}}let h=e.select().from(ee).where(w(...d)).$dynamic();if(s!=null&&s.sort_by&&so.has(s.sort_by)){const C=ee[s.sort_by];h=h.orderBy(s.sort_order==="desc"?le(C):me(C))}const y=(await h.offset(u*p).limit(p)).map(Un);if(!a)return{resource_servers:y};const[S]=await e.select({count:ye()}).from(ee).where(w(...d));return{resource_servers:y,start:u*p,limit:p,length:Number((S==null?void 0:S.count)??0)}},async remove(t,n){return(await e.delete(ee).where(w(_(ee.tenant_id,t),_(ee.id,n))).returning()).length>0}}}function Hh(e){return{async assign(t,n,i){const o=new Date().toISOString();return await e.insert(Fe).values(i.map(a=>({tenant_id:t,role_id:n,resource_server_identifier:a.resource_server_identifier,permission_name:a.permission_name,created_at:o}))).onConflictDoNothing(),!0},async list(t,n,i){const o=await e.select({resource_server_identifier:Fe.resource_server_identifier,permission_name:Fe.permission_name,created_at:Fe.created_at}).from(Fe).where(w(_(Fe.tenant_id,t),_(Fe.role_id,n))).all(),a=[...new Set(o.map(c=>c.resource_server_identifier))],s=new Map;if(a.length>0){const c=await e.select({identifier:ee.identifier,name:ee.name}).from(ee).where(w(_(ee.tenant_id,t),Re(ee.identifier,a))).all();for(const u of c)s.set(u.identifier,u.name)}return o.map(c=>({...c,resource_server_name:s.get(c.resource_server_identifier)||c.resource_server_identifier}))},async remove(t,n,i){const o=i.map(s=>w(_(Fe.resource_server_identifier,s.resource_server_identifier),_(Fe.permission_name,s.permission_name)));return(await e.delete(Fe).where(w(_(Fe.tenant_id,t),_(Fe.role_id,n),Be(...o))).returning()).length>0}}}function Wh(e){return{async create(t,n,i,o){var a,s;try{await e.insert(je).values({tenant_id:t,user_id:n,resource_server_identifier:i.resource_server_identifier,permission_name:i.permission_name,organization_id:o||"",created_at:new Date().toISOString()})}catch(c){if((a=c==null?void 0:c.message)!=null&&a.includes("UNIQUE constraint")||(s=c==null?void 0:c.message)!=null&&s.includes("SQLITE_CONSTRAINT_PRIMARYKEY"))return!0;throw c}return!0},async list(t,n,i,o){let a=[_(je.tenant_id,t),_(je.user_id,n)];o&&a.push(_(je.organization_id,o));const s=await e.select().from(je).where(w(...a)).all();return await Promise.all(s.map(async u=>{const p=await e.select({name:ee.name}).from(ee).where(w(_(ee.tenant_id,t),_(ee.identifier,u.resource_server_identifier))).get();return{resource_server_identifier:u.resource_server_identifier,permission_name:u.permission_name,resource_server_name:(p==null?void 0:p.name)||u.resource_server_identifier,organization_id:u.organization_id===""?void 0:u.organization_id}}))},async remove(t,n,i,o){return(await e.delete(je).where(w(_(je.tenant_id,t),_(je.user_id,n),_(je.resource_server_identifier,i.resource_server_identifier),_(je.permission_name,i.permission_name),_(je.organization_id,o||""))).returning()).length>0}}}function Fn(e){const{tenant_id:t,is_system:n,metadata:i,...o}=e;return K({...o,is_system:n?!0:void 0,metadata:R(i)})}function Qh(e){return{async create(t,n){const i=new Date().toISOString(),a={id:n.id||Le(),tenant_id:t,name:n.name,description:n.description,is_system:n.is_system?1:0,metadata:n.metadata?JSON.stringify(n.metadata):void 0,created_at:i,updated_at:i};return await e.insert(_e).values(a),Fn({...a,tenant_id:t})},async get(t,n){const i=await e.select().from(_e).where(w(_(_e.tenant_id,t),_(_e.id,n))).get();return i?Fn(i):null},async update(t,n,i){const o={updated_at:new Date().toISOString()};return i.name!==void 0&&(o.name=i.name),i.description!==void 0&&(o.description=i.description),i.is_system!==void 0&&(o.is_system=i.is_system?1:0),i.metadata!==void 0&&(o.metadata=JSON.stringify(i.metadata)),(await e.update(_e).set(o).where(w(_(_e.tenant_id,t),_(_e.id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{},u=c?Ye(_e,c,["name"]):void 0,p=u?w(_(_e.tenant_id,t),u):_(_e.tenant_id,t);let d=e.select().from(_e).where(p).$dynamic();if(s!=null&&s.sort_by){const S=_e[s.sort_by];S&&(d=d.orderBy(s.sort_order==="desc"?le(S):me(S)))}const m=(await d.offset(i*o).limit(o)).map(Fn);if(!a)return{roles:m};const[y]=await e.select({count:ye()}).from(_e).where(p);return{roles:m,start:i*o,limit:o,length:Number((y==null?void 0:y.count)??0)}},async remove(t,n){return(await e.delete(_e).where(w(_(_e.tenant_id,t),_(_e.id,n))).returning()).length>0}}}const Xh=["created_at_ts","updated_at_ts"],Yh=["expires_at_ts","idle_expires_at_ts","authenticated_at_ts","last_interaction_at_ts","used_at_ts","revoked_at_ts"];function Zn(e){const{tenant_id:t,created_at_ts:n,updated_at_ts:i,expires_at_ts:o,idle_expires_at_ts:a,authenticated_at_ts:s,last_interaction_at_ts:c,used_at_ts:u,revoked_at_ts:p,device:d,clients:h,...m}=e,y=Ht({created_at_ts:n,updated_at_ts:i,expires_at_ts:o,idle_expires_at_ts:a,authenticated_at_ts:s,last_interaction_at_ts:c,used_at_ts:u,revoked_at_ts:p},[...Xh],[...Yh]);return K({...m,...y,device:R(d,{}),clients:R(h,[])})}function em(e){return{async create(t,n){const i=Date.now(),o={id:n.id||Le(),tenant_id:t,user_id:n.user_id,login_session_id:n.login_session_id,device:JSON.stringify(n.device||{}),clients:JSON.stringify(n.clients||[]),created_at_ts:i,updated_at_ts:i,expires_at_ts:te(n.expires_at),idle_expires_at_ts:te(n.idle_expires_at),authenticated_at_ts:n.authenticated_at?te(n.authenticated_at):i,last_interaction_at_ts:n.last_interaction_at?te(n.last_interaction_at):i,used_at_ts:te(n.used_at),revoked_at_ts:te(n.revoked_at)};return await e.insert(se).values(o),Zn({...o,tenant_id:t})},async get(t,n){const i=await e.select().from(se).where(w(_(se.tenant_id,t),_(se.id,n))).get();return i?Zn(i):null},async update(t,n,i){const o={updated_at_ts:Date.now()};return i.user_id!==void 0&&(o.user_id=i.user_id),i.login_session_id!==void 0&&(o.login_session_id=i.login_session_id),i.device!==void 0&&(o.device=JSON.stringify(i.device)),i.clients!==void 0&&(o.clients=JSON.stringify(i.clients)),i.expires_at!==void 0&&(o.expires_at_ts=te(i.expires_at)),i.idle_expires_at!==void 0&&(o.idle_expires_at_ts=te(i.idle_expires_at)),i.authenticated_at!==void 0&&(o.authenticated_at_ts=te(i.authenticated_at)),i.last_interaction_at!==void 0&&(o.last_interaction_at_ts=te(i.last_interaction_at)),i.used_at!==void 0&&(o.used_at_ts=te(i.used_at)),i.revoked_at!==void 0&&(o.revoked_at_ts=te(i.revoked_at)),(await e.update(se).set(o).where(w(_(se.tenant_id,t),_(se.id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,sort:s,q:c}=n||{},u=c?Ye(se,c,["user_id"]):void 0,p=u?w(_(se.tenant_id,t),u):_(se.tenant_id,t);let d=e.select().from(se).where(p).$dynamic();if(s!=null&&s.sort_by){const S=se[s.sort_by];S&&(d=d.orderBy(s.sort_order==="desc"?le(S):me(S)))}const m=(await d.offset(i*o).limit(o)).map(Zn);if(!a)return{sessions:m};const[y]=await e.select({count:ye()}).from(se).where(p);return{sessions:m,start:i*o,limit:o,length:Number((y==null?void 0:y.count)??0)}},async remove(t,n){return(await e.delete(se).where(w(_(se.tenant_id,t),_(se.id,n))).returning()).length>0}}}const ac=["session_cookie","enabled_locales","error_page","flags","sandbox_versions_available","change_password","guardian_mfa_page","sessions","oidc_logout","device_flow","default_token_quota","allowed_logout_urls","acr_values_supported","mtls","mfa"],sc=["allow_organization_name_in_authentication_api","customize_mfa_in_postlogin_action","pushed_authorization_requests_supported","authorization_response_iss_parameter_supported"];function lo(e){const t={...e};for(const n of ac)typeof t[n]=="string"&&(t[n]=R(t[n]));for(const n of sc)t[n]!==void 0&&t[n]!==null&&(t[n]=t[n]===1);return K(t)}function co(e){const t={...e};xc(e,ac,t);for(const n of sc)e[n]!==void 0&&(t[n]=e[n]?1:0);return Pa(t)}function tm(e){return{async create(t){var o,a;const n={id:t.id||Le(),created_at:new Date().toISOString(),updated_at:new Date().toISOString(),...t},i=co(n);try{await e.insert(F).values(i)}catch(s){throw(o=s==null?void 0:s.message)!=null&&o.includes("UNIQUE constraint failed")||(a=s==null?void 0:s.message)!=null&&a.includes("duplicate key")||(s==null?void 0:s.code)==="SQLITE_CONSTRAINT"?new lt(409,{message:`Tenant with ID '${n.id}' already exists`}):s}return n},async get(t){const n=await e.select().from(F).where(_(F.id,t)).get();return n?lo(n):null},async list(t){const{page:n=0,per_page:i=50,include_totals:o=!1,sort:a,q:s}=t||{};let c=e.select().from(F).$dynamic();if(s){const h=Ye(F,s,["friendly_name"]);h&&(c=c.where(h))}if(a!=null&&a.sort_by){const h=F[a.sort_by];h&&(c=c.orderBy(a.sort_order==="desc"?le(h):me(h)))}const p=(await c.offset(n*i).limit(i)).map(lo);if(!o)return{tenants:p};const[d]=await e.select({count:ye()}).from(F);return{tenants:p,start:n*i,limit:i,length:Number((d==null?void 0:d.count)??0)}},async update(t,n){const i=co({...n,id:t,updated_at:new Date().toISOString()});await e.update(F).set(i).where(_(F.id,t))},async remove(t){return(await e.delete(F).where(_(F.id,t)).returning()).length>0}}}const nm=["colors","borders","fonts","page_background","widget"];function uo(e){const{tenant_id:t,...n}=e,i=Ua(n,nm);return i.borders&&(i.borders.show_widget_shadow=!!i.borders.show_widget_shadow),i.fonts&&(i.fonts.links_bold=!!i.fonts.links_bold,i.fonts.subtitle_bold=!!i.fonts.subtitle_bold,i.fonts.title_bold=!!i.fonts.title_bold),K(i)}function im(e){return{async create(t,n,i){const o=new Date().toISOString(),a=i||Le(),c={...Jn(n),tenant_id:t,themeId:a,created_at:o,updated_at:o};return await e.insert(Ve).values(c),uo({...c,tenant_id:t})},async get(t,n){const i=await e.select().from(Ve).where(w(_(Ve.tenant_id,t),_(Ve.themeId,n))).get();return i?uo(i):null},async update(t,n,i){const o=Jn(i);return o.updated_at=new Date().toISOString(),await e.update(Ve).set(o).where(w(_(Ve.tenant_id,t),_(Ve.themeId,n))),!0},async remove(t,n){return(await e.delete(Ve).where(w(_(Ve.tenant_id,t),_(Ve.themeId,n))).returning()).length>0}}}function om(e){return{async get(t){const n=await e.select({body:ot.body}).from(ot).where(_(ot.tenant_id,t)).get();return n?{body:n.body}:null},async set(t,n){const i=Date.now();await e.insert(ot).values({tenant_id:t,body:n.body,created_at_ts:i,updated_at_ts:i}).onConflictDoUpdate({target:ot.tenant_id,set:{body:n.body,updated_at_ts:i}})},async delete(t){await e.delete(ot).where(_(ot.tenant_id,t))}}}function _o(e,t){const n={connection:e.connection,provider:e.provider,user_id:e.user_id,isSocial:!!e.is_social};return t?n.isPrimary=!0:n.profileData={email:e.email,email_verified:!!e.email_verified,...typeof e.profileData=="string"?R(e.profileData,{}):{}},n}function Mn(e,t=[]){const{tenant_id:n,app_metadata:i,user_metadata:o,address:a,email_verified:s,phone_verified:c,is_social:u,linked_to:p,profileData:d,...h}=e,m=_o(e,!0),y=t.map(S=>_o(S,!1));return K({...h,email:e.email||"",email_verified:!!s,phone_verified:c!=null?!!c:void 0,is_social:!!u,app_metadata:R(i,{}),user_metadata:R(o,{}),address:R(a),identities:[m,...y]})}function rm(e){const t=async(n,i)=>{var c,u;const o=new Date().toISOString(),a={user_id:i.user_id,tenant_id:n,email:i.email,given_name:i.given_name,family_name:i.family_name,nickname:i.nickname,name:i.name,picture:i.picture,tags:i.tags,phone_number:i.phone_number,phone_verified:i.phone_verified??!1,username:i.username,linked_to:i.linked_to,last_ip:i.last_ip,login_count:i.login_count??0,last_login:i.last_login,provider:i.provider,connection:i.connection,email_verified:i.email_verified??!1,is_social:i.is_social??!1,app_metadata:JSON.stringify(i.app_metadata||{}),user_metadata:JSON.stringify(i.user_metadata||{}),address:i.address?JSON.stringify(i.address):void 0,profileData:i.profileData?JSON.stringify(i.profileData):void 0,locale:i.locale,middle_name:i.middle_name,preferred_username:i.preferred_username,profile:i.profile,website:i.website,gender:i.gender,birthdate:i.birthdate,zoneinfo:i.zoneinfo,created_at:i.created_at||o,updated_at:i.updated_at||o},s=i.password?Le():void 0;try{if(i.password&&s){await e.run(k`BEGIN`);try{await e.insert(q).values(a),await e.insert(oe).values({id:s,tenant_id:n,user_id:i.user_id,password:i.password.hash||i.password,algorithm:i.password.algorithm||"bcrypt",is_current:1,created_at:o,updated_at:o}),await e.run(k`COMMIT`)}catch(p){throw await e.run(k`ROLLBACK`),p}}else await e.insert(q).values(a)}catch(p){throw(c=p==null?void 0:p.message)!=null&&c.includes("UNIQUE constraint")||(u=p==null?void 0:p.message)!=null&&u.includes("AlreadyExists")?new lt(409,{message:"User already exists"}):(console.error("User upsert failed:",p==null?void 0:p.code,p==null?void 0:p.message),new lt(500,{message:"Internal server error"}))}return Mn(a)};return{create:t,rawCreate:t,async get(n,i){const o=await e.select().from(q).where(w(_(q.tenant_id,n),_(q.user_id,i))).get();if(!o)return null;const a=await e.select().from(q).where(w(_(q.tenant_id,n),_(q.linked_to,i))).all();return Mn(o,a)},async update(n,i,o){const a={updated_at:new Date().toISOString()},s=["email","given_name","family_name","nickname","name","picture","tags","phone_number","username","linked_to","last_ip","login_count","last_login","provider","connection","locale","middle_name","preferred_username","profile","website","gender","birthdate","zoneinfo"];for(const u of s)o[u]!==void 0&&(a[u]=o[u]);return o.email_verified!==void 0&&(a.email_verified=o.email_verified),o.phone_verified!==void 0&&(a.phone_verified=o.phone_verified),o.is_social!==void 0&&(a.is_social=o.is_social),o.app_metadata!==void 0&&(a.app_metadata=JSON.stringify(o.app_metadata)),o.user_metadata!==void 0&&(a.user_metadata=JSON.stringify(o.user_metadata)),o.address!==void 0&&(a.address=JSON.stringify(o.address)),o.profileData!==void 0&&(a.profileData=JSON.stringify(o.profileData)),(await e.update(q).set(a).where(w(_(q.tenant_id,n),_(q.user_id,i))).returning()).length>0},async list(n,i){const{page:o=0,per_page:a=50,include_totals:s=!1,sort:c,q:u}=i||{},p=[_(q.tenant_id,n),xe(q.linked_to)];if(u){const x=Ye(q,u,["email","name","nickname","username"]);x&&p.push(x)}const d=w(...p);let h=e.select().from(q).where(d).$dynamic();if(c!=null&&c.sort_by){const x=q[c.sort_by];x&&(h=h.orderBy(c.sort_order==="desc"?le(x):me(x)))}const m=await h.offset(o*a).limit(a),y=m.map(x=>x.user_id);let S=[];y.length>0&&(S=await e.select().from(q).where(w(_(q.tenant_id,n),Re(q.linked_to,y))));const C=m.map(x=>{const G=S.filter(X=>X.linked_to===x.user_id);return Mn(x,G)});if(!s)return{users:C};const[L]=await e.select({count:ye()}).from(q).where(d);return{users:C,start:o*a,limit:a,length:Number((L==null?void 0:L.count)??0)}},async remove(n,i){await e.run(k`BEGIN`);try{const o=await e.select({user_id:q.user_id}).from(q).where(w(_(q.tenant_id,n),_(q.linked_to,i))),a=[i,...o.map(c=>c.user_id)];await e.delete(pe).where(w(_(pe.tenant_id,n),Re(pe.user_id,a))),await e.delete(oe).where(w(_(oe.tenant_id,n),Re(oe.user_id,a))),await e.delete(q).where(w(_(q.tenant_id,n),_(q.linked_to,i)));const s=await e.delete(q).where(w(_(q.tenant_id,n),_(q.user_id,i))).returning();return await e.run(k`COMMIT`),s.length>0}catch(o){throw await e.run(k`ROLLBACK`),o}},async unlink(n,i,o,a){const s=`${o}|${a}`;return(await e.update(q).set({linked_to:null}).where(w(_(q.tenant_id,n),_(q.user_id,s),_(q.linked_to,i))).returning()).length>0}}}function am(e){return{async create(t,n,i,o){var a,s;try{await e.insert(qe).values({tenant_id:t,user_id:n,role_id:i,organization_id:o||"",created_at:new Date().toISOString()})}catch(c){if((a=c==null?void 0:c.message)!=null&&a.includes("UNIQUE constraint")||(s=c==null?void 0:c.message)!=null&&s.includes("SQLITE_CONSTRAINT_PRIMARYKEY"))return!0;throw c}return!0},async list(t,n,i,o){let a=[_(qe.tenant_id,t),_(qe.user_id,n)];o&&a.push(_(qe.organization_id,o));const s=await e.select({role_id:qe.role_id}).from(qe).where(w(...a)).all();return s.length===0?[]:(await Promise.all(s.map(async u=>{const p=await e.select().from(_e).where(w(_(_e.tenant_id,t),_(_e.id,u.role_id))).get();if(!p)return null;const{tenant_id:d,is_system:h,metadata:m,...y}=p;return K({...y,is_system:h?!0:void 0,metadata:R(m)})}))).filter(Boolean)},async remove(t,n,i,o){return(await e.delete(qe).where(w(_(qe.tenant_id,t),_(qe.user_id,n),_(qe.role_id,i),_(qe.organization_id,o||""))).returning()).length>0}}}function sm(e){return{async create(t,n){var u,p;const i=new Date().toISOString(),a={id:n.id||Le(),tenant_id:t,user_id:n.user_id,organization_id:n.organization_id,created_at:i,updated_at:i};try{await e.insert(ue).values(a)}catch(d){throw(u=d==null?void 0:d.message)!=null&&u.includes("UNIQUE constraint")||(p=d==null?void 0:d.message)!=null&&p.includes("duplicate key")?new lt(409,{message:"User organization already exists"}):d}const{tenant_id:s,...c}=a;return c},async get(t,n){const i=await e.select().from(ue).where(w(_(ue.tenant_id,t),_(ue.id,n))).get();if(!i)return null;const{tenant_id:o,...a}=i;return a},async update(t,n,i){const o={updated_at:new Date().toISOString()};return i.user_id!==void 0&&(o.user_id=i.user_id),i.organization_id!==void 0&&(o.organization_id=i.organization_id),(await e.update(ue).set(o).where(w(_(ue.tenant_id,t),_(ue.id,n))).returning()).length>0},async list(t,n){const{page:i=0,per_page:o=50,include_totals:a=!1,q:s}=n||{},c=_(ue.tenant_id,t);let u=c;if(s){const m=Ye(ue,s,["user_id","organization_id"]);m&&(u=w(c,m))}const d=(await e.select().from(ue).where(u).offset(i*o).limit(o)).map(m=>{const{tenant_id:y,...S}=m;return S});if(!a)return{userOrganizations:d};const[h]=await e.select({count:ye()}).from(ue).where(u);return{userOrganizations:d,start:i*o,limit:o,length:Number((h==null?void 0:h.count)??0)}},async listUserOrganizations(t,n,i){const{page:o=0,per_page:a=50,include_totals:s=!1}=i||{},c=await e.select().from(ue).where(w(_(ue.tenant_id,t),_(ue.user_id,n))).offset(o*a).limit(a).all(),p=(await Promise.all(c.map(async h=>{const m=await e.select().from(Y).where(w(_(Y.tenant_id,t),_(Y.id,h.organization_id))).get();if(!m)return null;const{tenant_id:y,branding:S,metadata:C,enabled_connections:L,token_quota:x,...G}=m;return K({...G,branding:R(S,{}),metadata:R(C,{}),enabled_connections:R(L,[]),token_quota:R(x,{})})}))).filter(Boolean);if(!s)return{organizations:p};const[d]=await e.select({count:ye()}).from(ue).where(w(_(ue.tenant_id,t),_(ue.user_id,n)));return{organizations:p,start:o*a,limit:a,length:Number((d==null?void 0:d.count)??0)}},async remove(t,n){return(await e.delete(ue).where(w(_(ue.tenant_id,t),_(ue.id,n))).returning()).length>0}}}const po=["s"],lm=["pwd_leak"];function fo(e){return/^\d{8}$/.test(e)?`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`:e}function cm(e){return{async getDaily(t,n){const i=new Date,o=n!=null&&n.from?fo(n.from):new Date(i.getTime()-30*24*60*60*1e3).toISOString().split("T")[0],a=n!=null&&n.to?fo(n.to):i.toISOString().split("T")[0];return(await e.select({date:k`substr(${$.date}, 1, 10)`.as("date"),logins:k`SUM(CASE WHEN ${$.type} IN (${k.join(po.map(c=>k`${c}`),k`, `)}) THEN 1 ELSE 0 END)`.as("logins"),signups:k`SUM(CASE WHEN ${$.type} = 'ss' THEN 1 ELSE 0 END)`.as("signups"),leaked_passwords:k`SUM(CASE WHEN ${$.type} IN (${k.join(lm.map(c=>k`${c}`),k`, `)}) THEN 1 ELSE 0 END)`.as("leaked_passwords")}).from($).where(w(_($.tenant_id,t),Tt($.date,o),pt($.date,`${a}T23:59:59.999Z`))).groupBy(k`substr(${$.date}, 1, 10)`).orderBy(k`substr(${$.date}, 1, 10)`).all()).map(c=>({date:c.date,logins:Number(c.logins)||0,signups:Number(c.signups)||0,leaked_passwords:Number(c.leaked_passwords)||0,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}))},async getActiveUsers(t){const n=new Date(Date.now()-2592e6).toISOString(),[i]=await e.select({count:k`COUNT(DISTINCT ${$.user_id})`.as("count")}).from($).where(w(_($.tenant_id,t),Tt($.date,n),k`${$.type} IN (${k.join(po.map(o=>k`${o}`),k`, `)})`));return Number(i==null?void 0:i.count)||0}}}const um={"active-users":["s","seacft"],logins:["s","f","fp"],signups:["ss","fs"],"refresh-tokens":["seacft","fertft"],sessions:["slo"]},dm={"active-users":{alias:"active_users",type:"UInt64",agg:"uniq"},logins:{alias:"logins",type:"UInt64",agg:"count"},signups:{alias:"signups",type:"UInt64",agg:"count"},"refresh-tokens":{alias:"refresh_tokens",type:"UInt64",agg:"count"},sessions:{alias:"sessions",type:"UInt64",agg:"count"}};function _m(e){switch(e){case"hour":return k`substr(${$.date}, 1, 13)`;case"month":return k`substr(${$.date}, 1, 7)`;case"day":return k`substr(${$.date}, 1, 10)`;case"week":return k`date(substr(${$.date}, 1, 10), '-' || ((cast(strftime('%w', substr(${$.date}, 1, 10)) as integer) + 6) % 7) || ' days')`;default:throw new Error(`Unsupported interval '${e}' for SQL analytics adapter`)}}function jn(e){return`"${e.replace(/"/g,'""')}"`}function pm(e){switch(e){case"connection":return $.connection;case"client_id":return $.client_id;case"user_type":return $.strategy_type;case"event":return $.type;case"time":throw new Error("time dimension handled separately")}}function fm(e){return{async query(t,n,i){var C,L,x,G;const o=Date.now(),a=um[n],s=dm[n],c=[_($.tenant_id,t),Tt($.date,i.from),Qe($.date,i.to),Re($.type,a)];(C=i.filters.connection)!=null&&C.length&&c.push(Re($.connection,i.filters.connection)),(L=i.filters.client_id)!=null&&L.length&&c.push(Re($.client_id,i.filters.client_id)),(x=i.filters.user_type)!=null&&x.length&&c.push(Re($.strategy_type,i.filters.user_type)),(G=i.filters.user_id)!=null&&G.length&&c.push(Re($.user_id,i.filters.user_id));const u={},p=[],d=[];for(const X of i.group_by)if(X==="time"){const V=_m(i.interval);u.time=V,p.push(V),d.push({name:"time",type:i.interval==="hour"?"DateTime":"Date"})}else{const V=pm(X);u[X]=V,p.push(V),d.push({name:X,type:"String"})}u[s.alias]=s.agg==="uniq"?k`COUNT(DISTINCT ${$.user_id})`:k`COUNT(*)`,d.push({name:s.alias,type:s.type});let h=e.select(u).from($).where(w(...c));p.length>0&&(h=h.groupBy(...p));const m=new Set([...Object.keys(u)]);if(i.order_by){const X=i.order_by.startsWith("-"),V=X?i.order_by.slice(1):i.order_by;if(!m.has(V))throw new Error(`Invalid order_by column '${V}' for analytics query`);const we=jn(V);h=h.orderBy(k.raw(`${we} ${X?"DESC":"ASC"}`))}else i.group_by[0]==="time"?h=h.orderBy(k.raw(`${jn("time")} ASC`)):h=h.orderBy(k.raw(`${jn(s.alias)} DESC`));h=h.limit(i.limit).offset(i.offset);const S=(await h.all()).map(X=>{const V={};for(const we of d){const j=X[we.name];V[we.name]=we.type==="UInt64"?Number(j)||0:j??""}return V});return{meta:d,data:S,rows:S.length,rows_before_limit_at_least:S.length,statistics:{elapsed:(Date.now()-o)/1e3}}}}}function go(e){return{...e,payload:R(e.payload,{})}}function gm(e){return{async create(t,n){const i=Le(),o=new Date().toISOString();return await e.insert(U).values({id:i,tenant_id:t,event_type:n.event_type,log_type:n.log_type,aggregate_type:n.aggregate_type,aggregate_id:n.aggregate_id,payload:JSON.stringify({...n,id:i}),created_at:o,processed_at:null,retry_count:0,next_retry_at:null,error:null,claimed_by:null,claim_expires_at:null}),i},async getByIds(t){return t.length===0?[]:(await e.select().from(U).where(Re(U.id,t)).all()).map(go)},async getUnprocessed(t){const n=new Date().toISOString();return(await e.select().from(U).where(w(xe(U.processed_at),Be(xe(U.next_retry_at),pt(U.next_retry_at,n)),Be(xe(U.claimed_by),pt(U.claim_expires_at,n)))).orderBy(U.created_at,U.id).limit(t).all()).map(go)},async claimEvents(t,n,i){if(t.length===0)return[];const o=new Date().toISOString(),a=new Date(Date.now()+i).toISOString();return await e.update(U).set({claimed_by:n,claim_expires_at:a}).where(w(Re(U.id,t),xe(U.processed_at),Be(xe(U.claimed_by),pt(U.claim_expires_at,o)))),(await e.select({id:U.id}).from(U).where(w(Re(U.id,t),_(U.claimed_by,n))).all()).map(c=>c.id)},async markProcessed(t){t.length!==0&&await e.update(U).set({processed_at:new Date().toISOString()}).where(Re(U.id,t))},async markRetry(t,n,i){await e.update(U).set({error:n,next_retry_at:i,retry_count:k`${U.retry_count} + 1`,claimed_by:null,claim_expires_at:null}).where(_(U.id,t))},async cleanup(t){return(await e.delete(U).where(w(k`${U.processed_at} IS NOT NULL`,pt(U.processed_at,t))).returning()).length},async deadLetter(t,n){const i=new Date().toISOString();await e.update(U).set({processed_at:i,dead_lettered_at:i,final_error:n}).where(_(U.id,t))},async listFailed(t,n={}){const{page:i=0,per_page:o=50,include_totals:a=!1}=n,c=(await e.select().from(U).where(w(_(U.tenant_id,t),rn(U.dead_lettered_at))).orderBy(le(U.dead_lettered_at),me(U.id)).offset(i*o).limit(o).all()).map(p=>({...R(p.payload,{}),id:p.id,created_at:p.created_at,processed_at:p.processed_at,retry_count:p.retry_count,next_retry_at:p.next_retry_at,error:p.error,dead_lettered_at:p.dead_lettered_at,final_error:p.final_error}));let u=c.length;if(a){const[p]=await e.select({total:ye()}).from(U).where(w(_(U.tenant_id,t),rn(U.dead_lettered_at)));u=Number((p==null?void 0:p.total)??c.length)}return{events:c,start:i*o,limit:o,length:u}},async replay(t,n){return(await e.update(U).set({processed_at:null,dead_lettered_at:null,final_error:null,retry_count:0,next_retry_at:null,error:null}).where(w(_(U.id,t),_(U.tenant_id,n),rn(U.dead_lettered_at))).returning()).length>0}}}const hm=7*24*60*60*1e3;function mm(e){return async t=>{const n=Date.now()-hm;try{let i=[Be(Qe(J.expires_at_ts,n),Qe(J.idle_expires_at_ts,n))];t!=null&&t.tenant_id&&i.push(_(J.tenant_id,t.tenant_id)),await e.delete(J).where(w(...i)),i=[Be(Qe(se.expires_at_ts,n),Qe(se.idle_expires_at_ts,n))],t!=null&&t.tenant_id&&i.push(_(se.tenant_id,t.tenant_id)),t!=null&&t.user_id&&i.push(_(se.user_id,t.user_id)),await e.delete(se).where(w(...i)),i=[Qe(Q.expires_at_ts,n)],t!=null&&t.tenant_id&&i.push(_(Q.tenant_id,t.tenant_id)),await e.delete(Q).where(w(...i))}catch(i){console.error("Session cleanup error:",i)}}}function ym(e,t={useTransactions:!0}){const n={actions:yc(),actionExecutions:wc(),actionVersions:vc(),branding:Pc(e),clients:Uc(e),clientConnections:Zc(e),clientGrants:Jc(e),clientRegistrationTokens:mh(e),codes:yh(e),connections:vh(e),customDomains:bh(e),customText:Sh(e),emailProviders:Nh(e),emailTemplates:Eh(e),flows:Oh(e),forms:Ih(e),hookCode:Th(e),hooks:Dh(e),invites:$h(e),keys:Rh(e),loginSessions:Ph(e),logs:Uh(e),authenticationMethods:Zh(e),organizations:jh(e),passwords:qh(e),promptSettings:Bh(e),refreshTokens:Kh(e),resourceServers:Vh(e),rolePermissions:Hh(e),userPermissions:Wh(e),roles:Qh(e),sessions:em(e),sessionCleanup:mm(e),tenants:tm(e),themes:im(e),universalLoginTemplates:om(e),users:rm(e),userRoles:am(e),userOrganizations:sm(e),stats:cm(e),analytics:fm(e),outbox:gm(e),async transaction(i){if(t.useTransactions===!1)return i(n);await e.run(k`BEGIN`);try{const o=await i(n);return await e.run(k`COMMIT`),o}catch(o){throw await e.run(k`ROLLBACK`),o}}};return n}exports.default=ym;exports.sqlite=Dc;
|
|
77
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Rf(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Vf(t,`input`,e.processors),output:Vf(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function zf(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return zf(r.element,n);if(r.type===`set`)return zf(r.valueType,n);if(r.type===`lazy`)return zf(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return zf(r.innerType,n);if(r.type===`intersection`)return zf(r.left,n)||zf(r.right,n);if(r.type===`record`||r.type===`map`)return zf(r.keyType,n)||zf(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:zf(r.in,n)||zf(r.out,n);if(r.type===`object`){for(let e in r.shape)if(zf(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(zf(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(zf(e,n))return!0;return!!(r.rest&&zf(r.rest,n))}return!1}var Bf=(e,t={})=>n=>{let r=If({...n,processors:t});return B(e,r),Lf(r,e),Rf(r,e)},Vf=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=If({...i??{},target:a,io:t,processors:n});return B(e,o),Lf(o,e),Rf(o,e)},Hf={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Uf=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Hf[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Wf=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),ee=t.target===`draft-04`||t.target===`openapi-3.0`;d?ee?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?ee?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Gf=(e,t,n,r)=>{n.type=`boolean`},Kf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},qf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},Jf=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Yf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Xf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Zf=(e,t,n,r)=>{n.not={}},Qf=(e,t,n,r)=>{},$f=(e,t,n,r)=>{},ep=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},tp=(e,t,n,r)=>{let i=e._zod.def,a=_r(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},np=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},rp=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},ip=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},ap=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},op=(e,t,n,r)=>{n.type=`boolean`},sp=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},cp=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},lp=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},up=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},dp=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},fp=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=B(a.element,t,{...r,path:[...r.path,`items`]})},pp=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=B(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=B(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},mp=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>B(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},hp=(e,t,n,r)=>{let i=e._zod.def,a=B(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=B(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},gp=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>B(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?B(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},_p=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=B(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=B(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=B(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},vp=(e,t,n,r)=>{let i=e._zod.def,a=B(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},yp=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bp=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},xp=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Sp=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Cp=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;B(o,t,r);let s=t.seen.get(e);s.ref=o},wp=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Tp=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ep=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Dp=(e,t,n,r)=>{let i=e._zod.innerType;B(i,t,r);let a=t.seen.get(e);a.ref=i},Op={string:Uf,number:Wf,boolean:Gf,bigint:Kf,symbol:qf,null:Jf,undefined:Yf,void:Xf,never:Zf,any:Qf,unknown:$f,date:ep,enum:tp,literal:np,nan:rp,template_literal:ip,file:ap,success:op,custom:sp,function:cp,transform:lp,map:up,set:dp,array:fp,object:pp,union:mp,intersection:hp,tuple:gp,record:_p,nullable:vp,nonoptional:yp,default:bp,prefault:xp,catch:Sp,pipe:Cp,readonly:wp,promise:Tp,optional:Ep,lazy:Dp};function kp(e,t){if(`_idmap`in e){let n=e,r=If({...t,processors:Op}),i={};for(let e of n._idmap.entries()){let[t,n]=e;B(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Lf(r,n),a[t]=Rf(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=If({...t,processors:Op});return B(e,n),Lf(n,e),Rf(n,e)}var Ap=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??`draft-2020-12`;t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),this.ctx=If({processors:Op,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return B(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),Lf(this.ctx,e);let{"~standard":n,...r}=Rf(this.ctx,e);return r}},jp=a({}),Mp=a({$ZodAny:()=>gs,$ZodArray:()=>Ss,$ZodAsyncError:()=>sr,$ZodBase64:()=>ts,$ZodBase64URL:()=>rs,$ZodBigInt:()=>ds,$ZodBigIntFormat:()=>fs,$ZodBoolean:()=>us,$ZodCIDRv4:()=>Qo,$ZodCIDRv6:()=>$o,$ZodCUID:()=>Bo,$ZodCUID2:()=>Vo,$ZodCatch:()=>ac,$ZodCheck:()=>oo,$ZodCheckBigIntFormat:()=>po,$ZodCheckEndsWith:()=>Eo,$ZodCheckGreaterThan:()=>lo,$ZodCheckIncludes:()=>wo,$ZodCheckLengthEquals:()=>yo,$ZodCheckLessThan:()=>co,$ZodCheckLowerCase:()=>So,$ZodCheckMaxLength:()=>_o,$ZodCheckMaxSize:()=>mo,$ZodCheckMimeType:()=>ko,$ZodCheckMinLength:()=>vo,$ZodCheckMinSize:()=>ho,$ZodCheckMultipleOf:()=>uo,$ZodCheckNumberFormat:()=>fo,$ZodCheckOverwrite:()=>Ao,$ZodCheckProperty:()=>Oo,$ZodCheckRegex:()=>xo,$ZodCheckSizeEquals:()=>go,$ZodCheckStartsWith:()=>To,$ZodCheckStringFormat:()=>bo,$ZodCheckUpperCase:()=>Co,$ZodCodec:()=>lc,$ZodCustom:()=>yc,$ZodCustomStringFormat:()=>ss,$ZodDate:()=>bs,$ZodDefault:()=>$s,$ZodDiscriminatedUnion:()=>Ms,$ZodE164:()=>is,$ZodEmail:()=>Io,$ZodEmoji:()=>Ro,$ZodEncodeError:()=>cr,$ZodEnum:()=>Gs,$ZodError:()=>vi,$ZodExactOptional:()=>Zs,$ZodFile:()=>qs,$ZodFunction:()=>gc,$ZodGUID:()=>Po,$ZodIPv4:()=>Yo,$ZodIPv6:()=>Xo,$ZodISODate:()=>Ko,$ZodISODateTime:()=>Go,$ZodISODuration:()=>Jo,$ZodISOTime:()=>qo,$ZodIntersection:()=>Ns,$ZodJWT:()=>os,$ZodKSUID:()=>Wo,$ZodLazy:()=>vc,$ZodLiteral:()=>Ks,$ZodMAC:()=>Zo,$ZodMap:()=>Vs,$ZodNaN:()=>oc,$ZodNanoID:()=>zo,$ZodNever:()=>vs,$ZodNonOptional:()=>nc,$ZodNull:()=>hs,$ZodNullable:()=>Qs,$ZodNumber:()=>cs,$ZodNumberFormat:()=>ls,$ZodObject:()=>Es,$ZodObjectJIT:()=>Ds,$ZodOptional:()=>Xs,$ZodPipe:()=>sc,$ZodPrefault:()=>tc,$ZodPreprocess:()=>fc,$ZodPromise:()=>_c,$ZodReadonly:()=>pc,$ZodRealError:()=>yi,$ZodRecord:()=>Bs,$ZodRegistry:()=>Tu,$ZodSet:()=>Us,$ZodString:()=>No,$ZodStringFormat:()=>z,$ZodSuccess:()=>ic,$ZodSymbol:()=>ps,$ZodTemplateLiteral:()=>hc,$ZodTransform:()=>Js,$ZodTuple:()=>Is,$ZodType:()=>R,$ZodULID:()=>Ho,$ZodURL:()=>Lo,$ZodUUID:()=>Fo,$ZodUndefined:()=>ms,$ZodUnion:()=>ks,$ZodUnknown:()=>_s,$ZodVoid:()=>ys,$ZodXID:()=>Uo,$ZodXor:()=>js,$brand:()=>or,$constructor:()=>M,$input:()=>wu,$output:()=>Cu,Doc:()=>jo,JSONSchema:()=>jp,JSONSchemaGenerator:()=>Ap,NEVER:()=>ar,TimePrecision:()=>$u,_any:()=>bd,_array:()=>nf,_base64:()=>Yu,_base64url:()=>Xu,_bigint:()=>pd,_boolean:()=>dd,_catch:()=>Sf,_check:()=>jf,_cidrv4:()=>qu,_cidrv6:()=>Ju,_coercedBigint:()=>md,_coercedBoolean:()=>fd,_coercedDate:()=>Td,_coercedNumber:()=>ad,_coercedString:()=>ku,_cuid:()=>zu,_cuid2:()=>Bu,_custom:()=>Of,_date:()=>wd,_decode:()=>Fi,_decodeAsync:()=>zi,_default:()=>yf,_discriminatedUnion:()=>of,_e164:()=>Zu,_email:()=>Au,_emoji:()=>Lu,_encode:()=>Ni,_encodeAsync:()=>Li,_endsWith:()=>qd,_enum:()=>ff,_file:()=>hf,_float32:()=>sd,_float64:()=>cd,_gt:()=>kd,_gte:()=>Ad,_guid:()=>ju,_includes:()=>Gd,_int:()=>od,_int32:()=>ld,_int64:()=>hd,_intersection:()=>sf,_ipv4:()=>Wu,_ipv6:()=>Gu,_isoDate:()=>td,_isoDateTime:()=>ed,_isoDuration:()=>rd,_isoTime:()=>nd,_jwt:()=>Qu,_ksuid:()=>Uu,_lazy:()=>Ef,_length:()=>Vd,_literal:()=>mf,_lowercase:()=>Ud,_lt:()=>Dd,_lte:()=>Od,_mac:()=>Ku,_map:()=>uf,_max:()=>Od,_maxLength:()=>zd,_maxSize:()=>Id,_mime:()=>Yd,_min:()=>Ad,_minLength:()=>Bd,_minSize:()=>Ld,_multipleOf:()=>Fd,_nan:()=>Ed,_nanoid:()=>Ru,_nativeEnum:()=>pf,_negative:()=>Md,_never:()=>Sd,_nonnegative:()=>Pd,_nonoptional:()=>bf,_nonpositive:()=>Nd,_normalize:()=>Zd,_null:()=>yd,_nullable:()=>vf,_number:()=>id,_optional:()=>_f,_overwrite:()=>Xd,_parse:()=>Ti,_parseAsync:()=>Di,_pipe:()=>Cf,_positive:()=>jd,_promise:()=>Df,_property:()=>Jd,_readonly:()=>wf,_record:()=>lf,_refine:()=>kf,_regex:()=>Hd,_safeDecode:()=>Ui,_safeDecodeAsync:()=>qi,_safeEncode:()=>Vi,_safeEncodeAsync:()=>Gi,_safeParse:()=>ki,_safeParseAsync:()=>ji,_set:()=>df,_size:()=>Rd,_slugify:()=>tf,_startsWith:()=>Kd,_string:()=>Ou,_stringFormat:()=>Ff,_stringbool:()=>Pf,_success:()=>xf,_superRefine:()=>Af,_symbol:()=>_d,_templateLiteral:()=>Tf,_toLowerCase:()=>$d,_toUpperCase:()=>ef,_transform:()=>gf,_trim:()=>Qd,_tuple:()=>cf,_uint32:()=>ud,_uint64:()=>gd,_ulid:()=>Vu,_undefined:()=>vd,_union:()=>rf,_unknown:()=>xd,_uppercase:()=>Wd,_url:()=>Iu,_uuid:()=>Mu,_uuidv4:()=>Nu,_uuidv6:()=>Pu,_uuidv7:()=>Fu,_void:()=>Cd,_xid:()=>Hu,_xor:()=>af,clone:()=>Ur,config:()=>ur,createStandardJSONSchemaMethod:()=>Vf,createToJSONSchemaMethod:()=>Bf,decode:()=>Ii,decodeAsync:()=>Bi,describe:()=>Mf,encode:()=>Pi,encodeAsync:()=>Ri,extractDefs:()=>Lf,finalize:()=>Rf,flattenError:()=>bi,formatError:()=>xi,globalConfig:()=>lr,globalRegistry:()=>Du,initializeContext:()=>If,isValidBase64:()=>es,isValidBase64URL:()=>ns,isValidJWT:()=>as,locales:()=>xu,meta:()=>Nf,parse:()=>Ei,parseAsync:()=>Oi,prettifyError:()=>wi,process:()=>B,regexes:()=>Yi,registry:()=>Eu,safeDecode:()=>Wi,safeDecodeAsync:()=>Ji,safeEncode:()=>Hi,safeEncodeAsync:()=>Ki,safeParse:()=>Ai,safeParseAsync:()=>Mi,toDotPath:()=>Ci,toJSONSchema:()=>kp,treeifyError:()=>Si,util:()=>dr,version:()=>Mo}),Np=a({endsWith:()=>qd,gt:()=>kd,gte:()=>Ad,includes:()=>Gd,length:()=>Vd,lowercase:()=>Ud,lt:()=>Dd,lte:()=>Od,maxLength:()=>zd,maxSize:()=>Id,mime:()=>Yd,minLength:()=>Bd,minSize:()=>Ld,multipleOf:()=>Fd,negative:()=>Md,nonnegative:()=>Pd,nonpositive:()=>Nd,normalize:()=>Zd,overwrite:()=>Xd,positive:()=>jd,property:()=>Jd,regex:()=>Hd,size:()=>Rd,slugify:()=>tf,startsWith:()=>Kd,toLowerCase:()=>$d,toUpperCase:()=>ef,trim:()=>Qd,uppercase:()=>Wd}),Pp=a({ZodISODate:()=>Lp,ZodISODateTime:()=>Fp,ZodISODuration:()=>Vp,ZodISOTime:()=>zp,date:()=>Rp,datetime:()=>Ip,duration:()=>Hp,time:()=>Bp}),Fp=M(`ZodISODateTime`,(e,t)=>{Go.init(e,t),U.init(e,t)});function Ip(e){return ed(Fp,e)}var Lp=M(`ZodISODate`,(e,t)=>{Ko.init(e,t),U.init(e,t)});function Rp(e){return td(Lp,e)}var zp=M(`ZodISOTime`,(e,t)=>{qo.init(e,t),U.init(e,t)});function Bp(e){return nd(zp,e)}var Vp=M(`ZodISODuration`,(e,t)=>{Jo.init(e,t),U.init(e,t)});function Hp(e){return rd(Vp,e)}var Up=(e,t)=>{vi.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>xi(e,t)},flatten:{value:t=>bi(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,vr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,vr,2)}},isEmpty:{get(){return e.issues.length===0}}})},Wp=M(`ZodError`,Up),Gp=M(`ZodError`,Up,{Parent:Error}),Kp=Ti(Gp),qp=Di(Gp),Jp=ki(Gp),Yp=ji(Gp),Xp=Ni(Gp),Zp=Fi(Gp),Qp=Li(Gp),$p=zi(Gp),em=Vi(Gp),tm=Ui(Gp),nm=Gi(Gp),rm=qi(Gp),im=a({ZodAny:()=>Ch,ZodArray:()=>Mh,ZodBase64:()=>Gm,ZodBase64URL:()=>qm,ZodBigInt:()=>fh,ZodBigIntFormat:()=>mh,ZodBoolean:()=>dh,ZodCIDRv4:()=>Vm,ZodCIDRv6:()=>Um,ZodCUID:()=>Tm,ZodCUID2:()=>Dm,ZodCatch:()=>Sg,ZodCodec:()=>Og,ZodCustom:()=>Hg,ZodCustomStringFormat:()=>$m,ZodDate:()=>Ah,ZodDefault:()=>mg,ZodDiscriminatedUnion:()=>Vh,ZodE164:()=>Ym,ZodEmail:()=>lm,ZodEmoji:()=>xm,ZodEnum:()=>eg,ZodExactOptional:()=>lg,ZodFile:()=>rg,ZodFunction:()=>Bg,ZodGUID:()=>dm,ZodIPv4:()=>Fm,ZodIPv6:()=>zm,ZodIntersection:()=>Uh,ZodJWT:()=>Zm,ZodKSUID:()=>Nm,ZodLazy:()=>Ig,ZodLiteral:()=>ng,ZodMAC:()=>Lm,ZodMap:()=>Xh,ZodNaN:()=>wg,ZodNanoID:()=>Cm,ZodNever:()=>Eh,ZodNonOptional:()=>vg,ZodNull:()=>xh,ZodNullable:()=>dg,ZodNumber:()=>ih,ZodNumberFormat:()=>ah,ZodObject:()=>Ph,ZodOptional:()=>sg,ZodPipe:()=>Eg,ZodPrefault:()=>gg,ZodPreprocess:()=>jg,ZodPromise:()=>Rg,ZodReadonly:()=>Mg,ZodRecord:()=>qh,ZodSet:()=>Qh,ZodString:()=>cm,ZodStringFormat:()=>U,ZodSuccess:()=>bg,ZodSymbol:()=>_h,ZodTemplateLiteral:()=>Pg,ZodTransform:()=>ag,ZodTuple:()=>Gh,ZodType:()=>V,ZodULID:()=>km,ZodURL:()=>vm,ZodUUID:()=>pm,ZodUndefined:()=>yh,ZodUnion:()=>Lh,ZodUnknown:()=>wh,ZodVoid:()=>Oh,ZodXID:()=>jm,ZodXor:()=>zh,_ZodString:()=>sm,_default:()=>hg,_function:()=>Vg,any:()=>K,array:()=>q,base64:()=>Km,base64url:()=>Jm,bigint:()=>ph,boolean:()=>G,catch:()=>Cg,check:()=>Ug,cidrv4:()=>Hm,cidrv6:()=>Wm,codec:()=>kg,cuid:()=>Em,cuid2:()=>Om,custom:()=>Wg,date:()=>jh,describe:()=>qg,discriminatedUnion:()=>Hh,e164:()=>Xm,email:()=>um,emoji:()=>Sm,enum:()=>X,exactOptional:()=>ug,file:()=>ig,float32:()=>sh,float64:()=>ch,function:()=>Vg,guid:()=>fm,hash:()=>rh,hex:()=>nh,hostname:()=>th,httpUrl:()=>bm,instanceof:()=>Yg,int:()=>oh,int32:()=>lh,int64:()=>hh,intersection:()=>Wh,invertCodec:()=>Ag,ipv4:()=>Im,ipv6:()=>Bm,json:()=>Zg,jwt:()=>Qm,keyof:()=>Nh,ksuid:()=>Pm,lazy:()=>Lg,literal:()=>Z,looseObject:()=>Ih,looseRecord:()=>Yh,mac:()=>Rm,map:()=>Zh,meta:()=>Jg,nan:()=>Tg,nanoid:()=>wm,nativeEnum:()=>tg,never:()=>Dh,nonoptional:()=>yg,null:()=>Sh,nullable:()=>fg,nullish:()=>pg,number:()=>W,object:()=>J,optional:()=>cg,partialRecord:()=>Jh,pipe:()=>Dg,prefault:()=>_g,preprocess:()=>Qg,promise:()=>zg,readonly:()=>Ng,record:()=>Y,refine:()=>Gg,set:()=>$h,strictObject:()=>Fh,string:()=>H,stringFormat:()=>eh,stringbool:()=>Xg,success:()=>xg,superRefine:()=>Kg,symbol:()=>vh,templateLiteral:()=>Fg,transform:()=>og,tuple:()=>Kh,uint32:()=>uh,uint64:()=>gh,ulid:()=>Am,undefined:()=>bh,union:()=>Rh,unknown:()=>Th,url:()=>ym,uuid:()=>mm,uuidv4:()=>hm,uuidv6:()=>gm,uuidv7:()=>_m,void:()=>kh,xid:()=>Mm,xor:()=>Bh}),am=new WeakMap;function om(e,t,n){let r=Object.getPrototypeOf(e),i=am.get(r);if(i||(i=new Set,am.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var V=M(`ZodType`,(e,t)=>(R.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Vf(e,`input`),output:Vf(e,`output`)}}),e.toJSONSchema=Bf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Kp(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Jp(e,t,n),e.parseAsync=async(t,n)=>qp(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Yp(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Xp(e,t,n),e.decode=(t,n)=>Zp(e,t,n),e.encodeAsync=async(t,n)=>Qp(e,t,n),e.decodeAsync=async(t,n)=>$p(e,t,n),e.safeEncode=(t,n)=>em(e,t,n),e.safeDecode=(t,n)=>tm(e,t,n),e.safeEncodeAsync=async(t,n)=>nm(e,t,n),e.safeDecodeAsync=async(t,n)=>rm(e,t,n),om(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Er(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ur(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gg(e,t))},superRefine(e,t){return this.check(Kg(e,t))},overwrite(e){return this.check(Xd(e))},optional(){return cg(this)},exactOptional(){return ug(this)},nullable(){return fg(this)},nullish(){return cg(fg(this))},nonoptional(e){return yg(this,e)},array(){return q(this)},or(e){return Rh([this,e])},and(e){return Wh(this,e)},transform(e){return Dg(this,og(e))},default(e){return hg(this,e)},prefault(e){return _g(this,e)},catch(e){return Cg(this,e)},pipe(e){return Dg(this,e)},readonly(){return Ng(this)},describe(e){let t=this.clone();return Du.add(t,{description:e}),t},meta(...e){if(e.length===0)return Du.get(this);let t=this.clone();return Du.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Du.get(e)?.description},configurable:!0}),e)),sm=M(`_ZodString`,(e,t)=>{No.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uf(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,om(e,`_ZodString`,{regex(...e){return this.check(Hd(...e))},includes(...e){return this.check(Gd(...e))},startsWith(...e){return this.check(Kd(...e))},endsWith(...e){return this.check(qd(...e))},min(...e){return this.check(Bd(...e))},max(...e){return this.check(zd(...e))},length(...e){return this.check(Vd(...e))},nonempty(...e){return this.check(Bd(1,...e))},lowercase(e){return this.check(Ud(e))},uppercase(e){return this.check(Wd(e))},trim(){return this.check(Qd())},normalize(...e){return this.check(Zd(...e))},toLowerCase(){return this.check($d())},toUpperCase(){return this.check(ef())},slugify(){return this.check(tf())}})}),cm=M(`ZodString`,(e,t)=>{No.init(e,t),sm.init(e,t),e.email=t=>e.check(Au(lm,t)),e.url=t=>e.check(Iu(vm,t)),e.jwt=t=>e.check(Qu(Zm,t)),e.emoji=t=>e.check(Lu(xm,t)),e.guid=t=>e.check(ju(dm,t)),e.uuid=t=>e.check(Mu(pm,t)),e.uuidv4=t=>e.check(Nu(pm,t)),e.uuidv6=t=>e.check(Pu(pm,t)),e.uuidv7=t=>e.check(Fu(pm,t)),e.nanoid=t=>e.check(Ru(Cm,t)),e.guid=t=>e.check(ju(dm,t)),e.cuid=t=>e.check(zu(Tm,t)),e.cuid2=t=>e.check(Bu(Dm,t)),e.ulid=t=>e.check(Vu(km,t)),e.base64=t=>e.check(Yu(Gm,t)),e.base64url=t=>e.check(Xu(qm,t)),e.xid=t=>e.check(Hu(jm,t)),e.ksuid=t=>e.check(Uu(Nm,t)),e.ipv4=t=>e.check(Wu(Fm,t)),e.ipv6=t=>e.check(Gu(zm,t)),e.cidrv4=t=>e.check(qu(Vm,t)),e.cidrv6=t=>e.check(Ju(Um,t)),e.e164=t=>e.check(Zu(Ym,t)),e.datetime=t=>e.check(Ip(t)),e.date=t=>e.check(Rp(t)),e.time=t=>e.check(Bp(t)),e.duration=t=>e.check(Hp(t))});function H(e){return Ou(cm,e)}var U=M(`ZodStringFormat`,(e,t)=>{z.init(e,t),sm.init(e,t)}),lm=M(`ZodEmail`,(e,t)=>{Io.init(e,t),U.init(e,t)});function um(e){return Au(lm,e)}var dm=M(`ZodGUID`,(e,t)=>{Po.init(e,t),U.init(e,t)});function fm(e){return ju(dm,e)}var pm=M(`ZodUUID`,(e,t)=>{Fo.init(e,t),U.init(e,t)});function mm(e){return Mu(pm,e)}function hm(e){return Nu(pm,e)}function gm(e){return Pu(pm,e)}function _m(e){return Fu(pm,e)}var vm=M(`ZodURL`,(e,t)=>{Lo.init(e,t),U.init(e,t)});function ym(e){return Iu(vm,e)}function bm(e){return Iu(vm,{protocol:Ea,hostname:Ta,...F(e)})}var xm=M(`ZodEmoji`,(e,t)=>{Ro.init(e,t),U.init(e,t)});function Sm(e){return Lu(xm,e)}var Cm=M(`ZodNanoID`,(e,t)=>{zo.init(e,t),U.init(e,t)});function wm(e){return Ru(Cm,e)}var Tm=M(`ZodCUID`,(e,t)=>{Bo.init(e,t),U.init(e,t)});function Em(e){return zu(Tm,e)}var Dm=M(`ZodCUID2`,(e,t)=>{Vo.init(e,t),U.init(e,t)});function Om(e){return Bu(Dm,e)}var km=M(`ZodULID`,(e,t)=>{Ho.init(e,t),U.init(e,t)});function Am(e){return Vu(km,e)}var jm=M(`ZodXID`,(e,t)=>{Uo.init(e,t),U.init(e,t)});function Mm(e){return Hu(jm,e)}var Nm=M(`ZodKSUID`,(e,t)=>{Wo.init(e,t),U.init(e,t)});function Pm(e){return Uu(Nm,e)}var Fm=M(`ZodIPv4`,(e,t)=>{Yo.init(e,t),U.init(e,t)});function Im(e){return Wu(Fm,e)}var Lm=M(`ZodMAC`,(e,t)=>{Zo.init(e,t),U.init(e,t)});function Rm(e){return Ku(Lm,e)}var zm=M(`ZodIPv6`,(e,t)=>{Xo.init(e,t),U.init(e,t)});function Bm(e){return Gu(zm,e)}var Vm=M(`ZodCIDRv4`,(e,t)=>{Qo.init(e,t),U.init(e,t)});function Hm(e){return qu(Vm,e)}var Um=M(`ZodCIDRv6`,(e,t)=>{$o.init(e,t),U.init(e,t)});function Wm(e){return Ju(Um,e)}var Gm=M(`ZodBase64`,(e,t)=>{ts.init(e,t),U.init(e,t)});function Km(e){return Yu(Gm,e)}var qm=M(`ZodBase64URL`,(e,t)=>{rs.init(e,t),U.init(e,t)});function Jm(e){return Xu(qm,e)}var Ym=M(`ZodE164`,(e,t)=>{is.init(e,t),U.init(e,t)});function Xm(e){return Zu(Ym,e)}var Zm=M(`ZodJWT`,(e,t)=>{os.init(e,t),U.init(e,t)});function Qm(e){return Qu(Zm,e)}var $m=M(`ZodCustomStringFormat`,(e,t)=>{ss.init(e,t),U.init(e,t)});function eh(e,t,n={}){return Ff($m,e,t,n)}function th(e){return Ff($m,`hostname`,wa,e)}function nh(e){return Ff($m,`hex`,Ha,e)}function rh(e,t){let n=`${e}_${t?.enc??`hex`}`,r=Yi[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return Ff($m,n,r,t)}var ih=M(`ZodNumber`,(e,t)=>{cs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wf(e,t,n,r),om(e,`ZodNumber`,{gt(e,t){return this.check(kd(e,t))},gte(e,t){return this.check(Ad(e,t))},min(e,t){return this.check(Ad(e,t))},lt(e,t){return this.check(Dd(e,t))},lte(e,t){return this.check(Od(e,t))},max(e,t){return this.check(Od(e,t))},int(e){return this.check(oh(e))},safe(e){return this.check(oh(e))},positive(e){return this.check(kd(0,e))},nonnegative(e){return this.check(Ad(0,e))},negative(e){return this.check(Dd(0,e))},nonpositive(e){return this.check(Od(0,e))},multipleOf(e,t){return this.check(Fd(e,t))},step(e,t){return this.check(Fd(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function W(e){return id(ih,e)}var ah=M(`ZodNumberFormat`,(e,t)=>{ls.init(e,t),ih.init(e,t)});function oh(e){return od(ah,e)}function sh(e){return sd(ah,e)}function ch(e){return cd(ah,e)}function lh(e){return ld(ah,e)}function uh(e){return ud(ah,e)}var dh=M(`ZodBoolean`,(e,t)=>{us.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gf(e,t,n,r)});function G(e){return dd(dh,e)}var fh=M(`ZodBigInt`,(e,t)=>{ds.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kf(e,t,n,r),e.gte=(t,n)=>e.check(Ad(t,n)),e.min=(t,n)=>e.check(Ad(t,n)),e.gt=(t,n)=>e.check(kd(t,n)),e.gte=(t,n)=>e.check(Ad(t,n)),e.min=(t,n)=>e.check(Ad(t,n)),e.lt=(t,n)=>e.check(Dd(t,n)),e.lte=(t,n)=>e.check(Od(t,n)),e.max=(t,n)=>e.check(Od(t,n)),e.positive=t=>e.check(kd(BigInt(0),t)),e.negative=t=>e.check(Dd(BigInt(0),t)),e.nonpositive=t=>e.check(Od(BigInt(0),t)),e.nonnegative=t=>e.check(Ad(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(Fd(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function ph(e){return pd(fh,e)}var mh=M(`ZodBigIntFormat`,(e,t)=>{fs.init(e,t),fh.init(e,t)});function hh(e){return hd(mh,e)}function gh(e){return gd(mh,e)}var _h=M(`ZodSymbol`,(e,t)=>{ps.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qf(e,t,n,r)});function vh(e){return _d(_h,e)}var yh=M(`ZodUndefined`,(e,t)=>{ms.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yf(e,t,n,r)});function bh(e){return vd(yh,e)}var xh=M(`ZodNull`,(e,t)=>{hs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jf(e,t,n,r)});function Sh(e){return yd(xh,e)}var Ch=M(`ZodAny`,(e,t)=>{gs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function K(){return bd(Ch)}var wh=M(`ZodUnknown`,(e,t)=>{_s.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Th(){return xd(wh)}var Eh=M(`ZodNever`,(e,t)=>{vs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zf(e,t,n,r)});function Dh(e){return Sd(Eh,e)}var Oh=M(`ZodVoid`,(e,t)=>{ys.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xf(e,t,n,r)});function kh(e){return Cd(Oh,e)}var Ah=M(`ZodDate`,(e,t)=>{bs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ep(e,t,n,r),e.min=(t,n)=>e.check(Ad(t,n)),e.max=(t,n)=>e.check(Od(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function jh(e){return wd(Ah,e)}var Mh=M(`ZodArray`,(e,t)=>{Ss.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fp(e,t,n,r),e.element=t.element,om(e,`ZodArray`,{min(e,t){return this.check(Bd(e,t))},nonempty(e){return this.check(Bd(1,e))},max(e,t){return this.check(zd(e,t))},length(e,t){return this.check(Vd(e,t))},unwrap(){return this.element}})});function q(e,t){return nf(Mh,e,t)}function Nh(e){let t=e._zod.def.shape;return X(Object.keys(t))}var Ph=M(`ZodObject`,(e,t)=>{Ds.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pp(e,t,n,r),P(e,`shape`,()=>t.shape),om(e,`ZodObject`,{keyof(){return X(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Th()})},loose(){return this.clone({...this._zod.def,catchall:Th()})},strict(){return this.clone({...this._zod.def,catchall:Dh()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Xr(this,e)},safeExtend(e){return Zr(this,e)},merge(e){return Qr(this,e)},pick(e){return Jr(this,e)},omit(e){return Yr(this,e)},partial(...e){return $r(sg,this,e[0])},required(...e){return ei(vg,this,e[0])}})});function J(e,t){return new Ph({type:`object`,shape:e??{},...F(t)})}function Fh(e,t){return new Ph({type:`object`,shape:e,catchall:Dh(),...F(t)})}function Ih(e,t){return new Ph({type:`object`,shape:e,catchall:Th(),...F(t)})}var Lh=M(`ZodUnion`,(e,t)=>{ks.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mp(e,t,n,r),e.options=t.options});function Rh(e,t){return new Lh({type:`union`,options:e,...F(t)})}var zh=M(`ZodXor`,(e,t)=>{Lh.init(e,t),js.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mp(e,t,n,r),e.options=t.options});function Bh(e,t){return new zh({type:`union`,options:e,inclusive:!1,...F(t)})}var Vh=M(`ZodDiscriminatedUnion`,(e,t)=>{Lh.init(e,t),Ms.init(e,t)});function Hh(e,t,n){return new Vh({type:`union`,options:t,discriminator:e,...F(n)})}var Uh=M(`ZodIntersection`,(e,t)=>{Ns.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hp(e,t,n,r)});function Wh(e,t){return new Uh({type:`intersection`,left:e,right:t})}var Gh=M(`ZodTuple`,(e,t)=>{Is.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gp(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Kh(e,t,n){let r=t instanceof R;return new Gh({type:`tuple`,items:e,rest:r?t:null,...F(r?n:t)})}var qh=M(`ZodRecord`,(e,t)=>{Bs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_p(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Y(e,t,n){return!t||!t._zod?new qh({type:`record`,keyType:H(),valueType:e,...F(t)}):new qh({type:`record`,keyType:e,valueType:t,...F(n)})}function Jh(e,t,n){let r=Ur(e);return r._zod.values=void 0,new qh({type:`record`,keyType:r,valueType:t,...F(n)})}function Yh(e,t,n){return new qh({type:`record`,keyType:e,valueType:t,mode:`loose`,...F(n)})}var Xh=M(`ZodMap`,(e,t)=>{Vs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>up(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(Ld(...t)),e.nonempty=t=>e.check(Ld(1,t)),e.max=(...t)=>e.check(Id(...t)),e.size=(...t)=>e.check(Rd(...t))});function Zh(e,t,n){return new Xh({type:`map`,keyType:e,valueType:t,...F(n)})}var Qh=M(`ZodSet`,(e,t)=>{Us.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dp(e,t,n,r),e.min=(...t)=>e.check(Ld(...t)),e.nonempty=t=>e.check(Ld(1,t)),e.max=(...t)=>e.check(Id(...t)),e.size=(...t)=>e.check(Rd(...t))});function $h(e,t){return new Qh({type:`set`,valueType:e,...F(t)})}var eg=M(`ZodEnum`,(e,t)=>{Gs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tp(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new eg({...t,checks:[],...F(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new eg({...t,checks:[],...F(r),entries:i})}});function X(e,t){return new eg({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...F(t)})}function tg(e,t){return new eg({type:`enum`,entries:e,...F(t)})}var ng=M(`ZodLiteral`,(e,t)=>{Ks.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>np(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Z(e,t){return new ng({type:`literal`,values:Array.isArray(e)?e:[e],...F(t)})}var rg=M(`ZodFile`,(e,t)=>{qs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ap(e,t,n,r),e.min=(t,n)=>e.check(Ld(t,n)),e.max=(t,n)=>e.check(Id(t,n)),e.mime=(t,n)=>e.check(Yd(Array.isArray(t)?t:[t],n))});function ig(e){return hf(rg,e)}var ag=M(`ZodTransform`,(e,t)=>{Js.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lp(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new cr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ci(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ci(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function og(e){return new ag({type:`transform`,transform:e})}var sg=M(`ZodOptional`,(e,t)=>{Xs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ep(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cg(e){return new sg({type:`optional`,innerType:e})}var lg=M(`ZodExactOptional`,(e,t)=>{Zs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ep(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ug(e){return new lg({type:`optional`,innerType:e})}var dg=M(`ZodNullable`,(e,t)=>{Qs.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fg(e){return new dg({type:`nullable`,innerType:e})}function pg(e){return cg(fg(e))}var mg=M(`ZodDefault`,(e,t)=>{$s.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hg(e,t){return new mg({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Lr(t)}})}var gg=M(`ZodPrefault`,(e,t)=>{tc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _g(e,t){return new gg({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Lr(t)}})}var vg=M(`ZodNonOptional`,(e,t)=>{nc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yg(e,t){return new vg({type:`nonoptional`,innerType:e,...F(t)})}var bg=M(`ZodSuccess`,(e,t)=>{ic.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>op(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xg(e){return new bg({type:`success`,innerType:e})}var Sg=M(`ZodCatch`,(e,t)=>{ac.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cg(e,t){return new Sg({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var wg=M(`ZodNaN`,(e,t)=>{oc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rp(e,t,n,r)});function Tg(e){return Ed(wg,e)}var Eg=M(`ZodPipe`,(e,t)=>{sc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cp(e,t,n,r),e.in=t.in,e.out=t.out});function Dg(e,t){return new Eg({type:`pipe`,in:e,out:t})}var Og=M(`ZodCodec`,(e,t)=>{Eg.init(e,t),lc.init(e,t)});function kg(e,t,n){return new Og({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function Ag(e){let t=e._zod.def;return new Og({type:`pipe`,in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var jg=M(`ZodPreprocess`,(e,t)=>{Eg.init(e,t),fc.init(e,t)}),Mg=M(`ZodReadonly`,(e,t)=>{pc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ng(e){return new Mg({type:`readonly`,innerType:e})}var Pg=M(`ZodTemplateLiteral`,(e,t)=>{hc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ip(e,t,n,r)});function Fg(e,t){return new Pg({type:`template_literal`,parts:e,...F(t)})}var Ig=M(`ZodLazy`,(e,t)=>{vc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dp(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Lg(e){return new Ig({type:`lazy`,getter:e})}var Rg=M(`ZodPromise`,(e,t)=>{_c.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tp(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zg(e){return new Rg({type:`promise`,innerType:e})}var Bg=M(`ZodFunction`,(e,t)=>{gc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cp(e,t,n,r)});function Vg(e){return new Bg({type:`function`,input:Array.isArray(e?.input)?Kh(e?.input):e?.input??q(Th()),output:e?.output??Th()})}var Hg=M(`ZodCustom`,(e,t)=>{yc.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sp(e,t,n,r)});function Ug(e){let t=new oo({check:`custom`});return t._zod.check=e,t}function Wg(e,t){return Of(Hg,e??(()=>!0),t)}function Gg(e,t={}){return kf(Hg,e,t)}function Kg(e,t){return Af(e,t)}var qg=Mf,Jg=Nf;function Yg(e,t={}){let n=new Hg({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...F(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}var Xg=(...e)=>Pf({Codec:Og,Boolean:dh,String:cm},...e);function Zg(e){let t=Lg(()=>Rh([H(e),W(),G(),Sh(),q(t),Y(H(),t)]));return t}function Qg(e,t){return new jg({type:`pipe`,in:og(e),out:t})}var $g={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`};function e_(e){ur({customError:e})}function t_(){return ur().customError}var n_;(function(e){})(n_||={});var Q={...im,...Np,iso:Pp},r_=new Set(`$schema.$ref.$defs.definitions.$id.id.$comment.$anchor.$vocabulary.$dynamicRef.$dynamicAnchor.type.enum.const.anyOf.oneOf.allOf.not.properties.required.additionalProperties.patternProperties.propertyNames.minProperties.maxProperties.items.prefixItems.additionalItems.minItems.maxItems.uniqueItems.contains.minContains.maxContains.minLength.maxLength.pattern.format.minimum.maximum.exclusiveMinimum.exclusiveMaximum.multipleOf.description.default.contentEncoding.contentMediaType.contentSchema.unevaluatedItems.unevaluatedProperties.if.then.else.dependentSchemas.dependentRequired.nullable.readOnly`.split(`.`));function i_(e,t){let n=e.$schema;return n===`https://json-schema.org/draft/2020-12/schema`?`draft-2020-12`:n===`http://json-schema.org/draft-07/schema#`?`draft-7`:n===`http://json-schema.org/draft-04/schema#`?`draft-4`:t??`draft-2020-12`}function a_(e,t){if(!e.startsWith(`#`))throw Error(`External $ref is not supported, only local refs (#/...) are allowed`);let n=e.slice(1).split(`/`).filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version===`draft-2020-12`?`$defs`:`definitions`;if(n[0]===r){let r=n[1];if(!r||!t.defs[r])throw Error(`Reference not found: ${e}`);return t.defs[r]}throw Error(`Reference not found: ${e}`)}function o_(e,t){if(e.not!==void 0){if(typeof e.not==`object`&&Object.keys(e.not).length===0)return Q.never();throw Error(`not is not supported in Zod (except { not: {} } for never)`)}if(e.unevaluatedItems!==void 0)throw Error(`unevaluatedItems is not supported`);if(e.unevaluatedProperties!==void 0)throw Error(`unevaluatedProperties is not supported`);if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error(`Conditional schemas (if/then/else) are not supported`);if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error(`dependentSchemas and dependentRequired are not supported`);if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return Q.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let r=s_(a_(n,t),t);return t.refs.set(n,r),t.processing.delete(n),r}if(e.enum!==void 0){let n=e.enum;if(t.version===`openapi-3.0`&&e.nullable===!0&&n.length===1&&n[0]===null)return Q.null();if(n.length===0)return Q.never();if(n.length===1)return Q.literal(n[0]);if(n.every(e=>typeof e==`string`))return Q.enum(n);let r=n.map(e=>Q.literal(e));return r.length<2?r[0]:Q.union([r[0],r[1],...r.slice(2)])}if(e.const!==void 0)return Q.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(n=>o_({...e,type:n},t));return r.length===0?Q.never():r.length===1?r[0]:Q.union(r)}if(!n)return Q.any();let r;switch(n){case`string`:{let t=Q.string();if(e.format){let n=e.format;n===`email`?t=t.check(Q.email()):n===`uri`||n===`uri-reference`?t=t.check(Q.url()):n===`uuid`||n===`guid`?t=t.check(Q.uuid()):n===`date-time`?t=t.check(Q.iso.datetime()):n===`date`?t=t.check(Q.iso.date()):n===`time`?t=t.check(Q.iso.time()):n===`duration`?t=t.check(Q.iso.duration()):n===`ipv4`?t=t.check(Q.ipv4()):n===`ipv6`?t=t.check(Q.ipv6()):n===`mac`?t=t.check(Q.mac()):n===`cidr`?t=t.check(Q.cidrv4()):n===`cidr-v6`?t=t.check(Q.cidrv6()):n===`base64`?t=t.check(Q.base64()):n===`base64url`?t=t.check(Q.base64url()):n===`e164`?t=t.check(Q.e164()):n===`jwt`?t=t.check(Q.jwt()):n===`emoji`?t=t.check(Q.emoji()):n===`nanoid`?t=t.check(Q.nanoid()):n===`cuid`?t=t.check(Q.cuid()):n===`cuid2`?t=t.check(Q.cuid2()):n===`ulid`?t=t.check(Q.ulid()):n===`xid`?t=t.check(Q.xid()):n===`ksuid`&&(t=t.check(Q.ksuid()))}typeof e.minLength==`number`&&(t=t.min(e.minLength)),typeof e.maxLength==`number`&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),r=t;break}case`number`:case`integer`:{let t=n===`integer`?Q.number().int():Q.number();typeof e.minimum==`number`&&(t=t.min(e.minimum)),typeof e.maximum==`number`&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum==`number`?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum==`number`&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum==`number`?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum==`number`&&(t=t.lt(e.maximum)),typeof e.multipleOf==`number`&&(t=t.multipleOf(e.multipleOf)),r=t;break}case`boolean`:r=Q.boolean();break;case`null`:r=Q.null();break;case`object`:{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[e,r]of Object.entries(i)){let i=s_(r,t);n[e]=a.has(e)?i:i.optional()}if(e.propertyNames){let i=s_(e.propertyNames,t),a=e.additionalProperties&&typeof e.additionalProperties==`object`?s_(e.additionalProperties,t):Q.any();if(Object.keys(n).length===0){r=Q.record(i,a);break}let o=Q.object(n).passthrough(),s=Q.looseRecord(i,a);r=Q.intersection(o,s);break}if(e.patternProperties){let i=e.patternProperties,a=Object.keys(i),o=[];for(let e of a){let n=s_(i[e],t),r=Q.string().regex(new RegExp(e));o.push(Q.looseRecord(r,n))}let s=[];if(Object.keys(n).length>0&&s.push(Q.object(n).passthrough()),s.push(...o),s.length===0)r=Q.object({}).passthrough();else if(s.length===1)r=s[0];else{let e=Q.intersection(s[0],s[1]);for(let t=2;t<s.length;t++)e=Q.intersection(e,s[t]);r=e}break}let o=Q.object(n);r=e.additionalProperties===!1?o.strict():typeof e.additionalProperties==`object`?o.catchall(s_(e.additionalProperties,t)):o.passthrough();break}case`array`:{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=n.map(e=>s_(e,t)),o=i&&typeof i==`object`&&!Array.isArray(i)?s_(i,t):void 0;r=o?Q.tuple(a).rest(o):Q.tuple(a),typeof e.minItems==`number`&&(r=r.check(Q.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(Q.maxLength(e.maxItems)))}else if(Array.isArray(i)){let n=i.map(e=>s_(e,t)),a=e.additionalItems&&typeof e.additionalItems==`object`?s_(e.additionalItems,t):void 0;r=a?Q.tuple(n).rest(a):Q.tuple(n),typeof e.minItems==`number`&&(r=r.check(Q.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(Q.maxLength(e.maxItems)))}else if(i!==void 0){let n=s_(i,t),a=Q.array(n);typeof e.minItems==`number`&&(a=a.min(e.minItems)),typeof e.maxItems==`number`&&(a=a.max(e.maxItems)),r=a}else r=Q.array(Q.any());break}default:throw Error(`Unsupported type: ${n}`)}return r}function s_(e,t){if(typeof e==`boolean`)return e?Q.any():Q.never();let n=o_(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let i=e.anyOf.map(e=>s_(e,t)),a=Q.union(i);n=r?Q.intersection(n,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let i=e.oneOf.map(e=>s_(e,t)),a=Q.xor(i);n=r?Q.intersection(n,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:Q.any();else{let i=r?n:s_(e.allOf[0],t),a=+!r;for(let n=a;n<e.allOf.length;n++)i=Q.intersection(i,s_(e.allOf[n],t));n=i}e.nullable===!0&&t.version===`openapi-3.0`&&(n=Q.nullable(n)),e.readOnly===!0&&(n=Q.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let i={};for(let t of[`$id`,`id`,`$comment`,`$anchor`,`$vocabulary`,`$dynamicRef`,`$dynamicAnchor`])t in e&&(i[t]=e[t]);for(let t of[`contentEncoding`,`contentMediaType`,`contentSchema`])t in e&&(i[t]=e[t]);for(let t of Object.keys(e))r_.has(t)||(i[t]=e[t]);return Object.keys(i).length>0&&t.registry.add(n,i),e.description&&(n=n.describe(e.description)),n}function c_(e,t){if(typeof e==`boolean`)return e?Q.any():Q.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw Error(`fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas`)}let r={version:i_(n,t?.defaultTarget),defs:n.$defs||n.definitions||{},refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Du};return s_(n,r)}var l_=a({bigint:()=>p_,boolean:()=>f_,date:()=>m_,number:()=>d_,string:()=>u_});function u_(e){return ku(cm,e)}function d_(e){return ad(ih,e)}function f_(e){return fd(dh,e)}function p_(e){return md(fh,e)}function m_(e){return Td(Ah,e)}var h_=a({$brand:()=>or,$input:()=>wu,$output:()=>Cu,NEVER:()=>ar,TimePrecision:()=>$u,ZodAny:()=>Ch,ZodArray:()=>Mh,ZodBase64:()=>Gm,ZodBase64URL:()=>qm,ZodBigInt:()=>fh,ZodBigIntFormat:()=>mh,ZodBoolean:()=>dh,ZodCIDRv4:()=>Vm,ZodCIDRv6:()=>Um,ZodCUID:()=>Tm,ZodCUID2:()=>Dm,ZodCatch:()=>Sg,ZodCodec:()=>Og,ZodCustom:()=>Hg,ZodCustomStringFormat:()=>$m,ZodDate:()=>Ah,ZodDefault:()=>mg,ZodDiscriminatedUnion:()=>Vh,ZodE164:()=>Ym,ZodEmail:()=>lm,ZodEmoji:()=>xm,ZodEnum:()=>eg,ZodError:()=>Wp,ZodExactOptional:()=>lg,ZodFile:()=>rg,ZodFirstPartyTypeKind:()=>n_,ZodFunction:()=>Bg,ZodGUID:()=>dm,ZodIPv4:()=>Fm,ZodIPv6:()=>zm,ZodISODate:()=>Lp,ZodISODateTime:()=>Fp,ZodISODuration:()=>Vp,ZodISOTime:()=>zp,ZodIntersection:()=>Uh,ZodIssueCode:()=>$g,ZodJWT:()=>Zm,ZodKSUID:()=>Nm,ZodLazy:()=>Ig,ZodLiteral:()=>ng,ZodMAC:()=>Lm,ZodMap:()=>Xh,ZodNaN:()=>wg,ZodNanoID:()=>Cm,ZodNever:()=>Eh,ZodNonOptional:()=>vg,ZodNull:()=>xh,ZodNullable:()=>dg,ZodNumber:()=>ih,ZodNumberFormat:()=>ah,ZodObject:()=>Ph,ZodOptional:()=>sg,ZodPipe:()=>Eg,ZodPrefault:()=>gg,ZodPreprocess:()=>jg,ZodPromise:()=>Rg,ZodReadonly:()=>Mg,ZodRealError:()=>Gp,ZodRecord:()=>qh,ZodSet:()=>Qh,ZodString:()=>cm,ZodStringFormat:()=>U,ZodSuccess:()=>bg,ZodSymbol:()=>_h,ZodTemplateLiteral:()=>Pg,ZodTransform:()=>ag,ZodTuple:()=>Gh,ZodType:()=>V,ZodULID:()=>km,ZodURL:()=>vm,ZodUUID:()=>pm,ZodUndefined:()=>yh,ZodUnion:()=>Lh,ZodUnknown:()=>wh,ZodVoid:()=>Oh,ZodXID:()=>jm,ZodXor:()=>zh,_ZodString:()=>sm,_default:()=>hg,_function:()=>Vg,any:()=>K,array:()=>q,base64:()=>Km,base64url:()=>Jm,bigint:()=>ph,boolean:()=>G,catch:()=>Cg,check:()=>Ug,cidrv4:()=>Hm,cidrv6:()=>Wm,clone:()=>Ur,codec:()=>kg,coerce:()=>l_,config:()=>ur,core:()=>Mp,cuid:()=>Em,cuid2:()=>Om,custom:()=>Wg,date:()=>jh,decode:()=>Zp,decodeAsync:()=>$p,describe:()=>qg,discriminatedUnion:()=>Hh,e164:()=>Xm,email:()=>um,emoji:()=>Sm,encode:()=>Xp,encodeAsync:()=>Qp,endsWith:()=>qd,enum:()=>X,exactOptional:()=>ug,file:()=>ig,flattenError:()=>bi,float32:()=>sh,float64:()=>ch,formatError:()=>xi,fromJSONSchema:()=>c_,function:()=>Vg,getErrorMap:()=>t_,globalRegistry:()=>Du,gt:()=>kd,gte:()=>Ad,guid:()=>fm,hash:()=>rh,hex:()=>nh,hostname:()=>th,httpUrl:()=>bm,includes:()=>Gd,instanceof:()=>Yg,int:()=>oh,int32:()=>lh,int64:()=>hh,intersection:()=>Wh,invertCodec:()=>Ag,ipv4:()=>Im,ipv6:()=>Bm,iso:()=>Pp,json:()=>Zg,jwt:()=>Qm,keyof:()=>Nh,ksuid:()=>Pm,lazy:()=>Lg,length:()=>Vd,literal:()=>Z,locales:()=>xu,looseObject:()=>Ih,looseRecord:()=>Yh,lowercase:()=>Ud,lt:()=>Dd,lte:()=>Od,mac:()=>Rm,map:()=>Zh,maxLength:()=>zd,maxSize:()=>Id,meta:()=>Jg,mime:()=>Yd,minLength:()=>Bd,minSize:()=>Ld,multipleOf:()=>Fd,nan:()=>Tg,nanoid:()=>wm,nativeEnum:()=>tg,negative:()=>Md,never:()=>Dh,nonnegative:()=>Pd,nonoptional:()=>yg,nonpositive:()=>Nd,normalize:()=>Zd,null:()=>Sh,nullable:()=>fg,nullish:()=>pg,number:()=>W,object:()=>J,optional:()=>cg,overwrite:()=>Xd,parse:()=>Kp,parseAsync:()=>qp,partialRecord:()=>Jh,pipe:()=>Dg,positive:()=>jd,prefault:()=>_g,preprocess:()=>Qg,prettifyError:()=>wi,promise:()=>zg,property:()=>Jd,readonly:()=>Ng,record:()=>Y,refine:()=>Gg,regex:()=>Hd,regexes:()=>Yi,registry:()=>Eu,safeDecode:()=>tm,safeDecodeAsync:()=>rm,safeEncode:()=>em,safeEncodeAsync:()=>nm,safeParse:()=>Jp,safeParseAsync:()=>Yp,set:()=>$h,setErrorMap:()=>e_,size:()=>Rd,slugify:()=>tf,startsWith:()=>Kd,strictObject:()=>Fh,string:()=>H,stringFormat:()=>eh,stringbool:()=>Xg,success:()=>xg,superRefine:()=>Kg,symbol:()=>vh,templateLiteral:()=>Fg,toJSONSchema:()=>kp,toLowerCase:()=>$d,toUpperCase:()=>ef,transform:()=>og,treeifyError:()=>Si,trim:()=>Qd,tuple:()=>Kh,uint32:()=>uh,uint64:()=>gh,ulid:()=>Am,undefined:()=>bh,union:()=>Rh,unknown:()=>Th,uppercase:()=>Wd,url:()=>ym,util:()=>dr,uuid:()=>mm,uuidv4:()=>hm,uuidv6:()=>gm,uuidv7:()=>_m,void:()=>kh,xid:()=>Mm,xor:()=>Bh});ur(Vc()),nr(h_);var g_=J({created_at:H(),updated_at:H()}),__=J({id:H(),version:H().optional()}),v_=J({name:H(),version:H()}),y_=J({name:H(),value:H().optional()}),b_=J({name:H().max(255),code:H().max(1e5),supported_triggers:q(__).optional(),runtime:H().max(50).optional(),dependencies:q(v_).optional(),secrets:q(y_).optional(),is_system:G().optional(),inherit:G().optional()});b_.partial().extend({status:X([`draft`,`built`]).optional(),deployed_at:H().optional()}),b_.extend({id:H(),tenant_id:H(),status:X([`draft`,`built`]).default(`built`),deployed_at:H().optional(),secrets:q(J({name:H(),value:H().optional()})).optional()}).extend(g_.shape);var x_=H(),S_=X([`unspecified`,`pending`,`final`,`partial`,`canceled`,`suspended`]),C_=J({id:H(),msg:H(),url:H().optional()}),w_=J({action_name:H(),error:C_.nullable(),started_at:H(),ended_at:H()}),T_=J({level:X([`log`,`info`,`warn`,`error`,`debug`]),message:H()}),E_=q(J({action_name:H(),lines:q(T_)}));J({id:H(),tenant_id:H(),trigger_id:x_,status:S_,results:q(w_),logs:E_.optional(),created_at:H(),updated_at:H()}).omit({tenant_id:!0,created_at:!0,updated_at:!0}),J({action_id:H(),code:H().max(1e5),runtime:H().max(50).optional(),dependencies:q(v_).optional(),secrets:q(y_).optional(),supported_triggers:q(__).optional(),deployed:G().default(!0)}).extend({id:H(),tenant_id:H(),number:W().int()}).extend(g_.shape);var D_=X([`user_action`,`admin_action`,`system`,`api`]),O_=J({type:X([`user`,`admin`,`system`,`api_key`,`client_credentials`]),id:H().optional(),email:H().optional(),org_id:H().optional(),org_name:H().optional(),scopes:q(H()).optional(),client_id:H().optional()}),k_=J({type:H(),id:H(),before:Y(H(),Th()).optional(),after:Y(H(),Th()).optional(),diff:Y(H(),J({old:Th(),new:Th()})).optional()}),A_=J({method:H(),path:H(),query:Y(H(),H()).optional(),body:Th().optional(),ip:H(),user_agent:H().optional(),correlation_id:H().optional()}),j_=J({status_code:W(),body:Th().optional()}),M_=J({country_code:H(),city_name:H(),latitude:H(),longitude:H(),time_zone:H(),continent_code:H()}),N_=J({name:H(),version:H(),env:Y(H(),H()).optional()});J({tenant_id:H(),event_type:H(),log_type:H(),description:H().optional(),category:D_,actor:O_,target:k_,request:A_,response:j_.optional(),connection:H().optional(),strategy:H().optional(),strategy_type:H().optional(),audience:H().optional(),scope:H().optional(),location:M_.optional(),auth0_client:N_.optional(),hostname:H(),is_mobile:G().optional(),timestamp:H()}).extend({id:H()}),X([`AUTH0`,`EMAIL`,`REDIRECT`]),X([`CREATE_USER`,`GET_USER`,`UPDATE_USER`,`SEND_REQUEST`,`SEND_EMAIL`]),X([`VERIFY_EMAIL`]);var P_=J({require_mx_record:G().optional(),block_aliases:G().optional(),block_free_emails:G().optional(),block_disposable_emails:G().optional(),blocklist:q(H()).optional(),allowlist:q(H()).optional()}),F_=J({id:H(),alias:H().max(100).optional(),type:Z(`AUTH0`),action:Z(`UPDATE_USER`),allow_failure:G().optional(),mask_output:G().optional(),params:J({connection_id:H().optional(),user_id:H(),changes:Y(H(),K())})}),I_=J({id:H(),alias:H().max(100).optional(),type:Z(`EMAIL`),action:Z(`VERIFY_EMAIL`),allow_failure:G().optional(),mask_output:G().optional(),params:J({email:H(),rules:P_.optional()})}),L_=X([`change-email`,`account`,`custom`]),R_=Rh([F_,I_,J({id:H(),alias:H().max(100).optional(),type:Z(`REDIRECT`),action:Z(`REDIRECT_USER`),allow_failure:G().optional(),mask_output:G().optional(),params:J({target:L_.openapi({description:`The predefined target to redirect to, or 'custom' for a custom URL`}),custom_url:H().optional().openapi({description:`Custom URL to redirect to when target is 'custom'`})})})]);J({name:H().min(1).max(150).openapi({description:`The name of the flow`}),actions:q(R_).optional().default([]).openapi({description:`The list of actions to execute in sequence`})}).extend(g_.shape).extend({id:H().openapi({description:`Unique identifier for the flow`,example:`af_12tMpdJ3iek7svMyZkSh5M`})}),J({page:H().min(0).optional().default(`0`).transform(e=>parseInt(e,10)).openapi({description:`The page number where 0 is the first page`}),per_page:H().min(1).optional().default(`10`).transform(e=>parseInt(e,10)).openapi({description:`The number of items per page`}),include_totals:H().optional().default(`false`).transform(e=>e===`true`).openapi({description:`If the total number of items should be included in the response`}),sort:H().regex(/^.+:(-1|1)$/).optional().openapi({description:`A property that should have the format 'string:-1' or 'string:1'`}),q:H().optional().openapi({description:`A lucene query string used to filter the results`})}),J({start:W(),limit:W(),length:W(),total:W().optional()});var z_=J({email:H().optional(),email_verified:G().optional(),name:H().optional(),username:H().optional(),given_name:H().optional(),phone_number:H().optional(),phone_verified:G().optional(),family_name:H().optional()}).catchall(K()),B_=J({connection:H(),user_id:H(),provider:H(),isSocial:G(),email:H().optional(),email_verified:G().optional(),phone_number:H().optional(),phone_verified:G().optional(),username:H().optional(),access_token:H().optional(),access_token_secret:H().optional(),refresh_token:H().optional(),profileData:z_.optional()}),V_=J({formatted:H().optional(),street_address:H().optional(),locality:H().optional(),region:H().optional(),postal_code:H().optional(),country:H().optional()}).optional(),H_=J({email:H().transform(e=>e.toLowerCase()).optional(),username:H().refine(e=>!e.includes(`@`),{message:`Usernames must not contain "@". Use the email field for email addresses.`}).optional(),phone_number:H().optional(),phone_verified:G().optional(),given_name:H().optional(),family_name:H().optional(),nickname:H().optional(),name:H().optional(),picture:H().optional(),locale:H().optional(),linked_to:H().optional(),profileData:H().optional(),user_id:H().optional(),app_metadata:K().default({}).optional(),user_metadata:K().default({}).optional(),middle_name:H().optional(),preferred_username:H().optional(),profile:H().optional(),website:H().optional(),gender:H().optional(),birthdate:H().optional(),zoneinfo:H().optional(),address:V_});H_.extend({email_verified:G().default(!1),verify_email:G().optional(),last_ip:H().optional(),last_login:H().optional(),user_id:H().optional(),provider:H().optional(),connection:H(),is_social:G().optional(),registration_completed_at:H().optional(),password:J({hash:H(),algorithm:H()}).optional()}).omit({password:!0}).extend(g_.shape).extend({user_id:H(),provider:H(),is_social:G(),email:H().optional(),login_count:W().default(0),identities:q(B_).optional()}).omit({registration_completed_at:!0}),H_.extend({login_count:W(),multifactor:q(H()).optional(),last_ip:H().optional(),last_login:H().optional(),user_id:H()}).catchall(K());var U_=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,W_=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=U_[n[e]&63];return t},G_=J({client_id:H().optional().openapi({description:`ID of this client. Generated server-side if omitted (Auth0 behavior).`}),name:H().min(1).openapi({description:`Name of this client (min length: 1 character, does not allow < or >).`}),description:H().max(140).optional().openapi({description:`Free text description of this client (max length: 140 characters).`}),global:G().default(!1).openapi({description:`Whether this is your global 'All Applications' client representing legacy tenant settings (true) or a regular client (false).`}),client_secret:H().default(()=>W_()).optional().openapi({description:`Client secret (which you must not make public).`}),app_type:X([`native`,`spa`,`regular_web`,`non_interactive`,`resource_server`,`express_configuration`,`rms`,`box`,`cloudbees`,`concur`,`dropbox`,`mscrm`,`echosign`,`egnyte`,`newrelic`,`office365`,`salesforce`,`sentry`,`sharepoint`,`slack`,`springcm`,`zendesk`,`zoom`,`sso_integration`,`oag`]).default(`regular_web`).optional().openapi({description:`The type of application this client represents`}),logo_uri:H().url().optional().openapi({description:`URL of the logo to display for this client. Recommended size is 150x150 pixels.`}),is_first_party:G().default(!1).openapi({description:`Whether this client a first party client (true) or not (false).`}),oidc_conformant:G().default(!0).openapi({description:`Whether this client conforms to strict OIDC specifications (true) or uses legacy features (false).`}),auth0_conformant:G().default(!0).openapi({description:`Whether this client follows Auth0-compatible behavior (true) or strict OIDC behavior (false). When true, profile/email claims are included in the ID token when scopes are requested. When false, these claims are only available from the userinfo endpoint (strict OIDC 5.4 compliance).`}),callbacks:q(H()).default([]).optional().openapi({description:`Comma-separated list of URLs whitelisted for Auth0 to use as a callback to the client after authentication.`}),allowed_origins:q(H()).default([]).optional().openapi({description:`Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level (e.g., https://*.contoso.com). Query strings and hash information are not taken into account when validating these URLs.`}),web_origins:q(H()).default([]).optional().openapi({description:`Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode.`}),client_aliases:q(H()).default([]).optional().openapi({description:`List of audiences/realms for SAML protocol. Used by the wsfed addon.`}),allowed_clients:q(H()).default([]).optional().openapi({description:`List of allow clients and API ids that are allowed to make delegation requests. Empty means all all your clients are allowed.`}),connections:q(H()).default([]).optional().openapi({description:`List of connection IDs enabled for this client. The order determines the display order on the login page.`}),allowed_logout_urls:q(H()).default([]).optional().openapi({description:`Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains.`}),session_transfer:Y(H(),K()).default({}).optional().openapi({description:`Native to Web SSO Configuration`}),oidc_logout:Y(H(),K()).default({}).optional().openapi({description:`Configuration for OIDC backchannel logout`}),grant_types:q(H()).default([]).optional().openapi({description:`List of grant types supported for this application. Can include authorization_code, implicit, refresh_token, client_credentials, password, http://auth0.com/oauth/grant-type/password-realm, http://auth0.com/oauth/grant-type/mfa-oob, http://auth0.com/oauth/grant-type/mfa-otp, http://auth0.com/oauth/grant-type/mfa-recovery-code, urn:openid:params:grant-type:ciba, and urn:ietf:params:oauth:grant-type:device_code.`}),jwt_configuration:Y(H(),K()).default({}).optional().openapi({description:`Configuration related to JWTs for the client.`}),signing_keys:q(Y(H(),K())).default([]).optional().openapi({description:`Signing certificates associated with this client.`}),encryption_key:Y(H(),K()).default({}).optional().openapi({description:`Encryption used for WsFed responses with this client.`}),sso:G().default(!1).openapi({description:`Applies only to SSO clients and determines whether Auth0 will handle Single Sign On (true) or whether the Identity Provider will (false).`}),sso_disabled:G().default(!1).openapi({description:`Whether Single Sign On is disabled for this client. When true, existing SSO sessions will not be reused and users must authenticate every time.`}),cross_origin_authentication:G().default(!1).openapi({description:`Whether this client can be used to make cross-origin authentication requests (true) or it is not allowed to make such requests (false).`}),cross_origin_loc:H().url().optional().openapi({description:`URL of the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page.`}),custom_login_page_on:G().default(!1).openapi({description:`Whether a custom login page is to be used (true) or the default provided login page (false).`}),custom_login_page:H().optional().openapi({description:`The content (HTML, CSS, JS) of the custom login page.`}),custom_login_page_preview:H().optional().openapi({description:`The content (HTML, CSS, JS) of the custom login page. (Used on Previews)`}),form_template:H().optional().openapi({description:`HTML form template to be used for WS-Federation.`}),addons:Y(H(),K()).default({}).optional().openapi({description:`Addons enabled for this client and their associated configurations.`}),token_endpoint_auth_method:X([`none`,`client_secret_post`,`client_secret_basic`,`client_secret_jwt`,`private_key_jwt`]).default(`client_secret_basic`).optional().openapi({description:"Defines the requested authentication method for the token endpoint. `none` (public client), `client_secret_post` / `client_secret_basic` (HTTP POST / Basic), `client_secret_jwt` (RFC 7523 HMAC assertion using client_secret), or `private_key_jwt` (RFC 7523 asymmetric assertion verified against the client's `jwks` / `jwks_uri`)."}),client_metadata:Y(H(),H().max(255)).default({}).optional().openapi({description:`Metadata associated with the client, in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed. Field names (max 255 chars) are alphanumeric and may only include the following special characters: :,-+=_*?"/()<>@ [Tab][Space]`}),hide_sign_up_disabled_error:G().default(!1).optional().openapi({description:"Enumeration-safe variant of the connection-level `disable_signup` flag. When a signup is blocked by the password connection and this is true, the identifier screen does not reveal that an email is unknown — it advances to the OTP/password challenge as if the account existed and fails at credential check. Mitigates email enumeration at the cost of UX: users without an account see a generic credential failure instead of an explicit signup-disabled message."}),mobile:Y(H(),K()).default({}).optional().openapi({description:`Additional configuration for native mobile apps.`}),initiate_login_uri:H().url().optional().openapi({description:`Initiate login uri, must be https`}),native_social_login:Y(H(),K()).default({}).optional(),refresh_token:J({rotation_type:X([`rotating`,`non-rotating`]).optional().openapi({description:`Whether refresh tokens for this client are rotated on every exchange (Auth0 'rotating' behavior) or kept stable (legacy non-rotating). Defaults to 'non-rotating' when unset.`}),leeway:W().int().min(0).max(600).optional().openapi({description:`Seconds after a parent token's first rotation during which presenting it again still mints a fresh sibling child instead of triggering reuse-detection. Defaults to 30s when unset.`}),expiration_type:X([`expiring`,`non-expiring`]).optional().openapi({description:`Auth0-compatible: whether refresh tokens expire.`}),token_lifetime:W().int().min(0).optional().openapi({description:`Auth0-compatible: refresh-token absolute lifetime in seconds.`}),infinite_token_lifetime:G().optional().openapi({description:`Auth0-compatible: when true, refresh tokens have no absolute expiry.`}),idle_token_lifetime:W().int().min(0).optional().openapi({description:`Auth0-compatible: refresh-token idle (sliding) lifetime in seconds.`}),infinite_idle_token_lifetime:G().optional().openapi({description:`Auth0-compatible: when true, refresh tokens have no idle expiry.`})}).default({}).optional().openapi({description:`Refresh token configuration`}),default_organization:Y(H(),K()).default({}).optional().openapi({description:`Defines the default Organization ID and flows`}),organization_usage:X([`deny`,`allow`,`require`]).default(`deny`).optional().openapi({description:`Defines how to proceed during an authentication transaction with regards an organization. Can be deny (default), allow or require.`}),organization_require_behavior:X([`no_prompt`,`pre_login_prompt`,`post_login_prompt`]).default(`no_prompt`).optional().openapi({description:`Defines how to proceed during an authentication transaction when client.organization_usage: 'require'. Can be no_prompt (default), pre_login_prompt or post_login_prompt. post_login_prompt requires oidc_conformant: true.`}),client_authentication_methods:Y(H(),K()).default({}).optional().openapi({description:`Defines client authentication methods.`}),require_pushed_authorization_requests:G().default(!1).openapi({description:`Makes the use of Pushed Authorization Requests mandatory for this client`}),require_proof_of_possession:G().default(!1).openapi({description:`Makes the use of Proof-of-Possession mandatory for this client`}),signed_request_object:Y(H(),K()).default({}).optional().openapi({description:`JWT-secured Authorization Requests (JAR) settings.`}),compliance_level:X([`none`,`fapi1_adv_pkj_par`,`fapi1_adv_mtls_par`,`fapi2_sp_pkj_mtls`,`fapi2_sp_mtls_mtls`]).optional().openapi({description:`Defines the compliance level for this client, which may restrict it's capabilities`}),par_request_expiry:W().optional().openapi({description:`Specifies how long, in seconds, a Pushed Authorization Request URI remains valid`}),token_quota:Y(H(),K()).default({}).optional(),owner_user_id:H().optional().openapi({description:`User ID of the consenting user when this client was created via IAT-gated Dynamic Client Registration. NULL for clients created via the Management API or open DCR.`}),registration_type:X([`manual`,`open_dcr`,`iat_dcr`]).optional().openapi({description:"Provenance of this client. `manual` = Management API; `open_dcr` = RFC 7591 without IAT; `iat_dcr` = RFC 7591 with an Initial Access Token."}),registration_metadata:Y(H(),K()).default({}).optional().openapi({description:"Arbitrary metadata captured at Dynamic Client Registration time that isn't a first-class client field (e.g. integration_type, domain). Also stores `iat_constraints` for clients created via IAT so RFC 7592 PUT can enforce field immutability."}),user_linking_mode:X([`builtin`,`off`]).optional().openapi({description:"Per-client override for the built-in email-based user-linking path. `builtin` runs the legacy in-process linking at user creation/email update. `off` disables the legacy path; linking only happens if the tenant has enabled the `account-linking` template hook. When unset, the service-level `userLinkingMode` default applies."})});J({created_at:H(),updated_at:H()}).extend(G_.shape).extend({client_id:H()});var K_=J({client_id:H().min(1).openapi({description:`ID of the client.`}),audience:H().min(1).openapi({description:`The audience (API identifier) of this client grant.`}),scope:q(H()).optional().openapi({description:`Scopes allowed for this client grant.`}),organization_usage:X([`deny`,`allow`,`require`]).optional().openapi({description:`Defines whether organizations can be used with client credentials exchanges for this grant.`}),allow_any_organization:G().optional().openapi({description:`If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.`}),is_system:G().optional().openapi({description:`If enabled, this grant is a special grant created by Auth0. It cannot be modified or deleted directly.`}),subject_type:X([`client`,`user`]).optional().openapi({description:`The type of application access the client grant allows. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement.`}),authorization_details_types:q(H()).optional().openapi({description:`Types of authorization_details allowed for this client grant. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement.`})});J({id:H().openapi({description:`ID of the client grant.`})}).extend(K_.shape).extend({created_at:H().optional(),updated_at:H().optional()});var q_=X([`iat`,`rat`]),J_=J({id:H(),token_hash:H(),type:q_,client_id:H().optional(),sub:H().optional(),constraints:Y(H(),Th()).optional(),single_use:G().default(!1),expires_at:H().optional()});J({created_at:H(),used_at:H().optional(),revoked_at:H().optional()}).extend(J_.shape);var Y_=J({x:W(),y:W()}),X_=function(e){return e.RICH_TEXT=`RICH_TEXT`,e.NEXT_BUTTON=`NEXT_BUTTON`,e.BACK_BUTTON=`BACK_BUTTON`,e.SUBMIT_BUTTON=`SUBMIT_BUTTON`,e.DIVIDER=`DIVIDER`,e.TEXT=`TEXT`,e.EMAIL=`EMAIL`,e.PASSWORD=`PASSWORD`,e.NUMBER=`NUMBER`,e.PHONE=`PHONE`,e.DATE=`DATE`,e.CHECKBOX=`CHECKBOX`,e.RADIO=`RADIO`,e.SELECT=`SELECT`,e.HIDDEN=`HIDDEN`,e.LEGAL=`LEGAL`,e}({}),Z_=function(e){return e.BLOCK=`BLOCK`,e.FIELD=`FIELD`,e}({}),Q_=J({id:H(),category:tg(Z_),type:tg(X_)}),$_=Rh([Q_.extend({category:Z(`BLOCK`),type:Z(`RICH_TEXT`),config:J({content:H()}).passthrough()}),Q_.extend({category:Z(`BLOCK`),type:Rh([Z(`NEXT_BUTTON`),Z(`BACK_BUTTON`),Z(`SUBMIT_BUTTON`)]),config:J({text:H()}).passthrough()}),Q_.extend({category:Z(`FIELD`),type:Z(`LEGAL`),required:G().optional(),sensitive:G().optional(),config:J({text:H()}).passthrough()}),Q_.extend({category:Z(`FIELD`),type:Rh([Z(`TEXT`),Z(`EMAIL`),Z(`PASSWORD`),Z(`NUMBER`),Z(`PHONE`),Z(`DATE`),Z(`CHECKBOX`),Z(`RADIO`),Z(`SELECT`),Z(`HIDDEN`)]),required:G().optional(),sensitive:G().optional(),config:J({label:H().optional(),placeholder:H().optional()}).passthrough()}),J({id:H(),category:H(),type:H()}).passthrough()]),ev=Rh([J({id:H(),type:Z(`STEP`),coordinates:Y_,alias:H().optional(),config:J({components:q($_),next_node:H()}).passthrough()}),J({id:H(),type:Z(`FLOW`),coordinates:Y_,alias:H().optional(),config:J({flow_id:H(),next_node:H()})}),J({id:H(),type:Z(`ACTION`),coordinates:Y_,alias:H().optional(),config:J({action_type:X([`REDIRECT`]).openapi({description:`The type of action to perform`}),target:X([`change-email`,`account`,`custom`]).openapi({description:`The predefined target to redirect to`}),custom_url:H().optional().openapi({description:`Custom URL when target is 'custom'`}),next_node:H().openapi({description:`The next node to navigate to after action (for non-redirect actions)`})}).passthrough()}),J({id:H(),type:H(),coordinates:Y_}).passthrough()]),tv=J({next_node:H(),coordinates:Y_}).passthrough(),nv=J({resume_flow:G().optional(),coordinates:Y_}).passthrough();J({id:H(),name:H(),languages:J({primary:H()}).passthrough(),nodes:q(ev),start:tv,ending:nv,created_at:H(),updated_at:H(),links:J({sdkSrc:H().optional(),sdk_src:H().optional()}).passthrough()}).passthrough().omit({id:!0,created_at:!0,updated_at:!0});var rv=function(e){return e.TOKEN=`token`,e.ID_TOKEN=`id_token`,e.TOKEN_ID_TOKEN=`id_token token`,e.CODE=`code`,e.CODE_ID_TOKEN=`code id_token`,e.CODE_TOKEN=`code token`,e.CODE_ID_TOKEN_TOKEN=`code id_token token`,e}({}),iv=function(e){return e.QUERY=`query`,e.FRAGMENT=`fragment`,e.FORM_POST=`form_post`,e.WEB_MESSAGE=`web_message`,e.SAML_POST=`saml_post`,e}({}),av=function(e){return e.S256=`S256`,e.Plain=`plain`,e}({}),ov=Rh([Sh(),J({essential:G().optional(),value:Th().optional(),values:q(Th()).optional()})]).nullable(),sv=J({userinfo:Y(H(),ov).optional(),id_token:Y(H(),ov).optional()}),cv=J({client_id:H(),act_as:H().optional(),response_type:tg(rv).optional(),response_mode:tg(iv).optional(),redirect_uri:H().optional(),audience:H().optional(),organization:H().optional(),state:H().optional(),nonce:H().optional(),scope:H().optional(),prompt:H().optional(),code_challenge_method:tg(av).optional(),code_challenge:H().optional(),username:H().optional(),ui_locales:H().optional(),max_age:W().optional(),acr_values:H().optional(),claims:sv.optional(),vendor_id:H().optional()});J({colors:J({primary:H(),page_background:Rh([H(),J({type:H().optional(),start:H().optional(),end:H().optional(),angle_deg:W().optional()})]).optional()}).optional(),logo_url:H().optional(),favicon_url:H().optional(),powered_by_logo_url:H().optional(),font:J({url:H()}).optional(),dark_mode:X([`dark`,`light`,`auto`]).optional()});var lv=X([`password_reset`,`email_verification`,`otp`,`mfa_otp`,`authorization_code`,`oauth2_state`,`ticket`]);J({code_id:H().openapi({description:`The code that will be used in for instance an email verification flow`}),login_id:H().openapi({description:`The id of the login session that the code is connected to`}),connection_id:H().optional().openapi({description:`The connection that the code is connected to`}),code_type:lv,code_verifier:H().optional().openapi({description:`The code verifier used in PKCE in outbound flows`}),code_challenge:H().optional().openapi({description:`The code challenge used in PKCE in outbound flows`}),code_challenge_method:X([`plain`,`S256`]).optional().openapi({description:`The code challenge method used in PKCE in outbound flows`}),redirect_uri:H().optional().openapi({description:`The redirect URI associated with the code`}),otp:H().optional().openapi({description:`The one-time password value for OTP-based flows`}),nonce:H().optional().openapi({description:`The nonce value used for security in OIDC flows`}),state:H().optional().openapi({description:`The state parameter used for CSRF protection in OAuth flows`}),expires_at:H(),used_at:H().optional(),user_id:H().optional()}).extend({created_at:H()});var uv=J({kid:H().optional(),team_id:H().optional(),realms:H().optional(),authentication_method:H().optional(),client_id:H().optional(),client_secret:H().optional(),app_secret:H().optional(),scope:H().optional(),authorization_endpoint:H().optional(),token_endpoint:H().optional(),userinfo_endpoint:H().optional(),jwks_uri:H().optional(),discovery_url:H().optional(),issuer:H().optional(),token_endpoint_auth_method:X([`client_secret_basic`,`client_secret_post`]).optional(),provider:H().optional(),from:H().optional(),twilio_sid:H().optional(),twilio_token:H().optional(),icon_url:H().optional(),domain_aliases:q(H()).optional(),callback_url:H().url().optional(),passwordPolicy:X([`none`,`low`,`fair`,`good`,`excellent`]).optional(),password_complexity_options:J({min_length:W().optional()}).optional(),password_history:J({enable:G().optional(),size:W().optional()}).optional(),password_no_personal_info:J({enable:G().optional()}).optional(),password_dictionary:J({enable:G().optional(),dictionary:q(H()).optional()}).optional(),disable_signup:G().optional(),brute_force_protection:G().optional(),import_mode:G().optional(),configuration:J({token_endpoint:H().optional(),userinfo_endpoint:H().optional(),client_id:H().optional(),client_secret:H().optional(),realm:H().optional()}).optional(),attributes:J({email:J({identifier:J({active:G().optional()}).optional(),signup:J({status:X([`required`,`optional`,`disabled`]).optional(),verification:J({active:G().optional()}).optional()}).optional(),validation:J({allowed:G().optional()}).optional(),unique:G().optional(),profile_required:G().optional(),verification_method:X([`link`,`code`]).optional()}).optional(),username:J({identifier:J({active:G().optional()}).optional(),signup:J({status:X([`required`,`optional`,`disabled`]).optional()}).optional(),validation:J({max_length:W().optional(),min_length:W().optional(),allowed_types:J({email:G().optional(),phone_number:G().optional()}).optional()}).optional(),profile_required:G().optional()}).optional(),phone_number:J({identifier:J({active:G().optional()}).optional(),signup:J({status:X([`required`,`optional`,`disabled`]).optional()}).optional()}).optional()}).optional(),authentication_methods:J({password:J({enabled:G().optional()}).optional(),passkey:J({enabled:G().optional()}).optional()}).optional(),passkey_options:J({challenge_ui:X([`both`,`autofill`,`button`]).optional(),local_enrollment_enabled:G().optional(),progressive_enrollment_enabled:G().optional()}).optional(),requires_username:G().optional(),validation:J({username:J({min:W().optional(),max:W().optional()}).optional()}).optional(),set_user_root_attributes:X([`on_each_login`,`on_first_login`,`never_on_login`]).optional()});function dv(e){if(e!==null){if(Array.isArray(e))return e.filter(e=>e!==null).map(dv);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))r!==null&&(t[n]=dv(r));return t}return e}}var fv=J({id:H().optional(),name:H(),display_name:H().optional(),strategy:H(),options:Qg(e=>e===null?{}:dv(e),uv).default({}),enabled_clients:q(H()).default([]).optional(),response_type:Wg().optional(),response_mode:Wg().optional(),is_domain_connection:G().optional(),show_as_button:G().optional(),metadata:Y(H(),K()).optional(),is_system:G().optional()});J({id:H(),created_at:H().transform(e=>e===null?``:e),updated_at:H().transform(e=>e===null?``:e)}).extend(fv.shape);var pv=J({domain:H(),custom_domain_id:H().optional(),type:X([`auth0_managed_certs`,`self_managed_certs`]),verification_method:X([`txt`]).optional(),tls_policy:X([`recommended`]).optional(),custom_client_ip_header:X([`true-client-ip`,`cf-connecting-ip`,`x-forwarded-for`,`x-azure-clientip`,`null`]).optional(),domain_metadata:Y(H(),H().max(255)).optional()}),mv=Hh(`name`,[J({name:Z(`txt`),record:H(),domain:H()}),J({name:Z(`http`),http_body:H(),http_url:H()})]);pv.extend({custom_domain_id:H(),primary:G(),status:X([`disabled`,`pending`,`pending_verification`,`ready`]),origin_domain_name:H().optional(),verification:J({methods:q(mv)}).optional(),tls_policy:H().optional()}).extend({tenant_id:H()});var hv=J({id:H(),order:W().optional(),visible:G().optional().default(!0)}),gv=hv.extend({category:Z(`BLOCK`).optional()}),_v=gv.extend({type:Z(`DIVIDER`),config:J({text:H().optional()}).optional()}),vv=gv.extend({type:Z(`HTML`),config:J({content:H().optional()}).optional()}),yv=gv.extend({type:Z(`IMAGE`),config:J({src:H().optional(),alt:H().optional(),width:W().optional(),height:W().optional()}).optional()}),bv=gv.extend({type:Z(`JUMP_BUTTON`),config:J({text:H().optional(),target_step:H().optional()})}),xv=gv.extend({type:Z(`RESEND_BUTTON`),config:J({text:H().optional(),resend_action:H().optional()})}),Sv=gv.extend({type:Z(`NEXT_BUTTON`),config:J({text:H().optional()})}),Cv=gv.extend({type:Z(`PREVIOUS_BUTTON`),config:J({text:H().optional()})}),wv=gv.extend({type:Z(`RICH_TEXT`),config:J({content:H().optional()}).optional()}),Tv=hv.extend({category:Z(`WIDGET`).optional(),label:H().min(1).optional(),hint:H().min(1).max(500).optional(),required:G().optional(),sensitive:G().optional()}),Ev=Tv.extend({type:Z(`AUTH0_VERIFIABLE_CREDENTIALS`),config:J({credential_type:H().optional()})}),Dv=Tv.extend({type:Z(`GMAPS_ADDRESS`),config:J({api_key:H().optional()})}),Ov=Tv.extend({type:Z(`RECAPTCHA`),config:J({site_key:H().optional()})}),kv=hv.extend({category:Z(`FIELD`).optional(),label:H().min(1).optional(),hint:H().min(1).max(500).optional(),messages:q(J({id:W().optional(),text:H(),type:X([`info`,`error`,`success`,`warning`])})).optional(),required:G().optional(),sensitive:G().optional()}),Av=kv.extend({type:Z(`BOOLEAN`),config:J({default_value:G().optional()}).optional()}),jv=kv.extend({type:Z(`CARDS`),config:J({options:q(J({value:H(),label:H(),description:H().optional(),image:H().optional()})).optional(),multi_select:G().optional()}).optional()}),Mv=kv.extend({type:Z(`CHOICE`),config:J({options:q(J({value:H(),label:H()})).optional(),display:X([`radio`,`checkbox`]).optional(),multiple:G().optional(),default_value:Rh([H(),q(H())]).optional()}).optional()}),Nv=kv.extend({type:Z(`CUSTOM`),config:J({component:H().optional(),props:Y(H(),K()).optional(),schema:Y(H(),K()).optional(),code:H().optional()})}),Pv=kv.extend({type:Z(`DATE`),config:J({format:H().optional(),min:H().optional(),max:H().optional(),default_value:H().optional()}).optional()}),Fv=kv.extend({type:Z(`DROPDOWN`),config:J({options:q(J({value:H(),label:H()})).optional(),placeholder:H().optional(),searchable:G().optional(),multiple:G().optional(),default_value:Rh([H(),q(H())]).optional()}).optional()}),Iv=kv.extend({type:Z(`EMAIL`),config:J({placeholder:H().optional(),default_value:H().optional()}).optional()}),Lv=kv.extend({type:Z(`FILE`),config:J({accept:H().optional(),max_size:W().optional(),multiple:G().optional()}).optional()}),Rv=kv.extend({type:Z(`LEGAL`),config:J({text:H(),html:G().optional()}).optional()}),zv=kv.extend({type:Z(`NUMBER`),config:J({placeholder:H().optional(),min:W().optional(),max:W().optional(),step:W().optional(),default_value:H().optional()}).optional()}),Bv=kv.extend({type:Z(`PASSWORD`),config:J({placeholder:H().optional(),min_length:W().optional(),show_toggle:G().optional(),forgot_password_link:H().optional(),default_value:H().optional()}).optional()}),Vv=kv.extend({type:Z(`PAYMENT`),config:J({provider:H().optional(),currency:H().optional()}).optional()}),Hv=kv.extend({type:Z(`SOCIAL`),config:J({providers:q(H()).optional(),provider_details:q(J({name:H(),strategy:H().optional(),display_name:H().optional(),icon_url:H().optional(),href:H().optional()})).optional()}).optional()}),Uv=kv.extend({type:Z(`TEL`),config:J({placeholder:H().optional(),default_country:H().optional(),default_value:H().optional(),allow_email:G().optional()}).optional()}),Wv=kv.extend({type:Z(`TEXT`),config:J({placeholder:H().optional(),multiline:G().optional(),max_length:W().optional(),default_value:H().optional()}).optional()}),Gv=kv.extend({type:Z(`COUNTRY`),config:J({placeholder:H().optional(),default_value:H().optional()}).optional()}),Kv=kv.extend({type:Z(`URL`),config:J({placeholder:H().optional(),default_value:H().optional()}).optional()}),qv=Rh([Hh(`type`,[_v,vv,yv,bv,xv,Sv,Cv,wv]),Hh(`type`,[Ev,Dv,Ov]),Hh(`type`,[Av,jv,Mv,Gv,Nv,Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv,Kv])]);new Set([`BOOLEAN`,`CARDS`,`CHOICE`,`COUNTRY`,`DATE`,`DROPDOWN`,`EMAIL`,`LEGAL`,`NUMBER`,`PASSWORD`,`TEL`,`TEXT`,`URL`]),J({id:H(),type:Z(`submit`),label:H(),className:H().optional(),disabled:G().optional().default(!1),order:W().optional(),visible:G().optional().default(!0),customizations:Y(H(),K()).optional()});var Jv=J({x:W(),y:W()}),Yv=Hh(`type`,[J({id:H(),type:Z(`FLOW`),coordinates:Jv,alias:H().min(1).max(150).optional(),config:J({flow_id:H().max(30),next_node:H().optional()})}),J({id:H(),type:Z(`ROUTER`),coordinates:Jv,alias:H().min(1).max(150),config:J({rules:q(J({id:H(),alias:H().min(1).max(150).optional(),condition:K(),next_node:H()})),fallback:H()})}),J({id:H(),type:Z(`STEP`),coordinates:Jv,alias:H().min(1).max(150).optional(),config:J({components:q(qv),next_node:H().optional()})})]),Xv=J({name:H().openapi({description:`The name of the form`}),messages:J({errors:Y(H(),K()).optional(),custom:Y(H(),K()).optional()}).optional(),languages:J({primary:H().optional(),default:H().optional()}).optional(),translations:Y(H(),K()).optional(),nodes:q(Yv).optional(),start:J({hidden_fields:q(J({key:H(),value:H()})).optional(),next_node:H().optional(),coordinates:Jv.optional()}).optional(),ending:J({redirection:J({delay:W().optional(),target:H().optional()}).optional(),after_submit:J({flow_id:H().optional()}).optional(),coordinates:Jv.optional(),resume_flow:G().optional()}).optional(),style:J({css:H().optional()}).optional(),links:J({sdkSrc:H().optional(),sdk_src:H().optional()}).optional()}).openapi({description:`Schema for flow-based forms (matches Auth0 Forms structure)`});g_.extend(Xv.shape).extend({id:H()});var Zv=J({id:W().optional(),text:H(),type:X([`info`,`error`,`success`,`warning`])}),Qv=J({id:H().optional(),text:H(),href:H(),linkText:H().optional()});J({name:H().optional(),action:H(),method:X([`POST`,`GET`]),title:H().optional(),description:H().optional(),components:q(qv),messages:q(Zv).optional(),links:q(Qv).optional(),footer:H().optional()});var $v=X([`pre-user-registration`,`post-user-registration`,`post-user-login`,`post-user-update`,`validate-registration-username`,`pre-user-deletion`,`post-user-deletion`]),ey=X([`pre-user-registration`,`post-user-registration`,`post-user-login`,`validate-registration-username`,`pre-user-deletion`,`post-user-deletion`]),ty=X([`post-user-login`,`post-user-registration`,`post-user-update`,`credentials-exchange`]),ny=X([`post-user-login`,`credentials-exchange`,`pre-user-registration`,`post-user-registration`]),ry=X([`ensure-username`,`set-preferred-username`,`account-linking`]),iy={enabled:G().default(!1),synchronous:G().default(!1),priority:W().optional(),hook_id:H().optional(),metadata:Y(H(),Th()).optional()};Rh([J({...iy,trigger_id:$v,url:H()}),J({...iy,trigger_id:ey,form_id:H()}),J({...iy,trigger_id:ty,template_id:ry}),J({...iy,trigger_id:ny,code_id:H()})]),Rh([J({...iy,trigger_id:$v}).extend(g_.shape).extend({hook_id:H(),url:H()}),J({...iy,trigger_id:ey}).extend(g_.shape).extend({hook_id:H(),form_id:H()}),J({...iy,trigger_id:ty}).extend(g_.shape).extend({hook_id:H(),template_id:ry}),J({...iy,trigger_id:ny}).extend(g_.shape).extend({hook_id:H(),code_id:H()})]),J({code:H().max(1e5),secrets:Y(H(),H()).optional()}).extend({id:H(),tenant_id:H()}).extend(g_.shape);var ay=J({name:H().optional()}),oy=J({email:H().optional()}),sy=J({id:H().optional(),organization_id:H().max(50),inviter:ay,invitee:oy,invitation_url:H().url(),client_id:H(),connection_id:H().optional(),app_metadata:Y(H(),K()).default({}).optional(),user_metadata:Y(H(),K()).default({}).optional(),ttl_sec:W().int().max(2592e3).default(604800).optional(),roles:q(H()).default([]).optional(),send_invitation_email:G().default(!0).optional()});J({id:H(),organization_id:H().max(50),created_at:H().datetime(),expires_at:H().datetime(),ticket_id:H().optional()}).extend(sy.omit({id:!0}).shape),J({keys:q(J({alg:X([`RS256`,`RS384`,`RS512`,`ES256`,`ES384`,`ES512`,`HS256`,`HS384`,`HS512`]),kid:H(),kty:X([`RSA`,`EC`,`oct`]),use:X([`sig`,`enc`]).optional(),n:H().optional(),e:H().optional(),crv:H().optional(),x:H().optional(),y:H().optional(),x5t:H().optional(),x5c:q(H()).optional()}).superRefine((e,t)=>{if(e.kty===`RSA`)for(let n of[`n`,`e`])e[n]||t.addIssue({code:$g.custom,path:[n],message:`RSA JWK is missing required member '${n}'`});else if(e.kty===`EC`)for(let n of[`crv`,`x`,`y`])e[n]||t.addIssue({code:$g.custom,path:[n],message:`EC JWK is missing required member '${n}'`})}))}),J({issuer:H(),authorization_endpoint:H(),token_endpoint:H(),userinfo_endpoint:H(),jwks_uri:H(),registration_endpoint:H().optional(),revocation_endpoint:H(),end_session_endpoint:H().optional(),scopes_supported:q(H()),response_types_supported:q(H()),grant_types_supported:q(H()).optional(),code_challenge_methods_supported:q(H()),response_modes_supported:q(H()),subject_types_supported:q(H()),id_token_signing_alg_values_supported:q(H()),token_endpoint_auth_methods_supported:q(H()),claims_supported:q(H()),request_uri_parameter_supported:G(),request_parameter_supported:G(),claims_parameter_supported:G().optional(),request_object_signing_alg_values_supported:q(H()).optional(),token_endpoint_auth_signing_alg_values_supported:q(H())});var cy=tg(function(e){return e.PENDING=`pending`,e.AUTHENTICATED=`authenticated`,e.AWAITING_EMAIL_VERIFICATION=`awaiting_email_verification`,e.AWAITING_MFA=`awaiting_mfa`,e.AWAITING_HOOK=`awaiting_hook`,e.AWAITING_CONTINUATION=`awaiting_continuation`,e.COMPLETED=`completed`,e.FAILED=`failed`,e.EXPIRED=`expired`,e}({})),ly=J({strategy:H(),strategy_type:H()});J({csrf_token:H(),auth0Client:H().optional(),authParams:cv,expires_at:H(),deleted_at:H().optional(),ip:H().optional(),useragent:H().optional(),session_id:H().optional(),authorization_url:H().optional(),state:cy.optional().default(`pending`),state_data:H().optional(),failure_reason:H().optional(),user_id:H().optional(),auth_connection:H().optional(),auth_strategy:ly.optional(),authenticated_at:H().optional()}).openapi({description:`This represents a login sesion`}).extend({id:H().openapi({description:`This is is used as the state in the universal login`}),created_at:H(),updated_at:H()});var $={ACLS_SUMMARY:`acls_summary`,ACTIONS_EXECUTION_FAILED:`actions_execution_failed`,API_LIMIT:`api_limit`,API_LIMIT_WARNING:`api_limit_warning`,APPI:`appi`,CIBA_EXCHANGE_FAILED:`ciba_exchange_failed`,CIBA_EXCHANGE_SUCCEEDED:`ciba_exchange_succeeded`,CIBA_START_FAILED:`ciba_start_failed`,CIBA_START_SUCCEEDED:`ciba_start_succeeded`,CODE_LINK_SENT:`cls`,CODE_SENT:`cs`,DEPRECATION_NOTICE:`depnote`,FAILED_LOGIN:`f`,FAILED_BY_CONNECTOR:`fc`,FAILED_CHANGE_EMAIL:`fce`,FAILED_BY_CORS:`fco`,FAILED_CROSS_ORIGIN_AUTHENTICATION:`fcoa`,FAILED_CHANGE_PASSWORD:`fcp`,FAILED_POST_CHANGE_PASSWORD_HOOK:`fcph`,FAILED_CHANGE_PHONE_NUMBER:`fcpn`,FAILED_CHANGE_PASSWORD_REQUEST:`fcpr`,FAILED_CONNECTOR_PROVISIONING:`fcpro`,FAILED_CHANGE_USERNAME:`fcu`,FAILED_DELEGATION:`fd`,FAILED_DEVICE_ACTIVATION:`fdeac`,FAILED_DEVICE_AUTHORIZATION_REQUEST:`fdeaz`,USER_CANCELED_DEVICE_CONFIRMATION:`fdecc`,FAILED_USER_DELETION:`fdu`,FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:`feacft`,FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:`feccft`,FAILED_EXCHANGE_CUSTOM_TOKEN:`fecte`,FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:`fede`,FAILED_FEDERATED_LOGOUT:`federated_logout_failed`,FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:`fens`,FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:`feoobft`,FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:`feotpft`,FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:`fepft`,FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:`fepotpft`,FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:`fercft`,FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:`ferrt`,FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:`fertft`,FAILED_HOOK:`fh`,FAILED_IMPERSONATION:`fimp`,FAILED_INVITE_ACCEPT:`fi`,FAILED_LOGOUT:`flo`,FLOWS_EXECUTION_COMPLETED:`flows_execution_completed`,FLOWS_EXECUTION_FAILED:`flows_execution_failed`,FAILED_SENDING_NOTIFICATION:`fn`,FORMS_SUBMISSION_FAILED:`forms_submission_failed`,FORMS_SUBMISSION_SUCCEEDED:`forms_submission_succeeded`,FAILED_LOGIN_INCORRECT_PASSWORD:`fp`,FAILED_PUSHED_AUTHORIZATION_REQUEST:`fpar`,FAILED_POST_USER_REGISTRATION_HOOK:`fpurh`,FAILED_SIGNUP:`fs`,FAILED_SILENT_AUTH:`fsa`,FAILED_LOGIN_INVALID_EMAIL_USERNAME:`fu`,FAILED_USERS_IMPORT:`fui`,FAILED_VERIFICATION_EMAIL:`fv`,FAILED_VERIFICATION_EMAIL_REQUEST:`fvr`,EMAIL_VERIFICATION_CONFIRMED:`gd_auth_email_verification`,EMAIL_VERIFICATION_FAILED:`gd_auth_fail_email_verification`,MFA_AUTH_FAILED:`gd_auth_failed`,MFA_AUTH_REJECTED:`gd_auth_rejected`,MFA_AUTH_SUCCESS:`gd_auth_succeed`,MFA_ENROLLMENT_COMPLETE:`gd_enrollment_complete`,TOO_MANY_MFA_FAILURES:`gd_otp_rate_limit_exceed`,MFA_RECOVERY_FAILED:`gd_recovery_failed`,MFA_RECOVERY_RATE_LIMIT_EXCEED:`gd_recovery_rate_limit_exceed`,MFA_RECOVERY_SUCCESS:`gd_recovery_succeed`,MFA_EMAIL_SENT:`gd_send_email`,EMAIL_VERIFICATION_SENT:`gd_send_email_verification`,EMAIL_VERIFICATION_SEND_FAILURE:`gd_send_email_verification_failure`,PUSH_NOTIFICATION_SENT:`gd_send_pn`,ERROR_SENDING_MFA_PUSH_NOTIFICATION:`gd_send_pn_failure`,MFA_SMS_SENT:`gd_send_sms`,ERROR_SENDING_MFA_SMS:`gd_send_sms_failure`,MFA_VOICE_CALL_SUCCESS:`gd_send_voice`,MFA_VOICE_CALL_FAILED:`gd_send_voice_failure`,SECOND_FACTOR_STARTED:`gd_start_auth`,MFA_ENROLL_STARTED:`gd_start_enroll`,MFA_ENROLLMENT_FAILED:`gd_start_enroll_failed`,GUARDIAN_TENANT_UPDATE:`gd_tenant_update`,UNENROLL_DEVICE_ACCOUNT:`gd_unenroll`,UPDATE_DEVICE_ACCOUNT:`gd_update_device_account`,WEBAUTHN_CHALLENGE_FAILED:`gd_webauthn_challenge_failed`,WEBAUTHN_ENROLLMENT_FAILED:`gd_webauthn_enrollment_failed`,FAILED_KMS_API_OPERATION:`kms_key_management_failure`,SUCCESS_KMS_API_OPERATION:`kms_key_management_success`,KMS_KEY_STATE_CHANGED:`kms_key_state_changed`,TOO_MANY_CALLS_TO_DELEGATION:`limit_delegation`,BLOCKED_IP_ADDRESS:`limit_mu`,BLOCKED_ACCOUNT_IP:`limit_sul`,BLOCKED_ACCOUNT_EMAIL:`limit_wc`,INFORMATION:`i`,MFA_REQUIRED:`mfar`,MANAGEMENT_API_READ_OPERATION:`mgmt_api_read`,FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:`my_account_authentication_method_failed`,SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:`my_account_authentication_method_succeeded`,FAILED_OIDC_BACKCHANNEL_LOGOUT:`oidc_backchannel_logout_failed`,SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:`oidc_backchannel_logout_succeeded`,ORGANIZATION_MEMBER_ADDED:`organization_member_added`,PASSKEY_CHALLENGE_FAILED:`passkey_challenge_failed`,PASSKEY_CHALLENGE_STARTED:`passkey_challenge_started`,PRE_LOGIN_ASSESSMENT:`pla`,BREACHED_PASSWORD:`pwd_leak`,BREACHED_PASSWORD_ON_RESET:`reset_pwd_leak`,SUCCESS_RESOURCE_CLEANUP:`resource_cleanup`,RICH_CONSENTS_ACCESS_ERROR:`rich_consents_access_error`,SUCCESS_LOGIN:`s`,SUCCESS_API_OPERATION:`sapi`,FAILED_API_OPERATION:`fapi`,SUCCESS_CHANGE_EMAIL:`sce`,SUCCESS_CROSS_ORIGIN_AUTHENTICATION:`scoa`,SUCCESS_CHANGE_PASSWORD:`scp`,SUCCESS_CHANGE_PHONE_NUMBER:`scpn`,SUCCESS_CHANGE_PASSWORD_REQUEST:`scpr`,SUCCESS_CHANGE_USERNAME:`scu`,SUCCESS_CREDENTIAL_VALIDATION:`scv`,SUCCESS_DELEGATION:`sd`,SUCCESS_USER_DELETION:`sdu`,SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:`seacft`,SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:`seccft`,SUCCESS_EXCHANGE_CUSTOM_TOKEN:`secte`,SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:`sede`,SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:`sens`,SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:`seoobft`,SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:`seotpft`,SUCCESS_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:`sepotpft`,SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:`sepft`,SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:`sepkoobft`,SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:`sepkotpft`,SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:`sepkrcft`,SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:`sercft`,SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:`sertft`,SUCCESS_IMPERSONATION:`simp`,SUCCESSFULLY_ACCEPTED_USER_INVITE:`si`,BREACHED_PASSWORD_ON_SIGNUP:`signup_pwd_leak`,SUCCESS_LOGOUT:`slo`,SUCCESS_HOOK:`sh`,SUCCESS_PASSWORD_MIGRATION:`spm`,SUCCESS_REVOCATION:`srrt`,SUCCESS_SIGNUP:`ss`,FAILED_SS_SSO_OPERATION:`ss_sso_failure`,INFORMATION_FROM_SS_SSO_OPERATION:`ss_sso_info`,SUCCESS_SS_SSO_OPERATION:`ss_sso_success`,SUCCESS_SILENT_AUTH:`ssa`,SUCCESSFUL_SCIM_OPERATION:`sscim`,SUCCESSFULLY_IMPORTED_USERS:`sui`,SUCCESS_VERIFICATION_EMAIL:`sv`,SUCCESS_VERIFICATION_EMAIL_REQUEST:`svr`,MAX_AMOUNT_OF_AUTHENTICATORS:`too_many_records`,USER_LOGIN_BLOCK_RELEASED:`ublkdu`,FAILED_UNIVERSAL_LOGOUT:`universal_logout_failed`,SUCCESSFUL_UNIVERSAL_LOGOUT:`universal_logout_succeeded`,WARNING_DURING_LOGIN:`w`,WARNING_SENDING_NOTIFICATION:`wn`,WARNING_USER_MANAGEMENT:`wum`},uy=H().refine(e=>Object.values($).includes(e),{message:`Invalid log type`});$.ACLS_SUMMARY,$.ACTIONS_EXECUTION_FAILED,$.API_LIMIT,$.API_LIMIT_WARNING,$.APPI,$.CIBA_EXCHANGE_FAILED,$.CIBA_EXCHANGE_SUCCEEDED,$.CIBA_START_FAILED,$.CIBA_START_SUCCEEDED,$.CODE_LINK_SENT,$.CODE_SENT,$.DEPRECATION_NOTICE,$.FAILED_LOGIN,$.FAILED_BY_CONNECTOR,$.FAILED_CHANGE_EMAIL,$.FAILED_BY_CORS,$.FAILED_CROSS_ORIGIN_AUTHENTICATION,$.FAILED_CHANGE_PASSWORD,$.FAILED_POST_CHANGE_PASSWORD_HOOK,$.FAILED_CHANGE_PHONE_NUMBER,$.FAILED_CHANGE_PASSWORD_REQUEST,$.FAILED_CONNECTOR_PROVISIONING,$.FAILED_CHANGE_USERNAME,$.FAILED_DELEGATION,$.FAILED_DEVICE_ACTIVATION,$.FAILED_DEVICE_AUTHORIZATION_REQUEST,$.USER_CANCELED_DEVICE_CONFIRMATION,$.FAILED_USER_DELETION,$.FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN,$.FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS,$.FAILED_EXCHANGE_CUSTOM_TOKEN,$.FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN,$.FAILED_FEDERATED_LOGOUT,$.FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN,$.FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN,$.FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN,$.FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN,$.FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN,$.FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN,$.FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN,$.FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN,$.FAILED_HOOK,$.FAILED_IMPERSONATION,$.FAILED_INVITE_ACCEPT,$.FAILED_LOGOUT,$.FLOWS_EXECUTION_COMPLETED,$.FLOWS_EXECUTION_FAILED,$.FAILED_SENDING_NOTIFICATION,$.FORMS_SUBMISSION_FAILED,$.FORMS_SUBMISSION_SUCCEEDED,$.FAILED_LOGIN_INCORRECT_PASSWORD,$.FAILED_PUSHED_AUTHORIZATION_REQUEST,$.FAILED_POST_USER_REGISTRATION_HOOK,$.FAILED_SIGNUP,$.FAILED_SILENT_AUTH,$.FAILED_LOGIN_INVALID_EMAIL_USERNAME,$.FAILED_USERS_IMPORT,$.FAILED_VERIFICATION_EMAIL,$.FAILED_VERIFICATION_EMAIL_REQUEST,$.EMAIL_VERIFICATION_CONFIRMED,$.EMAIL_VERIFICATION_FAILED,$.MFA_AUTH_FAILED,$.MFA_AUTH_REJECTED,$.MFA_AUTH_SUCCESS,$.MFA_ENROLLMENT_COMPLETE,$.TOO_MANY_MFA_FAILURES,$.MFA_RECOVERY_FAILED,$.MFA_RECOVERY_RATE_LIMIT_EXCEED,$.MFA_RECOVERY_SUCCESS,$.MFA_EMAIL_SENT,$.EMAIL_VERIFICATION_SENT,$.EMAIL_VERIFICATION_SEND_FAILURE,$.PUSH_NOTIFICATION_SENT,$.ERROR_SENDING_MFA_PUSH_NOTIFICATION,$.MFA_SMS_SENT,$.ERROR_SENDING_MFA_SMS,$.MFA_VOICE_CALL_SUCCESS,$.MFA_VOICE_CALL_FAILED,$.SECOND_FACTOR_STARTED,$.MFA_ENROLL_STARTED,$.MFA_ENROLLMENT_FAILED,$.GUARDIAN_TENANT_UPDATE,$.UNENROLL_DEVICE_ACCOUNT,$.UPDATE_DEVICE_ACCOUNT,$.WEBAUTHN_CHALLENGE_FAILED,$.WEBAUTHN_ENROLLMENT_FAILED,$.FAILED_KMS_API_OPERATION,$.SUCCESS_KMS_API_OPERATION,$.KMS_KEY_STATE_CHANGED,$.TOO_MANY_CALLS_TO_DELEGATION,$.BLOCKED_IP_ADDRESS,$.BLOCKED_ACCOUNT_IP,$.BLOCKED_ACCOUNT_EMAIL,$.INFORMATION,$.MFA_REQUIRED,$.MANAGEMENT_API_READ_OPERATION,$.FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT,$.SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT,$.FAILED_OIDC_BACKCHANNEL_LOGOUT,$.SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT,$.ORGANIZATION_MEMBER_ADDED,$.PASSKEY_CHALLENGE_FAILED,$.PASSKEY_CHALLENGE_STARTED,$.PRE_LOGIN_ASSESSMENT,$.BREACHED_PASSWORD,$.BREACHED_PASSWORD_ON_RESET,$.SUCCESS_RESOURCE_CLEANUP,$.RICH_CONSENTS_ACCESS_ERROR,$.SUCCESS_LOGIN,$.SUCCESS_API_OPERATION,$.FAILED_API_OPERATION,$.SUCCESS_CHANGE_EMAIL,$.SUCCESS_CROSS_ORIGIN_AUTHENTICATION,$.SUCCESS_CHANGE_PASSWORD,$.SUCCESS_CHANGE_PHONE_NUMBER,$.SUCCESS_CHANGE_PASSWORD_REQUEST,$.SUCCESS_CHANGE_USERNAME,$.SUCCESS_CREDENTIAL_VALIDATION,$.SUCCESS_DELEGATION,$.SUCCESS_USER_DELETION,$.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS,$.SUCCESS_EXCHANGE_CUSTOM_TOKEN,$.SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN,$.SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN,$.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN,$.SUCCESS_IMPERSONATION,$.SUCCESSFULLY_ACCEPTED_USER_INVITE,$.BREACHED_PASSWORD_ON_SIGNUP,$.SUCCESS_LOGOUT,$.SUCCESS_HOOK,$.SUCCESS_PASSWORD_MIGRATION,$.SUCCESS_REVOCATION,$.SUCCESS_SIGNUP,$.FAILED_SS_SSO_OPERATION,$.INFORMATION_FROM_SS_SSO_OPERATION,$.SUCCESS_SS_SSO_OPERATION,$.SUCCESS_SILENT_AUTH,$.SUCCESSFUL_SCIM_OPERATION,$.SUCCESSFULLY_IMPORTED_USERS,$.SUCCESS_VERIFICATION_EMAIL,$.SUCCESS_VERIFICATION_EMAIL_REQUEST,$.MAX_AMOUNT_OF_AUTHENTICATORS,$.USER_LOGIN_BLOCK_RELEASED,$.FAILED_UNIVERSAL_LOGOUT,$.SUCCESSFUL_UNIVERSAL_LOGOUT,$.WARNING_DURING_LOGIN,$.WARNING_SENDING_NOTIFICATION,$.WARNING_USER_MANAGEMENT,(()=>{let e={};for(let[t,n]of Object.entries($))t.startsWith(`SUCCESS_`)||t.startsWith(`SUCCESSFUL_`)||t.startsWith(`SUCCESSFULLY_`)||t.endsWith(`_SUCCEEDED`)||t.endsWith(`_COMPLETED`)?e[n]=`success`:t.startsWith(`FAILED_`)||t.startsWith(`ERROR_`)||t.startsWith(`BREACHED_`)||t.startsWith(`BLOCKED_`)||t===`MFA_AUTH_FAILED`||t===`MFA_AUTH_REJECTED`||t===`MFA_RECOVERY_FAILED`||t===`MFA_ENROLLMENT_FAILED`||t===`EMAIL_VERIFICATION_FAILED`||t===`WEBAUTHN_CHALLENGE_FAILED`||t===`WEBAUTHN_ENROLLMENT_FAILED`||t===`PASSKEY_CHALLENGE_FAILED`||t===`FLOWS_EXECUTION_FAILED`||t===`FORMS_SUBMISSION_FAILED`||t===`CIBA_EXCHANGE_FAILED`||t===`CIBA_START_FAILED`||t===`ACTIONS_EXECUTION_FAILED`||t===`RICH_CONSENTS_ACCESS_ERROR`||t===`USER_CANCELED_DEVICE_CONFIRMATION`||t===`TOO_MANY_MFA_FAILURES`||t===`MFA_RECOVERY_RATE_LIMIT_EXCEED`||t===`API_LIMIT`||t===`MAX_AMOUNT_OF_AUTHENTICATORS`?e[n]=`failure`:t.startsWith(`WARNING_`)||t===`API_LIMIT_WARNING`||t===`DEPRECATION_NOTICE`||t===`PRE_LOGIN_ASSESSMENT`?e[n]=`warning`:t===`CODE_SENT`||t===`CODE_LINK_SENT`||t===`MFA_EMAIL_SENT`||t===`MFA_SMS_SENT`||t===`EMAIL_VERIFICATION_SENT`||t===`PUSH_NOTIFICATION_SENT`?e[n]=`code_sent`:t===`INFORMATION`||t===`INFORMATION_FROM_SS_SSO_OPERATION`||t===`MANAGEMENT_API_READ_OPERATION`||t===`APPI`||t===`ACLS_SUMMARY`||t===`ORGANIZATION_MEMBER_ADDED`?e[n]=`info`:e[n]=`other`;return e})();var dy=J({name:H(),version:H(),env:J({node:H().optional()}).optional()}),fy=J({country_code:H().length(2),city_name:H(),latitude:H(),longitude:H(),time_zone:H(),continent_code:H()});J({type:uy,date:H(),description:H().optional(),ip:H().optional(),user_agent:H().optional(),details:K().optional(),isMobile:G(),user_id:H().optional(),user_name:H().optional(),connection:H().optional(),connection_id:H().optional(),client_id:H().optional(),client_name:H().optional(),audience:H().optional(),scope:H().optional(),strategy:H().optional(),strategy_type:H().optional(),hostname:H().optional(),auth0_client:dy.optional(),log_id:H().optional(),location_info:fy.optional()}).extend({log_id:H()});var py=X([`http`,`eventbridge`,`eventgrid`,`splunk`,`datadog`,`sumo`]),my=X([`active`,`paused`,`suspended`]),hy=J({type:H(),name:H()});J({name:H(),type:py,status:my.optional(),sink:Y(H(),Th()),filters:q(hy).optional(),isPriority:G().optional()}).extend({id:H(),status:my,created_at:H().optional(),updated_at:H().optional()});var gy=X([`auth0`,`cognito`,`okta`,`oidc`]),_y=J({domain:H(),client_id:H(),client_secret:H(),audience:H().optional(),scope:H().optional()}),vy=J({id:H().optional(),name:H(),provider:gy,connection:H(),enabled:G().default(!0),credentials:_y});J({id:H(),created_at:H(),updated_at:H()}).extend(vy.shape);var yy=J({enabled:G().optional(),shields:q(H()).optional(),admin_notification_frequency:q(H()).optional(),method:H().optional(),stage:J({"pre-user-registration":J({shields:q(H()).optional()}).optional(),"pre-change-password":J({shields:q(H()).optional()}).optional()}).optional()}),by=J({enabled:G().optional(),shields:q(H()).optional(),allowlist:q(H()).optional(),mode:H().optional(),max_attempts:W().optional()}),xy=J({enabled:G().optional(),shields:q(H()).optional(),allowlist:q(H()).optional(),stage:J({"pre-login":J({max_attempts:W().optional(),rate:W().optional()}).optional(),"pre-user-registration":J({max_attempts:W().optional(),rate:W().optional()}).optional()}).optional()}),Sy=J({breached_password_detection:yy.optional(),brute_force_protection:by.optional(),suspicious_ip_throttling:xy.optional()});J({id:H().optional(),user_id:H(),password:H(),algorithm:X([`bcrypt`,`argon2id`]).default(`argon2id`),is_current:G().default(!0)}).extend({id:H(),created_at:H(),updated_at:H()});var Cy=J({initial_user_agent:H().describe(`First user agent of the device from which this user logged in`),initial_ip:H().describe(`First IP address associated with this session`),initial_asn:H().describe(`First autonomous system number associated with this session`),last_user_agent:H().describe(`Last user agent of the device from which this user logged in`),last_ip:H().describe(`Last IP address from which this user logged in`),last_asn:H().describe(`Last autonomous system number from which this user logged in`)}),wy=J({id:H(),revoked_at:H().optional(),used_at:H().optional(),user_id:H().describe(`The user ID associated with the session`),expires_at:H().optional(),login_session_id:H(),idle_expires_at:H().optional(),device:Cy.describe(`Metadata related to the device used in the session`),clients:q(H()).describe(`List of client details for the session`)});J({created_at:H(),updated_at:H(),authenticated_at:H(),last_interaction_at:H()}).extend(wy.shape),J({kid:H().openapi({description:`The key id of the signing key`}),tenant_id:H().optional().openapi({description:`The tenant the key belongs to. Omitted means the key is shared / control-plane scoped.`}),cert:H().openapi({description:`The public certificate of the signing key`}),fingerprint:H().openapi({description:`The cert fingerprint`}),thumbprint:H().openapi({description:`The cert thumbprint`}),pkcs7:H().optional().openapi({description:`The private key in pkcs7 format`}),current:G().optional().openapi({description:`True if the key is the current key`}),next:G().optional().openapi({description:`True if the key is the next key`}),previous:G().optional().openapi({description:`True if the key is the previous key`}),current_since:H().optional().openapi({description:`The date and time when the key became the current key`}),current_until:H().optional().openapi({description:`The date and time when the current key was rotated`}),revoked:G().optional().openapi({description:`True if the key is revoked`}),revoked_at:H().optional().openapi({description:`The date and time when the key was revoked`}),connection:H().optional().openapi({description:`The connection identifier associated with the key`}),type:X([`jwt_signing`,`saml_encryption`]).openapi({description:`The type of the signing key`})});var Ty=J({id:H().optional(),audience:H(),friendly_name:H(),picture_url:H().optional(),support_email:H().optional(),support_url:H().optional(),sender_email:H().email(),sender_name:H(),session_lifetime:W().optional(),idle_session_lifetime:W().optional(),ephemeral_session_lifetime:W().optional(),idle_ephemeral_session_lifetime:W().optional(),session_cookie:J({mode:X([`persistent`,`non-persistent`]).optional()}).optional(),allowed_logout_urls:q(H()).optional(),default_redirection_uri:H().optional(),default_client_id:H().optional(),enabled_locales:q(H()).optional(),default_directory:H().optional(),error_page:J({html:H().optional(),show_log_link:G().optional(),url:H().optional()}).nullish(),flags:J({allow_changing_enable_sso:G().optional(),allow_legacy_delegation_grant_types:G().optional(),allow_legacy_ro_grant_types:G().optional(),allow_legacy_tokeninfo_endpoint:G().optional(),change_pwd_flow_v1:G().optional(),custom_domains_provisioning:G().optional(),dashboard_insights_view:G().optional(),dashboard_log_streams_next:G().optional(),disable_clickjack_protection_headers:G().optional(),disable_fields_map_fix:G().optional(),disable_impersonation:G().optional(),disable_management_api_sms_obfuscation:G().optional(),enable_adfs_waad_email_verification:G().optional(),enable_apis_section:G().optional(),enable_client_connections:G().optional(),enable_custom_domain_in_emails:G().optional(),enable_dynamic_client_registration:G().optional(),dcr_require_initial_access_token:G().optional(),dcr_allowed_grant_types:q(H()).optional(),allow_http_return_to:q(H().refine(e=>{try{let t=new URL(e);return t.protocol===`http:`&&(t.pathname===``||t.pathname===`/`)&&!t.search&&!t.hash&&e===t.origin}catch{return!1}},{message:`must be a fully-qualified http origin (scheme + host + port, no path)`})).optional(),enable_idtoken_api2:G().optional(),enable_legacy_logs_search_v2:G().optional(),enable_legacy_profile:G().optional(),enable_pipeline2:G().optional(),enable_public_signup_user_exists_error:G().optional(),enable_sso:G().optional(),enforce_client_authentication_on_passwordless_start:G().optional(),genai_trial:G().optional(),improved_signup_bot_detection_in_classic:G().optional(),mfa_show_factor_list_on_enrollment:G().optional(),no_disclose_enterprise_connections:G().optional(),remove_alg_from_jwks:G().optional(),revoke_refresh_token_grant:G().optional(),trust_azure_adfs_email_verified_connection_property:G().optional(),use_scope_descriptions_for_consent:G().optional(),inherit_global_permissions_in_organizations:G().optional()}).optional(),sandbox_version:H().optional(),legacy_sandbox_version:H().optional(),sandbox_versions_available:q(H()).optional(),change_password:J({enabled:G().optional(),html:H().optional()}).optional(),guardian_mfa_page:J({enabled:G().optional(),html:H().optional()}).optional(),device_flow:J({charset:X([`base20`,`digits`]).optional(),mask:H().max(20).optional()}).optional(),default_token_quota:J({clients:J({client_credentials:Y(H(),K()).optional()}).optional(),organizations:J({client_credentials:Y(H(),K()).optional()}).optional()}).nullish(),default_audience:H().optional(),default_organization:H().optional(),sessions:J({oidc_logout_prompt_enabled:G().optional()}).optional(),oidc_logout:J({rp_logout_end_session_endpoint_discovery:G().optional()}).optional(),allow_organization_name_in_authentication_api:G().optional(),customize_mfa_in_postlogin_action:G().optional(),acr_values_supported:q(H()).optional(),mtls:J({enable_endpoint_aliases:G().optional()}).nullish(),pushed_authorization_requests_supported:G().optional(),authorization_response_iss_parameter_supported:G().optional(),attack_protection:Sy.optional(),mfa:J({policy:X([`never`,`always`]).default(`never`).optional(),factors:J({sms:G().default(!1),otp:G().default(!1),email:G().default(!1),push_notification:G().default(!1),webauthn_roaming:G().default(!1),webauthn_platform:G().default(!1),recovery_code:G().default(!1),duo:G().default(!1)}).optional(),sms_provider:J({provider:X([`twilio`,`vonage`,`aws_sns`,`phone_message_hook`]).optional()}).optional(),twilio:J({sid:H().optional(),auth_token:H().optional(),from:H().optional(),messaging_service_sid:H().optional()}).optional(),phone_message:J({message:H().optional()}).optional()}).optional()});J({created_at:H().nullable().transform(e=>e??``),updated_at:H().nullable().transform(e=>e??``)}).extend(Ty.shape).extend({id:H(),is_control_plane:G().optional()}),J({access_token:H(),id_token:H().optional(),scope:H().optional(),state:H().optional(),refresh_token:H().optional(),token_type:H(),expires_in:W()}),J({code:H(),state:H().optional()});var Ey=J({button_border_radius:W(),button_border_weight:W(),buttons_style:X([`pill`,`rounded`,`sharp`]),input_border_radius:W(),input_border_weight:W(),inputs_style:X([`pill`,`rounded`,`sharp`]),show_widget_shadow:G(),widget_border_weight:W(),widget_corner_radius:W()}),Dy=J({base_focus_color:H(),base_hover_color:H(),body_text:H(),captcha_widget_theme:X([`auto`,`dark`,`light`]),error:H(),header:H(),icons:H(),input_background:H(),input_border:H(),input_filled_text:H(),input_labels_placeholders:H(),links_focused_components:H(),primary_button:H(),primary_button_label:H(),secondary_button_border:H(),secondary_button_label:H(),success:H(),widget_background:H(),widget_border:H()}),Oy=J({bold:G(),size:W()}),ky=J({body_text:Oy,buttons_text:Oy,font_url:H(),input_labels:Oy,links:Oy,links_style:X([`normal`,`underlined`]),reference_text_size:W(),subtitle:Oy,title:Oy}),Ay=J({background_color:H(),background_image_url:H(),page_layout:X([`center`,`left`,`right`]),logo_placement:X([`widget`,`chip`,`none`]).optional()}),jy=J({header_text_alignment:X([`center`,`left`,`right`]),logo_height:W(),logo_position:X([`center`,`left`,`none`,`right`]),logo_url:H(),social_buttons_layout:X([`bottom`,`top`])});J({borders:Ey,colors:Dy,displayName:H(),fonts:ky,page_background:Ay,widget:jy}).extend({themeId:H()}),J({universal_login_experience:X([`new`,`classic`]).default(`new`),identifier_first:G().default(!0),password_first:G().default(!1),webauthn_platform_first_factor:G()}),J({name:H(),enabled:G().optional().default(!0),default_from_address:H().optional(),credentials:Y(H(),Th()),settings:J({}).optional()}),J({template:X([`verify_email`,`verify_email_by_code`,`reset_email`,`reset_email_by_code`,`welcome_email`,`blocked_account`,`stolen_credentials`,`enrollment_email`,`mfa_oob_code`,`change_password`,`password_reset`,`user_invitation`]),body:H(),from:H(),subject:H(),syntax:Z(`liquid`).default(`liquid`),resultUrl:H().optional(),urlLifetimeInSeconds:W().int().nonnegative().optional(),includeEmailInRedirect:G().default(!1),enabled:G().default(!0)}),J({id:H(),login_id:H(),user_id:H(),client_id:H(),expires_at:H().optional(),idle_expires_at:H().optional(),last_exchanged_at:H().optional(),device:Cy,resource_servers:q(J({audience:H(),scopes:H()})),rotating:G(),token_lookup:H().optional(),token_hash:H().optional(),family_id:H().optional(),rotated_to:H().optional(),rotated_at:H().optional()}).extend({created_at:H(),revoked_at:H().optional()}),J({to:H(),message:H()}),J({name:H(),options:J({})});var My=J({value:H(),description:H().optional()}),Ny=J({token_dialect:X([`access_token`,`access_token_authz`]).optional(),enforce_policies:G().optional(),allow_skipping_userinfo:G().optional(),skip_userinfo:G().optional(),persist_client_authorization:G().optional(),enable_introspection_endpoint:G().optional(),mtls:J({bound_access_tokens:G().optional()}).optional()});J({id:H().optional(),name:H(),identifier:H(),scopes:q(My).optional(),signing_alg:H().optional(),signing_secret:H().optional(),token_lifetime:W().default(86400),token_lifetime_for_web:W().default(7200),skip_consent_for_verifiable_first_party_clients:G().optional(),allow_offline_access:G().optional(),verificationKey:H().optional(),options:Ny.optional(),is_system:G().optional(),metadata:Y(H(),K()).optional()}).extend({created_at:H().optional(),updated_at:H().optional()}),J({role_id:H(),resource_server_identifier:H(),permission_name:H()}).extend({created_at:H()}),J({user_id:H(),resource_server_identifier:H(),permission_name:H(),organization_id:H().optional()}).extend({tenant_id:H(),created_at:H().optional()}),J({user_id:H(),resource_server_identifier:H(),resource_server_name:H(),permission_name:H(),description:H().nullable().optional(),created_at:H().optional(),organization_id:H().optional()}),J({user_id:H(),role_id:H(),organization_id:H().optional()}).extend({tenant_id:H(),created_at:H().optional()}),J({id:H().optional().openapi({description:`The unique identifier of the role. If not provided, one will be generated.`}),name:H().min(1).max(50).openapi({description:`The name of the role. Cannot include '<' or '>'`}),description:H().max(255).optional().openapi({description:`The description of the role`}),is_system:G().optional(),metadata:Y(H(),K()).optional().openapi({description:`Metadata associated with the role. Can be used to control sync behavior in multi-tenancy scenarios.`})}).extend({id:H().openapi({description:`The unique identifier of the role`}),created_at:H().optional(),updated_at:H().optional()});var Py=J({logo_url:H().optional().openapi({description:`URL of the organization's logo`}),colors:J({primary:H().optional().openapi({description:`Primary color in hex format (e.g., #FF0000)`}),page_background:H().optional().openapi({description:`Page background color in hex format (e.g., #FFFFFF)`})}).optional()}).optional(),Fy=J({connection_id:H().openapi({description:`ID of the connection`}),assign_membership_on_login:G().default(!1).openapi({description:`Whether to assign membership to the organization on login`}),show_as_button:G().default(!0).openapi({description:`Whether to show this connection as a button in the login screen`}),is_signup_enabled:G().default(!0).openapi({description:`Whether signup is enabled for this connection`})}),Iy=J({client_credentials:J({enforce:G().default(!1).openapi({description:`Whether to enforce token quota limits`}),per_day:W().min(0).default(0).openapi({description:`Maximum tokens per day (0 = unlimited)`}),per_hour:W().min(0).default(0).openapi({description:`Maximum tokens per hour (0 = unlimited)`})}).optional()}).optional();J({id:H().optional(),name:H().min(1).regex(/^[a-z0-9_-]+$/,{message:`Organization name must be lowercase and can only contain letters, numbers, hyphens, and underscores`}).openapi({description:`The name of the organization. Must be lowercase and can only contain letters, numbers, hyphens, and underscores.`}),display_name:H().optional().openapi({description:`The display name of the organization`}),branding:Py,metadata:Y(H(),K()).default({}).optional().openapi({description:`Custom metadata for the organization`}),enabled_connections:q(Fy).default([]).optional().openapi({description:`List of enabled connections for the organization`}),token_quota:Iy}).extend(g_.shape).extend({id:H(),name:H().min(1).openapi({description:`The name of the organization`})}),J({connection_id:H().openapi({description:`ID of the tenant-level connection to enable for the org.`}),assign_membership_on_login:G().optional().default(!1),show_as_button:G().optional().default(!0),is_signup_enabled:G().optional().default(!0)}).extend({connection:J({name:H().optional(),strategy:H().optional()}).optional(),created_at:H().optional(),updated_at:H().optional()}),J({user_id:H().openapi({description:`ID of the user`}),organization_id:H().openapi({description:`ID of the organization`})}).extend(g_.shape).extend({id:H()}),J({idle_session_lifetime:W().default(72),session_lifetime:W().default(168),session_cookie:J({mode:X([`persistent`,`non-persistent`]).optional()}).optional(),enable_client_connections:G().optional(),default_redirection_uri:H().optional(),enabled_locales:q(H()).optional(),default_directory:H().optional(),error_page:J({html:H().optional(),show_log_link:G().optional(),url:H().optional()}).optional(),flags:J({allow_legacy_delegation_grant_types:G().optional(),allow_legacy_ro_grant_types:G().optional(),allow_legacy_tokeninfo_endpoint:G().optional(),disable_clickjack_protection_headers:G().optional(),enable_apis_section:G().optional(),enable_client_connections:G().optional(),enable_custom_domain_in_emails:G().optional(),enable_dynamic_client_registration:G().optional(),enable_idtoken_api2:G().optional(),enable_legacy_logs_search_v2:G().optional(),enable_legacy_profile:G().optional(),enable_pipeline2:G().optional(),enable_public_signup_user_exists_error:G().optional(),use_scope_descriptions_for_consent:G().optional(),disable_management_api_sms_obfuscation:G().optional(),enable_adfs_waad_email_verification:G().optional(),revoke_refresh_token_grant:G().optional(),dashboard_log_streams_next:G().optional(),dashboard_insights_view:G().optional(),disable_fields_map_fix:G().optional(),mfa_show_factor_list_on_enrollment:G().optional()}).optional(),friendly_name:H().optional(),picture_url:H().optional(),support_email:H().optional(),support_url:H().optional(),sandbox_version:H().optional(),sandbox_versions_available:q(H()).optional(),change_password:J({enabled:G(),html:H()}).optional(),guardian_mfa_page:J({enabled:G(),html:H()}).optional(),default_audience:H().optional(),default_organization:H().optional(),sessions:J({oidc_logout_prompt_enabled:G().optional()}).optional(),mfa:J({policy:X([`never`,`always`]).default(`never`).optional(),factors:J({sms:G().default(!1),otp:G().default(!1),email:G().default(!1),push_notification:G().default(!1),webauthn_roaming:G().default(!1),webauthn_platform:G().default(!1),recovery_code:G().default(!1),duo:G().default(!1)}).optional(),sms_provider:J({provider:X([`twilio`,`vonage`,`aws_sns`,`phone_message_hook`]).optional()}).optional(),twilio:J({sid:H().optional(),auth_token:H().optional(),from:H().optional(),messaging_service_sid:H().optional()}).optional(),phone_message:J({message:H().optional()}).optional()}).optional()}),J({date:H().openapi({description:`Date these events occurred in ISO 8601 format`,example:`2025-12-19`}),logins:W().openapi({description:`Number of logins on this date`,example:150}),signups:W().openapi({description:`Number of signups on this date`,example:25}),leaked_passwords:W().openapi({description:`Number of breached-password detections on this date (subscription required)`,example:0}),updated_at:H().openapi({description:`Date and time this stats entry was last updated in ISO 8601 format`,example:`2025-12-19T10:30:00.000Z`}),created_at:H().openapi({description:`Approximate date and time the first event occurred in ISO 8601 format`,example:`2025-12-19T00:00:00.000Z`})}),W().openapi({description:`Number of active users in the last 30 days`,example:1234}),X([`active-users`,`logins`,`signups`,`refresh-tokens`,`sessions`]),X([`hour`,`day`,`week`,`month`]),X([`time`,`connection`,`client_id`,`user_type`,`event`]),X([`password`,`social`,`passwordless`,`enterprise`]);var Ly=J({name:H(),type:H()}),Ry=J({elapsed:W(),rows_read:W().optional(),bytes_read:W().optional()});J({meta:q(Ly),data:q(Y(H(),K())),rows:W(),rows_before_limit_at_least:W().optional(),statistics:Ry.optional()});var zy=X(`login.login-id.login-password.signup.signup-id.signup-password.reset-password.consent.mfa.mfa-push.mfa-otp.mfa-voice.mfa-phone.mfa-webauthn.mfa-email.mfa-recovery-code.status.device-flow.email-verification.email-otp-challenge.organizations.invitation.common.passkeys.captcha.custom-form.login-passwordless.mfa-login-options`.split(`.`)),By=Y(H(),Y(H(),H())).openapi({type:`object`,additionalProperties:{type:`object`,additionalProperties:{type:`string`}}});J({prompt:zy,language:H(),custom_text:By});var Vy=X([`phone`,`totp`,`email`,`push`,`webauthn-roaming`,`webauthn-platform`,`passkey`]),Hy=J({user_id:H(),type:Vy,phone_number:H().optional(),totp_secret:H().optional(),credential_id:H().optional(),public_key:H().optional(),sign_count:W().int().nonnegative().optional(),credential_backed_up:G().optional(),transports:q(H()).optional(),friendly_name:H().optional(),confirmed:G().default(!1)});function Uy(e,t){e.type===`phone`&&!e.phone_number&&t.addIssue({code:$g.custom,message:`phone_number is required when type is 'phone'`,path:[`phone_number`]}),e.type===`totp`&&!e.totp_secret&&t.addIssue({code:$g.custom,message:`totp_secret is required when type is 'totp'`,path:[`totp_secret`]}),[`webauthn-roaming`,`webauthn-platform`,`passkey`].includes(e.type)&&(e.credential_id||t.addIssue({code:$g.custom,message:`credential_id is required when type is '${e.type}'`,path:[`credential_id`]}),e.public_key||t.addIssue({code:$g.custom,message:`public_key is required when type is '${e.type}'`,path:[`public_key`]}))}Hy.superRefine(Uy),Hy.extend({id:H(),created_at:H(),updated_at:H()}).superRefine(Uy);function Wy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gy(e){if(!e)return;let t=JSON.parse(e);return Wy(t)?t:void 0}function Ky(e){return e==null?void 0:new Date(e).toISOString()}function qy(e){if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t.getTime()}function Jy(e){let t=q_.parse(e.type);return{id:e.id,token_hash:e.token_hash,type:t,client_id:e.client_id??void 0,sub:e.sub??void 0,constraints:Gy(e.constraints),single_use:!!e.single_use,expires_at:Ky(e.expires_at_ts),used_at:Ky(e.used_at_ts),revoked_at:Ky(e.revoked_at_ts),created_at:new Date(e.created_at_ts).toISOString()}}function Yy(e){return{async create(t,n){let r=Date.now();return await e.insert(T).values({id:n.id,tenant_id:t,token_hash:n.token_hash,type:n.type,client_id:n.client_id??null,sub:n.sub??null,constraints:n.constraints?JSON.stringify(n.constraints):null,single_use:+!!n.single_use,expires_at_ts:qy(n.expires_at),created_at_ts:r}),{id:n.id,token_hash:n.token_hash,type:n.type,client_id:n.client_id,sub:n.sub,constraints:n.constraints,single_use:n.single_use,expires_at:n.expires_at,created_at:new Date(r).toISOString()}},async get(t,n){let r=await e.select().from(T).where(h(m(T.tenant_id,t),m(T.id,n))).get();return r?Jy(r):null},async getByHash(t,n){let r=await e.select().from(T).where(h(m(T.tenant_id,t),m(T.token_hash,n))).get();return r?Jy(r):null},async listByClient(t,n){return(await e.select().from(T).where(h(m(T.tenant_id,t),m(T.client_id,n))).orderBy(Be(T.created_at_ts))).map(Jy)},async markUsed(t,n,r){return(await e.update(T).set({used_at_ts:qy(r)}).where(h(m(T.tenant_id,t),m(T.id,n),Ie(T.used_at_ts))).returning()).length>0},async revoke(t,n,r){return(await e.update(T).set({revoked_at_ts:qy(r)}).where(h(m(T.tenant_id,t),m(T.id,n),Ie(T.revoked_at_ts))).returning()).length>0},async revokeByClient(t,n,r){return(await e.update(T).set({revoked_at_ts:qy(r)}).where(h(m(T.tenant_id,t),m(T.client_id,n),Ie(T.revoked_at_ts))).returning()).length},async remove(t,n){return(await e.delete(T).where(h(m(T.tenant_id,t),m(T.id,n))).returning()).length>0}}}function Xy(e){let{tenant_id:t,...n}=e;return A(n)}function Zy(e){return{async create(t,n){let r={...n,tenant_id:t,created_at:n.created_at||new Date().toISOString(),expires_at:n.expires_at};return await e.insert(Vt).values(r),Xy(r)},async get(t,n,r){if(!t)throw Error(`tenant_id is required`);let i=await e.select().from(Vt).where(h(m(Vt.tenant_id,t),m(Vt.code_id,n),m(Vt.code_type,r))).get();return i?Xy(i):null},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o}=n||{},s=e.select().from(Vt).where(m(Vt.tenant_id,t)).$dynamic();if(o?.sort_by){let e=Vt[o.sort_by];e&&(s=s.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let c=(await s.offset(r*i).limit(i)).map(Xy);if(!a)return{codes:c};let[l]=await e.select({count:Ve()}).from(Vt).where(m(Vt.tenant_id,t));return{codes:c,start:r*i,limit:i,length:Number(l?.count??0)}},async used(t,n){return(await e.update(Vt).set({used_at:new Date().toISOString()}).where(h(m(Vt.tenant_id,t),m(Vt.code_id,n))).returning()).length>0},async consume(t,n){return(await e.update(Vt).set({used_at:new Date().toISOString()}).where(h(m(Vt.tenant_id,t),m(Vt.code_id,n),Ie(Vt.used_at))).returning()).length>0},async remove(t,n){return(await e.delete(Vt).where(h(m(Vt.tenant_id,t),m(Vt.code_id,n))).returning()).length>0}}}function Qy(){let{customAlphabet:e}=(Vn(),s(In));return`con_${e(`0123456789abcdefghijklmnopqrstuvwxyz`,17)()}`}function $y(e){let{tenant_id:t,is_system:n,options:r,metadata:i,...a}=e;return A({...a,options:j(r,{}),metadata:j(i),is_system:n?!0:void 0})}function eb(e){return{async create(t,n){let r=new Date().toISOString(),i={id:n.id||Qy(),...n,tenant_id:t,options:JSON.stringify(n.options||{}),metadata:n.metadata?JSON.stringify(n.metadata):void 0,is_system:+!!n.is_system,created_at:r,updated_at:r};try{await e.insert(Kt).values(i)}catch(e){throw e?.message?.includes(`UNIQUE constraint failed`)||e?.message?.includes(`duplicate key`)?new wn(409,{message:`Connection already exists`}):e}return $y(i)},async get(t,n){let r=await e.select().from(Kt).where(h(m(Kt.tenant_id,t),m(Kt.id,n))).get();return r?$y(r):null},async update(t,n,r){let i={updated_at:new Date().toISOString()};return r.name!==void 0&&(i.name=r.name),r.strategy!==void 0&&(i.strategy=r.strategy),r.options!==void 0&&(i.options=JSON.stringify(r.options)),r.metadata!==void 0&&(i.metadata=JSON.stringify(r.metadata)),r.display_name!==void 0&&(i.display_name=r.display_name),r.response_type!==void 0&&(i.response_type=r.response_type),r.response_mode!==void 0&&(i.response_mode=r.response_mode),await e.update(Kt).set(i).where(h(m(Kt.tenant_id,t),m(Kt.id,n))),!0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=m(Kt.tenant_id,t);if(s){let e=Tn(Kt,s,[`name`]);e&&(c=h(c,e))}let l=e.select().from(Kt).where(c).$dynamic();if(o?.sort_by){let e=Kt[o.sort_by];e&&(l=l.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let u=(await l.offset(r*i).limit(i)).map($y);if(!a)return{connections:u};let[d]=await e.select({count:Ve()}).from(Kt).where(c);return{connections:u,start:r*i,limit:i,length:Number(d?.count??0)}},async remove(t,n){return(await e.delete(Kt).where(h(m(Kt.tenant_id,t),m(Kt.id,n))).returning()).length>0}}}Vn();function tb(e){let{tenant_id:t,domain_metadata:n,...r}=e;return A({...r,primary:!!r.primary,domain_metadata:j(n)})}function nb(e){return{async create(t,n){let r=new Date().toISOString(),i={custom_domain_id:n.custom_domain_id||Bn(),tenant_id:t,domain:n.domain,primary:n.primary??!1,status:n.status||`pending`,type:n.type,origin_domain_name:n.origin_domain_name,verification:n.verification,custom_client_ip_header:n.custom_client_ip_header,tls_policy:n.tls_policy,domain_metadata:n.domain_metadata?JSON.stringify(n.domain_metadata):void 0,created_at:r,updated_at:r};return await e.insert(qt).values(i),tb({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(qt).where(h(m(qt.tenant_id,t),m(qt.custom_domain_id,n))).get();return r?tb(r):null},async getByDomain(t){let n=await e.select().from(qt).where(m(qt.domain,t)).get();return n?{...tb(n),tenant_id:n.tenant_id}:null},async list(t){return(await e.select().from(qt).where(m(qt.tenant_id,t)).all()).map(tb)},async update(t,n,r){let i={updated_at:new Date().toISOString()};return r.domain!==void 0&&(i.domain=r.domain),r.primary!==void 0&&(i.primary=r.primary),r.status!==void 0&&(i.status=r.status),r.type!==void 0&&(i.type=r.type),r.origin_domain_name!==void 0&&(i.origin_domain_name=r.origin_domain_name),r.verification!==void 0&&(i.verification=r.verification),r.custom_client_ip_header!==void 0&&(i.custom_client_ip_header=r.custom_client_ip_header),r.tls_policy!==void 0&&(i.tls_policy=r.tls_policy),r.domain_metadata!==void 0&&(i.domain_metadata=JSON.stringify(r.domain_metadata)),(await e.update(qt).set(i).where(h(m(qt.tenant_id,t),m(qt.custom_domain_id,n))).returning()).length>0},async remove(t,n){return(await e.delete(qt).where(h(m(qt.tenant_id,t),m(qt.custom_domain_id,n))).returning()).length>0}}}function rb(e){return{async get(t,n,r){let i=await e.select().from(pn).where(h(m(pn.tenant_id,t),m(pn.prompt,n),m(pn.language,r))).get();if(!i)return null;try{return JSON.parse(i.custom_text)}catch{return null}},async set(t,n,r,i){let a=Date.now(),o=JSON.stringify(i);await e.insert(pn).values({tenant_id:t,prompt:n,language:r,custom_text:o,created_at_ts:a,updated_at_ts:a}).onConflictDoUpdate({target:[pn.tenant_id,pn.prompt,pn.language],set:{custom_text:o,updated_at_ts:a}})},async delete(t,n,r){await e.delete(pn).where(h(m(pn.tenant_id,t),m(pn.prompt,n),m(pn.language,r)))},async list(t){return await e.select({prompt:pn.prompt,language:pn.language}).from(pn).where(m(pn.tenant_id,t)).all()}}}function ib(e){return{async create(t,n){let r=new Date().toISOString();await e.insert(cn).values({tenant_id:t,name:n.name,enabled:n.enabled,default_from_address:n.default_from_address,credentials:JSON.stringify(n.credentials||{}),settings:JSON.stringify(n.settings||{}),created_at:r,updated_at:r})},async get(t){let n=await e.select().from(cn).where(m(cn.tenant_id,t)).get();if(!n)return null;let{tenant_id:r,...i}=n;return A({...i,enabled:!!i.enabled,credentials:j(i.credentials,{}),settings:j(i.settings,{})})},async update(t,n){let r={updated_at:new Date().toISOString()};n.name!==void 0&&(r.name=n.name),n.enabled!==void 0&&(r.enabled=n.enabled),n.default_from_address!==void 0&&(r.default_from_address=n.default_from_address),n.credentials!==void 0&&(r.credentials=JSON.stringify(n.credentials)),n.settings!==void 0&&(r.settings=JSON.stringify(n.settings)),await e.update(cn).set(r).where(m(cn.tenant_id,t))},async remove(t){await e.delete(cn).where(m(cn.tenant_id,t))}}}function ab(e){return A({template:e.template,body:e.body,from:e.from,subject:e.subject,syntax:`liquid`,includeEmailInRedirect:!!e.include_email_in_redirect,enabled:!!e.enabled,resultUrl:e.result_url??void 0,urlLifetimeInSeconds:e.url_lifetime_in_seconds??void 0})}function ob(e){return{async get(t,n){let r=await e.select().from(ln).where(h(m(ln.tenant_id,t),m(ln.template,n))).get();return r?ab(r):null},async list(t){return(await e.select().from(ln).where(m(ln.tenant_id,t)).all()).map(ab)},async create(t,n){let r=new Date().toISOString();return await e.insert(ln).values({tenant_id:t,template:n.template,body:n.body,from:n.from,subject:n.subject,syntax:n.syntax,result_url:n.resultUrl??null,url_lifetime_in_seconds:n.urlLifetimeInSeconds??null,include_email_in_redirect:n.includeEmailInRedirect,enabled:n.enabled,created_at:r,updated_at:r}),n},async update(t,n,r){let i={updated_at:new Date().toISOString()};r.body!==void 0&&(i.body=r.body),r.from!==void 0&&(i.from=r.from),r.subject!==void 0&&(i.subject=r.subject),r.syntax!==void 0&&(i.syntax=r.syntax),r.resultUrl!==void 0&&(i.result_url=r.resultUrl),r.urlLifetimeInSeconds!==void 0&&(i.url_lifetime_in_seconds=r.urlLifetimeInSeconds),r.includeEmailInRedirect!==void 0&&(i.include_email_in_redirect=r.includeEmailInRedirect),r.enabled!==void 0&&(i.enabled=r.enabled);let a=await e.update(ln).set(i).where(h(m(ln.tenant_id,t),m(ln.template,n))).run();return Number(a.changes??0)>0},async remove(t,n){let r=await e.delete(ln).where(h(m(ln.tenant_id,t),m(ln.template,n))).run();return Number(r.changes??0)>0}}}Vn();function sb(e){return{async create(t,n){let r=new Date().toISOString(),i=`af_${Bn()}`;return await e.insert(on).values({id:i,tenant_id:t,name:n.name,actions:JSON.stringify(n.actions||[]),created_at:r,updated_at:r}),{id:i,name:n.name,actions:n.actions||[],created_at:r,updated_at:r}},async get(t,n){let r=await e.select().from(on).where(h(m(on.tenant_id,t),m(on.id,n))).get();if(!r)return null;let{tenant_id:i,actions:a,...o}=r;return A({...o,actions:j(a,[])})},async update(t,n,r){let i={updated_at:new Date().toISOString()};return r.name!==void 0&&(i.name=r.name),r.actions!==void 0&&(i.actions=JSON.stringify(r.actions)),(await e.update(on).set(i).where(h(m(on.tenant_id,t),m(on.id,n))).returning()).length===0?null:this.get(t,n)},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o}=n||{},s=e.select().from(on).where(m(on.tenant_id,t)).$dynamic();if(o?.sort_by){let e=on[o.sort_by];e&&(s=s.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let c=(await s.offset(r*i).limit(i)).map(e=>{let{tenant_id:t,actions:n,...r}=e;return A({...r,actions:j(n,[])})});if(!a)return{flows:c};let[l]=await e.select({count:Ve()}).from(on).where(m(on.tenant_id,t));return{flows:c,start:r*i,limit:i,length:Number(l?.count??0)}},async remove(t,n){return(await e.delete(on).where(h(m(on.tenant_id,t),m(on.id,n))).returning()).length>0}}}Vn();var cb=[`nodes`,`start`,`ending`];function lb(e){return{async create(t,n){let r=new Date().toISOString(),i=Bn(),a={id:i,tenant_id:t,name:n.name,messages:n.messages,languages:n.languages,translations:n.translations,style:n.style,created_at:r,updated_at:r};for(let e of cb)a[e]=JSON.stringify(n[e]||(e===`nodes`?[]:{}));return await e.insert(an).values(a),{id:i,...n,created_at:r,updated_at:r}},async get(t,n){let r=await e.select().from(an).where(h(m(an.tenant_id,t),m(an.id,n))).get();if(!r)return null;let{tenant_id:i,...a}=r,o={...a};for(let e of cb)o[e]=j(a[e]);return A(o)},async update(t,n,r){let i={updated_at:new Date().toISOString()};for(let[e,t]of Object.entries(r))t!==void 0&&(cb.includes(e)?i[e]=JSON.stringify(t):i[e]=t);return(await e.update(an).set(i).where(h(m(an.tenant_id,t),m(an.id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o}=n||{},s=e.select().from(an).where(m(an.tenant_id,t)).$dynamic();if(o?.sort_by){let e=an[o.sort_by];e&&(s=s.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let c=(await s.offset(r*i).limit(i)).map(e=>{let{tenant_id:t,...n}=e,r={...n};for(let e of cb)r[e]=j(n[e]);return A(r)});if(!a)return{forms:c};let[l]=await e.select({count:Ve()}).from(an).where(m(an.tenant_id,t));return{forms:c,start:r*i,limit:i,length:Number(l?.count??0)}},async remove(t,n){return(await e.delete(an).where(h(m(an.tenant_id,t),m(an.id,n))).returning()).length>0}}}function ub(e){if(e!=null){if(typeof e==`number`)return new Date(e).toISOString();if(typeof e==`string`){if(e===``)return;let t=parseFloat(e);return!isNaN(t)&&/^\d+(\.\d+)?$/.test(e)?new Date(t).toISOString():e}}}function db(e,t=new Date(0).toISOString()){return ub(e)??t}function fb(e){if(!e||e===``)return null;let t=new Date(e);return isNaN(t.getTime())?null:t.getTime()}function pb(e,t,n=[]){let r={};for(let n of t){let t=n.replace(/_ts$/,``);r[t]=db(e[n])}for(let t of n){let n=t.replace(/_ts$/,``);r[n]=ub(e[t])}return r}Vn();var mb=zn(`0123456789abcdefghijklmnopqrstuvwxyz`,17);function hb(){return`hc_${mb()}`}function gb(e){let{created_at_ts:t,updated_at_ts:n,secrets:r,...i}=e,a=pb({created_at_ts:t,updated_at_ts:n},[`created_at_ts`,`updated_at_ts`]);return{...i,...a,secrets:r?JSON.parse(r):void 0}}function _b(e){return{async create(t,n){let r=Date.now(),i={id:hb(),tenant_id:t,code:n.code,secrets:n.secrets?JSON.stringify(n.secrets):null,created_at_ts:r,updated_at_ts:r};return await e.insert(dn).values(i),gb({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(dn).where(h(m(dn.tenant_id,t),m(dn.id,n))).get();return r?gb(r):null},async update(t,n,r){let i={updated_at_ts:Date.now()};return r.code!==void 0&&(i.code=r.code),r.secrets!==void 0&&(i.secrets=JSON.stringify(r.secrets)),(await e.update(dn).set(i).where(h(m(dn.tenant_id,t),m(dn.id,n))).returning()).length>0},async remove(t,n){return(await e.delete(dn).where(h(m(dn.tenant_id,t),m(dn.id,n))).returning()).length>0}}}function vb(){let{customAlphabet:e}=(Vn(),s(In));return`h_${e(`0123456789abcdefghijklmnopqrstuvwxyz`,17)()}`}function yb(e){if(!(typeof e!=`string`||!e))try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}catch{return}}function bb(e){let{tenant_id:t,created_at_ts:n,updated_at_ts:r,metadata:i,...a}=e,o=pb({created_at_ts:n,updated_at_ts:r},[`created_at_ts`,`updated_at_ts`]);return A({...a,enabled:!!a.enabled,synchronous:!!a.synchronous,metadata:yb(i),...o})}function xb(e){return{async create(t,n){let r=Date.now(),i={hook_id:n.hook_id||vb(),tenant_id:t,trigger_id:n.trigger_id,url:n.url,enabled:n.enabled??!0,synchronous:n.synchronous??!1,priority:n.priority,form_id:n.form_id,template_id:n.template_id,code_id:n.code_id,metadata:n.metadata?JSON.stringify(n.metadata):null,created_at_ts:r,updated_at_ts:r};return await e.insert(un).values(i),bb({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(un).where(h(m(un.tenant_id,t),m(un.hook_id,n))).get();return r?bb(r):null},async update(t,n,r){let i={updated_at_ts:Date.now()};return r.trigger_id!==void 0&&(i.trigger_id=r.trigger_id),r.url!==void 0&&(i.url=r.url),r.enabled!==void 0&&(i.enabled=r.enabled),r.synchronous!==void 0&&(i.synchronous=r.synchronous),r.priority!==void 0&&(i.priority=r.priority),r.form_id!==void 0&&(i.form_id=r.form_id),r.template_id!==void 0&&(i.template_id=r.template_id),r.code_id!==void 0&&(i.code_id=r.code_id),r.metadata!==void 0&&(i.metadata=r.metadata===null?null:JSON.stringify(r.metadata)),(await e.update(un).set(i).where(h(m(un.tenant_id,t),m(un.hook_id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=s?Tn(un,s,[`url`,`form_id`,`template_id`,`code_id`]):void 0,l=c?h(m(un.tenant_id,t),c):m(un.tenant_id,t),u=e.select().from(un).where(l).$dynamic(),d=o?.sort_by?un[o.sort_by]:void 0;u=d?u.orderBy(o?.sort_order===`desc`?Be(d):ze(d)):u.orderBy(Be(un.priority),ze(un.created_at_ts));let f=(await u.offset(r*i).limit(i)).map(bb);if(!a)return{hooks:f};let[ee]=await e.select({count:Ve()}).from(un).where(l);return{hooks:f,start:r*i,limit:i,length:Number(ee?.count??0)}},async remove(t,n){return(await e.delete(un).where(h(m(un.tenant_id,t),m(un.hook_id,n))).returning()).length>0}}}function Sb(){let{customAlphabet:e}=(Vn(),s(In));return`inv_${e(`0123456789abcdefghijklmnopqrstuvwxyz`,17)()}`}var Cb=[`inviter`,`invitee`,`app_metadata`,`user_metadata`,`roles`];function wb(e){let{tenant_id:t,send_invitation_email:n,...r}=e,i={...r};for(let e of Cb)i[e]=j(r[e],e===`roles`?[]:{});return i.send_invitation_email=!!n,A(i)}function Tb(e){return{async create(t,n){let r=n.id||Sb(),i=n.ttl_sec||604800,a=new Date,o=new Date(a.getTime()+i*1e3).toISOString(),s={id:r,tenant_id:t,organization_id:n.organization_id,client_id:n.client_id,connection_id:n.connection_id,invitation_url:n.invitation_url,ticket_id:n.ticket_id,ttl_sec:i,send_invitation_email:n.send_invitation_email===!1?0:1,created_at:a.toISOString(),expires_at:o};for(let e of Cb)n[e]!==void 0&&(s[e]=JSON.stringify(n[e]));try{await e.insert(Xt).values(s)}catch(e){throw e?.message?.includes(`UNIQUE constraint failed`)||e?.message?.includes(`duplicate key`)?new wn(409,{message:`Invite already exists`}):e}return wb({...s,tenant_id:t})},async get(t,n){let r=await e.select().from(Xt).where(h(m(Xt.tenant_id,t),m(Xt.id,n))).get();return r?wb(r):null},async update(t,n,r){let i={};for(let e of Cb)r[e]!==void 0&&(i[e]=JSON.stringify(r[e]));return r.connection_id!==void 0&&(i.connection_id=r.connection_id),r.ttl_sec!==void 0&&(i.ttl_sec=r.ttl_sec,i.expires_at=new Date(Date.now()+r.ttl_sec*1e3).toISOString()),(await e.update(Xt).set(i).where(h(m(Xt.tenant_id,t),m(Xt.id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o}=n||{},s=e.select().from(Xt).where(m(Xt.tenant_id,t)).$dynamic();if(o?.sort_by){let e=Xt[o.sort_by];e&&(s=s.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let c=(await s.offset(r*i).limit(i)).map(wb);if(!a)return{invites:c};let[l]=await e.select({count:Ve()}).from(Xt).where(m(Xt.tenant_id,t));return{invites:c,start:r*i,limit:i,length:Number(l?.count??0)}},async remove(t,n){return(await e.delete(Xt).where(h(m(Xt.tenant_id,t),m(Xt.id,n))).returning()).length>0}}}function Eb(e){return{async create(t){await e.insert(fn).values({...t,created_at:new Date().toDateString()})},async list(t){let{page:n=0,per_page:r=50,include_totals:i=!1,sort:a}=t||{},o=new Date().toISOString(),s=e.select().from(fn).where(Ae(je(fn.revoked_at,o),Ie(fn.revoked_at))).$dynamic();if(a?.sort_by){let e=fn[a.sort_by];e&&(s=s.orderBy(a.sort_order===`desc`?Be(e):ze(e)))}let c=(await s.offset(n*r).limit(r)).map(e=>{let{created_at:t,...n}=e;return A(n)});if(!i)return{signingKeys:c};let[l]=await e.select({count:Ve()}).from(fn).where(Ae(je(fn.revoked_at,o),Ie(fn.revoked_at)));return{signingKeys:c,start:n*r,limit:r,length:xn(l?.count??0)}},async update(t,n){return(await e.update(fn).set(n).where(m(fn.kid,t)).returning()).length>0}}}var Db=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,Ob=32;function kb(){let e=Date.now(),t=``;for(let n=10;n>0;n--)t=Db.charAt(e%Ob)+t,e=Math.floor(e/Ob);let n=new Uint8Array(16);crypto.getRandomValues(n);for(let e=0;e<16;e++)t+=Db.charAt(n[e]%Ob);return t}function Ab(e){let{tenant_id:t,created_at_ts:n,updated_at_ts:r,expires_at_ts:i,state_data:a,auth_params:o,...s}=e,c=pb({created_at_ts:n,updated_at_ts:r,expires_at_ts:i},[`created_at_ts`,`updated_at_ts`,`expires_at_ts`]),l={};for(let[e,t]of Object.entries(s))t!=null&&(l[e]=t);return A({...bn(l,[`auth_strategy`]),authParams:typeof o==`string`&&o.length>0?JSON.parse(o):{},...c,state_data:j(a)})}function jb(e){return{async create(t,n){let r=Date.now(),i={id:kb(),tenant_id:t,session_id:n.session_id,csrf_token:n.csrf_token,auth_params:JSON.stringify(n.authParams||{}),authorization_url:n.authorization_url?n.authorization_url.substring(0,1024):void 0,ip:n.ip,useragent:n.useragent,auth0Client:n.auth0Client,state:n.state||`pending`,state_data:n.state_data?JSON.stringify(n.state_data):void 0,failure_reason:n.failure_reason,user_id:n.user_id,auth_connection:n.auth_connection,auth_strategy_strategy:n.auth_strategy?.strategy,auth_strategy_strategy_type:n.auth_strategy?.strategy_type,authenticated_at:n.authenticated_at,created_at_ts:r,updated_at_ts:r,expires_at_ts:n.expires_at?fb(n.expires_at):r+1e3*60*60*24};return await e.insert(C).values(i),Ab({...i,tenant_id:t})},async get(t,n){let r=t?h(m(C.tenant_id,t),m(C.id,n)):m(C.id,n),i=await e.select().from(C).where(r).get();return i?Ab(i):null},async update(t,n,r){let i={updated_at_ts:Date.now()};if(r.session_id!==void 0&&(i.session_id=r.session_id),r.state!==void 0&&(i.state=r.state),r.state_data!==void 0&&(i.state_data=JSON.stringify(r.state_data)),r.failure_reason!==void 0&&(i.failure_reason=r.failure_reason),r.user_id!==void 0&&(i.user_id=r.user_id),r.auth_connection!==void 0&&(i.auth_connection=r.auth_connection),r.auth_strategy!==void 0&&(i.auth_strategy_strategy=r.auth_strategy?.strategy,i.auth_strategy_strategy_type=r.auth_strategy?.strategy_type),r.authenticated_at!==void 0&&(i.authenticated_at=r.authenticated_at),r.authorization_url!==void 0&&(i.authorization_url=r.authorization_url?.substring(0,1024)),r.expires_at!==void 0&&(i.expires_at_ts=fb(r.expires_at)),r.authParams!==void 0){let a=await e.select({auth_params:C.auth_params}).from(C).where(h(m(C.tenant_id,t),m(C.id,n))).get(),o=a?.auth_params&&typeof a.auth_params==`string`&&a.auth_params.length>0?JSON.parse(a.auth_params):{};i.auth_params=JSON.stringify({...o,...r.authParams})}return await e.update(C).set(i).where(h(m(C.tenant_id,t),m(C.id,n))),!0},async remove(t,n){return(await e.delete(C).where(h(m(C.tenant_id,t),m(C.id,n))).returning()).length>0}}}Vn();function Mb(e){let{tenant_id:t,isMobile:n,auth0_client:r,details:i,country_code:a,city_name:o,latitude:s,longitude:c,time_zone:l,continent_code:u,scope:d,...f}=e,ee={...f,isMobile:!!n,auth0_client:j(r),details:j(i),scope:d?d.split(`,`):void 0};return a&&(ee.location_info=A({country_code:a,city_name:o,latitude:s,longitude:c,time_zone:l,continent_code:u})),A(ee)}function Nb(e){return{async create(t,n){let r={log_id:n.log_id||Bn(),tenant_id:t,type:n.type,date:n.date||new Date().toISOString(),category:n.category,user_id:n.user_id,ip:n.ip,client_id:n.client_id,client_name:n.client_name,user_agent:n.user_agent?.substring(0,256),description:n.description?.substring(0,256),isMobile:+!!n.isMobile,user_name:n.user_name,connection:n.connection,connection_id:n.connection_id,audience:n.audience,scope:Array.isArray(n.scope)?n.scope.join(`,`):n.scope,strategy:n.strategy,strategy_type:n.strategy_type,hostname:n.hostname,session_connection:n.session_connection};return n.auth0_client&&(r.auth0_client=JSON.stringify(n.auth0_client)),n.details&&(r.details=JSON.stringify(n.details).substring(0,8192)),n.location_info&&(r.country_code=n.location_info.country_code,r.city_name=n.location_info.city_name,r.latitude=n.location_info.latitude,r.longitude=n.location_info.longitude,r.time_zone=n.location_info.time_zone,r.continent_code=n.location_info.continent_code),await e.insert(O).values(r),Mb({...r,tenant_id:t})},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s,from_date:c,to_date:l}=n||{},u=[m(O.tenant_id,t)];if(s){let e=Tn(O,s,[`user_id`,`ip`,`type`,`client_id`]);e&&u.push(e)}typeof c==`number`&&Number.isFinite(c)&&u.push(Me(O.date,new Date(Math.floor(c)*1e3).toISOString())),typeof l==`number`&&Number.isFinite(l)&&u.push(Ne(O.date,new Date((Math.floor(l)+1)*1e3).toISOString()));let d=h(...u),f=e.select().from(O).where(d).$dynamic();if(o?.sort_by){let e=O[o.sort_by];e&&(f=f.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}else f=f.orderBy(Be(O.date));let ee=(await f.offset(r*i).limit(i)).map(Mb);if(!a)return{logs:ee};let[te]=await e.select({count:Ve()}).from(O).where(d);return{logs:ee,start:r*i,limit:i,length:Number(te?.count??0)}},async get(t,n){let r=await e.select().from(O).where(h(m(O.tenant_id,t),m(O.log_id,n))).get();return r?Mb(r):null}}}var Pb=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,Fb=32;function Ib(){let e=Date.now(),t=``;for(let n=10;n>0;n--)t=Pb.charAt(e%Fb)+t,e=Math.floor(e/Fb);let n=new Uint8Array(16);crypto.getRandomValues(n);for(let e=0;e<16;e++)t+=Pb.charAt(n[e]%Fb);return t}function Lb(e){let{tenant_id:t,created_at_ts:n,updated_at_ts:r,credential_backed_up:i,confirmed:a,transports:o,...s}=e;return A({...s,confirmed:!!a,credential_backed_up:i==null?void 0:!!i,transports:j(o),created_at:db(n),updated_at:db(r)})}function Rb(e){return{async create(t,n){let r=Date.now(),i={id:n.id||Ib(),tenant_id:t,user_id:n.user_id,type:n.type,phone_number:n.phone_number,totp_secret:n.totp_secret,credential_id:n.credential_id,public_key:n.public_key,sign_count:n.sign_count,credential_backed_up:n.credential_backed_up==null?null:+!!n.credential_backed_up,transports:n.transports?JSON.stringify(n.transports):null,friendly_name:n.friendly_name,confirmed:+!!n.confirmed,created_at_ts:r,updated_at_ts:r};return await e.insert(mn).values(i),Lb({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(mn).where(h(m(mn.tenant_id,t),m(mn.id,n))).get();return r?Lb(r):null},async getByCredentialId(t,n){let r=await e.select().from(mn).where(h(m(mn.tenant_id,t),m(mn.credential_id,n))).get();return r?Lb(r):null},async list(t,n){return(await e.select().from(mn).where(h(m(mn.tenant_id,t),m(mn.user_id,n))).all()).map(Lb)},async update(t,n,r){let i={updated_at_ts:Date.now()};r.type!==void 0&&(i.type=r.type),r.phone_number!==void 0&&(i.phone_number=r.phone_number),r.totp_secret!==void 0&&(i.totp_secret=r.totp_secret),r.credential_id!==void 0&&(i.credential_id=r.credential_id),r.public_key!==void 0&&(i.public_key=r.public_key),r.sign_count!==void 0&&(i.sign_count=r.sign_count),r.credential_backed_up!==void 0&&(i.credential_backed_up=+!!r.credential_backed_up),r.transports!==void 0&&(i.transports=JSON.stringify(r.transports)),r.friendly_name!==void 0&&(i.friendly_name=r.friendly_name),r.confirmed!==void 0&&(i.confirmed=+!!r.confirmed),await e.update(mn).set(i).where(h(m(mn.tenant_id,t),m(mn.id,n)));let a=await this.get(t,n);if(!a)throw Error(`Authentication method ${n} not found after update`);return a},async remove(t,n){return(await e.delete(mn).where(h(m(mn.tenant_id,t),m(mn.id,n))).returning()).length>0}}}function zb(){let{customAlphabet:e}=(Vn(),s(In));return`org_${e(`0123456789abcdefghijklmnopqrstuvwxyz`,17)()}`}function Bb(e){let{tenant_id:t,branding:n,metadata:r,enabled_connections:i,token_quota:a,...o}=e;return A({...o,branding:j(n,{}),metadata:j(r,{}),enabled_connections:j(i,[]),token_quota:j(a,{})})}function Vb(e){return{async create(t,n){let r=new Date().toISOString(),i={id:n.id||zb(),tenant_id:t,name:n.name,display_name:n.display_name,branding:JSON.stringify(n.branding||{}),metadata:JSON.stringify(n.metadata||{}),enabled_connections:JSON.stringify(n.enabled_connections||[]),token_quota:JSON.stringify(n.token_quota||{}),created_at:r,updated_at:r};try{await e.insert(E).values(i)}catch(e){throw e?.message?.includes(`UNIQUE constraint failed`)||e?.message?.includes(`AlreadyExists`)?new wn(409,{message:`Organization already exists`}):e}return Bb({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(E).where(h(m(E.tenant_id,t),m(E.id,n))).get();return r||=await e.select().from(E).where(h(m(E.tenant_id,t),m(E.name,n))).get(),r?Bb(r):null},async update(t,n,r){let i={updated_at:new Date().toISOString()};return r.name!==void 0&&(i.name=r.name),r.display_name!==void 0&&(i.display_name=r.display_name),r.branding!==void 0&&(i.branding=JSON.stringify(r.branding)),r.metadata!==void 0&&(i.metadata=JSON.stringify(r.metadata)),r.enabled_connections!==void 0&&(i.enabled_connections=JSON.stringify(r.enabled_connections)),r.token_quota!==void 0&&(i.token_quota=JSON.stringify(r.token_quota)),(await e.update(E).set(i).where(h(m(E.tenant_id,t),m(E.id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=e.select().from(E).where(m(E.tenant_id,t)).$dynamic();if(s&&(c=c.where(Ae(Re(E.name,`%${s}%`),Re(E.display_name,`%${s}%`)))),o?.sort_by){let e=E[o.sort_by];e&&(c=c.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let l=(await c.offset(r*i).limit(i)).map(Bb);if(!a)return{organizations:l};let u=[m(E.tenant_id,t)];s&&u.push(Ae(Re(E.name,`%${s}%`),Re(E.display_name,`%${s}%`)));let[d]=await e.select({count:Ve()}).from(E).where(h(...u));return{organizations:l,start:r*i,limit:i,length:Number(d?.count??0)}},async remove(t,n){return(await e.delete(E).where(h(m(E.tenant_id,t),m(E.id,n))).returning()).length>0}}}Vn();function Hb(e){let{tenant_id:t,is_current:n,...r}=e;return{...r,is_current:!!n}}function Ub(e){return{async create(t,n){let r=new Date().toISOString(),i=n.id||Bn();n.is_current!==!1&&await e.update(zt).set({is_current:0}).where(h(m(zt.tenant_id,t),m(zt.user_id,n.user_id)));let a={id:i,tenant_id:t,user_id:n.user_id,password:n.password,algorithm:n.algorithm||`bcrypt`,is_current:n.is_current===!1?0:1,created_at:r,updated_at:r};return await e.insert(zt).values(a),Hb({...a,tenant_id:t})},async get(t,n){let r=await e.select().from(zt).where(h(m(zt.tenant_id,t),m(zt.user_id,n),m(zt.is_current,1))).get();return r?Hb(r):null},async list(t,n,r){let i=e.select().from(zt).where(h(m(zt.tenant_id,t),m(zt.user_id,n))).orderBy(Be(zt.created_at)).$dynamic();return r&&(i=i.limit(r)),(await i).map(Hb)},async update(t,n){let r={updated_at:new Date().toISOString()};return n.password!==void 0&&(r.password=n.password),n.algorithm!==void 0&&(r.algorithm=n.algorithm),n.is_current!==void 0&&(r.is_current=+!!n.is_current),n.id?await e.update(zt).set(r).where(h(m(zt.tenant_id,t),m(zt.id,n.id))):await e.update(zt).set(r).where(h(m(zt.tenant_id,t),m(zt.user_id,n.user_id),m(zt.is_current,1))),!0}}}function Wb(e){return{async get(t){let n=await e.select().from(sn).where(m(sn.tenant_id,t)).get();return n?{universal_login_experience:n.universal_login_experience,identifier_first:!!n.identifier_first,password_first:!!n.password_first,webauthn_platform_first_factor:!!n.webauthn_platform_first_factor}:{universal_login_experience:`new`,identifier_first:!0,password_first:!1,webauthn_platform_first_factor:!1}},async set(t,n){await e.insert(sn).values({tenant_id:t,universal_login_experience:n.universal_login_experience,identifier_first:n.identifier_first,password_first:n.password_first,webauthn_platform_first_factor:n.webauthn_platform_first_factor}).onConflictDoUpdate({target:sn.tenant_id,set:{universal_login_experience:n.universal_login_experience,identifier_first:n.identifier_first,password_first:n.password_first,webauthn_platform_first_factor:n.webauthn_platform_first_factor}})}}}Vn();function Gb(e){let{tenant_id:t,created_at_ts:n,expires_at_ts:r,idle_expires_at_ts:i,last_exchanged_at_ts:a,revoked_at_ts:o,rotated_at_ts:s,device:c,resource_servers:l,rotating:u,...d}=e,f=pb({created_at_ts:n,expires_at_ts:r,idle_expires_at_ts:i,last_exchanged_at_ts:a,revoked_at_ts:o,rotated_at_ts:s},[`created_at_ts`],[`expires_at_ts`,`idle_expires_at_ts`,`last_exchanged_at_ts`,`revoked_at_ts`,`rotated_at_ts`]);return A({...d,...f,rotating:!!u,device:j(c,{}),resource_servers:j(l,[])})}function Kb(e,t){return Math.max(e??0,t??0)}function qb(e){return{async create(t,n){let r=Date.now(),i={id:n.id||Bn(),tenant_id:t,client_id:n.client_id,login_id:n.login_id,user_id:n.user_id,device:JSON.stringify(n.device||{}),resource_servers:JSON.stringify(n.resource_servers||[]),rotating:n.rotating??!1,token_lookup:n.token_lookup??null,token_hash:n.token_hash??null,family_id:n.family_id??null,rotated_to:n.rotated_to??null,rotated_at_ts:fb(n.rotated_at),created_at_ts:r,expires_at_ts:fb(n.expires_at),idle_expires_at_ts:fb(n.idle_expires_at),last_exchanged_at_ts:fb(n.last_exchanged_at)};await e.run(p`BEGIN`);try{await e.insert(S).values(i);let n=Kb(i.expires_at_ts,i.idle_expires_at_ts);n>0&&i.login_id&&await e.update(C).set({expires_at_ts:n,updated_at_ts:r}).where(h(m(C.tenant_id,t),m(C.id,i.login_id),Ne(C.expires_at_ts,n))),await e.run(p`COMMIT`)}catch(t){throw await e.run(p`ROLLBACK`),t}return Gb({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(S).where(h(m(S.tenant_id,t),m(S.id,n))).get();return r?Gb(r):null},async getByLookup(t,n){let r=await e.select().from(S).where(h(m(S.tenant_id,t),m(S.token_lookup,n))).get();return r?Gb(r):null},async update(t,n,r,i){let a={};r.device!==void 0&&(a.device=JSON.stringify(r.device)),r.resource_servers!==void 0&&(a.resource_servers=JSON.stringify(r.resource_servers)),r.rotating!==void 0&&(a.rotating=r.rotating),r.token_lookup!==void 0&&(a.token_lookup=r.token_lookup),r.token_hash!==void 0&&(a.token_hash=r.token_hash),r.family_id!==void 0&&(a.family_id=r.family_id),r.rotated_to!==void 0&&(a.rotated_to=r.rotated_to),r.rotated_at!==void 0&&(a.rotated_at_ts=fb(r.rotated_at)),r.expires_at!==void 0&&(a.expires_at_ts=fb(r.expires_at)),r.idle_expires_at!==void 0&&(a.idle_expires_at_ts=fb(r.idle_expires_at)),r.last_exchanged_at!==void 0&&(a.last_exchanged_at_ts=fb(r.last_exchanged_at)),r.revoked_at!==void 0&&(a.revoked_at_ts=fb(r.revoked_at));let o=i?.loginSessionBump,s=o?fb(o.expires_at):null,c=await e.update(S).set(a).where(h(m(S.tenant_id,t),m(S.id,n))).returning();return o?.login_id&&s&&s>0&&await e.update(C).set({expires_at_ts:s,updated_at_ts:Date.now()}).where(h(m(C.tenant_id,t),m(C.id,o.login_id),Ne(C.expires_at_ts,s))).catch(()=>{}),c.length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=e.select().from(S).where(m(S.tenant_id,t)).$dynamic();if(s){let e=Tn(S,s,[`user_id`]);e&&(c=c.where(h(m(S.tenant_id,t),e)))}if(o?.sort_by){let e=S[o.sort_by];e&&(c=c.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let l=(await c.offset(r*i).limit(i)).map(Gb);if(!a)return{refresh_tokens:l};let[u]=await e.select({count:Ve()}).from(S).where(m(S.tenant_id,t));return{refresh_tokens:l,start:r*i,limit:i,length:Number(u?.count??0)}},async remove(t,n){return(await e.delete(S).where(h(m(S.tenant_id,t),m(S.id,n))).returning()).length>0},async revokeByLoginSession(t,n,r){return(await e.update(S).set({revoked_at_ts:fb(r)}).where(h(m(S.tenant_id,t),m(S.login_id,n),Ie(S.revoked_at_ts))).returning()).length},async revokeFamily(t,n,r){return(await e.update(S).set({revoked_at_ts:fb(r)}).where(h(m(S.tenant_id,t),m(S.family_id,n),Ie(S.revoked_at_ts))).returning()).length}}}function Jb(){let{customAlphabet:e}=(Vn(),s(In));return`api_${e(`0123456789abcdefghijklmnopqrstuvwxyz`,17)()}`}var Yb=[`skip_consent_for_verifiable_first_party_clients`,`allow_offline_access`,`is_system`],Xb=new Set([`id`,`tenant_id`,`identifier`,`name`,`scopes`,`signing_alg`,`signing_secret`,`token_lifetime`,`token_lifetime_for_web`,`skip_consent_for_verifiable_first_party_clients`,`allow_offline_access`,`verification_key`,`options`,`is_system`,`metadata`,`created_at`,`updated_at`]);function Zb(e){let{tenant_id:t,verification_key:n,scopes:r,options:i,metadata:a,...o}=e,s={...o};s.scopes=j(r,[]),s.options=j(i,{}),s.metadata=j(a),n!==void 0&&(s.verificationKey=n);for(let e of Yb)o[e]!==void 0&&o[e]!==null&&(s[e]=!!o[e]);return A(s)}function Qb(e){return{async create(t,n){let r=new Date().toISOString(),i={id:n.id||Jb(),tenant_id:t,identifier:n.identifier,name:n.name,signing_alg:n.signing_alg,signing_secret:n.signing_secret,token_lifetime:n.token_lifetime,token_lifetime_for_web:n.token_lifetime_for_web,scopes:JSON.stringify(n.scopes||[]),options:JSON.stringify(n.options||{}),metadata:n.metadata?JSON.stringify(n.metadata):void 0,verification_key:n.verificationKey||n.verification_key,created_at:r,updated_at:r};for(let e of Yb)n[e]!==void 0&&(i[e]=+!!n[e]);return i.is_system===void 0&&(i.is_system=0),await e.insert(D).values(i),Zb({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(D).where(h(m(D.tenant_id,t),m(D.id,n))).get();return r?Zb(r):null},async update(t,n,r){let i={updated_at:new Date().toISOString()};r.name!==void 0&&(i.name=r.name),r.identifier!==void 0&&(i.identifier=r.identifier),r.signing_alg!==void 0&&(i.signing_alg=r.signing_alg),r.signing_secret!==void 0&&(i.signing_secret=r.signing_secret),r.token_lifetime!==void 0&&(i.token_lifetime=r.token_lifetime),r.token_lifetime_for_web!==void 0&&(i.token_lifetime_for_web=r.token_lifetime_for_web),r.scopes!==void 0&&(i.scopes=JSON.stringify(r.scopes)),r.options!==void 0&&(i.options=p`json_patch(COALESCE(${D.options}, '{}'), ${JSON.stringify(r.options)})`),r.metadata!==void 0&&(i.metadata=JSON.stringify(r.metadata)),r.verificationKey!==void 0&&(i.verification_key=r.verificationKey);for(let e of Yb)r[e]!==void 0&&(i[e]=+!!r[e]);return(await e.update(D).set(i).where(h(m(D.tenant_id,t),m(D.id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=Math.max(0,Math.floor(Number(r)||0)),l=Math.min(Math.max(1,Math.floor(Number(i)||50)),500),u=[m(D.tenant_id,t)];if(s){let e=s.match(/^([^:]+):(.+)$/);if(e){let[,t,n]=e,r=t?.startsWith(`-`),i=r?t?.substring(1):t;if(i&&Xb.has(i)&&!r){let e=D[i];u.push(Re(e,`%${n}%`))}}}let d=e.select().from(D).where(h(...u)).$dynamic();if(o?.sort_by&&Xb.has(o.sort_by)){let e=D[o.sort_by];d=d.orderBy(o.sort_order===`desc`?Be(e):ze(e))}let f=(await d.offset(c*l).limit(l)).map(Zb);if(!a)return{resource_servers:f};let[ee]=await e.select({count:Ve()}).from(D).where(h(...u));return{resource_servers:f,start:c*l,limit:l,length:Number(ee?.count??0)}},async remove(t,n){return(await e.delete(D).where(h(m(D.tenant_id,t),m(D.id,n))).returning()).length>0}}}function $b(e){return{async assign(t,n,r){let i=new Date().toISOString();return await e.insert(Qt).values(r.map(e=>({tenant_id:t,role_id:n,resource_server_identifier:e.resource_server_identifier,permission_name:e.permission_name,created_at:i}))).onConflictDoNothing(),!0},async list(t,n,r){let i=await e.select({resource_server_identifier:Qt.resource_server_identifier,permission_name:Qt.permission_name,created_at:Qt.created_at}).from(Qt).where(h(m(Qt.tenant_id,t),m(Qt.role_id,n))).all(),a=[...new Set(i.map(e=>e.resource_server_identifier))],o=new Map;if(a.length>0){let n=await e.select({identifier:D.identifier,name:D.name}).from(D).where(h(m(D.tenant_id,t),Fe(D.identifier,a))).all();for(let e of n)o.set(e.identifier,e.name)}return i.map(e=>({...e,resource_server_name:o.get(e.resource_server_identifier)||e.resource_server_identifier}))},async remove(t,n,r){let i=r.map(e=>h(m(Qt.resource_server_identifier,e.resource_server_identifier),m(Qt.permission_name,e.permission_name)));return(await e.delete(Qt).where(h(m(Qt.tenant_id,t),m(Qt.role_id,n),Ae(...i))).returning()).length>0}}}function ex(e){return{async create(t,n,r,i){try{await e.insert($t).values({tenant_id:t,user_id:n,resource_server_identifier:r.resource_server_identifier,permission_name:r.permission_name,organization_id:i||``,created_at:new Date().toISOString()})}catch(e){if(e?.message?.includes(`UNIQUE constraint`)||e?.message?.includes(`SQLITE_CONSTRAINT_PRIMARYKEY`))return!0;throw e}return!0},async list(t,n,r,i){let a=[m($t.tenant_id,t),m($t.user_id,n)];i&&a.push(m($t.organization_id,i));let o=await e.select().from($t).where(h(...a)).all();return await Promise.all(o.map(async n=>{let r=await e.select({name:D.name}).from(D).where(h(m(D.tenant_id,t),m(D.identifier,n.resource_server_identifier))).get();return{resource_server_identifier:n.resource_server_identifier,permission_name:n.permission_name,resource_server_name:r?.name||n.resource_server_identifier,organization_id:n.organization_id===``?void 0:n.organization_id}}))},async remove(t,n,r,i){return(await e.delete($t).where(h(m($t.tenant_id,t),m($t.user_id,n),m($t.resource_server_identifier,r.resource_server_identifier),m($t.permission_name,r.permission_name),m($t.organization_id,i||``))).returning()).length>0}}}Vn();function tx(e){let{tenant_id:t,is_system:n,metadata:r,...i}=e;return A({...i,is_system:n?!0:void 0,metadata:j(r)})}function nx(e){return{async create(t,n){let r=new Date().toISOString(),i={id:n.id||Bn(),tenant_id:t,name:n.name,description:n.description,is_system:+!!n.is_system,metadata:n.metadata?JSON.stringify(n.metadata):void 0,created_at:r,updated_at:r};return await e.insert(Zt).values(i),tx({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(Zt).where(h(m(Zt.tenant_id,t),m(Zt.id,n))).get();return r?tx(r):null},async update(t,n,r){let i={updated_at:new Date().toISOString()};return r.name!==void 0&&(i.name=r.name),r.description!==void 0&&(i.description=r.description),r.is_system!==void 0&&(i.is_system=+!!r.is_system),r.metadata!==void 0&&(i.metadata=JSON.stringify(r.metadata)),(await e.update(Zt).set(i).where(h(m(Zt.tenant_id,t),m(Zt.id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=s?Tn(Zt,s,[`name`]):void 0,l=c?h(m(Zt.tenant_id,t),c):m(Zt.tenant_id,t),u=e.select().from(Zt).where(l).$dynamic();if(o?.sort_by){let e=Zt[o.sort_by];e&&(u=u.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let d=(await u.offset(r*i).limit(i)).map(tx);if(!a)return{roles:d};let[f]=await e.select({count:Ve()}).from(Zt).where(l);return{roles:d,start:r*i,limit:i,length:Number(f?.count??0)}},async remove(t,n){return(await e.delete(Zt).where(h(m(Zt.tenant_id,t),m(Zt.id,n))).returning()).length>0}}}Vn();var rx=[`created_at_ts`,`updated_at_ts`],ix=[`expires_at_ts`,`idle_expires_at_ts`,`authenticated_at_ts`,`last_interaction_at_ts`,`used_at_ts`,`revoked_at_ts`];function ax(e){let{tenant_id:t,created_at_ts:n,updated_at_ts:r,expires_at_ts:i,idle_expires_at_ts:a,authenticated_at_ts:o,last_interaction_at_ts:s,used_at_ts:c,revoked_at_ts:l,device:u,clients:d,...f}=e,ee=pb({created_at_ts:n,updated_at_ts:r,expires_at_ts:i,idle_expires_at_ts:a,authenticated_at_ts:o,last_interaction_at_ts:s,used_at_ts:c,revoked_at_ts:l},[...rx],[...ix]);return A({...f,...ee,device:j(u,{}),clients:j(d,[])})}function ox(e){return{async create(t,n){let r=Date.now(),i={id:n.id||Bn(),tenant_id:t,user_id:n.user_id,login_session_id:n.login_session_id,device:JSON.stringify(n.device||{}),clients:JSON.stringify(n.clients||[]),created_at_ts:r,updated_at_ts:r,expires_at_ts:fb(n.expires_at),idle_expires_at_ts:fb(n.idle_expires_at),authenticated_at_ts:n.authenticated_at?fb(n.authenticated_at):r,last_interaction_at_ts:n.last_interaction_at?fb(n.last_interaction_at):r,used_at_ts:fb(n.used_at),revoked_at_ts:fb(n.revoked_at)};return await e.insert(Bt).values(i),ax({...i,tenant_id:t})},async get(t,n){let r=await e.select().from(Bt).where(h(m(Bt.tenant_id,t),m(Bt.id,n))).get();return r?ax(r):null},async update(t,n,r){let i={updated_at_ts:Date.now()};return r.user_id!==void 0&&(i.user_id=r.user_id),r.login_session_id!==void 0&&(i.login_session_id=r.login_session_id),r.device!==void 0&&(i.device=JSON.stringify(r.device)),r.clients!==void 0&&(i.clients=JSON.stringify(r.clients)),r.expires_at!==void 0&&(i.expires_at_ts=fb(r.expires_at)),r.idle_expires_at!==void 0&&(i.idle_expires_at_ts=fb(r.idle_expires_at)),r.authenticated_at!==void 0&&(i.authenticated_at_ts=fb(r.authenticated_at)),r.last_interaction_at!==void 0&&(i.last_interaction_at_ts=fb(r.last_interaction_at)),r.used_at!==void 0&&(i.used_at_ts=fb(r.used_at)),r.revoked_at!==void 0&&(i.revoked_at_ts=fb(r.revoked_at)),(await e.update(Bt).set(i).where(h(m(Bt.tenant_id,t),m(Bt.id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=s?Tn(Bt,s,[`user_id`]):void 0,l=c?h(m(Bt.tenant_id,t),c):m(Bt.tenant_id,t),u=e.select().from(Bt).where(l).$dynamic();if(o?.sort_by){let e=Bt[o.sort_by];e&&(u=u.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let d=(await u.offset(r*i).limit(i)).map(ax);if(!a)return{sessions:d};let[f]=await e.select({count:Ve()}).from(Bt).where(l);return{sessions:d,start:r*i,limit:i,length:Number(f?.count??0)}},async remove(t,n){return(await e.delete(Bt).where(h(m(Bt.tenant_id,t),m(Bt.id,n))).returning()).length>0}}}Vn();var sx=[`session_cookie`,`enabled_locales`,`error_page`,`flags`,`sandbox_versions_available`,`change_password`,`guardian_mfa_page`,`sessions`,`oidc_logout`,`device_flow`,`default_token_quota`,`allowed_logout_urls`,`acr_values_supported`,`mtls`,`mfa`],cx=[`allow_organization_name_in_authentication_api`,`customize_mfa_in_postlogin_action`,`pushed_authorization_requests_supported`,`authorization_response_iss_parameter_supported`];function lx(e){let t={...e};for(let e of sx)typeof t[e]==`string`&&(t[e]=j(t[e]));for(let e of cx)t[e]!==void 0&&t[e]!==null&&(t[e]=t[e]===1);return A(t)}function ux(e){let t={...e};gn(e,sx,t);for(let n of cx)e[n]!==void 0&&(t[n]=+!!e[n]);return vn(t)}function dx(e){return{async create(t){let n={id:t.id||Bn(),created_at:new Date().toISOString(),updated_at:new Date().toISOString(),...t},r=ux(n);try{await e.insert(b).values(r)}catch(e){throw e?.message?.includes(`UNIQUE constraint failed`)||e?.message?.includes(`duplicate key`)||e?.code===`SQLITE_CONSTRAINT`?new wn(409,{message:`Tenant with ID '${n.id}' already exists`}):e}return n},async get(t){let n=await e.select().from(b).where(m(b.id,t)).get();return n?lx(n):null},async list(t){let{page:n=0,per_page:r=50,include_totals:i=!1,sort:a,q:o}=t||{},s=e.select().from(b).$dynamic();if(o){let e=Tn(b,o,[`friendly_name`]);e&&(s=s.where(e))}if(a?.sort_by){let e=b[a.sort_by];e&&(s=s.orderBy(a.sort_order===`desc`?Be(e):ze(e)))}let c=(await s.offset(n*r).limit(r)).map(lx);if(!i)return{tenants:c};let[l]=await e.select({count:Ve()}).from(b);return{tenants:c,start:n*r,limit:r,length:Number(l?.count??0)}},async update(t,n){let r=ux({...n,id:t,updated_at:new Date().toISOString()});await e.update(b).set(r).where(m(b.id,t))},async remove(t){return(await e.delete(b).where(m(b.id,t)).returning()).length>0}}}Vn();var fx=[`colors`,`borders`,`fonts`,`page_background`,`widget`];function px(e){let{tenant_id:t,...n}=e,r=bn(n,fx);return r.borders&&(r.borders.show_widget_shadow=!!r.borders.show_widget_shadow),r.fonts&&(r.fonts.links_bold=!!r.fonts.links_bold,r.fonts.subtitle_bold=!!r.fonts.subtitle_bold,r.fonts.title_bold=!!r.fonts.title_bold),A(r)}function mx(e){return{async create(t,n,r){let i=new Date().toISOString(),a=r||Bn(),o={...yn(n),tenant_id:t,themeId:a,created_at:i,updated_at:i};return await e.insert(rn).values(o),px({...o,tenant_id:t})},async get(t,n){let r=await e.select().from(rn).where(h(m(rn.tenant_id,t),m(rn.themeId,n))).get();return r?px(r):null},async update(t,n,r){let i=yn(r);return i.updated_at=new Date().toISOString(),await e.update(rn).set(i).where(h(m(rn.tenant_id,t),m(rn.themeId,n))),!0},async remove(t,n){return(await e.delete(rn).where(h(m(rn.tenant_id,t),m(rn.themeId,n))).returning()).length>0}}}function hx(e){return{async get(t){let n=await e.select({body:nn.body}).from(nn).where(m(nn.tenant_id,t)).get();return n?{body:n.body}:null},async set(t,n){let r=Date.now();await e.insert(nn).values({tenant_id:t,body:n.body,created_at_ts:r,updated_at_ts:r}).onConflictDoUpdate({target:nn.tenant_id,set:{body:n.body,updated_at_ts:r}})},async delete(t){await e.delete(nn).where(m(nn.tenant_id,t))}}}Vn();function gx(e,t){let n={connection:e.connection,provider:e.provider,user_id:e.user_id,isSocial:!!e.is_social};return t?n.isPrimary=!0:n.profileData={email:e.email,email_verified:!!e.email_verified,...typeof e.profileData==`string`?j(e.profileData,{}):{}},n}function _x(e,t=[]){let{tenant_id:n,app_metadata:r,user_metadata:i,address:a,email_verified:o,phone_verified:s,is_social:c,linked_to:l,profileData:u,...d}=e,f=gx(e,!0),ee=t.map(e=>gx(e,!1));return A({...d,email:e.email||``,email_verified:!!o,phone_verified:s==null?void 0:!!s,is_social:!!c,app_metadata:j(r,{}),user_metadata:j(i,{}),address:j(a),identities:[f,...ee]})}function vx(e){let t=async(t,n)=>{let r=new Date().toISOString(),i={user_id:n.user_id,tenant_id:t,email:n.email,given_name:n.given_name,family_name:n.family_name,nickname:n.nickname,name:n.name,picture:n.picture,tags:n.tags,phone_number:n.phone_number,phone_verified:n.phone_verified??!1,username:n.username,linked_to:n.linked_to,last_ip:n.last_ip,login_count:n.login_count??0,last_login:n.last_login,provider:n.provider,connection:n.connection,email_verified:n.email_verified??!1,is_social:n.is_social??!1,app_metadata:JSON.stringify(n.app_metadata||{}),user_metadata:JSON.stringify(n.user_metadata||{}),address:n.address?JSON.stringify(n.address):void 0,profileData:n.profileData?JSON.stringify(n.profileData):void 0,locale:n.locale,middle_name:n.middle_name,preferred_username:n.preferred_username,profile:n.profile,website:n.website,gender:n.gender,birthdate:n.birthdate,zoneinfo:n.zoneinfo,created_at:n.created_at||r,updated_at:n.updated_at||r},a=n.password?Bn():void 0;try{if(n.password&&a){await e.run(p`BEGIN`);try{await e.insert(x).values(i),await e.insert(zt).values({id:a,tenant_id:t,user_id:n.user_id,password:n.password.hash||n.password,algorithm:n.password.algorithm||`bcrypt`,is_current:1,created_at:r,updated_at:r}),await e.run(p`COMMIT`)}catch(t){throw await e.run(p`ROLLBACK`),t}}else await e.insert(x).values(i)}catch(e){throw e?.message?.includes(`UNIQUE constraint`)||e?.message?.includes(`AlreadyExists`)?new wn(409,{message:`User already exists`}):(console.error(`User upsert failed:`,e?.code,e?.message),new wn(500,{message:`Internal server error`}))}return _x(i)};return{create:t,rawCreate:t,async get(t,n){let r=await e.select().from(x).where(h(m(x.tenant_id,t),m(x.user_id,n))).get();return r?_x(r,await e.select().from(x).where(h(m(x.tenant_id,t),m(x.linked_to,n))).all()):null},async update(t,n,r){let i={updated_at:new Date().toISOString()};for(let e of[`email`,`given_name`,`family_name`,`nickname`,`name`,`picture`,`tags`,`phone_number`,`username`,`linked_to`,`last_ip`,`login_count`,`last_login`,`provider`,`connection`,`locale`,`middle_name`,`preferred_username`,`profile`,`website`,`gender`,`birthdate`,`zoneinfo`])r[e]!==void 0&&(i[e]=r[e]);return r.email_verified!==void 0&&(i.email_verified=r.email_verified),r.phone_verified!==void 0&&(i.phone_verified=r.phone_verified),r.is_social!==void 0&&(i.is_social=r.is_social),r.app_metadata!==void 0&&(i.app_metadata=JSON.stringify(r.app_metadata)),r.user_metadata!==void 0&&(i.user_metadata=JSON.stringify(r.user_metadata)),r.address!==void 0&&(i.address=JSON.stringify(r.address)),r.profileData!==void 0&&(i.profileData=JSON.stringify(r.profileData)),(await e.update(x).set(i).where(h(m(x.tenant_id,t),m(x.user_id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,sort:o,q:s}=n||{},c=[m(x.tenant_id,t),Ie(x.linked_to)];if(s){let e=Tn(x,s,[`email`,`name`,`nickname`,`username`]);e&&c.push(e)}let l=h(...c),u=e.select().from(x).where(l).$dynamic();if(o?.sort_by){let e=x[o.sort_by];e&&(u=u.orderBy(o.sort_order===`desc`?Be(e):ze(e)))}let d=await u.offset(r*i).limit(i),f=d.map(e=>e.user_id),ee=[];f.length>0&&(ee=await e.select().from(x).where(h(m(x.tenant_id,t),Fe(x.linked_to,f))));let te=d.map(e=>_x(e,ee.filter(t=>t.linked_to===e.user_id)));if(!a)return{users:te};let[ne]=await e.select({count:Ve()}).from(x).where(l);return{users:te,start:r*i,limit:i,length:Number(ne?.count??0)}},async remove(t,n){await e.run(p`BEGIN`);try{let r=[n,...(await e.select({user_id:x.user_id}).from(x).where(h(m(x.tenant_id,t),m(x.linked_to,n)))).map(e=>e.user_id)];await e.delete(mn).where(h(m(mn.tenant_id,t),Fe(mn.user_id,r))),await e.delete(zt).where(h(m(zt.tenant_id,t),Fe(zt.user_id,r))),await e.delete(x).where(h(m(x.tenant_id,t),m(x.linked_to,n)));let i=await e.delete(x).where(h(m(x.tenant_id,t),m(x.user_id,n))).returning();return await e.run(p`COMMIT`),i.length>0}catch(t){throw await e.run(p`ROLLBACK`),t}},async unlink(t,n,r,i){let a=`${r}|${i}`;return(await e.update(x).set({linked_to:null}).where(h(m(x.tenant_id,t),m(x.user_id,a),m(x.linked_to,n))).returning()).length>0}}}function yx(e){return{async create(t,n,r,i){try{await e.insert(en).values({tenant_id:t,user_id:n,role_id:r,organization_id:i||``,created_at:new Date().toISOString()})}catch(e){if(e?.message?.includes(`UNIQUE constraint`)||e?.message?.includes(`SQLITE_CONSTRAINT_PRIMARYKEY`))return!0;throw e}return!0},async list(t,n,r,i){let a=[m(en.tenant_id,t),m(en.user_id,n)];i&&a.push(m(en.organization_id,i));let o=await e.select({role_id:en.role_id}).from(en).where(h(...a)).all();return o.length===0?[]:(await Promise.all(o.map(async n=>{let r=await e.select().from(Zt).where(h(m(Zt.tenant_id,t),m(Zt.id,n.role_id))).get();if(!r)return null;let{tenant_id:i,is_system:a,metadata:o,...s}=r;return A({...s,is_system:a?!0:void 0,metadata:j(o)})}))).filter(Boolean)},async remove(t,n,r,i){return(await e.delete(en).where(h(m(en.tenant_id,t),m(en.user_id,n),m(en.role_id,r),m(en.organization_id,i||``))).returning()).length>0}}}Vn();function bx(e){return{async create(t,n){let r=new Date().toISOString(),i={id:n.id||Bn(),tenant_id:t,user_id:n.user_id,organization_id:n.organization_id,created_at:r,updated_at:r};try{await e.insert(Yt).values(i)}catch(e){throw e?.message?.includes(`UNIQUE constraint`)||e?.message?.includes(`duplicate key`)?new wn(409,{message:`User organization already exists`}):e}let{tenant_id:a,...o}=i;return o},async get(t,n){let r=await e.select().from(Yt).where(h(m(Yt.tenant_id,t),m(Yt.id,n))).get();if(!r)return null;let{tenant_id:i,...a}=r;return a},async update(t,n,r){let i={updated_at:new Date().toISOString()};return r.user_id!==void 0&&(i.user_id=r.user_id),r.organization_id!==void 0&&(i.organization_id=r.organization_id),(await e.update(Yt).set(i).where(h(m(Yt.tenant_id,t),m(Yt.id,n))).returning()).length>0},async list(t,n){let{page:r=0,per_page:i=50,include_totals:a=!1,q:o}=n||{},s=m(Yt.tenant_id,t),c=s;if(o){let e=Tn(Yt,o,[`user_id`,`organization_id`]);e&&(c=h(s,e))}let l=(await e.select().from(Yt).where(c).offset(r*i).limit(i)).map(e=>{let{tenant_id:t,...n}=e;return n});if(!a)return{userOrganizations:l};let[u]=await e.select({count:Ve()}).from(Yt).where(c);return{userOrganizations:l,start:r*i,limit:i,length:Number(u?.count??0)}},async listUserOrganizations(t,n,r){let{page:i=0,per_page:a=50,include_totals:o=!1}=r||{},s=await e.select().from(Yt).where(h(m(Yt.tenant_id,t),m(Yt.user_id,n))).offset(i*a).limit(a).all(),c=(await Promise.all(s.map(async n=>{let r=await e.select().from(E).where(h(m(E.tenant_id,t),m(E.id,n.organization_id))).get();if(!r)return null;let{tenant_id:i,branding:a,metadata:o,enabled_connections:s,token_quota:c,...l}=r;return A({...l,branding:j(a,{}),metadata:j(o,{}),enabled_connections:j(s,[]),token_quota:j(c,{})})}))).filter(Boolean);if(!o)return{organizations:c};let[l]=await e.select({count:Ve()}).from(Yt).where(h(m(Yt.tenant_id,t),m(Yt.user_id,n)));return{organizations:c,start:i*a,limit:a,length:Number(l?.count??0)}},async remove(t,n){return(await e.delete(Yt).where(h(m(Yt.tenant_id,t),m(Yt.id,n))).returning()).length>0}}}var xx=[`s`],Sx=[`pwd_leak`];function Cx(e){return/^\d{8}$/.test(e)?`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`:e}function wx(e){return{async getDaily(t,n){let r=new Date,i=n?.from?Cx(n.from):new Date(r.getTime()-720*60*60*1e3).toISOString().split(`T`)[0],a=n?.to?Cx(n.to):r.toISOString().split(`T`)[0];return(await e.select({date:p`substr(${O.date}, 1, 10)`.as(`date`),logins:p`SUM(CASE WHEN ${O.type} IN (${p.join(xx.map(e=>p`${e}`),p`, `)}) THEN 1 ELSE 0 END)`.as(`logins`),signups:p`SUM(CASE WHEN ${O.type} = 'ss' THEN 1 ELSE 0 END)`.as(`signups`),leaked_passwords:p`SUM(CASE WHEN ${O.type} IN (${p.join(Sx.map(e=>p`${e}`),p`, `)}) THEN 1 ELSE 0 END)`.as(`leaked_passwords`)}).from(O).where(h(m(O.tenant_id,t),Me(O.date,i),Pe(O.date,`${a}T23:59:59.999Z`))).groupBy(p`substr(${O.date}, 1, 10)`).orderBy(p`substr(${O.date}, 1, 10)`).all()).map(e=>({date:e.date,logins:Number(e.logins)||0,signups:Number(e.signups)||0,leaked_passwords:Number(e.leaked_passwords)||0,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}))},async getActiveUsers(t){let n=new Date(Date.now()-720*60*60*1e3).toISOString(),[r]=await e.select({count:p`COUNT(DISTINCT ${O.user_id})`.as(`count`)}).from(O).where(h(m(O.tenant_id,t),Me(O.date,n),p`${O.type} IN (${p.join(xx.map(e=>p`${e}`),p`, `)})`));return Number(r?.count)||0}}}var Tx={"active-users":[`s`,`seacft`],logins:[`s`,`f`,`fp`],signups:[`ss`,`fs`],"refresh-tokens":[`seacft`,`fertft`],sessions:[`slo`]},Ex={"active-users":{alias:`active_users`,type:`UInt64`,agg:`uniq`},logins:{alias:`logins`,type:`UInt64`,agg:`count`},signups:{alias:`signups`,type:`UInt64`,agg:`count`},"refresh-tokens":{alias:`refresh_tokens`,type:`UInt64`,agg:`count`},sessions:{alias:`sessions`,type:`UInt64`,agg:`count`}};function Dx(e){switch(e){case`hour`:return p`substr(${O.date}, 1, 13)`;case`month`:return p`substr(${O.date}, 1, 7)`;case`day`:return p`substr(${O.date}, 1, 10)`;case`week`:return p`date(substr(${O.date}, 1, 10), '-' || ((cast(strftime('%w', substr(${O.date}, 1, 10)) as integer) + 6) % 7) || ' days')`;default:throw Error(`Unsupported interval '${e}' for SQL analytics adapter`)}}function Ox(e){return`"${e.replace(/"/g,`""`)}"`}function kx(e){switch(e){case`connection`:return O.connection;case`client_id`:return O.client_id;case`user_type`:return O.strategy_type;case`event`:return O.type;case`time`:throw Error(`time dimension handled separately`)}}function Ax(e){return{async query(t,n,r){let i=Date.now(),a=Tx[n],o=Ex[n],s=[m(O.tenant_id,t),Me(O.date,r.from),Ne(O.date,r.to),Fe(O.type,a)];r.filters.connection?.length&&s.push(Fe(O.connection,r.filters.connection)),r.filters.client_id?.length&&s.push(Fe(O.client_id,r.filters.client_id)),r.filters.user_type?.length&&s.push(Fe(O.strategy_type,r.filters.user_type)),r.filters.user_id?.length&&s.push(Fe(O.user_id,r.filters.user_id));let c={},l=[],u=[];for(let e of r.group_by)if(e===`time`){let e=Dx(r.interval);c.time=e,l.push(e),u.push({name:`time`,type:r.interval===`hour`?`DateTime`:`Date`})}else{let t=kx(e);c[e]=t,l.push(t),u.push({name:e,type:`String`})}c[o.alias]=o.agg===`uniq`?p`COUNT(DISTINCT ${O.user_id})`:p`COUNT(*)`,u.push({name:o.alias,type:o.type});let d=e.select(c).from(O).where(h(...s));l.length>0&&(d=d.groupBy(...l));let f=new Set([...Object.keys(c)]);if(r.order_by){let e=r.order_by.startsWith(`-`),t=e?r.order_by.slice(1):r.order_by;if(!f.has(t))throw Error(`Invalid order_by column '${t}' for analytics query`);let n=Ox(t);d=d.orderBy(p.raw(`${n} ${e?`DESC`:`ASC`}`))}else d=r.group_by[0]===`time`?d.orderBy(p.raw(`${Ox(`time`)} ASC`)):d.orderBy(p.raw(`${Ox(o.alias)} DESC`));d=d.limit(r.limit).offset(r.offset);let ee=(await d.all()).map(e=>{let t={};for(let n of u){let r=e[n.name];t[n.name]=n.type===`UInt64`?Number(r)||0:r??``}return t});return{meta:u,data:ee,rows:ee.length,rows_before_limit_at_least:ee.length,statistics:{elapsed:(Date.now()-i)/1e3}}}}}Vn();function jx(e){return{...e,payload:j(e.payload,{})}}function Mx(e){return{async create(t,n){let r=Bn(),i=new Date().toISOString();return await e.insert(k).values({id:r,tenant_id:t,event_type:n.event_type,log_type:n.log_type,aggregate_type:n.aggregate_type,aggregate_id:n.aggregate_id,payload:JSON.stringify({...n,id:r}),created_at:i,processed_at:null,retry_count:0,next_retry_at:null,error:null,claimed_by:null,claim_expires_at:null}),r},async getByIds(t){return t.length===0?[]:(await e.select().from(k).where(Fe(k.id,t)).all()).map(jx)},async getUnprocessed(t){let n=new Date().toISOString();return(await e.select().from(k).where(h(Ie(k.processed_at),Ae(Ie(k.next_retry_at),Pe(k.next_retry_at,n)),Ae(Ie(k.claimed_by),Pe(k.claim_expires_at,n)))).orderBy(k.created_at,k.id).limit(t).all()).map(jx)},async claimEvents(t,n,r){if(t.length===0)return[];let i=new Date().toISOString(),a=new Date(Date.now()+r).toISOString();return await e.update(k).set({claimed_by:n,claim_expires_at:a}).where(h(Fe(k.id,t),Ie(k.processed_at),Ae(Ie(k.claimed_by),Pe(k.claim_expires_at,i)))),(await e.select({id:k.id}).from(k).where(h(Fe(k.id,t),m(k.claimed_by,n))).all()).map(e=>e.id)},async markProcessed(t){t.length!==0&&await e.update(k).set({processed_at:new Date().toISOString()}).where(Fe(k.id,t))},async markRetry(t,n,r){await e.update(k).set({error:n,next_retry_at:r,retry_count:p`${k.retry_count} + 1`,claimed_by:null,claim_expires_at:null}).where(m(k.id,t))},async cleanup(t){return(await e.delete(k).where(h(p`${k.processed_at} IS NOT NULL`,Pe(k.processed_at,t))).returning()).length},async deadLetter(t,n){let r=new Date().toISOString();await e.update(k).set({processed_at:r,dead_lettered_at:r,final_error:n}).where(m(k.id,t))},async listFailed(t,n={}){let{page:r=0,per_page:i=50,include_totals:a=!1}=n,o=(await e.select().from(k).where(h(m(k.tenant_id,t),Le(k.dead_lettered_at))).orderBy(Be(k.dead_lettered_at),ze(k.id)).offset(r*i).limit(i).all()).map(e=>({...j(e.payload,{}),id:e.id,created_at:e.created_at,processed_at:e.processed_at,retry_count:e.retry_count,next_retry_at:e.next_retry_at,error:e.error,dead_lettered_at:e.dead_lettered_at,final_error:e.final_error})),s=o.length;if(a){let[n]=await e.select({total:Ve()}).from(k).where(h(m(k.tenant_id,t),Le(k.dead_lettered_at)));s=Number(n?.total??o.length)}return{events:o,start:r*i,limit:i,length:s}},async replay(t,n){return(await e.update(k).set({processed_at:null,dead_lettered_at:null,final_error:null,retry_count:0,next_retry_at:null,error:null}).where(h(m(k.id,t),m(k.tenant_id,n),Le(k.dead_lettered_at))).returning()).length>0}}}var Nx=10080*60*1e3;function Px(e){return async t=>{let n=Date.now()-Nx;try{let r=[Ae(Ne(S.expires_at_ts,n),Ne(S.idle_expires_at_ts,n))];t?.tenant_id&&r.push(m(S.tenant_id,t.tenant_id)),await e.delete(S).where(h(...r)),r=[Ae(Ne(Bt.expires_at_ts,n),Ne(Bt.idle_expires_at_ts,n))],t?.tenant_id&&r.push(m(Bt.tenant_id,t.tenant_id)),t?.user_id&&r.push(m(Bt.user_id,t.user_id)),await e.delete(Bt).where(h(...r)),r=[Ne(C.expires_at_ts,n)],t?.tenant_id&&r.push(m(C.tenant_id,t.tenant_id)),await e.delete(C).where(h(...r))}catch(e){console.error(`Session cleanup error:`,e)}}}function Fx(e,t={useTransactions:!0}){let n={actions:He(),actionExecutions:Ue(),actionVersions:We(),branding:Cn(e),clients:jn(e),clientConnections:Nn(e),clientGrants:Un(e),clientRegistrationTokens:Yy(e),codes:Zy(e),connections:eb(e),customDomains:nb(e),customText:rb(e),emailProviders:ib(e),emailTemplates:ob(e),flows:sb(e),forms:lb(e),hookCode:_b(e),hooks:xb(e),invites:Tb(e),keys:Eb(e),loginSessions:jb(e),logs:Nb(e),authenticationMethods:Rb(e),organizations:Vb(e),passwords:Ub(e),promptSettings:Wb(e),refreshTokens:qb(e),resourceServers:Qb(e),rolePermissions:$b(e),userPermissions:ex(e),roles:nx(e),sessions:ox(e),sessionCleanup:Px(e),tenants:dx(e),themes:mx(e),universalLoginTemplates:hx(e),users:vx(e),userRoles:yx(e),userOrganizations:bx(e),stats:wx(e),analytics:Ax(e),outbox:Mx(e),async transaction(r){if(t.useTransactions===!1)return r(n);await e.run(p`BEGIN`);try{let t=await r(n);return await e.run(p`COMMIT`),t}catch(t){throw await e.run(p`ROLLBACK`),t}}};return n}exports.default=Fx,Object.defineProperty(exports,"sqlite",{enumerable:!0,get:function(){return hn}});
|