1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[716],{4474:(e,t,i)=>{i.d(t,{U9:()=>r});var s=i(75699);function r(e){return(0,s.ll)`count(${e||s.ll.raw("*")})`.mapWith(Number)}},7062:(e,t,i)=>{i.d(t,{J:()=>n,n:()=>r});var s=i(29395);class r{static [s.i]="Subquery";constructor(e,t,i,s=!1,r=[]){this._={brand:"Subquery",sql:e,selectedFields:t,alias:i,isWith:s,usedTables:r}}}class n extends r{static [s.i]="WithSubquery"}},10081:(e,t,i)=>{i.d(t,{x:()=>l});var s=i(29395),r=i(60169);class n extends r.o{static [s.i]="SQLiteRealBuilder";constructor(e){super(e,"number","SQLiteReal")}build(e){return new a(e,this.config)}}class a extends r.v{static [s.i]="SQLiteReal";getSQLType(){return"real"}}function l(e){return new n(e??"")}},11878:(e,t,i)=>{i.d(t,{Qq:()=>u});var s=i(29395),r=i(18929),n=i(60169);class a extends n.o{static [s.i]="SQLiteTextBuilder";constructor(e,t){super(e,"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new l(e,this.config)}}class l extends n.v{static [s.i]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}}class o extends n.o{static [s.i]="SQLiteTextJsonBuilder";constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new c(e,this.config)}}class c extends n.v{static [s.i]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}}function u(e,t={}){let{name:i,config:s}=(0,r.Ll)(e,t);return"json"===s.mode?new o(i):new a(i,s)}},14799:(e,t,i)=>{i.d(t,{Pe:()=>l});var s=i(29395);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)}},17209:(e,t,i)=>{i.d(t,{iv:()=>b,pD:()=>g,DZ:()=>E,_k:()=>v,mm:()=>w,rl:()=>S,I$:()=>function e(t,i,s,a,l=e=>e){let o={};for(let[c,u]of a.entries())if(u.isJson){let r=i.relations[u.tsKey],a=s[c],h="string"==typeof a?JSON.parse(a):a;o[u.tsKey]=(0,n.is)(r,g)?h&&e(t,t[u.relationTableTsKey],h,u.selection,l):h.map(i=>e(t,t[u.relationTableTsKey],i,u.selection,l))}else{let e,t=l(s[c]),i=u.field;e=(0,n.is)(i,r.V)?i:(0,n.is)(i,d.Xs)?i.decoder:i.sql.decoder,o[u.tsKey]=null===t?null:e.mapFromDriverValue(t)}return o},W0:()=>A,K1:()=>C});var s=i(28824),r=i(17394),n=i(29395);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;[s.XI.Symbol.ExtraConfigColumns]={}}class c{static [n.i]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new u(e,this.columns,this.name)}}class u{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 h=i(18035),d=i(75699);function f(e){return(0,d.ll)`${e} asc`}function m(e){return(0,d.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 y{constructor(e,t){this.table=e,this.config=t}static [n.i]="Relations"}class g 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 g(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class b extends p{constructor(e,t,i){super(e,t,i?.relationName),this.config=i}static [n.i]="Many";withFieldName(e){let t=new b(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}function w(){return{and:h.Uo,between:h.Tq,eq:h.eq,exists:h.t2,gt:h.gt,gte:h.RO,ilike:h.B3,inArray:h.RV,isNull:h.kZ,isNotNull:h.Pe,like:h.mj,lt:h.lt,lte:h.wJ,ne:h.ne,not:h.AU,notBetween:h.o8,notExists:h.KJ,n
1otLike:h.RK,notIlike:h.q1,notInArray:h.KL,or:h.or,sql:d.ll}}function S(){return{sql:d.ll,asc:f,desc:m}}function v(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 u=o[s.XI.Symbol.ExtraConfigBuilder]?.(o[s.XI.Symbol.ExtraConfigColumns]);if(u)for(let e of Object.values(u))(0,n.is)(e,c)&&a[l].primaryKey.push(...e.columns)}else if((0,n.is)(o,y)){let e,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 C(e,t){return new y(e,e=>Object.fromEntries(Object.entries(t(e)).map(([e,t])=>[e,t.withFieldName(e)])))}function A(e,t,i){if((0,n.is)(i,g)&&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 c=[];for(let e of Object.values(a.relations))(i.relationName&&i!==e&&e.relationName===i.relationName||!i.relationName&&e.referencedTable===i.sourceTable)&&c.push(e);if(c.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(c[0]&&(0,n.is)(c[0],g)&&c[0].config)return{fields:c[0].config.references,references:c[0].config.fields};throw Error(`There is not enough information to infer relation "${o}.${i.fieldName}"`)}function E(e){return{one:function(t,i){return new g(e,t,i,i?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)},many:function(t,i){return new b(e,t,i)}}}},17394:(e,t,i)=>{i.d(t,{V:()=>r});var s=i(29395);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}}},18035:(e,t,i)=>{i.d(t,{AU:()=>d,B3:()=>N,KJ:()=>C,KL:()=>b,Pe:()=>S,RK:()=>$,RO:()=>m,RV:()=>g,Tq:()=>A,Uo:()=>u,eq:()=>o,gt:()=>f,kZ:()=>w,lt:()=>p,mj:()=>T,ne:()=>c,o8:()=>E,or:()=>h,q1:()=>L,t2:()=>v,wJ:()=>y});var s=i(17394),r=i(29395),n=i(28824),a=i(75699);function l(e,t){return!(0,a.eG)(t)||(0,a.qt)(e)||(0,r.is)(e,a.Iw)||(0,r.is)(e,a.Or)||(0,r.is)(e,s.V)||(0,r.is)(e,n.XI)||(0,r.is)(e,a.Ss)?e:new a.Iw(e,t)}let o=(e,t)=>(0,a.ll)`${e} = ${l(t,e)}`,c=(e,t)=>(0,a.ll)`${e} <> ${l(t,e)}`;function u(...e){let t=e.filter(e=>void 0!==e);if(0!==t.length)return new a.Xs(1===t.length?t:[new a.DJ("("),a.ll.join(t,new a.DJ(" and ")),new a.DJ(")")])}function h(...e){let t=e.filter(e=>void 0!==e);if(0!==t.length)return new a.Xs(1===t.length?t:[new a.DJ("("),a.ll.join(t,new a.DJ(" or ")),new a.DJ(")")])}function d(e){return(0,a.ll)`not ${e}`}let f=(e,t)=>(0,a.ll)`${e} > ${l(t,e)}`,m=(e,t)=>(0,a.ll)`${e} >= ${l(t,e)}`,p=(e,t)=>(0,a.ll)`${e} < ${l(t,e)}`,y=(e,t)=>(0,a.ll)`${e} <= ${l(t,e)}`;function g(e,t){return Array.isArray(t)?0===t.length?(0,a.ll)`false`:(0,a.ll)`${e} in ${t.map(t=>l(t,e))}`:(0,a.ll)`${e} in ${l(t,e)}`}function b(e,t){return Array.isArray(t)?0===t.length?(0,a.ll)`true`:(0,a.ll)`${e} not in ${t.map(t=>l(t,e))}`:(0,a.ll)`${e} not in ${l(t,e)}`}function w(e){return(0,a.ll)`${e} is null`}function S(e){return(0,a.ll)`${e} is not null`}function v(e){return(0,a.ll)`exists ${e}`}function C(e){return(0,a.ll)`not exists ${e}`}function A(e,t,i){return(0,a.ll)`${e} between ${l(t,e)} and ${l(i,e)}`}function E(e,t,i){return(0,a.ll)`${e} not between ${l(t,e)} and ${l(i,e)}`}function T(e,t){return(0,a.ll)`${e} like ${t}`}function $(e,t){return(0,a.ll)`${e} not like ${t}`}function N(e,t){return(0,a.ll)`${e} ilike ${t}`}function L(e,t){return(0,a.ll)`${e} not ilike ${t}`}},18929:(e,t,i)=>{i.d(t,{DV:()=>u,He:()=>function e(t,i){return Object.entries(t).reduce((t,[a,o])=>{if("string"!=typeof a)return t;let c=i?[...i,a]:[a];return(0,r.is)(o,s.V)||(0,r.is)(o,n.Xs)||(0,r.is)(o,n.Xs.Aliased)?t.push({path:c,field:o}):(0,r.is)(o,l.XI)?t.push(...e(o[l.XI.Symbol.Columns],c)):t.push(...e(o,c)),t},[])},Ll:()=>p,XJ:()=>d,YD:()=>f,a6:()=>c,q:()=>h,su:()=>y,zN:()=>m});var s=i(17394),r=i(29395),n=i(75699),a=i(7062),l=i(28824),o=i(42525);function c(e,t,i){let a={},o=e.reduce((e,{path:o,field:c},u)=>{let h;h=(0,r.is)(c,s.V)?c:(0,r.is)(c,n.Xs)?c.decoder:c.sql.decoder;let d=e;for(let[e,n]of o.entries())if(e<o.length-1)n in d||(d[n]={}),d=d[n];else{let e=t[u],f=d[n]=null===e?null:h.mapFromDriverValue(e);if(i&&(0,r.is)(c,s.V)&&2===o.length){let e=o[0];
1e in a?"string"==typeof a[e]&&a[e]!==(0,l.Io)(c.table)&&(a[e]=!1):a[e]=null===f&&(0,l.Io)(c.table)}}return e},{});if(i&&Object.keys(a).length>0)for(let[e,t]of Object.entries(a))"string"!=typeof t||i[t]||(o[e]=null);return o}function u(e,t){let i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(let[e,t]of i.entries())if(t!==s[e])return!1;return!0}function h(e,t){let i=Object.entries(t).filter(([,e])=>void 0!==e).map(([t,i])=>(0,r.is)(i,n.Xs)||(0,r.is)(i,s.V)?[t,i]:[t,new n.Iw(i,e[l.XI.Symbol.Columns][t])]);if(0===i.length)throw Error("No values to set");return Object.fromEntries(i)}function d(e,t){for(let i of t)for(let t of Object.getOwnPropertyNames(i.prototype))"constructor"!==t&&Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(i.prototype,t)||Object.create(null))}function f(e){return e[l.XI.Symbol.Columns]}function m(e){return(0,r.is)(e,a.n)?e._.alias:(0,r.is)(e,n.Ss)?e[o.n].name:(0,r.is)(e,n.Xs)?void 0:e[l.XI.Symbol.IsAlias]?e[l.XI.Symbol.Name]:e[l.XI.Symbol.BaseName]}function p(e,t){return{name:"string"==typeof e&&e.length>0?e:"",config:"object"==typeof e?e:t}}let y="undefined"==typeof TextDecoder?null:new TextDecoder},23710:(e,t,i)=>{let s;i.d(t,{V:()=>j});let r=new TextEncoder,n=new TextDecoder;function a(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(s>127)throw TypeError("non-ASCII string encountered in encode()");t[i]=s}return t}function l(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:n.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=n.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{var i=t;if(Uint8Array.fromBase64)return Uint8Array.fromBase64(i);let e=atob(i),s=new Uint8Array(e.length);for(let t=0;t<e.length;t++)s[t]=e.charCodeAt(t);return s}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}class o extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class c extends o{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,i="unspecified",s="unspecified"){super(e,{cause:{claim:i,reason:s,payload:t}}),this.claim=i,this.reason=s,this.payload=t}}class u extends o{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,i="unspecified",s="unspecified"){super(e,{cause:{claim:i,reason:s,payload:t}}),this.claim=i,this.reason=s,this.payload=t}}class h extends o{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class d extends o{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class f extends o{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class m extends o{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class p extends o{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}}class y extends o{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}let g=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function b(e){return parseInt(e.name.slice(4),10)}function w(e,t,...i){if((i=i.filter(Boolean)).length>2){let t=i.pop();e+=`one of type ${i.join(", ")}, or ${t}.`}else 2===i.length?e+=`one of type ${i[0]} or ${i[1]}.`:e+=`of type ${i[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}let S=(e,t,...i)=>w(`Key for the ${e} algorithm must be `,t,...i);async function v(e,t,i){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw TypeError(((e,...t)=>w("Key must be ",e,...t))(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[i])}
1return!function(e,t,i){switch(t){case"HS256":case"HS384":case"HS512":{if("HMAC"!==e.algorithm.name)throw g("HMAC");let i=parseInt(t.slice(2),10);if(b(e.algorithm.hash)!==i)throw g(`SHA-${i}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if("RSASSA-PKCS1-v1_5"!==e.algorithm.name)throw g("RSASSA-PKCS1-v1_5");let i=parseInt(t.slice(2),10);if(b(e.algorithm.hash)!==i)throw g(`SHA-${i}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if("RSA-PSS"!==e.algorithm.name)throw g("RSA-PSS");let i=parseInt(t.slice(2),10);if(b(e.algorithm.hash)!==i)throw g(`SHA-${i}`,"algorithm.hash");break}case"Ed25519":case"EdDSA":if("Ed25519"!==e.algorithm.name)throw g("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let s;if(s=e.algorithm,s.name!==t)throw g(t);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==e.algorithm.name)throw g("ECDSA");let i=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(t);if(e.algorithm.namedCurve!==i)throw g(i,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(i&&!e.usages.includes(i))throw TypeError(`CryptoKey does not support this operation, its usages must include ${i}.`)}(t,e,i),t}async function C(e,t,i,s){let r=await v(e,t,"verify");if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:t}=r.algorithm;if("number"!=typeof t||t<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}let n=function(e,t){let i=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:i,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:i,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:i,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:i,name:"ECDSA",namedCurve:t.namedCurve};
1case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new d(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}(e,r.algorithm);try{return await crypto.subtle.verify(n,r,i,s)}catch{return!1}}function A(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}let E=e=>e?.[Symbol.toStringTag]==="CryptoKey",T=e=>e?.[Symbol.toStringTag]==="KeyObject",$=e=>E(e)||T(e),N=e=>A(e)&&"string"==typeof e.kty,L=e=>e?.[Symbol.toStringTag],x=(e,t,i)=>{if(void 0!==t.use){let e;switch(i){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(void 0!==t.alg&&t.alg!==e)throw TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let s;switch(!0){case"sign"===i||"verify"===i:case"dir"===e:case e.includes("CBC-HS"):s=i;break;case e.startsWith("PBES2"):s="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):s=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===i?"wrapKey":"unwrapKey":i;break;case"encrypt"===i&&e.startsWith("RSA"):s="wrapKey";break;case"decrypt"===i:s=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(s&&t.key_ops?.includes?.(s)===!1)throw TypeError(`Invalid key for this operation, its "key_ops" must include "${s}" when present`)}return!0};async function Q(e){if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:i}=function(e){let t,i;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},i=e.priv?["sign"]:["verify"];break;default:throw new d('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},i=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},i=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},i=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new d('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},i=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},i=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},i=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},i=e.d?["deriveBits"]:[];break;default:throw new d('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;
1case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},i=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},i=e.d?["deriveBits"]:[];break;default:throw new d('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new d('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:i}}(e),s={...e};return"AKP"!==s.kty&&delete s.alg,delete s.use,crypto.subtle.importKey("jwk",s,t,e.ext??(!e.d&&!e.priv),e.key_ops??i)}let I=async(e,t,i,r=!1)=>{let n=(s||=new WeakMap).get(e);if(n?.[i])return n[i];let a=await Q({...t,alg:i});return r&&Object.freeze(e),n?n[i]=a:s.set(e,{[i]:a}),a};async function q(e,t){if(e instanceof Uint8Array||E(e))return e;if(T(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{let i,r=(s||=new WeakMap).get(e);if(r?.[t])return r[t];let n="public"===e.type,a=!!n;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw TypeError("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,a,n?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,a,[n?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw TypeError("given KeyObject instance cannot be used for this algorithm");i=e.toCryptoKey(e.asymmetricKeyType,a,[n?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let s;switch(t){case"RSA-OAEP":s="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":s="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":s="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":s="SHA-512";break;default:throw TypeError("given KeyObject instance cannot be used for this algorithm")}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:s},a,n?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:s},a,[n?"verify":"sign"])}if("ec"===e.asymmetricKeyType){let s=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!s)throw TypeError("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===s&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:s},a,[n?"verify":"sign"])),"ES384"===t&&"P-384"===s&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:s},a,[n?"verify":"sign"])),"ES512"===t&&"P-521"===s&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:s},a,[n?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:s},a,n?[]:["deriveBits"]))}if(!i)throw TypeError("given KeyObject instance cannot be used for this algorithm");return r?r[t]=i:s.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let i=e.export({format:"jwk"});return I(e,i,t)}if(N(e))return e.k?l(e.k):I(e,e,t,!0);throw Error("unreachable")}async function O(e,t,i){let s,o;if(!A(e))throw new f("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new f('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new f("JWS Protected Header incorrect type");if(void 0===e.payload)throw new f("JWS Payload missing");if("string"!=typeof e.signature)throw new f("JWS Signature missing or incorrect type");if(void 0!==e.header&&!A(e.header))throw new f("JWS Unprotected Header incorrect type");let c={};if(e.protected)try{let t=l(e.protected);c=JSON.parse(n.decode(t))}catch{throw new f("JWS Protected Header is invalid")}if(!function(...e){let t,i=e.filter(Boolean);if(0===i.length||1===i.length)return!0;for(let e of i){let i=Object.keys(e);if(!t||0===t.size){t=new Set(i);continue}for(let e of i){if(t.has(e))return!1;t.add(e)}}return!0}(c,e.header))throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let u={...c,...e.header},m=function(e,t,i,s,r){let n;if(void 0!==r.crit&&s?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!s||void 0===s.crit)return new Set;if(!Array.isArray(s.crit)||0===s.crit.length||s.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let a of(n=void 0!==i?new Map([...Object.entries(i),...t.entries()]):t,s.crit)){if(!n.has(a))throw new d(`
1Extension Header Parameter "${a}" is not recognized`);if(void 0===r[a])throw new e(`Extension Header Parameter "${a}" is missing`);if(n.get(a)&&void 0===s[a])throw new e(`Extension Header Parameter "${a}" MUST be integrity protected`)}return new Set(s.crit)}(f,new Map([["b64",!0]]),i?.crit,c,u),p=!0;if(m.has("b64")&&"boolean"!=typeof(p=c.b64))throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:g}=u;if("string"!=typeof g||!g)throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');let b=i&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}("algorithms",i.algorithms);if(b&&!b.has(g))throw new h('"alg" (Algorithm) Header Parameter value not allowed');if(p){if("string"!=typeof e.payload)throw new f("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new f("JWS Payload must be a string or an Uint8Array instance");let w=!1;"function"==typeof t&&(t=await t(c,e),w=!0);var v=t,E="verify";switch(g.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,i)=>{if(!(t instanceof Uint8Array)){if(N(t)){let s;if("oct"===(s=t).kty&&"string"==typeof s.k&&x(e,t,i))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!$(t))throw TypeError(S(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw TypeError(`${L(t)} instances for symmetric algorithms must be of type "secret"`)}})(g,v,E);break;default:((e,t,i)=>{if(N(t))switch(i){case"decrypt":case"sign":let s;if("oct"!==(s=t).kty&&("AKP"===s.kty&&"string"==typeof s.priv||"string"==typeof s.d)&&x(e,t,i))return;throw TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":let r;if("oct"!==(r=t).kty&&void 0===r.d&&void 0===r.priv&&x(e,t,i))return;throw TypeError("JSON Web Key for this operation be a public JWK")}if(!$(t))throw TypeError(S(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw TypeError(`${L(t)} instances for asymmetric algorithms must not be of type "secret"`);if("public"===t.type)switch(i){case"sign":throw TypeError(`${L(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw TypeError(`${L(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if("private"===t.type)switch(i){case"verify":throw TypeError(`${L(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw TypeError(`${L(t)} instances for asymmetric algorithm encryption must be of type "public"`)}})(g,v,E)}let T=function(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),i=0;for(let s of e)t.set(s,i),i+=s.length;return t}(void 0!==e.protected?a(e.protected):new Uint8Array,a("."),"string"==typeof e.payload?p?a(e.payload):r.encode(e.payload):e.payload);try{s=l(e.signature)}catch{throw new f("Failed to base64url decode the signature")}let Q=await q(t,g);if(!await C(g,Q,s,T))throw new y;if(p)try{o=l(e.payload)}catch{throw new f("Failed to base64url decode the payload")}else o="string"==typeof e.payload?r.encode(e.payload):e.payload;let I={payload:o};return(void 0!==e.protected&&(I.protectedHeader=c),void 0!==e.header&&(I.unprotectedHeader=e.header),w)?{...I,key:Q}:I}async function _(e,t,i){if(e instanceof Uint8Array&&(e=n.decode(e)),"string"!=typeof e)throw new f("Compact JWS must be a string or Uint8Array");let{0:s,1:r,2:a,length:l}=e.split(".");if(3!==l)throw new f("Invalid Compact JWS");let o=await O({payload:r,protected:s,signature:a},t,i),c={payload:o.payload,protectedHeader:o.protectedHeader};return"function"==typeof t?{...c,key:o.key}:c}let D=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function R(e){let t,i=D.exec(e);if(!i||i[4]&&i[1])throw TypeError("Invalid time period format");let s=parseFloat(i[2]);switch(i[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(s);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(60*s);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(3600*s);break;case"day":case"days":case"d":t=Math.round(86400*s);break;case"week":case"weeks":case"w":t=Math.round(604800*s);break;default:t=Math.round(0x1e187e0*s)}return"-"===i[1]||"ago"===i[4]?-t:t}let P=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`;async function j(e,t,i){let s=await _(e,t,i);if(s.protectedHeader.crit?.includes("b64")&&!1===s.protectedHeader.b64)throw new m
1("JWTs MUST NOT use unencoded payload");let r={payload:function(e,t,i={}){var s,r;let a,l;try{a=JSON.parse(n.decode(t))}catch{}if(!A(a))throw new m("JWT Claims Set must be a top-level JSON object");let{typ:o}=i;if(o&&("string"!=typeof e.typ||P(e.typ)!==P(o)))throw new c('unexpected "typ" JWT header value',a,"typ","check_failed");let{requiredClaims:h=[],issuer:d,subject:f,audience:p,maxTokenAge:y}=i,g=[...h];for(let e of(void 0!==y&&g.push("iat"),void 0!==p&&g.push("aud"),void 0!==f&&g.push("sub"),void 0!==d&&g.push("iss"),new Set(g.reverse())))if(!(e in a))throw new c(`missing required "${e}" claim`,a,e,"missing");if(d&&!(Array.isArray(d)?d:[d]).includes(a.iss))throw new c('unexpected "iss" claim value',a,"iss","check_failed");if(f&&a.sub!==f)throw new c('unexpected "sub" claim value',a,"sub","check_failed");if(p&&(s=a.aud,r="string"==typeof p?[p]:p,"string"==typeof s?!r.includes(s):!(Array.isArray(s)&&r.some(Set.prototype.has.bind(new Set(s))))))throw new c('unexpected "aud" claim value',a,"aud","check_failed");switch(typeof i.clockTolerance){case"string":l=R(i.clockTolerance);break;case"number":l=i.clockTolerance;break;case"undefined":l=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:b}=i,w=Math.floor((b||new Date).getTime()/1e3);if((void 0!==a.iat||y)&&"number"!=typeof a.iat)throw new c('"iat" claim must be a number',a,"iat","invalid");if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw new c('"nbf" claim must be a number',a,"nbf","invalid");if(a.nbf>w+l)throw new c('"nbf" claim timestamp check failed',a,"nbf","check_failed")}if(void 0!==a.exp){if("number"!=typeof a.exp)throw new c('"exp" claim must be a number',a,"exp","invalid");if(a.exp<=w-l)throw new u('"exp" claim timestamp check failed',a,"exp","check_failed")}if(y){let e=w-a.iat;if(e-l>("number"==typeof y?y:R(y)))throw new u('"iat" claim timestamp check failed (too far in the past)',a,"iat","check_failed");if(e<0-l)throw new c('"iat" claim timestamp check failed (it should be in the past)',a,"iat","check_failed")}return a}(s.protectedHeader,s.payload,i),protectedHeader:s.protectedHeader};return"function"==typeof t?{...r,key:s.key}:r}},27399:(e,t,i)=>{i.d(t,{E:()=>s});let s=Symbol.for("drizzle:Name")},28824:(e,t,i)=>{i.d(t,{HE:()=>u,Io:()=>m,Lf:()=>p,XI:()=>f,e:()=>a});var s=i(29395),r=i(27399);let n=Symbol.for("drizzle:Schema"),a=Symbol.for("drizzle:Columns"),l=Symbol.for("drizzle:ExtraConfigColumns"),o=Symbol.for("drizzle:OriginalName"),c=Symbol.for("drizzle:BaseName"),u=Symbol.for("drizzle:IsAlias"),h=Symbol.for("drizzle:ExtraConfigBuilder"),d=Symbol.for("drizzle:IsDrizzleTable");class f{static [s.i]="Table";static Symbol={Name:r.E,Schema:n,OriginalName:o,Columns:a,ExtraConfigColumns:l,BaseName:c,IsAlias:u,ExtraConfigBuilder:h};[r.E];[o];[n];[a];[l];[c];[u]=!1;[d]=!0;[h]=void 0;constructor(e,t,i){this[r.E]=this[o]=e,this[n]=t,this[c]=i}}function m(e){return e[r.E]}function p(e){return`${e[n]??"public"}.${e[r.E]}`}},29395:(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")},36254:(e,t,i)=>{i.d(t,{Am:()=>a,Wx:()=>n});var s=i(29395),r=i(27399);function n(e,t){return`${e[r.E]}_${t.join("_")}_unique`}function a(e){return new o(e)}class l{constructor(e,t){this.name=t,this.columns=e}static [s.i]="SQLiteUniqueConstraintBuilder";columns;build(e){return new c(e,this.columns,this.name)}}class o{static [s.i]="SQLiteUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new l(e,this.name)}}class c{constructor(e,t,i){this.table=e,this.columns=t,this.name=i??n(this.table,this.columns.map(e=>e.name))}static [s.i]="SQLiteUniqueConstraint";columns;name;getName(){return this.name}}},42525:(e,t,i)=>{i.d(t,{n:()=>s});let s=Symbol.for("drizzle:ViewBaseConfig")},42848:(e,t,i)=>{i.d(t,{Q:()=>r});var s=i(29395);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)}}},60169:(e,t,i)=>{i.d(t,{v:()=>h,o:()=>u});var s=i(42848),r=i(17394),n=i(29395),a=i(27399);class l{static [n.i]="SQLiteForeignKeyBuilder";reference;
1_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`}}var c=i(36254);class u 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 h extends r.V{constructor(e,t){t.uniqueName||(t.uniqueName=(0,c.Wx)(e,[t.name])),super(e,t),this.table=e}static [n.i]="SQLiteColumn"}},64101:(e,t,i)=>{i.d(t,{nd:()=>p});var s=i(29395),r=i(75699),n=i(18929),a=i(60169);class l extends a.o{static [s.i]="SQLiteBaseIntegerBuilder";constructor(e,t,i){super(e,t,i),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}}class o extends a.v{static [s.i]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}}class c extends l{static [s.i]="SQLiteIntegerBuilder";constructor(e){super(e,"number","SQLiteInteger")}build(e){return new u(e,this.config)}}class u extends o{static [s.i]="SQLiteInteger"}class h extends l{static [s.i]="SQLiteTimestampBuilder";constructor(e,t){super(e,"date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default((0,r.ll)`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new d(e,this.config)}}class d extends o{static [s.i]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(e){return new Date("timestamp"===this.config.mode?1e3*e:e)}mapToDriverValue(e){let t=e.getTime();return"timestamp"===this.config.mode?Math.floor(t/1e3):t}}class f extends l{static [s.i]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new m(e,this.config)}}class m extends o{static [s.i]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(e){return 1===Number(e)}mapToDriverValue(e){return+!!e}}function p(e,t){let{name:i,config:s}=(0,n.Ll)(e,t);return s?.mode==="timestamp"||s?.mode==="timestamp_ms"?new h(i,s.mode):s?.mode==="boolean"?new f(i,s.mode):new c(i)}},67660:(e,t,i)=>{i.d(t,{f:()=>eb});var s=i(29395);class r{static [s.i]="ConsoleLogWriter";write(e){console.log(e)}}class n{static [s.i]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new r}logQuery(e,t){let i=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),s=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${s}`)}}class a{static [s.i]="NoopLogger";logQuery(){}}var l=i(17209),o=i(17394),c=i(75699),u=i(28824),h=i(42525);class d{constructor(e){this.table=e}static [s.i]="ColumnAliasProxyHandler";get(e,t){return"table"===t?this.table:e[t]}}class f{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static [s.i]="TableAliasProxyHandler";get(e,t){if(t===u.XI.Symbol.IsAlias)return!0;if(t===u.XI.Symbol.Name||this.replaceOriginalName&&t===u.XI.Symbol.OriginalName)return this.alias;if(t===h.n)return{...e[h.n],name:this.alias,isAlias:!0};if(t===u.XI.Symbol.Columns){let t=e[u.XI.Symbol.Columns];if(!t)return t;let i={};return Object.keys(t).map(s=>{i[s]=new Proxy(t[s],new d(new Proxy(e,this)))}),i}let i=e[t];return(0,s.is)(i,o.V)?new Proxy(i,new d(new Proxy(e,this))):i}}class m{constructor(e){this.alias=e}static [s.i]=null;get(e,t){return"sourceTable"===t?p(e.sourceTable,this.alias):e[t]}}function p(e,t){return new Proxy(e,new f(t,!1))}function y(e,t){return new Proxy(e,new d(new Proxy(e.table,new f(t,!1))))}function g(e,t){return new c.Xs.Aliased(b(e.sql,t),e.fieldAlias)}function b(e,t){return c.ll.join(e.queryChunks.map(e=>(0,s.is)(e,o.V)?y(e,t):(0,s.is)(e,c.Xs)?b(e,t):(0,s.is)(e,c.Xs.Aliased)?g(e,t):e))}var w=i(7062);class S{static [s.i]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if("_"===t)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===h.n)return{...e[h.n],selectedFields:new Proxy(e[h.n].selectedFields,this)};if("symbol"==typeof t)return e[t];let i=((0,s.is)(e,w.n)?e._.selectedFields:(0,s.is)(e,c.Ss)?e[h.n].selectedFields:e)[t];if((0,s.is)(i,c.Xs.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!i.isSelectionField)return i.sql;let e=i.clone();return e.isSelectionField=!0,e}
1if((0,s.is)(i,c.Xs)){if("sql"===this.config.sqlBehavior)return i;throw Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return(0,s.is)(i,o.V)?this.config.alias?new Proxy(i,new d(new Proxy(i.table,new f(this.config.alias,this.config.replaceOriginalName??!1)))):i:"object"!=typeof i||null===i?i:new Proxy(i,new S(this.config))}}function v(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function C(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,i)=>e+(0===i?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}function A(e){return e}class E{static [s.i]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert="snake_case"===e?v:"camelCase"===e?C:A}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[u.XI.Symbol.Schema]??"public",i=e.table[u.XI.Symbol.OriginalName],s=`${t}.${i}.${e.name}`;return this.cache[s]||this.cacheTable(e.table),this.cache[s]}cacheTable(e){let t=e[u.XI.Symbol.Schema]??"public",i=e[u.XI.Symbol.OriginalName],s=`${t}.${i}`;if(!this.cachedTables[s]){for(let t of Object.values(e[u.XI.Symbol.Columns])){let e=`${s}.${t.name}`;this.cache[e]=this.convert(t.name)}this.cachedTables[s]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class T extends Error{static [s.i]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}}class $ extends Error{constructor(e,t,i){super(`Failed query: ${e} 2params: ${t}`),this.query=e,this.params=t,this.cause=i,Error.captureStackTrace(this,$),i&&(this.cause=i)}}class N extends T{static [s.i]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}var L=i(18035),x=i(60169),Q=i(85631),I=i(18929);class q extends c.Ss{static [s.i]="SQLiteViewBase"}class O{static [s.i]="SQLiteDialect";casing;constructor(e){this.casing=new E(e?.casing)}escapeName(e){return`"${e}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[(0,c.ll)`with `];for(let[i,s]of e.entries())t.push((0,c.ll)`${c.ll.identifier(s._.alias)} as (${s._.sql})`),i<e.length-1&&t.push((0,c.ll)`, `);return t.push((0,c.ll)` `),c.ll.join(t)}buildDeleteQuery({table:e,where:t,returning:i,withList:s,limit:r,orderBy:n}){let a=this.buildWithCTE(s),l=i?(0,c.ll)` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,o=t?(0,c.ll)` where ${t}`:void 0,u=this.buildOrderBy(n),h=this.buildLimit(r);return(0,c.ll)`${a}delete from ${e}${o}${l}${u}${h}`}buildUpdateSet(e,t){let i=e[u.XI.Symbol.Columns],s=Object.keys(i).filter(e=>void 0!==t[e]||i[e]?.onUpdateFn!==void 0),r=s.length;return c.ll.join(s.flatMap((e,s)=>{let n=i[e],a=t[e]??c.ll.param(n.onUpdateFn(),n),l=(0,c.ll)`${c.ll.identifier(this.casing.getColumnCasing(n))} = ${a}`;return s<r-1?[l,c.ll.raw(", ")]:[l]}))}buildUpdateQuery({table:e,set:t,where:i,returning:s,withList:r,joins:n,from:a,limit:l,orderBy:o}){let u=this.buildWithCTE(r),h=this.buildUpdateSet(e,t),d=a&&c.ll.join([c.ll.raw(" from "),this.buildFromTable(a)]),f=this.buildJoins(n),m=s?(0,c.ll)` returning ${this.buildSelection(s,{isSingleTable:!0})}`:void 0,p=i?(0,c.ll)` where ${i}`:void 0,y=this.buildOrderBy(o),g=this.buildLimit(l);return(0,c.ll)`${u}update ${e} set ${h}${d}${f}${p}${m}${y}${g}`}buildSelection(e,{isSingleTable:t=!1}={}){let i=e.length,r=e.flatMap(({field:e},r)=>{let n=[];if((0,s.is)(e,c.Xs.Aliased)&&e.isSelectionField)n.push(c.ll.identifier(e.fieldAlias));else if((0,s.is)(e,c.Xs.Aliased)||(0,s.is)(e,c.Xs)){let i=(0,s.is)(e,c.Xs.Aliased)?e.sql:e;t?n.push(new c.Xs(i.queryChunks.map(e=>(0,s.is)(e,o.V)?c.ll.identifier(this.casing.getColumnCasing(e)):e))):n.push(i),(0,s.is)(e,c.Xs.Aliased)&&n.push((0,c.ll)` as ${c.ll.identifier(e.fieldAlias)}`)}else if((0,s.is)(e,o.V)){let i=e.table[u.XI.Symbol.Name];"SQLiteNumericBigInt"===e.columnType?t?n.push((0,c.ll)`cast(${c.ll.identifier(this.casing.getColumnCasing(e))} as text)`):n.push((0,c.ll)`cast(${c.ll.identifier(i)}.${c.ll.identifier(this.casing.getColumnCasing(e))} as text)`):t?n.push(c.ll.identifier(this.casing.getColumnCasing(e))):n.push((0,c.ll)`${c.ll.identifier(i)}.${c.ll.identifier(this.casing.getColumnCasing(e))}`)}return r<i-1&&n.push((0,c.ll)`, `),n});return c.ll.join(r)}buildJoins(e){if(!e||0===e.length)return;let t=[];if(e)for(let[i,r]of e.entries()){0===i&&t.push((0,c.ll)` `);let n=r.table,a=r.on?(0,c.ll)` on ${r.on}`:void 0;if((0,s.is)(n,Q.jo)){let e=n[Q.jo.Symbol.Name],i=n[Q.jo.Symbol.Schema],s=n[Q.jo.Symbol.OriginalName],l=e===s?void 0:r.alias;t.push((0,c.ll)`${c.ll.raw(r.joinType)} join ${i?(0,c.ll)`${c.ll.identifier(i)}.`:void 0}${c.ll.identifier(s)}${l&&(0,c.ll)` ${c.ll.identifier(l)}`}${a}
2`)}else t.push((0,c.ll)`${c.ll.raw(r.joinType)} join ${n}${a}`);i<e.length-1&&t.push((0,c.ll)` `)}return c.ll.join(t)}buildLimit(e){return"object"==typeof e||"number"==typeof e&&e>=0?(0,c.ll)` limit ${e}`:void 0}buildOrderBy(e){let t=[];if(e)for(let[i,s]of e.entries())t.push(s),i<e.length-1&&t.push((0,c.ll)`, `);return t.length>0?(0,c.ll)` order by ${c.ll.join(t)}`:void 0}buildFromTable(e){return(0,s.is)(e,u.XI)&&e[u.XI.Symbol.IsAlias]?(0,c.ll)`${(0,c.ll)`${c.ll.identifier(e[u.XI.Symbol.Schema]??"")}.`.if(e[u.XI.Symbol.Schema])}${c.ll.identifier(e[u.XI.Symbol.OriginalName])} ${c.ll.identifier(e[u.XI.Symbol.Name])}`:e}buildSelectQuery({withList:e,fields:t,fieldsFlat:i,where:r,having:n,table:a,joins:l,orderBy:d,groupBy:f,limit:m,offset:p,distinct:y,setOperators:g}){let b=i??(0,I.He)(t);for(let e of b){let t;if((0,s.is)(e.field,o.V)&&(0,u.Io)(e.field.table)!==((0,s.is)(a,w.n)?a._.alias:(0,s.is)(a,q)?a[h.n].name:(0,s.is)(a,c.Xs)?void 0:(0,u.Io)(a))&&(t=e.field.table,!l?.some(({alias:e})=>e===(t[u.XI.Symbol.IsAlias]?(0,u.Io)(t):t[u.XI.Symbol.BaseName])))){let t=(0,u.Io)(e.field.table);throw Error(`Your "${e.path.join("->")}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}}let S=!l||0===l.length,v=this.buildWithCTE(e),C=y?(0,c.ll)` distinct`:void 0,A=this.buildSelection(b,{isSingleTable:S}),E=this.buildFromTable(a),T=this.buildJoins(l),$=r?(0,c.ll)` where ${r}`:void 0,N=n?(0,c.ll)` having ${n}`:void 0,L=[];if(f)for(let[e,t]of f.entries())L.push(t),e<f.length-1&&L.push((0,c.ll)`, `);let x=L.length>0?(0,c.ll)` group by ${c.ll.join(L)}`:void 0,Q=this.buildOrderBy(d),O=this.buildLimit(m),_=p?(0,c.ll)` offset ${p}`:void 0,D=(0,c.ll)`${v}select${C} ${A} from ${E}${T}${$}${x}${N}${Q}${O}${_}`;return g.length>0?this.buildSetOperations(D,g):D}buildSetOperations(e,t){let[i,...s]=t;if(!i)throw Error("Cannot pass undefined values to any set operator");return 0===s.length?this.buildSetOperationQuery({leftSelect:e,setOperator:i}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:i}),s)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:i,rightSelect:r,limit:n,orderBy:a,offset:l}}){let o,u=(0,c.ll)`${e.getSQL()} `,h=(0,c.ll)`${r.getSQL()}`;if(a&&a.length>0){let e=[];for(let t of a)if((0,s.is)(t,x.v))e.push(c.ll.identifier(t.name));else if((0,s.is)(t,c.Xs)){for(let e=0;e<t.queryChunks.length;e++){let i=t.queryChunks[e];(0,s.is)(i,x.v)&&(t.queryChunks[e]=c.ll.identifier(this.casing.getColumnCasing(i)))}e.push((0,c.ll)`${t}`)}else e.push((0,c.ll)`${t}`);o=(0,c.ll)` order by ${c.ll.join(e,(0,c.ll)`, `)}`}let d="object"==typeof n||"number"==typeof n&&n>=0?(0,c.ll)` limit ${n}`:void 0,f=c.ll.raw(`${t} ${i?"all ":""}`),m=l?(0,c.ll)` offset ${l}`:void 0;return(0,c.ll)`${u}${f}${h}${o}${d}${m}`}buildInsertQuery({table:e,values:t,onConflict:i,returning:r,withList:n,select:a}){let l=[],o=Object.entries(e[u.XI.Symbol.Columns]).filter(([e,t])=>!t.shouldDisableInsert()),h=o.map(([,e])=>c.ll.identifier(this.casing.getColumnCasing(e)));if(a)(0,s.is)(t,c.Xs)?l.push(t):l.push(t.getSQL());else for(let[e,i]of(l.push(c.ll.raw("values ")),t.entries())){let r=[];for(let[e,t]of o){let n=i[e];if(void 0===n||(0,s.is)(n,c.Iw)&&void 0===n.value){let e;if(null!==t.default&&void 0!==t.default)e=(0,s.is)(t.default,c.Xs)?t.default:c.ll.param(t.default,t);else if(void 0!==t.defaultFn){let i=t.defaultFn();e=(0,s.is)(i,c.Xs)?i:c.ll.param(i,t)}else if(t.default||void 0===t.onUpdateFn)e=(0,c.ll)`null`;else{let i=t.onUpdateFn();e=(0,s.is)(i,c.Xs)?i:c.ll.param(i,t)}r.push(e)}else r.push(n)}l.push(r),e<t.length-1&&l.push((0,c.ll)`, `)}let d=this.buildWithCTE(n),f=c.ll.join(l),m=r?(0,c.ll)` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,p=i?.length?c.ll.join(i):void 0;return(0,c.ll)`${d}insert into ${e} ${h} ${f}${p}${m}`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:t})}buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:i,table:r,tableConfig:n,queryConfig:a,tableAlias:h,nestedQueryRelation:d,joinOn:f}){let m,S=[],v,C,A=[],E,$=[];if(!0===a)S=Object.entries(n.columns).map(([e,t])=>({dbKey:t.name,tsKey:e,field:y(t,h),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let r=Object.fromEntries(Object.entries(n.columns).map(([e,t])=>[e,y(t,h)]));if(a.where){let e="function"==typeof a.where?a.where(r,(0,l.mm)()):a.where;E=e&&b(e,h)}let d=[],f=[];if(a.columns){let e=!1;for(let[t,i]of Object.entries(a.columns))void 0!==i&&t in n.columns&&(e||!0!==i||(e=!0),f.push(t));f.length>0&&(f=e?f.filter(e=>a.columns?.[e]===!0):Object.keys(n.columns).filter(e=>!f.includes(e)))}else f=Object.keys(n.columns);for(let e of f){let t=n.columns[e];d.push({tsKey:e,value:t})}let m=[];
2if(a.with&&(m=Object.entries(a.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:n.relations[e]}))),a.extras)for(let[e,t]of Object.entries("function"==typeof a.extras?a.extras(r,{sql:c.ll}):a.extras))d.push({tsKey:e,value:g(t,h)});for(let{tsKey:e,value:t}of d)S.push({dbKey:(0,s.is)(t,c.Xs.Aliased)?t.fieldAlias:n.columns[e].name,tsKey:e,field:(0,s.is)(t,o.V)?y(t,h):t,relationTableTsKey:void 0,isJson:!1,selection:[]});let p="function"==typeof a.orderBy?a.orderBy(r,(0,l.rl)()):a.orderBy??[];for(let{tsKey:r,queryConfig:n,relation:d}of(Array.isArray(p)||(p=[p]),A=p.map(e=>(0,s.is)(e,o.V)?y(e,h):b(e,h)),v=a.limit,C=a.offset,m)){let a=(0,l.W0)(t,i,d),o=i[(0,u.Lf)(d.referencedTable)],f=`${h}_${r}`,m=(0,L.Uo)(...a.fields.map((e,t)=>(0,L.eq)(y(a.references[t],f),y(e,h)))),p=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:i,table:e[o],tableConfig:t[o],queryConfig:(0,s.is)(d,l.pD)?!0===n?{limit:1}:{...n,limit:1}:n,tableAlias:f,joinOn:m,nestedQueryRelation:d}),g=(0,c.ll)`(${p.sql})`.as(r);S.push({dbKey:r,tsKey:r,field:g,relationTableTsKey:o,isJson:!0,selection:p.selection})}}if(0===S.length)throw new T({message:`No fields selected for table "${n.tsName}" ("${h}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});if(E=(0,L.Uo)(f,E),d){let e=(0,c.ll)`json_array(${c.ll.join(S.map(({field:e})=>(0,s.is)(e,x.v)?c.ll.identifier(this.casing.getColumnCasing(e)):(0,s.is)(e,c.Xs.Aliased)?e.sql:e),(0,c.ll)`, `)})`;(0,s.is)(d,l.iv)&&(e=(0,c.ll)`coalesce(json_group_array(${e}), json_array())`);let t=[{dbKey:"data",tsKey:"data",field:e.as("data"),isJson:!0,relationTableTsKey:n.tsName,selection:S}];void 0!==v||void 0!==C||A.length>0?(m=this.buildSelectQuery({table:p(r,h),fields:{},fieldsFlat:[{path:[],field:c.ll.raw("*")}],where:E,limit:v,offset:C,orderBy:A,setOperators:[]}),E=void 0,v=void 0,C=void 0,A=void 0):m=p(r,h),m=this.buildSelectQuery({table:(0,s.is)(m,Q.jo)?m:new w.n(m,{},h),fields:{},fieldsFlat:t.map(({field:e})=>({path:[],field:(0,s.is)(e,o.V)?y(e,h):e})),joins:$,where:E,limit:v,offset:C,orderBy:A,setOperators:[]})}else m=this.buildSelectQuery({table:p(r,h),fields:{},fieldsFlat:S.map(({field:e})=>({path:[],field:(0,s.is)(e,o.V)?y(e,h):e})),joins:$,where:E,limit:v,offset:C,orderBy:A,setOperators:[]});return{tableTsKey:n.tsName,sql:m,selection:S}}}class _ extends O{static [s.i]="SQLiteSyncDialect";migrate(e,t,i){let s=void 0===i||"string"==typeof i?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",r=(0,c.ll)` 3 CREATE TABLE IF NOT EXISTS ${c.ll.identifier(s)} ( 4 id SERIAL PRIMARY KEY, 5 hash text NOT NULL, 6 created_at numeric 7 ) 8 `;t.run(r);let n=t.values((0,c.ll)`SELECT id, hash, created_at FROM ${c.ll.identifier(s)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;t.run((0,c.ll)`BEGIN`);try{for(let i of e)if(!n||Number(n[2])<i.folderMillis){for(let e of i.sql)t.run(c.ll.raw(e));t.run((0,c.ll)`INSERT INTO ${c.ll.identifier(s)} ("hash", "created_at") VALUES(${i.hash}, ${i.folderMillis})`)}t.run((0,c.ll)`COMMIT`)}catch(e){throw t.run((0,c.ll)`ROLLBACK`),e}}}class D extends O{static [s.i]="SQLiteAsyncDialect";async migrate(e,t,i){let s=void 0===i||"string"==typeof i?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",r=(0,c.ll)` 9 CREATE TABLE IF NOT EXISTS ${c.ll.identifier(s)} ( 10 id SERIAL PRIMARY KEY, 11 hash text NOT NULL, 12 created_at numeric 13 ) 14 `;await t.run(r);let n=(await t.values((0,c.ll)`SELECT id, hash, created_at FROM ${c.ll.identifier(s)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await t.transaction(async t=>{for(let i of e)if(!n||Number(n[2])<i.folderMillis){for(let e of i.sql)await t.run(c.ll.raw(e));await t.run((0,c.ll)`INSERT INTO ${c.ll.identifier(s)} ("hash", "created_at") VALUES(${i.hash}, ${i.folderMillis})`)}})}}class R{static [s.i]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class P{static [s.i]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}function j(e){return(0,s.is)(e,Q.jo)?[`${e[u.XI.Symbol.BaseName]}`]:(0,s.is)(e,w.n)?e._.usedTables??[]:(0,s.is)(e,c.Xs)?e.usedTables??[]:[]}class B{static [s.i]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let t,i=!!this.fields;return t=this.fields?this.fields:(0,s.is)(e,w.n)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):(0,s.is)(e,q)?e[h.n].selectedFields:(0,s.is)(e,c.Xs)?{}:(0,I.YD)(e),new K({table:e,fields:t,isPartialSelect:i,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}}class k extends R{static [s.i]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:i,session:s,dialect:r,withList:n,distinct:a}){for(let l of(super(),this.config={withList:n,table:e,fields:{...t},distinct:a,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=r,this._={selectedFields:t,config:this.config},this.tableName=(0,I.zN)(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{},j(e)))this.usedTables.add(l)}getUsedTables(){return[...this.usedTables]}createJoin(e){return(t,i)=>{let r=this.tableName,n=(0,I.zN)(t);for(let e of j(t))this.usedTables.add(e);if("string"==typeof n&&this.config.joins?.some(e=>e.alias===n))throw Error(`Alias "${n}" is already used in this query`);
14if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof r&&(this.config.fields={[r]:this.config.fields}),"string"==typeof n&&!(0,s.is)(t,c.Xs))){let e=(0,s.is)(t,w.n)?t._.selectedFields:(0,s.is)(t,c.Ss)?t[h.n].selectedFields:t[u.XI.Symbol.Columns];this.config.fields[n]=e}if("function"==typeof i&&(i=i(new Proxy(this.config.fields,new S({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t,joinType:e,alias:n}),"string"==typeof n)switch(e){case"left":this.joinsNotNullableMap[n]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[n]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[n]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[n]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return i=>{let s="function"==typeof i?i(M()):i;if(!(0,I.DV)(this.getSelectedFields(),s.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:s}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new S({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new S({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new S({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new S({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...j(this.config.table)),this.config.joins)for(let e of this.config.joins)t.push(...j(e.table));return new Proxy(new w.n(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new S({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new S({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class K extends k{static [s.i]="SQLiteSelect";_prepare(e=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let t=(0,I.He)(this.config.fields),i=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return i.joinsNotNullableMap=this.joinsNotNullableMap,i}$withCache(e){return this.cacheConfig=void 0===e?{config:{},enable:!0,autoInvalidate:!0}:!1===e?{enable:!1}:{enable:!0,autoInvalidate:!0,...e},this}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.all()}}function F(e,t){return(i,s,...r)=>{let n=[s,...r].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of n)if(!(0,I.DV)(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(n)}}(0,I.XJ)(K,[P]);let M=()=>({union:J,unionAll:X,intersect:V,except:W}),J=F("union",!1),X=F("union",!0),V=F("intersect",!1),W=F("except",!1);class U{static [s.i]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=(0,s.is)(e,O)?e:void 0,this.dialectConfig=(0,s.is)(e,O)?void 0:e}$with=(e,t)=>{let i=this;return{as:s=>("function"==typeof s&&(s=s(i)),new Proxy(new w.J(s.getSQL(),t??("getSelectedFields"in s?s.getSelectedFields()??{}:{}),e,!0),new S({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){let t=this;return{select:function(i){return new B({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(i){return new B({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}}}select(e){return new B({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new B({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new _(this.dialectConfig)),this.dialect}}class z{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s}static [s.i]="SQLiteUpdateBuilder";set(e){return new H(this.table,(0,I.q)(this.table,e),this.session,this.dialect,this.withList)}}class H extends P{constructor(e,t,i,s,r){super(),this.session=i,this.dialect=s,this.config={set:t,table:e,withList:r,joins:[]}}static [s.i]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return(t,i)=>{let r=(0,I.zN)(t);if("string"==typeof r&&this.config.joins.some(e=>e.alias===r))throw Error(`Alias "${r}" is already used in this query`);
14if("function"==typeof i){let e=this.config.from?(0,s.is)(t,Q.jo)?t[u.XI.Symbol.Columns]:(0,s.is)(t,w.n)?t._.selectedFields:(0,s.is)(t,q)?t[h.n].selectedFields:void 0:void 0;i=i(new Proxy(this.config.table[u.XI.Symbol.Columns],new S({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),e&&new Proxy(e,new S({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:i,table:t,joinType:e,alias:r}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[u.XI.Symbol.Columns],new S({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[Q.jo.Symbol.Columns]){return this.config.returning=(0,I.He)(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:j(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class G{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s}static [s.i]="SQLiteInsertBuilder";values(e){if(0===(e=Array.isArray(e)?e:[e]).length)throw Error("values() must be called with at least one value");let t=e.map(e=>{let t={},i=this.table[u.XI.Symbol.Columns];for(let r of Object.keys(e)){let n=e[r];t[r]=(0,s.is)(n,c.Xs)?n:new c.Iw(n,i[r])}return t});return new Y(this.table,t,this.session,this.dialect,this.withList)}select(e){let t="function"==typeof e?e(new U):e;if(!(0,s.is)(t,c.Xs)&&!(0,I.DV)(this.table[u.e],t._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new Y(this.table,t,this.session,this.dialect,this.withList,!0)}}class Y extends P{constructor(e,t,i,s,r,n){super(),this.session=i,this.dialect=s,this.config={table:e,values:t,withList:r,select:n}}static [s.i]="SQLiteInsert";config;returning(e=this.config.table[Q.jo.Symbol.Columns]){return this.config.returning=(0,I.He)(e),this}onConflictDoNothing(e={}){if(this.config.onConflict||(this.config.onConflict=[]),void 0===e.target)this.config.onConflict.push((0,c.ll)` on conflict do nothing`);else{let t=Array.isArray(e.target)?(0,c.ll)`${e.target}`:(0,c.ll)`${[e.target]}`,i=e.where?(0,c.ll)` where ${e.where}`:(0,c.ll)``;this.config.onConflict.push((0,c.ll)` on conflict ${t} do nothing${i}`)}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');this.config.onConflict||(this.config.onConflict=[]);let t=e.where?(0,c.ll)` where ${e.where}`:void 0,i=e.targetWhere?(0,c.ll)` where ${e.targetWhere}`:void 0,s=e.setWhere?(0,c.ll)` where ${e.setWhere}`:void 0,r=Array.isArray(e.target)?(0,c.ll)`${e.target}`:(0,c.ll)`${[e.target]}`,n=this.dialect.buildUpdateSet(this.config.table,(0,I.q)(this.config.table,e.set));return this.config.onConflict.push((0,c.ll)` on conflict ${r}${i} do update set ${n}${t}${s}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:j(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class Z extends P{constructor(e,t,i,s){super(),this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:s}}static [s.i]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.table[u.XI.Symbol.Columns],new S({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.orderBy=i}else this.config.orderBy=e;return this}limit(e){return this.config.limit=e,this}returning(e=this.table[Q.jo.Symbol.Columns]){return this.config.returning=(0,I.He)(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:j(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}class ee extends c.Xs{constructor(e){super(ee.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.session=e.session,this.sql=ee.buildCount(e.source,e.filters)}sql;static [s.i]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return(0,c.ll)`(select count(*) from ${e}${c.ll.raw(" where ").if(t)}${t})`}static buildCount(e,t){return(0,c.ll)`select count(*) from ${e}${c.ll.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}}class et{constructor(e,t,i,s,r,n,a,l){this.mode=e,this.fullSchema=t,this.schema=i,this.tableNamesMap=s,this.table=r,this.tableConfig=n,this.dialect=a,this.session=l}static [s.i]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return"sync"===this.mode?new es(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new ei(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return"sync"===this.mode?new es(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new ei(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}}class ei extends P{constructor(e,t,i,s,r,n,a,l,o){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=s,this.tableConfig=r,this.dialect=n,this.session=a,this.config=l,this.mode=o}static [s.i]="SQLiteAsyncRelationalQuery";mode;
14getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=!1){let{query:t,builtQuery:i}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](i,void 0,"first"===this.mode?"get":"all",!0,(e,i)=>{let s=e.map(e=>(0,l.I$)(this.schema,this.tableConfig,e,t.selection,i));return"first"===this.mode?s[0]:s})}prepare(){return this._prepare(!1)}_toSQL(){let e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return"first"===this.mode?this._prepare(!1).get():this._prepare(!1).all()}async execute(){return this.executeRaw()}}class es extends ei{static [s.i]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}class er extends P{constructor(e,t,i,s,r){super(),this.execute=e,this.getSQL=t,this.dialect=s,this.mapBatchResult=r,this.config={action:i}}static [s.i]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}}class en{constructor(e,t,i,s){this.resultKind=e,this.dialect=t,this.session=i,this._=s?{schema:s.schema,fullSchema:s.fullSchema,tableNamesMap:s.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};let r=this.query;if(this._.schema)for(let[n,a]of Object.entries(this._.schema))r[n]=new et(e,s.fullSchema,this._.schema,this._.tableNamesMap,s.fullSchema[n],a,t,i);this.$cache={invalidate:async e=>{}}}static [s.i]="BaseSQLiteDatabase";query;$with=(e,t)=>{let i=this;return{as:s=>("function"==typeof s&&(s=s(new U(i.dialect))),new Proxy(new w.J(s.getSQL(),t??("getSelectedFields"in s?s.getSelectedFields()??{}:{}),e,!0),new S({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return new ee({source:e,filters:t,session:this.session})}with(...e){let t=this;return{select:function(i){return new B({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e})},selectDistinct:function(i){return new B({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})},update:function(i){return new z(i,t.session,t.dialect,e)},insert:function(i){return new G(i,t.session,t.dialect,e)},delete:function(i){return new Z(i,t.session,t.dialect,e)}}}select(e){return new B({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new B({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(e){return new z(e,this.session,this.dialect)}$cache;insert(e){return new G(e,this.session,this.dialect)}delete(e){return new Z(e,this.session,this.dialect)}run(e){let t="string"==typeof e?c.ll.raw(e):e.getSQL();return"async"===this.resultKind?new er(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(t)}all(e){let t="string"==typeof e?c.ll.raw(e):e.getSQL();return"async"===this.resultKind?new er(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(t)}get(e){let t="string"==typeof e?c.ll.raw(e):e.getSQL();return"async"===this.resultKind?new er(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(t)}values(e){let t="string"==typeof e?c.ll.raw(e):e.getSQL();return"async"===this.resultKind?new er(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}}class ea{static [s.i]="Cache"}class el extends ea{strategy(){return"all"}static [s.i]="NoopCache";async get(e){}async put(e,t,i,s){}async onMutate(e){}}async function eo(e,t){let i=`${e}-${JSON.stringify(t)}`,s=new TextEncoder().encode(i);return[...new Uint8Array(await crypto.subtle.digest("SHA-256",s))].map(e=>e.toString(16).padStart(2,"0")).join("")}class ec extends P{constructor(e){super(),this.resultCb=e}static [s.i]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}}class eu{constructor(e,t,i,s,r,n){this.mode=e,this.executeMethod=t,this.query=i,this.cache=s,this.queryMetadata=r,this.cacheConfig=n,s&&"all"===s.strategy()&&void 0===n&&(this.cacheConfig={enable:!0,autoInvalidate:!0}),this.cacheConfig?.enable||(this.cacheConfig=void 0)}static [s.i]="PreparedQuery";joinsNotNullableMap;async queryWithCache(e,t,i){if(void 0===this.cache||(0,s.is)(this.cache,el)||void 0===this.queryMetadata||this.cacheConfig&&!this.cacheConfig.enable)try{return await i()}catch(i){throw new $(e,t,i)}if(("insert"===this.queryMetadata.type||"update"===this.queryMetadata.type||"delete"===this.queryMetadata.type)&&this.queryMetadata.tables.length>0)try{let[e]=await Promise.all([i(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return e}catch(i){throw new $(e,t,i)}if(!this.cacheConfig)try{return await i()}catch(i){throw new $(e,t,i)}if("select"===this.queryMetadata.type){let s=await this.cache.get(this.cacheConfig.tag??await eo(e,t),this.queryMetadata.tables,void 0!==this.cacheConfig.tag,this.cacheConfig.autoInvalidate);if(void 0===s){let s;try{s=await i()}catch(i){throw new $(e,t,i)}return await this.cache.put(this.cacheConfig.tag??await eo(e,t),s,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],void 0!==this.cacheConfig.tag,this.cacheConfig.config),s}return s}try{return await i()}catch(i){throw new $(e,t,i)}}getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw Error("Not implemented")}mapGetResult(e,t){throw Error("Not implemented")}execute(e){return"async"===this.mode?this[this.executeMethod](e):new ec(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case"run":return this.mapRunResult(e,t);case"all":return this.mapAllResult(e,t);case"get":return this.mapGetResult(e,t)}}}class eh{constructor(e){this.dialect=e}static [s.i]="SQLiteSession";prepareOneTimeQuery(e,t,i,s,r,n,a){return this.prepareQuery(e,t,i,s,r,n,a)}run(e){let t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(e){throw new T({cause:e,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(e){throw Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(e){throw Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).values()}async count(e){return(await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw Error("Not implemented")}}class ed extends en{constructor(e,t,i,s,r=0){super(e,t,i,s),this.schema=s,this.nestedIndex=r}static [s.i]="SQLiteTransaction";rollback(){throw new N}}class ef extends eh{constructor(e,t,i,s={}){super(t),this.client=e,this.schema=i,this.options=s,this.logger=s.logger??new a,this.cache=s.cache??new el}static [s.i]="SQLiteD1Session";logger;cache;prepareQuery(e,t,i,s,r,n,a){return new ey(this.client.prepare(e.sql),e,this.logger,this.cache,n,a,t,i,s,r)}async batch(e){let t=[],i=[];for(let s of e){let e=s._prepare(),r=e.getQuery();if(t.push(e),r.params.length>0)i.push(e.stmt.bind(...r.params));else{let t=e.getQuery();i.push(this.client.prepare(t.sql).bind(...t.params))}}return(await this.client.batch(i)).map((e,i)=>t[i].mapResult(e,!0))}extractRawAllValueFromBatchResult(e){return e.results}extractRawGetValueFromBatchResult(e){return e.results[0]}extractRawValuesValueFromBatchResult(e){return ep(e.results)}async transaction(e,t){let i=new em("async",this.dialect,this,this.schema);await this.run(c.ll.raw(`begin${t?.behavior?" "+t.behavior:""}`));try{let t=await e(i);return await this.run((0,c.ll)`commit`),t}catch(e){throw await this.run((0,c.ll)`rollback`),e}}}class em extends ed{static [s.i]="D1Transaction";async transaction(e){let t=`sp${this.nestedIndex}`,i=new em("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(c.ll.raw(`savepoint ${t}`));try{let s=await e(i);return await this.session.run(c.ll.raw(`release savepoint ${t}`)),s}catch(e){throw await this.session.run(c.ll.raw(`rollback to savepoint ${t}`)),e}}}function ep(e){let t=[];for(let i of e){let e=Object.keys(i).map(e=>i[e]);t.push(e)}return t}class ey extends eu{constructor(e,t,i,s,r,n,a,l,o,c){super("async",l,t,s,r,n),this.logger=i,this._isResponseInArrayMode=o,this.customResultMapper=c,this.fields=a,this.stmt=e}static [s.i]="D1PreparedQuery";customResultMapper;fields;stmt;async run(e){let t=(0,c.Ct)(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>this.stmt.bind(...t).run())}async all(e){let{fields:t,query:i,logger:s,stmt:r,customResultMapper:n}=this;if(!t&&!n){let t=(0,c.Ct)(i.params,e??{});return s.logQuery(i.sql,t),await this.queryWithCache(i.sql,t,async()=>r.bind(...t).all().then(({results:e})=>this.mapAllResult(e)))}let a=await this.values(e);return this.mapAllResult(a)}mapAllResult(e,t){return(t&&(e=ep(e.results)),this.fields||this.customResultMapper)?this.customResultMapper?this.customResultMapper(e):e.map(e=>(0,I.a6)(this.fields,e,this.joinsNotNullableMap)):e}async get(e){let{fields:t,joinsNotNullableMap:i,query:s,logger:r,stmt:n,customResultMapper:a}=this;if(!t&&!a){let t=(0,c.Ct)(s.params,e??{});return r.logQuery(s.sql,t),await this.queryWithCache(s.sql,t,async()=>n.bind(...t).all().then(({results:e})=>e[0]))}let l=await this.values(e);if(l[0])return a?a(l):(0,I.a6)(t,l[0],i)}mapGetResult(e,t){return(t&&(e=ep(e.results)[0]),this.fields||this.customResultMapper)?this.customResultMapper?this.customResultMapper([e]):(0,I.a6)(this.fields,e,this.joinsNotNullableMap):e}async values(e){let t=(0,c.Ct)(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>this.stmt.bind(...t).raw())}isResponseInArrayMode(){return this._isResponseInArrayMode}}class eg extends en{static [s.i]="D1Database";async batch(e){return this.session.batch(e)}}function eb(e,t={}){let i,s,r=new D({casing:t.casing});if(!0===t.logger?i=new n:!1!==t.logger&&(i=t.logger),t.schema){let e=(0,l._k)(t.schema,l.DZ);s={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}let a=new ef(e,r,s,{logger:i,cache:t.cache}),o=new eg("async",r,a,s);return o.$client=e,o.$cache=t.cache,o.$cache&&(o.$cache.invalidate=t.cache?.onMutate),o}},75699:(e,t,i)=>{let s,r;i.d(t,{Iw:()=>k,Or:()=>F,Xs:()=>D,DJ:()=>
14_,Ss:()=>X,Ct:()=>M,eG:()=>P,qt:()=>O,ll:()=>K});var n=i(29395),a=i(42848),l=i(17394),o=i(27399);class c{static [n.i]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";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=void 0===e?"no action":e,this}onDelete(e){return this._onDelete=void 0===e?"no action":e,this}build(e){return new u(e,this)}}class u{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [n.i]="PgForeignKey";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[o.E],...s,i[0].table[o.E],...r];return e??`${n.join("_")}_fk`}}function h(e,...t){return e(...t)}function d(e,t){return`${e[o.E]}_${t.join("_")}_unique`}class f{constructor(e,t){this.name=t,this.columns=e}static [n.i]=null;columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new p(e,this.columns,this.nullsNotDistinctConfig,this.name)}}class m{static [n.i]=null;name;constructor(e){this.name=e}on(...e){return new f(e,this.name)}}class p{constructor(e,t,i,s){this.table=e,this.columns=t,this.name=s??d(this.table,this.columns.map(e=>e.name)),this.nullsNotDistinct=i}static [n.i]=null;columns;name;nullsNotDistinct=!1;getName(){return this.name}}function y(e,t,i){for(let s=t;s<e.length;s++){let r=e[s];if("\\"===r){s++;continue}if('"'===r)return[e.slice(t,s).replace(/\\/g,""),s+1];if(!i&&(","===r||"}"===r))return[e.slice(t,s).replace(/\\/g,""),s]}return[e.slice(t).replace(/\\/g,""),e.length]}class g extends a.Q{foreignKeyConfigs=[];static [n.i]="PgColumnBuilder";array(e){return new v(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:s})=>h((i,s)=>{let r=new c(()=>({columns:[e],foreignColumns:[i()]}));return s.onUpdate&&r.onUpdate(s.onUpdate),s.onDelete&&r.onDelete(s.onDelete),r.build(t)},i,s))}buildExtraConfigColumn(e){return new w(e,this.config)}}class b extends l.V{constructor(e,t){t.uniqueName||(t.uniqueName=d(e,[t.name])),super(e,t),this.table=e}static [n.i]="PgColumn"}class w extends b{static [n.i]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}}class S{static [n.i]=null;constructor(e,t,i,s){this.name=e,this.keyAsName=t,this.type=i,this.indexConfig=s}name;keyAsName;type;indexConfig}class v extends g{static [n.i]="PgArrayBuilder";constructor(e,t,i){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=i}build(e){let t=this.config.baseBuilder.build(e);return new C(e,this.config,t)}}class C extends b{constructor(e,t,i,s){super(e,t),this.baseColumn=i,this.range=s,this.size=t.size}size;static [n.i]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${"number"==typeof this.size?this.size:""}]`}mapFromDriverValue(e){return"string"==typeof e&&(e=function(e){let[t]=function e(t,i=0){let s=[],r=i,n=!1;for(;r<t.length;){let a=t[r];if(","===a){(n||r===i)&&s.push(""),n=!0,r++;continue}if(n=!1,"\\"===a){r+=2;continue}if('"'===a){let[e,i]=y(t,r+1,!0);s.push(e),r=i;continue}if("}"===a)return[s,r+1];if("{"===a){let[i,n]=e(t,r+1);s.push(i),r=n;continue}let[l,o]=y(t,r,!1);s.push(l),r=o}return[s,r]}(e,1);return t}(e)),e.map(e=>this.baseColumn.mapFromDriverValue(e))}mapToDriverValue(e,t=!1){let i=e.map(e=>null===e?null:(0,n.is)(this.baseColumn,C)?this.baseColumn.mapToDriverValue(e,!0):this.baseColumn.mapToDriverValue(e));return t?i:function e(t){return`{${t.map(t=>Array.isArray(t)?e(t):"string"==typeof t?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}(i)}}class A extends g{static [n.i]="PgEnumObjectColumnBuilder";constructor(e,t){super(e,"string","PgEnumObjectColumn"),this.config.enum=t}build(e){return new E(e,this.config)}}class E extends b{static [n.i]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}let T=Symbol.for("drizzle:isPgEnum");class $ extends g{static [n.i]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn"),this.config.enum=t}build(e){return new N(e,this.config)}}class N extends b{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 L=i(7062);let x={startActiveSpan:(e,t)=>s?(r||(r=s.trace.getTracer("drizzle-orm","0.44.7")),h((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 Q=i(42525),I=i(28824);class q{static [n.i]=null}function O(e){return null!=e&&"function"==typeof e.getSQL}class _{static [n.i]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new D([this])}}class D{constructor(e){for(let t of(this.queryChunks=e,e))if((0,n.is)(t,I.XI)){let e=t[I.XI.Symbol.Schema];this.usedTables.push(void 0===e?t[I.XI.Symbol.Name]:e+"."+t[I.XI.Symbol.Name])}}static [n.i]="SQL";decoder=j;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return x.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:c,paramStartIndex:u}=i;var h=e.map(e=>{if((0,n.is)(e,_))return{sql:e.value.join(""),params:[]};if((0,n.is)(e,R))return{sql:r(e.value),params:[]};if(void 0===e)return{sql:"",params:[]};if(Array.isArray(e)){let t=[new _("(")];for(let[i,s]of e.entries())t.push(s),i<e.length-1&&t.push(new _(", "));return t.push(new _(")")),this.buildQueryFromSourceParams(t,i)}if((0,n.is)(e,D))return this.buildQueryFromSourceParams(e.queryChunks,{...i,inlineParams:c||e.shouldInlineParams});if((0,n.is)(e,I.XI)){let t=e[I.XI.Symbol.Schema],i=e[I.XI.Symbol.Name];return{sql:void 0===t||e[I.HE]?r(i):r(t)+"."+r(i),params:[]}}if((0,n.is)(e,l.V)){let i=s.getColumnCasing(e);if("indexes"===t.invokeSource)return{sql:r(i),params:[]};let n=e.table[I.XI.Symbol.Schema];return{sql:e.table[I.HE]||void 0===n?r(e.table[I.XI.Symbol.Name])+"."+r(i):r(n)+"."+r(e.table[I.XI.Symbol.Name])+"."+r(i),params:[]}}if((0,n.is)(e,X)){let t=e[Q.n].schema,i=e[Q.n].name;return{sql:void 0===t||e[Q.n].isAlias?r(i):r(t)+"."+r(i),params:[]}}if((0,n.is)(e,k)){if((0,n.is)(e.value,F))return{sql:a(u.value++,e),params:[e],typings:["none"]};let t=null===e.value?null:e.encoder.mapToDriverValue(e.value);if((0,n.is)(t,D))return this.buildQueryFromSourceParams([t],i);if(c)return{sql:this.mapInlineParam(t,i),params:[]};let s=["none"];return o&&(s=[o(e.encoder)]),{sql:a(u.value++,t),params:[t],typings:s}}return(0,n.is)(e,F)?{sql:a(u.value++,e),params:[e],typings:["none"]}:(0,n.is)(e,D.Aliased)&&void 0!==e.fieldAlias?{sql:r(e.fieldAlias),params:[]}:(0,n.is)(e,L.n)?e._.isWith?{sql:r(e._.alias),params:[]}:this.buildQueryFromSourceParams([new _("("),e._.sql,new _(") "),new R(e._.alias)],i):e&&"function"==typeof e&&T in e&&!0===e[T]?e.schema?{sql:r(e.schema)+"."+r(e.enumName),params:[]}:{sql:r(e.enumName),params:[]}:O(e)?e.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([e.getSQL()],i):this.buildQueryFromSourceParams([new _("("),e.getSQL(),new _(")")],i):c?{sql:this.mapInlineParam(e,i),params:[]}:{sql:a(u.value++,e),params:[e],typings:["none"]}});let d={sql:"",params:[]};for(let e of h)d.sql+=e.sql,d.params.push(...e.params),e.typings?.length&&(d.typings||(d.typings=[]),d.typings.push(...e.typings));return d}mapInlineParam(e,{escapeString:t}
14){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 D.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 R{constructor(e){this.value=e}static [n.i]="Name";brand;getSQL(){return new D([this])}}function P(e){return"object"==typeof e&&null!==e&&"mapToDriverValue"in e&&"function"==typeof e.mapToDriverValue}let j={mapFromDriverValue:e=>e},B={mapToDriverValue:e=>e};({...j,...B});class k{constructor(e,t=B){this.value=e,this.encoder=t}static [n.i]="Param";brand;getSQL(){return new D([this])}}function K(e,...t){let i=[];for(let[s,r]of((t.length>0||e.length>0&&""!==e[0])&&i.push(new _(e[0])),t.entries()))i.push(r,new _(e[s+1]));return new D(i)}(e=>{e.empty=function(){return new D([])},e.fromList=function(e){return new D(e)},e.raw=function(e){return new D([new _(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 D(i)},e.identifier=function(e){return new R(e)},e.placeholder=function(e){return new F(e)},e.param=function(e,t){return new k(e,t)}})(K||(K={})),(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})(D||(D={}));class F{constructor(e){this.name=e}static [n.i]="Placeholder";getSQL(){return new D([this])}}function M(e,t){return e.map(e=>{if((0,n.is)(e,F)){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,F)){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})}let J=Symbol.for("drizzle:IsDrizzleView");class X{static [n.i]="View";[Q.n];[J]=!0;constructor({name:e,schema:t,selectedFields:i,query:s}){this[Q.n]={name:e,originalName:e,schema:t,selectedFields:i,query:s,isExisting:!s,isAlias:!1}}getSQL(){return new D([this])}}l.V.prototype.getSQL=function(){return new D([this])},I.XI.prototype.getSQL=function(){return new D([this])},L.n.prototype.getSQL=function(){return new D([this])}},75716:(e,t,i)=>{i.d(t,{DM:()=>n});var s=i(20434);let r=Symbol.for("__cloudflare-context__");function n(e={async:!1}){return e.async?o():function(){let e=a();if(e)return e;if(l())throw Error("\n\nERROR: `getCloudflareContext` has been called in sync mode in either a static route or at the top level of a non-static one, both cases are not allowed but can be solved by either:\n - make sure that the call is not at the top level and that the route is not static\n - call `getCloudflareContext({async: true})` to use the `async` mode\n - avoid calling `getCloudflareContext` in the route\n");throw Error(u)}()}function a(){return globalThis[r]}function l(){let e=globalThis;return e.__NEXT_DATA__?.nextExport===!0}async function o(){let e=a();if(e)return e;if(l()){var t;let e=await c();return t=e,globalThis[r]=t,e}throw Error(u)}async function c(e){let{getPlatformProxy:t}=await import(`${"__wrangler".replaceAll("_","")}`),i=e?.environment??s.env.NEXT_DEV_WRANGLER_ENV,{env:r,cf:n,ctx:a}=await t({...e,environment:i});return{env:r,cf:n,ctx:a}}let u='\n\nERROR: `getCloudflareContext` has been called without having called `initOpenNextCloudflareForDev` from the Next.js config file.\nYou should update your Next.js config file as shown below:\n\n ```\n // next.config.mjs\n\n import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";\n\n initOpenNextCloudflareForDev();\n\n const nextConfig = { ... };\n export default nextConfig;\n ```\n\n'},81008:(e,t,i)=>{i.d(t,{ie:()=>n});var s=i(29395),r=i(85631);function n(...e){return e[0].columns?new a(e[0].columns,e[0].name):new a(e)}class a{static [s.i]="SQLitePrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new l(e,this.columns,this.name)}}class l{constructor(e,t,i){this.table=e,this.columns=t,this.name=i}static [s.i]="SQLitePrimaryKey";columns;name;getName(){return this.name??`${this.table[r.jo.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}},85631:(e,t,i)=>{i.d(t,{jo:()=>x,D:()=>Q});var s=i(29395),r=i(28824),n=i(18929),a=i(60169),l=i(36946).Buffer;class o extends a.o{static [s.i]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint","SQLiteBigInt")}build(e){return new c(e,this.config)}}class c extends a.v{static [s.i]="SQLiteBigInt";
14getSQLType(){return"blob"}mapFromDriverValue(e){return void 0!==l&&l.from?BigInt((l.isBuffer(e)?e:e instanceof ArrayBuffer?l.from(e):e.buffer?l.from(e.buffer,e.byteOffset,e.byteLength):l.from(e)).toString("utf8")):BigInt(n.su.decode(e))}mapToDriverValue(e){return l.from(e.toString())}}class u extends a.o{static [s.i]="SQLiteBlobJsonBuilder";constructor(e){super(e,"json","SQLiteBlobJson")}build(e){return new h(e,this.config)}}class h extends a.v{static [s.i]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(e){return void 0!==l&&l.from?JSON.parse((l.isBuffer(e)?e:e instanceof ArrayBuffer?l.from(e):e.buffer?l.from(e.buffer,e.byteOffset,e.byteLength):l.from(e)).toString("utf8")):JSON.parse(n.su.decode(e))}mapToDriverValue(e){return l.from(JSON.stringify(e))}}class d extends a.o{static [s.i]="SQLiteBlobBufferBuilder";constructor(e){super(e,"buffer","SQLiteBlobBuffer")}build(e){return new f(e,this.config)}}class f extends a.v{static [s.i]="SQLiteBlobBuffer";mapFromDriverValue(e){return l.isBuffer(e)?e:l.from(e)}getSQLType(){return"blob"}}function m(e,t){let{name:i,config:s}=(0,n.Ll)(e,t);return s?.mode==="json"?new u(i):s?.mode==="bigint"?new o(i):new d(i)}class p 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 y(e,this.config)}}class y 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 p(s,r,e)}}var b=i(64101);class w extends a.o{static [s.i]="SQLiteNumericBuilder";constructor(e){super(e,"string","SQLiteNumeric")}build(e){return new S(e,this.config)}}class S extends a.v{static [s.i]="SQLiteNumeric";mapFromDriverValue(e){return"string"==typeof e?e:String(e)}getSQLType(){return"numeric"}}class v extends a.o{static [s.i]="SQLiteNumericNumberBuilder";constructor(e){super(e,"number","SQLiteNumericNumber")}build(e){return new C(e,this.config)}}class C extends a.v{static [s.i]="SQLiteNumericNumber";mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}mapToDriverValue=String;getSQLType(){return"numeric"}}class A extends a.o{static [s.i]="SQLiteNumericBigIntBuilder";constructor(e){super(e,"bigint","SQLiteNumericBigInt")}build(e){return new E(e,this.config)}}class E extends a.v{static [s.i]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}function T(e,t){let{name:i,config:s}=(0,n.Ll)(e,t),r=s?.mode;return"number"===r?new v(i):"bigint"===r?new A(i):new w(i)}var $=i(10081),N=i(11878);let L=Symbol.for("drizzle:SQLiteInlineForeignKeys");class x extends r.XI{static [s.i]="SQLiteTable";static Symbol=Object.assign({},r.XI.Symbol,{InlineForeignKeys:L});[r.XI.Symbol.Columns];[L]=[];[r.XI.Symbol.ExtraConfigBuilder]=void 0}let Q=(e,t,i)=>(function(e,t,i,s,n=e){let a=new x(e,void 0,n),l=Object.fromEntries(Object.entries("function"==typeof t?t({blob:m,customType:g,integer:b.nd,numeric:T,real:$.x,text:N.Qq}):t).map(([e,t])=>{t.setName(e);let i=t.build(a);return a[L].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[x.Symbol.ExtraConfigBuilder]=i),o})(e,t,i)},86739:(e,t,i)=>{i.d(t,{_:()=>s});function s(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.