@omer-x/buttler
Version:
automates CI/CD workflows using Docker and GitHub webhooks
1 lines • 130 kB
JavaScript
"use strict";exports.id=474,exports.ids=[474],exports.modules={5730:(e,t,i)=>{i.d(t,{i:()=>s,is:()=>r});let s=Symbol.for("drizzle:entityKind");function r(e,t){if(!e||"object"!=typeof e)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,s))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 i=Object.getPrototypeOf(e).constructor;if(i)for(;i;){if(s in i&&i[s]===t[s])return!0;i=Object.getPrototypeOf(i)}return!1}Symbol.for("drizzle:hasOwnEntityKind")},8030:(e,t,i)=>{i.d(t,{Pe:()=>l});var s=i(5730);class r{constructor(e,t){this.name=e,this.unique=t}static [s.i]="SQLiteIndexBuilderOn";on(...e){return new n(this.name,e,this.unique)}}class n{static [s.i]="SQLiteIndexBuilder";config;constructor(e,t,i){this.config={name:e,columns:t,unique:i,where:void 0}}where(e){return this.config.where=e,this}build(e){return new a(this.config,e)}}class a{static [s.i]="SQLiteIndex";config;constructor(e,t){this.config={...e,table:t}}}function l(e){return new r(e,!1)}},10007:(e,t,i)=>{i.d(t,{V:()=>r});var s=i(5730);class r{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 [s.i]="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 void 0!==this.config.generated&&"byDefault"!==this.config.generated.type}}},12772:(e,t,i)=>{i.d(t,{n:()=>s});let s=Symbol.for("drizzle:ViewBaseConfig")},24717:(e,t,i)=>{i.d(t,{HE:()=>d,Io:()=>m,Lf:()=>p,XI:()=>f,e:()=>a});var s=i(5730),r=i(86214);let n=Symbol.for("drizzle:Schema"),a=Symbol.for("drizzle:Columns"),l=Symbol.for("drizzle:ExtraConfigColumns"),o=Symbol.for("drizzle:OriginalName"),u=Symbol.for("drizzle:BaseName"),d=Symbol.for("drizzle:IsAlias"),c=Symbol.for("drizzle:ExtraConfigBuilder"),h=Symbol.for("drizzle:IsDrizzleTable");class f{static [s.i]="Table";static Symbol={Name:r.E,Schema:n,OriginalName:o,Columns:a,ExtraConfigColumns:l,BaseName:u,IsAlias:d,ExtraConfigBuilder:c};[r.E];[o];[n];[a];[l];[u];[d]=!1;[h]=!0;[c]=void 0;constructor(e,t,i){this[r.E]=this[o]=e,this[n]=t,this[u]=i}}function m(e){return e[r.E]}function p(e){return`${e[n]??"public"}.${e[r.E]}`}},28234:(e,t,i)=>{i.d(t,{jo:()=>N,D:()=>C});var s=i(5730),r=i(24717),n=i(79608),a=i(61652);class l extends a.o{static [s.i]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint","SQLiteBigInt")}build(e){return new o(e,this.config)}}class o extends a.v{static [s.i]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(e){return Buffer.isBuffer(e)?BigInt(e.toString()):e instanceof ArrayBuffer?BigInt(new TextDecoder().decode(e)):BigInt(String.fromCodePoint(...e))}mapToDriverValue(e){return Buffer.from(e.toString())}}class u extends a.o{static [s.i]="SQLiteBlobJsonBuilder";constructor(e){super(e,"json","SQLiteBlobJson")}build(e){return new d(e,this.config)}}class d extends a.v{static [s.i]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(e){return Buffer.isBuffer(e)?JSON.parse(e.toString()):e instanceof ArrayBuffer?JSON.parse(new TextDecoder().decode(e)):JSON.parse(String.fromCodePoint(...e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}}class c extends a.o{static [s.i]="SQLiteBlobBufferBuilder";constructor(e){super(e,"buffer","SQLiteBlobBuffer")}build(e){return new h(e,this.config)}}class h extends a.v{static [s.i]="SQLiteBlobBuffer";getSQLType(){return"blob"}}function f(e,t){let{name:i,config:s}=(0,n.Ll)(e,t);return s?.mode==="json"?new u(i):s?.mode==="bigint"?new l(i):new c(i)}class m extends a.o{static [s.i]="SQLiteCustomColumnBuilder";constructor(e,t,i){super(e,"custom","SQLiteCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new p(e,this.config)}}class p extends a.v{static [s.i]="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"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}function g(e){return(t,i)=>{let{name:s,config:r}=(0,n.Ll)(t,i);return new m(s,r,e)}}var y=i(70932);class v extends a.o{static [s.i]="SQLiteNumericBuilder";constructor(e){super(e,"string","SQLiteNumeric")}build(e){return new b(e,this.config)}}class b extends a.v{static [s.i]="SQLiteNumeric";getSQLType(){return"numeric"}}function _(e){return new v(e??"")}class w extends a.o{static [s.i]="SQLiteRealBuilder";constructor(e){super(e,"number","SQLiteReal")}build(e){return new S(e,this.config)}}class S extends a.v{static [s.i]="SQLiteReal";getSQLType(){return"real"}}function x(e){return new w(e??"")}var k=i(89283);let T=Symbol.for("drizzle:SQLiteInlineForeignKeys");class N extends r.XI{static [s.i]="SQLiteTable";static Symbol=Object.assign({},r.XI.Symbol,{InlineForeignKeys:T});[r.XI.Symbol.Columns];[T]=[];[r.XI.Symbol.ExtraConfigBuilder]=void 0}let C=(e,t,i)=>(function(e,t,i,s,n=e){let a=new N(e,void 0,n),l=Object.fromEntries(Object.entries("function"==typeof t?t({blob:f,customType:g,integer:y.nd,numeric:_,real:x,text:k.Qq}):t).map(([e,t])=>{t.setName(e);let i=t.build(a);return a[T].push(...t.buildForeignKeys(i,a)),[e,i]})),o=Object.assign(a,l);return o[r.XI.Symbol.Columns]=l,o[r.XI.Symbol.ExtraConfigColumns]=l,i&&(o[N.Symbol.ExtraConfigBuilder]=i),o})(e,t,i)},38949:(e,t,i)=>{i.d(t,{Q:()=>r});var s=i(5730);class r{static [s.i]="ColumnBuilder";config;constructor(e,t,i){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:i,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)}}},51707:(e,t,i)=>{let s,r;i.d(t,{Iw:()=>k,Or:()=>N,Xs:()=>b,DJ:()=>v,Ss:()=>$,Ct:()=>C,eG:()=>w,qt:()=>y,ll:()=>T});var n=i(5730),a=i(76123);let l=Symbol.for("drizzle:isPgEnum");class o extends a.pe{static [n.i]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn"),this.config.enum=t}build(e){return new u(e,this.config)}}class u extends a.Kl{static [n.i]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}var d=i(67083),c=i(69167);let h={startActiveSpan:(e,t)=>s?(r||(r=s.trace.getTracer("drizzle-orm","0.37.0")),(0,c.i)((i,s)=>s.startActiveSpan(e,e=>{try{return t(e)}catch(t){throw e.setStatus({code:i.SpanStatusCode.ERROR,message:t instanceof Error?t.message:"Unknown error"}),t}finally{e.end()}}),s,r)):t()};var f=i(12772),m=i(10007),p=i(24717);class g{static [n.i]=null}function y(e){return null!=e&&"function"==typeof e.getSQL}class v{static [n.i]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new b([this])}}class b{constructor(e){this.queryChunks=e}static [n.i]="SQL";decoder=S;shouldInlineParams=!1;append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return h.startActiveSpan("drizzle.buildSQL",t=>{let i=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(e,t){let i=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:s,escapeName:r,escapeParam:a,prepareTyping:o,inlineParams:u,paramStartIndex:c}=i;return function(e){let t={sql:"",params:[]};for(let i of e)t.sql+=i.sql,t.params.push(...i.params),i.typings?.length&&(t.typings||(t.typings=[]),t.typings.push(...i.typings));return t}(e.map(e=>{if((0,n.is)(e,v))return{sql:e.value.join(""),params:[]};if((0,n.is)(e,_))return{sql:r(e.value),params:[]};if(void 0===e)return{sql:"",params:[]};if(Array.isArray(e)){let t=[new v("(")];for(let[i,s]of e.entries())t.push(s),i<e.length-1&&t.push(new v(", "));return t.push(new v(")")),this.buildQueryFromSourceParams(t,i)}if((0,n.is)(e,b))return this.buildQueryFromSourceParams(e.queryChunks,{...i,inlineParams:u||e.shouldInlineParams});if((0,n.is)(e,p.XI)){let t=e[p.XI.Symbol.Schema],i=e[p.XI.Symbol.Name];return{sql:void 0===t?r(i):r(t)+"."+r(i),params:[]}}if((0,n.is)(e,m.V)){let i=s.getColumnCasing(e);if("indexes"===t.invokeSource)return{sql:r(i),params:[]};let n=e.table[p.XI.Symbol.Schema];return{sql:e.table[p.HE]||void 0===n?r(e.table[p.XI.Symbol.Name])+"."+r(i):r(n)+"."+r(e.table[p.XI.Symbol.Name])+"."+r(i),params:[]}}if((0,n.is)(e,$)){let t=e[f.n].schema,i=e[f.n].name;return{sql:void 0===t?r(i):r(t)+"."+r(i),params:[]}}if((0,n.is)(e,k)){if((0,n.is)(e.value,N))return{sql:a(c.value++,e),params:[e],typings:["none"]};let t=null===e.value?null:e.encoder.mapToDriverValue(e.value);if((0,n.is)(t,b))return this.buildQueryFromSourceParams([t],i);if(u)return{sql:this.mapInlineParam(t,i),params:[]};let s=["none"];return o&&(s=[o(e.encoder)]),{sql:a(c.value++,t),params:[t],typings:s}}return(0,n.is)(e,N)?{sql:a(c.value++,e),params:[e],typings:["none"]}:(0,n.is)(e,b.Aliased)&&void 0!==e.fieldAlias?{sql:r(e.fieldAlias),params:[]}:(0,n.is)(e,d.n)?e._.isWith?{sql:r(e._.alias),params:[]}:this.buildQueryFromSourceParams([new v("("),e._.sql,new v(") "),new _(e._.alias)],i):e&&"function"==typeof e&&l in e&&!0===e[l]?e.schema?{sql:r(e.schema)+"."+r(e.enumName),params:[]}:{sql:r(e.enumName),params:[]}:y(e)?e.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([e.getSQL()],i):this.buildQueryFromSourceParams([new v("("),e.getSQL(),new v(")")],i):u?{sql:this.mapInlineParam(e,i),params:[]}:{sql:a(c.value++,e),params:[e],typings:["none"]}}))}mapInlineParam(e,{escapeString:t}){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return e.toString();if("string"==typeof e)return t(e);if("object"==typeof e){let i=e.toString();return"[object Object]"===i?t(JSON.stringify(e)):t(i)}throw Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return void 0===e?this:new b.Aliased(this,e)}mapWith(e){return this.decoder="function"==typeof e?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class _{constructor(e){this.value=e}static [n.i]="Name";brand;getSQL(){return new b([this])}}function w(e){return"object"==typeof e&&null!==e&&"mapToDriverValue"in e&&"function"==typeof e.mapToDriverValue}let S={mapFromDriverValue:e=>e},x={mapToDriverValue:e=>e};({...S,...x});class k{constructor(e,t=x){this.value=e,this.encoder=t}static [n.i]="Param";brand;getSQL(){return new b([this])}}function T(e,...t){let i=[];for(let[s,r]of((t.length>0||e.length>0&&""!==e[0])&&i.push(new v(e[0])),t.entries()))i.push(r,new v(e[s+1]));return new b(i)}(e=>{e.empty=function(){return new b([])},e.fromList=function(e){return new b(e)},e.raw=function(e){return new b([new v(e)])},e.join=function(e,t){let i=[];for(let[s,r]of e.entries())s>0&&void 0!==t&&i.push(t),i.push(r);return new b(i)},e.identifier=function(e){return new _(e)},e.placeholder=function(e){return new N(e)},e.param=function(e,t){return new k(e,t)}})(T||(T={})),(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static [n.i]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(b||(b={}));class N{constructor(e){this.name=e}static [n.i]="Placeholder";getSQL(){return new b([this])}}function C(e,t){return e.map(e=>{if((0,n.is)(e,N)){if(!(e.name in t))throw Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if((0,n.is)(e,k)&&(0,n.is)(e.value,N)){if(!(e.value.name in t))throw Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}class ${static [n.i]="View";[f.n];constructor({name:e,schema:t,selectedFields:i,query:s}){this[f.n]={name:e,originalName:e,schema:t,selectedFields:i,query:s,isExisting:!s,isAlias:!1}}getSQL(){return new b([this])}}m.V.prototype.getSQL=function(){return new b([this])},p.XI.prototype.getSQL=function(){return new b([this])},d.n.prototype.getSQL=function(){return new b([this])}},56013:(e,t,i)=>{i.d(t,{iv:()=>v,pD:()=>y,DZ:()=>k,_k:()=>w,mm:()=>b,rl:()=>_,I$:()=>function e(t,i,s,a,l=e=>e){let o={};for(let[u,d]of a.entries())if(d.isJson){let r=i.relations[d.tsKey],a=s[u],c="string"==typeof a?JSON.parse(a):a;o[d.tsKey]=(0,n.is)(r,y)?c&&e(t,t[d.relationTableTsKey],c,d.selection,l):c.map(i=>e(t,t[d.relationTableTsKey],i,d.selection,l))}else{let e;let t=l(s[u]),i=d.field;e=(0,n.is)(i,r.V)?i:(0,n.is)(i,h.Xs)?i.decoder:i.sql.decoder,o[d.tsKey]=null===t?null:e.mapFromDriverValue(t)}return o},W0:()=>x,K1:()=>S});var s=i(24717),r=i(10007),n=i(5730);let a=Symbol.for("drizzle:PgInlineForeignKeys"),l=Symbol.for("drizzle:EnableRLS");class o extends s.XI{static [n.i]="PgTable";static Symbol=Object.assign({},s.XI.Symbol,{InlineForeignKeys:a,EnableRLS:l});[a]=[];[l]=!1;[s.XI.Symbol.ExtraConfigBuilder]=void 0}class u{static [n.i]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new d(e,this.columns,this.name)}}class d{constructor(e,t,i){this.table=e,this.columns=t,this.name=i}static [n.i]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[o.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}var c=i(94634),h=i(51707);function f(e){return(0,h.ll)`${e} asc`}function m(e){return(0,h.ll)`${e} desc`}class p{constructor(e,t,i){this.sourceTable=e,this.referencedTable=t,this.relationName=i,this.referencedTableName=t[s.XI.Symbol.Name]}static [n.i]="Relation";referencedTableName;fieldName}class g{constructor(e,t){this.table=e,this.config=t}static [n.i]="Relations"}class y extends p{constructor(e,t,i,s){super(e,t,i?.relationName),this.config=i,this.isNullable=s}static [n.i]="One";withFieldName(e){let t=new y(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class v extends p{constructor(e,t,i){super(e,t,i?.relationName),this.config=i}static [n.i]="Many";withFieldName(e){let t=new v(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}function b(){return{and:c.Uo,between:c.Tq,eq:c.eq,exists:c.t2,gt:c.gt,gte:c.RO,ilike:c.B3,inArray:c.RV,isNull:c.kZ,isNotNull:c.Pe,like:c.mj,lt:c.lt,lte:c.wJ,ne:c.ne,not:c.AU,notBetween:c.o8,notExists:c.KJ,notLike:c.RK,notIlike:c.q1,notInArray:c.KL,or:c.or,sql:h.ll}}function _(){return{sql:h.ll,asc:f,desc:m}}function w(e,t){1===Object.keys(e).length&&"default"in e&&!(0,n.is)(e.default,s.XI)&&(e=e.default);let i={},r={},a={};for(let[l,o]of Object.entries(e))if((0,n.is)(o,s.XI)){let e=(0,s.Lf)(o),t=r[e];for(let r of(i[e]=l,a[l]={tsName:l,dbName:o[s.XI.Symbol.Name],schema:o[s.XI.Symbol.Schema],columns:o[s.XI.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]},Object.values(o[s.XI.Symbol.Columns])))r.primary&&a[l].primaryKey.push(r);let d=o[s.XI.Symbol.ExtraConfigBuilder]?.(o[s.XI.Symbol.ExtraConfigColumns]);if(d)for(let e of Object.values(d))(0,n.is)(e,u)&&a[l].primaryKey.push(...e.columns)}else if((0,n.is)(o,g)){let e;let n=(0,s.Lf)(o.table),l=i[n];for(let[i,s]of Object.entries(o.config(t(o.table))))if(l){let t=a[l];t.relations[i]=s,e&&t.primaryKey.push(...e)}else n in r||(r[n]={relations:{},primaryKey:e}),r[n].relations[i]=s}return{tables:a,tableNamesMap:i}}function S(e,t){return new g(e,e=>Object.fromEntries(Object.entries(t(e)).map(([e,t])=>[e,t.withFieldName(e)])))}function x(e,t,i){if((0,n.is)(i,y)&&i.config)return{fields:i.config.fields,references:i.config.references};let r=t[(0,s.Lf)(i.referencedTable)];if(!r)throw Error(`Table "${i.referencedTable[s.XI.Symbol.Name]}" not found in schema`);let a=e[r];if(!a)throw Error(`Table "${r}" not found in schema`);let l=i.sourceTable,o=t[(0,s.Lf)(l)];if(!o)throw Error(`Table "${l[s.XI.Symbol.Name]}" not found in schema`);let u=[];for(let e of Object.values(a.relations))(i.relationName&&i!==e&&e.relationName===i.relationName||!i.relationName&&e.referencedTable===i.sourceTable)&&u.push(e);if(u.length>1)throw i.relationName?Error(`There are multiple relations with name "${i.relationName}" in table "${r}"`):Error(`There are multiple relations between "${r}" and "${i.sourceTable[s.XI.Symbol.Name]}". Please specify relation name`);if(u[0]&&(0,n.is)(u[0],y)&&u[0].config)return{fields:u[0].config.references,references:u[0].config.fields};throw Error(`There is not enough information to infer relation "${o}.${i.fieldName}"`)}function k(e){return{one:function(t,i){return new y(e,t,i,i?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)},many:function(t,i){return new v(e,t,i)}}}},61652:(e,t,i)=>{i.d(t,{v:()=>m,o:()=>f});var s=i(38949),r=i(10007),n=i(5730),a=i(86214);class l{static [n.i]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:s}=e();return{name:t,columns:i,foreignTable:s[0].table,foreignColumns:s}},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 o(e,this)}}class o{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [n.i]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),s=t.map(e=>e.name),r=i.map(e=>e.name),n=[this.table[a.E],...s,i[0].table[a.E],...r];return e??`${n.join("_")}_fk`}}function u(e,t){return`${e[a.E]}_${t.join("_")}_unique`}class d{constructor(e,t){this.name=t,this.columns=e}static [n.i]=null;columns;build(e){return new h(e,this.columns,this.name)}}class c{static [n.i]=null;name;constructor(e){this.name=e}on(...e){return new d(e,this.name)}}class h{constructor(e,t,i){this.table=e,this.columns=t,this.name=i??u(this.table,this.columns.map(e=>e.name))}static [n.i]=null;columns;name;getName(){return this.name}}class f extends s.Q{static [n.i]="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:i,actions:s})=>((i,s)=>{let r=new l(()=>({columns:[e],foreignColumns:[i()]}));return s.onUpdate&&r.onUpdate(s.onUpdate),s.onDelete&&r.onDelete(s.onDelete),r.build(t)})(i,s))}}class m extends r.V{constructor(e,t){t.uniqueName||(t.uniqueName=u(e,[t.name])),super(e,t),this.table=e}static [n.i]="SQLiteColumn"}},67083:(e,t,i)=>{i.d(t,{J:()=>n,n:()=>r});var s=i(5730);class r{static [s.i]="Subquery";constructor(e,t,i,s=!1){this._={brand:"Subquery",sql:e,selectedFields:t,alias:i,isWith:s}}}class n extends r{static [s.i]="WithSubquery"}},69167:(e,t,i)=>{i.d(t,{i:()=>s});function s(e,...t){return e(...t)}},70762:(e,t,i)=>{let s;i.d(t,{Ay:()=>tu,z:()=>tu}),function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw Error()},e.arrayToEnum=e=>{let t={};for(let i of e)t[i]=i;return t},e.getValidEnumValues=t=>{let i=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),s={};for(let e of i)s[e]=t[e];return e.objectValues(s)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t},e.find=(e,t)=>{for(let i of e)if(t(i))return i},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(ts||(ts={})),(tr||(tr={})).mergeShapes=(e,t)=>({...e,...t});let r=ts.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),n=e=>{switch(typeof e){case"undefined":return r.undefined;case"string":return r.string;case"number":return isNaN(e)?r.nan:r.number;case"boolean":return r.boolean;case"function":return r.function;case"bigint":return r.bigint;case"symbol":return r.symbol;case"object":if(Array.isArray(e))return r.array;if(null===e)return r.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return r.promise;if("undefined"!=typeof Map&&e instanceof Map)return r.map;if("undefined"!=typeof Set&&e instanceof Set)return r.set;if("undefined"!=typeof Date&&e instanceof Date)return r.date;return r.object;default:return r.unknown}},a=ts.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class l extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},i={_errors:[]},s=e=>{for(let r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(s);else if("invalid_return_type"===r.code)s(r.returnTypeError);else if("invalid_arguments"===r.code)s(r.argumentsError);else if(0===r.path.length)i._errors.push(t(r));else{let e=i,s=0;for(;s<r.path.length;){let i=r.path[s];s===r.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(t(r))):e[i]=e[i]||{_errors:[]},e=e[i],s++}}};return s(this),i}static assert(e){if(!(e instanceof l))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ts.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},i=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):i.push(e(s));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}l.create=e=>new l(e);let o=(e,t)=>{let i;switch(e.code){case a.invalid_type:i=e.received===r.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case a.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,ts.jsonStringifyReplacer)}`;break;case a.unrecognized_keys:i=`Unrecognized key(s) in object: ${ts.joinValues(e.keys,", ")}`;break;case a.invalid_union:i="Invalid input";break;case a.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${ts.joinValues(e.options)}`;break;case a.invalid_enum_value:i=`Invalid enum value. Expected ${ts.joinValues(e.options)}, received '${e.received}'`;break;case a.invalid_arguments:i="Invalid function arguments";break;case a.invalid_return_type:i="Invalid function return type";break;case a.invalid_date:i="Invalid date";break;case a.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:ts.assertNever(e.validation):i="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case a.too_small:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case a.too_big:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case a.custom:i="Invalid input";break;case a.invalid_intersection_types:i="Intersection results could not be merged";break;case a.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case a.not_finite:i="Number must be finite";break;default:i=t.defaultError,ts.assertNever(e)}return{message:i}},u=o;function d(){return u}let c=e=>{let{data:t,path:i,errorMaps:s,issueData:r}=e,n=[...i,...r.path||[]],a={...r,path:n};if(void 0!==r.message)return{...r,path:n,message:r.message};let l="";for(let e of s.filter(e=>!!e).slice().reverse())l=e(a,{data:t,defaultError:l}).message;return{...r,path:n,message:l}};function h(e,t){let i=d(),s=c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===o?void 0:o].filter(e=>!!e)});e.common.issues.push(s)}class f{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let i=[];for(let s of t){if("aborted"===s.status)return m;"dirty"===s.status&&e.dirty(),i.push(s.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){let i=[];for(let e of t){let t=await e.key,s=await e.value;i.push({key:t,value:s})}return f.mergeObjectSync(e,i)}static mergeObjectSync(e,t){let i={};for(let s of t){let{key:t,value:r}=s;if("aborted"===t.status||"aborted"===r.status)return m;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==r.value||s.alwaysSet)&&(i[t.value]=r.value)}return{status:e.value,value:i}}}let m=Object.freeze({status:"aborted"}),p=e=>({status:"dirty",value:e}),g=e=>({status:"valid",value:e}),y=e=>"aborted"===e.status,v=e=>"dirty"===e.status,b=e=>"valid"===e.status,_=e=>"undefined"!=typeof Promise&&e instanceof Promise;function w(e,t,i,s){if("a"===i&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(e):s?s.value:t.get(e)}function S(e,t,i,s,r){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!r)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?r.call(e,i):r?r.value=i:t.set(e,i),i}"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(tn||(tn={}));class x{constructor(e,t,i,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let k=(e,t)=>{if(b(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new l(e.common.issues);return this._error=t,this._error}}};function T(e){if(!e)return{};let{errorMap:t,invalid_type_error:i,required_error:s,description:r}=e;if(t&&(i||s))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:r}:{errorMap:(t,r)=>{var n,a;let{message:l}=e;return"invalid_enum_value"===t.code?{message:null!=l?l:r.defaultError}:void 0===r.data?{message:null!==(n=null!=l?l:s)&&void 0!==n?n:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!==(a=null!=l?l:i)&&void 0!==a?a:r.defaultError}},description:r}}class N{get description(){return this._def.description}_getType(e){return n(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new f,ctx:{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(_(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){var i;let s={common:{issues:[],async:null!==(i=null==t?void 0:t.async)&&void 0!==i&&i,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},r=this._parseSync({data:e,path:s.path,parent:s});return k(s,r)}"~validate"(e){var t,i;let s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:s});return b(t)?{value:t.value}:{issues:s.common.issues}}catch(e){(null===(i=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===i?void 0:i.includes("encountered"))&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(e=>b(e)?{value:e.value}:{issues:s.common.issues})}async parseAsync(e,t){let i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){let i={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},s=this._parse({data:e,path:i.path,parent:i});return k(i,await (_(s)?s:Promise.resolve(s)))}refine(e,t){let i=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,s)=>{let r=e(t),n=()=>s.addIssue({code:a.custom,...i(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(n(),!1)):!!r||(n(),!1)})}refinement(e,t){return this._refinement((i,s)=>!!e(i)||(s.addIssue("function"==typeof t?t(i,s):t),!1))}_refinement(e){return new e_({schema:this,typeName:to.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ew.create(this,this._def)}nullable(){return eS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return es.create(this)}promise(){return eb.create(this,this._def)}or(e){return en.create([this,e],this._def)}and(e){return eo.create(this,e,this._def)}transform(e){return new e_({...T(this._def),schema:this,typeName:to.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ex({...T(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:to.ZodDefault})}brand(){return new eC({typeName:to.ZodBranded,type:this,...T(this._def)})}catch(e){return new ek({...T(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:to.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return e$.create(this,e)}readonly(){return eO.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let C=/^c[^\s-]{8,}$/i,$=/^[0-9a-z]+$/,O=/^[0-9A-HJKMNP-TV-Z]{26}$/i,j=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,I=/^[a-z0-9_-]{21}$/i,A=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,L=/^[-+]?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)?)??$/,Q=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,q=/^(?:(?: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])$/,E=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Z=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,P=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,B=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,R=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,D="((\\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])))",F=RegExp(`^${D}$`);function z(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function M(e){let t=`${D}T${z(e)}`,i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${i.join("|")})`,RegExp(`^${t}$`)}class V extends N{_parse(e){var t,i,n,l;let o;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==r.string){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:r.string,received:t.parsedType}),m}let u=new f;for(let r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(h(o=this._getOrReturnCtx(e,o),{code:a.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),u.dirty());else if("max"===r.kind)e.data.length>r.value&&(h(o=this._getOrReturnCtx(e,o),{code:a.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),u.dirty());else if("length"===r.kind){let t=e.data.length>r.value,i=e.data.length<r.value;(t||i)&&(o=this._getOrReturnCtx(e,o),t?h(o,{code:a.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):i&&h(o,{code:a.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),u.dirty())}else if("email"===r.kind)Q.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"email",code:a.invalid_string,message:r.message}),u.dirty());else if("emoji"===r.kind)s||(s=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),s.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"emoji",code:a.invalid_string,message:r.message}),u.dirty());else if("uuid"===r.kind)j.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"uuid",code:a.invalid_string,message:r.message}),u.dirty());else if("nanoid"===r.kind)I.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"nanoid",code:a.invalid_string,message:r.message}),u.dirty());else if("cuid"===r.kind)C.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"cuid",code:a.invalid_string,message:r.message}),u.dirty());else if("cuid2"===r.kind)$.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"cuid2",code:a.invalid_string,message:r.message}),u.dirty());else if("ulid"===r.kind)O.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"ulid",code:a.invalid_string,message:r.message}),u.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(t){h(o=this._getOrReturnCtx(e,o),{validation:"url",code:a.invalid_string,message:r.message}),u.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"regex",code:a.invalid_string,message:r.message}),u.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(h(o=this._getOrReturnCtx(e,o),{code:a.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),u.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(h(o=this._getOrReturnCtx(e,o),{code:a.invalid_string,validation:{startsWith:r.value},message:r.message}),u.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(h(o=this._getOrReturnCtx(e,o),{code:a.invalid_string,validation:{endsWith:r.value},message:r.message}),u.dirty()):"datetime"===r.kind?M(r).test(e.data)||(h(o=this._getOrReturnCtx(e,o),{code:a.invalid_string,validation:"datetime",message:r.message}),u.dirty()):"date"===r.kind?F.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{code:a.invalid_string,validation:"date",message:r.message}),u.dirty()):"time"===r.kind?RegExp(`^${z(r)}$`).test(e.data)||(h(o=this._getOrReturnCtx(e,o),{code:a.invalid_string,validation:"time",message:r.message}),u.dirty()):"duration"===r.kind?L.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"duration",code:a.invalid_string,message:r.message}),u.dirty()):"ip"===r.kind?(t=e.data,!(("v4"===(i=r.version)||!i)&&q.test(t)||("v6"===i||!i)&&Z.test(t))&&(h(o=this._getOrReturnCtx(e,o),{validation:"ip",code:a.invalid_string,message:r.message}),u.dirty())):"jwt"===r.kind?!function(e,t){if(!A.test(e))return!1;try{let[i]=e.split("."),s=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),r=JSON.parse(atob(s));if("object"!=typeof r||null===r||!r.typ||!r.alg||t&&r.alg!==t)return!1;return!0}catch(e){return!1}}(e.data,r.alg)&&(h(o=this._getOrReturnCtx(e,o),{validation:"jwt",code:a.invalid_string,message:r.message}),u.dirty()):"cidr"===r.kind?(n=e.data,!(("v4"===(l=r.version)||!l)&&E.test(n)||("v6"===l||!l)&&P.test(n))&&(h(o=this._getOrReturnCtx(e,o),{validation:"cidr",code:a.invalid_string,message:r.message}),u.dirty())):"base64"===r.kind?B.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"base64",code:a.invalid_string,message:r.message}),u.dirty()):"base64url"===r.kind?R.test(e.data)||(h(o=this._getOrReturnCtx(e,o),{validation:"base64url",code:a.invalid_string,message:r.message}),u.dirty()):ts.assertNever(r);return{status:u.value,value:e.data}}_regex(e,t,i){return this.refinement(t=>e.test(t),{validation:t,code:a.invalid_string,...tn.errToObj(i)})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tn.errToObj(e)})}datetime(e){var t,i;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(i=null==e?void 0:e.local)&&void 0!==i&&i,...tn.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...tn.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tn.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tn.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tn.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tn.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tn.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tn.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tn.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tn.errToObj(t)})}nonempty(e){return this.min(1,tn.errToObj(e))}trim(){return new V({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}V.create=e=>{var t;return new V({checks:[],typeName:to.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...T(e)})};class X extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==r.number){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:r.number,received:t.parsedType}),m}let i=new f;for(let s of this._def.checks)"int"===s.kind?ts.isInteger(e.data)||(h(t=this._getOrReturnCtx(e,t),{code:a.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):"multipleOf"===s.kind?0!==function(e,t){let i=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,r=i>s?i:s;return parseInt(e.toFixed(r).replace(".",""))%parseInt(t.toFixed(r).replace(".",""))/Math.pow(10,r)}(e.data,s.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(h(t=this._getOrReturnCtx(e,t),{code:a.not_finite,message:s.message}),i.dirty()):ts.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tn.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tn.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tn.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tn.toString(t))}setLimit(e,t,i,s){return new X({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:tn.toString(s)}]})}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tn.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tn.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tn.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&ts.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let i of this._def.checks){if("finite"===i.kind||"int"===i.kind||"multipleOf"===i.kind)return!0;"min"===i.kind?(null===t||i.value>t)&&(t=i.value):"max"===i.kind&&(null===e||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}X.create=e=>new X({checks:[],typeName:to.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...T(e)});class K extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==r.bigint)return this._getInvalidInput(e);let i=new f;for(let s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(h(t=this._getOrReturnCtx(e,t),{code:a.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ts.assertNever(s);return{status:i.value,value:e.data}}