prisma 6.10.0-dev.12 → 6.10.0-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +8 -8
- package/build/schema_engine_bg.wasm +0 -0
- package/package.json +14 -14
- package/prisma-client/generator-build/index.js +11 -11
- package/prisma-client/package.json +4 -4
- package/prisma-client/runtime/binary.js +2 -2
- package/prisma-client/runtime/binary.mjs +2 -2
- package/prisma-client/runtime/client.js +4 -4
- package/prisma-client/runtime/client.mjs +4 -4
- package/prisma-client/runtime/edge-esm.js +3 -3
- package/prisma-client/runtime/edge.js +3 -3
- package/prisma-client/runtime/library.js +2 -2
- package/prisma-client/runtime/library.mjs +2 -2
- package/prisma-client/runtime/query_compiler_bg.mysql.js +2 -2
- package/prisma-client/runtime/query_compiler_bg.mysql.mjs +2 -2
- package/prisma-client/runtime/query_compiler_bg.postgresql.js +2 -2
- package/prisma-client/runtime/query_compiler_bg.postgresql.mjs +2 -2
- package/prisma-client/runtime/query_compiler_bg.sqlite.js +2 -2
- package/prisma-client/runtime/query_compiler_bg.sqlite.mjs +2 -2
- package/prisma-client/runtime/react-native.js +2 -2
- package/prisma-client/scripts/default-index.js +3 -3
@@ -5,9 +5,9 @@ import * as __banner_node_url from "node:url";
|
|
5
5
|
const __filename = __banner_node_url.fileURLToPath(import.meta.url);
|
6
6
|
const __dirname = __banner_node_path.dirname(__filename);
|
7
7
|
const require = __banner_node_module.createRequire(import.meta.url);
|
8
|
-
var nc=Object.create;var Xn=Object.defineProperty;var ic=Object.getOwnPropertyDescriptor;var oc=Object.getOwnPropertyNames;var sc=Object.getPrototypeOf,ac=Object.prototype.hasOwnProperty;var Ut=(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 Lo=(e,t)=>()=>(e&&(t=e(e=0)),t);var G=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jt=(e,t)=>{for(var r in t)Xn(e,r,{get:t[r],enumerable:!0})},lc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oc(t))!ac.call(e,i)&&i!==r&&Xn(e,i,{get:()=>t[i],enumerable:!(n=ic(t,i))||n.enumerable});return e};var we=(e,t,r)=>(r=e!=null?nc(sc(e)):{},lc(t||!e||!e.__esModule?Xn(r,"default",{value:e,enumerable:!0}):r,e));var Xo=G((oh,kc)=>{kc.exports={name:"@prisma/internals",version:"6.10.0-dev.
|
8
|
+
var nc=Object.create;var Xn=Object.defineProperty;var ic=Object.getOwnPropertyDescriptor;var oc=Object.getOwnPropertyNames;var sc=Object.getPrototypeOf,ac=Object.prototype.hasOwnProperty;var Ut=(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 Lo=(e,t)=>()=>(e&&(t=e(e=0)),t);var G=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jt=(e,t)=>{for(var r in t)Xn(e,r,{get:t[r],enumerable:!0})},lc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oc(t))!ac.call(e,i)&&i!==r&&Xn(e,i,{get:()=>t[i],enumerable:!(n=ic(t,i))||n.enumerable});return e};var we=(e,t,r)=>(r=e!=null?nc(sc(e)):{},lc(t||!e||!e.__esModule?Xn(r,"default",{value:e,enumerable:!0}):r,e));var Xo=G((oh,kc)=>{kc.exports={name:"@prisma/internals",version:"6.10.0-dev.13",description:"This package is intended for Prisma's internal use",main:"dist/index.js",types:"dist/index.d.ts",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/internals"},homepage:"https://www.prisma.io",author:"Tim Suchanek <suchanek@prisma.io>",bugs:"https://github.com/prisma/prisma/issues",license:"Apache-2.0",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",test:"dotenv -e ../../.db.env -- jest --silent",prepublishOnly:"pnpm run build"},files:["README.md","dist","!**/libquery_engine*","!dist/get-generators/engines/*","scripts"],devDependencies:{"@babel/helper-validator-identifier":"7.25.9","@opentelemetry/api":"1.9.0","@swc/core":"1.11.5","@swc/jest":"0.2.37","@types/babel__helper-validator-identifier":"7.15.2","@types/jest":"29.5.14","@types/node":"18.19.76","@types/resolve":"1.20.6",archiver:"6.0.2","checkpoint-client":"1.1.33","cli-truncate":"4.0.0",dotenv:"16.5.0",esbuild:"0.25.1","escape-string-regexp":"5.0.0",execa:"5.1.1","fast-glob":"3.3.3","find-up":"7.0.0","fp-ts":"2.16.9","fs-extra":"11.3.0","fs-jetpack":"5.1.0","global-dirs":"4.0.0",globby:"11.1.0","identifier-regex":"1.0.0","indent-string":"4.0.0","is-windows":"1.0.2","is-wsl":"3.1.0",jest:"29.7.0","jest-junit":"16.0.0",kleur:"4.1.5","mock-stdin":"1.0.0","new-github-issue-url":"0.2.1","node-fetch":"3.3.2","npm-packlist":"5.1.3",open:"7.4.2","p-map":"4.0.0","read-package-up":"11.0.0",resolve:"1.22.10","string-width":"7.2.0","strip-ansi":"6.0.1","strip-indent":"4.0.0","temp-dir":"2.0.0",tempy:"1.0.1","terminal-link":"4.0.0",tmp:"0.2.3","ts-node":"10.9.2","ts-pattern":"5.6.2","ts-toolbelt":"9.6.0",typescript:"5.4.5",yarn:"1.22.22"},dependencies:{"@prisma/config":"workspace:*","@prisma/debug":"workspace:*","@prisma/dmmf":"workspace:*","@prisma/driver-adapter-utils":"workspace:*","@prisma/engines":"workspace:*","@prisma/fetch-engine":"workspace:*","@prisma/generator":"workspace:*","@prisma/generator-helper":"workspace:*","@prisma/get-platform":"workspace:*","@prisma/prisma-schema-wasm":"6.10.0-12.92dceb179d2de27c75ffc880013170792e527a34","@prisma/schema-engine-wasm":"6.10.0-12.92dceb179d2de27c75ffc880013170792e527a34","@prisma/schema-files-loader":"workspace:*",arg:"5.0.2",prompts:"2.4.2"},peerDependencies:{typescript:">=5.1.0"},peerDependenciesMeta:{typescript:{optional:!0}},sideEffects:!1}});var ts=G((lh,es)=>{"use strict";es.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((r,n)=>Math.min(r,n.length),1/0):0}});var os=G((ph,is)=>{"use strict";is.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 ls=G((mh,as)=>{"use strict";as.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var si=G((fh,us)=>{"use strict";var $c=ls();us.exports=e=>typeof e=="string"?e.replace($c(),""):e});var cs=G((wh,Vc)=>{Vc.exports={name:"dotenv",version:"16.5.0",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var gs=G((Eh,ke)=>{"use strict";var li=Ut("node:fs"),ui=Ut("node:path"),qc=Ut("node:os"),Uc=Ut("node:crypto"),jc=cs(),ds=jc.version,Bc=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Qc(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
|
9
9
|
`);let n;for(;(n=Bc.exec(r))!=null;){let i=n[1],o=n[2]||"";o=o.trim();let s=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(o=o.replace(/\\n/g,`
|
10
|
-
`),o=o.replace(/\\r/g,"\r")),t[i]=o}return t}function Hc(e){let t=fs(e),r=j.configDotenv({path:t});if(!r.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw s.code="MISSING_DATA",s}let n=ms(e).split(","),i=n.length,o;for(let s=0;s<i;s++)try{let a=n[s].trim(),l=Wc(r,a);o=j.decrypt(l.ciphertext,l.key);break}catch(a){if(s+1>=i)throw a}return j.parse(o)}function Gc(e){console.log(`[dotenv@${ds}][WARN] ${e}`)}function Kt(e){console.log(`[dotenv@${ds}][DEBUG] ${e}`)}function ms(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Wc(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=r.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${i.toUpperCase()}`,s=e.parsed[o];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:n}}function fs(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)li.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=ui.resolve(process.cwd(),".env.vault");return li.existsSync(t)?t:null}function ps(e){return e[0]==="~"?ui.join(qc.homedir(),e.slice(1)):e}function Jc(e){!!(e&&e.debug)&&Kt("Loading env from encrypted .env.vault");let r=j._parseVault(e),n=process.env;return e&&e.processEnv!=null&&(n=e.processEnv),j.populate(n,r,e),{parsed:r}}function Kc(e){let t=ui.resolve(process.cwd(),".env"),r="utf8",n=!!(e&&e.debug);e&&e.encoding?r=e.encoding:n&&Kt("No encoding is specified. UTF-8 is used by default");let i=[t];if(e&&e.path)if(!Array.isArray(e.path))i=[ps(e.path)];else{i=[];for(let l of e.path)i.push(ps(l))}let o,s={};for(let l of i)try{let u=j.parse(li.readFileSync(l,{encoding:r}));j.populate(s,u,e)}catch(u){n&&Kt(`Failed to load ${l} ${u.message}`),o=u}let a=process.env;return e&&e.processEnv!=null&&(a=e.processEnv),j.populate(a,s,e),o?{parsed:s,error:o}:{parsed:s}}function zc(e){if(ms(e).length===0)return j.configDotenv(e);let t=fs(e);return t?j._configVault(e):(Gc(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),j.configDotenv(e))}function Yc(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),i=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let s=Uc.createDecipheriv("aes-256-gcm",r,i);return s.setAuthTag(o),`${s.update(n)}${s.final()}`}catch(s){let a=s instanceof RangeError,l=s.message==="Invalid key length",u=s.message==="Unsupported state or unable to authenticate data";if(a||l){let c=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw c.code="INVALID_DOTENV_KEY",c}else if(u){let c=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw c.code="DECRYPTION_FAILED",c}else throw s}}function Zc(e,t,r={}){let n=!!(r&&r.debug),i=!!(r&&r.override);if(typeof t!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(i===!0&&(e[o]=t[o]),n&&Kt(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):e[o]=t[o]}var j={configDotenv:Kc,_configVault:Jc,_parseVault:Hc,config:zc,decrypt:Yc,parse:Qc,populate:Zc};ke.exports.configDotenv=j.configDotenv;ke.exports._configVault=j._configVault;ke.exports._parseVault=j._parseVault;ke.exports.config=j.config;ke.exports.decrypt=j.decrypt;ke.exports.parse=j.parse;ke.exports.populate=j.populate;ke.exports=j});var Es=G((Sh,Kr)=>{"use strict";Kr.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()};Kr.exports.default=Kr.exports});var bi=G((nw,Us)=>{"use strict";Us.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,f,g,h,I,T,C,w,k=[];for(l=0;l<i;l++)k.push(l+1),k.push(t.charCodeAt(s+l));for(var de=k.length-1;a<o-3;)for(I=r.charCodeAt(s+(u=a)),T=r.charCodeAt(s+(c=a+1)),C=r.charCodeAt(s+(p=a+2)),w=r.charCodeAt(s+(d=a+3)),f=a+=4,l=0;l<de;l+=2)g=k[l],h=k[l+1],u=e(g,u,c,I,h),c=e(u,c,p,T,h),p=e(c,p,d,C,h),f=e(p,d,f,w,h),k[l]=f,d=p,p=c,c=u,u=g;for(;a<o;)for(I=r.charCodeAt(s+(u=a)),f=++a,l=0;l<de;l+=2)g=k[l],k[l]=f=e(g,u,f,I,k[l+1]),u=g;return f}}()});var Gs=Lo(()=>{"use strict"});var Ws=Lo(()=>{"use strict"});var fa=G((Dx,Yd)=>{Yd.exports={name:"@prisma/engines-version",version:"6.10.0-11.23a074b7d12a9a3bff0be884b60c14f17cd7ae13",main:"index.js",types:"index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <suchanek@prisma.io>",prisma:{enginesVersion:"23a074b7d12a9a3bff0be884b60c14f17cd7ae13"},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 Ki=G(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.anumber=Ji;et.abytes=ol;et.ahash=tf;et.aexists=rf;et.aoutput=nf;function Ji(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ef(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ol(e,...t){if(!ef(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function tf(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ji(e.outputLen),Ji(e.blockLen)}function rf(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function nf(e,t){ol(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}});var Sl=G(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.add5L=P.add5H=P.add4H=P.add4L=P.add3H=P.add3L=P.rotlBL=P.rotlBH=P.rotlSL=P.rotlSH=P.rotr32L=P.rotr32H=P.rotrBL=P.rotrBH=P.rotrSL=P.rotrSH=P.shrSL=P.shrSH=P.toBig=void 0;P.fromBig=Yi;P.split=sl;P.add=xl;var On=BigInt(2**32-1),zi=BigInt(32);function Yi(e,t=!1){return t?{h:Number(e&On),l:Number(e>>zi&On)}:{h:Number(e>>zi&On)|0,l:Number(e&On)|0}}function sl(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:o,l:s}=Yi(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}var al=(e,t)=>BigInt(e>>>0)<<zi|BigInt(t>>>0);P.toBig=al;var ll=(e,t,r)=>e>>>r;P.shrSH=ll;var ul=(e,t,r)=>e<<32-r|t>>>r;P.shrSL=ul;var cl=(e,t,r)=>e>>>r|t<<32-r;P.rotrSH=cl;var pl=(e,t,r)=>e<<32-r|t>>>r;P.rotrSL=pl;var dl=(e,t,r)=>e<<64-r|t>>>r-32;P.rotrBH=dl;var ml=(e,t,r)=>e>>>r-32|t<<64-r;P.rotrBL=ml;var fl=(e,t)=>t;P.rotr32H=fl;var gl=(e,t)=>e;P.rotr32L=gl;var hl=(e,t,r)=>e<<r|t>>>32-r;P.rotlSH=hl;var yl=(e,t,r)=>t<<r|e>>>32-r;P.rotlSL=yl;var wl=(e,t,r)=>t<<r-32|e>>>64-r;P.rotlBH=wl;var El=(e,t,r)=>e<<r-32|t>>>64-r;P.rotlBL=El;function xl(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var bl=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);P.add3L=bl;var Pl=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;P.add3H=Pl;var vl=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);P.add4L=vl;var Tl=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;P.add4H=Tl;var Al=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);P.add5L=Al;var Cl=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;P.add5H=Cl;var of={fromBig:Yi,split:sl,toBig:al,shrSH:ll,shrSL:ul,rotrSH:cl,rotrSL:pl,rotrBH:dl,rotrBL:ml,rotr32H:fl,rotr32L:gl,rotlSH:hl,rotlSL:yl,rotlBH:wl,rotlBL:El,add:xl,add3L:bl,add3H:Pl,add4L:vl,add4H:Tl,add5H:Cl,add5L:Al};P.default=of});var Rl=G(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.crypto=void 0;var Be=Ut("node:crypto");Dn.crypto=Be&&typeof Be=="object"&&"webcrypto"in Be?Be.webcrypto:Be&&typeof Be=="object"&&"randomBytes"in Be?Be:void 0});var Ol=G(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.Hash=R.nextTick=R.byteSwapIfBE=R.isLE=void 0;R.isBytes=sf;R.u8=af;R.u32=lf;R.createView=uf;R.rotr=cf;R.rotl=pf;R.byteSwap=eo;R.byteSwap32=df;R.bytesToHex=ff;R.hexToBytes=gf;R.asyncLoop=yf;R.utf8ToBytes=kl;R.toBytes=_n;R.concatBytes=wf;R.checkOpts=Ef;R.wrapConstructor=xf;R.wrapConstructorWithOpts=bf;R.wrapXOFConstructorWithOpts=Pf;R.randomBytes=vf;var St=Rl(),Xi=Ki();function sf(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function af(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function lf(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function uf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function cf(e,t){return e<<32-t|e>>>t}function pf(e,t){return e<<t|e>>>32-t>>>0}R.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function eo(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}R.byteSwapIfBE=R.isLE?e=>e:e=>eo(e);function df(e){for(let t=0;t<e.length;t++)e[t]=eo(e[t])}var mf=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ff(e){(0,Xi.abytes)(e);let t="";for(let r=0;r<e.length;r++)t+=mf[e[r]];return t}var _e={_0:48,_9:57,A:65,F:70,a:97,f:102};function Il(e){if(e>=_e._0&&e<=_e._9)return e-_e._0;if(e>=_e.A&&e<=_e.F)return e-(_e.A-10);if(e>=_e.a&&e<=_e.f)return e-(_e.a-10)}function gf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=Il(e.charCodeAt(o)),a=Il(e.charCodeAt(o+1));if(s===void 0||a===void 0){let l=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+o)}n[i]=s*16+a}return n}var hf=async()=>{};R.nextTick=hf;async function yf(e,t,r){let n=Date.now();for(let i=0;i<e;i++){r(i);let o=Date.now()-n;o>=0&&o<t||(await(0,R.nextTick)(),n+=o)}}function kl(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function _n(e){return typeof e=="string"&&(e=kl(e)),(0,Xi.abytes)(e),e}function wf(...e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];(0,Xi.abytes)(i),t+=i.length}let r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){let o=e[n];r.set(o,i),i+=o.length}return r}var Zi=class{clone(){return this._cloneInto()}};R.Hash=Zi;function Ef(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}function xf(e){let t=n=>e().update(_n(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function bf(e){let t=(n,i)=>e(i).update(_n(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function Pf(e){let t=(n,i)=>e(i).update(_n(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function vf(e=32){if(St.crypto&&typeof St.crypto.getRandomValues=="function")return St.crypto.getRandomValues(new Uint8Array(e));if(St.crypto&&typeof St.crypto.randomBytes=="function")return St.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}});var Vl=G($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.shake256=$.shake128=$.keccak_512=$.keccak_384=$.keccak_256=$.keccak_224=$.sha3_512=$.sha3_384=$.sha3_256=$.sha3_224=$.Keccak=void 0;$.keccakP=Ll;var Rt=Ki(),xr=Sl(),Ne=Ol(),Nl=[],Ml=[],Fl=[],Tf=BigInt(0),Er=BigInt(1),Af=BigInt(2),Cf=BigInt(7),Sf=BigInt(256),Rf=BigInt(113);for(let e=0,t=Er,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Nl.push(2*(5*n+r)),Ml.push((e+1)*(e+2)/2%64);let i=Tf;for(let o=0;o<7;o++)t=(t<<Er^(t>>Cf)*Rf)%Sf,t&Af&&(i^=Er<<(Er<<BigInt(o))-Er);Fl.push(i)}var[If,kf]=(0,xr.split)(Fl,!0),Dl=(e,t,r)=>r>32?(0,xr.rotlBH)(e,t,r):(0,xr.rotlSH)(e,t,r),_l=(e,t,r)=>r>32?(0,xr.rotlBL)(e,t,r):(0,xr.rotlSL)(e,t,r);function Ll(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,l=(s+2)%10,u=r[l],c=r[l+1],p=Dl(u,c,1)^r[a],d=_l(u,c,1)^r[a+1];for(let f=0;f<50;f+=10)e[s+f]^=p,e[s+f+1]^=d}let i=e[2],o=e[3];for(let s=0;s<24;s++){let a=Ml[s],l=Dl(i,o,a),u=_l(i,o,a),c=Nl[s];i=e[c],o=e[c+1],e[c]=l,e[c+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=If[n],e[1]^=kf[n]}r.fill(0)}var br=class e extends Ne.Hash{constructor(t,r,n,i=!1,o=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,Rt.anumber)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Ne.u32)(this.state)}keccak(){Ne.isLE||(0,Ne.byteSwap32)(this.state32),Ll(this.state32,this.rounds),Ne.isLE||(0,Ne.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,Rt.aexists)(this);let{blockLen:r,state:n}=this;t=(0,Ne.toBytes)(t);let i=t.length;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);for(let a=0;a<s;a++)n[this.pos++]^=t[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,Rt.aexists)(this,!1),(0,Rt.abytes)(t),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,o=t.length;i<o;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);t.set(r.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,Rt.anumber)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,Rt.aoutput)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return t||(t=new e(r,n,i,s,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}};$.Keccak=br;var Qe=(e,t,r)=>(0,Ne.wrapConstructor)(()=>new br(t,e,r));$.sha3_224=Qe(6,144,224/8);$.sha3_256=Qe(6,136,256/8);$.sha3_384=Qe(6,104,384/8);$.sha3_512=Qe(6,72,512/8);$.keccak_224=Qe(1,144,224/8);$.keccak_256=Qe(1,136,256/8);$.keccak_384=Qe(1,104,384/8);$.keccak_512=Qe(1,72,512/8);var $l=(e,t,r)=>(0,Ne.wrapXOFConstructorWithOpts)((n={})=>new br(t,e,n.dkLen===void 0?r:n.dkLen,!0));$.shake128=$l(31,168,128/8);$.shake256=$l(31,136,256/8)});var Wl=G((cP,He)=>{"use strict";var{sha3_512:Of}=Vl(),Ul=24,Pr=32,to=(e=4,t=Math.random)=>{let r="";for(;r.length<e;)r=r+Math.floor(t()*36).toString(36);return r};function jl(e){let t=8n,r=0n;for(let n of e.values()){let i=BigInt(n);r=(r<<t)+i}return r}var Bl=(e="")=>jl(Of(e)).toString(36).slice(1),ql=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),Df=e=>ql[Math.floor(e()*ql.length)],Ql=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=Math.random}={})=>{let r=Object.keys(e).toString(),n=r.length?r+to(Pr,t):to(Pr,t);return Bl(n).substring(0,Pr)},Hl=e=>()=>e++,_f=476782367,Gl=({random:e=Math.random,counter:t=Hl(Math.floor(e()*_f)),length:r=Ul,fingerprint:n=Ql({random:e})}={})=>function(){let o=Df(e),s=Date.now().toString(36),a=t().toString(36),l=to(r,e),u=`${s+l+a+n}`;return`${o+Bl(u).substring(1,r)}`},Nf=Gl(),Mf=(e,{minLength:t=2,maxLength:r=Pr}={})=>{let n=e.length,i=/^[0-9a-z]+$/;try{if(typeof e=="string"&&n>=t&&n<=r&&i.test(e))return!0}finally{}return!1};He.exports.getConstants=()=>({defaultLength:Ul,bigLength:Pr});He.exports.init=Gl;He.exports.createId=Nf;He.exports.bufToBigInt=jl;He.exports.createCounter=Hl;He.exports.createFingerprint=Ql;He.exports.isCuid=Mf});var Jl=G((pP,vr)=>{"use strict";var{createId:Ff,init:Lf,getConstants:$f,isCuid:Vf}=Wl();vr.exports.createId=Ff;vr.exports.init=Lf;vr.exports.getConstants=$f;vr.exports.isCuid=Vf});var qo={};jt(qo,{defineExtension:()=>$o,getExtensionContext:()=>Vo});function $o(e){return typeof e=="function"?e:t=>t.$extends(e)}function Vo(e){return e}var jo={};jt(jo,{validator:()=>Uo});function Uo(...e){return t=>t}var Hr={};jt(Hr,{$:()=>Wo,bgBlack:()=>wc,bgBlue:()=>Pc,bgCyan:()=>Tc,bgGreen:()=>xc,bgMagenta:()=>vc,bgRed:()=>Ec,bgWhite:()=>Ac,bgYellow:()=>bc,black:()=>fc,blue:()=>Ke,bold:()=>X,cyan:()=>Ie,dim:()=>We,gray:()=>Qt,green:()=>Bt,grey:()=>yc,hidden:()=>dc,inverse:()=>pc,italic:()=>cc,magenta:()=>gc,red:()=>Re,reset:()=>uc,strikethrough:()=>mc,underline:()=>ie,white:()=>hc,yellow:()=>Je});var ei,Bo,Qo,Ho,Go=!0;typeof process<"u"&&({FORCE_COLOR:ei,NODE_DISABLE_COLORS:Bo,NO_COLOR:Qo,TERM:Ho}=process.env||{},Go=process.stdout&&process.stdout.isTTY);var Wo={enabled:!Bo&&Qo==null&&Ho!=="dumb"&&(ei!=null&&ei!=="0"||Go)};function M(e,t){let r=new RegExp(`\\x1b\\[${t}m`,"g"),n=`\x1B[${e}m`,i=`\x1B[${t}m`;return function(o){return!Wo.enabled||o==null?o:n+(~(""+o).indexOf(i)?o.replace(r,i+n):o)+i}}var uc=M(0,0),X=M(1,22),We=M(2,22),cc=M(3,23),ie=M(4,24),pc=M(7,27),dc=M(8,28),mc=M(9,29),fc=M(30,39),Re=M(31,39),Bt=M(32,39),Je=M(33,39),Ke=M(34,39),gc=M(35,39),Ie=M(36,39),hc=M(37,39),Qt=M(90,39),yc=M(90,39),wc=M(40,49),Ec=M(41,49),xc=M(42,49),bc=M(43,49),Pc=M(44,49),vc=M(45,49),Tc=M(46,49),Ac=M(47,49);var Cc=100,Jo=["green","yellow","blue","magenta","cyan","red"],Ht=[],Ko=Date.now(),Sc=0,ti=typeof process<"u"?process.env:{};globalThis.DEBUG??=ti.DEBUG??"";globalThis.DEBUG_COLORS??=ti.DEBUG_COLORS?ti.DEBUG_COLORS==="true":!0;var Gt={enable(e){typeof e=="string"&&(globalThis.DEBUG=e)},disable(){let e=globalThis.DEBUG;return globalThis.DEBUG="",e},enabled(e){let t=globalThis.DEBUG.split(",").map(i=>i.replace(/[.+?^${}()|[\]\\]/g,"\\$&")),r=t.some(i=>i===""||i[0]==="-"?!1:e.match(RegExp(i.split("*").join(".*")+"$"))),n=t.some(i=>i===""||i[0]!=="-"?!1:e.match(RegExp(i.slice(1).split("*").join(".*")+"$")));return r&&!n},log:(...e)=>{let[t,r,...n]=e;(console.warn??console.log)(`${t} ${r}`,...n)},formatters:{}};function Rc(e){let t={color:Jo[Sc++%Jo.length],enabled:Gt.enabled(e),namespace:e,log:Gt.log,extend:()=>{}},r=(...n)=>{let{enabled:i,namespace:o,color:s,log:a}=t;if(n.length!==0&&Ht.push([o,...n]),Ht.length>Cc&&Ht.shift(),Gt.enabled(o)||i){let l=n.map(c=>typeof c=="string"?c:Ic(c)),u=`+${Date.now()-Ko}ms`;Ko=Date.now(),globalThis.DEBUG_COLORS?a(Hr[s](X(o)),...l,Hr[s](u)):a(o,...l,u)}};return new Proxy(r,{get:(n,i)=>t[i],set:(n,i,o)=>t[i]=o})}var q=new Proxy(Rc,{get:(e,t)=>Gt[t],set:(e,t,r)=>Gt[t]=r});function Ic(e,t=2){let r=new Set;return JSON.stringify(e,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular *]";r.add(i)}else if(typeof i=="bigint")return i.toString();return i},t)}function zo(e=7500){let t=Ht.map(([r,...n])=>`${r} ${n.map(i=>typeof i=="string"?i:JSON.stringify(i)).join(" ")}`).join(`
|
10
|
+
`),o=o.replace(/\\r/g,"\r")),t[i]=o}return t}function Hc(e){let t=fs(e),r=j.configDotenv({path:t});if(!r.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw s.code="MISSING_DATA",s}let n=ms(e).split(","),i=n.length,o;for(let s=0;s<i;s++)try{let a=n[s].trim(),l=Wc(r,a);o=j.decrypt(l.ciphertext,l.key);break}catch(a){if(s+1>=i)throw a}return j.parse(o)}function Gc(e){console.log(`[dotenv@${ds}][WARN] ${e}`)}function Kt(e){console.log(`[dotenv@${ds}][DEBUG] ${e}`)}function ms(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Wc(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=r.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${i.toUpperCase()}`,s=e.parsed[o];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:n}}function fs(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)li.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=ui.resolve(process.cwd(),".env.vault");return li.existsSync(t)?t:null}function ps(e){return e[0]==="~"?ui.join(qc.homedir(),e.slice(1)):e}function Jc(e){!!(e&&e.debug)&&Kt("Loading env from encrypted .env.vault");let r=j._parseVault(e),n=process.env;return e&&e.processEnv!=null&&(n=e.processEnv),j.populate(n,r,e),{parsed:r}}function Kc(e){let t=ui.resolve(process.cwd(),".env"),r="utf8",n=!!(e&&e.debug);e&&e.encoding?r=e.encoding:n&&Kt("No encoding is specified. UTF-8 is used by default");let i=[t];if(e&&e.path)if(!Array.isArray(e.path))i=[ps(e.path)];else{i=[];for(let l of e.path)i.push(ps(l))}let o,s={};for(let l of i)try{let u=j.parse(li.readFileSync(l,{encoding:r}));j.populate(s,u,e)}catch(u){n&&Kt(`Failed to load ${l} ${u.message}`),o=u}let a=process.env;return e&&e.processEnv!=null&&(a=e.processEnv),j.populate(a,s,e),o?{parsed:s,error:o}:{parsed:s}}function zc(e){if(ms(e).length===0)return j.configDotenv(e);let t=fs(e);return t?j._configVault(e):(Gc(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),j.configDotenv(e))}function Yc(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),i=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let s=Uc.createDecipheriv("aes-256-gcm",r,i);return s.setAuthTag(o),`${s.update(n)}${s.final()}`}catch(s){let a=s instanceof RangeError,l=s.message==="Invalid key length",u=s.message==="Unsupported state or unable to authenticate data";if(a||l){let c=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw c.code="INVALID_DOTENV_KEY",c}else if(u){let c=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw c.code="DECRYPTION_FAILED",c}else throw s}}function Zc(e,t,r={}){let n=!!(r&&r.debug),i=!!(r&&r.override);if(typeof t!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(i===!0&&(e[o]=t[o]),n&&Kt(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):e[o]=t[o]}var j={configDotenv:Kc,_configVault:Jc,_parseVault:Hc,config:zc,decrypt:Yc,parse:Qc,populate:Zc};ke.exports.configDotenv=j.configDotenv;ke.exports._configVault=j._configVault;ke.exports._parseVault=j._parseVault;ke.exports.config=j.config;ke.exports.decrypt=j.decrypt;ke.exports.parse=j.parse;ke.exports.populate=j.populate;ke.exports=j});var Es=G((Sh,Kr)=>{"use strict";Kr.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()};Kr.exports.default=Kr.exports});var bi=G((nw,Us)=>{"use strict";Us.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,f,g,h,I,T,C,w,k=[];for(l=0;l<i;l++)k.push(l+1),k.push(t.charCodeAt(s+l));for(var de=k.length-1;a<o-3;)for(I=r.charCodeAt(s+(u=a)),T=r.charCodeAt(s+(c=a+1)),C=r.charCodeAt(s+(p=a+2)),w=r.charCodeAt(s+(d=a+3)),f=a+=4,l=0;l<de;l+=2)g=k[l],h=k[l+1],u=e(g,u,c,I,h),c=e(u,c,p,T,h),p=e(c,p,d,C,h),f=e(p,d,f,w,h),k[l]=f,d=p,p=c,c=u,u=g;for(;a<o;)for(I=r.charCodeAt(s+(u=a)),f=++a,l=0;l<de;l+=2)g=k[l],k[l]=f=e(g,u,f,I,k[l+1]),u=g;return f}}()});var Gs=Lo(()=>{"use strict"});var Ws=Lo(()=>{"use strict"});var fa=G((Dx,Yd)=>{Yd.exports={name:"@prisma/engines-version",version:"6.10.0-12.92dceb179d2de27c75ffc880013170792e527a34",main:"index.js",types:"index.d.ts",license:"Apache-2.0",author:"Tim Suchanek <suchanek@prisma.io>",prisma:{enginesVersion:"92dceb179d2de27c75ffc880013170792e527a34"},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 Ki=G(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.anumber=Ji;et.abytes=ol;et.ahash=tf;et.aexists=rf;et.aoutput=nf;function Ji(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ef(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ol(e,...t){if(!ef(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function tf(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ji(e.outputLen),Ji(e.blockLen)}function rf(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function nf(e,t){ol(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}});var Sl=G(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.add5L=P.add5H=P.add4H=P.add4L=P.add3H=P.add3L=P.rotlBL=P.rotlBH=P.rotlSL=P.rotlSH=P.rotr32L=P.rotr32H=P.rotrBL=P.rotrBH=P.rotrSL=P.rotrSH=P.shrSL=P.shrSH=P.toBig=void 0;P.fromBig=Yi;P.split=sl;P.add=xl;var On=BigInt(2**32-1),zi=BigInt(32);function Yi(e,t=!1){return t?{h:Number(e&On),l:Number(e>>zi&On)}:{h:Number(e>>zi&On)|0,l:Number(e&On)|0}}function sl(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:o,l:s}=Yi(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]}var al=(e,t)=>BigInt(e>>>0)<<zi|BigInt(t>>>0);P.toBig=al;var ll=(e,t,r)=>e>>>r;P.shrSH=ll;var ul=(e,t,r)=>e<<32-r|t>>>r;P.shrSL=ul;var cl=(e,t,r)=>e>>>r|t<<32-r;P.rotrSH=cl;var pl=(e,t,r)=>e<<32-r|t>>>r;P.rotrSL=pl;var dl=(e,t,r)=>e<<64-r|t>>>r-32;P.rotrBH=dl;var ml=(e,t,r)=>e>>>r-32|t<<64-r;P.rotrBL=ml;var fl=(e,t)=>t;P.rotr32H=fl;var gl=(e,t)=>e;P.rotr32L=gl;var hl=(e,t,r)=>e<<r|t>>>32-r;P.rotlSH=hl;var yl=(e,t,r)=>t<<r|e>>>32-r;P.rotlSL=yl;var wl=(e,t,r)=>t<<r-32|e>>>64-r;P.rotlBH=wl;var El=(e,t,r)=>e<<r-32|t>>>64-r;P.rotlBL=El;function xl(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var bl=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);P.add3L=bl;var Pl=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;P.add3H=Pl;var vl=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);P.add4L=vl;var Tl=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;P.add4H=Tl;var Al=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);P.add5L=Al;var Cl=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;P.add5H=Cl;var of={fromBig:Yi,split:sl,toBig:al,shrSH:ll,shrSL:ul,rotrSH:cl,rotrSL:pl,rotrBH:dl,rotrBL:ml,rotr32H:fl,rotr32L:gl,rotlSH:hl,rotlSL:yl,rotlBH:wl,rotlBL:El,add:xl,add3L:bl,add3H:Pl,add4L:vl,add4H:Tl,add5H:Cl,add5L:Al};P.default=of});var Rl=G(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.crypto=void 0;var Be=Ut("node:crypto");Dn.crypto=Be&&typeof Be=="object"&&"webcrypto"in Be?Be.webcrypto:Be&&typeof Be=="object"&&"randomBytes"in Be?Be:void 0});var Ol=G(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.Hash=R.nextTick=R.byteSwapIfBE=R.isLE=void 0;R.isBytes=sf;R.u8=af;R.u32=lf;R.createView=uf;R.rotr=cf;R.rotl=pf;R.byteSwap=eo;R.byteSwap32=df;R.bytesToHex=ff;R.hexToBytes=gf;R.asyncLoop=yf;R.utf8ToBytes=kl;R.toBytes=_n;R.concatBytes=wf;R.checkOpts=Ef;R.wrapConstructor=xf;R.wrapConstructorWithOpts=bf;R.wrapXOFConstructorWithOpts=Pf;R.randomBytes=vf;var St=Rl(),Xi=Ki();function sf(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function af(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function lf(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function uf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function cf(e,t){return e<<32-t|e>>>t}function pf(e,t){return e<<t|e>>>32-t>>>0}R.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function eo(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}R.byteSwapIfBE=R.isLE?e=>e:e=>eo(e);function df(e){for(let t=0;t<e.length;t++)e[t]=eo(e[t])}var mf=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ff(e){(0,Xi.abytes)(e);let t="";for(let r=0;r<e.length;r++)t+=mf[e[r]];return t}var _e={_0:48,_9:57,A:65,F:70,a:97,f:102};function Il(e){if(e>=_e._0&&e<=_e._9)return e-_e._0;if(e>=_e.A&&e<=_e.F)return e-(_e.A-10);if(e>=_e.a&&e<=_e.f)return e-(_e.a-10)}function gf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=Il(e.charCodeAt(o)),a=Il(e.charCodeAt(o+1));if(s===void 0||a===void 0){let l=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+o)}n[i]=s*16+a}return n}var hf=async()=>{};R.nextTick=hf;async function yf(e,t,r){let n=Date.now();for(let i=0;i<e;i++){r(i);let o=Date.now()-n;o>=0&&o<t||(await(0,R.nextTick)(),n+=o)}}function kl(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function _n(e){return typeof e=="string"&&(e=kl(e)),(0,Xi.abytes)(e),e}function wf(...e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];(0,Xi.abytes)(i),t+=i.length}let r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){let o=e[n];r.set(o,i),i+=o.length}return r}var Zi=class{clone(){return this._cloneInto()}};R.Hash=Zi;function Ef(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}function xf(e){let t=n=>e().update(_n(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function bf(e){let t=(n,i)=>e(i).update(_n(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function Pf(e){let t=(n,i)=>e(i).update(_n(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function vf(e=32){if(St.crypto&&typeof St.crypto.getRandomValues=="function")return St.crypto.getRandomValues(new Uint8Array(e));if(St.crypto&&typeof St.crypto.randomBytes=="function")return St.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}});var Vl=G($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.shake256=$.shake128=$.keccak_512=$.keccak_384=$.keccak_256=$.keccak_224=$.sha3_512=$.sha3_384=$.sha3_256=$.sha3_224=$.Keccak=void 0;$.keccakP=Ll;var Rt=Ki(),xr=Sl(),Ne=Ol(),Nl=[],Ml=[],Fl=[],Tf=BigInt(0),Er=BigInt(1),Af=BigInt(2),Cf=BigInt(7),Sf=BigInt(256),Rf=BigInt(113);for(let e=0,t=Er,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Nl.push(2*(5*n+r)),Ml.push((e+1)*(e+2)/2%64);let i=Tf;for(let o=0;o<7;o++)t=(t<<Er^(t>>Cf)*Rf)%Sf,t&Af&&(i^=Er<<(Er<<BigInt(o))-Er);Fl.push(i)}var[If,kf]=(0,xr.split)(Fl,!0),Dl=(e,t,r)=>r>32?(0,xr.rotlBH)(e,t,r):(0,xr.rotlSH)(e,t,r),_l=(e,t,r)=>r>32?(0,xr.rotlBL)(e,t,r):(0,xr.rotlSL)(e,t,r);function Ll(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,l=(s+2)%10,u=r[l],c=r[l+1],p=Dl(u,c,1)^r[a],d=_l(u,c,1)^r[a+1];for(let f=0;f<50;f+=10)e[s+f]^=p,e[s+f+1]^=d}let i=e[2],o=e[3];for(let s=0;s<24;s++){let a=Ml[s],l=Dl(i,o,a),u=_l(i,o,a),c=Nl[s];i=e[c],o=e[c+1],e[c]=l,e[c+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=If[n],e[1]^=kf[n]}r.fill(0)}var br=class e extends Ne.Hash{constructor(t,r,n,i=!1,o=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,Rt.anumber)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Ne.u32)(this.state)}keccak(){Ne.isLE||(0,Ne.byteSwap32)(this.state32),Ll(this.state32,this.rounds),Ne.isLE||(0,Ne.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,Rt.aexists)(this);let{blockLen:r,state:n}=this;t=(0,Ne.toBytes)(t);let i=t.length;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);for(let a=0;a<s;a++)n[this.pos++]^=t[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,Rt.aexists)(this,!1),(0,Rt.abytes)(t),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,o=t.length;i<o;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);t.set(r.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,Rt.anumber)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,Rt.aoutput)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return t||(t=new e(r,n,i,s,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}};$.Keccak=br;var Qe=(e,t,r)=>(0,Ne.wrapConstructor)(()=>new br(t,e,r));$.sha3_224=Qe(6,144,224/8);$.sha3_256=Qe(6,136,256/8);$.sha3_384=Qe(6,104,384/8);$.sha3_512=Qe(6,72,512/8);$.keccak_224=Qe(1,144,224/8);$.keccak_256=Qe(1,136,256/8);$.keccak_384=Qe(1,104,384/8);$.keccak_512=Qe(1,72,512/8);var $l=(e,t,r)=>(0,Ne.wrapXOFConstructorWithOpts)((n={})=>new br(t,e,n.dkLen===void 0?r:n.dkLen,!0));$.shake128=$l(31,168,128/8);$.shake256=$l(31,136,256/8)});var Wl=G((cP,He)=>{"use strict";var{sha3_512:Of}=Vl(),Ul=24,Pr=32,to=(e=4,t=Math.random)=>{let r="";for(;r.length<e;)r=r+Math.floor(t()*36).toString(36);return r};function jl(e){let t=8n,r=0n;for(let n of e.values()){let i=BigInt(n);r=(r<<t)+i}return r}var Bl=(e="")=>jl(Of(e)).toString(36).slice(1),ql=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),Df=e=>ql[Math.floor(e()*ql.length)],Ql=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=Math.random}={})=>{let r=Object.keys(e).toString(),n=r.length?r+to(Pr,t):to(Pr,t);return Bl(n).substring(0,Pr)},Hl=e=>()=>e++,_f=476782367,Gl=({random:e=Math.random,counter:t=Hl(Math.floor(e()*_f)),length:r=Ul,fingerprint:n=Ql({random:e})}={})=>function(){let o=Df(e),s=Date.now().toString(36),a=t().toString(36),l=to(r,e),u=`${s+l+a+n}`;return`${o+Bl(u).substring(1,r)}`},Nf=Gl(),Mf=(e,{minLength:t=2,maxLength:r=Pr}={})=>{let n=e.length,i=/^[0-9a-z]+$/;try{if(typeof e=="string"&&n>=t&&n<=r&&i.test(e))return!0}finally{}return!1};He.exports.getConstants=()=>({defaultLength:Ul,bigLength:Pr});He.exports.init=Gl;He.exports.createId=Nf;He.exports.bufToBigInt=jl;He.exports.createCounter=Hl;He.exports.createFingerprint=Ql;He.exports.isCuid=Mf});var Jl=G((pP,vr)=>{"use strict";var{createId:Ff,init:Lf,getConstants:$f,isCuid:Vf}=Wl();vr.exports.createId=Ff;vr.exports.init=Lf;vr.exports.getConstants=$f;vr.exports.isCuid=Vf});var qo={};jt(qo,{defineExtension:()=>$o,getExtensionContext:()=>Vo});function $o(e){return typeof e=="function"?e:t=>t.$extends(e)}function Vo(e){return e}var jo={};jt(jo,{validator:()=>Uo});function Uo(...e){return t=>t}var Hr={};jt(Hr,{$:()=>Wo,bgBlack:()=>wc,bgBlue:()=>Pc,bgCyan:()=>Tc,bgGreen:()=>xc,bgMagenta:()=>vc,bgRed:()=>Ec,bgWhite:()=>Ac,bgYellow:()=>bc,black:()=>fc,blue:()=>Ke,bold:()=>X,cyan:()=>Ie,dim:()=>We,gray:()=>Qt,green:()=>Bt,grey:()=>yc,hidden:()=>dc,inverse:()=>pc,italic:()=>cc,magenta:()=>gc,red:()=>Re,reset:()=>uc,strikethrough:()=>mc,underline:()=>ie,white:()=>hc,yellow:()=>Je});var ei,Bo,Qo,Ho,Go=!0;typeof process<"u"&&({FORCE_COLOR:ei,NODE_DISABLE_COLORS:Bo,NO_COLOR:Qo,TERM:Ho}=process.env||{},Go=process.stdout&&process.stdout.isTTY);var Wo={enabled:!Bo&&Qo==null&&Ho!=="dumb"&&(ei!=null&&ei!=="0"||Go)};function M(e,t){let r=new RegExp(`\\x1b\\[${t}m`,"g"),n=`\x1B[${e}m`,i=`\x1B[${t}m`;return function(o){return!Wo.enabled||o==null?o:n+(~(""+o).indexOf(i)?o.replace(r,i+n):o)+i}}var uc=M(0,0),X=M(1,22),We=M(2,22),cc=M(3,23),ie=M(4,24),pc=M(7,27),dc=M(8,28),mc=M(9,29),fc=M(30,39),Re=M(31,39),Bt=M(32,39),Je=M(33,39),Ke=M(34,39),gc=M(35,39),Ie=M(36,39),hc=M(37,39),Qt=M(90,39),yc=M(90,39),wc=M(40,49),Ec=M(41,49),xc=M(42,49),bc=M(43,49),Pc=M(44,49),vc=M(45,49),Tc=M(46,49),Ac=M(47,49);var Cc=100,Jo=["green","yellow","blue","magenta","cyan","red"],Ht=[],Ko=Date.now(),Sc=0,ti=typeof process<"u"?process.env:{};globalThis.DEBUG??=ti.DEBUG??"";globalThis.DEBUG_COLORS??=ti.DEBUG_COLORS?ti.DEBUG_COLORS==="true":!0;var Gt={enable(e){typeof e=="string"&&(globalThis.DEBUG=e)},disable(){let e=globalThis.DEBUG;return globalThis.DEBUG="",e},enabled(e){let t=globalThis.DEBUG.split(",").map(i=>i.replace(/[.+?^${}()|[\]\\]/g,"\\$&")),r=t.some(i=>i===""||i[0]==="-"?!1:e.match(RegExp(i.split("*").join(".*")+"$"))),n=t.some(i=>i===""||i[0]!=="-"?!1:e.match(RegExp(i.slice(1).split("*").join(".*")+"$")));return r&&!n},log:(...e)=>{let[t,r,...n]=e;(console.warn??console.log)(`${t} ${r}`,...n)},formatters:{}};function Rc(e){let t={color:Jo[Sc++%Jo.length],enabled:Gt.enabled(e),namespace:e,log:Gt.log,extend:()=>{}},r=(...n)=>{let{enabled:i,namespace:o,color:s,log:a}=t;if(n.length!==0&&Ht.push([o,...n]),Ht.length>Cc&&Ht.shift(),Gt.enabled(o)||i){let l=n.map(c=>typeof c=="string"?c:Ic(c)),u=`+${Date.now()-Ko}ms`;Ko=Date.now(),globalThis.DEBUG_COLORS?a(Hr[s](X(o)),...l,Hr[s](u)):a(o,...l,u)}};return new Proxy(r,{get:(n,i)=>t[i],set:(n,i,o)=>t[i]=o})}var q=new Proxy(Rc,{get:(e,t)=>Gt[t],set:(e,t,r)=>Gt[t]=r});function Ic(e,t=2){let r=new Set;return JSON.stringify(e,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular *]";r.add(i)}else if(typeof i=="bigint")return i.toString();return i},t)}function zo(e=7500){let t=Ht.map(([r,...n])=>`${r} ${n.map(i=>typeof i=="string"?i:JSON.stringify(i)).join(" ")}`).join(`
|
11
11
|
`);return t.length<e?t:t.slice(-e)}function Yo(){Ht.length=0}var Zo=q;var Oc=Xo(),ri=Oc.version;function ct(e){let t=Dc();return t||(e?.config.engineType==="library"?"library":e?.config.engineType==="binary"?"binary":e?.config.engineType==="client"?"client":_c(e))}function Dc(){let e=process.env.PRISMA_CLIENT_ENGINE_TYPE;return e==="library"?"library":e==="binary"?"binary":e==="client"?"client":void 0}function _c(e){return e?.previewFeatures.includes("queryCompiler")?"client":"library"}var rs=we(ts(),1);function ni(e){let t=(0,rs.default)(e);if(t===0)return e;let r=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(r,"")}var ns="prisma+postgres",Gr=`${ns}:`;function Wr(e){return e?.toString().startsWith(`${Gr}//`)??!1}function ii(e){if(!Wr(e))return!1;let{host:t}=new URL(e);return t.includes("localhost")||t.includes("127.0.0.1")}var Jt={};jt(Jt,{error:()=>Fc,info:()=>Mc,log:()=>Nc,query:()=>Lc,should:()=>ss,tags:()=>Wt,warn:()=>oi});var Wt={error:Re("prisma:error"),warn:Je("prisma:warn"),info:Ie("prisma:info"),query:Ke("prisma:query")},ss={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function Nc(...e){console.log(...e)}function oi(e,...t){ss.warn()&&console.warn(`${Wt.warn} ${e}`,...t)}function Mc(e,...t){console.info(`${Wt.info} ${e}`,...t)}function Fc(e,...t){console.error(`${Wt.error} ${e}`,...t)}function Lc(e,...t){console.log(`${Wt.query} ${e}`,...t)}function me(e,t){throw new Error(t)}import Jr from"node:path";function ai(e){return Jr.sep===Jr.posix.sep?e:e.split(Jr.sep).join(Jr.posix.sep)}var di=we(gs());import ci from"node:fs";import zt from"node:path";function hs(e){let t=e.ignoreProcessEnv?{}:process.env,r=n=>n.match(/(.?\${(?:[a-zA-Z0-9_]+)?})/g)?.reduce(function(o,s){let a=/(.?)\${([a-zA-Z0-9_]+)?}/g.exec(s);if(!a)return o;let l=a[1],u,c;if(l==="\\")c=a[0],u=c.replace("\\$","$");else{let p=a[2];c=a[0].substring(l.length),u=Object.hasOwnProperty.call(t,p)?t[p]:e.parsed[p]||"",u=r(u)}return o.replace(c,u)},n)??n;for(let n in e.parsed){let i=Object.hasOwnProperty.call(t,n)?t[n]:e.parsed[n];e.parsed[n]=r(i)}for(let n in e.parsed)t[n]=e.parsed[n];return e}var pi=Zo("prisma:tryLoadEnv");function Yt({rootEnvPath:e,schemaEnvPath:t},r={conflictCheck:"none"}){let n=ys(e);r.conflictCheck!=="none"&&Xc(n,t,r.conflictCheck);let i=null;return ws(n?.path,t)||(i=ys(t)),!n&&!i&&pi("No Environment variables loaded"),i?.dotenvResult.error?console.error(Re(X("Schema Env Error: "))+i.dotenvResult.error):{message:[n?.message,i?.message].filter(Boolean).join(`
|
12
12
|
`),parsed:{...n?.dotenvResult?.parsed,...i?.dotenvResult?.parsed}}}function Xc(e,t,r){let n=e?.dotenvResult.parsed,i=!ws(e?.path,t);if(n&&t&&i&&ci.existsSync(t)){let o=di.default.parse(ci.readFileSync(t)),s=[];for(let a in o)n[a]===o[a]&&s.push(a);if(s.length>0){let a=zt.relative(process.cwd(),e.path),l=zt.relative(process.cwd(),t);if(r==="error"){let u=`There is a conflict between env var${s.length>1?"s":""} in ${ie(a)} and ${ie(l)}
|
13
13
|
Conflicting env vars:
|
@@ -75,8 +75,8 @@ ${ie(p)}
|
|
75
75
|
If you want the Prisma team to look into it, please open the link above \u{1F64F}
|
76
76
|
To increase the chance of success, please post your schema and a snippet of
|
77
77
|
how you used Prisma Client in the issue.
|
78
|
-
`}function L(e,t){throw new Error(t)}function Ui(e,t){return e===t||e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(r=>Ui(e[r],t[r]))}function hr(e,t){let r=Object.keys(e),n=Object.keys(t);return(r.length<n.length?r:n).every(o=>{if(typeof e[o]!=typeof t[o]){if(typeof e[o]=="number"||typeof t[o]=="number")return`${e[o]}`==`${t[o]}`;if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return BigInt(`${e[o]}`.replace(/n$/,""))===BigInt(`${t[o]}`.replace(/n$/,""));if(e[o]instanceof Date||t[o]instanceof Date)return new Date(`${e[o]}`).getTime()===new Date(`${t[o]}`).getTime();if(Z.isDecimal(e[o])||Z.isDecimal(t[o]))return new Z(`${e[o]}`).equals(new Z(`${t[o]}`))}return Ui(e[o],t[o])})}function yr(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():r instanceof Uint8Array?Buffer.from(r).toString("base64"):r)}var V=class extends Error{name="DataMapperError"};function el(e,t,r){switch(t.type){case"AffectedRows":if(typeof e!="number")throw new V(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"Object":return ji(e,t.fields,r);case"Value":return Bi(e,"<result>",t.resultType,r);default:L(t,`Invalid data mapping type: '${t.type}'`)}}function ji(e,t,r){if(e===null)return null;if(Array.isArray(e))return e.map(i=>Za(i,t,r));if(typeof e=="object")return Za(e,t,r);if(typeof e=="string"){let n;try{n=JSON.parse(e)}catch(i){throw new V("Expected an array or object, got a string that is not valid JSON",{cause:i})}return ji(n,t,r)}throw new V(`Expected an array or an object, got: ${typeof e}`)}function Za(e,t,r){if(typeof e!="object")throw new V(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Object.entries(t))switch(o.type){case"AffectedRows":throw new V(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"Object":{if(!o.flattened&&!Object.hasOwn(e,i))throw new V(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let s=o.flattened?e:e[i];n[i]=ji(s,o.fields,r);break}case"Value":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=Bi(e[s],s,o.resultType,r);else throw new V(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:L(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function Bi(e,t,r,n){if(e===null)return r.type==="Array"?[]:null;switch(r.type){case"Any":return e;case"String":{if(typeof e!="string")throw new V(`Expected a string in column '${t}', got ${typeof e}: ${e}`);return e}case"Int":switch(typeof e){case"number":return Math.trunc(e);case"string":{let i=Math.trunc(Number(e));if(Number.isNaN(i)||!Number.isFinite(i))throw new V(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new V(`Integer value in column '${t}' is too large to represent as a JavaScript number without loss of precision, got: ${e}. Consider using BigInt type.`);return i}default:throw new V(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"BigInt":{if(typeof e!="number"&&typeof e!="string")throw new V(`Expected a bigint in column '${t}', got ${typeof e}: ${e}`);return{$type:"BigInt",value:e}}case"Float":{if(typeof e=="number")return e;if(typeof e=="string"){let i=Number(e);if(Number.isNaN(i)&&!/^[-+]?nan$/.test(e.toLowerCase()))throw new V(`Expected a float in column '${t}', got string: ${e}`);return i}throw new V(`Expected a float in column '${t}', got ${typeof e}: ${e}`)}case"Boolean":{if(typeof e=="boolean")return e;if(typeof e=="number")return e===1;if(typeof e=="string"){if(e==="true"||e==="TRUE"||e==="1")return!0;if(e==="false"||e==="FALSE"||e==="0")return!1;throw new V(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}throw new V(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"Decimal":if(typeof e!="number"&&typeof e!="string"&&!Z.isDecimal(e))throw new V(`Expected a decimal in column '${t}', got ${typeof e}: ${e}`);return{$type:"Decimal",value:e};case"Date":{if(typeof e=="string")return{$type:"DateTime",value:Xa(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new V(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"Time":{if(typeof e=="string")return{$type:"DateTime",value:`1970-01-01T${Xa(e)}`};throw new V(`Expected a time in column '${t}', got ${typeof e}: ${e}`)}case"Array":return e.map((o,s)=>Bi(o,`${t}[${s}]`,r.inner,n));case"Object":return{$type:"Json",value:typeof e=="string"?e:yr(e)};case"Bytes":{if(typeof e=="string"&&e.startsWith("\\x"))return{$type:"Bytes",value:Buffer.from(e.slice(2),"hex").toString("base64")};if(Array.isArray(e))return{$type:"Bytes",value:Buffer.from(e).toString("base64")};throw new V(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`)}case"Enum":{let i=n[r.inner];if(i===void 0)throw new V(`Unknown enum '${r.inner}'`);let o=i[`${e}`];if(o===void 0)throw new V(`Unknown enum value '${e}' for enum '${r.inner}'`);return o}default:L(r,`DataMapper: Unknown result type: ${r.type}`)}}var Qm=/Z$|(?<!\d{4}-\d{2})[+-]\d{2}(:?\d{2})?$/;function Xa(e){let t=Qm.exec(e);return t===null?`${e}Z`:t[0]!=="Z"&&t[1]===void 0?`${e}:00`:e}var wr;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(wr||(wr={}));function Hm(e){switch(e){case"postgres":return"postgresql";case"mysql":return"mysql";case"sqlite":return"sqlite";default:L(e,`Unknown provider: ${e}`)}}async function In({query:e,queryable:t,tracingHelper:r,onQuery:n,execute:i}){return await r.runInChildSpan({name:"db_query",kind:wr.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":Hm(t.provider)}},async()=>{let o=new Date,s=performance.now(),a=await i(),l=performance.now();return n?.({timestamp:o,duration:l-s,query:e.sql,params:e.args}),a})}function Qi(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}var A={Int32:0,Int64:1,Float:2,Double:3,Numeric:4,Boolean:5,Character:6,Text:7,Date:8,Time:9,DateTime:10,Json:11,Enum:12,Bytes:13,Set:14,Uuid:15,Int32Array:64,Int64Array:65,FloatArray:66,DoubleArray:67,NumericArray:68,BooleanArray:69,CharacterArray:70,TextArray:71,DateArray:72,TimeArray:73,DateTimeArray:74,JsonArray:75,EnumArray:76,BytesArray:77,UuidArray:78,UnknownNumber:128};var Ae=class extends Error{name="UserFacingError";code;meta;constructor(t,r,n){super(t),this.code=r,this.meta=n??{}}toQueryResponseErrorObject(){return{error:this.message,user_facing_error:{is_panic:!1,message:this.message,meta:this.meta,error_code:this.code}}}};function tl(e){if(!Qi(e))throw e;let t=Gm(e),r=Wm(e);throw!t||!r?e:new Ae(r,t,{driverAdapterError:e})}function Gm(e){switch(e.cause.kind){case"AuthenticationFailed":return"P1000";case"DatabaseDoesNotExist":return"P1003";case"SocketTimeout":return"P1008";case"DatabaseAlreadyExists":return"P1009";case"DatabaseAccessDenied":return"P1010";case"LengthMismatch":return"P2000";case"UniqueConstraintViolation":return"P2002";case"ForeignKeyConstraintViolation":return"P2003";case"UnsupportedNativeDataType":return"P2010";case"NullConstraintViolation":return"P2011";case"ValueOutOfRange":return"P2020";case"TableDoesNotExist":return"P2021";case"ColumnNotFound":return"P2022";case"InvalidIsolationLevel":return"P2023";case"MissingFullTextSearchIndex":return"P2030";case"TransactionWriteConflict":return"P2034";case"GenericJs":return"P2036";case"TooManyConnections":return"P2037";case"postgres":case"sqlite":case"mysql":return;default:L(e.cause,`Unknown error: ${e.cause}`)}}function Wm(e){switch(e.cause.kind){case"AuthenticationFailed":return`Authentication failed against the database server, the provided database credentials for \`${e.cause.user??"(not available)"}\` are not valid`;case"DatabaseDoesNotExist":return`Database \`${e.cause.db??"(not available)"}\` does not exist on the database server`;case"SocketTimeout":return"Operation has timed out";case"DatabaseAlreadyExists":return`Database \`${e.cause.db??"(not available)"}\` already exists on the database server`;case"DatabaseAccessDenied":return`User was denied access on the database \`${e.cause.db??"(not available)"}\``;case"LengthMismatch":return`The provided value for the column is too long for the column's type. Column: ${e.cause.column??"(not available)"}`;case"UniqueConstraintViolation":return`Unique constraint failed on the ${Hi(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":return`Foreign key constraint violated on the ${Hi(e.cause.constraint)}`;case"UnsupportedNativeDataType":return`Failed to deserialize column of type '${e.cause.type}'. If you're using $queryRaw and this column is explicitly marked as \`Unsupported\` in your Prisma schema, try casting this column to any supported Prisma type such as \`String\`.`;case"NullConstraintViolation":return`Null constraint violation on the ${Hi(e.cause.constraint)}`;case"ValueOutOfRange":return`Value out of range for the type. ${e.cause.cause}`;case"TableDoesNotExist":return`The table \`${e.cause.table??"(not available)"}\` does not exist in the current database.`;case"ColumnNotFound":return`The column \`${e.cause.column??"(not available)"}\` does not exist in the current database.`;case"InvalidIsolationLevel":return`Invalid isolation level \`${e.cause.level}\``;case"MissingFullTextSearchIndex":return"Cannot find a fulltext index to use for the native search, try adding a @@fulltext([Fields...]) to your schema";case"TransactionWriteConflict":return"Transaction failed due to a write conflict or a deadlock. Please retry your transaction";case"GenericJs":return`Error in external connector (id ${e.cause.id})`;case"TooManyConnections":return`Too many database connections opened: ${e.cause.cause}`;case"sqlite":case"postgres":case"mysql":return;default:L(e.cause,`Unknown error: ${e.cause}`)}}function Hi(e){return e&&"fields"in e?`fields: (${e.fields.map(t=>`\`${t}\``).join(", ")})`:e&&"index"in e?`constraint: \`${e.index}\``:e&&"foreignKey"in e?"foreign key":"(not available)"}function Xe(e,t){var r="000000000"+e;return r.substr(r.length-t)}import Jm from"node:os";function Km(){try{return Jm.hostname()}catch{return process.env._CLUSTER_NETWORK_NAME_||process.env.COMPUTERNAME||"hostname"}}var rl=2,zm=Xe(process.pid.toString(36),rl),nl=Km(),Ym=nl.length,Zm=Xe(nl.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+Ym+36).toString(36),rl);function Gi(){return zm+Zm}function kn(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function Wi(e){let n=Math.pow(36,4),i=0;function o(){return Xe((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var l="c",u=new Date().getTime().toString(36),c=Xe(s().toString(36),4),p=e(),d=o()+o();return l+u+c+p+d}return a.fingerprint=e,a.isCuid=kn,a}var Xm=Wi(Gi);var il=Xm;var ru=we(Jl());import{webcrypto as zl}from"node:crypto";var Kl="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var qf=128,tt,It;function Uf(e){!tt||tt.length<e?(tt=Buffer.allocUnsafe(e*qf),zl.getRandomValues(tt),It=0):It+e>tt.length&&(zl.getRandomValues(tt),It=0),It+=e}function ro(e=21){Uf(e|=0);let t="";for(let r=It-e;r<It;r++)t+=Kl[tt[r]&63];return t}import Nn from"node:crypto";var Zl="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Tr=32;var jf=16,Xl=10,Yl=0xffffffffffff;var rt;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(rt||(rt={}));var nt=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Bf(e){let t=Math.floor(e()*Tr);return t===Tr&&(t=Tr-1),Zl.charAt(t)}function Qf(e){let t=Hf(),r=t&&(t.crypto||t.msCrypto)||(typeof Nn<"u"?Nn:null);if(typeof r?.getRandomValues=="function")return()=>{let n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};if(typeof r?.randomBytes=="function")return()=>r.randomBytes(1).readUInt8()/255;if(Nn?.randomBytes)return()=>Nn.randomBytes(1).readUInt8()/255;throw new nt(rt.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Hf(){return Jf()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function Gf(e,t){let r="";for(;e>0;e--)r=Bf(t)+r;return r}function Wf(e,t=Xl){if(isNaN(e))throw new nt(rt.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>Yl)throw new nt(rt.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Yl}: ${e}`);if(e<0)throw new nt(rt.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new nt(rt.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%Tr,n=Zl.charAt(r)+n,e=(e-r)/Tr;return n}function Jf(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function eu(e,t){let r=t||Qf(),n=!e||isNaN(e)?Date.now():e;return Wf(n,Xl)+Gf(jf,r)}var J=[];for(let e=0;e<256;++e)J.push((e+256).toString(16).slice(1));function Mn(e,t=0){return(J[e[t+0]]+J[e[t+1]]+J[e[t+2]]+J[e[t+3]]+"-"+J[e[t+4]]+J[e[t+5]]+"-"+J[e[t+6]]+J[e[t+7]]+"-"+J[e[t+8]]+J[e[t+9]]+"-"+J[e[t+10]]+J[e[t+11]]+J[e[t+12]]+J[e[t+13]]+J[e[t+14]]+J[e[t+15]]).toLowerCase()}import{randomFillSync as Kf}from"node:crypto";var Ln=new Uint8Array(256),Fn=Ln.length;function kt(){return Fn>Ln.length-16&&(Kf(Ln),Fn=0),Ln.slice(Fn,Fn+=16)}import{randomUUID as zf}from"node:crypto";var no={randomUUID:zf};function Yf(e,t,r){if(no.randomUUID&&!t&&!e)return no.randomUUID();e=e||{};let n=e.random??e.rng?.()??kt();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Mn(n)}var io=Yf;var oo={};function Zf(e,t,r){let n;if(e)n=tu(e.random??e.rng?.()??kt(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=kt();Xf(oo,i,o),n=tu(o,oo.msecs,oo.seq,t,r)}return t??Mn(n)}function Xf(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function tu(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}var so=Zf;var $n=class{#e={};constructor(){this.register("uuid",new uo),this.register("cuid",new co),this.register("ulid",new po),this.register("nanoid",new mo),this.register("product",new fo)}snapshot(t){return Object.create(this.#e,{now:{value:t==="mysql"?new lo:new ao}})}register(t,r){this.#e[t]=r}},ao=class{#e=new Date;generate(){return this.#e.toISOString()}},lo=class{#e=new Date;generate(){return this.#e.toISOString().replace("T"," ").replace("Z","")}},uo=class{generate(t){if(t===4)return io();if(t===7)return so();throw new Error("Invalid UUID generator arguments")}},co=class{generate(t){if(t===1)return il();if(t===2)return(0,ru.createId)();throw new Error("Invalid CUID generator arguments")}},po=class{generate(){return eu()}},mo=class{generate(t){if(typeof t=="number")return ro(t);if(t===void 0)return ro();throw new Error("Invalid Nanoid generator arguments")}},fo=class{generate(t,r){if(t===void 0||r===void 0)throw new Error("Invalid Product generator arguments");return Array.isArray(t)&&Array.isArray(r)?t.flatMap(n=>r.map(i=>[n,i])):Array.isArray(t)?t.map(n=>[n,r]):Array.isArray(r)?r.map(n=>[t,n]):[[t,r]]}};function go(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function ho(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function nu(e){return typeof e=="object"&&e!==null&&e.prisma__type==="bytes"}function iu(e){return typeof e=="object"&&e!==null&&e.prisma__type==="bigint"}function wo(e,t,r){let n=e.type;switch(n){case"rawSql":return su(e.sql,ou(e.params,t,r));case"templateSql":return eg(e.fragments,e.placeholderFormat,ou(e.params,t,r));default:L(n,"Invalid query type")}}function ou(e,t,r){return e.map(n=>ye(n,t,r))}function ye(e,t,r){let n=e;for(;rg(n);)if(go(n)){let i=t[n.prisma__value.name];if(i===void 0)throw new Error(`Missing value for query variable ${n.prisma__value.name}`);n=i}else if(ho(n)){let{name:i,args:o}=n.prisma__value,s=r[i];if(!s)throw new Error(`Encountered an unknown generator '${i}'`);n=s.generate(...o.map(a=>ye(a,t,r)))}else L(n,`Unexpected unevaluated value type: ${n}`);return Array.isArray(n)?n=n.map(i=>ye(i,t,r)):nu(n)?n=Buffer.from(n.prisma__value,"base64"):iu(n)&&(n=BigInt(n.prisma__value)),n}function eg(e,t,r){let n=0,i=1,o=[],s=e.map(a=>{let l=a.type;switch(l){case"parameter":if(n>=r.length)throw new Error(`Malformed query template. Fragments attempt to read over ${r.length} parameters.`);return o.push(r[n++]),yo(t,i++);case"stringChunk":return a.value;case"parameterTuple":{if(n>=r.length)throw new Error(`Malformed query template. Fragments attempt to read over ${r.length} parameters.`);let u=r[n++],c=Array.isArray(u)?u:[u];return`(${c.length==0?"NULL":c.map(d=>(o.push(d),yo(t,i++))).join(",")})`}case"parameterTupleList":{if(n>=r.length)throw new Error(`Malformed query template. Fragments attempt to read over ${r.length} parameters.`);let u=r[n++];if(!Array.isArray(u))throw new Error("Malformed query template. Tuple list expected.");if(u.length===0)throw new Error("Malformed query template. Tuple list cannot be empty.");return u.map(p=>{if(!Array.isArray(p))throw new Error("Malformed query template. Tuple expected.");return`(${p.map(f=>(o.push(f),yo(t,i++))).join(",")})`}).join(",")}default:L(l,"Invalid fragment type")}}).join("");return su(s,o)}function yo(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function su(e,t){let r=t.map(n=>tg(n));return{sql:e,args:t,argTypes:r}}function tg(e){return typeof e=="string"?"Text":typeof e=="number"?"Numeric":typeof e=="boolean"?"Boolean":Array.isArray(e)?"Array":Buffer.isBuffer(e)?"Bytes":"Unknown"}function rg(e){return go(e)||ho(e)}function lu(e){return e.rows.map(t=>t.reduce((r,n,i)=>{let o=e.columnNames[i].split("."),s=r;for(let a=0;a<o.length;a++){let l=o[a];a===o.length-1?s[l]=n:(s[l]===void 0&&(s[l]={}),s=s[l])}return r},{}))}function uu(e){let r=e.columnTypes.map(n=>au(n)).map(n=>{switch(n){case"int":return i=>i===null?null:typeof i=="number"?i:parseInt(`${i}`,10);case"bigint":return i=>i===null?null:typeof i=="bigint"?i:BigInt(`${i}`);case"json":return i=>typeof i=="string"?JSON.parse(i):i;case"bool":return i=>typeof i=="string"?i==="true"||i==="1":typeof i=="number"?i===1:i;default:return i=>i}});return{columns:e.columnNames,types:e.columnTypes.map(n=>au(n)),rows:e.rows.map(n=>n.map((i,o)=>r[o](i)))}}function au(e){switch(e){case A.Int32:return"int";case A.Int64:return"bigint";case A.Float:return"float";case A.Double:return"double";case A.Text:return"string";case A.Enum:return"enum";case A.Bytes:return"bytes";case A.Boolean:return"bool";case A.Character:return"char";case A.Numeric:return"decimal";case A.Json:return"json";case A.Uuid:return"uuid";case A.DateTime:return"datetime";case A.Date:return"date";case A.Time:return"time";case A.Int32Array:return"int-array";case A.Int64Array:return"bigint-array";case A.FloatArray:return"float-array";case A.DoubleArray:return"double-array";case A.TextArray:return"string-array";case A.EnumArray:return"string-array";case A.BytesArray:return"bytes-array";case A.BooleanArray:return"bool-array";case A.CharacterArray:return"char-array";case A.NumericArray:return"decimal-array";case A.JsonArray:return"json-array";case A.UuidArray:return"uuid-array";case A.DateTimeArray:return"datetime-array";case A.DateArray:return"date-array";case A.TimeArray:return"time-array";case A.UnknownNumber:return"unknown";case A.Set:return"string";default:L(e,`Unexpected column type: ${e}`)}}function cu(e,t,r){if(!t.every(n=>Eo(e,n))){let n=ng(e,r),i=ig(r);throw new Ae(n,i,r.context)}}function Eo(e,t){switch(t.type){case"rowCountEq":return Array.isArray(e)?e.length===t.args:e===null?t.args===0:t.args===1;case"rowCountNeq":return Array.isArray(e)?e.length!==t.args:e===null?t.args!==0:t.args!==1;case"affectedRowCountEq":return e===t.args;case"never":return!1;default:L(t,`Unknown rule type: ${t.type}`)}}function ng(e,t){switch(t.error_identifier){case"RELATION_VIOLATION":return`The change you are trying to make would violate the required relation '${t.context.relation}' between the \`${t.context.modelA}\` and \`${t.context.modelB}\` models.`;case"MISSING_RECORD":return`An operation failed because it depends on one or more records that were required but not found. No record was found for ${t.context.operation}.`;case"MISSING_RELATED_RECORD":{let r=t.context.neededFor?` (needed to ${t.context.neededFor})`:"";return`An operation failed because it depends on one or more records that were required but not found. No '${t.context.model}' record${r} was found for ${t.context.operation} on ${t.context.relationType} relation '${t.context.relation}'.`}case"INCOMPLETE_CONNECT_INPUT":return`An operation failed because it depends on one or more records that were required but not found. Expected ${t.context.expectedRows} records to be connected, found only ${Array.isArray(e)?e.length:e}.`;case"INCOMPLETE_CONNECT_OUTPUT":return`The required connected records were not found. Expected ${t.context.expectedRows} records to be connected after connect operation on ${t.context.relationType} relation '${t.context.relation}', found ${Array.isArray(e)?e.length:e}.`;case"RECORDS_NOT_CONNECTED":return`The records for relation \`${t.context.relation}\` between the \`${t.context.parent}\` and \`${t.context.child}\` models are not connected.`;default:L(t,`Unknown error identifier: ${t}`)}}function ig(e){switch(e.error_identifier){case"RELATION_VIOLATION":return"P2014";case"RECORDS_NOT_CONNECTED":return"P2017";case"INCOMPLETE_CONNECT_OUTPUT":return"P2018";case"MISSING_RECORD":case"MISSING_RELATED_RECORD":case"INCOMPLETE_CONNECT_INPUT":return"P2025";default:L(e,`Unknown error identifier: ${e}`)}}var Ot=class e{#e;#r;#t;#o=new $n;#n;#s;#i;constructor({transactionManager:t,placeholderValues:r,onQuery:n,tracingHelper:i,serializer:o,rawSerializer:s}){this.#e=t,this.#r=r,this.#t=n,this.#n=i,this.#s=o,this.#i=s??o}static forSql(t){return new e({transactionManager:t.transactionManager,placeholderValues:t.placeholderValues,onQuery:t.onQuery,tracingHelper:t.tracingHelper,serializer:lu,rawSerializer:uu})}async run(t,r){let{value:n}=await this.interpretNode(t,r,this.#r,this.#o.snapshot(r.provider)).catch(i=>tl(i));return n}async interpretNode(t,r,n,i){switch(t.type){case"value":return{value:ye(t.args,n,i)};case"seq":{let o;for(let s of t.args)o=await this.interpretNode(s,r,n,i);return o??{value:void 0}}case"get":return{value:n[t.args.name]};case"let":{let o=Object.create(n);for(let s of t.args.bindings){let{value:a}=await this.interpretNode(s.expr,r,o,i);o[s.name]=a}return this.interpretNode(t.args.expr,r,o,i)}case"getFirstNonEmpty":{for(let o of t.args.names){let s=n[o];if(!pu(s))return{value:s}}return{value:[]}}case"concat":{let o=await Promise.all(t.args.map(s=>this.interpretNode(s,r,n,i).then(a=>a.value)));return{value:o.length>0?o.reduce((s,a)=>s.concat(Ar(a)),[]):[]}}case"sum":{let o=await Promise.all(t.args.map(s=>this.interpretNode(s,r,n,i).then(a=>a.value)));return{value:o.length>0?o.reduce((s,a)=>Ce(s)+Ce(a)):0}}case"execute":{let o=wo(t.args,n,i);return this.#a(o,r,async()=>({value:await r.executeRaw(o)}))}case"query":{let o=wo(t.args,n,i);return this.#a(o,r,async()=>{let s=await r.queryRaw(o);return t.args.type==="rawSql"?{value:this.#i(s),lastInsertId:s.lastInsertId}:{value:this.#s(s),lastInsertId:s.lastInsertId}})}case"reverse":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);return{value:Array.isArray(o)?o.reverse():o,lastInsertId:s}}case"unique":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);if(!Array.isArray(o))return{value:o,lastInsertId:s};if(o.length>1)throw new Error(`Expected zero or one element, got ${o.length}`);return{value:o[0]??null,lastInsertId:s}}case"required":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);if(pu(o))throw new Error("Required value is empty");return{value:o,lastInsertId:s}}case"mapField":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.records,r,n,i);return{value:hu(o,t.args.field),lastInsertId:s}}case"join":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.parent,r,n,i);if(o===null)return{value:null,lastInsertId:s};let a=await Promise.all(t.args.children.map(async l=>({joinExpr:l,childRecords:(await this.interpretNode(l.child,r,n,i)).value})));if(Array.isArray(o)){for(let l of o)du(Cr(l),a);return{value:o,lastInsertId:s}}return{value:du(Cr(o),a),lastInsertId:s}}case"transaction":{if(!this.#e.enabled)return this.interpretNode(t.args,r,n,i);let o=this.#e.manager,s=await o.startTransaction(),a=o.getTransaction(s,"query");try{let l=await this.interpretNode(t.args,a,n,i);return await o.commitTransaction(s.id),l}catch(l){throw await o.rollbackTransaction(s.id),l}}case"dataMap":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return{value:el(o,t.args.structure,t.args.enums),lastInsertId:s}}case"validate":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return cu(o,t.args.rules,t.args),{value:o,lastInsertId:s}}case"if":{let{value:o}=await this.interpretNode(t.args.value,r,n,i);return Eo(o,t.args.rule)?await this.interpretNode(t.args.then,r,n,i):await this.interpretNode(t.args.else,r,n,i)}case"unit":return{value:void 0};case"diff":{let{value:o}=await this.interpretNode(t.args.from,r,n,i),{value:s}=await this.interpretNode(t.args.to,r,n,i),a=new Set(Ar(s));return{value:Ar(o).filter(l=>!a.has(l))}}case"distinctBy":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i),a=new Set,l=[];for(let u of Ar(o)){let c=gu(u,t.args.fields);a.has(c)||(a.add(c),l.push(u))}return{value:l,lastInsertId:s}}case"paginate":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i),a=Ar(o),l=t.args.pagination.linkingFields;if(l!==null){let u=new Map;for(let p of a){let d=gu(p,l);u.has(d)||u.set(d,[]),u.get(d).push(p)}let c=Array.from(u.entries());return c.sort(([p],[d])=>p<d?-1:p>d?1:0),{value:c.flatMap(([,p])=>fu(p,t.args.pagination)),lastInsertId:s}}return{value:fu(a,t.args.pagination),lastInsertId:s}}case"initializeRecord":{let{lastInsertId:o}=await this.interpretNode(t.args.expr,r,n,i),s={};for(let[a,l]of Object.entries(t.args.fields))s[a]=sg(l,o,n,i);return{value:s,lastInsertId:o}}case"mapRecord":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i),a=o===null?{}:Cr(o);for(let[l,u]of Object.entries(t.args.fields))a[l]=ag(u,a[l],n,i);return{value:a,lastInsertId:s}}default:L(t,`Unexpected node type: ${t.type}`)}}#a(t,r,n){return In({query:t,queryable:r,execute:n,tracingHelper:this.#n,onQuery:this.#t})}};function pu(e){return Array.isArray(e)?e.length===0:e==null}function Ar(e){return Array.isArray(e)?e:[e]}function Ce(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function Cr(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function hu(e,t){return Array.isArray(e)?e.map(r=>hu(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function du(e,t){for(let{joinExpr:r,childRecords:n}of t)e[r.parentField]=og(n,e,r);return e}function og(e,t,r){if(Array.isArray(e)){let n=e.filter(i=>mu(Cr(i),t,r));return r.isRelationUnique?n.length>0?n[0]:null:n}else{if(e===null)return null;{let n=Cr(e);return mu(n,t,r)?n:null}}}function mu(e,t,r){for(let[n,i]of r.on)if(t[n]!==e[i])return!1;return!0}function fu(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>hr(a,t)):0;if(i===-1)return[];let o=i+(r??0),s=n!==null?o+n:e.length;return e.slice(o,s)}function gu(e,t){return JSON.stringify(t.map(r=>e[r]))}function sg(e,t,r,n){switch(e.type){case"value":return ye(e.value,r,n);case"lastInsertId":return t;default:L(e,`Unexpected field initializer type: ${e.type}`)}}function ag(e,t,r,n){switch(e.type){case"set":return ye(e.value,r,n);case"add":return Ce(t)+Ce(ye(e.value,r,n));case"subtract":return Ce(t)-Ce(ye(e.value,r,n));case"multiply":return Ce(t)*Ce(ye(e.value,r,n));case"divide":{let i=Ce(t),o=Ce(ye(e.value,r,n));return o===0?null:i/o}default:L(e,`Unexpected field operation type: ${e.type}`)}}async function lg(){return globalThis.crypto??await import("node:crypto")}async function yu(){return(await lg()).randomUUID()}var pe=class extends Ae{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},Sr=class extends pe{constructor(){super("Transaction not found. Transaction ID is invalid, refers to an old closed transaction Prisma doesn't have information about anymore, or was obtained before disconnecting.")}},Vn=class extends pe{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},qn=class extends pe{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},Un=class extends pe{constructor(){super("Unable to start a transaction in the given time.")}},jn=class extends pe{constructor(t,{timeout:r,timeTaken:n}){super(`A ${t} cannot be executed on an expired transaction. The timeout for this transaction was ${r} ms, however ${n} ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction`,{operation:t,timeout:r,timeTaken:n})}},Dt=class extends pe{constructor(t){super(`Internal Consistency Error: ${t}`)}},Bn=class extends pe{constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var ug=100,Rr=q("prisma:client:transactionManager"),cg=()=>({sql:"COMMIT",args:[],argTypes:[]}),pg=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),dg=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),mg=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),Ir=class{transactions=new Map;closedTransactions=[];driverAdapter;transactionOptions;tracingHelper;#e;constructor({driverAdapter:t,transactionOptions:r,tracingHelper:n,onQuery:i}){this.driverAdapter=t,this.transactionOptions=r,this.tracingHelper=n,this.#e=i}async startTransaction(t){return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#r(t))}async#r(t){let r=t!==void 0?this.validateOptions(t):this.transactionOptions,n={id:await yu(),status:"waiting",timer:void 0,timeout:r.timeout,startedAt:Date.now(),transaction:void 0};this.transactions.set(n.id,n),n.timer=this.startTransactionTimeout(n.id,r.maxWait);let i=await this.driverAdapter.startTransaction(r.isolationLevel);switch(n.status){case"waiting":return n.transaction=i,clearTimeout(n.timer),n.timer=void 0,n.status="running",n.timer=this.startTransactionTimeout(n.id,r.timeout),{id:n.id};case"timed_out":throw new Un;case"running":case"committed":case"rolled_back":throw new Dt(`Transaction in invalid state ${n.status} although it just finished startup.`);default:L(n.status,"Unknown transaction status.")}}async commitTransaction(t){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{let r=this.getActiveTransaction(t,"commit");await this.closeTransaction(r,"committed")})}async rollbackTransaction(t){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{let r=this.getActiveTransaction(t,"rollback");await this.closeTransaction(r,"rolled_back")})}getTransaction(t,r){let n=this.getActiveTransaction(t.id,r);if(!n.transaction)throw new Sr;return n.transaction}getActiveTransaction(t,r){let n=this.transactions.get(t);if(!n){let i=this.closedTransactions.find(o=>o.id===t);if(i)switch(Rr("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"waiting":case"running":throw new Dt("Active transaction found in closed transactions list.");case"committed":throw new Vn(r);case"rolled_back":throw new qn(r);case"timed_out":throw new jn(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw Rr("Transaction not found.",t),new Sr}if(["committed","rolled_back","timed_out"].includes(n.status))throw new Dt("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){await Promise.allSettled([...this.transactions.values()].map(t=>this.closeTransaction(t,"rolled_back")))}startTransactionTimeout(t,r){let n=Date.now();return setTimeout(async()=>{Rr("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let i=this.transactions.get(t);i&&["running","waiting"].includes(i.status)?await this.closeTransaction(i,"timed_out"):Rr("Transaction already committed or rolled back when timeout happened.",t)},r)}async closeTransaction(t,r){if(Rr("Closing transaction.",{transactionId:t.id,status:r}),t.status=r,t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#t(dg(),t.transaction,()=>t.transaction.commit());else{await t.transaction.commit();let n=cg();await this.#t(n,t.transaction,()=>t.transaction.executeRaw(n))}else if(t.transaction)if(t.transaction.options.usePhantomQuery)await this.#t(mg(),t.transaction,()=>t.transaction.rollback());else{await t.transaction.rollback();let n=pg();await this.#t(n,t.transaction,()=>t.transaction.executeRaw(n))}clearTimeout(t.timer),t.timer=void 0,this.transactions.delete(t.id),this.closedTransactions.push(t),this.closedTransactions.length>ug&&this.closedTransactions.shift()}validateOptions(t){if(!t.timeout)throw new pe("timeout is required");if(!t.maxWait)throw new pe("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new Bn(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#t(t,r,n){return In({query:t,queryable:r,execute:n,tracingHelper:this.tracingHelper,onQuery:this.#e})}};var Qn="6.10.0-dev.12";var xo,wu={async loadQueryCompiler(e){let{clientVersion:t,adapter:r,compilerWasm:n}=e;if(r===void 0)throw new O(`The \`adapter\` option for \`PrismaClient\` is required in this context (${Vi().prettyName})`,t);if(n===void 0)throw new O("WASM query compiler was unexpectedly `undefined`",t);return xo===void 0&&(xo=(async()=>{let i=await n.getRuntime(),o=await n.getQueryCompilerWasmModule();if(o==null)throw new O("The loaded wasm module was unexpectedly `undefined` or `null` once loaded",t);let s={"./query_compiler_bg.js":i},a=new WebAssembly.Instance(o,s),l=a.exports.__wbindgen_start;return i.__wbg_set_wasm(a.exports),l(),i.QueryCompiler})()),await xo}};var Eu="P2038",Hn=q("prisma:client:clientEngine"),bu=globalThis;bu.PRISMA_WASM_PANIC_REGISTRY={set_message(e){throw new oe(e,Qn)}};var _t=class{name="ClientEngine";queryCompiler;instantiateQueryCompilerPromise;QueryCompilerConstructor;queryCompilerLoader;adapterPromise;transactionManagerPromise;config;provider;datamodel;logEmitter;logQueries;logLevel;lastStartedQuery;tracingHelper;#e;constructor(t,r){if(!t.previewFeatures?.includes("driverAdapters"))throw new O("EngineType `client` requires the driverAdapters preview feature to be enabled.",t.clientVersion,Eu);if(t.adapter)this.adapterPromise=t.adapter.connect(),this.provider=t.adapter.provider,Hn("Using driver adapter: %O",t.adapter);else throw new O("Missing configured driver adapter. Engine type `client` requires an active driver adapter. Please check your PrismaClient initialization code.",t.clientVersion,Eu);this.queryCompilerLoader=r??wu,this.config=t,this.logQueries=t.logQueries??!1,this.logLevel=t.logLevel??"error",this.logEmitter=t.logEmitter,this.datamodel=t.inlineSchema,this.tracingHelper=t.tracingHelper,t.enableDebugLogs&&(this.logLevel="debug"),this.logQueries&&(this.#e=n=>{this.logEmitter.emit("query",{...n,params:yr(n.params),target:"ClientEngine"})}),this.transactionManagerPromise=this.adapterPromise.then(n=>new Ir({driverAdapter:n,transactionOptions:{...this.config.transactionOptions,isolationLevel:this.#i(this.config.transactionOptions.isolationLevel)},tracingHelper:this.tracingHelper,onQuery:this.#e})),this.instantiateQueryCompilerPromise=this.instantiateQueryCompiler()}applyPendingMigrations(){throw new Error("Cannot call applyPendingMigrations on engine type client.")}async instantiateQueryCompiler(){if(this.queryCompiler)return;this.QueryCompilerConstructor||(this.QueryCompilerConstructor=await this.queryCompilerLoader.loadQueryCompiler(this.config));let r=(await this.adapterPromise)?.getConnectionInfo?.()??{supportsRelationJoins:!1};try{this.#n(()=>{this.queryCompiler=new this.QueryCompilerConstructor({datamodel:this.datamodel,provider:this.provider,connectionInfo:r})})}catch(n){throw this.#r(n)}}#r(t){if(t instanceof oe)return t;try{let r=JSON.parse(t.message);return new O(r.message,this.config.clientVersion,r.error_code)}catch{return t}}#t(t){if(t instanceof O)return t;if(t.code==="GenericFailure"&&t.message?.startsWith("PANIC:"))return new oe(xu(this,t.message),this.config.clientVersion);if(t instanceof Ae)return new Q(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion});try{let r=JSON.parse(t);return new ee(`${r.message}
|
79
|
-
${r.backtrace}`,{clientVersion:this.config.clientVersion})}catch{return t}}#o(t){return t instanceof oe?t:typeof t.message=="string"&&typeof t.code=="string"?new Q(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion}):t}#n(t){let r=bu.PRISMA_WASM_PANIC_REGISTRY.set_message,n;global.PRISMA_WASM_PANIC_REGISTRY.set_message=i=>{n=i};try{return t()}finally{if(global.PRISMA_WASM_PANIC_REGISTRY.set_message=r,n)throw new oe(xu(this,n),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.tracingHelper.runInChildSpan("connect",()=>this.ensureStarted())}async stop(){await this.tracingHelper.runInChildSpan("disconnect",async()=>{await this.instantiateQueryCompilerPromise,await(await this.transactionManagerPromise)?.cancelAllTransactions(),await(await this.adapterPromise).dispose()})}async ensureStarted(){let t=await this.adapterPromise,r=await this.transactionManagerPromise;return await this.instantiateQueryCompilerPromise,[t,r]}version(){return"unknown"}async transaction(t,r,n){let i,o=await this.transactionManagerPromise;try{if(t==="start"){let s=n;i=await o.startTransaction({...s,isolationLevel:this.#i(s.isolationLevel)})}else if(t==="commit"){let s=n;await o.commitTransaction(s.id)}else if(t==="rollback"){let s=n;await o.rollbackTransaction(s.id)}else me(t,"Invalid transaction action.")}catch(s){throw this.#t(s)}return i?{id:i.id,payload:void 0}:void 0}async request(t,{traceparent:r,interactiveTransaction:n}){Hn("sending request");let i=JSON.stringify(t);this.lastStartedQuery=i;let[o,s]=await this.ensureStarted().catch(l=>{throw this.#t(l)}),a;try{a=this.#n(()=>this.queryCompiler.compile(i))}catch(l){throw this.#o(l)}try{Hn("query plan created",a);let l=n?s.getTransaction(n,"query"):o,u=n?{enabled:!1}:{enabled:!0,manager:s},c={},d=await Ot.forSql({transactionManager:u,placeholderValues:c,onQuery:this.#e,tracingHelper:this.tracingHelper}).run(a,l);return Hn("query plan executed"),{data:{[t.action]:d}}}catch(l){throw this.#t(l)}}async requestBatch(t,{transaction:r,traceparent:n}){if(t.length===0)return[];let i=t[0].action,o=JSON.stringify(At(t,r));this.lastStartedQuery=o;let[,s]=await this.ensureStarted().catch(l=>{throw this.#t(l)}),a;try{a=this.queryCompiler.compileBatch(o)}catch(l){throw this.#o(l)}try{let l;if(r?.kind==="itx")l=r.options;else{let f=r?.options.isolationLevel?{...this.config.transactionOptions,isolationLevel:r.options.isolationLevel}:this.config.transactionOptions;l=await this.transaction("start",{},f)}let u={},c=Ot.forSql({transactionManager:{enabled:!1},placeholderValues:u,onQuery:this.#e,tracingHelper:this.tracingHelper}),p=s.getTransaction(l,"batch query"),d=[];switch(a.type){case"multi":{d=await Promise.all(a.plans.map((f,g)=>c.run(f,p).then(h=>({data:{[t[g].action]:h}}),h=>h)));break}case"compacted":{if(!t.every(g=>g.action===i))throw new Error("All queries in a batch must have the same action");let f=await c.run(a.plan,p);d=this.#s(f,a,i);break}}return r?.kind!=="itx"&&await this.transaction("commit",{},l),d}catch(l){throw this.#t(l)}}metrics(t){throw new Error("Method not implemented.")}#s(t,r,n){let i=t.map(s=>r.keys.reduce((a,l)=>(a[l]=Ye(s[l]),a),{})),o=new Set(r.nestedSelection);return r.arguments.map(s=>{let a=i.findIndex(l=>hr(l,s));if(a===-1)return r.expectNonEmpty?new Q("An operation failed because it depends on one or more records that were required but not found",{code:"P2025",clientVersion:this.config.clientVersion}):{data:{[n]:null}};{let l=Object.entries(t[a]).filter(([u])=>o.has(u));return{data:{[n]:Object.fromEntries(l)}}}})}#i(t){switch(t){case void 0:return;case"ReadUncommitted":return"READ UNCOMMITTED";case"ReadCommitted":return"READ COMMITTED";case"RepeatableRead":return"REPEATABLE READ";case"Serializable":return"SERIALIZABLE";case"Snapshot":return"SNAPSHOT";default:throw new Q(`Inconsistent column data: Conversion failed: Invalid isolation level \`${t}\``,{code:"P2023",clientVersion:this.config.clientVersion,meta:{providedIsolationLevel:t}})}}};function xu(e,t){return Ya({binaryTarget:void 0,title:t,version:e.config.clientVersion,engineVersion:"unknown",database:e.config.activeProvider,query:e.lastStartedQuery})}function Nt({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 new O(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new O("error: Missing URL environment variable, value, or override.",n);return i}var Gn=class extends Error{clientVersion;cause;constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var ae=class extends Gn{isRetryable;constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};function S(e,t){return{...e,isRetryable:t}}var Mt=class extends ae{name="ForcedRetryError";code="P5001";constructor(t){super("This request must be retried",S(t,!0))}};b(Mt,"ForcedRetryError");var it=class extends ae{name="InvalidDatasourceError";code="P6001";constructor(t,r){super(t,S(r,!1))}};b(it,"InvalidDatasourceError");var ot=class extends ae{name="NotImplementedYetError";code="P5004";constructor(t,r){super(t,S(r,!1))}};b(ot,"NotImplementedYetError");var F=class extends ae{response;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 st=class extends F{name="SchemaMissingError";code="P5005";constructor(t){super("Schema needs to be uploaded",S(t,!0))}};b(st,"SchemaMissingError");var bo="This request could not be understood by the server",kr=class extends F{name="BadRequestError";code="P5000";constructor(t,r,n){super(r||bo,S(t,!1)),n&&(this.code=n)}};b(kr,"BadRequestError");var Or=class extends F{name="HealthcheckTimeoutError";code="P5013";logs;constructor(t,r){super("Engine not started: healthcheck timeout",S(t,!0)),this.logs=r}};b(Or,"HealthcheckTimeoutError");var Dr=class extends F{name="EngineStartupError";code="P5014";logs;constructor(t,r,n){super(r,S(t,!0)),this.logs=n}};b(Dr,"EngineStartupError");var _r=class extends F{name="EngineVersionNotSupportedError";code="P5012";constructor(t){super("Engine version is not supported",S(t,!1))}};b(_r,"EngineVersionNotSupportedError");var Po="Request timed out",Nr=class extends F{name="GatewayTimeoutError";code="P5009";constructor(t,r=Po){super(r,S(t,!1))}};b(Nr,"GatewayTimeoutError");var gg="Interactive transaction error",Mr=class extends F{name="InteractiveTransactionError";code="P5015";constructor(t,r=gg){super(r,S(t,!1))}};b(Mr,"InteractiveTransactionError");var hg="Request parameters are invalid",Fr=class extends F{name="InvalidRequestError";code="P5011";constructor(t,r=hg){super(r,S(t,!1))}};b(Fr,"InvalidRequestError");var vo="Requested resource does not exist",Lr=class extends F{name="NotFoundError";code="P5003";constructor(t,r=vo){super(r,S(t,!1))}};b(Lr,"NotFoundError");var To="Unknown server error",Ft=class extends F{name="ServerError";code="P5006";logs;constructor(t,r,n){super(r||To,S(t,!0)),this.logs=n}};b(Ft,"ServerError");var Ao="Unauthorized, check your connection string",$r=class extends F{name="UnauthorizedError";code="P5007";constructor(t,r=Ao){super(r,S(t,!1))}};b($r,"UnauthorizedError");var Co="Usage exceeded, retry again later",Vr=class extends F{name="UsageExceededError";code="P5008";constructor(t,r=Co){super(r,S(t,!0))}};b(Vr,"UsageExceededError");async function yg(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:"QueryEngineError",body:r};if("EngineNotStarted"in r||"InteractiveTransactionMisrouted"in r||"InvalidRequestError"in r){let n=Object.values(r)[0].reason;return typeof n=="string"&&!["SchemaMissing","EngineVersionNotSupported"].includes(n)?{type:"UnknownJsonError",body:r}:{type:"DataProxyError",body:r}}}return{type:"UnknownJsonError",body:r}}catch{return t===""?{type:"EmptyError"}:{type:"UnknownTextError",body:t}}}async function qr(e,t){if(e.ok)return;let r={clientVersion:t,response:e},n=await yg(e);if(n.type==="QueryEngineError")throw new Q(n.body.message,{code:n.body.error_code,clientVersion:t});if(n.type==="DataProxyError"){if(n.body==="InternalDataProxyError")throw new Ft(r,"Internal Data Proxy error");if("EngineNotStarted"in n.body){if(n.body.EngineNotStarted.reason==="SchemaMissing")return new st(r);if(n.body.EngineNotStarted.reason==="EngineVersionNotSupported")throw new _r(r);if("EngineStartupError"in n.body.EngineNotStarted.reason){let{msg:i,logs:o}=n.body.EngineNotStarted.reason.EngineStartupError;throw new Dr(r,i,o)}if("KnownEngineStartupError"in n.body.EngineNotStarted.reason){let{msg:i,error_code:o}=n.body.EngineNotStarted.reason.KnownEngineStartupError;throw new O(i,t,o)}if("HealthcheckTimeout"in n.body.EngineNotStarted.reason){let{logs:i}=n.body.EngineNotStarted.reason.HealthcheckTimeout;throw new Or(r,i)}}if("InteractiveTransactionMisrouted"in n.body){let i={IDParseError:"Could not parse interactive transaction ID",NoQueryEngineFoundError:"Could not find Query Engine for the specified host and transaction ID",TransactionStartError:"Could not start interactive transaction"};throw new Mr(r,i[n.body.InteractiveTransactionMisrouted.reason])}if("InvalidRequestError"in n.body)throw new Fr(r,n.body.InvalidRequestError.reason)}if(e.status===401||e.status===403)throw new $r(r,Lt(Ao,n));if(e.status===404)return new Lr(r,Lt(vo,n));if(e.status===429)throw new Vr(r,Lt(Co,n));if(e.status===504)throw new Nr(r,Lt(Po,n));if(e.status>=500)throw new Ft(r,Lt(To,n));if(e.status>=400)throw new kr(r,Lt(bo,n))}function Lt(e,t){return t.type==="EmptyError"?e:`${e}: ${JSON.stringify(t)}`}function Pu(e){let t=Math.pow(2,e)*50,r=Math.ceil(Math.random()*t)-Math.ceil(t/2),n=t+r;return new Promise(i=>setTimeout(()=>i(n),n))}var Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function vu(e){let t=new TextEncoder().encode(e),r="",n=t.byteLength,i=n%3,o=n-i,s,a,l,u,c;for(let p=0;p<o;p=p+3)c=t[p]<<16|t[p+1]<<8|t[p+2],s=(c&16515072)>>18,a=(c&258048)>>12,l=(c&4032)>>6,u=c&63,r+=Me[s]+Me[a]+Me[l]+Me[u];return i==1?(c=t[o],s=(c&252)>>2,a=(c&3)<<4,r+=Me[s]+Me[a]+"=="):i==2&&(c=t[o]<<8|t[o+1],s=(c&64512)>>10,a=(c&1008)>>4,l=(c&15)<<2,r+=Me[s]+Me[a]+Me[l]+"="),r}function Tu(e){if(!!e.generator?.previewFeatures.some(r=>r.toLowerCase().includes("metrics")))throw new O("The `metrics` preview feature is not yet available with Accelerate.\nPlease remove `metrics` from the `previewFeatures` in your schema.\n\nMore information about Accelerate: https://pris.ly/d/accelerate",e.clientVersion)}function wg(e){return e[0]*1e3+e[1]/1e6}function So(e){return new Date(wg(e))}var Au={"@prisma/debug":"workspace:*","@prisma/engines-version":"6.10.0-11.23a074b7d12a9a3bff0be884b60c14f17cd7ae13","@prisma/fetch-engine":"workspace:*","@prisma/get-platform":"workspace:*"};var Ur=class extends ae{name="RequestError";code="P5010";constructor(t,r){super(`Cannot fetch data from service:
|
78
|
+
`}function L(e,t){throw new Error(t)}function Ui(e,t){return e===t||e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(r=>Ui(e[r],t[r]))}function hr(e,t){let r=Object.keys(e),n=Object.keys(t);return(r.length<n.length?r:n).every(o=>{if(typeof e[o]!=typeof t[o]){if(typeof e[o]=="number"||typeof t[o]=="number")return`${e[o]}`==`${t[o]}`;if(typeof e[o]=="bigint"||typeof t[o]=="bigint")return BigInt(`${e[o]}`.replace(/n$/,""))===BigInt(`${t[o]}`.replace(/n$/,""));if(e[o]instanceof Date||t[o]instanceof Date)return new Date(`${e[o]}`).getTime()===new Date(`${t[o]}`).getTime();if(Z.isDecimal(e[o])||Z.isDecimal(t[o]))return new Z(`${e[o]}`).equals(new Z(`${t[o]}`))}return Ui(e[o],t[o])})}function yr(e){return JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString():r instanceof Uint8Array?Buffer.from(r).toString("base64"):r)}var V=class extends Error{name="DataMapperError"};function el(e,t,r){switch(t.type){case"AffectedRows":if(typeof e!="number")throw new V(`Expected an affected rows count, got: ${typeof e} (${e})`);return{count:e};case"Object":return ji(e,t.fields,r);case"Value":return Bi(e,"<result>",t.resultType,r);default:L(t,`Invalid data mapping type: '${t.type}'`)}}function ji(e,t,r){if(e===null)return null;if(Array.isArray(e))return e.map(i=>Za(i,t,r));if(typeof e=="object")return Za(e,t,r);if(typeof e=="string"){let n;try{n=JSON.parse(e)}catch(i){throw new V("Expected an array or object, got a string that is not valid JSON",{cause:i})}return ji(n,t,r)}throw new V(`Expected an array or an object, got: ${typeof e}`)}function Za(e,t,r){if(typeof e!="object")throw new V(`Expected an object, but got '${typeof e}'`);let n={};for(let[i,o]of Object.entries(t))switch(o.type){case"AffectedRows":throw new V(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"Object":{if(!o.flattened&&!Object.hasOwn(e,i))throw new V(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`);let s=o.flattened?e:e[i];n[i]=ji(s,o.fields,r);break}case"Value":{let s=o.dbName;if(Object.hasOwn(e,s))n[i]=Bi(e[s],s,o.resultType,r);else throw new V(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(e)}`)}break;default:L(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function Bi(e,t,r,n){if(e===null)return r.type==="Array"?[]:null;switch(r.type){case"Any":return e;case"String":{if(typeof e!="string")throw new V(`Expected a string in column '${t}', got ${typeof e}: ${e}`);return e}case"Int":switch(typeof e){case"number":return Math.trunc(e);case"string":{let i=Math.trunc(Number(e));if(Number.isNaN(i)||!Number.isFinite(i))throw new V(`Expected an integer in column '${t}', got string: ${e}`);if(!Number.isSafeInteger(i))throw new V(`Integer value in column '${t}' is too large to represent as a JavaScript number without loss of precision, got: ${e}. Consider using BigInt type.`);return i}default:throw new V(`Expected an integer in column '${t}', got ${typeof e}: ${e}`)}case"BigInt":{if(typeof e!="number"&&typeof e!="string")throw new V(`Expected a bigint in column '${t}', got ${typeof e}: ${e}`);return{$type:"BigInt",value:e}}case"Float":{if(typeof e=="number")return e;if(typeof e=="string"){let i=Number(e);if(Number.isNaN(i)&&!/^[-+]?nan$/.test(e.toLowerCase()))throw new V(`Expected a float in column '${t}', got string: ${e}`);return i}throw new V(`Expected a float in column '${t}', got ${typeof e}: ${e}`)}case"Boolean":{if(typeof e=="boolean")return e;if(typeof e=="number")return e===1;if(typeof e=="string"){if(e==="true"||e==="TRUE"||e==="1")return!0;if(e==="false"||e==="FALSE"||e==="0")return!1;throw new V(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}throw new V(`Expected a boolean in column '${t}', got ${typeof e}: ${e}`)}case"Decimal":if(typeof e!="number"&&typeof e!="string"&&!Z.isDecimal(e))throw new V(`Expected a decimal in column '${t}', got ${typeof e}: ${e}`);return{$type:"Decimal",value:e};case"Date":{if(typeof e=="string")return{$type:"DateTime",value:Xa(e)};if(typeof e=="number"||e instanceof Date)return{$type:"DateTime",value:e};throw new V(`Expected a date in column '${t}', got ${typeof e}: ${e}`)}case"Time":{if(typeof e=="string")return{$type:"DateTime",value:`1970-01-01T${Xa(e)}`};throw new V(`Expected a time in column '${t}', got ${typeof e}: ${e}`)}case"Array":return e.map((o,s)=>Bi(o,`${t}[${s}]`,r.inner,n));case"Object":return{$type:"Json",value:typeof e=="string"?e:yr(e)};case"Bytes":{if(typeof e=="string"&&e.startsWith("\\x"))return{$type:"Bytes",value:Buffer.from(e.slice(2),"hex").toString("base64")};if(Array.isArray(e))return{$type:"Bytes",value:Buffer.from(e).toString("base64")};throw new V(`Expected a byte array in column '${t}', got ${typeof e}: ${e}`)}case"Enum":{let i=n[r.inner];if(i===void 0)throw new V(`Unknown enum '${r.inner}'`);let o=i[`${e}`];if(o===void 0)throw new V(`Unknown enum value '${e}' for enum '${r.inner}'`);return o}default:L(r,`DataMapper: Unknown result type: ${r.type}`)}}var Qm=/Z$|(?<!\d{4}-\d{2})[+-]\d{2}(:?\d{2})?$/;function Xa(e){let t=Qm.exec(e);return t===null?`${e}Z`:t[0]!=="Z"&&t[1]===void 0?`${e}:00`:e}var wr;(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(wr||(wr={}));function Hm(e){switch(e){case"postgres":return"postgresql";case"mysql":return"mysql";case"sqlite":return"sqlite";default:L(e,`Unknown provider: ${e}`)}}async function In({query:e,queryable:t,tracingHelper:r,onQuery:n,execute:i}){return await r.runInChildSpan({name:"db_query",kind:wr.CLIENT,attributes:{"db.query.text":e.sql,"db.system.name":Hm(t.provider)}},async()=>{let o=new Date,s=performance.now(),a=await i(),l=performance.now();return n?.({timestamp:o,duration:l-s,query:e.sql,params:e.args}),a})}function Qi(e){return e.name==="DriverAdapterError"&&typeof e.cause=="object"}var A={Int32:0,Int64:1,Float:2,Double:3,Numeric:4,Boolean:5,Character:6,Text:7,Date:8,Time:9,DateTime:10,Json:11,Enum:12,Bytes:13,Set:14,Uuid:15,Int32Array:64,Int64Array:65,FloatArray:66,DoubleArray:67,NumericArray:68,BooleanArray:69,CharacterArray:70,TextArray:71,DateArray:72,TimeArray:73,DateTimeArray:74,JsonArray:75,EnumArray:76,BytesArray:77,UuidArray:78,UnknownNumber:128};var Ae=class extends Error{name="UserFacingError";code;meta;constructor(t,r,n){super(t),this.code=r,this.meta=n??{}}toQueryResponseErrorObject(){return{error:this.message,user_facing_error:{is_panic:!1,message:this.message,meta:this.meta,error_code:this.code}}}};function tl(e){if(!Qi(e))throw e;let t=Gm(e),r=Wm(e);throw!t||!r?e:new Ae(r,t,{driverAdapterError:e})}function Gm(e){switch(e.cause.kind){case"AuthenticationFailed":return"P1000";case"DatabaseDoesNotExist":return"P1003";case"SocketTimeout":return"P1008";case"DatabaseAlreadyExists":return"P1009";case"DatabaseAccessDenied":return"P1010";case"LengthMismatch":return"P2000";case"UniqueConstraintViolation":return"P2002";case"ForeignKeyConstraintViolation":return"P2003";case"UnsupportedNativeDataType":return"P2010";case"NullConstraintViolation":return"P2011";case"ValueOutOfRange":return"P2020";case"TableDoesNotExist":return"P2021";case"ColumnNotFound":return"P2022";case"InvalidIsolationLevel":return"P2023";case"MissingFullTextSearchIndex":return"P2030";case"TransactionWriteConflict":return"P2034";case"GenericJs":return"P2036";case"TooManyConnections":return"P2037";case"postgres":case"sqlite":case"mysql":return;default:L(e.cause,`Unknown error: ${e.cause}`)}}function Wm(e){switch(e.cause.kind){case"AuthenticationFailed":return`Authentication failed against the database server, the provided database credentials for \`${e.cause.user??"(not available)"}\` are not valid`;case"DatabaseDoesNotExist":return`Database \`${e.cause.db??"(not available)"}\` does not exist on the database server`;case"SocketTimeout":return"Operation has timed out";case"DatabaseAlreadyExists":return`Database \`${e.cause.db??"(not available)"}\` already exists on the database server`;case"DatabaseAccessDenied":return`User was denied access on the database \`${e.cause.db??"(not available)"}\``;case"LengthMismatch":return`The provided value for the column is too long for the column's type. Column: ${e.cause.column??"(not available)"}`;case"UniqueConstraintViolation":return`Unique constraint failed on the ${Hi(e.cause.constraint)}`;case"ForeignKeyConstraintViolation":return`Foreign key constraint violated on the ${Hi(e.cause.constraint)}`;case"UnsupportedNativeDataType":return`Failed to deserialize column of type '${e.cause.type}'. If you're using $queryRaw and this column is explicitly marked as \`Unsupported\` in your Prisma schema, try casting this column to any supported Prisma type such as \`String\`.`;case"NullConstraintViolation":return`Null constraint violation on the ${Hi(e.cause.constraint)}`;case"ValueOutOfRange":return`Value out of range for the type. ${e.cause.cause}`;case"TableDoesNotExist":return`The table \`${e.cause.table??"(not available)"}\` does not exist in the current database.`;case"ColumnNotFound":return`The column \`${e.cause.column??"(not available)"}\` does not exist in the current database.`;case"InvalidIsolationLevel":return`Invalid isolation level \`${e.cause.level}\``;case"MissingFullTextSearchIndex":return"Cannot find a fulltext index to use for the native search, try adding a @@fulltext([Fields...]) to your schema";case"TransactionWriteConflict":return"Transaction failed due to a write conflict or a deadlock. Please retry your transaction";case"GenericJs":return`Error in external connector (id ${e.cause.id})`;case"TooManyConnections":return`Too many database connections opened: ${e.cause.cause}`;case"sqlite":case"postgres":case"mysql":return;default:L(e.cause,`Unknown error: ${e.cause}`)}}function Hi(e){return e&&"fields"in e?`fields: (${e.fields.map(t=>`\`${t}\``).join(", ")})`:e&&"index"in e?`constraint: \`${e.index}\``:e&&"foreignKey"in e?"foreign key":"(not available)"}function Xe(e,t){var r="000000000"+e;return r.substr(r.length-t)}import Jm from"node:os";function Km(){try{return Jm.hostname()}catch{return process.env._CLUSTER_NETWORK_NAME_||process.env.COMPUTERNAME||"hostname"}}var rl=2,zm=Xe(process.pid.toString(36),rl),nl=Km(),Ym=nl.length,Zm=Xe(nl.split("").reduce(function(e,t){return+e+t.charCodeAt(0)},+Ym+36).toString(36),rl);function Gi(){return zm+Zm}function kn(e){return typeof e=="string"&&/^c[a-z0-9]{20,32}$/.test(e)}function Wi(e){let n=Math.pow(36,4),i=0;function o(){return Xe((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var l="c",u=new Date().getTime().toString(36),c=Xe(s().toString(36),4),p=e(),d=o()+o();return l+u+c+p+d}return a.fingerprint=e,a.isCuid=kn,a}var Xm=Wi(Gi);var il=Xm;var ru=we(Jl());import{webcrypto as zl}from"node:crypto";var Kl="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var qf=128,tt,It;function Uf(e){!tt||tt.length<e?(tt=Buffer.allocUnsafe(e*qf),zl.getRandomValues(tt),It=0):It+e>tt.length&&(zl.getRandomValues(tt),It=0),It+=e}function ro(e=21){Uf(e|=0);let t="";for(let r=It-e;r<It;r++)t+=Kl[tt[r]&63];return t}import Nn from"node:crypto";var Zl="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Tr=32;var jf=16,Xl=10,Yl=0xffffffffffff;var rt;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(rt||(rt={}));var nt=class extends Error{constructor(t,r){super(`${r} (${t})`),this.name="ULIDError",this.code=t}};function Bf(e){let t=Math.floor(e()*Tr);return t===Tr&&(t=Tr-1),Zl.charAt(t)}function Qf(e){let t=Hf(),r=t&&(t.crypto||t.msCrypto)||(typeof Nn<"u"?Nn:null);if(typeof r?.getRandomValues=="function")return()=>{let n=new Uint8Array(1);return r.getRandomValues(n),n[0]/255};if(typeof r?.randomBytes=="function")return()=>r.randomBytes(1).readUInt8()/255;if(Nn?.randomBytes)return()=>Nn.randomBytes(1).readUInt8()/255;throw new nt(rt.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Hf(){return Jf()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function Gf(e,t){let r="";for(;e>0;e--)r=Bf(t)+r;return r}function Wf(e,t=Xl){if(isNaN(e))throw new nt(rt.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>Yl)throw new nt(rt.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Yl}: ${e}`);if(e<0)throw new nt(rt.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new nt(rt.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,n="";for(let i=t;i>0;i--)r=e%Tr,n=Zl.charAt(r)+n,e=(e-r)/Tr;return n}function Jf(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function eu(e,t){let r=t||Qf(),n=!e||isNaN(e)?Date.now():e;return Wf(n,Xl)+Gf(jf,r)}var J=[];for(let e=0;e<256;++e)J.push((e+256).toString(16).slice(1));function Mn(e,t=0){return(J[e[t+0]]+J[e[t+1]]+J[e[t+2]]+J[e[t+3]]+"-"+J[e[t+4]]+J[e[t+5]]+"-"+J[e[t+6]]+J[e[t+7]]+"-"+J[e[t+8]]+J[e[t+9]]+"-"+J[e[t+10]]+J[e[t+11]]+J[e[t+12]]+J[e[t+13]]+J[e[t+14]]+J[e[t+15]]).toLowerCase()}import{randomFillSync as Kf}from"node:crypto";var Ln=new Uint8Array(256),Fn=Ln.length;function kt(){return Fn>Ln.length-16&&(Kf(Ln),Fn=0),Ln.slice(Fn,Fn+=16)}import{randomUUID as zf}from"node:crypto";var no={randomUUID:zf};function Yf(e,t,r){if(no.randomUUID&&!t&&!e)return no.randomUUID();e=e||{};let n=e.random??e.rng?.()??kt();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Mn(n)}var io=Yf;var oo={};function Zf(e,t,r){let n;if(e)n=tu(e.random??e.rng?.()??kt(),e.msecs,e.seq,t,r);else{let i=Date.now(),o=kt();Xf(oo,i,o),n=tu(o,oo.msecs,oo.seq,t,r)}return t??Mn(n)}function Xf(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function tu(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}var so=Zf;var $n=class{#e={};constructor(){this.register("uuid",new uo),this.register("cuid",new co),this.register("ulid",new po),this.register("nanoid",new mo),this.register("product",new fo)}snapshot(t){return Object.create(this.#e,{now:{value:t==="mysql"?new lo:new ao}})}register(t,r){this.#e[t]=r}},ao=class{#e=new Date;generate(){return this.#e.toISOString()}},lo=class{#e=new Date;generate(){return this.#e.toISOString().replace("T"," ").replace("Z","")}},uo=class{generate(t){if(t===4)return io();if(t===7)return so();throw new Error("Invalid UUID generator arguments")}},co=class{generate(t){if(t===1)return il();if(t===2)return(0,ru.createId)();throw new Error("Invalid CUID generator arguments")}},po=class{generate(){return eu()}},mo=class{generate(t){if(typeof t=="number")return ro(t);if(t===void 0)return ro();throw new Error("Invalid Nanoid generator arguments")}},fo=class{generate(t,r){if(t===void 0||r===void 0)throw new Error("Invalid Product generator arguments");return Array.isArray(t)&&Array.isArray(r)?t.flatMap(n=>r.map(i=>[n,i])):Array.isArray(t)?t.map(n=>[n,r]):Array.isArray(r)?r.map(n=>[t,n]):[[t,r]]}};function go(e){return typeof e=="object"&&e!==null&&e.prisma__type==="param"}function ho(e){return typeof e=="object"&&e!==null&&e.prisma__type==="generatorCall"}function nu(e){return typeof e=="object"&&e!==null&&e.prisma__type==="bytes"}function iu(e){return typeof e=="object"&&e!==null&&e.prisma__type==="bigint"}function wo(e,t,r){let n=e.type;switch(n){case"rawSql":return su(e.sql,ou(e.params,t,r));case"templateSql":return eg(e.fragments,e.placeholderFormat,ou(e.params,t,r));default:L(n,"Invalid query type")}}function ou(e,t,r){return e.map(n=>ye(n,t,r))}function ye(e,t,r){let n=e;for(;rg(n);)if(go(n)){let i=t[n.prisma__value.name];if(i===void 0)throw new Error(`Missing value for query variable ${n.prisma__value.name}`);n=i}else if(ho(n)){let{name:i,args:o}=n.prisma__value,s=r[i];if(!s)throw new Error(`Encountered an unknown generator '${i}'`);n=s.generate(...o.map(a=>ye(a,t,r)))}else L(n,`Unexpected unevaluated value type: ${n}`);return Array.isArray(n)?n=n.map(i=>ye(i,t,r)):nu(n)?n=Buffer.from(n.prisma__value,"base64"):iu(n)&&(n=BigInt(n.prisma__value)),n}function eg(e,t,r){let n=0,i=1,o=[],s=e.map(a=>{let l=a.type;switch(l){case"parameter":if(n>=r.length)throw new Error(`Malformed query template. Fragments attempt to read over ${r.length} parameters.`);return o.push(r[n++]),yo(t,i++);case"stringChunk":return a.value;case"parameterTuple":{if(n>=r.length)throw new Error(`Malformed query template. Fragments attempt to read over ${r.length} parameters.`);let u=r[n++],c=Array.isArray(u)?u:[u];return`(${c.length==0?"NULL":c.map(d=>(o.push(d),yo(t,i++))).join(",")})`}case"parameterTupleList":{if(n>=r.length)throw new Error(`Malformed query template. Fragments attempt to read over ${r.length} parameters.`);let u=r[n++];if(!Array.isArray(u))throw new Error("Malformed query template. Tuple list expected.");if(u.length===0)throw new Error("Malformed query template. Tuple list cannot be empty.");return u.map(p=>{if(!Array.isArray(p))throw new Error("Malformed query template. Tuple expected.");return`(${p.map(f=>(o.push(f),yo(t,i++))).join(",")})`}).join(",")}default:L(l,"Invalid fragment type")}}).join("");return su(s,o)}function yo(e,t){return e.hasNumbering?`${e.prefix}${t}`:e.prefix}function su(e,t){let r=t.map(n=>tg(n));return{sql:e,args:t,argTypes:r}}function tg(e){return typeof e=="string"?"Text":typeof e=="number"?"Numeric":typeof e=="boolean"?"Boolean":Array.isArray(e)?"Array":Buffer.isBuffer(e)?"Bytes":"Unknown"}function rg(e){return go(e)||ho(e)}function lu(e){return e.rows.map(t=>t.reduce((r,n,i)=>{let o=e.columnNames[i].split("."),s=r;for(let a=0;a<o.length;a++){let l=o[a];a===o.length-1?s[l]=n:(s[l]===void 0&&(s[l]={}),s=s[l])}return r},{}))}function uu(e){let r=e.columnTypes.map(n=>au(n)).map(n=>{switch(n){case"int":return i=>i===null?null:typeof i=="number"?i:parseInt(`${i}`,10);case"bigint":return i=>i===null?null:typeof i=="bigint"?i:BigInt(`${i}`);case"json":return i=>typeof i=="string"?JSON.parse(i):i;case"bool":return i=>typeof i=="string"?i==="true"||i==="1":typeof i=="number"?i===1:i;default:return i=>i}});return{columns:e.columnNames,types:e.columnTypes.map(n=>au(n)),rows:e.rows.map(n=>n.map((i,o)=>r[o](i)))}}function au(e){switch(e){case A.Int32:return"int";case A.Int64:return"bigint";case A.Float:return"float";case A.Double:return"double";case A.Text:return"string";case A.Enum:return"enum";case A.Bytes:return"bytes";case A.Boolean:return"bool";case A.Character:return"char";case A.Numeric:return"decimal";case A.Json:return"json";case A.Uuid:return"uuid";case A.DateTime:return"datetime";case A.Date:return"date";case A.Time:return"time";case A.Int32Array:return"int-array";case A.Int64Array:return"bigint-array";case A.FloatArray:return"float-array";case A.DoubleArray:return"double-array";case A.TextArray:return"string-array";case A.EnumArray:return"string-array";case A.BytesArray:return"bytes-array";case A.BooleanArray:return"bool-array";case A.CharacterArray:return"char-array";case A.NumericArray:return"decimal-array";case A.JsonArray:return"json-array";case A.UuidArray:return"uuid-array";case A.DateTimeArray:return"datetime-array";case A.DateArray:return"date-array";case A.TimeArray:return"time-array";case A.UnknownNumber:return"unknown";case A.Set:return"string";default:L(e,`Unexpected column type: ${e}`)}}function cu(e,t,r){if(!t.every(n=>Eo(e,n))){let n=ng(e,r),i=ig(r);throw new Ae(n,i,r.context)}}function Eo(e,t){switch(t.type){case"rowCountEq":return Array.isArray(e)?e.length===t.args:e===null?t.args===0:t.args===1;case"rowCountNeq":return Array.isArray(e)?e.length!==t.args:e===null?t.args!==0:t.args!==1;case"affectedRowCountEq":return e===t.args;case"never":return!1;default:L(t,`Unknown rule type: ${t.type}`)}}function ng(e,t){switch(t.error_identifier){case"RELATION_VIOLATION":return`The change you are trying to make would violate the required relation '${t.context.relation}' between the \`${t.context.modelA}\` and \`${t.context.modelB}\` models.`;case"MISSING_RECORD":return`An operation failed because it depends on one or more records that were required but not found. No record was found for ${t.context.operation}.`;case"MISSING_RELATED_RECORD":{let r=t.context.neededFor?` (needed to ${t.context.neededFor})`:"";return`An operation failed because it depends on one or more records that were required but not found. No '${t.context.model}' record${r} was found for ${t.context.operation} on ${t.context.relationType} relation '${t.context.relation}'.`}case"INCOMPLETE_CONNECT_INPUT":return`An operation failed because it depends on one or more records that were required but not found. Expected ${t.context.expectedRows} records to be connected, found only ${Array.isArray(e)?e.length:e}.`;case"INCOMPLETE_CONNECT_OUTPUT":return`The required connected records were not found. Expected ${t.context.expectedRows} records to be connected after connect operation on ${t.context.relationType} relation '${t.context.relation}', found ${Array.isArray(e)?e.length:e}.`;case"RECORDS_NOT_CONNECTED":return`The records for relation \`${t.context.relation}\` between the \`${t.context.parent}\` and \`${t.context.child}\` models are not connected.`;default:L(t,`Unknown error identifier: ${t}`)}}function ig(e){switch(e.error_identifier){case"RELATION_VIOLATION":return"P2014";case"RECORDS_NOT_CONNECTED":return"P2017";case"INCOMPLETE_CONNECT_OUTPUT":return"P2018";case"MISSING_RECORD":case"MISSING_RELATED_RECORD":case"INCOMPLETE_CONNECT_INPUT":return"P2025";default:L(e,`Unknown error identifier: ${e}`)}}var Ot=class e{#e;#r;#t;#o=new $n;#n;#s;#i;constructor({transactionManager:t,placeholderValues:r,onQuery:n,tracingHelper:i,serializer:o,rawSerializer:s}){this.#e=t,this.#r=r,this.#t=n,this.#n=i,this.#s=o,this.#i=s??o}static forSql(t){return new e({transactionManager:t.transactionManager,placeholderValues:t.placeholderValues,onQuery:t.onQuery,tracingHelper:t.tracingHelper,serializer:lu,rawSerializer:uu})}async run(t,r){let{value:n}=await this.interpretNode(t,r,this.#r,this.#o.snapshot(r.provider)).catch(i=>tl(i));return n}async interpretNode(t,r,n,i){switch(t.type){case"value":return{value:ye(t.args,n,i)};case"seq":{let o;for(let s of t.args)o=await this.interpretNode(s,r,n,i);return o??{value:void 0}}case"get":return{value:n[t.args.name]};case"let":{let o=Object.create(n);for(let s of t.args.bindings){let{value:a}=await this.interpretNode(s.expr,r,o,i);o[s.name]=a}return this.interpretNode(t.args.expr,r,o,i)}case"getFirstNonEmpty":{for(let o of t.args.names){let s=n[o];if(!pu(s))return{value:s}}return{value:[]}}case"concat":{let o=await Promise.all(t.args.map(s=>this.interpretNode(s,r,n,i).then(a=>a.value)));return{value:o.length>0?o.reduce((s,a)=>s.concat(Ar(a)),[]):[]}}case"sum":{let o=await Promise.all(t.args.map(s=>this.interpretNode(s,r,n,i).then(a=>a.value)));return{value:o.length>0?o.reduce((s,a)=>Ce(s)+Ce(a)):0}}case"execute":{let o=wo(t.args,n,i);return this.#a(o,r,async()=>({value:await r.executeRaw(o)}))}case"query":{let o=wo(t.args,n,i);return this.#a(o,r,async()=>{let s=await r.queryRaw(o);return t.args.type==="rawSql"?{value:this.#i(s),lastInsertId:s.lastInsertId}:{value:this.#s(s),lastInsertId:s.lastInsertId}})}case"reverse":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);return{value:Array.isArray(o)?o.reverse():o,lastInsertId:s}}case"unique":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);if(!Array.isArray(o))return{value:o,lastInsertId:s};if(o.length>1)throw new Error(`Expected zero or one element, got ${o.length}`);return{value:o[0]??null,lastInsertId:s}}case"required":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args,r,n,i);if(pu(o))throw new Error("Required value is empty");return{value:o,lastInsertId:s}}case"mapField":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.records,r,n,i);return{value:hu(o,t.args.field),lastInsertId:s}}case"join":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.parent,r,n,i);if(o===null)return{value:null,lastInsertId:s};let a=await Promise.all(t.args.children.map(async l=>({joinExpr:l,childRecords:(await this.interpretNode(l.child,r,n,i)).value})));if(Array.isArray(o)){for(let l of o)du(Cr(l),a);return{value:o,lastInsertId:s}}return{value:du(Cr(o),a),lastInsertId:s}}case"transaction":{if(!this.#e.enabled)return this.interpretNode(t.args,r,n,i);let o=this.#e.manager,s=await o.startTransaction(),a=o.getTransaction(s,"query");try{let l=await this.interpretNode(t.args,a,n,i);return await o.commitTransaction(s.id),l}catch(l){throw await o.rollbackTransaction(s.id),l}}case"dataMap":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return{value:el(o,t.args.structure,t.args.enums),lastInsertId:s}}case"validate":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i);return cu(o,t.args.rules,t.args),{value:o,lastInsertId:s}}case"if":{let{value:o}=await this.interpretNode(t.args.value,r,n,i);return Eo(o,t.args.rule)?await this.interpretNode(t.args.then,r,n,i):await this.interpretNode(t.args.else,r,n,i)}case"unit":return{value:void 0};case"diff":{let{value:o}=await this.interpretNode(t.args.from,r,n,i),{value:s}=await this.interpretNode(t.args.to,r,n,i),a=new Set(Ar(s));return{value:Ar(o).filter(l=>!a.has(l))}}case"distinctBy":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i),a=new Set,l=[];for(let u of Ar(o)){let c=gu(u,t.args.fields);a.has(c)||(a.add(c),l.push(u))}return{value:l,lastInsertId:s}}case"paginate":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i),a=Ar(o),l=t.args.pagination.linkingFields;if(l!==null){let u=new Map;for(let p of a){let d=gu(p,l);u.has(d)||u.set(d,[]),u.get(d).push(p)}let c=Array.from(u.entries());return c.sort(([p],[d])=>p<d?-1:p>d?1:0),{value:c.flatMap(([,p])=>fu(p,t.args.pagination)),lastInsertId:s}}return{value:fu(a,t.args.pagination),lastInsertId:s}}case"initializeRecord":{let{lastInsertId:o}=await this.interpretNode(t.args.expr,r,n,i),s={};for(let[a,l]of Object.entries(t.args.fields))s[a]=sg(l,o,n,i);return{value:s,lastInsertId:o}}case"mapRecord":{let{value:o,lastInsertId:s}=await this.interpretNode(t.args.expr,r,n,i),a=o===null?{}:Cr(o);for(let[l,u]of Object.entries(t.args.fields))a[l]=ag(u,a[l],n,i);return{value:a,lastInsertId:s}}default:L(t,`Unexpected node type: ${t.type}`)}}#a(t,r,n){return In({query:t,queryable:r,execute:n,tracingHelper:this.#n,onQuery:this.#t})}};function pu(e){return Array.isArray(e)?e.length===0:e==null}function Ar(e){return Array.isArray(e)?e:[e]}function Ce(e){if(typeof e=="number")return e;if(typeof e=="string")return Number(e);throw new Error(`Expected number, got ${typeof e}`)}function Cr(e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Expected object, got ${typeof e}`)}function hu(e,t){return Array.isArray(e)?e.map(r=>hu(r,t)):typeof e=="object"&&e!==null?e[t]??null:e}function du(e,t){for(let{joinExpr:r,childRecords:n}of t)e[r.parentField]=og(n,e,r);return e}function og(e,t,r){if(Array.isArray(e)){let n=e.filter(i=>mu(Cr(i),t,r));return r.isRelationUnique?n.length>0?n[0]:null:n}else{if(e===null)return null;{let n=Cr(e);return mu(n,t,r)?n:null}}}function mu(e,t,r){for(let[n,i]of r.on)if(t[n]!==e[i])return!1;return!0}function fu(e,{cursor:t,skip:r,take:n}){let i=t!==null?e.findIndex(a=>hr(a,t)):0;if(i===-1)return[];let o=i+(r??0),s=n!==null?o+n:e.length;return e.slice(o,s)}function gu(e,t){return JSON.stringify(t.map(r=>e[r]))}function sg(e,t,r,n){switch(e.type){case"value":return ye(e.value,r,n);case"lastInsertId":return t;default:L(e,`Unexpected field initializer type: ${e.type}`)}}function ag(e,t,r,n){switch(e.type){case"set":return ye(e.value,r,n);case"add":return Ce(t)+Ce(ye(e.value,r,n));case"subtract":return Ce(t)-Ce(ye(e.value,r,n));case"multiply":return Ce(t)*Ce(ye(e.value,r,n));case"divide":{let i=Ce(t),o=Ce(ye(e.value,r,n));return o===0?null:i/o}default:L(e,`Unexpected field operation type: ${e.type}`)}}async function lg(){return globalThis.crypto??await import("node:crypto")}async function yu(){return(await lg()).randomUUID()}var pe=class extends Ae{name="TransactionManagerError";constructor(t,r){super("Transaction API error: "+t,"P2028",r)}},Sr=class extends pe{constructor(){super("Transaction not found. Transaction ID is invalid, refers to an old closed transaction Prisma doesn't have information about anymore, or was obtained before disconnecting.")}},Vn=class extends pe{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a committed transaction.`)}},qn=class extends pe{constructor(t){super(`Transaction already closed: A ${t} cannot be executed on a transaction that was rolled back.`)}},Un=class extends pe{constructor(){super("Unable to start a transaction in the given time.")}},jn=class extends pe{constructor(t,{timeout:r,timeTaken:n}){super(`A ${t} cannot be executed on an expired transaction. The timeout for this transaction was ${r} ms, however ${n} ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction`,{operation:t,timeout:r,timeTaken:n})}},Dt=class extends pe{constructor(t){super(`Internal Consistency Error: ${t}`)}},Bn=class extends pe{constructor(t){super(`Invalid isolation level: ${t}`,{isolationLevel:t})}};var ug=100,Rr=q("prisma:client:transactionManager"),cg=()=>({sql:"COMMIT",args:[],argTypes:[]}),pg=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),dg=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),mg=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),Ir=class{transactions=new Map;closedTransactions=[];driverAdapter;transactionOptions;tracingHelper;#e;constructor({driverAdapter:t,transactionOptions:r,tracingHelper:n,onQuery:i}){this.driverAdapter=t,this.transactionOptions=r,this.tracingHelper=n,this.#e=i}async startTransaction(t){return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#r(t))}async#r(t){let r=t!==void 0?this.validateOptions(t):this.transactionOptions,n={id:await yu(),status:"waiting",timer:void 0,timeout:r.timeout,startedAt:Date.now(),transaction:void 0};this.transactions.set(n.id,n),n.timer=this.startTransactionTimeout(n.id,r.maxWait);let i=await this.driverAdapter.startTransaction(r.isolationLevel);switch(n.status){case"waiting":return n.transaction=i,clearTimeout(n.timer),n.timer=void 0,n.status="running",n.timer=this.startTransactionTimeout(n.id,r.timeout),{id:n.id};case"timed_out":throw new Un;case"running":case"committed":case"rolled_back":throw new Dt(`Transaction in invalid state ${n.status} although it just finished startup.`);default:L(n.status,"Unknown transaction status.")}}async commitTransaction(t){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{let r=this.getActiveTransaction(t,"commit");await this.closeTransaction(r,"committed")})}async rollbackTransaction(t){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{let r=this.getActiveTransaction(t,"rollback");await this.closeTransaction(r,"rolled_back")})}getTransaction(t,r){let n=this.getActiveTransaction(t.id,r);if(!n.transaction)throw new Sr;return n.transaction}getActiveTransaction(t,r){let n=this.transactions.get(t);if(!n){let i=this.closedTransactions.find(o=>o.id===t);if(i)switch(Rr("Transaction already closed.",{transactionId:t,status:i.status}),i.status){case"waiting":case"running":throw new Dt("Active transaction found in closed transactions list.");case"committed":throw new Vn(r);case"rolled_back":throw new qn(r);case"timed_out":throw new jn(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw Rr("Transaction not found.",t),new Sr}if(["committed","rolled_back","timed_out"].includes(n.status))throw new Dt("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){await Promise.allSettled([...this.transactions.values()].map(t=>this.closeTransaction(t,"rolled_back")))}startTransactionTimeout(t,r){let n=Date.now();return setTimeout(async()=>{Rr("Transaction timed out.",{transactionId:t,timeoutStartedAt:n,timeout:r});let i=this.transactions.get(t);i&&["running","waiting"].includes(i.status)?await this.closeTransaction(i,"timed_out"):Rr("Transaction already committed or rolled back when timeout happened.",t)},r)}async closeTransaction(t,r){if(Rr("Closing transaction.",{transactionId:t.id,status:r}),t.status=r,t.transaction&&r==="committed")if(t.transaction.options.usePhantomQuery)await this.#t(dg(),t.transaction,()=>t.transaction.commit());else{await t.transaction.commit();let n=cg();await this.#t(n,t.transaction,()=>t.transaction.executeRaw(n))}else if(t.transaction)if(t.transaction.options.usePhantomQuery)await this.#t(mg(),t.transaction,()=>t.transaction.rollback());else{await t.transaction.rollback();let n=pg();await this.#t(n,t.transaction,()=>t.transaction.executeRaw(n))}clearTimeout(t.timer),t.timer=void 0,this.transactions.delete(t.id),this.closedTransactions.push(t),this.closedTransactions.length>ug&&this.closedTransactions.shift()}validateOptions(t){if(!t.timeout)throw new pe("timeout is required");if(!t.maxWait)throw new pe("maxWait is required");if(t.isolationLevel==="SNAPSHOT")throw new Bn(t.isolationLevel);return{...t,timeout:t.timeout,maxWait:t.maxWait}}#t(t,r,n){return In({query:t,queryable:r,execute:n,tracingHelper:this.tracingHelper,onQuery:this.#e})}};var Qn="6.10.0-dev.13";var xo,wu={async loadQueryCompiler(e){let{clientVersion:t,adapter:r,compilerWasm:n}=e;if(r===void 0)throw new O(`The \`adapter\` option for \`PrismaClient\` is required in this context (${Vi().prettyName})`,t);if(n===void 0)throw new O("WASM query compiler was unexpectedly `undefined`",t);return xo===void 0&&(xo=(async()=>{let i=await n.getRuntime(),o=await n.getQueryCompilerWasmModule();if(o==null)throw new O("The loaded wasm module was unexpectedly `undefined` or `null` once loaded",t);let s={"./query_compiler_bg.js":i},a=new WebAssembly.Instance(o,s),l=a.exports.__wbindgen_start;return i.__wbg_set_wasm(a.exports),l(),i.QueryCompiler})()),await xo}};var Eu="P2038",Hn=q("prisma:client:clientEngine"),bu=globalThis;bu.PRISMA_WASM_PANIC_REGISTRY={set_message(e){throw new oe(e,Qn)}};var _t=class{name="ClientEngine";queryCompiler;instantiateQueryCompilerPromise;QueryCompilerConstructor;queryCompilerLoader;adapterPromise;transactionManagerPromise;config;provider;datamodel;logEmitter;logQueries;logLevel;lastStartedQuery;tracingHelper;#e;constructor(t,r){if(!t.previewFeatures?.includes("driverAdapters"))throw new O("EngineType `client` requires the driverAdapters preview feature to be enabled.",t.clientVersion,Eu);if(t.adapter)this.adapterPromise=t.adapter.connect(),this.provider=t.adapter.provider,Hn("Using driver adapter: %O",t.adapter);else throw new O("Missing configured driver adapter. Engine type `client` requires an active driver adapter. Please check your PrismaClient initialization code.",t.clientVersion,Eu);this.queryCompilerLoader=r??wu,this.config=t,this.logQueries=t.logQueries??!1,this.logLevel=t.logLevel??"error",this.logEmitter=t.logEmitter,this.datamodel=t.inlineSchema,this.tracingHelper=t.tracingHelper,t.enableDebugLogs&&(this.logLevel="debug"),this.logQueries&&(this.#e=n=>{this.logEmitter.emit("query",{...n,params:yr(n.params),target:"ClientEngine"})}),this.transactionManagerPromise=this.adapterPromise.then(n=>new Ir({driverAdapter:n,transactionOptions:{...this.config.transactionOptions,isolationLevel:this.#i(this.config.transactionOptions.isolationLevel)},tracingHelper:this.tracingHelper,onQuery:this.#e})),this.instantiateQueryCompilerPromise=this.instantiateQueryCompiler()}applyPendingMigrations(){throw new Error("Cannot call applyPendingMigrations on engine type client.")}async instantiateQueryCompiler(){if(this.queryCompiler)return;this.QueryCompilerConstructor||(this.QueryCompilerConstructor=await this.queryCompilerLoader.loadQueryCompiler(this.config));let r=(await this.adapterPromise)?.getConnectionInfo?.()??{supportsRelationJoins:!1};try{this.#n(()=>{this.queryCompiler=new this.QueryCompilerConstructor({datamodel:this.datamodel,provider:this.provider,connectionInfo:r})})}catch(n){throw this.#r(n)}}#r(t){if(t instanceof oe)return t;try{let r=JSON.parse(t.message);return new O(r.message,this.config.clientVersion,r.error_code)}catch{return t}}#t(t){if(t instanceof O)return t;if(t.code==="GenericFailure"&&t.message?.startsWith("PANIC:"))return new oe(xu(this,t.message),this.config.clientVersion);if(t instanceof Ae)return new Q(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion});try{let r=JSON.parse(t);return new ee(`${r.message}
|
79
|
+
${r.backtrace}`,{clientVersion:this.config.clientVersion})}catch{return t}}#o(t){return t instanceof oe?t:typeof t.message=="string"&&typeof t.code=="string"?new Q(t.message,{code:t.code,meta:t.meta,clientVersion:this.config.clientVersion}):t}#n(t){let r=bu.PRISMA_WASM_PANIC_REGISTRY.set_message,n;global.PRISMA_WASM_PANIC_REGISTRY.set_message=i=>{n=i};try{return t()}finally{if(global.PRISMA_WASM_PANIC_REGISTRY.set_message=r,n)throw new oe(xu(this,n),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.tracingHelper.runInChildSpan("connect",()=>this.ensureStarted())}async stop(){await this.tracingHelper.runInChildSpan("disconnect",async()=>{await this.instantiateQueryCompilerPromise,await(await this.transactionManagerPromise)?.cancelAllTransactions(),await(await this.adapterPromise).dispose()})}async ensureStarted(){let t=await this.adapterPromise,r=await this.transactionManagerPromise;return await this.instantiateQueryCompilerPromise,[t,r]}version(){return"unknown"}async transaction(t,r,n){let i,o=await this.transactionManagerPromise;try{if(t==="start"){let s=n;i=await o.startTransaction({...s,isolationLevel:this.#i(s.isolationLevel)})}else if(t==="commit"){let s=n;await o.commitTransaction(s.id)}else if(t==="rollback"){let s=n;await o.rollbackTransaction(s.id)}else me(t,"Invalid transaction action.")}catch(s){throw this.#t(s)}return i?{id:i.id,payload:void 0}:void 0}async request(t,{traceparent:r,interactiveTransaction:n}){Hn("sending request");let i=JSON.stringify(t);this.lastStartedQuery=i;let[o,s]=await this.ensureStarted().catch(l=>{throw this.#t(l)}),a;try{a=this.#n(()=>this.queryCompiler.compile(i))}catch(l){throw this.#o(l)}try{Hn("query plan created",a);let l=n?s.getTransaction(n,"query"):o,u=n?{enabled:!1}:{enabled:!0,manager:s},c={},d=await Ot.forSql({transactionManager:u,placeholderValues:c,onQuery:this.#e,tracingHelper:this.tracingHelper}).run(a,l);return Hn("query plan executed"),{data:{[t.action]:d}}}catch(l){throw this.#t(l)}}async requestBatch(t,{transaction:r,traceparent:n}){if(t.length===0)return[];let i=t[0].action,o=JSON.stringify(At(t,r));this.lastStartedQuery=o;let[,s]=await this.ensureStarted().catch(l=>{throw this.#t(l)}),a;try{a=this.queryCompiler.compileBatch(o)}catch(l){throw this.#o(l)}try{let l;if(r?.kind==="itx")l=r.options;else{let f=r?.options.isolationLevel?{...this.config.transactionOptions,isolationLevel:r.options.isolationLevel}:this.config.transactionOptions;l=await this.transaction("start",{},f)}let u={},c=Ot.forSql({transactionManager:{enabled:!1},placeholderValues:u,onQuery:this.#e,tracingHelper:this.tracingHelper}),p=s.getTransaction(l,"batch query"),d=[];switch(a.type){case"multi":{d=await Promise.all(a.plans.map((f,g)=>c.run(f,p).then(h=>({data:{[t[g].action]:h}}),h=>h)));break}case"compacted":{if(!t.every(g=>g.action===i))throw new Error("All queries in a batch must have the same action");let f=await c.run(a.plan,p);d=this.#s(f,a,i);break}}return r?.kind!=="itx"&&await this.transaction("commit",{},l),d}catch(l){throw this.#t(l)}}metrics(t){throw new Error("Method not implemented.")}#s(t,r,n){let i=t.map(s=>r.keys.reduce((a,l)=>(a[l]=Ye(s[l]),a),{})),o=new Set(r.nestedSelection);return r.arguments.map(s=>{let a=i.findIndex(l=>hr(l,s));if(a===-1)return r.expectNonEmpty?new Q("An operation failed because it depends on one or more records that were required but not found",{code:"P2025",clientVersion:this.config.clientVersion}):{data:{[n]:null}};{let l=Object.entries(t[a]).filter(([u])=>o.has(u));return{data:{[n]:Object.fromEntries(l)}}}})}#i(t){switch(t){case void 0:return;case"ReadUncommitted":return"READ UNCOMMITTED";case"ReadCommitted":return"READ COMMITTED";case"RepeatableRead":return"REPEATABLE READ";case"Serializable":return"SERIALIZABLE";case"Snapshot":return"SNAPSHOT";default:throw new Q(`Inconsistent column data: Conversion failed: Invalid isolation level \`${t}\``,{code:"P2023",clientVersion:this.config.clientVersion,meta:{providedIsolationLevel:t}})}}};function xu(e,t){return Ya({binaryTarget:void 0,title:t,version:e.config.clientVersion,engineVersion:"unknown",database:e.config.activeProvider,query:e.lastStartedQuery})}function Nt({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 new O(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new O("error: Missing URL environment variable, value, or override.",n);return i}var Gn=class extends Error{clientVersion;cause;constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var ae=class extends Gn{isRetryable;constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};function S(e,t){return{...e,isRetryable:t}}var Mt=class extends ae{name="ForcedRetryError";code="P5001";constructor(t){super("This request must be retried",S(t,!0))}};b(Mt,"ForcedRetryError");var it=class extends ae{name="InvalidDatasourceError";code="P6001";constructor(t,r){super(t,S(r,!1))}};b(it,"InvalidDatasourceError");var ot=class extends ae{name="NotImplementedYetError";code="P5004";constructor(t,r){super(t,S(r,!1))}};b(ot,"NotImplementedYetError");var F=class extends ae{response;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 st=class extends F{name="SchemaMissingError";code="P5005";constructor(t){super("Schema needs to be uploaded",S(t,!0))}};b(st,"SchemaMissingError");var bo="This request could not be understood by the server",kr=class extends F{name="BadRequestError";code="P5000";constructor(t,r,n){super(r||bo,S(t,!1)),n&&(this.code=n)}};b(kr,"BadRequestError");var Or=class extends F{name="HealthcheckTimeoutError";code="P5013";logs;constructor(t,r){super("Engine not started: healthcheck timeout",S(t,!0)),this.logs=r}};b(Or,"HealthcheckTimeoutError");var Dr=class extends F{name="EngineStartupError";code="P5014";logs;constructor(t,r,n){super(r,S(t,!0)),this.logs=n}};b(Dr,"EngineStartupError");var _r=class extends F{name="EngineVersionNotSupportedError";code="P5012";constructor(t){super("Engine version is not supported",S(t,!1))}};b(_r,"EngineVersionNotSupportedError");var Po="Request timed out",Nr=class extends F{name="GatewayTimeoutError";code="P5009";constructor(t,r=Po){super(r,S(t,!1))}};b(Nr,"GatewayTimeoutError");var gg="Interactive transaction error",Mr=class extends F{name="InteractiveTransactionError";code="P5015";constructor(t,r=gg){super(r,S(t,!1))}};b(Mr,"InteractiveTransactionError");var hg="Request parameters are invalid",Fr=class extends F{name="InvalidRequestError";code="P5011";constructor(t,r=hg){super(r,S(t,!1))}};b(Fr,"InvalidRequestError");var vo="Requested resource does not exist",Lr=class extends F{name="NotFoundError";code="P5003";constructor(t,r=vo){super(r,S(t,!1))}};b(Lr,"NotFoundError");var To="Unknown server error",Ft=class extends F{name="ServerError";code="P5006";logs;constructor(t,r,n){super(r||To,S(t,!0)),this.logs=n}};b(Ft,"ServerError");var Ao="Unauthorized, check your connection string",$r=class extends F{name="UnauthorizedError";code="P5007";constructor(t,r=Ao){super(r,S(t,!1))}};b($r,"UnauthorizedError");var Co="Usage exceeded, retry again later",Vr=class extends F{name="UsageExceededError";code="P5008";constructor(t,r=Co){super(r,S(t,!0))}};b(Vr,"UsageExceededError");async function yg(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:"QueryEngineError",body:r};if("EngineNotStarted"in r||"InteractiveTransactionMisrouted"in r||"InvalidRequestError"in r){let n=Object.values(r)[0].reason;return typeof n=="string"&&!["SchemaMissing","EngineVersionNotSupported"].includes(n)?{type:"UnknownJsonError",body:r}:{type:"DataProxyError",body:r}}}return{type:"UnknownJsonError",body:r}}catch{return t===""?{type:"EmptyError"}:{type:"UnknownTextError",body:t}}}async function qr(e,t){if(e.ok)return;let r={clientVersion:t,response:e},n=await yg(e);if(n.type==="QueryEngineError")throw new Q(n.body.message,{code:n.body.error_code,clientVersion:t});if(n.type==="DataProxyError"){if(n.body==="InternalDataProxyError")throw new Ft(r,"Internal Data Proxy error");if("EngineNotStarted"in n.body){if(n.body.EngineNotStarted.reason==="SchemaMissing")return new st(r);if(n.body.EngineNotStarted.reason==="EngineVersionNotSupported")throw new _r(r);if("EngineStartupError"in n.body.EngineNotStarted.reason){let{msg:i,logs:o}=n.body.EngineNotStarted.reason.EngineStartupError;throw new Dr(r,i,o)}if("KnownEngineStartupError"in n.body.EngineNotStarted.reason){let{msg:i,error_code:o}=n.body.EngineNotStarted.reason.KnownEngineStartupError;throw new O(i,t,o)}if("HealthcheckTimeout"in n.body.EngineNotStarted.reason){let{logs:i}=n.body.EngineNotStarted.reason.HealthcheckTimeout;throw new Or(r,i)}}if("InteractiveTransactionMisrouted"in n.body){let i={IDParseError:"Could not parse interactive transaction ID",NoQueryEngineFoundError:"Could not find Query Engine for the specified host and transaction ID",TransactionStartError:"Could not start interactive transaction"};throw new Mr(r,i[n.body.InteractiveTransactionMisrouted.reason])}if("InvalidRequestError"in n.body)throw new Fr(r,n.body.InvalidRequestError.reason)}if(e.status===401||e.status===403)throw new $r(r,Lt(Ao,n));if(e.status===404)return new Lr(r,Lt(vo,n));if(e.status===429)throw new Vr(r,Lt(Co,n));if(e.status===504)throw new Nr(r,Lt(Po,n));if(e.status>=500)throw new Ft(r,Lt(To,n));if(e.status>=400)throw new kr(r,Lt(bo,n))}function Lt(e,t){return t.type==="EmptyError"?e:`${e}: ${JSON.stringify(t)}`}function Pu(e){let t=Math.pow(2,e)*50,r=Math.ceil(Math.random()*t)-Math.ceil(t/2),n=t+r;return new Promise(i=>setTimeout(()=>i(n),n))}var Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function vu(e){let t=new TextEncoder().encode(e),r="",n=t.byteLength,i=n%3,o=n-i,s,a,l,u,c;for(let p=0;p<o;p=p+3)c=t[p]<<16|t[p+1]<<8|t[p+2],s=(c&16515072)>>18,a=(c&258048)>>12,l=(c&4032)>>6,u=c&63,r+=Me[s]+Me[a]+Me[l]+Me[u];return i==1?(c=t[o],s=(c&252)>>2,a=(c&3)<<4,r+=Me[s]+Me[a]+"=="):i==2&&(c=t[o]<<8|t[o+1],s=(c&64512)>>10,a=(c&1008)>>4,l=(c&15)<<2,r+=Me[s]+Me[a]+Me[l]+"="),r}function Tu(e){if(!!e.generator?.previewFeatures.some(r=>r.toLowerCase().includes("metrics")))throw new O("The `metrics` preview feature is not yet available with Accelerate.\nPlease remove `metrics` from the `previewFeatures` in your schema.\n\nMore information about Accelerate: https://pris.ly/d/accelerate",e.clientVersion)}function wg(e){return e[0]*1e3+e[1]/1e6}function So(e){return new Date(wg(e))}var Au={"@prisma/debug":"workspace:*","@prisma/engines-version":"6.10.0-12.92dceb179d2de27c75ffc880013170792e527a34","@prisma/fetch-engine":"workspace:*","@prisma/get-platform":"workspace:*"};var Ur=class extends ae{name="RequestError";code="P5010";constructor(t,r){super(`Cannot fetch data from service:
|
80
80
|
${t}`,S(r,!0))}};b(Ur,"RequestError");async function at(e,t,r=n=>n){let{clientVersion:n,...i}=t,o=r(fetch);try{return await o(e,i)}catch(s){let a=s.message??"Unknown error";throw new Ur(a,{clientVersion:n,cause:s})}}var xg=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,Cu=q("prisma:client:dataproxyEngine");async function bg(e,t){let r=Au["@prisma/engines-version"],n=t.clientVersion??"unknown";if(process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION||globalThis.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION||globalThis.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION;if(e.includes("accelerate")&&n!=="0.0.0"&&n!=="in-memory")return n;let[i,o]=n?.split("-")??[];if(o===void 0&&xg.test(i))return i;if(o!==void 0||n==="0.0.0"||n==="in-memory"){let[s]=r.split("-")??[],[a,l,u]=s.split("."),c=Pg(`<=${a}.${l}.${u}`),p=await at(c,{clientVersion:n});if(!p.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${p.status} ${p.statusText}, response body: ${await p.text()||"<empty body>"}`);let d=await p.text();Cu("length of body fetched from unpkg.com",d.length);let f;try{f=JSON.parse(d)}catch(g){throw console.error("JSON.parse error: body fetched from unpkg.com: ",d),g}return f.version}throw new ot("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function Su(e,t){let r=await bg(e,t);return Cu("version",r),r}function Pg(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var Ru=3,jr=q("prisma:client:dataproxyEngine"),Ro=class{apiKey;tracingHelper;logLevel;logQueries;engineHash;constructor({apiKey:t,tracingHelper:r,logLevel:n,logQueries:i,engineHash:o}){this.apiKey=t,this.tracingHelper=r,this.logLevel=n,this.logQueries=i,this.engineHash=o}build({traceparent:t,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}},Br=class{name="DataProxyEngine";inlineSchema;inlineSchemaHash;inlineDatasources;config;logEmitter;env;clientVersion;engineHash;tracingHelper;remoteClientVersion;host;headerBuilder;startPromise;protocol;constructor(t){Tu(t),this.config=t,this.env={...t.env,...typeof process<"u"?process.env:{}},this.inlineSchema=vu(t.inlineSchema),this.inlineDatasources=t.inlineDatasources,this.inlineSchemaHash=t.inlineSchemaHash,this.clientVersion=t.clientVersion,this.engineHash=t.engineVersion,this.logEmitter=t.logEmitter,this.tracingHelper=t.tracingHelper}apiKey(){return this.headerBuilder.apiKey}version(){return this.engineHash}async start(){this.startPromise!==void 0&&await this.startPromise,this.startPromise=(async()=>{let{apiKey:t,url:r}=this.getURLAndAPIKey();this.host=r.host,this.headerBuilder=new Ro({apiKey:t,tracingHelper:this.tracingHelper,logLevel:this.config.logLevel,logQueries:this.config.logQueries,engineHash:this.engineHash}),this.protocol=ii(r)?"http":"https",this.remoteClientVersion=await Su(this.host,this.config),jr("host",this.host),jr("protocol",this.protocol)})(),await this.startPromise}async stop(){}propagateResponseExtensions(t){t?.logs?.length&&t.logs.forEach(r=>{switch(r.level){case"debug":case"trace":jr(r);break;case"error":case"warn":case"info":{this.logEmitter.emit(r.level,{timestamp:So(r.timestamp),message:r.attributes.message??"",target:r.target});break}case"query":{this.logEmitter.emit("query",{query:r.attributes.query??"",timestamp:So(r.timestamp),duration:r.attributes.duration_ms??0,params:r.attributes.params??"",target:r.target});break}default:r.level}}),t?.traces?.length&&this.tracingHelper.dispatchEngineSpans(t.traces)}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the remote query engine')}async url(t){return await this.start(),`${this.protocol}://${this.host}/${this.remoteClientVersion}/${this.inlineSchemaHash}/${t}`}async uploadSchema(){let t={name:"schemaUpload",internal:!0};return this.tracingHelper.runInChildSpan(t,async()=>{let r=await at(await this.url("schema"),{method:"PUT",headers:this.headerBuilder.build(),body:this.inlineSchema,clientVersion:this.clientVersion});r.ok||jr("schema response status",r.status);let n=await qr(r,this.clientVersion);if(n)throw this.logEmitter.emit("warn",{message:`Error while uploading schema: ${n.message}`,timestamp:new Date,target:""}),n;this.logEmitter.emit("info",{message:`Schema (re)uploaded (hash: ${this.inlineSchemaHash})`,timestamp:new Date,target:""})})}request(t,{traceparent:r,interactiveTransaction:n,customDataProxyFetch:i}){return this.requestInternal({body:t,traceparent:r,interactiveTransaction:n,customDataProxyFetch:i})}async requestBatch(t,{traceparent:r,transaction:n,customDataProxyFetch:i}){let o=n?.kind==="itx"?n.options:void 0,s=At(t,n);return(await this.requestInternal({body:s,customDataProxyFetch:i,interactiveTransaction:o,traceparent:r})).map(l=>(l.extensions&&this.propagateResponseExtensions(l.extensions),"errors"in l?this.convertProtocolErrorsToClientError(l.errors):l))}requestInternal({body:t,traceparent:r,customDataProxyFetch:n,interactiveTransaction:i}){return this.withRetry({actionGerund:"querying",callback:async({logHttpCall:o})=>{let s=i?`${i.payload.endpoint}/graphql`:await this.url("graphql");o(s);let a=await at(s,{method:"POST",headers:this.headerBuilder.build({traceparent:r,interactiveTransaction:i}),body:JSON.stringify(t),clientVersion:this.clientVersion},n);a.ok||jr("graphql response status",a.status),await this.handleError(await qr(a,this.clientVersion));let l=await a.json();if(l.extensions&&this.propagateResponseExtensions(l.extensions),"errors"in l)throw this.convertProtocolErrorsToClientError(l.errors);return"batchResult"in l?l.batchResult:l}})}async transaction(t,r,n){let i={start:"starting",commit:"committing",rollback:"rolling back"};return this.withRetry({actionGerund:`${i[t]} transaction`,callback:async({logHttpCall:o})=>{if(t==="start"){let s=JSON.stringify({max_wait:n.maxWait,timeout:n.timeout,isolation_level:n.isolationLevel}),a=await this.url("transaction/start");o(a);let l=await at(a,{method:"POST",headers:this.headerBuilder.build({traceparent:r.traceparent}),body:s,clientVersion:this.clientVersion});await this.handleError(await qr(l,this.clientVersion));let u=await l.json(),{extensions:c}=u;c&&this.propagateResponseExtensions(c);let p=u.id,d=u["data-proxy"].endpoint;return{id:p,payload:{endpoint:d}}}else{let s=`${n.payload.endpoint}/${t}`;o(s);let a=await at(s,{method:"POST",headers:this.headerBuilder.build({traceparent:r.traceparent}),clientVersion:this.clientVersion});await this.handleError(await qr(a,this.clientVersion));let l=await a.json(),{extensions:u}=l;u&&this.propagateResponseExtensions(u);return}}})}getURLAndAPIKey(){let t={clientVersion:this.clientVersion},r=Object.keys(this.inlineDatasources)[0],n=Nt({inlineDatasources:this.inlineDatasources,overrideDatasources:this.config.overrideDatasources,clientVersion:this.clientVersion,env:this.env}),i;try{i=new URL(n)}catch{throw new it(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\``,t)}let{protocol:o,searchParams:s}=i;if(o!=="prisma:"&&o!==Gr)throw new it(`Error validating datasource \`${r}\`: the URL must start with the protocol \`prisma://\` or \`prisma+postgres://\``,t);let a=s.get("api_key");if(a===null||a.length<1)throw new it(`Error validating datasource \`${r}\`: the URL must contain a valid API key`,t);return{apiKey:a,url:i}}metrics(){throw new ot("Metrics are not yet supported for Accelerate",{clientVersion:this.clientVersion})}async withRetry(t){for(let r=0;;r++){let n=i=>{this.logEmitter.emit("info",{message:`Calling ${i} (n=${r})`,timestamp:new Date,target:""})};try{return await t.callback({logHttpCall:n})}catch(i){if(!(i instanceof ae)||!i.isRetryable)throw i;if(r>=Ru)throw i instanceof Mt?i.cause:i;this.logEmitter.emit("warn",{message:`Attempt ${r+1}/${Ru} failed for ${t.actionGerund}: ${i.message??"(unknown)"}`,timestamp:new Date,target:""});let o=await Pu(r);this.logEmitter.emit("warn",{message:`Retrying after ${o}ms`,timestamp:new Date,target:""})}}}async handleError(t){if(t instanceof st)throw await this.uploadSchema(),new Mt({clientVersion:this.clientVersion,cause:t});if(t)throw t}convertProtocolErrorsToClientError(t){return t.length===1?Cn(t[0],this.config.clientVersion,this.config.activeProvider):new ee(JSON.stringify(t),{clientVersion:this.config.clientVersion})}applyPendingMigrations(){throw new Error("Method not implemented.")}};function Iu({copyEngine:e=!0},t){let r;try{r=Nt({inlineDatasources:t.inlineDatasources,overrideDatasources:t.overrideDatasources,env:{...t.env,...process.env},clientVersion:t.clientVersion})}catch{}let n=!!(r?.startsWith("prisma://")||Wr(r));e&&n&&zr("recommend--no-engine","In production, we recommend using `prisma generate --no-engine` (See: `prisma generate --help`)");let i=ct(t.generator),o=n||!e,s=!!t.adapter,a=i==="library",l=i==="binary",u=i==="client";if(o&&s||s&&!1){let c;throw e?r?.startsWith("prisma://")?c=["Prisma Client was configured to use the `adapter` option but the URL was a `prisma://` URL.","Please either use the `prisma://` URL or remove the `adapter` from the Prisma Client constructor."]:c=["Prisma Client was configured to use both the `adapter` and Accelerate, please chose one."]:c=["Prisma Client was configured to use the `adapter` option but `prisma generate` was run with `--no-engine`.","Please run `prisma generate` without `--no-engine` to be able to use Prisma Client with the adapter."],new te(c.join(`
|
81
81
|
`),{clientVersion:t.clientVersion})}return o?new Br(t):u?new _t(t):new _t(t)}function Wn({generator:e}){return e?.previewFeatures??[]}var ku=e=>({command:e});var Ou=e=>e.strings.reduce((t,r,n)=>`${t}@P${n}${r}`);function $t(e){try{return Du(e,"fast")}catch{return Du(e,"slow")}}function Du(e,t){return JSON.stringify(e.map(r=>Nu(r,t)))}function Nu(e,t){if(Array.isArray(e))return e.map(r=>Nu(r,t));if(typeof e=="bigint")return{prisma__type:"bigint",prisma__value:e.toString()};if(ft(e))return{prisma__type:"date",prisma__value:e.toJSON()};if(Z.isDecimal(e))return{prisma__type:"decimal",prisma__value:e.toJSON()};if(Buffer.isBuffer(e))return{prisma__type:"bytes",prisma__value:e.toString("base64")};if(vg(e))return{prisma__type:"bytes",prisma__value:Buffer.from(e).toString("base64")};if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{prisma__type:"bytes",prisma__value:Buffer.from(r,n,i).toString("base64")}}return typeof e=="object"&&t==="slow"?Mu(e):e}function vg(e){return e instanceof ArrayBuffer||e instanceof SharedArrayBuffer?!0:typeof e=="object"&&e!==null?e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer":!1}function Mu(e){if(typeof e!="object"||e===null)return e;if(typeof e.toJSON=="function")return e.toJSON();if(Array.isArray(e))return e.map(_u);let t={};for(let r of Object.keys(e))t[r]=_u(e[r]);return t}function _u(e){return typeof e=="bigint"?e.toString():Mu(e)}var Tg=/^(\s*alter\s)/i,Fu=q("prisma:client");function Io(e,t,r,n){if(!(e!=="postgresql"&&e!=="cockroachdb")&&r.length>0&&Tg.exec(t))throw new Error(`Running ALTER using ${n} is not supported
|
82
82
|
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.
|