TreasureTrails/node_modules/@prisma/client/runtime/client.mjs

90 lines
180 KiB
JavaScript
Raw Normal View History

2026-03-18 09:02:21 -05:00
import * as __banner_node_module from "node:module";
import * as __banner_node_path from "node:path";
import * as process from "node:process";
import * as __banner_node_url from "node:url";
const __filename = __banner_node_url.fileURLToPath(import.meta.url);
globalThis['__dirname'] = __banner_node_path.dirname(__filename);
const require = __banner_node_module.createRequire(import.meta.url);
var Ml=Object.create;var Qr=Object.defineProperty;var Fl=Object.getOwnPropertyDescriptor;var _l=Object.getOwnPropertyNames;var $l=Object.getPrototypeOf,Ll=Object.prototype.hasOwnProperty;var Vl=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var gi=(e,t)=>()=>(e&&(t=e(e=0)),t);var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),et=(e,t)=>{for(var r in t)Qr(e,r,{get:t[r],enumerable:!0})},ql=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _l(t))!Ll.call(e,i)&&i!==r&&Qr(e,i,{get:()=>t[i],enumerable:!(n=Fl(t,i))||n.enumerable});return e};var fe=(e,t,r)=>(r=e!=null?Ml($l(e)):{},ql(t||!e||!e.__esModule?Qr(r,"default",{value:e,enumerable:!0}):r,e));var Oi=$((If,uu)=>{uu.exports={name:"@prisma/engines-version",version:"7.5.0-15.280c870be64f457428992c43c1f6d557fab6e29e",main:"index.js",types:"index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <suchanek@prisma.io>",prisma:{enginesVersion:"280c870be64f457428992c43c1f6d557fab6e29e"},repository:{type:"git",url:"https://github.com/prisma/engines-wrapper.git",directory:"packages/engines-version"},devDependencies:{"@types/node":"18.19.76",typescript:"4.9.5"},files:["index.js","index.d.ts"],scripts:{build:"tsc -d"}}});var Ni=$(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.enginesVersion=void 0;Vt.enginesVersion=Oi().prisma.enginesVersion});var Mi=$((Nf,Di)=>{"use strict";Di.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((r,n)=>Math.min(r,n.length),1/0):0}});var Vi=$((Ff,Li)=>{"use strict";Li.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof e!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(t===0)return e;let n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}});var ji=$((Bf,Ut)=>{"use strict";Ut.exports=(e={})=>{let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");let r=new URL(`${t}/issues/new`),n=["body","title","labels","template","milestone","assignee","projects"];for(let i of n){let o=e[i];if(o!==void 0){if(i==="labels"||i==="projects"){if(!Array.isArray(o))throw new TypeError(`The \`${i}\` option should be an array`);o=o.join(",")}r.searchParams.set(i,o)}}return r.toString()};Ut.exports.default=Ut.exports});var tn=$((_g,zi)=>{"use strict";zi.exports=function(){function e(t,r,n,i,o){return t<r||n<r?t>n?n+1:t+1:i===o?r:r+1}return function(t,r){if(t===r)return 0;if(t.length>r.length){var n=t;t=r,r=n}for(var i=t.length,o=r.length;i>0&&t.charCodeAt(i-1)===r.charCodeAt(o-1);)i--,o--;for(var s=0;s<i&&t.charCodeAt(s)===r.charCodeAt(s);)s++;if(i-=s,o-=s,i===0||o<3)return o;var a=0,l,u,c,p,d,m,g,b,w,R,E,S,V=[];for(l=0;l<i;l++)V.push(l+1),V.push(t.charCodeAt(s+l));for(var Ce=V.length-1;a<o-3;)for(w=r.charCodeAt(s+(u=a)),R=r.charCodeAt(s+(c=a+1)),E=r.charCodeAt(s+(p=a+2)),S=r.charCodeAt(s+(d=a+3)),m=a+=4,l=0;l<Ce;l+=2)g=V[l],b=V[l+1],u=e(g,u,c,w,b),c=e(u,c,p,R,b),p=e(c,p,d,E,b),m=e(p,d,m,S,b),V[l]=m,d=p,p=c,c=u,u=g;for(;a<o;)for(w=r.charCodeAt(s+(u=a)),m=++a,l=0;l<Ce;l+=2)g=V[l],V[l]=m=e(g,u,m,w,V[l+1]),u=g;return m}}()});var Xi=gi(()=>{"use strict"});var eo=gi(()=>{"use strict"});var vn=$(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.anumber=Sn;be.abytes=ps;be.ahash=vp;be.aexists=Ap;be.aoutput=Cp;function Sn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Sp(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ps(e,...t){if(!Sp(e
`);return t.length<e?t:t.slice(-e)}function Ii(){at.length=0}var Fi=fe(Mi(),1);function zr(e){let t=(0,Fi.default)(e);if(t===0)return e;let r=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(r,"")}var _i="prisma+postgres",qt=`${_i}:`;function $i(e){return e?.toString().startsWith(`${qt}//`)??!1}function Wr(e){if(!$i(e))return!1;let{host:t}=new URL(e);return t.includes("localhost")||t.includes("127.0.0.1")||t.includes("[::1]")}var ct={};et(ct,{error:()=>du,info:()=>pu,log:()=>cu,query:()=>mu,should:()=>qi,tags:()=>ut,warn:()=>Kr});var ut={error:ge("prisma:error"),warn:ot("prisma:warn"),info:ee("prisma:info"),query:ye("prisma:query")},qi={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function cu(...e){console.log(...e)}function Kr(e,...t){qi.warn()&&console.warn(`${ut.warn} ${e}`,...t)}function pu(e,...t){console.info(`${ut.info} ${e}`,...t)}function du(e,...t){console.error(`${ut.error} ${e}`,...t)}function mu(e,...t){console.log(`${ut.query} ${e}`,...t)}function te(e,t){throw new Error(t)}function Zr({onlyFirst:e=!1}={}){let r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,e?void 0:"g")}var fu=Zr();function Re(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(fu,"")}import jt from"node:path";function Yr(e){return jt.sep===jt.posix.sep?e:e.split(jt.sep).join(jt.posix.sep)}function Xr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Bt(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function en(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}function pt(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var Ui=new Set,Bi=(e,t,...r)=>{Ui.has(e)||(Ui.add(e),Kr(t,...r))};function ke(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Qt(e){return e.toString()!=="Invalid Date"}import{Decimal as gu}from"@prisma/client-runtime-utils";function Ie(e){return gu.isDecimal(e)?!0:e!==null&&typeof e=="object"&&typeof e.s=="number"&&typeof e.e=="number"&&typeof e.toFixed=="function"&&Array.isArray(e.d)}import{PrismaClientValidationError as rc}from"@prisma/client-runtime-utils";var Jt={};et(Jt,{ModelAction:()=>Oe,datamodelEnumToSchemaEnum:()=>yu});function yu(e){return{name:e.name,values:e.values.map(t=>t.name)}}var Oe=(S=>(S.findUnique="findUnique",S.findUniqueOrThrow="findUniqueOrThrow",S.findFirst="findFirst",S.findFirstOrThrow="findFirstOrThrow",S.findMany="findMany",S.create="create",S.createMany="createMany",S.createManyAndReturn="createManyAndReturn",S.update="update",S.updateMany="updateMany",S.updateManyAndReturn="updateManyAndReturn",S.upsert="upsert",S.delete="delete",S.deleteMany="deleteMany",S.groupBy="groupBy",S.count="count",S.aggregate="aggregate",S.findRaw="findRaw",S.aggregateRaw="aggregateRaw",S))(Oe||{});var Gi=fe(Vi());import Eu from"node:fs";var Qi={keyword:ee,entity:ee,value:e=>B(ye(e)),punctuation:ye,directive:ee,function:ee,variable:e=>B(ye(e)),string:e=>B(it(e)),boolean:ot,number:ee,comment:st};var hu=e=>e,Ht={},wu=0,h={manual:Ht.Prism&&Ht.Prism.manual,disableWorkerMessageHandler:Ht.Prism&&Ht.Prism.disableWorkerMessageHandler,util:{encode:function(e){if(e instanceof Q){let t=e;return new Q(t.type,h.util.encode(t.content),t.alias)}else return Array.isArray(e)?e.map(h.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++wu}),e.__id},clone:function e(t,r){let n,i,o=h.util.type(t);switch(r=r||{},o){case"Object":if(i=h.util.objId(t),r[i])return r[i];n={},r[i]=n;for(let s in t)t.hasOwnProperty(s)&&(n[s]=e(t[s],r));return n;case"Array":return i=h.util.objId(t),r[i]?r[i]:(n=[],r[i]=n,t.forEach(function(s,a){n[a]=e(s,r)}),n);default:return t}}},languages:{extend:functi
`);return new e(t,Hi(n).split(`
`))}highlight(){let t=Ji(this.toString());return new e(this.firstLineNumber,t.split(`
`))}toString(){return this.lines.join(`
`)}};var Pu={red:ge,gray:st,dim:rt,bold:B,underline:nt,highlightSource:e=>e.highlight()},Tu={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function Su({message:e,originalMethod:t,isPanic:r,callArguments:n}){return{functionName:`prisma.${t}()`,message:e,isPanic:r??!1,callArguments:n}}function vu({callsite:e,message:t,originalMethod:r,isPanic:n,callArguments:i},o){let s=Su({message:t,originalMethod:r,isPanic:n,callArguments:i});if(!e||typeof window<"u"||process.env.NODE_ENV==="production")return s;let a=e.getLocation();if(!a||!a.lineNumber||!a.columnNumber)return s;let l=Math.max(1,a.lineNumber-3),u=Gt.read(a.fileName)?.slice(l,a.lineNumber),c=u?.lineAt(a.lineNumber);if(u&&c){let p=Cu(c),d=Au(c);if(!d)return s;s.functionName=`${d.code})`,s.location=a,n||(u=u.mapLineAt(a.lineNumber,g=>g.slice(0,d.openingBraceIndex))),u=o.highlightSource(u);let m=String(u.lastLineNumber).length;if(s.contextLines=u.mapLines((g,b)=>o.gray(String(b).padStart(m))+" "+g).mapLines(g=>o.dim(g)).prependSymbolAt(a.lineNumber,o.bold(o.red("\u2192"))),i){let g=p+m+1;g+=2,s.callArguments=(0,Gi.default)(i,g).slice(g)}}return s}function Au(e){let t=Object.keys(Oe).join("|"),n=new RegExp(String.raw`\.(${t})\(`).exec(e);if(n){let i=n.index+n[0].length,o=e.lastIndexOf(" ",n.index)+1;return{code:e.slice(o,i),openingBraceIndex:i}}return null}function Cu(e){let t=0;for(let r=0;r<e.length;r++){if(e.charAt(r)!==" ")return t;t++}return t}function Ru({functionName:e,location:t,message:r,isPanic:n,contextLines:i,callArguments:o},s){let a=[""],l=t?" in":":";if(n?(a.push(s.red(`Oops, an unknown error occurred! This is ${s.bold("on us")}, you did nothing wrong.`)),a.push(s.red(`It occurred in the ${s.bold(`\`${e}\``)} invocation${l}`))):a.push(s.red(`Invalid ${s.bold(`\`${e}\``)} invocation${l}`)),t&&a.push(s.underline(ku(t))),i){a.push("");let u=[i.toString()];o&&(u.push(o),u.push(s.dim(")"))),a.push(u.join("")),o&&a.push("")}else a.push(""),o&&a.push(o),a.push("");return a.push(r),a.join(`
`)}function ku(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function zt(e){let t=e.showColors?Pu:Tu,r;return r=vu(e,t),Ru(r,t)}var ro=fe(tn());function Zi(e,t,r){let n=Yi(e),i=Iu(n),o=Nu(i);o?Wt(o,t,r):t.addErrorMessage(()=>"Unknown error")}function Yi(e){return e.errors.flatMap(t=>t.kind==="Union"?Yi(t):[t])}function Iu(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:Ou(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function Ou(e,t){return[...new Set(e.concat(t))]}function Nu(e){return en(e,(t,r)=>{let n=Wi(t),i=Wi(r);return n!==i?n-i:Ki(t)-Ki(r)})}function Wi(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function Ki(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}var L=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)}};eo();var Ne=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}};Xi();var Kt=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};var Zt=e=>e,Yt={bold:Zt,red:Zt,green:Zt,dim:Zt,enabled:!1},to={bold:B,red:ge,green:it,dim:rt,enabled:!0},De={write(e){e.writeLine(",")}};var G=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)))})}};var ae=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var Me=class extends ae{items=[];addItem(t){return this.items.push(new Kt(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 G("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined(De,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var Fe=class e extends ae{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 Me&&(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 G("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined(De,[...r,...this.suggestions]).newLine()}),t.write("}"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(t.context.colors.red("~".repeat(this.getPrintWidth())))})}};var k=class extends ae{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new G(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};var dt=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(()=>{t.writeJoined(De,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Wt(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":Du(e,t);break;case"Inclu
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function Fu(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){_u(e,t,i);return}if(n.hasField("select")){$u(e,t);return}}if(r?.[se(e.outputType.name)]){Lu(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function _u(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new L(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 $u(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),oo(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${mt(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function Lu(e,t){let r=new dt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new L("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=_e(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new Fe;l.addSuggestion(n),a.value=l}}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 Vu(e,t){let r=so(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":oo(n,e.outputType);break;case"include":Wu(n,e.outputType);break;case"omit":Ku(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(mt(n)),i.join(" ")})}function qu(e,t){let r=so(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 ju(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),Zu(n,e.arguments)),t.addErrorMessage(i=>no(i,r,e.arguments.map(o=>o.name)))}function Uu(e,t){let[r,n]=_e(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&ao(o,e.inputType)}t.addErrorMessage(o=>no(o,n,e.inputType.fields.map(s=>s.name)))}function no(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=Xu(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(mt(e)),n.join(" ")}function Bu(e,t){let r;t.addErrorMessage(l=>r?.value instanceof k&&r.value.text==="null"?`Argument \`${l.green(o)}\` must not be ${l.red("null")}.`:`Argument \`${l.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=_e(e.argumentPath),s=new dt,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 l of e.inputTypes[0].fields)s.addField(l.name,l.typeNames.join(" | "));a.addSuggestion(new L(o,s).makeRequired())}else{let l=e.inputTypes.map(io).join(" | ");a.addSuggestion(new L(o,l).makeRequired())}if(e.dependentArgumentPath){n.getDeepField(e.dependentArgumentPath)?.markAsError();let[,l]=_e(e.dependentArgumentPath);t.addErrorMessage(u=>`Argument \`${u.green(o)}\` is required because argument \`${u.green(l)}\` was provided.`)}}}function io(e){return e.kind==="list"?`${io(e.elementType)}[]`:e.name}function Qu(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&n.getDeepFieldValue(e.argumentPath)
`)}};function Le(e){return new nn(uo(e))}function uo(e){let t=new Fe;for(let[r,n]of Object.entries(e)){let i=new er(r,co(n));t.addField(i)}return t}function co(e){if(typeof e=="string")return new k(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new k(String(e));if(typeof e=="bigint")return new k(`${e}n`);if(e===null)return new k("null");if(e===void 0)return new k("undefined");if(Ie(e))return new k(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new k(`Buffer.alloc(${e.byteLength})`):new k(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Qt(e)?e.toISOString():"Invalid Date";return new k(`new Date("${t}")`)}return ec(e)?new k(`Prisma.${e._getName()}`):$e(e)?new k(`prisma.${se(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?tc(e):typeof e=="object"?uo(e):new k(Object.prototype.toString.call(e))}function tc(e){let t=new Me;for(let r of e)t.addItem(co(r));return t}function tr(e,t){let r=t==="pretty"?to:Yt,n=e.renderAllMessages(r),i=new Ne(0,{colors:r}).write(e).toString();return{message:n,args:i}}function rr({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=Le(e);for(let p of t)Wt(p,a,s);let{message:l,args:u}=tr(a,r),c=zt({message:l,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:u});throw new rc(c,{clientVersion:o})}function z(e){return e.replace(/^./,t=>t.toLowerCase())}function mo(e,t,r){let n=z(r);return!t.result||!(t.result.$allModels||t.result[n])?e:nc({...e,...po(t.name,e,t.result.$allModels),...po(t.name,e,t.result[n])})}function nc(e){let t=new H,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 Bt(e,n=>({...n,needs:r(n.name,new Set)}))}function po(e,t,r){return r?Bt(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:ic(t,o,i)})):{}}function ic(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function fo(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 go(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 nr=class{constructor(t,r){this.extension=t;this.previous=r}computedFieldsCache=new H;modelExtensionsCache=new H;queryCallbacksCache=new H;clientExtensions=tt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=tt(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t});getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>mo(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=z(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()}},Ve=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new nr(t))}isEmpty(){return this.head===void 0}append(t){return new e(new nr(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(
`);return t.reduce(function(r,n){var i=Pc(n)||Sc(n)||Cc(n)||Oc(n)||kc(n);return i&&r.push(i),r},[])}var xc=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|rsc|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ec=/\((\S*)(?::(\d+))(?::(\d+))\)/;function Pc(e){var t=xc.exec(e);if(!t)return null;var r=t[2]&&t[2].indexOf("native")===0,n=t[2]&&t[2].indexOf("eval")===0,i=Ec.exec(t[2]);return n&&i!=null&&(t[2]=i[1],t[3]=i[2],t[4]=i[3]),{file:r?null:t[2],methodName:t[1]||bt,arguments:r?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}var Tc=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|rsc|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function Sc(e){var t=Tc.exec(e);return t?{file:t[2],methodName:t[1]||bt,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var vc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|rsc|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,Ac=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Cc(e){var t=vc.exec(e);if(!t)return null;var r=t[3]&&t[3].indexOf(" > eval")>-1,n=Ac.exec(t[3]);return r&&n!=null&&(t[3]=n[1],t[4]=n[2],t[5]=null),{file:t[3],methodName:t[1]||bt,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}var Rc=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function kc(e){var t=Rc.exec(e);return t?{file:t[3],methodName:t[1]||bt,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}var Ic=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function Oc(e){var t=Ic.exec(e);return t?{file:t[2],methodName:t[1]||bt,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var pn=class{getLocation(){return null}},dn=class{_error;constructor(){this._error=new Error}getLocation(){let t=this._error.stack;if(!t)return null;let n=So(t).find(i=>{if(!i.file)return!1;let o=Yr(i.file);return o!=="<anonymous>"&&!o.includes("@prisma")&&!o.includes("/packages/client/src/runtime/")&&!o.endsWith("/runtime/client.js")&&!o.startsWith("internal/")&&!i.methodName.includes("new ")&&!i.methodName.includes("getCallSite")&&!i.methodName.includes("Proxy.")&&i.methodName.split(".").length<4});return!n||!n.file?null:{fileName:n.file,lineNumber:n.lineNumber,columnNumber:n.column}}};function le(e){return e==="minimal"?typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new pn:new dn}var vo={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function je(e={}){let t=Dc(e);return Object.entries(t).reduce((n,[i,o])=>(vo[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Dc(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function ur(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Ao(e,t){let r=ur(e);return t({action:"aggregate",unpacker:r,argsMapper:je})(e)}function Mc(e={}){let{select:t,...r}=e;return typeof t=="object"?je({...r,_count:t}):je({...r,_count:{_all:!0}})}function Fc(e={}){return typeof e.select=="object"?t=>ur(e)(t)._count:t=>ur(e)(t)._count._all}function Co(e,t){return t({action:"count",unpacker:Fc(e),argsMapper:Mc})(e)}function _c(e={}){let t=je(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 $c(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function Ro(e,t){return t({action:"groupBy",unpacker:$c(e),argsMapper:_c})(e)}function ko(e,t,r){if(t==="aggregate")return n=>Ao(n,r);if(t==="count")return n=>Co(n,r);if(t==="groupBy")return n=>Ro(n,r)}function Io(e,t){let r=t.fields.filter(i=>!i.relationName),n=Ei(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 ft(e,o,s.type,s.isList,s.kind==="enum")},...lr(Object.keys(n))})}var Oo=e=>Array.isArray(e)?e:e.split("."),mn=(e,t)=>Oo(t).reduce((r,n)=>r&&r[n],e),No=(e,t,r)=>Oo(t).reduceRight((n,i,o,s)=>Object.assign({},mn(e,s.slice(0,o)),{[i]:n}),r);function Lc(e,t){return e===void 0||
`).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(`
`)}var Ia=fe(ji());function Oa({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,Ia.default)({user:t,repo:r,template:n,title:e,body:i})}function Na({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=ki(6e3-(s?.length??0)),l=ka(Re(a)),u=n?`# Description
\`\`\`
${n}
\`\`\``:"",c=Re(`Hi Prisma Team! My Prisma Client just crashed. This is the report:
## Versions
| Name | Version |
|-----------------|--------------------|
| Node | ${process.version?.padEnd(19)}|
| OS | ${t?.padEnd(19)}|
| Prisma Client | ${e?.padEnd(19)}|
| Query Engine | ${i?.padEnd(19)}|
| Database | ${o?.padEnd(19)}|
${u}
## Logs
\`\`\`
${l}
\`\`\`
## Client Snippet
\`\`\`ts
// PLEASE FILL YOUR CODE SNIPPET HERE
\`\`\`
## Schema
\`\`\`prisma
// PLEASE ADD YOUR SCHEMA HERE IF POSSIBLE
\`\`\`
## Prisma Engine Query
\`\`\`
${s?Ra(s):""}
\`\`\`
`),p=Oa({title:r,body:c});return`${r}
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
${nt(p)}
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.
`}var Or=class e{#e;#t;#r;#n;#i;constructor(t,r,n){this.#e=t,this.#t=r,this.#r=n,this.#n=r.getConnectionInfo?.(),this.#i=It.forSql({onQuery:this.#e.onQuery,tracingHelper:this.#e.tracingHelper,provider:this.#e.provider,connectionInfo:this.#n})}static async connect(t){let r,n;try{r=await t.driverAdapterFactory.connect(),n=new Nt({driverAdapter:r,transactionOptions:t.transactionOptions,tracingHelper:t.tracingHelper,onQuery:t.onQuery,provider:t.provider})}catch(i){throw await r?.dispose(),i}return new e(t,r,n)}getConnectionInfo(){let t=this.#n??{supportsRelationJoins:!1};return Promise.resolve({provider:this.#t.provider,connectionInfo:t})}async execute({plan:t,placeholderValues:r,transaction:n,batchIndex:i,queryInfo:o}){let s=n?await this.#r.getTransaction(n,i!==void 0?"batch query":"query"):this.#t;return await this.#i.run(t,{queryable:s,transactionManager:n?{enabled:!1}:{enabled:!0,manager:this.#r},scope:r,sqlCommenter:this.#e.sqlCommenters&&{plugins:this.#e.sqlCommenters,queryInfo:o}})}async startTransaction(t){return{...await this.#r.startTransaction(t),payload:void 0}}async commitTransaction(t){await this.#r.commitTransaction(t.id)}async rollbackTransaction(t){await this.#r.rollbackTransaction(t.id)}async disconnect(){try{await this.#r.cancelAllTransactions()}finally{await this.#t.dispose()}}apiKey(){return null}};var Wd=new Set(["DateTime","Decimal","BigInt","Bytes","Json","Raw"]);function Nr(e){if(e==null)return{kind:"null"};if(typeof e=="string")return{kind:"primitive",value:e};if(typeof e=="number")return{kind:"primitive",value:e};if(typeof e=="boolean")return{kind:"primitive",value:e};if(Array.isArray(e))return{kind:"array",items:e};if(typeof e=="object"){let t=e;if("$type"in t&&typeof t.$type=="string"){let r=t.$type;return Wd.has(r)?{kind:"taggedScalar",tag:r,value:t.value}:{kind:"structural",value:t.value}}return{kind:"object",entries:t}}return{kind:"structural",value:e}}function Da(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!("$type"in e)}function Ma(e){return typeof e=="object"&&e!==null&&"$type"in e&&typeof e.$type=="string"}function _a(e,t){let r=new Dr(t),n=e.modelName?`${e.modelName}.${e.action}`:e.action,i=t.root(n);return{parameterizedQuery:{...e,query:r.parameterizeFieldSelection(e.query,i?.argsNodeId,i?.outputNodeId)},placeholderValues:r.getPlaceholderValues()}}function $a(e,t){let r=new Dr(t),n=[];for(let i=0;i<e.batch.length;i++){let o=e.batch[i],s=o.modelName?`${o.modelName}.${o.action}`:o.action,a=t.root(s);n.push({...o,query:r.parameterizeFieldSelection(o.query,a?.argsNodeId,a?.outputNodeId)})}return{parameterizedBatch:{...e,batch:n},placeholderValues:r.getPlaceholderValues()}}var Dr=class{#e;#t=new Map;#r=new Map;#n=1;constructor(t){this.#e=t}getPlaceholderValues(){return Object.fromEntries(this.#t)}#i(t,r){let n=Zd(t,r),i=this.#r.get(n);if(i!==void 0)return Fa(i,r);let o=`%${this.#n++}`;return this.#r.set(n,o),this.#t.set(o,t),Fa(o,r)}parameterizeFieldSelection(t,r,n){let i=this.#e.inputNode(r),o=this.#e.outputNode(n),s={...t};return t.arguments&&t.arguments.$type!=="Raw"&&(s.arguments=this.#o(t.arguments,i)),t.selection&&(s.selection=this.#c(t.selection,o)),s}#o(t,r){if(!r)return t;let n={};for(let[i,o]of Object.entries(t)){let s=this.#e.inputEdge(r,i);s?n[i]=this.#s(o,s):n[i]=o}return n}#s(t,r){let n=Nr(t);switch(n.kind){case"null":return t;case"structural":return t;case"primitive":return this.#a(n.value,r);case"taggedScalar":return this.#l(t,n.tag,r);case"array":return this.#u(n.items,t,r);case"object":return this.#p(n.entries,r);default:throw new Error(`Unknown value kind ${n.kind}`)}}#a(t,r){if(X(r,Y.ParamEnum)&&r.enumNameIndex!==void 0&&typeof t=="string"&&this.#e.enumValues(r)?.includes(t)){let s={type:"Enum"};return this.#i(t,s)}if(!X(r,Y.ParamScalar))return t;let n=me(r);if(n===0)return t;let i=Yn(t);return Va(i,n)?(n&N.Json&&(t=JSON.stringify(t)),this.#i(t,i)):t}#l(t,r,n){if(!X(n,Y.ParamScalar))return t;let i=me(n);if(i===0||!ja(r,i))return t;let o=qa(t.$type),s=Ua(t);return this.#i(s,o)}#u(t,r,n){if(X(n,Y.ParamScalar)&&me(n)&N.Json){let i=ue(W(t)),o={type:"Json"};retu
${n.backtrace}`,{clientVersion:this.config.clientVersion})}catch{return t}}#d(t){return t instanceof Mt?t:typeof t.message=="string"&&typeof t.code=="string"?new ni(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion}):typeof t.message=="string"?new Za(t.message,{clientVersion:this.config.clientVersion}):t}#m(t,r,n=!0){let i=tl.PRISMA_WASM_PANIC_REGISTRY.set_message,o;global.PRISMA_WASM_PANIC_REGISTRY.set_message=s=>{o=s};try{return t()}finally{if(global.PRISMA_WASM_PANIC_REGISTRY.set_message=i,o)throw this.#e=void 0,n&&this.stop().catch(s=>ie("failed to disconnect:",s)),new Mt(Ya(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.#a()}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.#a();try{if(t==="start"){let s=n;i=await o.startTransaction({...s,isolationLevel:this.#y(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 te(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}){ie("sending request");let{executor:i,queryCompiler:o}=await this.#a().catch(l=>{throw this.#c(l,JSON.stringify(t))}),s,a={};if(Xa(t))s=el(t);else{let{parameterizedQuery:l,placeholderValues:u}=_a(t,this.#o),c=JSON.stringify(l);a=u;let p=this.#i.getSingle(c);p?(ie("query plan cache hit"),s=p):(ie("query plan cache miss"),s=this.#f(l,c,o),this.#i.setSingle(c,s))}try{ie("query plan created",s);let l=await i.execute({plan:s,model:t.modelName,operation:t.action,placeholderValues:a,transaction:r,batchIndex:void 0,customFetch:n?.(globalThis.fetch),queryInfo:{type:"single",modelName:t.modelName,action:t.action,query:t.query}});return ie("query plan executed"),{data:{[t.action]:l}}}catch(l){throw this.#c(l,JSON.stringify(t))}}async requestBatch(t,{transaction:r,customDataProxyFetch:n}){if(t.length===0)return[];let i=t[0].action,o=t[0].modelName,s=Ca(t,r),a=JSON.stringify(s),{executor:l,queryCompiler:u}=await this.#a().catch(m=>{throw this.#c(m,a)}),c=o===void 0,p,d={};if(c)p=this.#g(t,a,u);else{let{parameterizedBatch:m,placeholderValues:g}=$a(s,this.#o),b=JSON.stringify(m);d=g;let w=this.#i.getBatch(b);if(w)ie("batch query plan cache hit"),p=w;else{ie("batch query plan cache miss");try{p=this.#g(m.batch,b,u),this.#i.setBatch(b,p)}catch(R){throw this.#d(R)}}}try{let m;switch(r?.kind==="itx"&&(m=r.options),p.type){case"multi":{if(r?.kind!=="itx"){let w=r?.options.isolationLevel?{...this.config.transactionOptions,isolationLevel:r.options.isolationLevel}:this.config.transactionOptions;m=await this.transaction("start",{},w)}let g=[],b=!1;for(let[w,R]of p.plans.entries())try{let E=await l.execute({plan:R,placeholderValues:d,model:t[w].modelName,operation:t[w].action,batchIndex:w,transaction:m,customFetch:n?.(globalThis.fetch),queryInfo:{type:"single",...t[w]}});g.push({data:{[t[w].action]:E}})}catch(E){g.push(E),b=!0;break}return m!==void 0&&r?.kind!=="itx"&&(b?await this.transaction("rollback",{},m):await this.transaction("commit",{},m)),g}case"compacted":{if(!t.every(w=>w.action===i&&w.modelName===o)){let w=t.map(E=>E.action).join(", "),R=t.map(E=>E.modelName).join(", ");throw new Error(`Internal error: All queries in a compacted batch must have the same action and model name, but received actions: [${w}] and model names: [${R}]. This indicates a bug in
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 oi=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(sr(r))n=r.sql,i={values:Ke(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:Ke(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:Ke(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:Ke(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=il(r),i={values:Ke(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?ul(`prisma.${e}(${n}, ${i.values})`):ul(`prisma.${e}(${n})`),{query:n,parameters:i}},cl={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new pm(t,r)}},pl={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function si(e){return function(r,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=dl(r(s)):dl(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 dl(e){return typeof e.then=="function"?e:Promise.resolve(e)}var ml={name:"@prisma/instrumentation-contract",version:"7.5.0",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}};var fm=ml.version.split(".")[0],gm="PRISMA_INSTRUMENTATION",ym=`V${fm}_PRISMA_INSTRUMENTATION`,fl=globalThis;function gl(){let e=fl[ym];return e?.helper?e.helper:fl[gm]?.helper}var hm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},ai=class{isEnabled(){return this.getTracingHelper().isEnabled()}getTraceParent(t){return this.getTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getTracingHelper().runInChildSpan(t,r)}getTracingHelper(){return gl()??hm}};function yl(){return new ai}function hl(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}function wl(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)}import{hasBatchIndex as Em}from"@prisma/client-runtime-utils";function ui(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(li(e.query.arguments)),t.push(li(e.query.selection)),t.join("")}function li(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${li(n)})`:r}).join(" ")})`}var wm={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 ci(e){return wm[e]}var qr=class{constructor(t){this.options=t;this.batches={}}batches;tickActive=!1;request(t){let r=this.options.batchBy(t);return r?(thi
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};pt(C,"PrismaClientConstructorValidationError");var El=["errorFormat","adapter","accelerateUrl","log","transactionOptions","omit","comments","__internal"],Pl=["pretty","colorless","minimal"],Tl=["info","query","warn","error"],Am={adapter:()=>{},accelerateUrl:e=>{if(e!==void 0){if(typeof e!="string")throw new C(`Invalid value ${JSON.stringify(e)} for "accelerateUrl" provided to PrismaClient constructor.`);if(e.trim().length===0)throw new C('"accelerateUrl" provided to PrismaClient constructor must be a non-empty string.')}},errorFormat:e=>{if(e){if(typeof e!="string")throw new C(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!Pl.includes(e)){let t=_t(e,Pl);throw new C(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new C(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!Tl.includes(r)){let n=_t(r,Tl);throw new C(`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=_t(i,o);throw new C(`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 C(`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 C(`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 C(`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 C('"omit" option is expected to be an object.');if(e===null)throw new C('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=km(n,t.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let l=o.fields.find(u=>u.name===s);if(!l){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(l.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 C(Im(e,r))},comments:e=>{if(e!==void 0){if(!Array.isArray(e))throw new C(`Invalid value ${JSON.stringify(e)} for "comments" provided to PrismaClient constructor. Expected an array of SQL commenter plugins.`);for(let t=0;t<e.length;t++)if(typeof e[t]!="function")throw new C(`Invalid value at index ${t} for "comments" provided to PrismaClient constructor. Each plugin must be a function.`)}},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new C(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=_t(r,t);throw new C(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function Cm(e){let t=e.adapter!==void 0,r=e.accelerateUrl!==void 0;if(t&&r)throw new C('The "adapter" and "accelerateUrl" options are mutually exclusive. Please provide only one of them.');if(!t&&!r)throw new C('Using engine type "client" requires either "adapter" or "accelerateUrl" to be provided to PrismaClient constructor.')}function Al(e,t){for(let[r,n]of Object.entries(e)){if(!El.includes(r)){let i=_t(r,El);throw new C(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}Am[r](n,t)}Cm(e)}function _t(e,t){if(t.length===0||typeof e!="string")return"";let r=Rm(e,t);return r?` Did you mean "${r}"?`:""}function Rm(e,t){if(t.length===0)return null;let r=t.map(i=>({
${i}
${n}`}import{hasBatchIndex as Om}from"@prisma/client-runtime-utils";function Cl(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)))},l=u=>{o||(o=!0,r(u))};for(let u=0;u<e.length;u++)e[u].then(c=>{n[u]=c,a()},c=>{if(!Om(c)){l(c);return}c.batchRequestIdx===u?l(c):(i||(i=c),a())})})}var Ze=D("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var Fm={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},Il=Symbol.for("prisma.client.transaction.scope_context");function Rl(e){let r=e[Il];if(r===void 0)return{kind:"top-level"};if(_m(r))return r;throw new Error("Internal error: inconsistent transaction scope context.")}function _m(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.kind==="nested"&&typeof t.txId=="string"&&typeof t.scopeId=="string"&&$m(t.scopeState)}function $m(e){return typeof e!="object"||e===null?!1:Array.isArray(e.stack)}function Lm(){return typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}var Vm={id:0,nextId(){return++this.id}};function qm(e){class t{_originalClient=this;_runtimeDataModel;_requestHandler;_connectionPromise;_disconnectionPromise;_engineConfig;_accelerateEngineConfig;_clientVersion;_errorFormat;_tracingHelper;_previewFeatures;_activeProvider;_globalOmit;_extensions;_engine;_appliedParent;_createPrismaPromise=si();constructor(n){if(!n)throw new Ae("`PrismaClient` needs to be constructed with a non-empty, valid `PrismaClientOptions`:\n\n```\nnew PrismaClient({\n ...\n})\n```\n\nor\n\n```\nconstructor() {\n super({ ... });\n}\n```\n ",fi);e=n.__internal?.configOverride?.(e)??e,Al(n,e);let i=new Mm().on("error",()=>{});this._extensions=Ve.empty(),this._previewFeatures=e.previewFeatures,this._clientVersion=e.clientVersion??fi,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=yl();let o;if(n.adapter){o=n.adapter;let s=e.activeProvider==="postgresql"||e.activeProvider==="cockroachdb"?"postgres":e.activeProvider;if(o.provider!==s)throw new Ae(`The Driver Adapter \`${o.adapterName}\`, based on \`${o.provider}\`, is not compatible with the provider \`${s}\` specified in the Prisma schema.`,this._clientVersion)}try{let s=n??{},l=(s.__internal??{}).debug===!0;if(l&&D.enable("prisma:client"),s.errorFormat?this._errorFormat=s.errorFormat:process.env.NODE_ENV==="production"?this._errorFormat="minimal":process.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={enableDebugLogs:l,logLevel:s.log&&wl(s.log),logQueries:s.log&&!!(typeof s.log=="string"?s.log==="query":s.log.find(u=>typeof u=="string"?u==="query":u.level==="query")),compilerWasm:e.compilerWasm,clientVersion:e.clientVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:s.transactionOptions?.maxWait??2e3,timeout:s.transactionOptions?.timeout??5e3,isolationLevel:s.transactionOptions?.isolationLevel},logEmitter:i,adapter:o,accelerateUrl:s.accelerateUrl,sqlCommenters:s.comments,parameterizationSchema:e.parameterizationSchema,runtimeDataModel:e.runtimeDataModel},this._accelerateEngineConfig=Object.create(this._engineConfig),this._accelerateEngineConfig.accelerateUtils={resolveDatasourceUrl:()=>{if(s.accelerateUrl)return s.accelerateUrl;throw new Ae(`\`accelerateUrl\` is required when using \`@prisma/extension-accelerate\`:
new PrismaClient({
accelerateUrl: "prisma://...",
}).$extends(withAccelerate())
`,e.clientVersion)}},Ze("clientVersion",e.clientVersion),this._engine=rl(this._engineConfig),this._requestHandler=new Ur(this,i),s.log)for(let u of s.log){let c=typeof u=="string"?u:u.emit==="stdout"?u.level:null;c&&this.$on(c,p=>{ct.log(`${ct.tags[c]??""}`,p.message||p.query)})}}catch(s){throw s.clientVersion=this._clientVersion,s}return this._appliedParent=xt(this)}get[Symbol.toStringTag](){return"PrismaClient"}$on(n,i){return n==="beforeExit"?this._engine.onBeforeExit(i):n&&this._engineConfig.logEmitter.on(n,i),this}$connect(){try{return this._engine.start()}catch(n){throw n.clientVersion=this._clientVersion,n}}async $disconnect(){try{await this._engine.stop()}catch(n){throw n.clientVersion=this._clientVersion,n}finally{Ii()}}$executeRawInternal(n,i,o,s){let a=this._activeProvider;return this._request({action:"executeRaw",args:o,transaction:n,clientMethod:i,argsMapper:oi({clientMethod:i,activeProvider:a}),callsite:le(this._errorFormat),dataPath:[],middlewareArgsMapper:s})}$executeRaw(n,...i){return this._createPrismaPromise(o=>{if(n.raw!==void 0||n.sql!==void 0){let[s,a]=kl(n,i);return ii(this._activeProvider,s.text,s.values,Array.isArray(n)?"prisma.$executeRaw`<SQL>`":"prisma.$executeRaw(sql`<SQL>`)"),this.$executeRawInternal(o,"$executeRaw",s,a)}throw new Ye("`$executeRaw` is a tag function, please use it like the following:\n```\nconst result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n```\n\nOr read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#executeraw\n",{clientVersion:this._clientVersion})})}$executeRawUnsafe(n,...i){return this._createPrismaPromise(o=>(ii(this._activeProvider,n,i,"prisma.$executeRawUnsafe(<SQL>, [...values])"),this.$executeRawInternal(o,"$executeRawUnsafe",[n,...i])))}$runCommandRaw(n){if(e.activeProvider!=="mongodb")throw new Ye(`The ${e.activeProvider} provider does not support $runCommandRaw. Use the mongodb provider.`,{clientVersion:this._clientVersion});return this._createPrismaPromise(i=>this._request({args:n,clientMethod:"$runCommandRaw",dataPath:[],action:"runCommandRaw",argsMapper:nl,callsite:le(this._errorFormat),transaction:i}))}async $queryRawInternal(n,i,o,s){let a=this._activeProvider;return this._request({action:"queryRaw",args:o,transaction:n,clientMethod:i,argsMapper:oi({clientMethod:i,activeProvider:a}),callsite:le(this._errorFormat),dataPath:[],middlewareArgsMapper:s})}$queryRaw(n,...i){return this._createPrismaPromise(o=>{if(n.raw!==void 0||n.sql!==void 0)return this.$queryRawInternal(o,"$queryRaw",...kl(n,i));throw new Ye("`$queryRaw` is a tag function, please use it like the following:\n```\nconst result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n```\n\nOr read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#queryraw\n",{clientVersion:this._clientVersion})})}$queryRawTyped(n){return this._createPrismaPromise(i=>{if(!this._hasPreviewFlag("typedSql"))throw new Ye("`typedSql` preview feature must be enabled in order to access $queryRawTyped API",{clientVersion:this._clientVersion});return this.$queryRawInternal(i,"$queryRawTyped",n)})}$queryRawUnsafe(n,...i){return this._createPrismaPromise(o=>this.$queryRawInternal(o,"$queryRawUnsafe",[n,...i]))}_transactionWithArray({promises:n,options:i}){let o=Vm.nextId(),s=hl(n.length),a=n.map((l,u)=>{if(l?.[Symbol.toStringTag]!=="PrismaPromise")throw new Error("All elements of the array need to be Prisma Client promises. Hint: Please make sure you are not awaiting the Prisma client calls you intended to pass in the $transaction function.");let c=i?.isolationLevel??this._engineConfig.transactionOptions.isolationLevel,p={kind:"batch",id:o,index:u,isolationLevel:c,lock:s};return l.requestTransaction?.(p)??l});return Cl(a)}async _transactionWithCallback({callback:n,options:i={}}){let o=Rl(this),s=o.kind==="nested",a=s?o.scopeState:{stack:[]},l=a.stack,u=Lm();if(s){if(l.at(-1)!==o.scopeId)throw new Error("Concurrent nested transactions are not sup
`)),c?.kind==="batch"&&await c.lock,this._requestHandler.request({protocolQuery:b,modelName:l,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:c,unpacker:p,otelParentCtx:d,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:m})}catch(g){throw g.clientVersion=this._clientVersion,g}}_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$extends=Fo}return t}function kl(e,t){return jm(e)?[new Nm(e,t),cl]:[e,pl]}function jm(e){return Array.isArray(e)&&Array.isArray(e.raw)}var Um=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function Bm(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!Um.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}var Qm=()=>globalThis.process?.release?.name==="node",Jm=()=>!!globalThis.Bun||!!globalThis.process?.versions?.bun,Hm=()=>!!globalThis.Deno,Gm=()=>typeof globalThis.Netlify=="object",zm=()=>typeof globalThis.EdgeRuntime=="object",Wm=()=>globalThis.navigator?.userAgent==="Cloudflare-Workers";function Km(){return[[Gm,"netlify"],[zm,"edge-light"],[Wm,"workerd"],[Hm,"deno"],[Jm,"bun"],[Qm,"node"]].flatMap(r=>r[0]()?[r[1]]:[]).at(0)??""}var Zm={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 Ym(){let e=Km();return{id:e,prettyName:Zm[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}import{PrismaClientInitializationError as Ae,PrismaClientKnownRequestError as di,PrismaClientRustPanicError as jr,PrismaClientUnknownRequestError as mi,PrismaClientValidationError as Ye}from"@prisma/client-runtime-utils";import{empty as Mv,join as Fv,raw as _v,Sql as $v,sql as Lv}from"@prisma/client-runtime-utils";import{AnyNull as qv,DbNull as jv,isAnyNull as Uv,isDbNull as Bv,isJsonNull as Qv,isObjectEnumValue as Jv,JsonNull as Hv,NullTypes as Gv,ObjectEnumValue as zv}from"@prisma/client-runtime-utils";import{Decimal as Kv}from"@prisma/client-runtime-utils";export{qv as AnyNull,Jt as DMMF,jv as DbNull,D as Debug,Kv as Decimal,wi as Extensions,Hv as JsonNull,Gv as NullTypes,zv as ObjectEnumValue,Ae as PrismaClientInitializationError,di as PrismaClientKnownRequestError,jr as PrismaClientRustPanicError,mi as PrismaClientUnknownRequestError,Ye as PrismaClientValidationError,xi as Public,$v as Sql,oc as createParam,yc as defineDmmfProperty,W as deserializeJsonObject,pi as deserializeRawResult,jl as dmmfToRuntimeDataModel,Mv as empty,qm as getPrismaClient,Ym as getRuntime,Uv as isAnyNull,Bv as isDbNull,Qv as isJsonNull,Jv as isObjectEnumValue,Fv as join,Bm as makeStrictEnum,wc as makeTypedQueryFactory,_v as raw,an as serializeJsonQuery,on as skip,Lv as sqltag,Bi as warnOnce};
/*! Bundled license information:
@noble/hashes/utils.js:
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
*/
//# sourceMappingURL=client.mjs.map