casualroom/apps/oa/db/generated/prisma/runtime/wasm-compiler-edge.js

84 lines
197 KiB
JavaScript
Raw Normal View History

2025-07-28 07:50:50 +08:00
/* !!! This is code generated by Prisma. Do not edit directly. !!!
/* eslint-disable */
"use strict";var au=Object.create;var Wr=Object.defineProperty;var lu=Object.getOwnPropertyDescriptor;var cu=Object.getOwnPropertyNames;var uu=Object.getPrototypeOf,pu=Object.prototype.hasOwnProperty;var fe=(e,t)=>()=>(e&&(t=e(e=0)),t);var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ut=(e,t)=>{for(var r in t)Wr(e,r,{get:t[r],enumerable:!0})},Lo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cu(t))!pu.call(e,i)&&i!==r&&Wr(e,i,{get:()=>t[i],enumerable:!(n=lu(t,i))||n.enumerable});return e};var Ae=(e,t,r)=>(r=e!=null?au(uu(e)):{},Lo(t||!e||!e.__esModule?Wr(r,"default",{value:e,enumerable:!0}):r,e)),No=e=>Lo(Wr({},"__esModule",{value:!0}),e);function si(e,t){if(t=t.toLowerCase(),t==="utf8"||t==="utf-8")return new h(gu.encode(e));if(t==="base64"||t==="base64url")return e=e.replace(/-/g,"+").replace(/_/g,"/"),e=e.replace(/[^A-Za-z0-9+/]/g,""),new h([...atob(e)].map(r=>r.charCodeAt(0)));if(t==="binary"||t==="ascii"||t==="latin1"||t==="latin-1")return new h([...e].map(r=>r.charCodeAt(0)));if(t==="ucs2"||t==="ucs-2"||t==="utf16le"||t==="utf-16le"){let r=new h(e.length*2),n=new DataView(r.buffer);for(let i=0;i<e.length;i++)n.setUint16(i*2,e.charCodeAt(i),!0);return r}if(t==="hex"){let r=new h(e.length/2);for(let n=0,i=0;i<e.length;i+=2,n++)r[n]=parseInt(e.slice(i,i+2),16);return r}Fo(`encoding "${t}"`)}function mu(e){let r=Object.getOwnPropertyNames(DataView.prototype).filter(a=>a.startsWith("get")||a.startsWith("set")),n=r.map(a=>a.replace("get","read").replace("set","write")),i=(a,f)=>function(w=0){return Y(w,"offset"),pe(w,"offset"),X(w,"offset",this.length-1),new DataView(this.buffer)[r[a]](w,f)},o=(a,f)=>function(w,v=0){let A=r[a].match(/set(\w+\d+)/)[1].toLowerCase(),R=fu[A];return Y(v,"offset"),pe(v,"offset"),X(v,"offset",this.length-1),du(w,"value",R[0],R[1]),new DataView(this.buffer)[r[a]](v,w,f),v+parseInt(r[a].match(/\d+/)[0])/8},s=a=>{a.forEach(f=>{f.includes("Uint")&&(e[f.replace("Uint","UInt")]=e[f]),f.includes("Float64")&&(e[f.replace("Float64","Double")]=e[f]),f.includes("Float32")&&(e[f.replace("Float32","Float")]=e[f])})};n.forEach((a,f)=>{a.startsWith("read")&&(e[a]=i(f,!1),e[a+"LE"]=i(f,!0),e[a+"BE"]=i(f,!1)),a.startsWith("write")&&(e[a]=o(f,!1),e[a+"LE"]=o(f,!0),e[a+"BE"]=o(f,!1)),s([a,a+"LE",a+"BE"])})}function Fo(e){throw new Error(`Buffer polyfill does not implement "${e}"`)}function Jr(e,t){if(!(e instanceof Uint8Array))throw new TypeError(`The "${t}" argument must be an instance of Buffer or Uint8Array`)}function X(e,t,r=wu+1){if(e<0||e>r){let n=new RangeError(`The value of "${t}" is out of range. It must be >= 0 && <= ${r}. Received ${e}`);throw n.code="ERR_OUT_OF_RANGE",n}}function Y(e,t){if(typeof e!="number"){let r=new TypeError(`The "${t}" argument must be of type number. Received type ${typeof e}.`);throw r.code="ERR_INVALID_ARG_TYPE",r}}function pe(e,t){if(!Number.isInteger(e)||Number.isNaN(e)){let r=new RangeError(`The value of "${t}" is out of range. It must be an integer. Received ${e}`);throw r.code="ERR_OUT_OF_RANGE",r}}function du(e,t,r,n){if(e<r||e>n){let i=new RangeError(`The value of "${t}" is out of range. It must be >= ${r} and <= ${n}. Received ${e}`);throw i.code="ERR_OUT_OF_RANGE",i}}function Uo(e,t){if(typeof e!="string"){let r=new TypeError(`The "${t}" argument must be of type string. Received type ${typeof e}`);throw r.code="ERR_INVALID_ARG_TYPE",r}}function bu(e,t="utf8"){return h.from(e,t)}var h,fu,gu,yu,hu,wu,y,ai,c=fe(()=>{"use strict";h=class e extends Uint8Array{_isBuffer=!0;get offset(){return this.byteOffset}static alloc(t,r=0,n="utf8"){return Uo(n,"encoding"),e.allocUnsafe(t).fill(r,n)}static allocUnsafe(t){return e.from(t)}static allocUnsafeSlow(t){return e.from(t)}static isBuffer(t){return t&&!!t._isBuffer}static byteLength(t,r="utf8"){if(typeof t=="string")return si(t,r).byteLength;if(t&&t.byteLength)return t.byteLength;let n=new TypeError('The "string" argument must be of type string or an instance of Buffer or ArrayBuffer.');throw n.code="ERR_INVALID_ARG_TYPE",n}static isEncoding(t){return hu.includes(t)}static compare(t,r){Jr(
`);return t.length<e?t:t.slice(-e)}function ls(){Ht.length=0}c();u();p();m();d();l();c();u();p();m();d();l();var Ju=hs(),gi=Ju.version;c();u();p();m();d();l();function ft(e){let t=Ku();return t||(e?.config.engineType==="library"?"library":e?.config.engineType==="binary"?"binary":e?.config.engineType==="client"?"client":zu(e))}function Ku(){let e=g.env.PRISMA_CLIENT_ENGINE_TYPE;return e==="library"?"library":e==="binary"?"binary":e==="client"?"client":void 0}function zu(e){return e?.previewFeatures.includes("queryCompiler")?"client":"library"}c();u();p();m();d();l();var Es="prisma+postgres",on=`${Es}:`;function sn(e){return e?.toString().startsWith(`${on}//`)??!1}function wi(e){if(!sn(e))return!1;let{host:t}=new URL(e);return t.includes("localhost")||t.includes("127.0.0.1")||t.includes("[::1]")}var zt={};ut(zt,{error:()=>ep,info:()=>Xu,log:()=>Zu,query:()=>tp,should:()=>Ts,tags:()=>Kt,warn:()=>bi});c();u();p();m();d();l();var Kt={error:dt("prisma:error"),warn:ts("prisma:warn"),info:ns("prisma:info"),query:rs("prisma:query")},Ts={warn:()=>!g.env.PRISMA_DISABLE_WARNINGS};function Zu(...e){console.log(...e)}function bi(e,...t){Ts.warn()&&console.warn(`${Kt.warn} ${e}`,...t)}function Xu(e,...t){console.info(`${Kt.info} ${e}`,...t)}function ep(e,...t){console.error(`${Kt.error} ${e}`,...t)}function tp(e,...t){console.log(`${Kt.query} ${e}`,...t)}c();u();p();m();d();l();function xe(e,t){throw new Error(t)}c();u();p();m();d();l();function xi(e,t){return Object.prototype.hasOwnProperty.call(e,t)}c();u();p();m();d();l();function yt(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}c();u();p();m();d();l();function Pi(e,t){if(e.length===0)return;let r=e[0];for(let n=1;n<e.length;n++)t(r,e[n])<0&&(r=e[n]);return r}c();u();p();m();d();l();function k(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}c();u();p();m();d();l();var Ss=new Set,Yt=(e,t,...r)=>{Ss.has(e)||(Ss.add(e),bi(t,...r))};var U=class e extends Error{clientVersion;errorCode;retryable;constructor(t,r,n){super(t),this.name="PrismaClientInitializationError",this.clientVersion=r,this.errorCode=n,Error.captureStackTrace(e)}get[Symbol.toStringTag](){return"PrismaClientInitializationError"}};k(U,"PrismaClientInitializationError");c();u();p();m();d();l();var K=class extends Error{code;meta;clientVersion;batchRequestIdx;constructor(t,{code:r,clientVersion:n,meta:i,batchRequestIdx:o}){super(t),this.name="PrismaClientKnownRequestError",this.code=r,this.clientVersion=n,this.meta=i,Object.defineProperty(this,"batchRequestIdx",{value:o,enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return"PrismaClientKnownRequestError"}};k(K,"PrismaClientKnownRequestError");c();u();p();m();d();l();var ae=class extends Error{clientVersion;constructor(t,r){super(t),this.name="PrismaClientRustPanicError",this.clientVersion=r}get[Symbol.toStringTag](){return"PrismaClientRustPanicError"}};k(ae,"PrismaClientRustPanicError");c();u();p();m();d();l();var se=class extends Error{clientVersion;batchRequestIdx;constructor(t,{clientVersion:r,batchRequestIdx:n}){super(t),this.name="PrismaClientUnknownRequestError",this.clientVersion=r,Object.defineProperty(this,"batchRequestIdx",{value:n,writable:!0,enumerable:!1})}get[Symbol.toStringTag](){return"PrismaClientUnknownRequestError"}};k(se,"PrismaClientUnknownRequestError");c();u();p();m();d();l();var ne=class extends Error{name="PrismaClientValidationError";clientVersion;constructor(t,{clientVersion:r}){super(t),this.clientVersion=r}get[Symbol.toStringTag](){return"PrismaClientValidationError"}};k(ne,"PrismaClientValidationError");c();u();p();m();d();l();l();function $e(e){return e===null?e:Array.isArray(e)?e.map($e):typeof e=="object"?np(e)?ip(e):e.constructor!==null&&e.constructor.name!=="Object"?e:yt(e,$e):e}function np(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function ip({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":{let{buffer:r,byteOffset:n,byteLength:i}=y.from(t,"base64");return new Uint8Array(r,n,i)}case"DateTime":return new Date(t);case"Decimal":return new re(t);case"Json":r
`)}function pp(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function cn(e){let t=e.showColors?ap:lp,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=cp(e),up(r,t)}c();u();p();m();d();l();var $s=Ae(vi());c();u();p();m();d();l();function Ls(e,t,r){let n=Ns(e),i=mp(n),o=fp(i);o?un(o,t,r):t.addErrorMessage(()=>"Unknown error")}function Ns(e){return e.errors.flatMap(t=>t.kind==="Union"?Ns(t):[t])}function mp(e){let t=new Map,r=[];for(let n of e){if(n.kind!=="InvalidArgumentType"){r.push(n);continue}let i=`${n.selectionPath.join(".")}:${n.argumentPath.join(".")}`,o=t.get(i);o?t.set(i,{...n,argument:{...n.argument,typeNames:dp(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function dp(e,t){return[...new Set(e.concat(t))]}function fp(e){return Pi(e,(t,r)=>{let n=_s(t),i=_s(r);return n!==i?n-i:Ms(t)-Ms(r)})}function _s(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function Ms(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}c();u();p();m();d();l();var ye=class{constructor(t,r){this.name=t;this.value=r}isRequired=!1;makeRequired(){return this.isRequired=!0,this}write(t){let{colors:{green:r}}=t.context;t.addMarginSymbol(r(this.isRequired?"+":"?")),t.write(r(this.name)),this.isRequired||t.write(r("?")),t.write(r(": ")),typeof this.value=="string"?t.write(r(this.value)):t.write(this.value)}};c();u();p();m();d();l();c();u();p();m();d();l();Fs();c();u();p();m();d();l();var bt=class{constructor(t=0,r){this.context=r;this.currentIndent=t}lines=[];currentLine="";currentIndent=0;marginSymbol;afterNextNewLineCallback;write(t){return typeof t=="string"?this.currentLine+=t:t.write(this),this}writeJoined(t,r,n=(i,o)=>o.write(i)){let i=r.length-1;for(let o=0;o<r.length;o++)n(r[o],this),o!==i&&this.write(t);return this}writeLine(t){return this.write(t).newLine()}newLine(){this.lines.push(this.indentedCurrentLine()),this.currentLine="",this.marginSymbol=void 0;let t=this.afterNextNewLineCallback;return this.afterNextNewLineCallback=void 0,t?.(),this}withIndent(t){return this.indent(),t(this),this.unindent(),this}afterNextNewline(t){return this.afterNextNewLineCallback=t,this}indent(){return this.currentIndent++,this}unindent(){return this.currentIndent>0&&this.currentIndent--,this}addMarginSymbol(t){return this.marginSymbol=t,this}toString(){return this.lines.concat(this.indentedCurrentLine()).join(`
`)}getCurrentLineLength(){return this.currentLine.length}indentedCurrentLine(){let t=this.currentLine.padStart(this.currentLine.length+2*this.currentIndent);return this.marginSymbol?this.marginSymbol+t.slice(1):t}};Us();c();u();p();m();d();l();c();u();p();m();d();l();var pn=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};c();u();p();m();d();l();var mn=e=>e,dn={bold:mn,red:mn,green:mn,dim:mn,enabled:!1},Vs={bold:Yr,red:dt,green:es,dim:Zr,enabled:!0},Et={write(e){e.writeLine(",")}};c();u();p();m();d();l();var Ie=class{constructor(t){this.contents=t}isUnderlined=!1;color=t=>t;underline(){return this.isUnderlined=!0,this}setColor(t){return this.color=t,this}write(t){let r=t.getCurrentLineLength();t.write(this.color(this.contents)),this.isUnderlined&&t.afterNextNewline(()=>{t.write(" ".repeat(r)).writeLine(this.color("~".repeat(this.contents.length)))})}};c();u();p();m();d();l();var Be=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var xt=class extends Be{items=[];addItem(t){return this.items.push(new pn(t)),this}getField(t){return this.items[t]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(r=>r.value.getPrintWidth()))+2}write(t){if(this.items.length===0){this.writeEmpty(t);return}this.writeWithItems(t)}writeEmpty(t){let r=new Ie("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined(Et,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var Pt=class e extends Be{fields={};suggestions=[];addField(t){this.fields[t.name]=t}addSuggestion(t){this.suggestions.push(t)}getField(t){return this.fields[t]}getDeepField(t){let[r,...n]=t,i=this.getField(r);if(!i)return;let o=i;for(let s of n){let a;if(o.value instanceof e?a=o.value.getField(s):o.value instanceof xt&&(a=o.value.getField(Number(s))),!a)return;o=a}return o}getDeepFieldValue(t){return t.length===0?this:this.getDeepField(t)?.value}hasField(t){return!!this.getField(t)}removeAllFields(){this.fields={}}removeField(t){delete this.fields[t]}getFields(){return this.fields}isEmpty(){return Object.keys(this.fields).length===0}getFieldValue(t){return this.getField(t)?.value}getDeepSubSelectionValue(t){let r=this;for(let n of t){if(!(r instanceof e))return;let i=r.getSubSelectionValue(n);if(!i)return;r=i}return r}getDeepSelectionParent(t){let r=this.getSelectionParent();if(!r)return;let n=r;for(let i of t){let o=n.value.getFieldValue(i);if(!o||!(o instanceof e))return;let s=o.getSelectionParent();if(!s)return;n=s}return n}getSelectionParent(){let t=this.getField("select")?.value.asObject();if(t)return{kind:"select",value:t};let r=this.getField("include")?.value.asObject();if(r)return{kind:"include",value:r}}getSubSelectionValue(t){return this.getSelectionParent()?.value.fields[t].value}getPrintWidth(){let t=Object.values(this.fields);return t.length==0?2:Math.max(...t.map(n=>n.getPrintWidth()))+2}write(t){let r=Object.values(this.fields);if(r.length===0&&this.suggestions.length===0){this.writeEmpty(t);return}this.writeWithContents(t,r)}asObject(){return this}writeEmpty(t){let r=new Ie("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined(Et,[...r,...this.suggestions]).newLine()}),t.write("}"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(t.context.colors.red("~".repeat(this.getPrintWidth())))})}};c();u();p();m();d();l();var te=class extends Be{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new Ie(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};c();u();p();m();d();l();var tr=class{fields=[];addField(t,r){return this.fields.push({write(n){let{green:i,dim:o}=n.context.colors;n.write(i(o(`${t}: ${r}`))).addMarginSymbol(i(o("+")))}}),this}write(t){let{colors:{green:r}}=t.context;t.writeLine(r("{")).withIndent((
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function hp(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){wp(e,t,i);return}if(n.hasField("select")){bp(e,t);return}}if(r?.[qe(e.outputType.name)]){Ep(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function wp(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new ye(n.name,"false"));t.addErrorMessage(n=>`The ${n.red("omit")} statement includes every field of the model ${n.bold(e.outputType.name)}. At least one field must be included in the result`)}function bp(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),js(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${nr(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function Ep(e,t){let r=new tr;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new ye("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=rr(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let f=a?.value.asObject()??new Pt;f.addSuggestion(n),a.value=f}}t.addErrorMessage(i=>`The global ${i.red("omit")} configuration excludes every field of the model ${i.bold(e.outputType.name)}. At least one field must be included in the result`)}function xp(e,t){let r=Qs(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":js(n,e.outputType);break;case"include":Op(n,e.outputType);break;case"omit":Dp(n,e.outputType);break}}t.addErrorMessage(n=>{let i=[`Unknown field ${n.red(`\`${r.fieldName}\``)}`];return r.parentKind!=="unknown"&&i.push(`for ${n.bold(r.parentKind)} statement`),i.push(`on model ${n.bold(`\`${e.outputType.name}\``)}.`),i.push(nr(n)),i.join(" ")})}function Pp(e,t){let r=Qs(e.selectionPath,t);r.parentKind!=="unknown"&&r.field.value.markAsError(),t.addErrorMessage(n=>`Invalid value for selection field \`${n.red(r.fieldName)}\`: ${e.underlyingError}`)}function Tp(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),_p(n,e.arguments)),t.addErrorMessage(i=>qs(i,r,e.arguments.map(o=>o.name)))}function vp(e,t){let[r,n]=rr(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&Hs(o,e.inputType)}t.addErrorMessage(o=>qs(o,n,e.inputType.fields.map(s=>s.name)))}function qs(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=Lp(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(nr(e)),n.join(" ")}function Ap(e,t){let r;t.addErrorMessage(f=>r?.value instanceof te&&r.value.text==="null"?`Argument \`${f.green(o)}\` must not be ${f.red("null")}.`:`Argument \`${f.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=rr(e.argumentPath),s=new tr,a=n.getDeepFieldValue(i)?.asObject();if(a)if(r=a.getField(o),r&&a.removeField(o),e.inputTypes.length===1&&e.inputTypes[0].kind==="object"){for(let f of e.inputTypes[0].fields)s.addField(f.name,f.typeNames.join(" | "));a.addSuggestion(new ye(o,s).makeRequired())}else{let f=e.inputTypes.map(Bs).join(" | ");a.addSuggestion(new ye(o,f).makeRequired())}}function Bs(e){return e.kind==="list"?`${Bs(e.elementType)}[]`:e.name}function Cp(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&n.getDeepFieldValue(e.argumentPath)?.markAsError(),t.addErrorMessage(i=>{let o=fn("or",e.argument.typeNames.map(s=>i.green(s)));return`Argument \`${i.bold(r)}\`: Invalid value provided. Expected ${o}, provided ${i.red(e.inferredType)}.`})}function Rp(e,t){let r=e
`)}};function vt(e){return new Si(Ws(e))}function Ws(e){let t=new Pt;for(let[r,n]of Object.entries(e)){let i=new hn(r,Js(n));t.addField(i)}return t}function Js(e){if(typeof e=="string")return new te(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new te(String(e));if(typeof e=="bigint")return new te(`${e}n`);if(e===null)return new te("null");if(e===void 0)return new te("undefined");if(wt(e))return new te(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return y.isBuffer(e)?new te(`Buffer.alloc(${e.byteLength})`):new te(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=ln(e)?e.toISOString():"Invalid Date";return new te(`new Date("${t}")`)}return e instanceof Le?new te(`Prisma.${e._getName()}`):Tt(e)?new te(`prisma.${qe(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Np(e):typeof e=="object"?Ws(e):new te(Object.prototype.toString.call(e))}function Np(e){let t=new xt;for(let r of e)t.addItem(Js(r));return t}function wn(e,t){let r=t==="pretty"?Vs:dn,n=e.renderAllMessages(r),i=new bt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function bn({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=vt(e);for(let A of t)un(A,a,s);let{message:f,args:w}=wn(a,r),v=cn({message:f,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:w});throw new ne(v,{clientVersion:o})}c();u();p();m();d();l();c();u();p();m();d();l();function ke(e){return e.replace(/^./,t=>t.toLowerCase())}c();u();p();m();d();l();function zs(e,t,r){let n=ke(r);return!t.result||!(t.result.$allModels||t.result[n])?e:Up({...e,...Ks(t.name,e,t.result.$allModels),...Ks(t.name,e,t.result[n])})}function Up(e){let t=new Se,r=(n,i)=>t.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),e[n]?e[n].needs.flatMap(o=>r(o,i)):[n]));return yt(e,n=>({...n,needs:r(n.name,new Set)}))}function Ks(e,t,r){return r?yt(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Fp(t,o,i)})):{}}function Fp(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function Ys(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function Zs(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(!e[n.name])for(let i of n.needs)delete r[i];return r}var En=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new Se;modelExtensionsCache=new Se;queryCallbacksCache=new Se;clientExtensions=Zt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=Zt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>zs(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=ke(t);return!this.extension.model||!(this.extension.model[r]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(t):{...this.previous?.getAllModelExtensions(t),...this.extension.model.$allModels,...this.extension.model[r]}})}getAllQueryCallbacks(t,r){return this.queryCallbacksCache.getOrCreate(`${t}:${r}`,()=>{let n=this.previous?.getAllQueryCallbacks(t,r)??[],i=[],o=this.extension.query;return!o||!(o[t]||o.$allModels||o[r]||o.$allOperations)?n:(o[t]!==void 0&&(o[t][r]!==void 0&&i.push(o[t][r]),o[t].$allOperations!==void 0&&i.push(o[t].$allOperations)),t!=="$none"&&o.$allModels!==void 0&&(o.$allModels[r]!==void 0&&i.push(o.$allModels[r]),o.$allModels.$allOperations!==void 0&&i.push(o.$allModels.$allOperations)),o[r]!==void 0&&i.push(o[r]),o.$allOperations!==void 0&&i.push(o.$allOperations),n.concat(i))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},At=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new En(t))}isEmpty(){return this.head===void 0}append(t){r
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}c();u();p();m();d();l();c();u();p();m();d();l();c();u();p();m();d();l();c();u();p();m();d();l();c();u();p();m();d();l();var Li=class{getLocation(){return null}};function je(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Li}c();u();p();m();d();l();c();u();p();m();d();l();c();u();p();m();d();l();var fa={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function It(e={}){let t=Xp(e);return Object.entries(t).reduce((n,[i,o])=>(fa[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Xp(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function kn(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function ga(e,t){let r=kn(e);return t({action:"aggregate",unpacker:r,argsMapper:It})(e)}c();u();p();m();d();l();function em(e={}){let{select:t,...r}=e;return typeof t=="object"?It({...r,_count:t}):It({...r,_count:{_all:!0}})}function tm(e={}){return typeof e.select=="object"?t=>kn(e)(t)._count:t=>kn(e)(t)._count._all}function ya(e,t){return t({action:"count",unpacker:tm(e),argsMapper:em})(e)}c();u();p();m();d();l();function rm(e={}){let t=It(e);if(Array.isArray(t.by))for(let r of t.by)typeof r=="string"&&(t.select[r]=!0);else typeof t.by=="string"&&(t.select[t.by]=!0);return t}function nm(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function ha(e,t){return t({action:"groupBy",unpacker:nm(e),argsMapper:rm})(e)}function wa(e,t,r){if(t==="aggregate")return n=>ga(n,r);if(t==="count")return n=>ya(n,r);if(t==="groupBy")return n=>ha(n,r)}c();u();p();m();d();l();function ba(e,t){let r=t.fields.filter(i=>!i.relationName),n=ks(r,"name");return new Proxy({},{get(i,o){if(o in i||typeof o=="symbol")return i[o];let s=n[o];if(s)return new ir(e,o,s.type,s.isList,s.kind==="enum")},...Sn(Object.keys(n))})}c();u();p();m();d();l();c();u();p();m();d();l();var Ea=e=>Array.isArray(e)?e:e.split("."),Ni=(e,t)=>Ea(t).reduce((r,n)=>r&&r[n],e),xa=(e,t,r)=>Ea(t).reduceRight((n,i,o,s)=>Object.assign({},Ni(e,s.slice(0,o)),{[i]:n}),r);function im(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function om(e,t,r){return t===void 0?e??{}:xa(t,r,e||!0)}function Ui(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((f,w)=>({...f,[w.name]:w}),{});return f=>{let w=je(e._errorFormat),v=im(n,i),A=om(f,o,v),R=r({dataPath:v,callsite:w})(A),C=sm(e,t);return new Proxy(R,{get(D,I){if(!C.includes(I))return D[I];let be=[a[I].type,r,I],ce=[v,A];return Ui(e,...be,...ce)},...Sn([...C,...Object.getOwnPropertyNames(R)])})}}function sm(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var am=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],lm=["aggregate","count","groupBy"];function Fi(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[cm(e,t),pm(e,t),mr(r),le("name",()=>t),le("$name",()=>t),le("$parent",()=>e._appliedParent)];return Pe({},n)}function cm(e,t){let r=ke(t),n=Object.keys(Xt).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>f=>{let w=je(e._errorFormat);return e._createPrismaPromise(v=>{let A={args:f,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:v,callsite:w};return e._request({...A,...a})},{action:o,args:f,model:t})};return am.includes(o)?Ui(e,t,s):um(i)?wa(e,i,s):s({})}}}function um(e){return lm.includes(e)}function pm(e,t){return Xe(le("fields",()=>{let r=e._runtimeDataModel.models[t];return ba(t,r)}))}c();u();p();m();d();l();function Pa(e){return e.replace(/^./,t=>t.toUpperCase())}var Vi=Symbol();function dr(e){let t=[mm(e),dm(e),le(Vi,()=>e),le("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(mr(r)),Pe(e,t)}function mm(e){let t=Object.getPrototypeOf(e._originalClient),r=[...new Set(Object.getOwnPropertyNames(t))];return{getKeys(){return r},getPropertyValue(n){return e[n]}}}function dm(e){let t=Object.
Learn how: https://pris.ly/d/${Ua[t]}-build`;throw console.error(n),new U(n,r)}}c();u();p();m();d();l();function Va(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}c();u();p();m();d();l();c();u();p();m();d();l();var bm=()=>globalThis.process?.release?.name==="node",Em=()=>!!globalThis.Bun||!!globalThis.process?.versions?.bun,xm=()=>!!globalThis.Deno,Pm=()=>typeof globalThis.Netlify=="object",Tm=()=>typeof globalThis.EdgeRuntime=="object",vm=()=>globalThis.navigator?.userAgent==="Cloudflare-Workers";function Am(){return[[Pm,"netlify"],[Tm,"edge-light"],[vm,"workerd"],[xm,"deno"],[Em,"bun"],[bm,"node"]].flatMap(r=>r[0]()?[r[1]]:[]).at(0)??""}var Cm={node:"Node.js",workerd:"Cloudflare Workers",deno:"Deno and Deno Deploy",netlify:"Netlify Edge Functions","edge-light":"Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware)"};function kt(){let e=Am();return{id:e,prettyName:Cm[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}c();u();p();m();d();l();c();u();p();m();d();l();var $i=Ae(Ei());c();u();p();m();d();l();function $a(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}c();u();p();m();d();l();function qa(e){return e.split(`
`).map(t=>t.replace(/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)\s*/,"").replace(/\+\d+\s*ms$/,"")).join(`
`)}c();u();p();m();d();l();var Ba=Ae(Rs());function ja({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,Ba.default)({user:t,repo:r,template:n,title:e,body:i})}function Qa({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=as(6e3-(s?.length??0)),f=qa((0,$i.default)(a)),w=n?`# Description
\`\`\`
${n}
\`\`\``:"",v=(0,$i.default)(`Hi Prisma Team! My Prisma Client just crashed. This is the report:
## Versions
| Name | Version |
|-----------------|--------------------|
| Node | ${g.version?.padEnd(19)}|
| OS | ${t?.padEnd(19)}|
| Prisma Client | ${e?.padEnd(19)}|
| Query Engine | ${i?.padEnd(19)}|
| Database | ${o?.padEnd(19)}|
${w}
## Logs
\`\`\`
${f}
\`\`\`
## Client Snippet
\`\`\`ts
// PLEASE FILL YOUR CODE SNIPPET HERE
\`\`\`
## Schema
\`\`\`prisma
// PLEASE ADD YOUR SCHEMA HERE IF POSSIBLE
\`\`\`
## Prisma Engine Query
\`\`\`
${s?$a(s):""}
\`\`\`
`),A=ja({title:r,body:v});return`${r}
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
${Xr(A)}
If you want the Prisma team to look into it, please open the link above \u{1F64F}
To increase the chance of success, please post your schema and a snippet of
how you used Prisma Client in the issue.
`}c();u();p();m();d();l();c();u();p();m();d();l();c();u();p();m();d();l();l();c();u();p();m();d();l();l();function Q(e,t){throw new Error(t)}function qi(e,t){return e===t||e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(r=>qi(e[r],t[r]))}function gr(e,t){let r=Object.keys(e),n=Object.keys(t);return(r.length<n.length?r:n).every(o=>{if(typeof e[o]==typeof t[o]&&typeof e[o]!="object")return e[o]===t[o];if(re.isDecimal(e[o])||re.isDecimal(t[o])){let s=Ha(e[o]),a=Ha(t[o]);return s&&a&&s.equals(a)}else if(e[o]instanceof Uint8Array||t[o]instanceof Uint8Array){let s=Ga(e[o]),a=Ga(t[o]);return s&&a&&s.equals(a)}else{if(e[o]instanceof Date||t[o]instanceof Date)return Wa(e[o])?.getTime()===Wa(t[o])?.getTime();if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return Ja(e[o])===Ja(t[o]);if(typeof e[o]=="number"||typeof t[o]=="number")return Ka(e[o])===Ka(t[o])}return qi(e[o],t[o])})}function Ha(e){return re.isDecimal(e)?e:typeof e=="number"||typeof e=="string"?new re(e):void 0}function Ga(e){return y.isBuffer(e)?e:e instanceof Uint8Array?y.from(e.buffer,e.byteOffset,e.byteLength):typeof e=="string"?y.from(e,"base64"):void 0}function Wa(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0}function Ja(e){return typeof e=="bigint"?e:typeof e=="number"||typeof e=="string"?BigInt(e):void 0}function Ka(e){return typeof e=="number"?e:typeof e=="string"?Number(e):void 0}function yr(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():r instanceof Uint8Array?y.from(r).toString("base64"):r)}var W=class extends Error{name="DataMapperError"};function Za(e,t,r){switch(t.type){case"AffectedRows":if(typeof e!="number")throw new W(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"Object":return Bi(e,t.fields,r);case"Value":return ji(e,"<result>",t.resultType,r);default:Q(t,`Invalid data mapping type: '${t.type}'`)}}function Bi(e,t,r){if(e===null)return null;if(Array.isArray(e))return e.map(i=>za(i,t,r));if(typeof e=="object")return za(e,t,r);if(typeof e=="string"){let n;try{n=JSON.parse(e)}catch(i){throw new W("Expected an array or object, got a string that is not valid JSON",{cause:i})}return Bi(n,t,r)}throw new W(`Expected an array or an object, got: ${typeof e}`)}function za(e,t,r){if(typeof e!="object")throw new W(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Object.entries(t))switch(o.type){case"AffectedRows":throw new W(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"Object":{if(o.serializedName!==null&&!Object.hasOwn(e,o.serializedName))throw new W(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let s=o.serializedName!==null?e[o.serializedName]:e;n[i]=Bi(s,o.fields,r);break}case"Value":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=ji(e[s],s,o.resultType,r);else throw new W(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:Q(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function ji(e,t,r,n){if(e===null)return r.type==="Array"?[]:null;switch(r.type){case"Any":return e;case"String":{if(typeof e!="string")throw new W(`Expected a string in column '${t}', got ${typeof e}: ${e}`);return e}case"Int":switch(typeof e){case"number":return Math.trunc(e);case"string":{let i=Math.trunc(Number(e));if(Number.isNaN(i)||!Number.isFinite(i))throw new W(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new W(`Integer value in column '${t}' is too large to represent as a JavaScript number without loss of precision, got: ${e}. Consider using BigInt type.`);return i}default:throw new W(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"BigInt":{if(typeof e!="number"&&typeof e!="string")throw new W(`Expected a bigint in column '${t}', got ${typeof e}: ${e}`);return{$type:"BigInt",value:e}}case"Float":{if(typeof e=="number")return e;if(typeof e=="string"){let i=Number(e);if(Number.isN
In Cloudflare module Workers, environment variables are available only in the Worker's \`env\` parameter of \`fetch\`.
To solve this, provide the connection string directly: https://pris.ly/d/cloudflare-datasource-url`,n):new U(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new U("error: Missing URL environment variable, value, or override.",n);return i}c();u();p();m();d();l();c();u();p();m();d();l();c();u();p();m();d();l();var zn=class extends Error{clientVersion;cause;constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var de=class extends zn{isRetryable;constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};c();u();p();m();d();l();function L(e,t){return{...e,isRetryable:t}}var ot=class extends de{name="InvalidDatasourceError";code="P6001";constructor(t,r){super(t,L(r,!1))}};k(ot,"InvalidDatasourceError");function Yn(e){let t={clientVersion:e.clientVersion},r=Object.keys(e.inlineDatasources)[0],n=Nt({inlineDatasources:e.inlineDatasources,overrideDatasources:e.overrideDatasources,clientVersion:e.clientVersion,env:{...e.env,...typeof g<"u"?g.env:{}}}),i;try{i=new URL(n)}catch{throw new ot(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\``,t)}let{protocol:o,searchParams:s}=i;if(o!=="prisma:"&&o!==on)throw new ot(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\` or \`prisma+postgres://\``,t);let a=s.get("api_key");if(a===null||a.length<1)throw new ot(`Error validating datasource \`${r}\`: the URL must contain a valid API key`,t);let f=wi(i)?"http:":"https:",w=new URL(i.href.replace(o,f));return{apiKey:a,url:w}}c();u();p();m();d();l();var gc=Ae(bs()),Ut=class{apiKey;tracingHelper;logLevel;logQueries;engineHash;constructor({apiKey:t,tracingHelper:r,logLevel:n,logQueries:i,engineHash:o}){this.apiKey=t,this.tracingHelper=r,this.logLevel=n,this.logQueries=i,this.engineHash=o}build({traceparent:t,transactionId:r}={}){let n={Accept:"application/json",Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json","Prisma-Engine-Hash":this.engineHash,"Prisma-Engine-Version":gc.enginesVersion};this.tracingHelper.isEnabled()&&(n.traceparent=t??this.tracingHelper.getTraceParent()),r&&(n["X-Transaction-Id"]=r);let i=this.#e();return i.length>0&&(n["X-Capture-Telemetry"]=i.join(", ")),n}#e(){let t=[];return this.tracingHelper.isEnabled()&&t.push("tracing"),this.logLevel&&t.push(this.logLevel),this.logQueries&&t.push("query"),t}};c();u();p();m();d();l();function zd(e){return e[0]*1e3+e[1]/1e6}function Ft(e){return new Date(zd(e))}var yc=J("prisma:client:clientEngine:remoteExecutor"),Zn=class{#e;#t;#r;#n;#o;constructor(t){this.#e=t.clientVersion,this.#n=t.logEmitter,this.#o=t.tracingHelper;let{url:r,apiKey:n}=Yn({clientVersion:t.clientVersion,env:t.env,inlineDatasources:t.inlineDatasources,overrideDatasources:t.overrideDatasources});this.#r=new xo(r),this.#t=new Ut({apiKey:n,engineHash:t.clientVersion,logLevel:t.logLevel,logQueries:t.logQueries,tracingHelper:t.tracingHelper})}async getConnectionInfo(){return await this.#i({path:"/connection-info",method:"GET"})}async execute({plan:t,placeholderValues:r,batchIndex:n,model:i,operation:o,transaction:s,customFetch:a}){return(await this.#i({path:s?`/transaction/${s.id}/query`:"/query",method:"POST",body:{model:i,operation:o,plan:t,params:r},batchRequestIdx:n,fetch:a})).data}async startTransaction(t){return{...await this.#i({path:"/transaction/start",method:"POST",body:t}),payload:void 0}}async commitTransaction(t){await this.#i({path:`/transaction/${t.id}/commit`,method:"POST"})}async rollbackTransaction(t){await this.#i({path:`/transaction/${t.id}/rollback`,method:"POST"})}disconnect(){return Promise.resolve()}async#i({path:t,method:r,body:n,fetch:i=globalThis.fetch,batchRequestIdx:o}){let s=await this.#r.request({method:r,path:t,headers:this.#t.build(),body:n,fetch:i});s.ok||await this.#s(s,o);let a=await s.json();return typeof a.extensions=="object"&&a.extensions!==null&&this.#a(a.extensions),a}async#s(t,r){let n=t.headers.get("Prisma-Error-Code"),i=await t.text(),o,s=i;try{o=JSON.parse(i)}catch{o={}}typ
${n.backtrace}`,{clientVersion:this.config.clientVersion})}catch{return t}}#u(t){return t instanceof ae?t:typeof t.message=="string"&&typeof t.code=="string"?new K(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion}):t}#p(t,r,n=!0){let i=Ec.PRISMA_WASM_PANIC_REGISTRY.set_message,o;globalThis.PRISMA_WASM_PANIC_REGISTRY.set_message=s=>{o=s};try{return t()}finally{if(globalThis.PRISMA_WASM_PANIC_REGISTRY.set_message=i,o)throw this.#e=void 0,n&&this.stop().catch(s=>Ir("failed to disconnect:",s)),new ae(bc(this,o,r),this.config.clientVersion)}}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the client engine, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead.')}async start(){await this.#i()}async stop(){switch(this.#t.type){case"disconnected":return;case"connecting":return await this.#t.promise,await this.stop();case"connected":{let t=this.#t.engine,r=this.tracingHelper.runInChildSpan("disconnect",async()=>{try{await t.executor.disconnect(),t.queryCompiler.free()}finally{this.#t={type:"disconnected"}}});return this.#t={type:"disconnecting",promise:r},await r}case"disconnecting":return await this.#t.promise}}version(){return"unknown"}async transaction(t,r,n){let i,{executor:o}=await this.#i();try{if(t==="start"){let s=n;i=await o.startTransaction({...s,isolationLevel:this.#m(s.isolationLevel)})}else if(t==="commit"){let s=n;await o.commitTransaction(s)}else if(t==="rollback"){let s=n;await o.rollbackTransaction(s)}else xe(t,"Invalid transaction action.")}catch(s){throw this.#c(s)}return i?{id:i.id,payload:void 0}:void 0}async request(t,{interactiveTransaction:r,customDataProxyFetch:n}){Ir("sending request");let i=JSON.stringify(t),{executor:o,queryCompiler:s}=await this.#i().catch(f=>{throw this.#c(f,i)}),a;try{a=this.#p(()=>s.compile(i),i)}catch(f){throw this.#u(f)}try{Ir("query plan created",a);let f={},w=await o.execute({plan:a,model:t.modelName,operation:t.action,placeholderValues:f,transaction:r,batchIndex:void 0,customFetch:n?.(globalThis.fetch)});return Ir("query plan executed"),{data:{[t.action]:w}}}catch(f){throw this.#c(f,i)}}async requestBatch(t,{transaction:r,customDataProxyFetch:n}){if(t.length===0)return[];let i=t[0].action,o=JSON.stringify(St(t,r)),{executor:s,queryCompiler:a}=await this.#i().catch(w=>{throw this.#c(w,o)}),f;try{f=a.compileBatch(o)}catch(w){throw this.#u(w)}try{let w;if(r?.kind==="itx")w=r.options;else{let R=r?.options.isolationLevel?{...this.config.transactionOptions,isolationLevel:r.options.isolationLevel}:this.config.transactionOptions;w=await this.transaction("start",{},R)}let v={},A=[];switch(f.type){case"multi":{A=await Promise.all(f.plans.map((R,C)=>s.execute({plan:R,placeholderValues:v,model:t[C].modelName,operation:t[C].action,batchIndex:C,transaction:w,customFetch:n?.(globalThis.fetch)}).then(D=>({data:{[t[C].action]:D}}),D=>D)));break}case"compacted":{if(!t.every(C=>C.action===i))throw new Error("All queries in a batch must have the same action");let R=await s.execute({plan:f.plan,placeholderValues:v,model:t[0].modelName,operation:i,batchIndex:void 0,transaction:w,customFetch:n?.(globalThis.fetch)});A=this.#d(R,f,i);break}}return r?.kind!=="itx"&&await this.transaction("commit",{},w),A}catch(w){throw this.#c(w,o)}}metrics(t){throw new Error("Method not implemented.")}#d(t,r,n){let i=t.map(s=>r.keys.reduce((a,f)=>(a[f]=$e(s[f]),a),{})),o=new Set(r.nestedSelection);return r.arguments.map(s=>{let a=i.findIndex(f=>gr(f,s));if(a===-1)return r.expectNonEmpty?new K("An operation failed because it depends on one or more records that were required but not found",{code:"P2025",clientVersion:this.config.clientVersion}):{data:{[n]:null}};{let f=Object.entries(t[a]).filter(([w])=>o.has(w));return{data:{[n]:Object.fromEntries(f)}}}})}#m(t){switch(t){case void 0:return;case"ReadUncommitted":return"READ UNCOMMITTED";case"ReadCommitted":return"READ COMMITTED";case"RepeatableRead":return"REPEATABLE READ";case"Serializable":return"SERIALIZABLE";case"Snapshot":return"SNAPSHOT";
${t}`,L(r,!0))}};k(Br,"RequestError");async function lt(e,t,r=n=>n){let{clientVersion:n,...i}=t,o=r(fetch);try{return await o(e,i)}catch(s){let a=s.message??"Unknown error";throw new Br(a,{clientVersion:n,cause:s})}}var tf=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,Ac=J("prisma:client:dataproxyEngine");async function rf(e,t){let r=vc["@prisma/engines-version"],n=t.clientVersion??"unknown";if(g.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION||globalThis.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return g.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION||globalThis.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION;if(e.includes("accelerate")&&n!=="0.0.0"&&n!=="in-memory")return n;let[i,o]=n?.split("-")??[];if(o===void 0&&tf.test(i))return i;if(o!==void 0||n==="0.0.0"||n==="in-memory"){let[s]=r.split("-")??[],[a,f,w]=s.split("."),v=nf(`<=${a}.${f}.${w}`),A=await lt(v,{clientVersion:n});if(!A.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${A.status} ${A.statusText}, response body: ${await A.text()||"<empty body>"}`);let R=await A.text();Ac("length of body fetched from unpkg.com",R.length);let C;try{C=JSON.parse(R)}catch(D){throw console.error("JSON.parse error: body fetched from unpkg.com: ",R),D}return C.version}throw new st("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function Cc(e,t){let r=await rf(e,t);return Ac("version",r),r}function nf(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var Rc=3,jr=J("prisma:client:dataproxyEngine"),Qr=class{name="DataProxyEngine";inlineSchema;inlineSchemaHash;inlineDatasources;config;logEmitter;env;clientVersion;engineHash;tracingHelper;remoteClientVersion;host;headerBuilder;startPromise;protocol;constructor(t){Tc(t),this.config=t,this.env=t.env,this.inlineSchema=Pc(t.inlineSchema),this.inlineDatasources=t.inlineDatasources,this.inlineSchemaHash=t.inlineSchemaHash,this.clientVersion=t.clientVersion,this.engineHash=t.engineVersion,this.logEmitter=t.logEmitter,this.tracingHelper=t.tracingHelper}apiKey(){return this.headerBuilder.apiKey}version(){return this.engineHash}async start(){this.startPromise!==void 0&&await this.startPromise,this.startPromise=(async()=>{let{apiKey:t,url:r}=this.getURLAndAPIKey();this.host=r.host,this.protocol=r.protocol,this.headerBuilder=new Ut({apiKey:t,tracingHelper:this.tracingHelper,logLevel:this.config.logLevel??"error",logQueries:this.config.logQueries,engineHash:this.engineHash}),this.remoteClientVersion=await Cc(this.host,this.config),jr("host",this.host),jr("protocol",this.protocol)})(),await this.startPromise}async stop(){}propagateResponseExtensions(t){t?.logs?.length&&t.logs.forEach(r=>{switch(r.level){case"debug":case"trace":jr(r);break;case"error":case"warn":case"info":{this.logEmitter.emit(r.level,{timestamp:Ft(r.timestamp),message:r.attributes.message??"",target:r.target});break}case"query":{this.logEmitter.emit("query",{query:r.attributes.query??"",timestamp:Ft(r.timestamp),duration:r.attributes.duration_ms??0,params:r.attributes.params??"",target:r.target});break}default:r.level}}),t?.traces?.length&&this.tracingHelper.dispatchEngineSpans(t.traces)}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the remote query engine')}async url(t){return await this.start(),`${this.protocol}//${this.host}/${this.remoteClientVersion}/${this.inlineSchemaHash}/${t}`}async uploadSchema(){let t={name:"schemaUpload",internal:!0};return this.tracingHelper.runInChildSpan(t,async()=>{let r=await lt(await this.url("schema"),{method:"PUT",headers:this.headerBuilder.build(),body:this.inlineSchema,clientVersion:this.clientVersion});r.ok||jr("schema response status",r.status);let n=await qr(r,this.clientVersion);if(n)throw this.logEmitter.emit("warn",{message:`Error while uploading schema: ${n.message}`,timestamp:new Date,target:""}),n;this.logEmitter.emit("info",{message:`Schema (re)uploaded (hash: ${this.inlineSchemaHash})`,timestamp:new Date,target:""})})}request(t,{traceparent:r,interactiveTransaction:n,customDataProxyFetch:i}){return this.requestInternal({body:t,traceparent:r,interactive
`);o.push({_tag:"error",value:M})},f=!!e?.startsWith("prisma://"),w=sn(e),v=!!t,A=f||w;!v&&r&&A&&s(["recommend--no-engine","In production, we recommend using `prisma generate --no-engine` (See: `prisma generate --help`)"]);let R=A||!r;v&&(R||n==="edge")&&(n==="edge"?a(["Prisma Client was configured to use the `adapter` option but it was imported via its `/edge` endpoint.","Please either remove the `/edge` endpoint or remove the `adapter` from the Prisma Client constructor."]):r?f&&a(["Prisma Client was configured to use the `adapter` option but the URL was a `prisma://` URL.","Please either use the `prisma://` URL or remove the `adapter` from the Prisma Client constructor."]):a(["Prisma Client was configured to use the `adapter` option but `prisma generate` was run with `--no-engine`.","Please run `prisma generate` without `--no-engine` to be able to use Prisma Client with the adapter."]));let C={accelerate:R,ppg:w,driverAdapters:v};function D(I){return I.length>0}return D(o)?{ok:!1,diagnostics:{warnings:i,errors:o},isUsing:C}:{ok:!0,diagnostics:{warnings:i},isUsing:C}}function Ic({copyEngine:e=!0},t){let r;try{r=Nt({inlineDatasources:t.inlineDatasources,overrideDatasources:t.overrideDatasources,env:{...t.env,...g.env},clientVersion:t.clientVersion})}catch{}let{ok:n,isUsing:i,diagnostics:o}=Sc({url:r,adapter:t.adapter,copyEngine:e,targetBuildType:"wasm-compiler-edge"});for(let A of o.warnings)Yt(...A.value);if(!n){let A=o.errors[0];throw new ne(A.value,{clientVersion:t.clientVersion})}let s=ft(t.generator),a=s==="library",f=s==="binary",w=s==="client",v=(i.accelerate||i.ppg)&&!i.driverAdapters;if(w)return new kr(t,v);if(i.accelerate)return new Qr(t);i.driverAdapters,i.accelerate;{let A=[`PrismaClient failed to initialize because it wasn't configured to run in this environment (${kt().prettyName}).`,"In order to run Prisma Client in an edge runtime, you will need to configure one of the following options:","- Enable Driver Adapters: https://pris.ly/d/driver-adapters","- Enable Accelerate: https://pris.ly/d/accelerate"];throw new ne(A.join(`
`),{clientVersion:t.clientVersion})}return"wasm-compiler-edge"}c();u();p();m();d();l();function Xn({generator:e}){return e?.previewFeatures??[]}c();u();p();m();d();l();var kc=e=>({command:e});c();u();p();m();d();l();c();u();p();m();d();l();var Oc=e=>e.strings.reduce((t,r,n)=>`${t}@P${n}${r}`);c();u();p();m();d();l();l();function Bt(e){try{return Dc(e,"fast")}catch{return Dc(e,"slow")}}function Dc(e,t){return JSON.stringify(e.map(r=>Mc(r,t)))}function Mc(e,t){if(Array.isArray(e))return e.map(r=>Mc(r,t));if(typeof e=="bigint")return{prisma__type:"bigint",prisma__value:e.toString()};if(ht(e))return{prisma__type:"date",prisma__value:e.toJSON()};if(re.isDecimal(e))return{prisma__type:"decimal",prisma__value:e.toJSON()};if(y.isBuffer(e))return{prisma__type:"bytes",prisma__value:e.toString("base64")};if(of(e))return{prisma__type:"bytes",prisma__value:y.from(e).toString("base64")};if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{prisma__type:"bytes",prisma__value:y.from(r,n,i).toString("base64")}}return typeof e=="object"&&t==="slow"?Lc(e):e}function of(e){return e instanceof ArrayBuffer||e instanceof SharedArrayBuffer?!0:typeof e=="object"&&e!==null?e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer":!1}function Lc(e){if(typeof e!="object"||e===null)return e;if(typeof e.toJSON=="function")return e.toJSON();if(Array.isArray(e))return e.map(_c);let t={};for(let r of Object.keys(e))t[r]=_c(e[r]);return t}function _c(e){return typeof e=="bigint"?e.toString():Lc(e)}var sf=/^(\s*alter\s)/i,Nc=J("prisma:client");function Io(e,t,r,n){if(!(e!=="postgresql"&&e!=="cockroachdb")&&r.length>0&&sf.exec(t))throw new Error(`Running ALTER using ${n} is not supported
Using the example below you can still execute your query with Prisma, but please note that it is vulnerable to SQL injection attacks and requires you to take care of input sanitization.
Example:
await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
More Information: https://pris.ly/d/execute-raw
`)}var ko=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(An(r))n=r.sql,i={values:Bt(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:Bt(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:Bt(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:Bt(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=Oc(r),i={values:Bt(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Nc(`prisma.${e}(${n}, ${i.values})`):Nc(`prisma.${e}(${n})`),{query:n,parameters:i}},Uc={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new me(t,r)}},Fc={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};c();u();p();m();d();l();function Oo(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=Vc(r(s)):Vc(r(s))}catch(a){return Promise.reject(a)}};return{get spec(){return n},then(s,a){return o().then(s,a)},catch(s){return o().catch(s)},finally(s){return o().finally(s)},requestTransaction(s){let a=o(s);return a.requestTransaction?a.requestTransaction(s):a},[Symbol.toStringTag]:"PrismaPromise"}}}function Vc(e){return typeof e.then=="function"?e:Promise.resolve(e)}c();u();p();m();d();l();var af=gi.split(".")[0],lf={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Do=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(t){return this.getGlobalTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getGlobalTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getGlobalTracingHelper().runInChildSpan(t,r)}getGlobalTracingHelper(){let t=globalThis[`V${af}_PRISMA_INSTRUMENTATION`],r=globalThis.PRISMA_INSTRUMENTATION;return t?.helper??r?.helper??lf}};function $c(){return new Do}c();u();p();m();d();l();function qc(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}c();u();p();m();d();l();function Bc(e){return typeof e=="string"?e:e.reduce((t,r)=>{let n=typeof r=="string"?r:r.level;return n==="query"?t:t&&(r==="info"||t==="info")?"info":n},void 0)}c();u();p();m();d();l();var ei=class{_middlewares=[];use(t){this._middlewares.push(t)}get(t){return this._middlewares[t]}has(t){return!!this._middlewares[t]}length(){return this._middlewares.length}};c();u();p();m();d();l();var Qc=Ae(Ei());c();u();p();m();d();l();function ti(e){return typeof e.batchRequestIdx=="number"}c();u();p();m();d();l();function jc(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(_o(e.query.arguments)),t.push(_o(e.query.selection)),t.join("")}function _o(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${_o(n)})`:r}).join(" ")})`}c();u();p();m();d();l();var cf={aggregate:!1,aggregateRaw:!1,createMany:!0,createManyAndReturn:!0,createOne:!0,deleteMany:!0,deleteOne:!0,executeRaw:!0,findFirst:!1,findFirstOrThrow:!1,findMany:!1,findRaw:!1,findUnique:!1,findUniqueOrThrow:!1,groupBy:!1,queryRaw:!1,runCommandRaw:!0,updateMany:!0,updateManyAndReturn:!0,updateOne:!0,upsertOne:!0};function Mo(e){return cf[e]}c();u();p();m();d();l();var ri=class{constructor(t){this.options=t;this.batches={}}batches;tickActive=!1;request(t){let r=this.options.batchBy(t);return r?(this.batches[r]||(this.batches[r]=[],this.tickActive||(this.tickActive=!0,g.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((n,i)=>{this.batches[r].push({request:t,resolve:n,reject:i})})):this.options.singleLoader(t)}dispatchBatches(){for(let t in this.batches){let r=this.batches[t];delete this.batches[t],r.length===1?this.options.singleLoader(r[0].request).then(n=>{n instan
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};k(F,"PrismaClientConstructorValidationError");var Jc=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],Kc=["pretty","colorless","minimal"],zc=["info","query","warn","error"],gf={datasources:(e,{datasourceNames:t})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new F(`Invalid value ${JSON.stringify(e)} for "datasources" provided to PrismaClient constructor`);for(let[r,n]of Object.entries(e)){if(!t.includes(r)){let i=jt(r,t)||` Available datasources: ${t.join(", ")}`;throw new F(`Unknown datasource ${r} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new F(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
It should have this form: { url: "CONNECTION_STRING" }`);if(n&&typeof n=="object")for(let[i,o]of Object.entries(n)){if(i!=="url")throw new F(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
It should have this form: { url: "CONNECTION_STRING" }`);if(typeof o!="string")throw new F(`Invalid value ${JSON.stringify(o)} for datasource "${r}" provided to PrismaClient constructor.
It should have this form: { url: "CONNECTION_STRING" }`)}}}},adapter:(e,t)=>{if(!e&&ft(t.generator)==="client")throw new F('Using engine type "client" requires a driver adapter to be provided to PrismaClient constructor.');if(e===null)return;if(e===void 0)throw new F('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!Xn(t).includes("driverAdapters"))throw new F('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(ft(t.generator)==="binary")throw new F('Cannot use a driver adapter with the "binary" Query Engine. Please use the "library" Query Engine.')},datasourceUrl:e=>{if(typeof e<"u"&&typeof e!="string")throw new F(`Invalid value ${JSON.stringify(e)} for "datasourceUrl" provided to PrismaClient constructor.
Expected string or undefined.`)},errorFormat:e=>{if(e){if(typeof e!="string")throw new F(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!Kc.includes(e)){let t=jt(e,Kc);throw new F(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new F(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!zc.includes(r)){let n=jt(r,zc);throw new F(`Invalid log level "${r}" provided to PrismaClient constructor.${n}`)}}for(let r of e){t(r);let n={level:t,emit:i=>{let o=["stdout","event"];if(!o.includes(i)){let s=jt(i,o);throw new F(`Invalid value ${JSON.stringify(i)} for "emit" in logLevel provided to PrismaClient constructor.${s}`)}}};if(r&&typeof r=="object")for(let[i,o]of Object.entries(r))if(n[i])n[i](o);else throw new F(`Invalid property ${i} for "log" provided to PrismaClient constructor`)}},transactionOptions:e=>{if(!e)return;let t=e.maxWait;if(t!=null&&t<=0)throw new F(`Invalid value ${t} for maxWait in "transactionOptions" provided to PrismaClient constructor. maxWait needs to be greater than 0`);let r=e.timeout;if(r!=null&&r<=0)throw new F(`Invalid value ${r} for timeout in "transactionOptions" provided to PrismaClient constructor. timeout needs to be greater than 0`)},omit:(e,t)=>{if(typeof e!="object")throw new F('"omit" option is expected to be an object.');if(e===null)throw new F('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=hf(n,t.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let f=o.fields.find(w=>w.name===s);if(!f){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(f.relationName){r.push({kind:"RelationInOmit",modelKey:n,fieldName:s});continue}typeof a!="boolean"&&r.push({kind:"InvalidFieldValue",modelKey:n,fieldName:s})}}if(r.length>0)throw new F(wf(e,r))},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new F(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=jt(r,t);throw new F(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function Xc(e,t){for(let[r,n]of Object.entries(e)){if(!Jc.includes(r)){let i=jt(r,Jc);throw new F(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}gf[r](n,t)}if(e.datasourceUrl&&e.datasources)throw new F('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function jt(e,t){if(t.length===0||typeof e!="string")return"";let r=yf(e,t);return r?` Did you mean "${r}"?`:""}function yf(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,Zc.default)(e,i)}));r.sort((i,o)=>i.distance<o.distance?-1:1);let n=r[0];return n.distance<3?n.value:null}function hf(e,t){return Yc(t.models,e)??Yc(t.types,e)}function Yc(e,t){let r=Object.keys(e).find(n=>qe(n)===t);if(r)return e[r]}function wf(e,t){let r=vt(e);for(let o of t)switch(o.kind){case"UnknownModel":r.arguments.getField(o.modelKey)?.markAsError(),r.addErrorMessage(()=>`Unknown model name: ${o.modelKey}.`);break;case"UnknownField":r.arguments.getDeepField([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>`Model "${o.modelKey}" does not have a field named "${o.fieldName}".`);break;case"RelationInOmit":r.arguments.getDeepField([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>'Relations are already excluded by default and can not be specified in "omit".');break;case"InvalidFieldValue":r.arguments.getDeepFieldValue([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>"Omit field option value must be a boolean.");break}let{message:n,args:i}=wn(r,"colorless");return`Error validating "omit" option:
${i}
${n}`}c();u();p();m();d();l();function eu(e){return e.length===0?Promise.resolve([]):new Promise((t,r)=>{let n=new Array(e.length),i=null,o=!1,s=0,a=()=>{o||(s++,s===e.length&&(o=!0,i?r(i):t(n)))},f=w=>{o||(o=!0,r(w))};for(let w=0;w<e.length;w++)e[w].then(v=>{n[w]=v,a()},v=>{if(!ti(v)){f(v);return}v.batchRequestIdx===w?f(v):(i||(i=v),a())})})}var We=J("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var bf={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},Ef=Symbol.for("prisma.client.transaction.id"),xf={id:0,nextId(){return++this.id}};function nu(e){class t{_originalClient=this;_runtimeDataModel;_requestHandler;_connectionPromise;_disconnectionPromise;_engineConfig;_accelerateEngineConfig;_clientVersion;_errorFormat;_tracingHelper;_middlewares=new ei;_previewFeatures;_activeProvider;_globalOmit;_extensions;_engine;_appliedParent;_createPrismaPromise=Oo();constructor(n){e=n?.__internal?.configOverride?.(e)??e,Fa(e),n&&Xc(n,e);let i=new Cn().on("error",()=>{});this._extensions=At.empty(),this._previewFeatures=Xn(e),this._clientVersion=e.clientVersion??Wc,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=$c();let o=e.relativeEnvPaths&&{rootEnvPath:e.relativeEnvPaths.rootEnvPath&&en.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&en.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=n.adapter;let f=e.activeProvider==="postgresql"||e.activeProvider==="cockroachdb"?"postgres":e.activeProvider;if(s.provider!==f)throw new U(`The Driver Adapter \`${s.adapterName}\`, based on \`${s.provider}\`, is not compatible with the provider \`${f}\` specified in the Prisma schema.`,this._clientVersion);if(n.datasources||n.datasourceUrl!==void 0)throw new U("Custom datasource configuration is not compatible with Prisma Driver Adapters. Please define the database connection string directly in the Driver Adapter configuration.",this._clientVersion)}let a=e.injectableEdgeEnv?.();try{let f=n??{},w=f.__internal??{},v=w.debug===!0;v&&J.enable("prisma:client");let A=en.resolve(e.dirname,e.relativePath);us.existsSync(A)||(A=e.dirname),We("dirname",e.dirname),We("relativePath",e.relativePath),We("cwd",A);let R=w.engine||{};if(f.errorFormat?this._errorFormat=f.errorFormat:g.env.NODE_ENV==="production"?this._errorFormat="minimal":g.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:A,dirname:e.dirname,enableDebugLogs:v,allowTriggerPanic:R.allowTriggerPanic,prismaPath:R.binaryPath??void 0,engineEndpoint:R.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:f.log&&Bc(f.log),logQueries:f.log&&!!(typeof f.log=="string"?f.log==="query":f.log.find(C=>typeof C=="string"?C==="query":C.level==="query")),env:a?.parsed??{},flags:[],engineWasm:e.engineWasm,compilerWasm:e.compilerWasm,clientVersion:e.clientVersion,engineVersion:e.engineVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,overrideDatasources:Va(f,e.datasourceNames),inlineDatasources:e.inlineDatasources,inlineSchemaHash:e.inlineSchemaHash,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:f.transactionOptions?.maxWait??2e3,timeout:f.transactionOptions?.timeout??5e3,isolationLevel:f.transactionOptions?.isolationLevel},logEmitter:i,isBundled:e.isBundled,adapter:s},this._accelerateEngineConfig={...this._engineConfig,accelerateUtils:{resolveDatasourceUrl:Nt,getBatchRequestPayload:St,prismaGraphQLToJSError:In,PrismaClientUnknownRequestError:se,PrismaClientInitializationError:U,PrismaClientKnownRequestError:K,debug:J("prisma:client:accelerateEngine"),engineVersion:ru.version,clientVersion:e.clientVersion}},We("clientVersion",e.clientVersion),this._engine=Ic(e,this._engineConfig),this._requestHandler=new ii(this,i),f.log)for(let C of f.log){let D=typeof C=="string"?C:C.emit==="stdout"?C.level:null;D&&this.$on(D,I=>{zt.log(`${zt.tags[D]??""}`,I.message||I.query)})}}catch(f){throw f.clie
`)),v?.kind==="batch"&&await v.lock,this._requestHandler.request({protocolQuery:I,modelName:f,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:v,unpacker:A,otelParentCtx:R,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:C})}catch(D){throw D.clientVersion=this._clientVersion,D}}$metrics=new Ct(this);_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$applyPendingMigrations(){return this._engine.applyPendingMigrations()}$extends=va}return t}function tu(e,t){return Pf(e)?[new me(e,t),Uc]:[e,Fc]}function Pf(e){return Array.isArray(e)&&Array.isArray(e.raw)}c();u();p();m();d();l();var Tf=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function iu(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!Tf.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}c();u();p();m();d();l();l();0&&(module.exports={DMMF,Debug,Decimal,Extensions,MetricsClient,PrismaClientInitializationError,PrismaClientKnownRequestError,PrismaClientRustPanicError,PrismaClientUnknownRequestError,PrismaClientValidationError,Public,Sql,createParam,defineDmmfProperty,deserializeJsonResponse,deserializeRawResult,dmmfToRuntimeDataModel,empty,getPrismaClient,getRuntime,join,makeStrictEnum,makeTypedQueryFactory,objectEnumValues,raw,serializeJsonQuery,skip,sqltag,warnEnvConflicts,warnOnce});
//# sourceMappingURL=wasm-compiler-edge.js.map