"use strict";exports.id=3938,exports.ids=[3938],exports.modules={83938:(a,b,c)=>{c.d(b,{D1SqliteDialect:()=>l});var d=c(4375),e=c(47291),f=c(77296),g=class extends d.U{},h=class{#a;#b;constructor(a){this.#a={...a}}async init(){this.#b=new i(this.#a.database),this.#a.onCreateConnection&&await this.#a.onCreateConnection(this.#b)}async acquireConnection(){return this.#b}async beginTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async commitTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async rollbackTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async releaseConnection(){}async destroy(){}},i=class{#c;constructor(a){this.#c=a}async executeQuery(a){let b=await this.#c.prepare(a.sql).bind(...a.parameters).all(),c=null!=b.meta.changes?BigInt(b.meta.changes):void 0;return{insertId:void 0===b.meta.last_row_id||null===b.meta.last_row_id?void 0:BigInt(b.meta.last_row_id),rows:b?.results||[],numAffectedRows:c}}async *streamQuery(){throw Error("D1 does not support streaming queries.")}},j=class{#c;#d;constructor(a,b){this.#c=a,this.#d=b}async getSchemas(){return[]}async getTables(a={withInternalKyselyTables:!1}){let b=this.#c.selectFrom("sqlite_master").where("type","in",["table","view"]).where("name","not like","sqlite_%").where("name","not like","_cf_%").select(["name","type","sql"]).$castTo();a.withInternalKyselyTables||(b=b.where("name","!=",e.kQ).where("name","!=",e.sy));let c=await b.execute();if(0===c.length)return[];let d=c.map(a=>this.#d.prepare("SELECT * FROM pragma_table_info(?)").bind(a.name)),f=await this.#d.batch(d);return c.map((a,b)=>{let c=f[b]?.results??[],d=a.sql?.split(/[(),]/)?.find(a=>a.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.filter(Boolean)?.[0]?.replace(/["`]/g,"");if(!d){let a=c.filter(a=>a.pk>0),b=1===a.length?a[0]:void 0;b&&"integer"===b.type.toLowerCase()&&(d=b.name)}return{name:a.name,isView:"view"===a.type,columns:c.map(a=>({name:a.name,dataType:a.type,isNullable:!a.notnull,isAutoIncrementing:a.name===d,hasDefaultValue:null!=a.dflt_value}))}})}async getMetadata(a){return{tables:await this.getTables(a)}}},k=class extends f.s{},l=class{#a;constructor(a){this.#a={...a}}createDriver(){return new h(this.#a)}createQueryCompiler(){return new k}createAdapter(){return new g}createIntrospector(a){return new j(a,this.#a.database)}}}};