bot/prisma/runtime/edge.js

32 lines
160 KiB
JavaScript
Raw Normal View History

"use strict";var na=Object.create;var ar=Object.defineProperty;var ia=Object.getOwnPropertyDescriptor;var oa=Object.getOwnPropertyNames;var sa=Object.getPrototypeOf,aa=Object.prototype.hasOwnProperty;var Ce=(e,t)=>()=>(e&&(t=e(e=0)),t);var Fe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lr=(e,t)=>{for(var r in t)ar(e,r,{get:t[r],enumerable:!0})},Zn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oa(t))!aa.call(e,i)&&i!==r&&ar(e,i,{get:()=>t[i],enumerable:!(n=ia(t,i))||n.enumerable});return e};var _e=(e,t,r)=>(r=e!=null?na(sa(e)):{},Zn(t||!e||!e.__esModule?ar(r,"default",{value:e,enumerable:!0}):r,e)),la=e=>Zn(ar({},"__esModule",{value:!0}),e);var y,c=Ce(()=>{"use strict";y={nextTick:(e,...t)=>{setTimeout(()=>{e(...t)},0)},env:{},version:"",cwd:()=>"/",stderr:{},argv:["/bin/node"]}});var b,p=Ce(()=>{"use strict";b=globalThis.performance??(()=>{let e=Date.now();return{now:()=>Date.now()-e}})()});var E,d=Ce(()=>{"use strict";E=()=>{};E.prototype=E});var m=Ce(()=>{"use strict"});var yi=Fe(ze=>{"use strict";f();c();p();d();m();var ni=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ua=ni(e=>{"use strict";e.byteLength=l,e.toByteArray=g,e.fromByteArray=S;var t=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(o=0,s=i.length;o<s;++o)t[o]=i[o],r[i.charCodeAt(o)]=o;var o,s;r[45]=62,r[95]=63;function a(C){var R=C.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var M=C.indexOf("=");M===-1&&(M=R);var F=M===R?0:4-M%4;return[M,F]}function l(C){var R=a(C),M=R[0],F=R[1];return(M+F)*3/4-F}function u(C,R,M){return(R+M)*3/4-M}function g(C){var R,M=a(C),F=M[0],q=M[1],D=new n(u(C,F,q)),I=0,ae=q>0?F-4:F,G;for(G=0;G<ae;G+=4)R=r[C.charCodeAt(G)]<<18|r[C.charCodeAt(G+1)]<<12|r[C.charCodeAt(G+2)]<<6|r[C.charCodeAt(G+3)],D[I++]=R>>16&255,D[I++]=R>>8&255,D[I++]=R&255;return q===2&&(R=r[C.charCodeAt(G)]<<2|r[C.charCodeAt(G+1)]>>4,D[I++]=R&255),q===1&&(R=r[C.charCodeAt(G)]<<10|r[C.charCodeAt(G+1)]<<4|r[C.charCodeAt(G+2)]>>2,D[I++]=R>>8&255,D[I++]=R&255),D}function h(C){return t[C>>18&63]+t[C>>12&63]+t[C>>6&63]+t[C&63]}function v(C,R,M){for(var F,q=[],D=R;D<M;D+=3)F=(C[D]<<16&16711680)+(C[D+1]<<8&65280)+(C[D+2]&255),q.push(h(F));return q.join("")}function S(C){for(var R,M=C.length,F=M%3,q=[],D=16383,I=0,ae=M-F;I<ae;I+=D)q.push(v(C,I,I+D>ae?ae:I+D));return F===1?(R=C[M-1],q.push(t[R>>2]+t[R<<4&63]+"==")):F===2&&(R=(C[M-2]<<8)+C[M-1],q.push(t[R>>10]+t[R>>4&63]+t[R<<2&63]+"=")),q.join("")}}),ca=ni(e=>{e.read=function(t,r,n,i,o){var s,a,l=o*8-i-1,u=(1<<l)-1,g=u>>1,h=-7,v=n?o-1:0,S=n?-1:1,C=t[r+v];for(v+=S,s=C&(1<<-h)-1,C>>=-h,h+=l;h>0;s=s*256+t[r+v],v+=S,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=i;h>0;a=a*256+t[r+v],v+=S,h-=8);if(s===0)s=1-g;else{if(s===u)return a?NaN:(C?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-g}return(C?-1:1)*a*Math.pow(2,s-i)},e.write=function(t,r,n,i,o,s){var a,l,u,g=s*8-o-1,h=(1<<g)-1,v=h>>1,S=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=i?0:s-1,R=i?1:-1,M=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+v>=1?r+=S/u:r+=S*Math.pow(2,1-v),r*u>=2&&(a++,u/=2),a+v>=h?(l=0,a=h):a+v>=1?(l=(r*u-1)*Math.pow(2,o),a=a+v):(l=r*Math.pow(2,v-1)*Math.pow(2,o),a=0));o>=8;t[n+C]=l&255,C+=R,l/=256,o-=8);for(a=a<<o|l,g+=o;g>0;t[n+C]=a&255,C+=R,a/=256,g-=8);t[n+C-R]|=M*128}}),Yr=ua(),We=ca(),Xn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ze.Buffer=T;ze.SlowBuffer=ha;ze.INSPECT_MAX_BYTES=50;var ur=2147483647;ze.kMaxLength=ur;T.TYPED_ARRAY_SUPPORT=pa();!T.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function pa(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Objec
`)}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}};f();c();p();d();m();f();c();p();d();m();function no(e){return e.substring(0,1).toLowerCase()+e.substring(1)}f();c();p();d();m();function rt(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function br(e){return e.toString()!=="Invalid Date"}f();c();p();d();m();f();c();p();d();m();var nt=9e15,ke=1e9,Pn="0123456789abcdef",Pr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",vr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",vn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-nt,maxE:nt,crypto:!1},ao,Te,_=!0,Ar="[DecimalError] ",Oe=Ar+"Invalid argument: ",lo=Ar+"Precision limit exceeded",uo=Ar+"crypto unavailable",co="[object Decimal]",X=Math.floor,Q=Math.pow,ol=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,sl=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,al=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,po=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,pe=1e7,k=7,ll=9007199254740991,ul=Pr.length-1,Tn=vr.length-1,A={toStringTag:co};A.absoluteValue=A.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),O(e)};A.ceil=function(){return O(new this.constructor(this),this.e+1,2)};A.clampedTo=A.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Oe+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};A.comparedTo=A.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,l=o.s,u=e.s;if(!s||!a)return!l||!u?NaN:l!==u?l:s===a?0:!s^l<0?1:-1;if(!s[0]||!a[0])return s[0]?l:a[0]?-u:0;if(l!==u)return l;if(o.e!==e.e)return o.e>e.e^l<0?1:-1;for(n=s.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};A.cosine=A.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+k,n.rounding=1,r=cl(n,yo(n,r)),n.precision=e,n.rounding=t,O(Te==2||Te==3
`)}};function ct(e){return new Sn(xo(e))}function xo(e){let t=new ut;for(let[r,n]of Object.entries(e)){let i=new kr(r,Po(n));t.addField(i)}return t}function Po(e){if(typeof e=="string")return new z(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new z(String(e));if(typeof e=="bigint")return new z(`${e}n`);if(e===null)return new z("null");if(e===void 0)return new z("undefined");if(ot(e))return new z(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return w.Buffer.isBuffer(e)?new z(`Buffer.alloc(${e.byteLength})`):new z(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=br(e)?e.toISOString():"Invalid Date";return new z(`new Date("${t}")`)}return e instanceof ve?new z(`Prisma.${e._getName()}`):st(e)?new z(`prisma.${no(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Xl(e):typeof e=="object"?xo(e):new z(Object.prototype.toString.call(e))}function Xl(e){let t=new lt;for(let r of e)t.addItem(Po(r));return t}function Dr(e,t){let r=t==="pretty"?Eo:Or,n=e.renderAllMessages(r),i=new tt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function vo(e){if(e===void 0)return"";let t=ct(e);return new tt(0,{colors:Or}).write(t).toString()}f();c();p();d();m();var eu="P2037";function qt({error:e,user_facing_error:t},r,n){return t.error_code?new W(tu(t,n),{code:t.error_code,clientVersion:r,meta:t.meta,batchRequestIdx:t.batch_request_idx}):new ne(e,{clientVersion:r,batchRequestIdx:t.batch_request_idx})}function tu(e,t){let r=e.message;return(t==="postgresql"||t==="postgres"||t==="mysql")&&e.error_code===eu&&(r+=`
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();var In=class{getLocation(){return null}};function Me(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new In}f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();var To={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function pt(e={}){let t=nu(e);return Object.entries(t).reduce((n,[i,o])=>(To[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function nu(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Mr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Ao(e,t){let r=Mr(e);return t({action:"aggregate",unpacker:r,argsMapper:pt})(e)}f();c();p();d();m();function iu(e={}){let{select:t,...r}=e;return typeof t=="object"?pt({...r,_count:t}):pt({...r,_count:{_all:!0}})}function ou(e={}){return typeof e.select=="object"?t=>Mr(e)(t)._count:t=>Mr(e)(t)._count._all}function Co(e,t){return t({action:"count",unpacker:ou(e),argsMapper:iu})(e)}f();c();p();d();m();function su(e={}){let t=pt(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 au(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:au(e),argsMapper:su})(e)}function So(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)}f();c();p();d();m();function Io(e,t){let r=t.fields.filter(i=>!i.relationName),n=dn(r,i=>i.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 Lt(e,o,s.type,s.isList,s.kind==="enum")},...wr(Object.keys(n))})}f();c();p();d();m();f();c();p();d();m();var Oo=e=>Array.isArray(e)?e:e.split("."),On=(e,t)=>Oo(t).reduce((r,n)=>r&&r[n],e),ko=(e,t,r)=>Oo(t).reduceRight((n,i,o,s)=>Object.assign({},On(e,s.slice(0,o)),{[i]:n}),r);function lu(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function uu(e,t,r){return t===void 0?e??{}:ko(t,r,e||!0)}function kn(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((l,u)=>({...l,[u.name]:u}),{});return l=>{let u=Me(e._errorFormat),g=lu(n,i),h=uu(l,o,g),v=r({dataPath:g,callsite:u})(h),S=cu(e,t);return new Proxy(v,{get(C,R){if(!S.includes(R))return C[R];let F=[a[R].type,r,R],q=[g,h];return kn(e,...F,...q)},...wr([...S,...Object.getOwnPropertyNames(v)])})}}function cu(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}f();c();p();d();m();f();c();p();d();m();var pu=_e($i());var du={red:Ye,gray:Di,dim:dr,bold:pr,underline:Ri,highlightSource:e=>e.highlight()},mu={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function fu({message:e,originalMethod:t,isPanic:r,callArguments:n}){return{functionName:`prisma.${t}()`,message:e,isPanic:r??!1,callArguments:n}}function gu({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(hu(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 hu(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function dt(e){let t=e.showColors?du:mu,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=fu(e),gu(r,t)}function Do(e,t,r,n){return e===qe.ModelAction.findFirstOrThrow||e===qe.ModelAction.findUniqueOrThrow?yu(t,r,n):n}function yu(e,t,r){return async n=>{if("rejectOnNotFound"in n.args){let o=dt({originalMethod:n.clientMethod,callsite:n.callsite,message:"'rejectOnNotFound' option is not supported"});throw new K(o,{clientVersion:t})}return await r(n).catch(o=>{throw o instanceof W&&o.code==="P2025"?new xe(`No ${e} found`,t):o})}}f();c();p();d();m();function we(e){return e.replace(/^./,t=>t.toLowerCase())}var wu=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],Eu=["aggregate","count","groupBy"];function Dn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[bu(e,t),Pu(e,t),Ft(r),te("name",()=>t),te("$name",()=>t),te("$parent",()=>e._appliedParent)];return fe({},n)}function bu(e,t){let r=we(t),n=Object.keys(qe.ModelAction).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=l=>e._request(l);s=Do(o,t,e._clientVersion,s);let a=l=>u=>{let g=Me(e._errorFormat);return e._createPrismaPromise(h=>{let v={args:u,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:h,callsite:g};return s({...v,...l})})};return wu.includes(o)?kn(e,t,a):xu(i)?So(e,i,a):a({})}}}function xu(e){return Eu.includes(e)}function Pu(e,t){return Ue(te("fields",()=>{let r=e._runtimeDataModel.models[t];return Io(t,r)}))}f();c();p();d();m();function Mo(e){return e.replace(/^./,t=>t.toUpperCase())}var Mn=Symbol();function Bt(e){let t=[vu(e),te(Mn,()=>e),te("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Ft(r)),fe(e,t)}function vu(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(we),n=[...new Set(t.concat(r))];return Ue({getKeys(){return n},getPropertyValue(i){let o=Mo(i);if(e._runtimeDataModel.models[o]!==void 0)return Dn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Dn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function No(e){return e[Mn]?e[Mn]:e}function Fo(e){if(typeof e=="function")return e(this);if(e.client?.__AccelerateEngine){let r=e.client.__AccelerateEngine;this._originalClient._engine=new r(this._originalClient._accelerateEngineConfig)}let t=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(e)},_appliedParent:{value:this,configurable:!0},$use:{value:void 0},$on:{value:void 0}});return Bt(t)}f();c();p();d();m();f();c();p();d();m();function _o({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let l of Object.values(o)){if(n){if(n[l.name])continue;let u=l.needs.filter(g=>n[g]);u.length>0&&a.push(et(u))}else if(r){if(!r[l.name])continue;let u=l.needs.filter(g=>!r[g]);u.length>0&&a.push(et(u))}Tu(e,l.needs)&&s.push(Au(l,fe(e,s)))}return s.length>0||a.length>0?fe(e,[...s,...a]):e}function Tu(e,t){return t.every(r=>pn(e,r))}function Au(e,t){return Ue(te(e.name,()=>e.compute(t)))}f();c();p();d();m();function Nr({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=Nr({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Lo({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Lo({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Lo({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null)continue;let l=n.models[r].fields.find(g=>g.name===o);if(!l||l.kind!=="object"||!l.relationName)continue;let u=typeof s=="object"?s:{};t[o]=Nr({visitor:i,result:t[o],args:u,modelName:l.type,runtimeDataModel:n})}}function qo({result:e,modelName:t,args:r,extensio
Learn how: https://pris.ly/d/${Yo[t]}-build`;throw console.error(n),new J(n,r)}}f();c();p();d();m();function Xo(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();var Iu="Cloudflare-Workers",Ou="node";function es(){return typeof Netlify=="object"?"netlify":typeof EdgeRuntime=="string"?"edge-light":globalThis.navigator?.userAgent===Iu?"workerd":globalThis.Deno?"deno":globalThis.__lagon__?"lagon":globalThis.process?.release?.name===Ou?"node":globalThis.Bun?"bun":globalThis.fastly?"fastly":"unknown"}var ku={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 Lr(){let e=es();return{id:e,prettyName:ku[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();function mt({inlineDatasources:e,overrideDatasources:t,env:r,clientVersion:n}){let i,o=Object.keys(e)[0],s=e[o]?.url,a=t[o]?.url;if(o===void 0?i=void 0:a?i=a:s?.value?i=s.value:s?.fromEnvVar&&(i=r[s.fromEnvVar]),s?.fromEnvVar!==void 0&&i===void 0)throw Lr().id==="workerd"?new J(`error: Environment variable not found: ${s.fromEnvVar}.
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 J(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new J("error: Missing URL environment variable, value, or override.",n);return i}f();c();p();d();m();f();c();p();d();m();var qr=class extends Error{constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var se=class extends qr{constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};f();c();p();d();m();f();c();p();d();m();function L(e,t){return{...e,isRetryable:t}}var ft=class extends se{constructor(r){super("This request must be retried",L(r,!0));this.name="ForcedRetryError";this.code="P5001"}};N(ft,"ForcedRetryError");f();c();p();d();m();var Ve=class extends se{constructor(r,n){super(r,L(n,!1));this.name="InvalidDatasourceError";this.code="P6001"}};N(Ve,"InvalidDatasourceError");f();c();p();d();m();var je=class extends se{constructor(r,n){super(r,L(n,!1));this.name="NotImplementedYetError";this.code="P5004"}};N(je,"NotImplementedYetError");f();c();p();d();m();f();c();p();d();m();var j=class extends se{constructor(t,r){super(t,r),this.response=r.response;let n=this.response.headers.get("prisma-request-id");if(n){let i=`(The request id was: ${n})`;this.message=this.message+" "+i}}};var Ge=class extends j{constructor(r){super("Schema needs to be uploaded",L(r,!0));this.name="SchemaMissingError";this.code="P5005"}};N(Ge,"SchemaMissingError");f();c();p();d();m();f();c();p();d();m();var Nn="This request could not be understood by the server",$t=class extends j{constructor(r,n,i){super(n||Nn,L(r,!1));this.name="BadRequestError";this.code="P5000";i&&(this.code=i)}};N($t,"BadRequestError");f();c();p();d();m();var Vt=class extends j{constructor(r,n){super("Engine not started: healthcheck timeout",L(r,!0));this.name="HealthcheckTimeoutError";this.code="P5013";this.logs=n}};N(Vt,"HealthcheckTimeoutError");f();c();p();d();m();var jt=class extends j{constructor(r,n,i){super(n,L(r,!0));this.name="EngineStartupError";this.code="P5014";this.logs=i}};N(jt,"EngineStartupError");f();c();p();d();m();var Gt=class extends j{constructor(r){super("Engine version is not supported",L(r,!1));this.name="EngineVersionNotSupportedError";this.code="P5012"}};N(Gt,"EngineVersionNotSupportedError");f();c();p();d();m();var Fn="Request timed out",Jt=class extends j{constructor(r,n=Fn){super(n,L(r,!1));this.name="GatewayTimeoutError";this.code="P5009"}};N(Jt,"GatewayTimeoutError");f();c();p();d();m();var Du="Interactive transaction error",Qt=class extends j{constructor(r,n=Du){super(n,L(r,!1));this.name="InteractiveTransactionError";this.code="P5015"}};N(Qt,"InteractiveTransactionError");f();c();p();d();m();var Mu="Request parameters are invalid",Ht=class extends j{constructor(r,n=Mu){super(n,L(r,!1));this.name="InvalidRequestError";this.code="P5011"}};N(Ht,"InvalidRequestError");f();c();p();d();m();var _n="Requested resource does not exist",Wt=class extends j{constructor(r,n=_n){super(n,L(r,!1));this.name="NotFoundError";this.code="P5003"}};N(Wt,"NotFoundError");f();c();p();d();m();var Ln="Unknown server error",gt=class extends j{constructor(r,n,i){super(n||Ln,L(r,!0));this.name="ServerError";this.code="P5006";this.logs=i}};N(gt,"ServerError");f();c();p();d();m();var qn="Unauthorized, check your connection string",Kt=class extends j{constructor(r,n=qn){super(n,L(r,!1));this.name="UnauthorizedError";this.code="P5007"}};N(Kt,"UnauthorizedError");f();c();p();d();m();var Bn="Usage exceeded, retry again later",zt=class extends j{constructor(r,n=Bn){super(n,L(r,!0));this.name="UsageExceededError";this.code="P5008"}};N(zt,"UsageExceededError");async function Nu(e){let t;try{t=await e.text()}catch{return{type:"EmptyError"}}try{let r=JSON.parse(t);if(typeof r=="string")switch(r){case"InternalDataProxyError":return{type:"DataProxyError",body:r};default:return{type:"UnknownTextError",body:r}}if(typeof r=="object"&&r!==null){if("is_panic"in r&&"message"in r&&"error_code"in r)return{type:"QueryEngineErro
${r}`,L(n,!0));this.name="RequestError";this.code="P5010"}};N(Zt,"RequestError");async function Je(e,t,r=n=>n){let n=t.clientVersion;try{return typeof fetch=="function"?await r(fetch)(e,t):await r(Un)(e,t)}catch(i){let o=i.message??"Unknown error";throw new Zt(o,{clientVersion:n})}}function Lu(e){return{...e.headers,"Content-Type":"application/json"}}function qu(e){return{method:e.method,headers:Lu(e)}}function Bu(e,t){return{text:()=>Promise.resolve(w.Buffer.concat(e).toString()),json:()=>Promise.resolve().then(()=>JSON.parse(w.Buffer.concat(e).toString())),ok:t.statusCode>=200&&t.statusCode<=299,status:t.statusCode,url:t.url,headers:new $n(t.headers)}}async function Un(e,t={}){let r=Uu("https"),n=qu(t),i=[],{origin:o}=new URL(e);return new Promise((s,a)=>{let l=r.request(e,n,u=>{let{statusCode:g,headers:{location:h}}=u;g>=301&&g<=399&&h&&(h.startsWith("http")===!1?s(Un(`${o}${h}`,t)):s(Un(h,t))),u.on("data",v=>i.push(v)),u.on("end",()=>s(Bu(i,u))),u.on("error",a)});l.on("error",a),l.end(t.body??"")})}var Uu=typeof require<"u"?require:()=>{},$n=class{constructor(t={}){this.headers=new Map;for(let[r,n]of Object.entries(t))if(typeof n=="string")this.headers.set(r,n);else if(Array.isArray(n))for(let i of n)this.headers.set(r,i)}append(t,r){this.headers.set(t,r)}delete(t){this.headers.delete(t)}get(t){return this.headers.get(t)??null}has(t){return this.headers.has(t)}set(t,r){this.headers.set(t,r)}forEach(t,r){for(let[n,i]of this.headers)t.call(r,i,n,this)}};var $u=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,ss=ee("prisma:client:dataproxyEngine");async function Vu(e,t){let r=os["@prisma/engines-version"],n=t.clientVersion??"unknown";if(y.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return y.env.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&&$u.test(i))return i;if(o!==void 0||n==="0.0.0"||n==="in-memory"){if(e.startsWith("localhost")||e.startsWith("127.0.0.1"))return"0.0.0";let[s]=r.split("-")??[],[a,l,u]=s.split("."),g=ju(`<=${a}.${l}.${u}`),h=await Je(g,{clientVersion:n});if(!h.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${h.status} ${h.statusText}, response body: ${await h.text()||"<empty body>"}`);let v=await h.text();ss("length of body fetched from unpkg.com",v.length);let S;try{S=JSON.parse(v)}catch(C){throw console.error("JSON.parse error: body fetched from unpkg.com: ",v),C}return S.version}throw new je("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function as(e,t){let r=await Vu(e,t);return ss("version",r),r}function ju(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var ls=3,Vn=ee("prisma:client:dataproxyEngine"),jn=class{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,interactiveTransaction:r}={}){let n={Authorization:`Bearer ${this.apiKey}`,"Prisma-Engine-Hash":this.engineHash};this.tracingHelper.isEnabled()&&(n.traceparent=t??this.tracingHelper.getTraceParent()),r&&(n["X-transaction-id"]=r.id);let i=this.buildCaptureSettings();return i.length>0&&(n["X-capture-telemetry"]=i.join(", ")),n}buildCaptureSettings(){let t=[];return this.tracingHelper.isEnabled()&&t.push("tracing"),this.logLevel&&t.push(this.logLevel),this.logQueries&&t.push("query"),t}},Xt=class{constructor(t){this.name="DataProxyEngine";ns(t),this.config=t,this.env={...t.env,...typeof y<"u"?y.env:{}},this.inlineSchema=rs(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[t,r]=this.extractHostAndApiKey();this.host=t,this.headerBuilder=new jn({apiKey:r,tracingHelper:this.tracingHelper,logLev
`),{clientVersion:t.clientVersion})}if(i)return new Xt(t);throw new K("Invalid client engine type, please use `library` or `binary`",{clientVersion:t.clientVersion})}f();c();p();d();m();function Br({generator:e}){return e?.previewFeatures??[]}f();c();p();d();m();f();c();p();d();m();function yt(e){return e.substring(0,1).toLowerCase()+e.substring(1)}f();c();p();d();m();f();c();p();d();m();var gs=_e(Gn());f();c();p();d();m();function ms(e,t,r){let n=fs(e),i=Gu(n),o=Qu(i);o?Ur(o,t,r):t.addErrorMessage(()=>"Unknown error")}function fs(e){return e.errors.flatMap(t=>t.kind==="Union"?fs(t):[t])}function Gu(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:Ju(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function Ju(e,t){return[...new Set(e.concat(t))]}function Qu(e){return mn(e,(t,r)=>{let n=ps(t),i=ps(r);return n!==i?n-i:ds(t)-ds(r)})}function ps(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function ds(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}f();c();p();d();m();var le=class{constructor(t,r){this.name=t;this.value=r;this.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)}};f();c();p();d();m();var er=class{constructor(){this.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(at,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Ur(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":Hu(e,t);break;case"IncludeOnScalar":Wu(e,t);break;case"EmptySelection":Ku(e,t,r);break;case"UnknownSelectionField":Xu(e,t);break;case"UnknownArgument":ec(e,t);break;case"UnknownInputField":tc(e,t);break;case"RequiredArgumentMissing":rc(e,t);break;case"InvalidArgumentType":nc(e,t);break;case"InvalidArgumentValue":ic(e,t);break;case"ValueTooLarge":oc(e,t);break;case"SomeFieldsMissing":sc(e,t);break;case"TooManyFieldsGiven":ac(e,t);break;case"Union":ms(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function Hu(e,t){let r=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();r&&(r.getField(e.firstField)?.markAsError(),r.getField(e.secondField)?.markAsError()),t.addErrorMessage(n=>`Please ${n.bold("either")} use ${n.green(`\`${e.firstField}\``)} or ${n.green(`\`${e.secondField}\``)}, but ${n.red("not both")} at the same time.`)}function Wu(e,t){let[r,n]=tr(e.selectionPath),i=e.outputType,o=t.arguments.getDeepSelectionParent(r)?.value;if(o&&(o.getField(n)?.markAsError(),i))for(let s of i.fields)s.isRelation&&o.addSuggestion(new le(s.name,"true"));t.addErrorMessage(s=>{let a=`Invalid scalar field ${s.red(`\`${n}\``)} for ${s.bold("include")} statement`;return i?a+=` on model ${s.bold(i.name)}. ${rr(s)}`:a+=".",a+=`
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function Ku(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){zu(e,t,i);return}if(n.hasField("select")){Yu(e,t);return}}if(r?.[yt(e.outputType.name)]){Zu(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function zu(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new le(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 Yu(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),ws(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${rr(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function Zu(e,t){let r=new er;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new le("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=tr(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new ut;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 Xu(e,t){let[r,n]=tr(e.selectionPath),i=t.arguments.getDeepSubSelectionValue(r)?.asObject(),o;if(i){let s=i.getFieldValue("select")?.asObject(),a=i.getFieldValue("include")?.asObject(),l=i.getFieldValue("omit")?.asObject();s?.hasField(n)?(o="select",s.getField(n)?.markAsError(),ws(s,e.outputType)):a?.hasField(n)?(o="include",a.getField(n)?.markAsError(),lc(a,e.outputType)):l?.hasField(n)&&(o="omit",l.getField(n)?.markAsError(),uc(l,e.outputType))}t.addErrorMessage(s=>{let a=[`Unknown field ${s.red(`\`${n}\``)}`];return o&&a.push(`for ${s.bold(o)} statement`),a.push(`on model ${s.bold(`\`${e.outputType.name}\``)}.`),a.push(rr(s)),a.join(" ")})}function ec(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),cc(n,e.arguments)),t.addErrorMessage(i=>hs(i,r,e.arguments.map(o=>o.name)))}function tc(e,t){let[r,n]=tr(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&Es(o,e.inputType)}t.addErrorMessage(o=>hs(o,n,e.inputType.fields.map(s=>s.name)))}function hs(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=dc(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(rr(e)),n.join(" ")}function rc(e,t){let r;t.addErrorMessage(l=>r?.value instanceof z&&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]=tr(e.argumentPath),s=new er,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 le(o,s).makeRequired())}else{let l=e.inputTypes.map(ys).join(" | ");a.addSuggestion(new le(o,l).makeRequired())}}function ys(e){return e.kind==="list"?`${ys(e.elementType)}[]`:e.name}function nc(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=$r("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 ic(e,t){let r=e.argument.name,n=t.arguments.getDeepS
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 Hn=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(r instanceof Mt)n=r.sql,i={values:wt(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:wt(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:wt(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:wt(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=Ts(r),i={values:wt(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Os(`prisma.${e}(${n}, ${i.values})`):Os(`prisma.${e}(${n})`),{query:n,parameters:i}},ks={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new ie(t,r)}},Ds={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};f();c();p();d();m();function Wn(e){return function(r){let n,i=(o=e)=>{try{return o===void 0||o?.kind==="itx"?n??=Ms(r(o)):Ms(r(o))}catch(s){return Promise.reject(s)}};return{then(o,s){return i().then(o,s)},catch(o){return i().catch(o)},finally(o){return i().finally(o)},requestTransaction(o){let s=i(o);return s.requestTransaction?s.requestTransaction(o):s},[Symbol.toStringTag]:"PrismaPromise"}}}function Ms(e){return typeof e.then=="function"?e:Promise.resolve(e)}f();c();p();d();m();var Ns={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},async createEngineSpan(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Kn=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(t){return this.getGlobalTracingHelper().getTraceParent(t)}createEngineSpan(t){return this.getGlobalTracingHelper().createEngineSpan(t)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getGlobalTracingHelper().runInChildSpan(t,r)}getGlobalTracingHelper(){return globalThis.PRISMA_INSTRUMENTATION?.helper??Ns}};function Fs(e){return e.includes("tracing")?new Kn:Ns}f();c();p();d();m();function _s(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}f();c();p();d();m();function Ls(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)}f();c();p();d();m();var jr=class{constructor(){this._middlewares=[]}use(t){this._middlewares.push(t)}get(t){return this._middlewares[t]}has(t){return!!this._middlewares[t]}length(){return this._middlewares.length}};f();c();p();d();m();var Us=_e(Qi());f();c();p();d();m();function Gr(e){return typeof e.batchRequestIdx=="number"}f();c();p();d();m();function Jr(e){return e===null?e:Array.isArray(e)?e.map(Jr):typeof e=="object"?Ac(e)?Cc(e):Ze(e,Jr):e}function Ac(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function Cc({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":return w.Buffer.from(t,"base64");case"DateTime":return new Date(t);case"Decimal":return new he(t);case"Json":return JSON.parse(t);default:be(t,"Unknown tagged value")}}f();c();p();d();m();function qs(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(zn(e.query.arguments)),t.push(zn(e.query.selection)),t.join("")}function zn(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${zn(n)})`:r}).join(" ")})`}f();c();p();d();m();var Rc={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,updateOne:!0,upsertOne:!0};function Yn(e){return Rc[e]}f();c();p();d();m();var Qr=class{constructor(t){this.options=t;this.tickActive=!1;this.batches={}}request(t){let r=this.options.batchBy(t);return r?(this.batches[r]||(this.batches[r]=[],this.tickActive||(this.tickActive=!0
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};N(B,"PrismaClientConstructorValidationError");var Js=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],Qs=["pretty","colorless","minimal"],Hs=["info","query","warn","error"],Nc={datasources:(e,{datasourceNames:t})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new B(`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=Et(r,t)||` Available datasources: ${t.join(", ")}`;throw new B(`Unknown datasource ${r} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new B(`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 B(`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 B(`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===null)return;if(e===void 0)throw new B('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!Br(t).includes("driverAdapters"))throw new B('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(Tt()==="binary")throw new B('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 B(`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 B(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!Qs.includes(e)){let t=Et(e,Qs);throw new B(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new B(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!Hs.includes(r)){let n=Et(r,Hs);throw new B(`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=Et(i,o);throw new B(`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 B(`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 B(`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 B(`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 B('"omit" option is expected to be an object.');if(e===null)throw new B('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=_c(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 B(Lc(e,r))},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new B(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=Et(r,t);throw new B(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function zs(e,t){for(let[r,n]of Object.entries(e)){if(!Js.includes(r)){let i=Et(r,Js);throw new B(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}Nc[r](n,t)}if(e.datasourceUrl&&e.datasources)throw new B('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function Et(e,t){if(t.length===0||typeof e!="string")return"";let r=Fc(e,t);return r?` Did you mean "${r}"?`:""}function Fc(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,Ks.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 _c(e,t){return Ws(t.models,e)??Ws(t.types,e)}function Ws(e,t){let r=Object.keys(e).find(n=>yt(n)===t);if(r)return e[r]}function Lc(e,t){let r=ct(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}=Dr(r,"colorless");return`Error validating "omit" option:
${i}
${n}`}f();c();p();d();m();function Ys(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(g=>{n[u]=g,a()},g=>{if(!Gr(g)){l(g);return}g.batchRequestIdx===u?l(g):(i||(i=g),a())})})}var Ne=ee("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var qc={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},Bc=Symbol.for("prisma.client.transaction.id"),Uc={id:0,nextId(){return++this.id}};function ea(e){class t{constructor(n){this._originalClient=this;this._middlewares=new jr;this._createPrismaPromise=Wn();this.$extends=Fo;e=n?.__internal?.configOverride?.(e)??e,Zo(e),n&&zs(n,e);let i=new fr().on("error",()=>{});this._extensions=_r.empty(),this._previewFeatures=Br(e),this._clientVersion=e.clientVersion??Gs,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=Fs(this._previewFeatures);let o={rootEnvPath:e.relativeEnvPaths.rootEnvPath&&vt.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&vt.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=En(n.adapter);let l=e.activeProvider==="postgresql"?"postgres":e.activeProvider;if(s.provider!==l)throw new J(`The Driver Adapter \`${s.adapterName}\`, based on \`${s.provider}\`, is not compatible with the provider \`${l}\` specified in the Prisma schema.`,this._clientVersion);if(n.datasources||n.datasourceUrl!==void 0)throw new J("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 l=n??{},u=l.__internal??{},g=u.debug===!0;g&&ee.enable("prisma:client");let h=vt.resolve(e.dirname,e.relativePath);xi.existsSync(h)||(h=e.dirname),Ne("dirname",e.dirname),Ne("relativePath",e.relativePath),Ne("cwd",h);let v=u.engine||{};if(l.errorFormat?this._errorFormat=l.errorFormat:y.env.NODE_ENV==="production"?this._errorFormat="minimal":y.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:h,dirname:e.dirname,enableDebugLogs:g,allowTriggerPanic:v.allowTriggerPanic,datamodelPath:vt.join(e.dirname,e.filename??"schema.prisma"),prismaPath:v.binaryPath??void 0,engineEndpoint:v.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:l.log&&Ls(l.log),logQueries:l.log&&!!(typeof l.log=="string"?l.log==="query":l.log.find(S=>typeof S=="string"?S==="query":S.level==="query")),env:a?.parsed??{},flags:[],engineWasm:e.engineWasm,clientVersion:e.clientVersion,engineVersion:e.engineVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,overrideDatasources:Xo(l,e.datasourceNames),inlineDatasources:e.inlineDatasources,inlineSchemaHash:e.inlineSchemaHash,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:l.transactionOptions?.maxWait??2e3,timeout:l.transactionOptions?.timeout??5e3,isolationLevel:l.transactionOptions?.isolationLevel},logEmitter:i,isBundled:e.isBundled,adapter:s},this._accelerateEngineConfig={...this._engineConfig,accelerateUtils:{resolveDatasourceUrl:mt,getBatchRequestPayload:Er,prismaGraphQLToJSError:qt,PrismaClientUnknownRequestError:ne,PrismaClientInitializationError:J,PrismaClientKnownRequestError:W,debug:ee("prisma:client:accelerateEngine"),engineVersion:Xs.version,clientVersion:e.clientVersion}},Ne("clientVersion",e.clientVersion),this._engine=us(e,this._engineConfig),this._requestHandler=new Hr(this,i),l.log)for(let S of l.log){let C=typeof S=="string"?S:S.emit==="stdout"?S.level:null;C&&this.$on(C,R=>{Ct.log(`${Ct.tags[C]??""}`,R.message||R.query)})}this._metrics=new Xe(this._engine)}catch(l){throw l.clientVersion=this._clientVersion,l}return this._appliedParent=Bt(this)}get[Symbol.toStringTag](){return"PrismaClient"}$use(n){this._middlewares.use(n)}$on(n,i){n==="befor
`)),g?.kind==="batch"&&await g.lock,this._requestHandler.request({protocolQuery:R,modelName:l,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:g,unpacker:h,otelParentCtx:v,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:S})}catch(C){throw C.clientVersion=this._clientVersion,C}}get $metrics(){if(!this._hasPreviewFlag("metrics"))throw new K("`metrics` preview feature must be enabled in order to access metrics API",{clientVersion:this._clientVersion});return this._metrics}_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$applyPendingMigrations(){return this._engine.applyPendingMigrations()}}return t}function Zs(e,t){return $c(e)?[new ie(e,t),ks]:[e,Ds]}function $c(e){return Array.isArray(e)&&Array.isArray(e.raw)}f();c();p();d();m();var Vc=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function ta(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!Vc.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}f();c();p();d();m();0&&(module.exports={Debug,Decimal,Extensions,MetricsClient,NotFoundError,PrismaClientInitializationError,PrismaClientKnownRequestError,PrismaClientRustPanicError,PrismaClientUnknownRequestError,PrismaClientValidationError,Public,Sql,defineDmmfProperty,empty,getPrismaClient,getRuntime,join,makeStrictEnum,makeTypedQueryFactory,objectEnumValues,raw,sqltag,warnEnvConflicts,warnOnce});
//# sourceMappingURL=edge.js.map