@prisma/client 7.10.0-dev.40 → 7.10.0-dev.41

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.
@@ -3,7 +3,7 @@ var kl=Object.create;var Kn=Object.defineProperty;var Nl=Object.getOwnPropertyDe
3
3
  `)}function mc(t){let e=[t.fileName];return t.lineNumber&&e.push(String(t.lineNumber)),t.columnNumber&&e.push(String(t.columnNumber)),e.join(":")}function Xr(t){let e=t.showColors?lc:cc,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(t,e):r=pc(t),dc(r,e)}u();l();c();p();d();var Rs=It(li());u();l();c();p();d();function Ps(t,e,r){let n=Ts(t),i=fc(n),o=yc(i);o?Zr(o,e,r):e.addErrorMessage(()=>"Unknown error")}function Ts(t){return t.errors.flatMap(e=>e.kind==="Union"?Ts(e):[e])}function fc(t){let e=new Map,r=[];for(let n of t){if(n.kind!=="InvalidArgumentType"){r.push(n);continue}let i=`${n.selectionPath.join(".")}:${n.argumentPath.join(".")}`,o=e.get(i);o?e.set(i,{...n,argument:{...n.argument,typeNames:gc(o.argument.typeNames,n.argument.typeNames)}}):e.set(i,n)}return r.push(...e.values()),r}function gc(t,e){return[...new Set(t.concat(e))]}function yc(t){return ui(t,(e,r)=>{let n=xs(e),i=xs(r);return n!==i?n-i:Es(e)-Es(r)})}function xs(t){let e=0;return Array.isArray(t.selectionPath)&&(e+=t.selectionPath.length),Array.isArray(t.argumentPath)&&(e+=t.argumentPath.length),e}function Es(t){switch(t.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}u();l();c();p();d();var ke=class{constructor(e,r){this.name=e;this.value=r}isRequired=!1;makeRequired(){return this.isRequired=!0,this}write(e){let{colors:{green:r}}=e.context;e.addMarginSymbol(r(this.isRequired?"+":"?")),e.write(r(this.name)),this.isRequired||e.write(r("?")),e.write(r(": ")),typeof this.value=="string"?e.write(r(this.value)):e.write(this.value)}};u();l();c();p();d();u();l();c();p();d();Ss();u();l();c();p();d();var $t=class{constructor(e=0,r){this.context=r;this.currentIndent=e}lines=[];currentLine="";currentIndent=0;marginSymbol;afterNextNewLineCallback;write(e){return typeof e=="string"?this.currentLine+=e:e.write(this),this}writeJoined(e,r,n=(i,o)=>o.write(i)){let i=r.length-1;for(let o=0;o<r.length;o++)n(r[o],this),o!==i&&this.write(e);return this}writeLine(e){return this.write(e).newLine()}newLine(){this.lines.push(this.indentedCurrentLine()),this.currentLine="",this.marginSymbol=void 0;let e=this.afterNextNewLineCallback;return this.afterNextNewLineCallback=void 0,e?.(),this}withIndent(e){return this.indent(),e(this),this.unindent(),this}afterNextNewline(e){return this.afterNextNewLineCallback=e,this}indent(){return this.currentIndent++,this}unindent(){return this.currentIndent>0&&this.currentIndent--,this}addMarginSymbol(e){return this.marginSymbol=e,this}toString(){return this.lines.concat(this.indentedCurrentLine()).join(`
4
4
  `)}getCurrentLineLength(){return this.currentLine.length}indentedCurrentLine(){let e=this.currentLine.padStart(this.currentLine.length+2*this.currentIndent);return this.marginSymbol?this.marginSymbol+e.slice(1):e}};vs();u();l();c();p();d();u();l();c();p();d();var Yr=class{constructor(e){this.value=e}write(e){e.write(this.value)}markAsError(){this.value.markAsError()}};u();l();c();p();d();var en=t=>t,tn={bold:en,red:en,green:en,dim:en,enabled:!1},As={bold:Br,red:Nt,green:Wo,dim:jr,enabled:!0},Ut={write(t){t.writeLine(",")}};u();l();c();p();d();var We=class{constructor(e){this.contents=e}isUnderlined=!1;color=e=>e;underline(){return this.isUnderlined=!0,this}setColor(e){return this.color=e,this}write(e){let r=e.getCurrentLineLength();e.write(this.color(this.contents)),this.isUnderlined&&e.afterNextNewline(()=>{e.write(" ".repeat(r)).writeLine(this.color("~".repeat(this.contents.length)))})}};u();l();c();p();d();var at=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var Vt=class extends at{items=[];addItem(e){return this.items.push(new Yr(e)),this}getField(e){return this.items[e]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(r=>r.value.getPrintWidth()))+2}write(e){if(this.items.length===0){this.writeEmpty(e);return}this.writeWithItems(e)}writeEmpty(e){let r=new We("[]");this.hasError&&r.setColor(e.context.colors.red).underline(),e.write(r)}writeWithItems(e){let{colors:r}=e.context;e.writeLine("[").withIndent(()=>e.writeJoined(Ut,this.items).newLine()).write("]"),this.hasError&&e.afterNextNewline(()=>{e.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var qt=class t extends at{fields={};suggestions=[];addField(e){this.fields[e.name]=e}addSuggestion(e){this.suggestions.push(e)}getField(e){return this.fields[e]}getDeepField(e){let[r,...n]=e,i=this.getField(r);if(!i)return;let o=i;for(let s of n){let a;if(o.value instanceof t?a=o.value.getField(s):o.value instanceof Vt&&(a=o.value.getField(Number(s))),!a)return;o=a}return o}getDeepFieldValue(e){return e.length===0?this:this.getDeepField(e)?.value}hasField(e){return!!this.getField(e)}removeAllFields(){this.fields={}}removeField(e){delete this.fields[e]}getFields(){return this.fields}isEmpty(){return Object.keys(this.fields).length===0}getFieldValue(e){return this.getField(e)?.value}getDeepSubSelectionValue(e){let r=this;for(let n of e){if(!(r instanceof t))return;let i=r.getSubSelectionValue(n);if(!i)return;r=i}return r}getDeepSelectionParent(e){let r=this.getSelectionParent();if(!r)return;let n=r;for(let i of e){let o=n.value.getFieldValue(i);if(!o||!(o instanceof t))return;let s=o.getSelectionParent();if(!s)return;n=s}return n}getSelectionParent(){let e=this.getField("select")?.value.asObject();if(e)return{kind:"select",value:e};let r=this.getField("include")?.value.asObject();if(r)return{kind:"include",value:r}}getSubSelectionValue(e){return this.getSelectionParent()?.value.fields[e].value}getPrintWidth(){let e=Object.values(this.fields);return e.length==0?2:Math.max(...e.map(n=>n.getPrintWidth()))+2}write(e){let r=Object.values(this.fields);if(r.length===0&&this.suggestions.length===0){this.writeEmpty(e);return}this.writeWithContents(e,r)}asObject(){return this}writeEmpty(e){let r=new We("{}");this.hasError&&r.setColor(e.context.colors.red).underline(),e.write(r)}writeWithContents(e,r){e.writeLine("{").withIndent(()=>{e.writeJoined(Ut,[...r,...this.suggestions]).newLine()}),e.write("}"),this.hasError&&e.afterNextNewline(()=>{e.writeLine(e.context.colors.red("~".repeat(this.getPrintWidth())))})}};u();l();c();p();d();var ye=class extends at{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new We(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};u();l();c();p();d();var fr=class{fields=[];addField(e,r){return this.fields.push({write(n){let{green:i,dim:o}=n.context.colors;n.write(i(o(`${e}: ${r}`))).addMarginSymbol(i(o("+")))}}),this}write(e){let{colors:{green:r}}=e.context;e.writeLine(r("{")).withIndent(()=>{e.writeJoined(Ut,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Zr(t,e,r){switch(t.kind){case"MutuallyExclusiveFields":hc(t,e);break;case"IncludeOnScalar":wc(t,e);break;case"EmptySelection":bc(t,e,r);break;case"UnknownSelectionField":Tc(t,e);break;case"InvalidSelectionValue":vc(t,e);break;case"UnknownArgument":Sc(t,e);break;case"UnknownInputField":Ac(t,e);break;case"RequiredArgumentMissing":Rc(t,e);break;case"InvalidArgumentType":Cc(t,e);break;case"InvalidArgumentValue":Ic(t,e);break;case"ValueTooLarge":Oc(t,e);break;case"SomeFieldsMissing":kc(t,e);break;case"TooManyFieldsGiven":Nc(t,e);break;case"Union":Ps(t,e,r);break;default:throw new Error("not implemented: "+t.kind)}}function hc(t,e){let r=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject();r&&(r.getField(t.firstField)?.markAsError(),r.getField(t.secondField)?.markAsError()),e.addErrorMessage(n=>`Please ${n.bold("either")} use ${n.green(`\`${t.firstField}\``)} or ${n.green(`\`${t.secondField}\``)}, but ${n.red("not both")} at the same time.`)}function wc(t,e){let[r,n]=Bt(t.selectionPath),i=t.outputType,o=e.arguments.getDeepSelectionParent(r)?.value;if(o&&(o.getField(n)?.markAsError(),i))for(let s of i.fields)s.isRelation&&o.addSuggestion(new ke(s.name,"true"));e.addErrorMessage(s=>{let a=`Invalid scalar field ${s.red(`\`${n}\``)} for ${s.bold("include")} statement`;return i?a+=` on model ${s.bold(i.name)}. ${gr(s)}`:a+=".",a+=`
5
5
  Note that ${s.bold("include")} statements only accept relation fields.`,a})}function bc(t,e,r){let n=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){xc(t,e,i);return}if(n.hasField("select")){Ec(t,e);return}}if(r?.[st(t.outputType.name)]){Pc(t,e);return}e.addErrorMessage(()=>`Unknown field at "${t.selectionPath.join(".")} selection"`)}function xc(t,e,r){r.removeAllFields();for(let n of t.outputType.fields)r.addSuggestion(new ke(n.name,"false"));e.addErrorMessage(n=>`The ${n.red("omit")} statement includes every field of the model ${n.bold(t.outputType.name)}. At least one field must be included in the result`)}function Ec(t,e){let r=t.outputType,n=e.arguments.getDeepSelectionParent(t.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),Os(n,r)),e.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${gr(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function Pc(t,e){let r=new fr;for(let i of t.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new ke("omit",r).makeRequired();if(t.selectionPath.length===0)e.arguments.addSuggestion(n);else{let[i,o]=Bt(t.selectionPath),a=e.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let m=a?.value.asObject()??new qt;m.addSuggestion(n),a.value=m}}e.addErrorMessage(i=>`The global ${i.red("omit")} configuration excludes every field of the model ${i.bold(t.outputType.name)}. At least one field must be included in the result`)}function Tc(t,e){let r=ks(t.selectionPath,e);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":Os(n,t.outputType);break;case"include":Dc(n,t.outputType);break;case"omit":Mc(n,t.outputType);break}}e.addErrorMessage(n=>{let i=[`Unknown field ${n.red(`\`${r.fieldName}\``)}`];return r.parentKind!=="unknown"&&i.push(`for ${n.bold(r.parentKind)} statement`),i.push(`on model ${n.bold(`\`${t.outputType.name}\``)}.`),i.push(gr(n)),i.join(" ")})}function vc(t,e){let r=ks(t.selectionPath,e);r.parentKind!=="unknown"&&r.field.value.markAsError(),e.addErrorMessage(n=>`Invalid value for selection field \`${n.red(r.fieldName)}\`: ${t.underlyingError}`)}function Sc(t,e){let r=t.argumentPath[0],n=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),Lc(n,t.arguments)),e.addErrorMessage(i=>Cs(i,r,t.arguments.map(o=>o.name)))}function Ac(t,e){let[r,n]=Bt(t.argumentPath),i=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject();if(i){i.getDeepField(t.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&Ns(o,t.inputType)}e.addErrorMessage(o=>Cs(o,n,t.inputType.fields.map(s=>s.name)))}function Cs(t,e,r){let n=[`Unknown argument \`${t.red(e)}\`.`],i=Fc(e,r);return i&&n.push(`Did you mean \`${t.green(i)}\`?`),r.length>0&&n.push(gr(t)),n.join(" ")}function Rc(t,e){let r;e.addErrorMessage(m=>r?.value instanceof ye&&r.value.text==="null"?`Argument \`${m.green(o)}\` must not be ${m.red("null")}.`:`Argument \`${m.green(o)}\` is missing.`);let n=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject();if(!n)return;let[i,o]=Bt(t.argumentPath),s=new fr,a=n.getDeepFieldValue(i)?.asObject();if(a){if(r=a.getField(o),r&&a.removeField(o),t.inputTypes.length===1&&t.inputTypes[0].kind==="object"){for(let m of t.inputTypes[0].fields)s.addField(m.name,m.typeNames.join(" | "));a.addSuggestion(new ke(o,s).makeRequired())}else{let m=t.inputTypes.map(Is).join(" | ");a.addSuggestion(new ke(o,m).makeRequired())}if(t.dependentArgumentPath){n.getDeepField(t.dependentArgumentPath)?.markAsError();let[,m]=Bt(t.dependentArgumentPath);e.addErrorMessage(y=>`Argument \`${y.green(o)}\` is required because argument \`${y.green(m)}\` was provided.`)}}}function Is(t){return t.kind==="list"?`${Is(t.elementType)}[]`:t.name}function Cc(t,e){let r=t.argument.name,n=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject();n&&n.getDeepFieldValue(t.argumentPath)?.markAsError(),e.addErrorMessage(i=>{let o=rn("or",t.argument.typeNames.map(s=>i.green(s)));return`Argument \`${i.bold(r)}\`: Invalid value provided. Expected ${o}, provided ${i.red(t.inferredType)}.`})}function Ic(t,e){let r=t.argument.name,n=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject();n&&n.getDeepFieldValue(t.argumentPath)?.markAsError(),e.addErrorMessage(i=>{let o=[`Invalid value for argument \`${i.bold(r)}\``];if(t.underlyingError&&o.push(`: ${t.underlyingError}`),o.push("."),t.argument.typeNames.length>0){let s=rn("or",t.argument.typeNames.map(a=>i.green(a)));o.push(` Expected ${s}.`)}return o.join("")})}function Oc(t,e){let r=t.argument.name,n=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject(),i;if(n){let s=n.getDeepField(t.argumentPath)?.value;s?.markAsError(),s instanceof ye&&(i=s.text)}e.addErrorMessage(o=>{let s=["Unable to fit value"];return i&&s.push(o.red(i)),s.push(`into a 64-bit signed integer for field \`${o.bold(r)}\``),s.join(" ")})}function kc(t,e){let r=t.argumentPath[t.argumentPath.length-1],n=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject();if(n){let i=n.getDeepFieldValue(t.argumentPath)?.asObject();i&&Ns(i,t.inputType)}e.addErrorMessage(i=>{let o=[`Argument \`${i.bold(r)}\` of type ${i.bold(t.inputType.name)} needs`];return t.constraints.minFieldCount===1?t.constraints.requiredFields?o.push(`${i.green("at least one of")} ${rn("or",t.constraints.requiredFields.map(s=>`\`${i.bold(s)}\``))} arguments.`):o.push(`${i.green("at least one")} argument.`):o.push(`${i.green(`at least ${t.constraints.minFieldCount}`)} arguments.`),o.push(gr(i)),o.join(" ")})}function Nc(t,e){let r=t.argumentPath[t.argumentPath.length-1],n=e.arguments.getDeepSubSelectionValue(t.selectionPath)?.asObject(),i=[];if(n){let o=n.getDeepFieldValue(t.argumentPath)?.asObject();o&&(o.markAsError(),i=Object.keys(o.getFields()))}e.addErrorMessage(o=>{let s=[`Argument \`${o.bold(r)}\` of type ${o.bold(t.inputType.name)} needs`];return t.constraints.minFieldCount===1&&t.constraints.maxFieldCount==1?s.push(`${o.green("exactly one")} argument,`):t.constraints.maxFieldCount==1?s.push(`${o.green("at most one")} argument,`):s.push(`${o.green(`at most ${t.constraints.maxFieldCount}`)} arguments,`),s.push(`but you provided ${rn("and",i.map(a=>o.red(a)))}. Please choose`),t.constraints.maxFieldCount===1?s.push("one."):s.push(`${t.constraints.maxFieldCount}.`),s.join(" ")})}function Os(t,e){for(let r of e.fields)t.hasField(r.name)||t.addSuggestion(new ke(r.name,"true"))}function Dc(t,e){for(let r of e.fields)r.isRelation&&!t.hasField(r.name)&&t.addSuggestion(new ke(r.name,"true"))}function Mc(t,e){for(let r of e.fields)!t.hasField(r.name)&&!r.isRelation&&t.addSuggestion(new ke(r.name,"true"))}function Lc(t,e){for(let r of e)t.hasField(r.name)||t.addSuggestion(new ke(r.name,r.typeNames.join(" | ")))}function ks(t,e){let[r,n]=Bt(t),i=e.arguments.getDeepSubSelectionValue(r)?.asObject();if(!i)return{parentKind:"unknown",fieldName:n};let o=i.getFieldValue("select")?.asObject(),s=i.getFieldValue("include")?.asObject(),a=i.getFieldValue("omit")?.asObject(),m=o?.getField(n);return o&&m?{parentKind:"select",parent:o,field:m,fieldName:n}:(m=s?.getField(n),s&&m?{parentKind:"include",field:m,parent:s,fieldName:n}:(m=a?.getField(n),a&&m?{parentKind:"omit",field:m,parent:a,fieldName:n}:{parentKind:"unknown",fieldName:n}))}function Ns(t,e){if(e.kind==="object")for(let r of e.fields)t.hasField(r.name)||t.addSuggestion(new ke(r.name,r.typeNames.join(" | ")))}function Bt(t){let e=[...t],r=e.pop();if(!r)throw new Error("unexpected empty path");return[e,r]}function gr({green:t,enabled:e}){return"Available options are "+(e?`listed in ${t("green")}`:"marked with ?")+"."}function rn(t,e){if(e.length===1)return e[0];let r=[...e],n=r.pop();return`${r.join(", ")} ${t} ${n}`}var _c=3;function Fc(t,e){let r=1/0,n;for(let i of e){let o=(0,Rs.default)(t,i);o>_c||o<r&&(r=o,n=i)}return n}u();l();c();p();d();import{isObjectEnumValue as $c}from"@prisma/client-runtime-utils";u();l();c();p();d();var yr=class{modelName;name;typeName;isList;isEnum;constructor(e,r,n,i,o){this.modelName=e,this.name=r,this.typeName=n,this.isList=i,this.isEnum=o}_toGraphQLInputType(){let e=this.isList?"List":"",r=this.isEnum?"Enum":"";return`${e}${r}${this.typeName}FieldRefInput<${this.modelName}>`}};function jt(t){return t instanceof yr}u();l();c();p();d();var Ds=": ",nn=class{constructor(e,r){this.name=e;this.value=r}hasError=!1;markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+Ds.length}write(e){let r=new We(this.name);this.hasError&&r.underline().setColor(e.context.colors.red),e.write(r).write(Ds).write(this.value)}};var pi=class{arguments;errorMessages=[];constructor(e){this.arguments=e}write(e){e.write(this.arguments)}addErrorMessage(e){this.errorMessages.push(e)}renderAllMessages(e){return this.errorMessages.map(r=>r(e)).join(`
6
- `)}};function Qt(t){return new pi(Ms(t))}function Ms(t){let e=new qt;for(let[r,n]of Object.entries(t)){let i=new nn(r,Ls(n));e.addField(i)}return e}function Ls(t){if(typeof t=="string")return new ye(JSON.stringify(t));if(typeof t=="number"||typeof t=="boolean")return new ye(String(t));if(typeof t=="bigint")return new ye(`${t}n`);if(t===null)return new ye("null");if(t===void 0)return new ye("undefined");if(Ft(t))return new ye(`new Prisma.Decimal("${t.toFixed()}")`);if(t instanceof Uint8Array)return w.isBuffer(t)?new ye(`Buffer.alloc(${t.byteLength})`):new ye(`new Uint8Array(${t.byteLength})`);if(t instanceof Date){let e=_t(t)?t.toISOString():"Invalid Date";return new ye(`new Date("${e}")`)}return $c(t)?new ye(`Prisma.${t._getName()}`):jt(t)?new ye(`prisma.${st(t.modelName)}.$fields.${t.name}`):Array.isArray(t)?Uc(t):typeof t=="object"?Ms(t):new ye(Object.prototype.toString.call(t))}function Uc(t){let e=new Vt;for(let r of t)e.addItem(Ls(r));return e}function on(t,e){let r=e==="pretty"?As:tn,n=t.renderAllMessages(r),i=new $t(0,{colors:r}).write(t).toString();return{message:n,args:i}}function sn({args:t,errors:e,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=Qt(t);for(let N of e)Zr(N,a,s);let{message:m,args:y}=on(a,r),E=Xr({message:m,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:y});throw new Vc(E,{clientVersion:o})}u();l();c();p();d();u();l();c();p();d();function Ke(t){return t.replace(/^./,e=>e.toLowerCase())}u();l();c();p();d();function Fs(t,e,r){let n=Ke(r);return!e.result||!(e.result.$allModels||e.result[n])?t:qc({...t,..._s(e.name,t,e.result.$allModels),..._s(e.name,t,e.result[n])})}function qc(t){let e=new ze,r=(n,i)=>e.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),t[n]?t[n].needs.flatMap(o=>r(o,i)):[n]));return Wr(t,n=>({...n,needs:r(n.name,new Set)}))}function _s(t,e,r){return r?Wr(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Bc(e,o,i)})):{}}function Bc(t,e,r){let n=t?.[e]?.compute;return n?(i,o)=>r({...i,[e]:n(i,o)},o):r}function $s(t,e){if(!e)return t;let r={...t};for(let n of Object.values(e))if(t[n.name])for(let i of n.needs)r[i]=!0;return r}function Us(t,e){if(!e)return t;let r={...t};for(let n of Object.values(e))if(!t[n.name])for(let i of n.needs)delete r[i];return r}var an=class{constructor(e,r){this.extension=e;this.previous=r}computedFieldsCache=new ze;modelExtensionsCache=new ze;queryCallbacksCache=new ze;clientExtensions=or(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=or(()=>{let e=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?e.concat(r):e});getAllComputedFields(e){return this.computedFieldsCache.getOrCreate(e,()=>Fs(this.previous?.getAllComputedFields(e),this.extension,e))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(e){return this.modelExtensionsCache.getOrCreate(e,()=>{let r=Ke(e);return!this.extension.model||!(this.extension.model[r]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(e):{...this.previous?.getAllModelExtensions(e),...this.extension.model.$allModels,...this.extension.model[r]}})}getAllQueryCallbacks(e,r){return this.queryCallbacksCache.getOrCreate(`${e}:${r}`,()=>{let n=this.previous?.getAllQueryCallbacks(e,r)??[],i=[],o=this.extension.query;return!o||!(o[e]||o.$allModels||o[r]||o.$allOperations)?n:(o[e]!==void 0&&(o[e][r]!==void 0&&i.push(o[e][r]),o[e].$allOperations!==void 0&&i.push(o[e].$allOperations)),e!=="$none"&&o.$allModels!==void 0&&(o.$allModels[r]!==void 0&&i.push(o.$allModels[r]),o.$allModels.$allOperations!==void 0&&i.push(o.$allModels.$allOperations)),o[r]!==void 0&&i.push(o[r]),o.$allOperations!==void 0&&i.push(o.$allOperations),n.concat(i))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},Jt=class t{constructor(e){this.head=e}static empty(){return new t}static single(e){return new t(new an(e))}isEmpty(){return this.head===void 0}append(e){return new t(new an(e,this.head))}getAllComputedFields(e){return this.head?.getAllComputedFields(e)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(e){return this.head?.getAllModelExtensions(e)}getAllQueryCallbacks(e,r){return this.head?.getAllQueryCallbacks(e,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};u();l();c();p();d();var un=class{constructor(e){this.name=e}};function Vs(t){return t instanceof un}function jc(t){return new un(t)}u();l();c();p();d();u();l();c();p();d();var qs=Symbol(),hr=class{constructor(e){if(e!==qs)throw new Error("Skip instance can not be constructed directly")}ifUndefined(e){return e===void 0?di:e}},di=new hr(qs);function Le(t){return t instanceof hr}var Jc={findUnique:"findUnique",findUniqueOrThrow:"findUniqueOrThrow",findFirst:"findFirst",findFirstOrThrow:"findFirstOrThrow",findMany:"findMany",count:"aggregate",create:"createOne",createMany:"createMany",createManyAndReturn:"createManyAndReturn",update:"updateOne",updateMany:"updateMany",updateManyAndReturn:"updateManyAndReturn",upsert:"upsertOne",delete:"deleteOne",deleteMany:"deleteMany",executeRaw:"executeRaw",queryRaw:"queryRaw",aggregate:"aggregate",groupBy:"groupBy",runCommandRaw:"runCommandRaw",findRaw:"findRaw",aggregateRaw:"aggregateRaw"},Bs="explicitly `undefined` values are not allowed";function fi({modelName:t,action:e,args:r,runtimeDataModel:n,extensions:i=Jt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:m,previewFeatures:y,globalOmit:E,wrapRawValues:N}){let $=new mi({runtimeDataModel:n,modelName:t,action:e,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:m,previewFeatures:y,globalOmit:E,wrapRawValues:N});return{modelName:t,action:Jc[e],query:wr(r,$)}}function wr({select:t,include:e,...r}={},n){let i=r.omit;return delete r.omit,{arguments:Qs(r,n),selection:Gc(t,e,i,n)}}function Gc(t,e,r,n){return t?(e?n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:n.getSelectionPath()}):r&&n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:n.getSelectionPath()}),Kc(t,n)):Hc(n,e,r)}function Hc(t,e,r){let n={};return t.modelOrType&&!t.isRawAction()&&(n.$composites=!0,n.$scalars=!0),e&&zc(n,e,t),Wc(n,r,t),n}function zc(t,e,r){for(let[n,i]of Object.entries(e)){if(Le(i))continue;let o=r.nestSelection(n);if(gi(i,o),i===!1||i===void 0){t[n]=!1;continue}let s=r.findField(n);if(s&&s.kind!=="object"&&r.throwValidationError({kind:"IncludeOnScalar",selectionPath:r.getSelectionPath().concat(n),outputType:r.getOutputTypeDescription()}),s){t[n]=wr(i===!0?{}:i,o);continue}if(i===!0){t[n]=!0;continue}t[n]=wr(i,o)}}function Wc(t,e,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...e},o=Us(i,n);for(let[s,a]of Object.entries(o)){if(Le(a))continue;gi(a,r.nestSelection(s));let m=r.findField(s);n?.[s]&&!m||(t[s]=!a)}}function Kc(t,e){let r={},n=e.getComputedFields(),i=$s(t,n);for(let[o,s]of Object.entries(i)){if(Le(s))continue;let a=e.nestSelection(o);gi(s,a);let m=e.findField(o);if(!(n?.[o]&&!m)){if(s===!1||s===void 0||Le(s)){r[o]=!1;continue}if(s===!0){m?.kind==="object"?r[o]=wr({},a):r[o]=!0;continue}r[o]=wr(s,a)}}return r}function js(t,e){if(t===null)return null;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t;if(typeof t=="bigint")return{$type:"BigInt",value:String(t)};if(Lt(t)){if(_t(t))return{$type:"DateTime",value:t.toISOString()};e.throwValidationError({kind:"InvalidArgumentValue",selectionPath:e.getSelectionPath(),argumentPath:e.getArgumentPath(),argument:{name:e.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(Vs(t))return{$type:"Param",value:t.name};if(jt(t))return{$type:"FieldRef",value:{_ref:t.name,_container:t.modelName}};if(Array.isArray(t))return Xc(t,e);if(ArrayBuffer.isView(t)){let{buffer:r,byteOffset:n,byteLength:i}=t;return{$type:"Bytes",value:w.from(r,n,i).toString("base64")}}if(Zc(t))return t.values;if(Ft(t))return{$type:"Decimal",value:t.toFixed()};if(Qc(t)){let r=t._getName();if(r!=="DbNull"&&r!=="JsonNull"&&r!=="AnyNull")throw new Error(`Invalid ObjectEnumValue: expected DbNull, JsonNull, or AnyNull, got ${r}`);return{$type:"Enum",value:r}}if(Yc(t))return t.toJSON();if(typeof t=="object")return Qs(t,e);e.throwValidationError({kind:"InvalidArgumentValue",selectionPath:e.getSelectionPath(),argumentPath:e.getArgumentPath(),argument:{name:e.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(t)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function Qs(t,e){if(e.shouldWrapRawValues()&&t.$type)return{$type:"Raw",value:t};let r={};for(let n in t){let i=t[n],o=e.nestArgument(n);Le(i)||(i!==void 0?r[n]=js(i,o):e.isPreviewFeatureOn("strictUndefinedChecks")&&e.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:e.getSelectionPath(),argument:{name:e.getArgumentName(),typeNames:[]},underlyingError:Bs}))}return r}function Xc(t,e){let r=[];for(let n=0;n<t.length;n++){let i=e.nestArgument(String(n)),o=t[n];if(o===void 0||Le(o)){let s=o===void 0?"undefined":"Prisma.skip";e.throwValidationError({kind:"InvalidArgumentValue",selectionPath:i.getSelectionPath(),argumentPath:i.getArgumentPath(),argument:{name:`${e.getArgumentName()}[${n}]`,typeNames:[]},underlyingError:`Can not use \`${s}\` value within array. Use \`null\` or filter out \`${s}\` values`})}r.push(js(o,i))}return r}function Zc(t){return typeof t=="object"&&t!==null&&t.__prismaRawParameters__===!0}function Yc(t){return typeof t=="object"&&t!==null&&typeof t.toJSON=="function"}function gi(t,e){t===void 0&&e.isPreviewFeatureOn("strictUndefinedChecks")&&e.throwValidationError({kind:"InvalidSelectionValue",selectionPath:e.getSelectionPath(),underlyingError:Bs})}var mi=class t{constructor(e){this.params=e;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}modelOrType;throwValidationError(e){sn({errors:[e],originalMethod:this.params.originalMethod,args:this.params.rootArgs??{},callsite:this.params.callsite,errorFormat:this.params.errorFormat,clientVersion:this.params.clientVersion,globalOmit:this.params.globalOmit})}getSelectionPath(){return this.params.selectionPath}getArgumentPath(){return this.params.argumentPath}getArgumentName(){return this.params.argumentPath[this.params.argumentPath.length-1]}getOutputTypeDescription(){if(!(!this.params.modelName||!this.modelOrType))return{name:this.params.modelName,fields:this.modelOrType.fields.map(e=>({name:e.name,typeName:"boolean",isRelation:e.kind==="object"}))}}isRawAction(){return["executeRaw","queryRaw","runCommandRaw","findRaw","aggregateRaw"].includes(this.params.action)}isPreviewFeatureOn(e){return this.params.previewFeatures.includes(e)}shouldWrapRawValues(){return this.params.wrapRawValues??!0}getComputedFields(){if(this.params.modelName)return this.params.extensions.getAllComputedFields(this.params.modelName)}findField(e){return this.modelOrType?.fields.find(r=>r.name===e)}nestSelection(e){let r=this.findField(e),n=r?.kind==="object"?r.type:void 0;return new t({...this.params,modelName:n,selectionPath:this.params.selectionPath.concat(e)})}getGlobalOmit(){return this.params.modelName&&this.shouldApplyGlobalOmit()?this.params.globalOmit?.[st(this.params.modelName)]??{}:{}}shouldApplyGlobalOmit(){switch(this.params.action){case"findFirst":case"findFirstOrThrow":case"findUniqueOrThrow":case"findMany":case"upsert":case"findUnique":case"createManyAndReturn":case"create":case"update":case"updateManyAndReturn":case"delete":return!0;case"executeRaw":case"aggregateRaw":case"runCommandRaw":case"findRaw":case"createMany":case"deleteMany":case"groupBy":case"updateMany":case"count":case"aggregate":case"queryRaw":return!1;default:rt(this.params.action,"Unknown action")}}nestArgument(e){return new t({...this.params,argumentPath:this.params.argumentPath.concat(e)})}};u();l();c();p();d();function ep(t,e){let r=or(()=>tp(e));Object.defineProperty(t,"dmmf",{get:()=>r.get()})}function tp(t){throw new Error("Prisma.dmmf is not available when running in edge runtimes.")}function yi(t){return Object.entries(t).map(([e,r])=>({name:e,...r}))}u();l();c();p();d();var hi=new WeakMap,ln="$$PrismaTypedSql",br=class{constructor(e,r){hi.set(this,{sql:e,values:r}),Object.defineProperty(this,ln,{value:ln})}get sql(){return hi.get(this).sql}get values(){return hi.get(this).values}};function rp(t){return(...e)=>new br(t,e)}function cn(t){return t!=null&&t[ln]===ln}u();l();c();p();d();import{Sql as zm}from"@prisma/client-runtime-utils";u();l();c();p();d();Js();u();l();c();p();d();u();l();c();p();d();function xr(t){return{getKeys(){return Object.keys(t)},getPropertyValue(e){return t[e]}}}u();l();c();p();d();function Se(t,e){return{getKeys(){return[t]},getPropertyValue(){return e()}}}u();l();c();p();d();function gt(t){let e=new ze;return{getKeys(){return t.getKeys()},getPropertyValue(r){return e.getOrCreate(r,()=>t.getPropertyValue(r))},getPropertyDescriptor(r){return t.getPropertyDescriptor?.(r)}}}u();l();c();p();d();u();l();c();p();d();var dn={enumerable:!0,configurable:!0,writable:!0};function mn(t){let e=new Set(t);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>dn,has:(r,n)=>e.has(n),set:(r,n,i)=>e.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...e]}}var Gs=Symbol.for("nodejs.util.inspect.custom");function qe(t,e){let r=np(e),n=new Set,i=new Proxy(t,{get(o,s){if(n.has(s))return o[s];let a=r.get(s);return a?a.getPropertyValue(s):o[s]},has(o,s){if(n.has(s))return!0;let a=r.get(s);return a?a.has?.(s)??!0:Reflect.has(o,s)},ownKeys(o){let s=Hs(Reflect.ownKeys(o),r),a=Hs(Array.from(r.keys()),r);return[...new Set([...s,...a,...n])]},set(o,s,a){return r.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(n.add(s),Reflect.set(o,s,a))},getOwnPropertyDescriptor(o,s){let a=Reflect.getOwnPropertyDescriptor(o,s);if(a&&!a.configurable)return a;let m=r.get(s);return m?m.getPropertyDescriptor?{...dn,...m?.getPropertyDescriptor(s)}:dn:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[Gs]=function(){let o={...this};return delete o[Gs],o},i}function np(t){let e=new Map;for(let r of t){let n=r.getKeys();for(let i of n)e.set(i,r)}return e}function Hs(t,e){return t.filter(r=>e.get(r)?.has?.(r)??!0)}u();l();c();p();d();function Gt(t){return{getKeys(){return t},has(){return!1},getPropertyValue(){}}}u();l();c();p();d();function zs(t){if(t===void 0)return"";let e=Qt(t);return new $t(0,{colors:tn}).write(e).toString()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var wi=class{getLocation(){return null}};function ut(t){return typeof $EnabledCallSite=="function"&&t!=="minimal"?new $EnabledCallSite:new wi}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Ws={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function Ht(t={}){let e=op(t);return Object.entries(e).reduce((n,[i,o])=>(Ws[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function op(t={}){return typeof t._count=="boolean"?{...t,_count:{_all:t._count}}:t}function fn(t={}){return e=>(typeof t._count=="boolean"&&(e._count=e._count._all),e)}function Ks(t,e){let r=fn(t);return e({action:"aggregate",unpacker:r,argsMapper:Ht})(t)}u();l();c();p();d();function sp(t={}){let{select:e,...r}=t;return typeof e=="object"?Ht({...r,_count:e}):Ht({...r,_count:{_all:!0}})}function ap(t={}){return typeof t.select=="object"?e=>fn(t)(e)._count:e=>fn(t)(e)._count._all}function Xs(t,e){return e({action:"count",unpacker:ap(t),argsMapper:sp})(t)}u();l();c();p();d();function up(t={}){let e=Ht(t);if(Array.isArray(e.by))for(let r of e.by)typeof r=="string"&&(e.select[r]=!0);else typeof e.by=="string"&&(e.select[e.by]=!0);return e}function lp(t={}){return e=>(typeof t?._count=="boolean"&&e.forEach(r=>{r._count=r._count._all}),e)}function Zs(t,e){return e({action:"groupBy",unpacker:lp(t),argsMapper:up})(t)}function Ys(t,e,r){if(e==="aggregate")return n=>Ks(n,r);if(e==="count")return n=>Xs(n,r);if(e==="groupBy")return n=>Zs(n,r)}u();l();c();p();d();function ea(t,e){let r=e.fields.filter(i=>!i.relationName),n=Qo(r,"name");return new Proxy({},{get(i,o){if(o in i||typeof o=="symbol")return i[o];let s=n[o];if(s)return new yr(t,o,s.type,s.isList,s.kind==="enum")},...mn(Object.keys(n))})}u();l();c();p();d();u();l();c();p();d();var ta=t=>Array.isArray(t)?t:t.split("."),bi=(t,e)=>ta(e).reduce((r,n)=>r&&r[n],t),ra=(t,e,r)=>ta(e).reduceRight((n,i,o,s)=>Object.assign({},bi(t,s.slice(0,o)),{[i]:n}),r);function cp(t,e){return t===void 0||e===void 0?[]:[...e,"select",t]}function pp(t,e,r){return e===void 0?t??{}:ra(e,r,t||!0)}function xi(t,e,r,n,i,o){let s=t._runtimeDataModel.models[e],a;return m=>{let y=ut(t._errorFormat),E=cp(n,i),N=pp(m,o,E),$=r({dataPath:E,callsite:y})(N),U=dp(t,e);return new Proxy($,{get(B,q){if(!U.includes(q))return B[q];a??=Object.fromEntries(s.fields.map(z=>[z.name,z]));let X=[a[q].type,r,q],_=[E,N];return xi(t,...X,..._)},...mn([...U,...Object.getOwnPropertyNames($)])})}}function dp(t,e){return t._runtimeDataModel.models[e].fields.filter(r=>r.kind==="object").map(r=>r.name)}var mp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],fp=["aggregate","count","groupBy"];function Ei(t,e){let r=t._extensions.getAllModelExtensions(e)??{},n=[gp(t,e),hp(t,e),xr(r),Se("name",()=>e),Se("$name",()=>e),Se("$parent",()=>t._appliedParent)];return qe({},n)}function gp(t,e){let r=Ke(e),n=Object.keys(mr).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>m=>{let y=ut(t._errorFormat);return t._createPrismaPromise(E=>{let N={args:m,dataPath:[],action:o,model:e,clientMethod:`${r}.${i}`,jsModelName:r,transaction:E,callsite:y};return t._request({...N,...a})},{action:o,args:m,model:e})};return mp.includes(o)?xi(t,e,s):yp(i)?Ys(t,i,s):s({})}}}function yp(t){return fp.includes(t)}function hp(t,e){return gt(Se("fields",()=>{let r=t._runtimeDataModel.models[e];return ea(e,r)}))}u();l();c();p();d();function na(t){return t.replace(/^./,e=>e.toUpperCase())}var Pi=Symbol();function Er(t){let e=[wp(t),bp(t),Se(Pi,()=>t),Se("$parent",()=>t._appliedParent)],r=t._extensions.getAllClientExtensions();return r&&e.push(xr(r)),qe(t,e)}function wp(t){let e=Object.getPrototypeOf(t._originalClient),r=[...new Set(Object.getOwnPropertyNames(e))];return{getKeys(){return r},getPropertyValue(n){return t[n]}}}function bp(t){let e=Object.keys(t._runtimeDataModel.models),r=e.map(Ke),n=[...new Set(e.concat(r))];return gt({getKeys(){return n},getPropertyValue(i){let o=na(i);if(t._runtimeDataModel.models[o]!==void 0)return Ei(t,o);if(t._runtimeDataModel.models[i]!==void 0)return Ei(t,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function ia(t){return t[Pi]?t[Pi]:t}function oa(t){if(typeof t=="function")return t(this);let e=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(t)},_appliedParent:{value:this,configurable:!0},$on:{value:void 0}});return Er(e)}u();l();c();p();d();u();l();c();p();d();function sa({result:t,modelName:e,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(e);if(!o)return t;let s=[],a=[];for(let m of Object.values(o)){if(n){if(n[m.name])continue;let y=m.needs.filter(E=>n[E]);y.length>0&&a.push(Gt(y))}else if(r){if(!r[m.name])continue;let y=m.needs.filter(E=>!r[E]);y.length>0&&a.push(Gt(y))}xp(t,m.needs)&&s.push(Ep(m,qe(t,s),e))}return s.length>0||a.length>0?qe(t,[...s,...a]):t}function xp(t,e){return e.every(r=>ai(t,r))}function Ep(t,e,r){return gt(Se(t.name,()=>t.compute(e,r)))}u();l();c();p();d();function gn({visitor:t,result:e,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(e)){for(let s=0;s<e.length;s++)e[s]=gn({result:e[s],args:r,modelName:i,runtimeDataModel:n,visitor:t});return e}let o=t(e,i,r)??e;return r.include&&aa({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:t}),r.select&&aa({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:t}),o}function aa({includeOrSelect:t,result:e,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(t)){if(!s||e[o]==null||Le(s))continue;let m=n.models[r].fields.find(E=>E.name===o);if(!m||m.kind!=="object"||!m.relationName)continue;let y=typeof s=="object"?s:{};e[o]=gn({visitor:i,result:e[o],args:y,modelName:m.type,runtimeDataModel:n})}}function ua({result:t,modelName:e,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||t==null||typeof t!="object"||!i.models[e]?t:gn({result:t,args:r??{},modelName:e,runtimeDataModel:i,visitor:(a,m,y)=>{let E=Ke(m);return sa({result:a,modelName:E,select:y.select,omit:y.select?void 0:{...o?.[E],...y.omit},extensions:n})}})}u();l();c();p();d();u();l();c();p();d();import{Decimal as Tp,isObjectEnumValue as vp,Sql as ca}from"@prisma/client-runtime-utils";u();l();c();p();d();var Pp=["$connect","$disconnect","$on","$use","$extends"],la=Pp;function pa(t){if(t instanceof ca)return Sp(t);if(cn(t))return Ap(t);if(Array.isArray(t)){let r=[t[0]];for(let n=1;n<t.length;n++)r[n]=Pr(t[n]);return r}let e={};for(let r in t)e[r]=Pr(t[r]);return e}function Sp(t){return new ca(t.strings,t.values)}function Ap(t){return new br(t.sql,t.values)}function Pr(t){if(typeof t!="object"||t==null||vp(t)||jt(t)||Le(t))return t;if(Ft(t))return new Tp(t.toFixed());if(Lt(t))return new Date(+t);if(ArrayBuffer.isView(t))return t.slice(0);if(Array.isArray(t)){let e=t.length,r;for(r=Array(e);e--;)r[e]=Pr(t[e]);return r}if(typeof t=="object"){let e={};for(let r in t)r==="__proto__"?Object.defineProperty(e,r,{value:Pr(t[r]),configurable:!0,enumerable:!0,writable:!0}):e[r]=Pr(t[r]);return e}rt(t,"Unknown value")}function ma(t,e,r,n=0){return t._createPrismaPromise(i=>{let o=e.customDataProxyFetch;return"transaction"in e&&i!==void 0&&(e.transaction?.kind==="batch"&&e.transaction.lock.then(),e.transaction=i),n===r.length?t._executeRequest(e):r[n]({model:e.model,operation:e.model?e.action:e.clientMethod,args:pa(e.args??{}),__internalParams:e,query:(s,a=e)=>{let m=a.customDataProxyFetch;return a.customDataProxyFetch=ha(o,m),a.args=s,ma(t,a,r,n+1)}})})}function fa(t,e){let{jsModelName:r,action:n,clientMethod:i}=e,o=r?n:i;if(t._extensions.isEmpty())return t._executeRequest(e);let s=t._extensions.getAllQueryCallbacks(r??"$none",o);return ma(t,e,s)}function ga(t){return e=>{let r={requests:e},n=e[0].extensions.getAllBatchQueryCallbacks();return n.length?ya(r,n,0,t):t(r)}}function ya(t,e,r,n){if(r===e.length)return n(t);let i=t.customDataProxyFetch,o=t.requests[0].transaction;return e[r]({args:{queries:t.requests.map(s=>({model:s.modelName,operation:s.action,args:s.args})),transaction:o?{isolationLevel:o.kind==="batch"?o.isolationLevel:void 0}:void 0},__internalParams:t,query(s,a=t){let m=a.customDataProxyFetch;return a.customDataProxyFetch=ha(i,m),ya(a,e,r+1,n)}})}var da=t=>t;function ha(t=da,e=da){return r=>t(e(r))}u();l();c();p();d();function ba({dataPath:t,modelName:e,args:r,runtimeDataModel:n}){let i={modelName:e,args:r??{}},o=Rp(t);if(!o||o.length===0)return i;let s=e,a=r??{};for(let m of o){let y=n.models[s];if(!y)return i;let E=y.fields.find(N=>N.name===m);if(!E)throw new Error(`Could not resolve relation field "${m}" on model "${s}" from dataPath "${t.join(".")}"`);if(E.kind!=="object"||!E.relationName)return i;s=E.type,a=Cp(a,m)}return{modelName:s,args:a}}function Rp(t){let e=[];for(let r=0;r<t.length;r+=2){let n=t[r],i=t[r+1];if(n!=="select"&&n!=="include"||i===void 0)return;e.push(i)}return e}function Cp(t,e){let r=t.select?.[e];if(wa(r))return r;let n=t.include?.[e];return wa(n)?n:{}}function wa(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();import{Decimal as Ip}from"@prisma/client-runtime-utils";u();l();c();p();d();import{Decimal as yn}from"@prisma/client-runtime-utils";function zt(t){return ArrayBuffer.isView(t)&&Object.prototype.toString.call(t)==="[object Uint8Array]"}function Tr(t){return Object.prototype.toString.call(t)==="[object Date]"}function Z(t,e){throw new Error(e)}function vi(t,e){return t===e||t!==null&&e!==null&&typeof t=="object"&&typeof e=="object"&&Object.keys(t).length===Object.keys(e).length&&Object.keys(t).every(r=>vi(t[r],e[r]))}function Wt(t,e){let r=Object.keys(t),n=Object.keys(e);return(r.length<n.length?r:n).every(o=>{if(typeof t[o]==typeof e[o]&&typeof t[o]!="object")return t[o]===e[o];if(yn.isDecimal(t[o])||yn.isDecimal(e[o])){let s=xa(t[o]),a=xa(e[o]);return s&&a&&s.equals(a)}else if(zt(t[o])||zt(e[o])){let s=Ea(t[o]),a=Ea(e[o]);return s&&a&&s.equals(a)}else{if(Tr(t[o])||Tr(e[o]))return Pa(t[o])?.getTime()===Pa(e[o])?.getTime();if(typeof t[o]=="bigint"||typeof e[o]=="bigint")return Ta(t[o])===Ta(e[o]);if(typeof t[o]=="number"||typeof e[o]=="number")return va(t[o])===va(e[o])}return vi(t[o],e[o])})}function xa(t){return yn.isDecimal(t)?t:typeof t=="number"||typeof t=="string"?new yn(t):void 0}function Ea(t){return w.isBuffer(t)?t:zt(t)?w.from(t.buffer,t.byteOffset,t.byteLength):typeof t=="string"?w.from(t,"base64"):void 0}function Pa(t){return Tr(t)?t:typeof t=="string"||typeof t=="number"?new Date(t):void 0}function Ta(t){return typeof t=="bigint"?t:typeof t=="number"||typeof t=="string"?BigInt(t):void 0}function va(t){return typeof t=="number"?t:typeof t=="string"?Number(t):void 0}function Be(t){return JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString():ArrayBuffer.isView(r)?w.from(r.buffer,r.byteOffset,r.byteLength).toString("base64"):r)}var Ti=8192;function hn(t,e){if(e.length<=Ti){t.push(...e);return}for(let r=0;r<e.length;r+=Ti)t.push(...e.slice(r,r+Ti))}function Op(t){return t!==null&&typeof t=="object"&&typeof t.$type=="string"}function kp(t,e){let r={};for(let n of Object.keys(t))r[n]=e(t[n],n);return r}function Xe(t){return t===null?t:Array.isArray(t)?t.map(Xe):typeof t=="object"?Op(t)?Np(t):t.constructor!==null&&t.constructor.name!=="Object"?t:kp(t,Xe):t}function Np({$type:t,value:e}){switch(t){case"BigInt":return BigInt(e);case"Bytes":return new Uint8Array(w.from(e,"base64"));case"DateTime":return new Date(e);case"Decimal":return new Ip(e);case"Json":return JSON.parse(e);case"Raw":return e;case"FieldRef":throw new Error("FieldRef tagged values cannot be deserialized to JavaScript values");case"Enum":return e;default:Z(e,"Unknown tagged value")}}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function wn(t){return t.name==="DriverAdapterError"&&typeof t.cause=="object"}u();l();c();p();d();var G={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 he=class extends Error{name="UserFacingError";code;meta;constructor(e,r,n){super(e),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 lt(t){if(!wn(t))throw t;let e=_p(t),r=Aa(t);throw e!==void 0&&r!==void 0?new he(r,e,{driverAdapterError:t}):Lp(t.cause.kind)?Mp(t):t}function Ai(t){throw wn(t)?Dp(t):t}function Dp(t){let e=t.cause.originalCode??"N/A",r=Sa(t);return new he(`Raw query failed. Code: \`${e}\`. Message: \`${r}\``,"P2010",{driverAdapterError:t})}function Mp(t){let e=t.cause.originalCode??"N/A",r=Sa(t);return new he(`Database error. Code: \`${e}\`. Message: \`${r}\``,"P2039",{driverAdapterError:t})}function Sa(t){return t.cause.originalMessage??Aa(t)??t.message??"N/A"}function Lp(t){switch(t){case"postgres":case"mysql":case"sqlite":case"mssql":return!0;default:return!1}}function _p(t){switch(t.cause.kind){case"AuthenticationFailed":return"P1000";case"DatabaseNotReachable":return"P1001";case"DatabaseDoesNotExist":return"P1003";case"SocketTimeout":return"P1008";case"DatabaseAlreadyExists":return"P1009";case"DatabaseAccessDenied":return"P1010";case"TlsConnectionError":return"P1011";case"ConnectionClosed":return"P1017";case"TransactionAlreadyClosed":return"P1018";case"LengthMismatch":return"P2000";case"UniqueConstraintViolation":return"P2002";case"ForeignKeyConstraintViolation":case"RestrictViolation":return"P2003";case"InvalidInputValue":return"P2007";case"UnsupportedNativeDataType":return"P2010";case"NullConstraintViolation":return"P2011";case"ValueOutOfRange":return"P2020";case"TableDoesNotExist":return"P2021";case"ColumnNotFound":return"P2022";case"InvalidIsolationLevel":case"InconsistentColumnData":return"P2023";case"MissingFullTextSearchIndex":return"P2030";case"TransactionWriteConflict":return"P2034";case"GenericJs":return"P2036";case"TooManyConnections":return"P2037";case"postgres":case"sqlite":case"mysql":case"mssql":return;default:Z(t.cause,`Unknown error: ${Be(t.cause)}`)}}function Aa(t){switch(t.cause.kind){case"AuthenticationFailed":return`Authentication failed against the database server, the provided database credentials for \`${t.cause.user??"(not available)"}\` are not valid`;case"DatabaseNotReachable":{let e=t.cause.host&&t.cause.port?`${t.cause.host}:${t.cause.port}`:t.cause.host;return`Can't reach database server${e?` at ${e}`:""}`}case"DatabaseDoesNotExist":return`Database \`${t.cause.db??"(not available)"}\` does not exist on the database server`;case"SocketTimeout":return"Operation has timed out";case"DatabaseAlreadyExists":return`Database \`${t.cause.db??"(not available)"}\` already exists on the database server`;case"DatabaseAccessDenied":return`User was denied access on the database \`${t.cause.db??"(not available)"}\``;case"TlsConnectionError":return`Error opening a TLS connection: ${t.cause.reason}`;case"ConnectionClosed":return"Server has closed the connection.";case"TransactionAlreadyClosed":return t.cause.cause;case"LengthMismatch":return`The provided value for the column is too long for the column's type. Column: ${t.cause.column??"(not available)"}`;case"UniqueConstraintViolation":return`Unique constraint failed on the ${Si(t.cause.constraint)}`;case"ForeignKeyConstraintViolation":case"RestrictViolation":return`Foreign key constraint violated on the ${Si(t.cause.constraint)}`;case"UnsupportedNativeDataType":return`Failed to deserialize column of type '${t.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 ${Si(t.cause.constraint)}`;case"ValueOutOfRange":return`Value out of range for the type: ${t.cause.cause}`;case"TableDoesNotExist":return`The table \`${t.cause.table??"(not available)"}\` does not exist in the current database.`;case"ColumnNotFound":return`The column \`${t.cause.column??"(not available)"}\` does not exist in the current database.`;case"InvalidIsolationLevel":return`Error in connector: Conversion error: ${t.cause.level}`;case"InconsistentColumnData":return`Inconsistent column data: ${t.cause.cause}`;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 ${t.cause.id})`;case"TooManyConnections":return`Too many database connections opened: ${t.cause.cause}`;case"InvalidInputValue":return`Invalid input value: ${t.cause.message}`;case"sqlite":case"postgres":case"mysql":case"mssql":return;default:Z(t.cause,`Unknown error: ${Be(t.cause)}`)}}function Si(t){return t&&"fields"in t?`fields: (${t.fields.map(e=>`\`${e}\``).join(", ")})`:t&&"index"in t?`constraint: \`${t.index}\``:t&&"foreignKey"in t?"foreign key":"(not available)"}function Fp(t){if(typeof t!="object"||t===null)return!1;let e=t;return"$type"in e&&e.$type==="Param"||"prisma__type"in e&&e.prisma__type==="param"}function $p(t){return"prisma__type"in t?t.prisma__value?.name:t.value.name}function Up(t,e){let r={};for(let[n,i]of Object.entries(t))if(r[n]=i,Fp(i)){let o=$p(i);o&&o in e&&(r[n]=e[o])}return r}function Ra(t,e,r={}){let n=t.map(o=>e.keys.reduce((s,a)=>(s[a]=Xe(o[a]),s),{})),i=new Set(e.nestedSelection);return e.arguments.map(o=>{let s=Up(o,r),a=n.findIndex(m=>Wt(m,s));if(a===-1)return e.expectNonEmpty?new he("An operation failed because it depends on one or more records that were required but not found","P2025"):null;{let m=Object.entries(t[a]).filter(([y])=>i.has(y));return Object.fromEntries(m)}})}u();l();c();p();d();import{Decimal as Vp}from"@prisma/client-runtime-utils";var ie=class extends he{name="DataMapperError";constructor(e,r){super(e,"P2023",r)}},Ca=new WeakMap;function qp(t){let e=Ca.get(t);return e||(e=Object.entries(t),Ca.set(t,e)),e}function Ci(t,e,r){switch(e.type){case"affectedRows":if(typeof t!="number")throw new ie(`Expected an affected rows count, got: ${typeof t} (${t})`);return{count:t};case"object":return Ii(t,e.fields,r,e.skipNulls);case"field":return Ri(t,"<result>",e.fieldType,r);default:Z(e,`Invalid data mapping type: '${e.type}'`)}}function Ii(t,e,r,n){if(t===null)return null;if(Array.isArray(t)){let i=t;return n&&(i=i.filter(o=>o!==null)),i.map(o=>Ia(o,e,r))}if(typeof t=="object")return Ia(t,e,r);if(typeof t=="string"){let i;try{i=JSON.parse(t)}catch(o){throw new ie("Expected an array or object, got a string that is not valid JSON",{cause:o})}return Ii(i,e,r,n)}throw new ie(`Expected an array or an object, got: ${typeof t}`)}function Ia(t,e,r){if(typeof t!="object")throw new ie(`Expected an object, but got '${typeof t}'`);let n={};for(let[i,o]of qp(e))switch(o.type){case"affectedRows":throw new ie(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"object":{let{serializedName:s,fields:a,skipNulls:m}=o;if(s!==null&&!Object.hasOwn(t,s))throw new ie(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(t)}`);let y=s!==null?t[s]:t;n[i]=Ii(y,a,r,m);break}case"field":{let s=o.dbName;if(Object.hasOwn(t,s))n[i]=Bp(t[s],s,o.fieldType,r);else throw new ie(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(t)}`)}break;default:Z(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function Bp(t,e,r,n){return t===null?r.arity==="list"?[]:null:r.arity==="list"?t.map((o,s)=>Ri(o,`${e}[${s}]`,r,n)):Ri(t,e,r,n)}function Ri(t,e,r,n){switch(r.type){case"unsupported":return t;case"string":{if(typeof t!="string")throw new ie(`Expected a string in column '${e}', got ${typeof t}: ${t}`);return t}case"int":switch(typeof t){case"number":return Math.trunc(t);case"string":{let i=Math.trunc(Number(t));if(Number.isNaN(i)||!Number.isFinite(i))throw new ie(`Expected an integer in column '${e}', got string: ${t}`);if(!Number.isSafeInteger(i))throw new ie(`Integer value in column '${e}' is too large to represent as a JavaScript number without loss of precision, got: ${t}. Consider using BigInt type.`);return i}default:throw new ie(`Expected an integer in column '${e}', got ${typeof t}: ${t}`)}case"bigint":{if(typeof t!="number"&&typeof t!="string")throw new ie(`Expected a bigint in column '${e}', got ${typeof t}: ${t}`);return{$type:"BigInt",value:t}}case"float":{if(typeof t=="number")return t;if(typeof t=="string"){let i=Number(t);if(Number.isNaN(i)&&!/^[-+]?nan$/.test(t.toLowerCase()))throw new ie(`Expected a float in column '${e}', got string: ${t}`);return i}throw new ie(`Expected a float in column '${e}', got ${typeof t}: ${t}`)}case"boolean":{if(typeof t=="boolean")return t;if(typeof t=="number")return t===1;if(typeof t=="string"){if(t==="true"||t==="TRUE"||t==="1")return!0;if(t==="false"||t==="FALSE"||t==="0")return!1;throw new ie(`Expected a boolean in column '${e}', got ${typeof t}: ${t}`)}if(Array.isArray(t)||zt(t)){for(let i of t)if(i!==0)return!0;return!1}throw new ie(`Expected a boolean in column '${e}', got ${typeof t}: ${t}`)}case"decimal":if(typeof t!="number"&&typeof t!="string"&&!Vp.isDecimal(t))throw new ie(`Expected a decimal in column '${e}', got ${typeof t}: ${t}`);return{$type:"Decimal",value:t};case"datetime":{if(typeof t=="string")return{$type:"DateTime",value:Qp(t)};if(typeof t=="number"||Tr(t))return{$type:"DateTime",value:t};throw new ie(`Expected a date in column '${e}', got ${typeof t}: ${t}`)}case"object":return{$type:"Json",value:Be(t)};case"json":return{$type:"Json",value:`${t}`};case"bytes":{switch(r.encoding){case"base64":if(typeof t!="string")throw new ie(`Expected a base64-encoded byte array in column '${e}', got ${typeof t}: ${t}`);return{$type:"Bytes",value:t};case"hex":if(typeof t!="string"||!t.startsWith("\\x"))throw new ie(`Expected a hex-encoded byte array in column '${e}', got ${typeof t}: ${t}`);return{$type:"Bytes",value:w.from(t.slice(2),"hex").toString("base64")};case"array":if(Array.isArray(t))return{$type:"Bytes",value:w.from(t).toString("base64")};if(zt(t))return{$type:"Bytes",value:w.from(t).toString("base64")};throw new ie(`Expected a byte array in column '${e}', got ${typeof t}: ${t}`);default:Z(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new ie(`Unknown enum '${r.name}'`);let o=i[`${t}`];if(o===void 0)throw new ie(`Value '${t}' not found in enum '${r.name}'`);return o}default:Z(r,`DataMapper: Unknown result type: ${r.type}`)}}var jp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function Qp(t){let e=jp.exec(t);if(e===null)return`${t}T00:00:00Z`;let r=t,[n,i,o]=e;if(i!==void 0&&i!=="Z"&&o===void 0?r=`${t}:00`:i===void 0&&(r=`${t}Z`),n.length===t.length)return`1970-01-01T${r}`;let s=e.index-1;return r[s]===" "&&(r=`${r.slice(0,s)}T${r.slice(s+1)}`),r}u();l();c();p();d();u();l();c();p();d();function _e(t){if(typeof t!="object")return t;var e,r,n=Object.prototype.toString.call(t);if(n==="[object Object]"){if(t.constructor!==Object&&typeof t.constructor=="function"){r=new t.constructor;for(e in t)t.hasOwnProperty(e)&&r[e]!==t[e]&&(r[e]=_e(t[e]))}else{r={};for(e in t)e==="__proto__"?Object.defineProperty(r,e,{value:_e(t[e]),configurable:!0,enumerable:!0,writable:!0}):r[e]=_e(t[e])}return r}if(n==="[object Array]"){for(e=t.length,r=Array(e);e--;)r[e]=_e(t[e]);return r}return n==="[object Set]"?(r=new Set,t.forEach(function(i){r.add(_e(i))}),r):n==="[object Map]"?(r=new Map,t.forEach(function(i,o){r.set(_e(o),_e(i))}),r):n==="[object Date]"?new Date(+t):n==="[object RegExp]"?(r=new RegExp(t.source,t.flags),r.lastIndex=t.lastIndex,r):n==="[object DataView]"?new t.constructor(_e(t.buffer)):n==="[object ArrayBuffer]"?t.slice(0):n.slice(-6)==="Array]"?new t.constructor(t):t}u();l();c();p();d();function Jp(t){let e=Object.entries(t);return e.length===0?"":(e.sort(([n],[i])=>n.localeCompare(i)),`/*${e.map(([n,i])=>{let o=encodeURIComponent(n),s=encodeURIComponent(i).replace(/'/g,"\\'");return`${o}='${s}'`}).join(",")}*/`)}function bn(t,e){let r={};for(let n of t){let i=n(_e(e));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function Oa(t,e){let r=bn(t,e);return Jp(r)}function ka(t,e){return e?`${t} ${e}`:t}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var vr;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(vr||(vr={}));function Gp(t){switch(t){case"postgresql":case"postgres":case"prisma+postgres":return"postgresql";case"sqlserver":return"mssql";case"mysql":case"sqlite":case"cockroachdb":case"mongodb":return t;default:Z(t,`Unknown provider: ${t}`)}}async function xn({query:t,tracingHelper:e,provider:r,onQuery:n,execute:i}){let o=n===void 0?i:async()=>{let s=new Date,a=T.now(),m=await i(),y=T.now();return n({timestamp:s,duration:y-a,query:t.sql,params:t.args}),m};return e.isEnabled()?await e.runInChildSpan({name:"db_query",kind:vr.CLIENT,attributes:{"db.query.text":t.sql,"db.system.name":Gp(r)}},o):o()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function yt(t,e){var r="000000000"+t;return r.substr(r.length-e)}var Na=It(us(),1);function Hp(){try{return Na.default.hostname()}catch{return b.env._CLUSTER_NETWORK_NAME_||b.env.COMPUTERNAME||"hostname"}}var Da=2,zp=yt(b.pid.toString(36),Da),Ma=Hp(),Wp=Ma.length,Kp=yt(Ma.split("").reduce(function(t,e){return+t+e.charCodeAt(0)},+Wp+36).toString(36),Da);function Oi(){return zp+Kp}u();l();c();p();d();u();l();c();p();d();function En(t){return typeof t=="string"&&/^c[a-z0-9]{20,32}$/.test(t)}function ki(t){let n=Math.pow(36,4),i=0;function o(){return yt((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var m="c",y=new Date().getTime().toString(36),E=yt(s().toString(36),4),N=t(),$=o()+o();return m+y+E+N+$}return a.fingerprint=t,a.isCuid=En,a}var Xp=ki(Oi);var La=Xp;u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Pn=BigInt(4294967295),_a=BigInt(32);function Zp(t,e=!1){return e?{h:Number(t&Pn),l:Number(t>>_a&Pn)}:{h:Number(t>>_a&Pn)|0,l:Number(t&Pn)|0}}function Fa(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:s,l:a}=Zp(t[o],e);[n[o],i[o]]=[s,a]}return[n,i]}var $a=(t,e,r)=>t<<r|e>>>32-r,Ua=(t,e,r)=>e<<r|t>>>32-r,Va=(t,e,r)=>e<<r-32|t>>>64-r,qa=(t,e,r)=>t<<r-32|e>>>64-r;u();l();c();p();d();function Yp(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Tn(t,e=""){if(typeof t!="number"){let r=e&&`"${e}" `;throw new TypeError(`${r}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){let r=e&&`"${e}" `;throw new RangeError(`${r}expected integer >= 0, got ${t}`)}}function vn(t,e,r=""){let n=Yp(t),i=t?.length,o=e!==void 0;if(!n||o&&i!==e){let s=r&&`"${r}" `,a=o?` of length ${e}`:"",m=n?`length=${i}`:`type=${typeof t}`,y=s+"expected Uint8Array"+a+", got "+m;throw n?new RangeError(y):new TypeError(y)}return t}function Ni(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Ba(t,e){vn(t,void 0,"digestInto() output");let r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function ja(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Di(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}var ed=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function td(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function rd(t){for(let e=0;e<t.length;e++)t[e]=td(t[e]);return t}var Mi=ed?t=>t:rd;function Qa(t,e={}){let r=(i,o)=>t(o).update(i).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=i=>t(i),Object.assign(r,e),Object.freeze(r)}var Ja=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});var nd=BigInt(0),Sr=BigInt(1),id=BigInt(2),od=BigInt(7),sd=BigInt(256),ad=BigInt(113),za=[],Wa=[],Ka=[];for(let t=0,e=Sr,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],za.push(2*(5*n+r)),Wa.push((t+1)*(t+2)/2%64);let i=nd;for(let o=0;o<7;o++)e=(e<<Sr^(e>>od)*ad)%sd,e&id&&(i^=Sr<<(Sr<<BigInt(o))-Sr);Ka.push(i)}var Xa=Fa(Ka,!0),ud=Xa[0],ld=Xa[1],Ga=(t,e,r)=>r>32?Va(t,e,r):$a(t,e,r),Ha=(t,e,r)=>r>32?qa(t,e,r):Ua(t,e,r);function cd(t,e=24){if(Tn(e,"rounds"),e<1||e>24)throw new Error('"rounds" expected integer 1..24');let r=new Uint32Array(5*2);for(let n=24-e;n<24;n++){for(let s=0;s<10;s++)r[s]=t[s]^t[s+10]^t[s+20]^t[s+30]^t[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,m=(s+2)%10,y=r[m],E=r[m+1],N=Ga(y,E,1)^r[a],$=Ha(y,E,1)^r[a+1];for(let U=0;U<50;U+=10)t[s+U]^=N,t[s+U+1]^=$}let i=t[2],o=t[3];for(let s=0;s<24;s++){let a=Wa[s],m=Ga(i,o,a),y=Ha(i,o,a),E=za[s];i=t[E],o=t[E+1],t[E]=m,t[E+1]=y}for(let s=0;s<50;s+=10){let a=t[s],m=t[s+1],y=t[s+2],E=t[s+3];t[s]^=~t[s+2]&t[s+4],t[s+1]^=~t[s+3]&t[s+5],t[s+2]^=~t[s+4]&t[s+6],t[s+3]^=~t[s+5]&t[s+7],t[s+4]^=~t[s+6]&t[s+8],t[s+5]^=~t[s+7]&t[s+9],t[s+6]^=~t[s+8]&a,t[s+7]^=~t[s+9]&m,t[s+8]^=~a&y,t[s+9]^=~m&E}t[0]^=ud[n],t[1]^=ld[n]}Di(r)}var Li=class t{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;canXOF;enableXOF=!1;rounds;constructor(e,r,n,i=!1,o=24){if(this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.canXOF=i,this.rounds=o,Tn(n,"outputLen"),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ja(this.state)}clone(){return this._cloneInto()}keccak(){Mi(this.state32),cd(this.state32,this.rounds),Mi(this.state32),this.posOut=0,this.pos=0}update(e){Ni(this),vn(e);let{blockLen:r,state:n}=this,i=e.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++]^=e[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){Ni(this,!1),vn(e),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,o=e.length;i<o;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);e.set(r.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Tn(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ba(e,this),this.finished)throw new Error("digest() was already called");this.writeInto(e.subarray(0,this.outputLen)),this.destroy()}digest(){let e=new Uint8Array(this.outputLen);return this.digestInto(e),e}destroy(){this.destroyed=!0,Di(this.state)}_cloneInto(e){let{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return e||=new t(r,n,i,s,o),e.blockLen=r,e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=i,e.enableXOF=s,e.canXOF=this.canXOF,e.destroyed=this.destroyed,e}},pd=(t,e,r,n={})=>Qa(()=>new Li(e,t,r),n);var Za=pd(6,72,64,Ja(10));u();l();c();p();d();var dd=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,_i=Math.ceil,$e=Math.floor,Ce="[BigNumber Error] ",Ya=Ce+"Number primitive has more than 15 significant digits: ",je=1e14,H=14,Fi=9007199254740991,$i=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ct=1e7,we=1e9;function eu(t){var e,r,n,i=_.prototype={constructor:_,toString:null,valueOf:null},o=new _(1),s=20,a=4,m=-7,y=21,E=-1e7,N=1e7,$=!1,U=1,B=0,q={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},J="0123456789abcdefghijklmnopqrstuvwxyz",X=!0;function _(f,g){var h,O,P,k,L,R,I,M,D=this;if(!(D instanceof _))return new _(f,g);if(g==null){if(f&&f._isBigNumber===!0){D.s=f.s,!f.c||f.e>N?D.c=D.e=null:f.e<E?D.c=[D.e=0]:(D.e=f.e,D.c=f.c.slice());return}if((R=typeof f=="number")&&f*0==0){if(D.s=1/f<0?(f=-f,-1):1,f===~~f){for(k=0,L=f;L>=10;L/=10,k++);k>N?D.c=D.e=null:(D.e=k,D.c=[f]);return}M=String(f)}else{if(!dd.test(M=String(f)))return n(D,M,R);D.s=M.charCodeAt(0)==45?(M=M.slice(1),-1):1}(k=M.indexOf("."))>-1&&(M=M.replace(".","")),(L=M.search(/e/i))>0?(k<0&&(k=L),k+=+M.slice(L+1),M=M.substring(0,L)):k<0&&(k=M.length)}else{if(se(g,2,J.length,"Base"),g==10&&X)return D=new _(f),Pe(D,s+D.e+1,a);if(M=String(f),R=typeof f=="number"){if(f*0!=0)return n(D,M,R,g);if(D.s=1/f<0?(M=M.slice(1),-1):1,_.DEBUG&&M.replace(/^0\.0*|\./,"").length>15)throw Error(Ya+f)}else D.s=M.charCodeAt(0)===45?(M=M.slice(1),-1):1;for(h=J.slice(0,g),k=L=0,I=M.length;L<I;L++)if(h.indexOf(O=M.charAt(L))<0){if(O=="."){if(L>k){k=I;continue}}else if(!P&&(M==M.toUpperCase()&&(M=M.toLowerCase())||M==M.toLowerCase()&&(M=M.toUpperCase()))){P=!0,L=-1,k=0;continue}return n(D,String(f),R,g)}R=!1,M=r(M,g,10,D.s),(k=M.indexOf("."))>-1?M=M.replace(".",""):k=M.length}for(L=0;M.charCodeAt(L)===48;L++);for(I=M.length;M.charCodeAt(--I)===48;);if(M=M.slice(L,++I)){if(I-=L,R&&_.DEBUG&&I>15&&(f>Fi||f!==$e(f)))throw Error(Ya+D.s*f);if((k=k-L-1)>N)D.c=D.e=null;else if(k<E)D.c=[D.e=0];else{if(D.e=k,D.c=[],L=(k+1)%H,k<0&&(L+=H),L<I){for(L&&D.c.push(+M.slice(0,L)),I-=H;L<I;)D.c.push(+M.slice(L,L+=H));L=H-(M=M.slice(L)).length}else L-=I;for(;L--;M+="0");D.c.push(+M)}}else D.c=[D.e=0]}_.clone=eu,_.ROUND_UP=0,_.ROUND_DOWN=1,_.ROUND_CEIL=2,_.ROUND_FLOOR=3,_.ROUND_HALF_UP=4,_.ROUND_HALF_DOWN=5,_.ROUND_HALF_EVEN=6,_.ROUND_HALF_CEIL=7,_.ROUND_HALF_FLOOR=8,_.EUCLID=9,_.config=_.set=function(f){var g,h;if(f!=null)if(typeof f=="object"){if(f.hasOwnProperty(g="DECIMAL_PLACES")&&(h=f[g],se(h,0,we,g),s=h),f.hasOwnProperty(g="ROUNDING_MODE")&&(h=f[g],se(h,0,8,g),a=h),f.hasOwnProperty(g="EXPONENTIAL_AT")&&(h=f[g],h&&h.pop?(se(h[0],-we,0,g),se(h[1],0,we,g),m=h[0],y=h[1]):(se(h,-we,we,g),m=-(y=h<0?-h:h))),f.hasOwnProperty(g="RANGE"))if(h=f[g],h&&h.pop)se(h[0],-we,-1,g),se(h[1],1,we,g),E=h[0],N=h[1];else if(se(h,-we,we,g),h)E=-(N=h<0?-h:h);else throw Error(Ce+g+" cannot be zero: "+h);if(f.hasOwnProperty(g="CRYPTO"))if(h=f[g],h===!!h)if(h)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))$=h;else throw $=!h,Error(Ce+"crypto unavailable");else $=h;else throw Error(Ce+g+" not true or false: "+h);if(f.hasOwnProperty(g="MODULO_MODE")&&(h=f[g],se(h,0,9,g),U=h),f.hasOwnProperty(g="POW_PRECISION")&&(h=f[g],se(h,0,we,g),B=h),f.hasOwnProperty(g="FORMAT"))if(h=f[g],typeof h=="object")q=h;else throw Error(Ce+g+" not an object: "+h);if(f.hasOwnProperty(g="ALPHABET"))if(h=f[g],typeof h=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(h))X=h.slice(0,10)=="0123456789",J=h;else throw Error(Ce+g+" invalid: "+h)}else throw Error(Ce+"Object expected: "+f);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[m,y],RANGE:[E,N],CRYPTO:$,MODULO_MODE:U,POW_PRECISION:B,FORMAT:q,ALPHABET:J}},_.isBigNumber=function(f){if(!f||f._isBigNumber!==!0)return!1;if(!_.DEBUG)return!0;var g,h,O=f.c,P=f.e,k=f.s;e:if({}.toString.call(O)=="[object Array]"){if((k===1||k===-1)&&P>=-we&&P<=we&&P===$e(P)){if(O[0]===0){if(P===0&&O.length===1)return!0;break e}if(g=(P+1)%H,g<1&&(g+=H),String(O[0]).length==g){for(g=0;g<O.length;g++)if(h=O[g],h<0||h>=je||h!==$e(h))break e;if(h!==0)return!0}}}else if(O===null&&P===null&&(k===null||k===1||k===-1))return!0;throw Error(Ce+"Invalid BigNumber: "+f)},_.maximum=_.max=function(){return le(arguments,-1)},_.minimum=_.min=function(){return le(arguments,1)},_.random=function(){var f=9007199254740992,g=Math.random()*f&2097151?function(){return $e(Math.random()*f)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(h){var O,P,k,L,R,I=0,M=[],D=new _(o);if(h==null?h=s:se(h,0,we),L=_i(h/H),$)if(crypto.getRandomValues){for(O=crypto.getRandomValues(new Uint32Array(L*=2));I<L;)R=O[I]*131072+(O[I+1]>>>11),R>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),O[I]=P[0],O[I+1]=P[1]):(M.push(R%1e14),I+=2);I=L/2}else if(crypto.randomBytes){for(O=crypto.randomBytes(L*=7);I<L;)R=(O[I]&31)*281474976710656+O[I+1]*1099511627776+O[I+2]*4294967296+O[I+3]*16777216+(O[I+4]<<16)+(O[I+5]<<8)+O[I+6],R>=9e15?crypto.randomBytes(7).copy(O,I):(M.push(R%1e14),I+=7);I=L/7}else throw $=!1,Error(Ce+"crypto unavailable");if(!$)for(;I<L;)R=g(),R<9e15&&(M[I++]=R%1e14);for(L=M[--I],h%=H,L&&h&&(R=$i[H-h],M[I]=$e(L/R)*R);M[I]===0;M.pop(),I--);if(I<0)M=[k=0];else{for(k=-1;M[0]===0;M.splice(0,1),k-=H);for(I=1,R=M[0];R>=10;R/=10,I++);I<H&&(k-=H-I)}return D.e=k,D.c=M,D}}(),_.sum=function(){for(var f=1,g=arguments,h=new _(g[0]);f<g.length;)h=h.plus(g[f++]);return h},r=function(){var f="0123456789";function g(h,O,P,k){for(var L,R=[0],I,M=0,D=h.length;M<D;){for(I=R.length;I--;R[I]*=O);for(R[0]+=k.indexOf(h.charAt(M++)),L=0;L<R.length;L++)R[L]>P-1&&(R[L+1]==null&&(R[L+1]=0),R[L+1]+=R[L]/P|0,R[L]%=P)}return R.reverse()}return function(h,O,P,k,L){var R,I,M,D,F,j,Q,K,ae=h.indexOf("."),me=s,W=a;for(ae>=0&&(D=B,B=0,h=h.replace(".",""),K=new _(O),j=K.pow(h.length-ae),B=D,K.c=g(nt(Fe(j.c),j.e,"0"),10,P,f),K.e=K.c.length),Q=g(h,O,P,L?(R=J,f):(R=f,J)),M=D=Q.length;Q[--D]==0;Q.pop());if(!Q[0])return R.charAt(0);if(ae<0?--M:(j.c=Q,j.e=M,j.s=k,j=e(j,K,me,W,P),Q=j.c,F=j.r,M=j.e),I=M+me+1,ae=Q[I],D=P/2,F=F||I<0||Q[I+1]!=null,F=W<4?(ae!=null||F)&&(W==0||W==(j.s<0?3:2)):ae>D||ae==D&&(W==4||F||W==6&&Q[I-1]&1||W==(j.s<0?8:7)),I<1||!Q[0])h=F?nt(R.charAt(1),-me,R.charAt(0)):R.charAt(0);else{if(Q.length=I,F)for(--P;++Q[--I]>P;)Q[I]=0,I||(++M,Q=[1].concat(Q));for(D=Q.length;!Q[--D];);for(ae=0,h="";ae<=D;h+=R.charAt(Q[ae++]));h=nt(h,M,R.charAt(0))}return h}}(),e=function(){function f(O,P,k){var L,R,I,M,D=0,F=O.length,j=P%ct,Q=P/ct|0;for(O=O.slice();F--;)I=O[F]%ct,M=O[F]/ct|0,L=Q*I+M*j,R=j*I+L%ct*ct+D,D=(R/k|0)+(L/ct|0)+Q*M,O[F]=R%k;return D&&(O=[D].concat(O)),O}function g(O,P,k,L){var R,I;if(k!=L)I=k>L?1:-1;else for(R=I=0;R<k;R++)if(O[R]!=P[R]){I=O[R]>P[R]?1:-1;break}return I}function h(O,P,k,L){for(var R=0;k--;)O[k]-=R,R=O[k]<P[k]?1:0,O[k]=R*L+O[k]-P[k];for(;!O[0]&&O.length>1;O.splice(0,1));}return function(O,P,k,L,R){var I,M,D,F,j,Q,K,ae,me,W,Y,Te,Ur,zn,Wn,Qe,rr,De=O.s==P.s?1:-1,ve=O.c,ue=P.c;if(!ve||!ve[0]||!ue||!ue[0])return new _(!O.s||!P.s||(ve?ue&&ve[0]==ue[0]:!ue)?NaN:ve&&ve[0]==0||!ue?De*0:De/0);for(ae=new _(De),me=ae.c=[],M=O.e-P.e,De=k+M+1,R||(R=je,M=Ue(O.e/H)-Ue(P.e/H),De=De/H|0),D=0;ue[D]==(ve[D]||0);D++);if(ue[D]>(ve[D]||0)&&M--,De<0)me.push(1),F=!0;else{for(zn=ve.length,Qe=ue.length,D=0,De+=2,j=$e(R/(ue[0]+1)),j>1&&(ue=f(ue,j,R),ve=f(ve,j,R),Qe=ue.length,zn=ve.length),Ur=Qe,W=ve.slice(0,Qe),Y=W.length;Y<Qe;W[Y++]=0);rr=ue.slice(),rr=[0].concat(rr),Wn=ue[0],ue[1]>=R/2&&Wn++;do{if(j=0,I=g(ue,W,Qe,Y),I<0){if(Te=W[0],Qe!=Y&&(Te=Te*R+(W[1]||0)),j=$e(Te/Wn),j>1)for(j>=R&&(j=R-1),Q=f(ue,j,R),K=Q.length,Y=W.length;g(Q,W,K,Y)==1;)j--,h(Q,Qe<K?rr:ue,K,R),K=Q.length,I=1;else j==0&&(I=j=1),Q=ue.slice(),K=Q.length;if(K<Y&&(Q=[0].concat(Q)),h(W,Q,Y,R),Y=W.length,I==-1)for(;g(ue,W,Qe,Y)<1;)j++,h(W,Qe<Y?rr:ue,Y,R),Y=W.length}else I===0&&(j++,W=[0]);me[D++]=j,W[0]?W[Y++]=ve[Ur]||0:(W=[ve[Ur]],Y=1)}while((Ur++<zn||W[0]!=null)&&De--);F=W[0]!=null,me[0]||me.splice(0,1)}if(R==je){for(D=1,De=me[0];De>=10;De/=10,D++);Pe(ae,k+(ae.e=D+M*H-1)+1,L,F)}else ae.e=M,ae.r=+F;return ae}}();function z(f,g,h,O){var P,k,L,R,I;if(h==null?h=a:se(h,0,8),!f.c)return f.toString();if(P=f.c[0],L=f.e,g==null)I=Fe(f.c),I=O==1||O==2&&(L<=m||L>=y)?An(I,L):nt(I,L,"0");else if(f=Pe(new _(f),g,h),k=f.e,I=Fe(f.c),R=I.length,O==1||O==2&&(g<=k||k<=m)){for(;R<g;I+="0",R++);I=An(I,k)}else if(g-=L+(O===2&&k>L),I=nt(I,k,"0"),k+1>R){if(--g>0)for(I+=".";g--;I+="0");}else if(g+=k-R,g>0)for(k+1==R&&(I+=".");g--;I+="0");return f.s<0&&P?"-"+I:I}function le(f,g){for(var h,O,P=1,k=new _(f[0]);P<f.length;P++)O=new _(f[P]),(!O.s||(h=ht(k,O))===g||h===0&&k.s===g)&&(k=O);return k}function Ae(f,g,h){for(var O=1,P=g.length;!g[--P];g.pop());for(P=g[0];P>=10;P/=10,O++);return(h=O+h*H-1)>N?f.c=f.e=null:h<E?f.c=[f.e=0]:(f.e=h,f.c=g),f}n=function(){var f=/^(-?)0([xbo])(?=\w[\w.]*$)/i,g=/^([^.]+)\.$/,h=/^\.([^.]+)$/,O=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(k,L,R,I){var M,D=R?L:L.replace(P,"");if(O.test(D))k.s=isNaN(D)?null:D<0?-1:1;else{if(!R&&(D=D.replace(f,function(F,j,Q){return M=(Q=Q.toLowerCase())=="x"?16:Q=="b"?2:8,!I||I==M?j:F}),I&&(M=I,D=D.replace(g,"$1").replace(h,"0.$1")),L!=D))return new _(D,M);if(_.DEBUG)throw Error(Ce+"Not a"+(I?" base "+I:"")+" number: "+L);k.s=null}k.c=k.e=null}}();function Pe(f,g,h,O){var P,k,L,R,I,M,D,F=f.c,j=$i;if(F){e:{for(P=1,R=F[0];R>=10;R/=10,P++);if(k=g-P,k<0)k+=H,L=g,I=F[M=0],D=$e(I/j[P-L-1]%10);else if(M=_i((k+1)/H),M>=F.length)if(O){for(;F.length<=M;F.push(0));I=D=0,P=1,k%=H,L=k-H+1}else break e;else{for(I=R=F[M],P=1;R>=10;R/=10,P++);k%=H,L=k-H+P,D=L<0?0:$e(I/j[P-L-1]%10)}if(O=O||g<0||F[M+1]!=null||(L<0?I:I%j[P-L-1]),O=h<4?(D||O)&&(h==0||h==(f.s<0?3:2)):D>5||D==5&&(h==4||O||h==6&&(k>0?L>0?I/j[P-L]:0:F[M-1])%10&1||h==(f.s<0?8:7)),g<1||!F[0])return F.length=0,O?(g-=f.e+1,F[0]=j[(H-g%H)%H],f.e=-g||0):F[0]=f.e=0,f;if(k==0?(F.length=M,R=1,M--):(F.length=M+1,R=j[H-k],F[M]=L>0?$e(I/j[P-L]%j[L])*R:0),O)for(;;)if(M==0){for(k=1,L=F[0];L>=10;L/=10,k++);for(L=F[0]+=R,R=1;L>=10;L/=10,R++);k!=R&&(f.e++,F[0]==je&&(F[0]=1));break}else{if(F[M]+=R,F[M]!=je)break;F[M--]=0,R=1}for(k=F.length;F[--k]===0;F.pop());}f.e>N?f.c=f.e=null:f.e<E&&(f.c=[f.e=0])}return f}function ce(f){var g,h=f.e;return h===null?f.toString():(g=Fe(f.c),g=h<=m||h>=y?An(g,h):nt(g,h,"0"),f.s<0?"-"+g:g)}return i.absoluteValue=i.abs=function(){var f=new _(this);return f.s<0&&(f.s=1),f},i.comparedTo=function(f,g){return ht(this,new _(f,g))},i.decimalPlaces=i.dp=function(f,g){var h,O,P,k=this;if(f!=null)return se(f,0,we),g==null?g=a:se(g,0,8),Pe(new _(k),f+k.e+1,g);if(!(h=k.c))return null;if(O=((P=h.length-1)-Ue(this.e/H))*H,P=h[P])for(;P%10==0;P/=10,O--);return O<0&&(O=0),O},i.dividedBy=i.div=function(f,g){return e(this,new _(f,g),s,a)},i.dividedToIntegerBy=i.idiv=function(f,g){return e(this,new _(f,g),0,1)},i.exponentiatedBy=i.pow=function(f,g){var h,O,P,k,L,R,I,M,D,F=this;if(f=new _(f),f.c&&!f.isInteger())throw Error(Ce+"Exponent not an integer: "+ce(f));if(g!=null&&(g=new _(g)),R=f.e>14,!F.c||!F.c[0]||F.c[0]==1&&!F.e&&F.c.length==1||!f.c||!f.c[0])return D=new _(Math.pow(+ce(F),R?f.s*(2-Sn(f)):+ce(f))),g?D.mod(g):D;if(I=f.s<0,g){if(g.c?!g.c[0]:!g.s)return new _(NaN);O=!I&&F.isInteger()&&g.isInteger(),O&&(F=F.mod(g))}else{if(f.e>9&&(F.e>0||F.e<-1||(F.e==0?F.c[0]>1||R&&F.c[1]>=24e7:F.c[0]<8e13||R&&F.c[0]<=9999975e7)))return k=F.s<0&&Sn(f)?-0:0,F.e>-1&&(k=1/k),new _(I?1/k:k);B&&(k=_i(B/H+2))}for(R?(h=new _(.5),I&&(f.s=1),M=Sn(f)):(P=Math.abs(+ce(f)),M=P%2),D=new _(o);;){if(M){if(D=D.times(F),!D.c)break;k?D.c.length>k&&(D.c.length=k):O&&(D=D.mod(g))}if(P){if(P=$e(P/2),P===0)break;M=P%2}else if(f=f.times(h),Pe(f,f.e+1,1),f.e>14)M=Sn(f);else{if(P=+ce(f),P===0)break;M=P%2}F=F.times(F),k?F.c&&F.c.length>k&&(F.c.length=k):O&&(F=F.mod(g))}return O?D:(I&&(D=o.div(D)),g?D.mod(g):k?Pe(D,B,a,L):D)},i.integerValue=function(f){var g=new _(this);return f==null?f=a:se(f,0,8),Pe(g,g.e+1,f)},i.isEqualTo=i.eq=function(f,g){return ht(this,new _(f,g))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(f,g){return ht(this,new _(f,g))>0},i.isGreaterThanOrEqualTo=i.gte=function(f,g){return(g=ht(this,new _(f,g)))===1||g===0},i.isInteger=function(){return!!this.c&&Ue(this.e/H)>this.c.length-2},i.isLessThan=i.lt=function(f,g){return ht(this,new _(f,g))<0},i.isLessThanOrEqualTo=i.lte=function(f,g){return(g=ht(this,new _(f,g)))===-1||g===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(f,g){var h,O,P,k,L=this,R=L.s;if(f=new _(f,g),g=f.s,!R||!g)return new _(NaN);if(R!=g)return f.s=-g,L.plus(f);var I=L.e/H,M=f.e/H,D=L.c,F=f.c;if(!I||!M){if(!D||!F)return D?(f.s=-g,f):new _(F?L:NaN);if(!D[0]||!F[0])return F[0]?(f.s=-g,f):new _(D[0]?L:a==3?-0:0)}if(I=Ue(I),M=Ue(M),D=D.slice(),R=I-M){for((k=R<0)?(R=-R,P=D):(M=I,P=F),P.reverse(),g=R;g--;P.push(0));P.reverse()}else for(O=(k=(R=D.length)<(g=F.length))?R:g,R=g=0;g<O;g++)if(D[g]!=F[g]){k=D[g]<F[g];break}if(k&&(P=D,D=F,F=P,f.s=-f.s),g=(O=F.length)-(h=D.length),g>0)for(;g--;D[h++]=0);for(g=je-1;O>R;){if(D[--O]<F[O]){for(h=O;h&&!D[--h];D[h]=g);--D[h],D[O]+=je}D[O]-=F[O]}for(;D[0]==0;D.splice(0,1),--M);return D[0]?Ae(f,D,M):(f.s=a==3?-1:1,f.c=[f.e=0],f)},i.modulo=i.mod=function(f,g){var h,O,P=this;return f=new _(f,g),!P.c||!f.s||f.c&&!f.c[0]?new _(NaN):!f.c||P.c&&!P.c[0]?new _(P):(U==9?(O=f.s,f.s=1,h=e(P,f,0,3),f.s=O,h.s*=O):h=e(P,f,0,U),f=P.minus(h.times(f)),!f.c[0]&&U==1&&(f.s=P.s),f)},i.multipliedBy=i.times=function(f,g){var h,O,P,k,L,R,I,M,D,F,j,Q,K,ae,me,W=this,Y=W.c,Te=(f=new _(f,g)).c;if(!Y||!Te||!Y[0]||!Te[0])return!W.s||!f.s||Y&&!Y[0]&&!Te||Te&&!Te[0]&&!Y?f.c=f.e=f.s=null:(f.s*=W.s,!Y||!Te?f.c=f.e=null:(f.c=[0],f.e=0)),f;for(O=Ue(W.e/H)+Ue(f.e/H),f.s*=W.s,I=Y.length,F=Te.length,I<F&&(K=Y,Y=Te,Te=K,P=I,I=F,F=P),P=I+F,K=[];P--;K.push(0));for(ae=je,me=ct,P=F;--P>=0;){for(h=0,j=Te[P]%me,Q=Te[P]/me|0,L=I,k=P+L;k>P;)M=Y[--L]%me,D=Y[L]/me|0,R=Q*M+D*j,M=j*M+R%me*me+K[k]+h,h=(M/ae|0)+(R/me|0)+Q*D,K[k--]=M%ae;K[k]=h}return h?++O:K.splice(0,1),Ae(f,K,O)},i.negated=function(){var f=new _(this);return f.s=-f.s||null,f},i.plus=function(f,g){var h,O=this,P=O.s;if(f=new _(f,g),g=f.s,!P||!g)return new _(NaN);if(P!=g)return f.s=-g,O.minus(f);var k=O.e/H,L=f.e/H,R=O.c,I=f.c;if(!k||!L){if(!R||!I)return new _(P/0);if(!R[0]||!I[0])return I[0]?f:new _(R[0]?O:P*0)}if(k=Ue(k),L=Ue(L),R=R.slice(),P=k-L){for(P>0?(L=k,h=I):(P=-P,h=R),h.reverse();P--;h.push(0));h.reverse()}for(P=R.length,g=I.length,P-g<0&&(h=I,I=R,R=h,g=P),P=0;g;)P=(R[--g]=R[g]+I[g]+P)/je|0,R[g]=je===R[g]?0:R[g]%je;return P&&(R=[P].concat(R),++L),Ae(f,R,L)},i.precision=i.sd=function(f,g){var h,O,P,k=this;if(f!=null&&f!==!!f)return se(f,1,we),g==null?g=a:se(g,0,8),Pe(new _(k),f,g);if(!(h=k.c))return null;if(P=h.length-1,O=P*H+1,P=h[P]){for(;P%10==0;P/=10,O--);for(P=h[0];P>=10;P/=10,O++);}return f&&k.e+1>O&&(O=k.e+1),O},i.shiftedBy=function(f){return se(f,-Fi,Fi),this.times("1e"+f)},i.squareRoot=i.sqrt=function(){var f,g,h,O,P,k=this,L=k.c,R=k.s,I=k.e,M=s+4,D=new _("0.5");if(R!==1||!L||!L[0])return new _(!R||R<0&&(!L||L[0])?NaN:L?k:1/0);if(R=Math.sqrt(+ce(k)),R==0||R==1/0?(g=Fe(L),(g.length+I)%2==0&&(g+="0"),R=Math.sqrt(+g),I=Ue((I+1)/2)-(I<0||I%2),R==1/0?g="5e"+I:(g=R.toExponential(),g=g.slice(0,g.indexOf("e")+1)+I),h=new _(g)):h=new _(R+""),h.c[0]){for(I=h.e,R=I+M,R<3&&(R=0);;)if(P=h,h=D.times(P.plus(e(k,P,M,1))),Fe(P.c).slice(0,R)===(g=Fe(h.c)).slice(0,R))if(h.e<I&&--R,g=g.slice(R-3,R+1),g=="9999"||!O&&g=="4999"){if(!O&&(Pe(P,P.e+s+2,0),P.times(P).eq(k))){h=P;break}M+=4,R+=4,O=1}else{(!+g||!+g.slice(1)&&g.charAt(0)=="5")&&(Pe(h,h.e+s+2,1),f=!h.times(h).eq(k));break}}return Pe(h,h.e+s+1,a,f)},i.toExponential=function(f,g){return f!=null&&(se(f,0,we),f++),z(this,f,g,1)},i.toFixed=function(f,g){return f!=null&&(se(f,0,we),f=f+this.e+1),z(this,f,g)},i.toFormat=function(f,g,h){var O,P=this;if(h==null)f!=null&&g&&typeof g=="object"?(h=g,g=null):f&&typeof f=="object"?(h=f,f=g=null):h=q;else if(typeof h!="object")throw Error(Ce+"Argument not an object: "+h);if(O=P.toFixed(f,g),P.c){var k,L=O.split("."),R=+h.groupSize,I=+h.secondaryGroupSize,M=h.groupSeparator||"",D=L[0],F=L[1],j=P.s<0,Q=j?D.slice(1):D,K=Q.length;if(I&&(k=R,R=I,I=k,K-=k),R>0&&K>0){for(k=K%R||R,D=Q.substr(0,k);k<K;k+=R)D+=M+Q.substr(k,R);I>0&&(D+=M+Q.slice(k)),j&&(D="-"+D)}O=F?D+(h.decimalSeparator||"")+((I=+h.fractionGroupSize)?F.replace(new RegExp("\\d{"+I+"}\\B","g"),"$&"+(h.fractionGroupSeparator||"")):F):D}return(h.prefix||"")+O+(h.suffix||"")},i.toFraction=function(f){var g,h,O,P,k,L,R,I,M,D,F,j,Q=this,K=Q.c;if(f!=null&&(R=new _(f),!R.isInteger()&&(R.c||R.s!==1)||R.lt(o)))throw Error(Ce+"Argument "+(R.isInteger()?"out of range: ":"not an integer: ")+ce(R));if(!K)return new _(Q);for(g=new _(o),M=h=new _(o),O=I=new _(o),j=Fe(K),k=g.e=j.length-Q.e-1,g.c[0]=$i[(L=k%H)<0?H+L:L],f=!f||R.comparedTo(g)>0?k>0?g:M:R,L=N,N=1/0,R=new _(j),I.c[0]=0;D=e(R,g,0,1),P=h.plus(D.times(O)),P.comparedTo(f)!=1;)h=O,O=P,M=I.plus(D.times(P=M)),I=P,g=R.minus(D.times(P=g)),R=P;return P=e(f.minus(h),O,0,1),I=I.plus(P.times(M)),h=h.plus(P.times(O)),I.s=M.s=Q.s,k=k*2,F=e(M,O,k,a).minus(Q).abs().comparedTo(e(I,h,k,a).minus(Q).abs())<1?[M,O]:[I,h],N=L,F},i.toNumber=function(){return+ce(this)},i.toPrecision=function(f,g){return f!=null&&se(f,1,we),z(this,f,g,2)},i.toString=function(f){var g,h=this,O=h.s,P=h.e;return P===null?O?(g="Infinity",O<0&&(g="-"+g)):g="NaN":(f==null?g=P<=m||P>=y?An(Fe(h.c),P):nt(Fe(h.c),P,"0"):f===10&&X?(h=Pe(new _(h),s+P+1,a),g=nt(Fe(h.c),h.e,"0")):(se(f,2,J.length,"Base"),g=r(nt(Fe(h.c),P,"0"),10,f,O,!0)),O<0&&h.c[0]&&(g="-"+g)),g},i.valueOf=i.toJSON=function(){return ce(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,t!=null&&_.set(t),_}function Ue(t){var e=t|0;return t>0||t===e?e:e-1}function Fe(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=H-e.length;r--;e="0"+e);o+=e}for(i=o.length;o.charCodeAt(--i)===48;);return o.slice(0,i+1||1)}function ht(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,m=t.e,y=e.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=m==y,!i||!o)return n?0:!i^r?1:-1;if(!n)return m>y^r?1:-1;for(a=(m=i.length)<(y=o.length)?m:y,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return m==y?0:m>y^r?1:-1}function se(t,e,r,n){if(t<e||t>r||t!==$e(t))throw Error(Ce+(n||"Argument")+(typeof t=="number"?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function Sn(t){var e=t.c.length-1;return Ue(t.e/H)==e&&t.c[e]%2!=0}function An(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function nt(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(n=t.length,++e>n){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}var md=eu(),tu=md;var fd=24,Ar=32,gd=()=>typeof globalThis<"u"&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"?()=>{let t=new Uint32Array(1);return globalThis.crypto.getRandomValues(t),t[0]/4294967296}:Math.random,Vi=gd(),Ui=(t=4,e=Vi)=>{let r="";for(;r.length<t;)r=r+Math.floor(e()*36).toString(36);return r};function yd(t){let e=new tu(0);for(let r of t.values())e=e.multipliedBy(256).plus(r);return e}var nu=(t="")=>{let e=new TextEncoder;return yd(Za(e.encode(t))).toString(36).slice(1)},ru=Array.from({length:26},(t,e)=>String.fromCharCode(e+97)),hd=t=>ru[Math.floor(t()*ru.length)],wd=({globalObj:t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},random:e=Vi}={})=>{let r=Object.keys(t).toString(),n=r.length?r+Ui(Ar,e):Ui(Ar,e);return nu(n).substring(0,Ar)},bd=t=>()=>t++,xd=476782367,iu=({random:t=Vi,counter:e=bd(Math.floor(t()*xd)),length:r=fd,fingerprint:n=wd({random:t})}={})=>{if(r>Ar)throw new Error(`Length must be between 2 and ${Ar}. Received: ${r}`);return function(){let o=hd(t),s=Date.now().toString(36),a=e().toString(36),m=Ui(r,t),y=`${s+m+a+n}`;return`${o+nu(y).substring(1,r)}`}},qi=Ed(iu);function Ed(t){let e;return()=>(e||(e=t()),e())}u();l();c();p();d();Jr();u();l();c();p();d();var ou="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Pd=128,wt,Kt;function Td(t){!wt||wt.length<t?(wt=w.allocUnsafe(t*Pd),lr.getRandomValues(wt),Kt=0):Kt+t>wt.length&&(lr.getRandomValues(wt),Kt=0),Kt+=t}function Bi(t=21){Td(t|=0);let e="";for(let r=Kt-t;r<Kt;r++)e+=ou[wt[r]&63];return e}u();l();c();p();d();Jr();var au="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Rr=32;var vd=16,uu=10,su=0xffffffffffff;var bt;(function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"})(bt||(bt={}));var xt=class extends Error{constructor(e,r){super(`${r} (${e})`),this.name="ULIDError",this.code=e}};function Sd(t){let e=Math.floor(t()*Rr);return e===Rr&&(e=Rr-1),au.charAt(e)}function Ad(t){let e=Rd(),r=e&&(e.crypto||e.msCrypto)||(typeof Dt<"u"?Dt: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(Dt?.randomBytes)return()=>Dt.randomBytes(1).readUInt8()/255;throw new xt(bt.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Rd(){return Od()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function Cd(t,e){let r="";for(;t>0;t--)r=Sd(e)+r;return r}function Id(t,e=uu){if(isNaN(t))throw new xt(bt.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>su)throw new xt(bt.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${su}: ${t}`);if(t<0)throw new xt(bt.EncodeTimeNegative,`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new xt(bt.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let r,n="";for(let i=e;i>0;i--)r=t%Rr,n=au.charAt(r)+n,t=(t-r)/Rr;return n}function Od(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function lu(t,e){let r=e||Ad(),n=!t||isNaN(t)?Date.now():t;return Id(n,uu)+Cd(vd,r)}u();l();c();p();d();u();l();c();p();d();var xe=[];for(let t=0;t<256;++t)xe.push((t+256).toString(16).slice(1));function Rn(t,e=0){return(xe[t[e+0]]+xe[t[e+1]]+xe[t[e+2]]+xe[t[e+3]]+"-"+xe[t[e+4]]+xe[t[e+5]]+"-"+xe[t[e+6]]+xe[t[e+7]]+"-"+xe[t[e+8]]+xe[t[e+9]]+"-"+xe[t[e+10]]+xe[t[e+11]]+xe[t[e+12]]+xe[t[e+13]]+xe[t[e+14]]+xe[t[e+15]]).toLowerCase()}u();l();c();p();d();var kd=new Uint8Array(16);function Xt(){return crypto.getRandomValues(kd)}u();l();c();p();d();function Nd(t,e,r){return!e&&!t&&crypto.randomUUID?crypto.randomUUID():Dd(t,e,r)}function Dd(t,e,r){t=t||{};let n=t.random??t.rng?.()??Xt();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,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[r+i]=n[i];return e}return Rn(n)}var ji=Nd;u();l();c();p();d();var Qi={};function Md(t,e,r){let n;if(t)n=cu(t.random??t.rng?.()??Xt(),t.msecs,t.seq,e,r);else{let i=Date.now(),o=Xt();Ld(Qi,i,o),n=cu(o,Qi.msecs,Qi.seq,e,r)}return e??Rn(n)}function Ld(t,e,r){return t.msecs??=-1/0,t.seq??=0,e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}function cu(t,e,r,n,i=0){if(t.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 e??=Date.now(),r??=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9],n[i++]=e/1099511627776&255,n[i++]=e/4294967296&255,n[i++]=e/16777216&255,n[i++]=e/65536&255,n[i++]=e/256&255,n[i++]=e&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|t[10]&3,n[i++]=t[11],n[i++]=t[12],n[i++]=t[13],n[i++]=t[14],n[i++]=t[15],n}var Ji=Md;var Cn=class{#e={};constructor(){this.register("uuid",new Hi),this.register("cuid",new zi),this.register("ulid",new Wi),this.register("nanoid",new Ki),this.register("product",new Xi)}snapshot(){return Object.create(this.#e,{now:{value:new Gi}})}register(e,r){this.#e[e]=r}},Gi=class{#e;generate(){return this.#e===void 0&&(this.#e=new Date),this.#e.toISOString()}},Hi=class{generate(e){if(e===4)return ji();if(e===7)return Ji();throw new Error("Invalid UUID generator arguments")}},zi=class{generate(e){if(e===1)return La();if(e===2)return qi();throw new Error("Invalid CUID generator arguments")}},Wi=class{generate(){return lu()}},Ki=class{generate(e){if(typeof e=="number")return Bi(e);if(e===void 0)return Bi();throw new Error("Invalid Nanoid generator arguments")}},Xi=class{generate(e,r){if(e===void 0||r===void 0)throw new Error("Invalid Product generator arguments");return Array.isArray(e)&&Array.isArray(r)?e.flatMap(n=>r.map(i=>[n,i])):Array.isArray(e)?e.map(n=>[n,r]):Array.isArray(r)?r.map(n=>[e,n]):[[e,r]]}};u();l();c();p();d();function Cr(t,e){return t==null?t:typeof t=="string"?Cr(JSON.parse(t),e):Array.isArray(t)?Fd(t,e):_d(t,e)}function _d(t,e){if(e.pagination){let{skip:r,take:n,cursor:i}=e.pagination;if(r!==null&&r>0||n===0||i!==null&&!Wt(t,i))return null}return du(t,e.nested)}function du(t,e){for(let[r,n]of Object.entries(e))t[r]=Cr(t[r],n);return t}function Fd(t,e){if(e.distinct!==null){let r=e.linkingFields!==null?[...e.distinct,...e.linkingFields]:e.distinct;t=$d(t,r)}return e.pagination&&(t=Ud(t,e.pagination,e.linkingFields)),e.reverse&&t.reverse(),Object.keys(e.nested).length===0?t:t.map(r=>du(r,e.nested))}function $d(t,e){let r=new Set,n=[];for(let i of t){let o=Et(i,e);r.has(o)||(r.add(o),n.push(i))}return n}function Ud(t,e,r){if(r===null)return pu(t,e);let n=new Map;for(let o of t){let s=Et(o,r);n.has(s)||n.set(s,[]),n.get(s).push(o)}let i=Array.from(n.entries());return i.sort(([o],[s])=>o<s?-1:o>s?1:0),i.flatMap(([,o])=>pu(o,e))}function pu(t,{cursor:e,skip:r,take:n}){let i=e!==null?t.findIndex(a=>Wt(a,e)):0;if(i===-1)return[];let o=i+(r??0),s=n!==null?o+n:t.length;return t.slice(o,s)}function Et(t,e,r){let n=e.map((i,o)=>r?.[o]?t[i]!==null?r[o](t[i]):null:t[i]);return JSON.stringify(n)}u();l();c();p();d();u();l();c();p();d();function Zi(t){return typeof t=="object"&&t!==null&&t.prisma__type==="param"}function Yi(t){return typeof t=="object"&&t!==null&&t.prisma__type==="generatorCall"}function ro(t,e,r,n){let i=t.args.map(o=>Ne(o,e,r));switch(t.type){case"rawSql":return[Bd(t.sql,i,t.argTypes)];case"templateSql":return(t.chunkable?Qd(t.fragments,i,n):[i]).map(s=>{let a=Vd(t.fragments,t.placeholderFormat,s,t.argTypes);if(n!==void 0&&a.args.length>n)throw new he("The query parameter limit supported by your database is exceeded.","P2029");return a});default:Z(t.type,"Invalid query type")}}function Ne(t,e,r){for(;jd(t);)if(Zi(t)){let n=e[t.prisma__value.name];if(n===void 0)throw new Error(`Missing value for query variable ${t.prisma__value.name}`);t.prisma__value.type==="DateTime"&&typeof n=="string"?t=new Date(n):t=n}else if(Yi(t)){let{name:n,args:i}=t.prisma__value,o=r[n];if(!o)throw new Error(`Encountered an unknown generator '${n}'`);t=o.generate(...i.map(s=>Ne(s,e,r)))}else Z(t,`Unexpected unevaluated value type: ${t}`);return Array.isArray(t)&&(t=t.map(n=>Ne(n,e,r))),t}function Vd(t,e,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let m of to(t,r,n)){if(i+=qd(m,e,o),m.type==="stringChunk")continue;let y=Array.from(mu(m)),E=y.length;if(hn(s,y),m.argType.arity==="tuple"){if(E%m.argType.elements.length!==0)throw new Error(`Malformed query template. Expected the number of parameters to match the tuple arity, but got ${E} parameters for a tuple of arity ${m.argType.elements.length}.`);for(let N=0;N<E/m.argType.elements.length;N++)a.push(...m.argType.elements)}else for(let N=0;N<E;N++)a.push(m.argType)}return{sql:i,args:s,argTypes:a}}function qd(t,e,r){let n=t.type;switch(n){case"parameter":return eo(e,r.placeholderNumber++);case"stringChunk":return t.chunk;case"parameterTuple":return`(${t.value.length==0?"NULL":t.value.map(()=>{let o=eo(e,r.placeholderNumber++);return`${t.itemPrefix}${o}${t.itemSuffix}`}).join(t.itemSeparator)})`;case"parameterTupleList":return t.value.map(i=>{let o=i.map(()=>eo(e,r.placeholderNumber++)).join(t.itemSeparator);return`${t.itemPrefix}${o}${t.itemSuffix}`}).join(t.groupSeparator);default:Z(n,"Invalid fragment type")}}function eo(t,e){return t.hasNumbering?`${t.prefix}${e}`:t.prefix}function Bd(t,e,r){return{sql:t,args:e,argTypes:r}}function jd(t){return Zi(t)||Yi(t)}function*to(t,e,r){let n=0;for(let i of t)switch(i.type){case"parameter":{if(n>=e.length)throw new Error(`Malformed query template. Fragments attempt to read over ${e.length} parameters.`);yield{...i,value:e[n],argType:r?.[n]},n++;break}case"stringChunk":{yield i;break}case"parameterTuple":{if(n>=e.length)throw new Error(`Malformed query template. Fragments attempt to read over ${e.length} parameters.`);let o=e[n];yield{...i,value:Array.isArray(o)?o:[o],argType:r?.[n]},n++;break}case"parameterTupleList":{if(n>=e.length)throw new Error(`Malformed query template. Fragments attempt to read over ${e.length} parameters.`);let o=e[n];if(!Array.isArray(o))throw new Error("Malformed query template. Tuple list expected.");if(o.length===0)throw new Error("Malformed query template. Tuple list cannot be empty.");for(let s of o)if(!Array.isArray(s))throw new Error("Malformed query template. Tuple expected.");yield{...i,value:o,argType:r?.[n]},n++;break}}}function*mu(t){switch(t.type){case"parameter":yield t.value;break;case"stringChunk":break;case"parameterTuple":yield*t.value;break;case"parameterTupleList":for(let e of t.value)yield*e;break}}function Qd(t,e,r){let n=0,i=0;for(let s of to(t,e,void 0)){let a=0;for(let m of mu(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of to(t,e,void 0))switch(s.type){case"parameter":{for(let a of o)a.push(s.value);break}case"stringChunk":break;case"parameterTuple":{let a=s.value.length,m=[];if(r&&o.length===1&&a===i&&n>r&&n-a<r){let y=r-(n-a);m=Jd(s.value,y)}else m=[s.value];o=o.flatMap(y=>m.map(E=>[...y,E]));break}case"parameterTupleList":{let a=s.value.reduce((N,$)=>N+$.length,0),m=[],y=[],E=0;for(let N of s.value)r&&o.length===1&&a===i&&y.length>0&&n-a+E+N.length>r&&(m.push(y),y=[],E=0),y.push(N),E+=N.length;y.length>0&&m.push(y),o=o.flatMap(N=>m.map($=>[...N,$]));break}}return o}function Jd(t,e){let r=[];for(let n=0;n<t.length;n+=e)r.push(t.slice(n,n+e));return r}u();l();c();p();d();function fu(t){return t.rows.map(e=>e.reduce((r,n,i)=>(r[t.columnNames[i]]=n,r),{}))}function gu(t){return{columns:t.columnNames,types:t.columnTypes.map(e=>Gd(e)),rows:t.rows.map(e=>e.map((r,n)=>Ir(r,t.columnTypes[n])))}}function Ir(t,e){if(t===null)return null;switch(e){case G.Int32:switch(typeof t){case"number":return Math.trunc(t);case"string":return Math.trunc(Number(t));default:throw new Error(`Cannot serialize value of type ${typeof t} as Int32`)}case G.Int32Array:if(!Array.isArray(t))throw new Error(`Cannot serialize value of type ${typeof t} as Int32Array`);return t.map(r=>Ir(r,G.Int32));case G.Int64:switch(typeof t){case"number":return BigInt(Math.trunc(t));case"string":return t;default:throw new Error(`Cannot serialize value of type ${typeof t} as Int64`)}case G.Int64Array:if(!Array.isArray(t))throw new Error(`Cannot serialize value of type ${typeof t} as Int64Array`);return t.map(r=>Ir(r,G.Int64));case G.Json:switch(typeof t){case"string":return JSON.parse(t);default:throw new Error(`Cannot serialize value of type ${typeof t} as Json`)}case G.JsonArray:if(!Array.isArray(t))throw new Error(`Cannot serialize value of type ${typeof t} as JsonArray`);return t.map(r=>Ir(r,G.Json));case G.Boolean:switch(typeof t){case"boolean":return t;case"string":return t==="true"||t==="1";case"number":return t===1;default:throw new Error(`Cannot serialize value of type ${typeof t} as Boolean`)}case G.BooleanArray:if(!Array.isArray(t))throw new Error(`Cannot serialize value of type ${typeof t} as BooleanArray`);return t.map(r=>Ir(r,G.Boolean));default:return t}}function Gd(t){switch(t){case G.Int32:return"int";case G.Int64:return"bigint";case G.Float:return"float";case G.Double:return"double";case G.Text:return"string";case G.Enum:return"enum";case G.Bytes:return"bytes";case G.Boolean:return"bool";case G.Character:return"char";case G.Numeric:return"decimal";case G.Json:return"json";case G.Uuid:return"uuid";case G.DateTime:return"datetime";case G.Date:return"date";case G.Time:return"time";case G.Int32Array:return"int-array";case G.Int64Array:return"bigint-array";case G.FloatArray:return"float-array";case G.DoubleArray:return"double-array";case G.TextArray:return"string-array";case G.EnumArray:return"string-array";case G.BytesArray:return"bytes-array";case G.BooleanArray:return"bool-array";case G.CharacterArray:return"char-array";case G.NumericArray:return"decimal-array";case G.JsonArray:return"json-array";case G.UuidArray:return"uuid-array";case G.DateTimeArray:return"datetime-array";case G.DateArray:return"date-array";case G.TimeArray:return"time-array";case G.UnknownNumber:return"unknown";case G.Set:return"string";default:Z(t,`Unexpected column type: ${t}`)}}u();l();c();p();d();function no(t,e,r){if(!e.every(n=>In(t,n))){let n=Hd(t,r),i=zd(r);throw new he(n,i,r.context)}}function In(t,e){switch(e.type){case"rowCountEq":return Array.isArray(t)?t.length===e.args:t===null?e.args===0:e.args===1;case"rowCountNeq":return Array.isArray(t)?t.length!==e.args:t===null?e.args!==0:e.args!==1;case"affectedRowCountEq":return t===e.args;case"never":return!1;default:Z(e,`Unknown rule type: ${e.type}`)}}function Hd(t,e){switch(e.errorIdentifier){case"RELATION_VIOLATION":return`The change you are trying to make would violate the required relation '${e.context.relation}' between the \`${e.context.modelA}\` and \`${e.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 ${e.context.operation}.`;case"MISSING_RELATED_RECORD":{let r=e.context.neededFor?` (needed to ${e.context.neededFor})`:"";return`An operation failed because it depends on one or more records that were required but not found. No '${e.context.model}' record${r} was found for ${e.context.operation} on ${e.context.relationType} relation '${e.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 ${e.context.expectedRows} records to be connected, found only ${Array.isArray(t)?t.length:t}.`;case"INCOMPLETE_CONNECT_OUTPUT":return`The required connected records were not found. Expected ${e.context.expectedRows} records to be connected after connect operation on ${e.context.relationType} relation '${e.context.relation}', found ${Array.isArray(t)?t.length:t}.`;case"RECORDS_NOT_CONNECTED":return`The records for relation \`${e.context.relation}\` between the \`${e.context.parent}\` and \`${e.context.child}\` models are not connected.`;default:Z(e,`Unknown error identifier: ${e}`)}}function zd(t){switch(t.errorIdentifier){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:Z(t,`Unknown error identifier: ${t}`)}}var Wd=be("prisma:client:queryInterpreter"),Nr=class t{#e;#t=new Cn;#r;#i;#o;#s;#a;constructor({onQuery:e,tracingHelper:r,serializer:n,rawSerializer:i,provider:o,connectionInfo:s}){this.#e=e,this.#r=r,this.#i=n,this.#o=i??n,this.#s=o,this.#a=s}static forSql(e){return new t({onQuery:e.onQuery,tracingHelper:e.tracingHelper,serializer:fu,rawSerializer:gu,provider:e.provider,connectionInfo:e.connectionInfo})}async run(e,r){let n=this.#t.snapshot(),i={...r,generators:n},o=Xd(e,a=>this.interpretNode(a,i))?.catch(a=>lt(a));if(o)try{return this.#n(await o,i.scope,n).value}catch(a){lt(a)}let{value:s}=await this.interpretNode(e,i).catch(a=>lt(a));return s}async interpretNode(e,r){switch(e.type){case"value":return{value:Ne(e.args,r.scope,r.generators),lastInsertId:e.lastInsertId};case"seq":{let n;for(let i of e.args)n=await this.interpretNode(i,r);return n??{value:void 0}}case"let":{let n=Object.create(r.scope);for(let i of e.args.bindings){let{value:o}=await this.interpretNode(i.expr,{...r,scope:n});n[i.name]=o}return this.interpretNode(e.args.expr,{...r,scope:n})}case"concat":{let n=await Promise.all(e.args.map(i=>this.interpretNode(i,r).then(o=>o.value)));return{value:n.length>0?n.reduce((i,o)=>i.concat(Zt(o)),[]):[]}}case"sum":{let n=await Promise.all(e.args.map(i=>this.interpretNode(i,r).then(o=>o.value)));return{value:n.length>0?n.reduce((i,o)=>Ve(i)+Ve(o)):0}}case"execute":{let n=ro(e.args,r.scope,r.generators,this.#p());return this.#l(n.length,r,async i=>{let o=0;for(let s of n){let a=bu(s,i.sqlCommenter);o+=await this.#d(a,i.queryable,()=>i.queryable.executeRaw(On(a)).catch(m=>e.args.type==="rawSql"?Ai(m):lt(m)))}return{value:o}})}case"query":{let n=ro(e.args,r.scope,r.generators,this.#p());return this.#l(n.length,r,async i=>{let o;for(let s of n){let a=bu(s,i.sqlCommenter),m=await this.#d(a,i.queryable,()=>i.queryable.queryRaw(On(a)).catch(y=>e.args.type==="rawSql"?Ai(y):lt(y)));o===void 0?o=m:(hn(o.rows,m.rows),o.lastInsertId=m.lastInsertId)}return{value:e.args.type==="rawSql"?this.#o(o):this.#i(o),lastInsertId:o?.lastInsertId}})}case"reverse":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args,r);return{value:Array.isArray(n)?n.reverse():n,lastInsertId:i}}case"unique":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args,r);if(!Array.isArray(n))return{value:n,lastInsertId:i};if(n.length>1)throw new Error(`Expected zero or one element, got ${n.length}`);return{value:n[0]??null,lastInsertId:i}}case"required":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args,r);if(io(n))throw new Error("Required value is empty");return{value:n,lastInsertId:i}}case"mapField":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.records,r);return{value:oo(n,e.args.field),lastInsertId:i}}case"join":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.parent,r);if(n===null)return{value:null,lastInsertId:i};let o=await Promise.all(e.args.children.map(async s=>({joinExpr:s,childRecords:(await this.interpretNode(s.child,r)).value})));return{value:yu(n,o,e.args.canAssumeStrictEquality),lastInsertId:i}}case"transaction":return this.#u(r,n=>this.interpretNode(e.args,n));case"dataMap":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.expr,r);return{value:Ci(n,e.args.structure,e.args.enums),lastInsertId:i}}case"validate":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.expr,r);return no(n,e.args.rules,e.args),{value:n,lastInsertId:i}}case"if":{let{value:n}=await this.interpretNode(e.args.value,r);return In(n,e.args.rule)?await this.interpretNode(e.args.then,r):await this.interpretNode(e.args.else,r)}case"diff":{let{value:n}=await this.interpretNode(e.args.from,r),{value:i}=await this.interpretNode(e.args.to,r),o=a=>a!==null?Et(Pt(a),e.args.fields):null,s=new Set(Zt(i).map(o));return{value:Zt(n).filter(a=>!s.has(o(a)))}}case"process":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.expr,r),o=On(e.args.operations);return so(o,r.scope,r.generators),{value:Cr(n,o),lastInsertId:i}}case"initializeRecord":{let{lastInsertId:n}=await this.interpretNode(e.args.expr,r),i={};for(let[o,s]of Object.entries(e.args.fields))i[o]=hu(s,n,r.scope,r.generators);return{value:i,lastInsertId:n}}case"mapRecord":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.expr,r),o=n===null?{}:Pt(n);for(let[s,a]of Object.entries(e.args.fields))o[s]=wu(a,o[s],r.scope,r.generators);return{value:o,lastInsertId:i}}default:return this.#n(e,r.scope,r.generators)}}#n(e,r,n){switch(e.type){case"value":return{value:Ne(e.args,r,n),lastInsertId:e.lastInsertId};case"seq":{let i;for(let o of e.args)i=this.#n(o,r,n);return i??{value:void 0}}case"get":return{value:r[e.args.name]};case"let":{let i=Object.create(r);for(let o of e.args.bindings){let{value:s}=this.#n(o.expr,i,n);i[o.name]=s}return this.#n(e.args.expr,i,n)}case"getFirstNonEmpty":{for(let i of e.args.names){let o=r[i];if(!io(o))return{value:o}}return{value:[]}}case"concat":{let i=e.args.map(o=>this.#n(o,r,n).value);return{value:i.length>0?i.reduce((o,s)=>o.concat(Zt(s)),[]):[]}}case"sum":{let i=e.args.map(o=>this.#n(o,r,n).value);return{value:i.length>0?i.reduce((o,s)=>Ve(o)+Ve(s)):0}}case"reverse":{let{value:i,lastInsertId:o}=this.#n(e.args,r,n);return{value:Array.isArray(i)?i.reverse():i,lastInsertId:o}}case"unique":{let{value:i,lastInsertId:o}=this.#n(e.args,r,n);if(!Array.isArray(i))return{value:i,lastInsertId:o};if(i.length>1)throw new Error(`Expected zero or one element, got ${i.length}`);return{value:i[0]??null,lastInsertId:o}}case"required":{let{value:i,lastInsertId:o}=this.#n(e.args,r,n);if(io(i))throw new Error("Required value is empty");return{value:i,lastInsertId:o}}case"mapField":{let{value:i,lastInsertId:o}=this.#n(e.args.records,r,n);return{value:oo(i,e.args.field),lastInsertId:o}}case"join":{let{value:i,lastInsertId:o}=this.#n(e.args.parent,r,n);if(i===null)return{value:null,lastInsertId:o};let s=e.args.children.map(a=>({joinExpr:a,childRecords:this.#n(a.child,r,n).value}));return{value:yu(i,s,e.args.canAssumeStrictEquality),lastInsertId:o}}case"dataMap":{let{value:i,lastInsertId:o}=this.#n(e.args.expr,r,n);return{value:Ci(i,e.args.structure,e.args.enums),lastInsertId:o}}case"validate":{let{value:i,lastInsertId:o}=this.#n(e.args.expr,r,n);return no(i,e.args.rules,e.args),{value:i,lastInsertId:o}}case"if":{let{value:i}=this.#n(e.args.value,r,n);return In(i,e.args.rule)?this.#n(e.args.then,r,n):this.#n(e.args.else,r,n)}case"unit":return{value:void 0};case"diff":{let{value:i}=this.#n(e.args.from,r,n),{value:o}=this.#n(e.args.to,r,n),s=m=>m!==null?Et(Pt(m),e.args.fields):null,a=new Set(Zt(o).map(s));return{value:Zt(i).filter(m=>!a.has(s(m)))}}case"process":{let{value:i,lastInsertId:o}=this.#n(e.args.expr,r,n),s=On(e.args.operations);return so(s,r,n),{value:Cr(i,s),lastInsertId:o}}case"initializeRecord":{let{lastInsertId:i}=this.#n(e.args.expr,r,n),o={};for(let[s,a]of Object.entries(e.args.fields))o[s]=hu(a,i,r,n);return{value:o,lastInsertId:i}}case"mapRecord":{let{value:i,lastInsertId:o}=this.#n(e.args.expr,r,n),s=i===null?{}:Pt(i);for(let[a,m]of Object.entries(e.args.fields))s[a]=wu(m,s[a],r,n);return{value:s,lastInsertId:o}}default:Z(e,`Unexpected node type: ${e.type}`)}}#l(e,r,n){return e<=1?n(r):this.#u(r,n)}async#u(e,r){if(!e.transactionManager.enabled)return r(e);let n=e.transactionManager.manager,i=await n.startInternalTransaction(),o=await n.getTransaction(i,"query");try{let s=await r({...e,queryable:o,transactionManager:{enabled:!1}});return await n.commitTransaction(i.id),s}catch(s){try{await n.rollbackTransaction(i.id)}catch(a){Wd("failed to roll back an internal transaction",a)}throw s}}#p(){return this.#a?.maxBindValues!==void 0?this.#a.maxBindValues:this.#c()}#c(){if(this.#s!==void 0)switch(this.#s){case"cockroachdb":case"postgres":case"postgresql":case"prisma+postgres":return 32766;case"mysql":return 65535;case"sqlite":return 999;case"sqlserver":return 2098;case"mongodb":return;default:Z(this.#s,`Unexpected provider: ${this.#s}`)}}#d(e,r,n){return xn({query:e,execute:n,provider:this.#s??r.provider,tracingHelper:this.#r,onQuery:this.#e})}};function io(t){return Array.isArray(t)?t.length===0:t==null}function Zt(t){return Array.isArray(t)?t:[t]}function Ve(t){if(typeof t=="number")return t;if(typeof t=="string")return Number(t);throw new Error(`Expected number, got ${typeof t}`)}function Pt(t){if(typeof t=="object"&&t!==null)return t;throw new Error(`Expected object, got ${typeof t}`)}function oo(t,e){return Array.isArray(t)?t.map(r=>oo(r,e)):typeof t=="object"&&t!==null?t[e]??null:t}function yu(t,e,r){for(let{joinExpr:n,childRecords:i}of e){let o=n.on.map(([E])=>E),s=n.on.map(([,E])=>E),a={},m=Array.isArray(t)?t:[t];for(let E of m){let N=Pt(E),$=Et(N,o);a[$]||(a[$]=[]),a[$].push(N),n.isRelationUnique?N[n.parentField]=null:N[n.parentField]=[]}let y=r?void 0:Kd(m,o);for(let E of Array.isArray(i)?i:[i]){if(E===null)continue;let N=Et(Pt(E),s,y);for(let $ of a[N]??[])n.isRelationUnique?$[n.parentField]=E:$[n.parentField].push(E)}}return t}function Kd(t,e){function r(o){switch(o){case"number":return Number;case"string":return String;case"boolean":return Boolean;case"bigint":return BigInt;default:return}}let n=Array.from({length:e.length}),i=0;for(let o of t){let s=Pt(o);for(let[a,m]of e.entries())if(s[m]!==null&&n[a]===void 0){let y=r(typeof s[m]);y!==void 0&&(n[a]=y),i++}if(i===e.length)break}return n}function hu(t,e,r,n){switch(t.type){case"value":return Ne(t.value,r,n);case"lastInsertId":return e;default:Z(t,`Unexpected field initializer type: ${t.type}`)}}function wu(t,e,r,n){switch(t.type){case"set":return Ne(t.value,r,n);case"add":return Ve(e)+Ve(Ne(t.value,r,n));case"subtract":return Ve(e)-Ve(Ne(t.value,r,n));case"multiply":return Ve(e)*Ve(Ne(t.value,r,n));case"divide":{let i=Ve(e),o=Ve(Ne(t.value,r,n));return o===0?null:i/o}default:Z(t,`Unexpected field operation type: ${t.type}`)}}function Xd(t,e){let r=kr(t);if(r)return e(r).then(n=>{let i={type:"value",args:n.value,lastInsertId:n.lastInsertId},o=Or(t,r,i);if(!o)throw new Error("Could not substitute the evaluated impure node into the query plan");return o})}function Or(t,e,r){if(t===e)return r;switch(t.type){case"seq":case"sum":case"concat":{for(let n=0;n<t.args.length;n++){let i=Or(t.args[n],e,r);if(i)return{...t,args:t.args.map((o,s)=>s===n?i:o)}}return}case"dataMap":case"validate":case"initializeRecord":case"mapRecord":case"process":{let n=Or(t.args.expr,e,r);return n&&{...t,args:{...t.args,expr:n}}}case"mapField":{let n=Or(t.args.records,e,r);return n&&{...t,args:{...t.args,records:n}}}case"reverse":case"unique":case"required":{let n=Or(t.args,e,r);return n&&{...t,args:n}}default:return}}function kr(t){switch(t.type){case"query":case"execute":return t;case"seq":case"sum":case"concat":{let e;for(let r of t.args){let n=kr(r);if(n===null)return null;if(n){if(e)return null;e=n}}return e}case"dataMap":case"validate":case"initializeRecord":case"mapRecord":case"process":return kr(t.args.expr);case"mapField":return kr(t.args.records);case"reverse":case"unique":case"required":return kr(t.args);case"let":case"join":case"diff":case"if":case"transaction":return null;case"value":case"get":case"getFirstNonEmpty":case"unit":return;default:Z(t,`Unexpected node type: ${t.type}`)}}function bu(t,e){if(!e||e.plugins.length===0)return t;let r=Oa(e.plugins,{query:e.queryInfo,sql:t.sql});return r?{...t,sql:ka(t.sql,r)}:t}function so(t,e,r){let n=t.pagination?.cursor;if(n)for(let[i,o]of Object.entries(n))n[i]=Ne(o,e,r);for(let i of Object.values(t.nested))so(i,e,r)}function On(t){return _e(t)}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function xu(t){return new ao(t).deserialize()}function Zd(t){return w.from(t,"base64url")}var ao=class{#e;#t;#r=0;constructor(e){this.#e=e;let r=Zd(e.graph);this.#t=new DataView(r.buffer,r.byteOffset,r.byteLength)}deserialize(){let{inputNodeCount:e,outputNodeCount:r,rootCount:n}=this.#n(),i=this.#l(e),o=this.#u(r),s=this.#p(n);return{strings:this.#e.strings,inputNodes:i,outputNodes:o,roots:s}}#i(){let e=0,r=0,n;do n=this.#t.getUint8(this.#r++),e|=(n&127)<<r,r+=7;while(n>=128);return e}#o(){let e=this.#i();return e===0?void 0:e-1}#s(){let e=this.#t.getUint8(this.#r);return this.#r+=1,e}#a(){let e=this.#t.getUint16(this.#r,!0);return this.#r+=2,e}#n(){let e=this.#i(),r=this.#i(),n=this.#i();return{inputNodeCount:e,outputNodeCount:r,rootCount:n}}#l(e){let r=[];for(let n=0;n<e;n++){let i=this.#i(),o={};for(let s=0;s<i;s++){let a=this.#i(),m=this.#a(),y=this.#o(),E=this.#o(),$={flags:this.#s()};m!==0&&($.scalarMask=m),y!==void 0&&($.childNodeId=y),E!==void 0&&($.enumNameIndex=E),o[a]=$}r.push({edges:o})}return r}#u(e){let r=[];for(let n=0;n<e;n++){let i=this.#i(),o={};for(let s=0;s<i;s++){let a=this.#i(),m=this.#o(),y=this.#o(),E={};m!==void 0&&(E.argsNodeId=m),y!==void 0&&(E.outputNodeId=y),o[a]=E}r.push({edges:o})}return r}#p(e){let r={};for(let n=0;n<e;n++){let i=this.#i(),o=this.#o(),s=this.#o(),a=this.#e.strings[i],m={};o!==void 0&&(m.argsNodeId=o),s!==void 0&&(m.outputNodeId=s),r[a]=m}return r}};var Dr=class t{#e;#t;#r;constructor(e,r){this.#e=e,this.#r=r,this.#t=new Map;for(let n=0;n<e.strings.length;n++)this.#t.set(e.strings[n],n)}static deserialize(e,r){let n=xu(e);return new t(n,r)}static fromData(e,r){return new t(e,r)}root(e){let r=this.#e.roots[e];if(r)return{argsNodeId:r.argsNodeId,outputNodeId:r.outputNodeId}}inputNode(e){if(!(e===void 0||e<0||e>=this.#e.inputNodes.length))return{id:e}}outputNode(e){if(!(e===void 0||e<0||e>=this.#e.outputNodes.length))return{id:e}}inputEdge(e,r){if(!e)return;let n=this.#e.inputNodes[e.id];if(!n)return;let i=this.#t.get(r);if(i===void 0)return;let o=n.edges[i];if(o)return{flags:o.flags,childNodeId:o.childNodeId,scalarMask:o.scalarMask??0,enumNameIndex:o.enumNameIndex}}outputEdge(e,r){if(!e)return;let n=this.#e.outputNodes[e.id];if(!n)return;let i=this.#t.get(r);if(i===void 0)return;let o=n.edges[i];if(o)return{argsNodeId:o.argsNodeId,outputNodeId:o.outputNodeId}}enumValues(e){if(e?.enumNameIndex===void 0)return;let r=this.#e.strings[e.enumNameIndex];if(r)return this.#r(r)}getString(e){return this.#e.strings[e]}},Ze={ParamScalar:1,ParamEnum:2,ParamListScalar:4,ParamListEnum:8,ListObject:16,Object:32},Ee={String:1,Int:2,BigInt:4,Float:8,Decimal:16,Boolean:32,DateTime:64,Json:128,Bytes:256};function Ye(t,e){return(t.flags&e)!==0}function pt(t){return t.scalarMask}u();l();c();p();d();var Yd=new Set(["DateTime","Decimal","BigInt","Bytes","Json","Raw"]);function kn(t){if(t==null)return{kind:"null"};if(typeof t=="string")return{kind:"primitive",value:t};if(typeof t=="number")return{kind:"primitive",value:t};if(typeof t=="boolean")return{kind:"primitive",value:t};if(Array.isArray(t))return{kind:"array",items:t};if(typeof t=="object"){let e=t;if("$type"in e&&typeof e.$type=="string"){let r=e.$type;return Yd.has(r)?{kind:"taggedScalar",tag:r,value:e.value}:{kind:"structural",value:e.value}}return{kind:"object",entries:e}}return{kind:"structural",value:t}}function Eu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&!("$type"in t)}function Pu(t){return typeof t=="object"&&t!==null&&"$type"in t&&typeof t.$type=="string"}function uo(t,e){let r=new Nn(e),n=t.modelName?`${t.modelName}.${t.action}`:t.action,i=e.root(n);return{parameterizedQuery:{...t,query:r.parameterizeFieldSelection(t.query,i?.argsNodeId,i?.outputNodeId)},placeholderValues:r.getPlaceholderValues()}}function lo(t,e){let r=new Nn(e),n=[];for(let i=0;i<t.batch.length;i++){let o=t.batch[i],s=o.modelName?`${o.modelName}.${o.action}`:o.action,a=e.root(s);n.push({...o,query:r.parameterizeFieldSelection(o.query,a?.argsNodeId,a?.outputNodeId)})}return{parameterizedBatch:{...t,batch:n},placeholderValues:r.getPlaceholderValues()}}var Nn=class{#e;#t=new Map;#r=new Map;#i=1;constructor(e){this.#e=e}getPlaceholderValues(){return Object.fromEntries(this.#t)}#o(e,r){let n=tm(e,r),i=this.#r.get(n);if(i!==void 0)return Tu(i,r);let o=`%${this.#i++}`;return this.#r.set(n,o),this.#t.set(o,e),Tu(o,r)}parameterizeFieldSelection(e,r,n){let i=this.#e.inputNode(r),o=this.#e.outputNode(n),s={...e};return e.arguments&&e.arguments.$type!=="Raw"&&(s.arguments=this.#s(e.arguments,i)),e.selection&&(s.selection=this.#c(e.selection,o)),s}#s(e,r){if(!r)return e;let n={};for(let[i,o]of Object.entries(e)){let s=this.#e.inputEdge(r,i);s?n[i]=this.#a(o,s):n[i]=o}return n}#a(e,r){let n=kn(e);switch(n.kind){case"null":return e;case"structural":return e;case"primitive":return this.#n(n.value,r);case"taggedScalar":return this.#l(e,n.tag,r);case"array":return this.#u(n.items,e,r);case"object":return this.#p(n.entries,r);default:throw new Error(`Unknown value kind ${n.kind}`)}}#n(e,r){if(Ye(r,Ze.ParamEnum)&&r.enumNameIndex!==void 0&&typeof e=="string"){let o=this.#e.enumValues(r);if(o&&Object.hasOwn(o,e)){let s={type:"Enum"};return this.#o(o[e],s)}}if(!Ye(r,Ze.ParamScalar))return e;let n=pt(r);if(n===0)return e;let i=co(e);return Su(i,n)?(n&Ee.Json&&(e=JSON.stringify(e)),this.#o(e,i)):e}#l(e,r,n){if(!Ye(n,Ze.ParamScalar))return e;let i=pt(n);if(i===0||!Ru(r,i))return e;let o=Au(e.$type),s=Cu(e);return this.#o(s,o)}#u(e,r,n){if(Ye(n,Ze.ParamScalar)&&pt(n)&Ee.Json){let i=Be(Xe(e)),o={type:"Json"};return this.#o(i,o)}if(Ye(n,Ze.ParamEnum)){let i=this.#e.enumValues(n);if(i&&e.every(o=>typeof o=="string"&&Object.hasOwn(i,o))){let o={type:"List",inner:{type:"Enum"}};return this.#o(e,o)}}if(Ye(n,Ze.ParamListScalar)&&e.every(o=>sm(o,n))&&e.length>0){let o=e.map(m=>am(m)),a={type:"List",inner:im(e)};return this.#o(o,a)}if(Ye(n,Ze.ListObject)){let i=this.#e.inputNode(n.childNodeId);if(i)return e.map(o=>Eu(o)?this.#s(o,i):o)}return r}#p(e,r){if(Ye(r,Ze.Object)){let i=this.#e.inputNode(r.childNodeId);if(i)return this.#s(e,i)}if(pt(r)&Ee.Json){let i=Be(Xe(e)),o={type:"Json"};return this.#o(i,o)}return e}#c(e,r){if(!e||!r)return e;let n={};for(let[i,o]of Object.entries(e)){if(i==="$scalars"||i==="$composites"||typeof o=="boolean"){n[i]=o;continue}let s=this.#e.outputEdge(r,i);if(s){let a=o,m=this.#e.inputNode(s.argsNodeId),y=this.#e.outputNode(s.outputNodeId),E={selection:a.selection?this.#c(a.selection,y):{}};a.arguments&&(E.arguments=this.#s(a.arguments,m)),n[i]=E}else n[i]=o}return n}};function Tu(t,e){return{$type:"Param",value:{name:t,...e}}}function vu(t){return t.type==="List"?`List<${vu(t.inner)}>`:t.type}function em(t){return ArrayBuffer.isView(t)?w.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"):JSON.stringify(t)}function tm(t,e){let r=vu(e),n=em(t);return`${r}:${n}`}var rm=2**31-1,nm=-(2**31);function co(t){switch(typeof t){case"boolean":return{type:"Boolean"};case"number":return Number.isInteger(t)?nm<=t&&t<=rm?{type:"Int"}:{type:"BigInt"}:{type:"Float"};case"string":return{type:"String"};default:throw new Error("unreachable")}}function Su({type:t},e){switch(t){case"Boolean":return(e&Ee.Boolean)!==0;case"Int":return(e&(Ee.Int|Ee.BigInt|Ee.Float))!==0;case"BigInt":return(e&Ee.BigInt)!==0;case"Float":return(e&Ee.Float)!==0;case"String":return(e&Ee.String)!==0;default:return!1}}function Au(t){switch(t){case"BigInt":case"Bytes":case"DateTime":case"Json":return{type:t};case"Decimal":return{type:"Float"};default:return}}function im(t){let e={type:"Any"};for(let r of t){let n=kn(r),i;switch(n.kind){case"primitive":i=co(n.value);break;case"taggedScalar":i=Au(n.tag)??{type:"Any"};break;default:return{type:"Any"}}e=om(e,i)}return e}function om(t,e){if(t.type==="Any")return e;if(e.type==="Any"||t.type===e.type)return t;let r={Int:0,BigInt:1,Float:2},n=r[t.type],i=r[e.type];return n!==void 0&&i!==void 0?n>=i?t:e:{type:"Any"}}function Ru(t,e){switch(t){case"DateTime":return(e&Ee.DateTime)!==0;case"Decimal":return(e&Ee.Decimal)!==0;case"BigInt":return(e&Ee.BigInt)!==0;case"Bytes":return(e&Ee.Bytes)!==0;case"Json":return(e&Ee.Json)!==0;default:return!1}}function sm(t,e){let r=kn(t);switch(r.kind){case"structural":return!1;case"null":return!1;case"primitive":{let n=co(r.value),i=pt(e);return i!==0&&Su(n,i)}case"taggedScalar":{let n=pt(e);return n!==0&&Ru(r.tag,n)}default:return!1}}function am(t){return Pu(t)?Cu(t):t}function Cu(t){return t.value}u();l();c();p();d();u();l();c();p();d();async function um(){return globalThis.crypto??await Promise.resolve().then(()=>(Jr(),as))}async function Iu(){return(await um()).randomUUID()}u();l();c();p();d();async function Ou(t,e){return new Promise(r=>{t.addEventListener(e,r,{once:!0})})}u();l();c();p();d();var Ie=class extends he{name="TransactionManagerError";constructor(e,r){super("Transaction API error: "+e,"P2028",r)}},Tt=class extends Ie{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.")}},Dn=class extends Ie{constructor(e){super(`Transaction already closed: A ${e} cannot be executed on a committed transaction.`)}},Mn=class extends Ie{constructor(e){super(`Transaction already closed: A ${e} cannot be executed on a transaction that was rolled back.`)}},Mr=class extends Ie{constructor(){super("Unable to start a transaction in the given time.")}},Ln=class extends Ie{constructor(e,{timeout:r,timeTaken:n}){super(`A ${e} 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:e,timeout:r,timeTaken:n})}},et=class extends Ie{constructor(e){super(`Internal Consistency Error: ${e}`)}},_n=class extends Ie{constructor(e){super(`Invalid isolation level: ${e}`,{isolationLevel:e})}};var lm=100,cm=2e3;function pm(){let t,e=new Promise(r=>{t=r});return{abortController:new AbortController,settled:e,markSettled:t}}var vt=be("prisma:client:transactionManager"),dm=()=>({sql:"COMMIT",args:[],argTypes:[]}),ku=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),mm=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),fm=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),Lr=class{transactions=new Map;closedTransactions=[];#e=new Set;driverAdapter;transactionOptions;tracingHelper;#t;#r;constructor({driverAdapter:e,transactionOptions:r,tracingHelper:n,onQuery:i,provider:o}){this.driverAdapter=e,this.transactionOptions=r,this.tracingHelper=n,this.#t=i,this.#r=o}async startInternalTransaction(e){let r=e!==void 0?this.#y(e):{};return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#i(r))}async startTransaction(e){let r=e!==void 0?this.#y(e):this.transactionOptions;return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#i(r))}async#i(e){if(e.newTxId)return await this.#d(e.newTxId,"start",async o=>{if(o.status!=="running")throw new et(`Transaction in invalid state ${o.status} when starting a nested transaction.`);if(!o.transaction)throw new et("Transaction missing underlying driver transaction when starting a nested transaction.");o.depth+=1;let s=this.#a(o);o.savepoints.push(s);try{await this.#n(o.transaction)(s)}catch(a){throw o.depth-=1,o.savepoints.pop(),a}return{id:o.id}});let r=pm(),{abortController:n}=r;this.#e.add(r);let i;try{let o={id:await Iu(),status:"waiting",timer:void 0,timeout:e.timeout,startedAt:Date.now(),transaction:void 0,operationQueue:Promise.resolve(),depth:1,savepoints:[],savepointCounter:0};if(n.signal.aborted)throw new Mr;let s=Nu(()=>n.abort(),e.maxWait);s?.unref?.();let a=this.driverAdapter.startTransaction(e.isolationLevel).catch(lt);switch(o.transaction=await Promise.race([a.finally(()=>clearTimeout(s)),Ou(n.signal,"abort").then(()=>{})]),this.transactions.set(o.id,o),o.status){case"waiting":if(n.signal.aborted)throw o.transaction=void 0,i=this.#o(a),await this.#f(o,"timed_out"),new Mr;return o.status="running",o.startedAt=Date.now(),o.timer=this.#c(o.id,e.timeout),{id:o.id};case"timed_out":case"running":case"committed":case"rolled_back":throw new et(`Transaction in invalid state ${o.status} although it just finished startup.`);default:return Z(o.status,"Unknown transaction status.")}}finally{this.#e.delete(r),i?i.finally(r.markSettled):r.markSettled()}}async#o(e){try{let r=await e;if(r.options.usePhantomQuery)await r.rollback();else try{await r.executeRaw(ku())}finally{await r.rollback()}}catch(r){vt("error in discarded transaction:",r)}}async commitTransaction(e){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{await this.#d(e,"commit",async r=>{if(r.depth>1){if(!r.transaction)throw new Tt;let n=r.savepoints.at(-1);if(!n)throw new et(`Missing savepoint for nested commit. Depth: ${r.depth}, transactionId: ${r.id}`);try{await this.#u(r.transaction,n)}finally{r.savepoints.pop(),r.depth-=1}return}await this.#f(r,"committed")})})}async rollbackTransaction(e){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{await this.#d(e,"rollback",async r=>{if(r.depth>1){if(!r.transaction)throw new Tt;let n=r.savepoints.at(-1);if(!n)throw new et(`Missing savepoint for nested rollback. Depth: ${r.depth}, transactionId: ${r.id}`);try{await this.#l(r.transaction)(n),await this.#u(r.transaction,n)}finally{r.savepoints.pop(),r.depth-=1}return}await this.#f(r,"rolled_back")})})}async getTransaction(e,r){let n=this.#s(e.id,r);if(n.status==="closing"&&(await n.closing,n=this.#s(e.id,r)),!n.transaction)throw new Tt;return n.transaction}#s(e,r){let n=this.transactions.get(e);if(!n){let i=this.closedTransactions.find(o=>o.id===e);if(i)switch(vt("Transaction already closed.",{transactionId:e,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new et("Active transaction found in closed transactions list.");case"committed":throw new Dn(r);case"rolled_back":throw new Mn(r);case"timed_out":throw new Ln(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw vt("Transaction not found.",e),new Tt}if(["committed","rolled_back","timed_out"].includes(n.status))throw new et("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){let e=[...this.#e];for(let{abortController:r}of e)r.abort();await Promise.allSettled([...[...this.transactions.values()].map(r=>this.#m(r,async()=>{let n=this.transactions.get(r.id);n&&await this.#f(n,"rolled_back")})),...e.map(({settled:r})=>gm(r,cm))])}#a(e){return`prisma_sp_${e.savepointCounter++}`}#n(e){if(e.createSavepoint)return e.createSavepoint.bind(e);throw new Ie(`Nested transactions are not supported by adapter "${e.adapterName}" (${e.provider}): createSavepoint is not implemented.`)}#l(e){if(e.rollbackToSavepoint)return e.rollbackToSavepoint.bind(e);throw new Ie(`Nested transactions are not supported by adapter "${e.adapterName}" (${e.provider}): rollbackToSavepoint is not implemented.`)}async#u(e,r){e.releaseSavepoint&&await e.releaseSavepoint(r)}#p(e){vt("Transaction already committed or rolled back when timeout happened.",e)}#c(e,r){let n=Date.now(),i=Nu(async()=>{try{vt("Transaction timed out.",{transactionId:e,timeoutStartedAt:n,timeout:r});let o=this.transactions.get(e);if(!o){this.#p(e);return}await this.#m(o,async()=>{let s=this.transactions.get(e);s&&["running","waiting"].includes(s.status)?await this.#f(s,"timed_out"):this.#p(e)})}catch(o){vt("Error while closing timed-out transaction.",{transactionId:e,error:o})}},r);return i?.unref?.(),i}async#d(e,r,n){let i=this.#s(e,r);return await this.#m(i,async()=>{let o=this.#s(e,r);return await n(o)})}async#m(e,r){let n=e.operationQueue,i;e.operationQueue=new Promise(o=>{i=o}),await n;try{return await r()}finally{i()}}async#f(e,r){let n=async()=>{vt("Closing transaction.",{transactionId:e.id,status:r});try{if(e.transaction&&r==="committed")if(e.transaction.options.usePhantomQuery)await this.#g(mm(),e.transaction,()=>e.transaction.commit());else{let i=dm();await this.#g(i,e.transaction,()=>e.transaction.executeRaw(i)).then(()=>e.transaction.commit(),o=>{let s=()=>Promise.reject(o);return e.transaction.rollback().then(s,s)})}else if(e.transaction)if(e.transaction.options.usePhantomQuery)await this.#g(fm(),e.transaction,()=>e.transaction.rollback());else{let i=ku();try{await this.#g(i,e.transaction,()=>e.transaction.executeRaw(i))}finally{await e.transaction.rollback()}}}finally{e.status=r,clearTimeout(e.timer),e.timer=void 0,this.transactions.delete(e.id),this.closedTransactions.push(e),this.closedTransactions.length>lm&&this.closedTransactions.shift()}};e.status==="closing"?(await e.closing,this.#s(e.id,r==="committed"?"commit":"rollback")):await Object.assign(e,{status:"closing",reason:r,closing:n()}).closing}#y(e){if(!e.timeout)throw new Ie("timeout is required");if(!e.maxWait)throw new Ie("maxWait is required");if(e.isolationLevel==="SNAPSHOT")throw new _n(e.isolationLevel);return{...e,timeout:e.timeout,maxWait:e.maxWait}}#g(e,r,n){return xn({query:e,execute:n,provider:this.#r??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#t})}};function Nu(t,e){return e!==void 0?setTimeout(t,e):void 0}function gm(t,e){let r,n=new Promise(i=>{r=setTimeout(i,e),r?.unref?.()});return Promise.race([t,n]).finally(()=>clearTimeout(r))}import{PrismaClientInitializationError as go,PrismaClientKnownRequestError as yo,PrismaClientRustPanicError as _r,PrismaClientUnknownRequestError as Xu}from"@prisma/client-runtime-utils";var Fn="7.10.0-dev.40";u();l();c();p();d();var Du={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function Lu(t){let e;try{e=JSON.parse(t)}catch(i){throw new Error(`Received invalid serialized parameters: ${i.message}`)}if(!Array.isArray(e))throw new Error("Received invalid serialized parameters: expected an array");let r=e.map(i=>_u(i)),n=e.map(i=>hm(i));return{args:r,argTypes:n}}function _u(t){if(Array.isArray(t))return t.map(e=>_u(e));if(typeof t=="object"&&t!==null&&"prisma__value"in t){if(!("prisma__type"in t))throw new Error("Invalid serialized parameter, prisma__type should be present when prisma__value is present");return`${t.prisma__value}`}return typeof t=="object"&&t!==null?JSON.stringify(t):t}function hm(t){return Array.isArray(t)?{scalarType:t.length>0?Mu(t[0]):"unknown",arity:"list"}:{scalarType:Mu(t),arity:"scalar"}}function Mu(t){return typeof t=="object"&&t!==null&&"prisma__type"in t&&typeof t.prisma__type=="string"&&t.prisma__type in Du?Du[t.prisma__type]:typeof t=="number"?"decimal":typeof t=="string"?"string":"unknown"}u();l();c();p();d();function Fu(t,e){return{batch:t,transaction:e?.kind==="batch"?{isolationLevel:e.options.isolationLevel}:void 0}}u();l();c();p();d();u();l();c();p();d();function $u(t){return t?t.replace(/"(?:[^"\\]|\\.)*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,e=>`${e[0]}5`):""}u();l();c();p();d();function Uu(t){return t.split(`
6
+ `)}};function Qt(t){return new pi(Ms(t))}function Ms(t){let e=new qt;for(let[r,n]of Object.entries(t)){let i=new nn(r,Ls(n));e.addField(i)}return e}function Ls(t){if(typeof t=="string")return new ye(JSON.stringify(t));if(typeof t=="number"||typeof t=="boolean")return new ye(String(t));if(typeof t=="bigint")return new ye(`${t}n`);if(t===null)return new ye("null");if(t===void 0)return new ye("undefined");if(Ft(t))return new ye(`new Prisma.Decimal("${t.toFixed()}")`);if(t instanceof Uint8Array)return w.isBuffer(t)?new ye(`Buffer.alloc(${t.byteLength})`):new ye(`new Uint8Array(${t.byteLength})`);if(t instanceof Date){let e=_t(t)?t.toISOString():"Invalid Date";return new ye(`new Date("${e}")`)}return $c(t)?new ye(`Prisma.${t._getName()}`):jt(t)?new ye(`prisma.${st(t.modelName)}.$fields.${t.name}`):Array.isArray(t)?Uc(t):typeof t=="object"?Ms(t):new ye(Object.prototype.toString.call(t))}function Uc(t){let e=new Vt;for(let r of t)e.addItem(Ls(r));return e}function on(t,e){let r=e==="pretty"?As:tn,n=t.renderAllMessages(r),i=new $t(0,{colors:r}).write(t).toString();return{message:n,args:i}}function sn({args:t,errors:e,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=Qt(t);for(let N of e)Zr(N,a,s);let{message:m,args:y}=on(a,r),E=Xr({message:m,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:y});throw new Vc(E,{clientVersion:o})}u();l();c();p();d();u();l();c();p();d();function Ke(t){return t.replace(/^./,e=>e.toLowerCase())}u();l();c();p();d();function Fs(t,e,r){let n=Ke(r);return!e.result||!(e.result.$allModels||e.result[n])?t:qc({...t,..._s(e.name,t,e.result.$allModels),..._s(e.name,t,e.result[n])})}function qc(t){let e=new ze,r=(n,i)=>e.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),t[n]?t[n].needs.flatMap(o=>r(o,i)):[n]));return Wr(t,n=>({...n,needs:r(n.name,new Set)}))}function _s(t,e,r){return r?Wr(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Bc(e,o,i)})):{}}function Bc(t,e,r){let n=t?.[e]?.compute;return n?(i,o)=>r({...i,[e]:n(i,o)},o):r}function $s(t,e){if(!e)return t;let r={...t};for(let n of Object.values(e))if(t[n.name])for(let i of n.needs)r[i]=!0;return r}function Us(t,e){if(!e)return t;let r={...t};for(let n of Object.values(e))if(!t[n.name])for(let i of n.needs)delete r[i];return r}var an=class{constructor(e,r){this.extension=e;this.previous=r}computedFieldsCache=new ze;modelExtensionsCache=new ze;queryCallbacksCache=new ze;clientExtensions=or(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=or(()=>{let e=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?e.concat(r):e});getAllComputedFields(e){return this.computedFieldsCache.getOrCreate(e,()=>Fs(this.previous?.getAllComputedFields(e),this.extension,e))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(e){return this.modelExtensionsCache.getOrCreate(e,()=>{let r=Ke(e);return!this.extension.model||!(this.extension.model[r]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(e):{...this.previous?.getAllModelExtensions(e),...this.extension.model.$allModels,...this.extension.model[r]}})}getAllQueryCallbacks(e,r){return this.queryCallbacksCache.getOrCreate(`${e}:${r}`,()=>{let n=this.previous?.getAllQueryCallbacks(e,r)??[],i=[],o=this.extension.query;return!o||!(o[e]||o.$allModels||o[r]||o.$allOperations)?n:(o[e]!==void 0&&(o[e][r]!==void 0&&i.push(o[e][r]),o[e].$allOperations!==void 0&&i.push(o[e].$allOperations)),e!=="$none"&&o.$allModels!==void 0&&(o.$allModels[r]!==void 0&&i.push(o.$allModels[r]),o.$allModels.$allOperations!==void 0&&i.push(o.$allModels.$allOperations)),o[r]!==void 0&&i.push(o[r]),o.$allOperations!==void 0&&i.push(o.$allOperations),n.concat(i))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},Jt=class t{constructor(e){this.head=e}static empty(){return new t}static single(e){return new t(new an(e))}isEmpty(){return this.head===void 0}append(e){return new t(new an(e,this.head))}getAllComputedFields(e){return this.head?.getAllComputedFields(e)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(e){return this.head?.getAllModelExtensions(e)}getAllQueryCallbacks(e,r){return this.head?.getAllQueryCallbacks(e,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};u();l();c();p();d();var un=class{constructor(e){this.name=e}};function Vs(t){return t instanceof un}function jc(t){return new un(t)}u();l();c();p();d();u();l();c();p();d();var qs=Symbol(),hr=class{constructor(e){if(e!==qs)throw new Error("Skip instance can not be constructed directly")}ifUndefined(e){return e===void 0?di:e}},di=new hr(qs);function Le(t){return t instanceof hr}var Jc={findUnique:"findUnique",findUniqueOrThrow:"findUniqueOrThrow",findFirst:"findFirst",findFirstOrThrow:"findFirstOrThrow",findMany:"findMany",count:"aggregate",create:"createOne",createMany:"createMany",createManyAndReturn:"createManyAndReturn",update:"updateOne",updateMany:"updateMany",updateManyAndReturn:"updateManyAndReturn",upsert:"upsertOne",delete:"deleteOne",deleteMany:"deleteMany",executeRaw:"executeRaw",queryRaw:"queryRaw",aggregate:"aggregate",groupBy:"groupBy",runCommandRaw:"runCommandRaw",findRaw:"findRaw",aggregateRaw:"aggregateRaw"},Bs="explicitly `undefined` values are not allowed";function fi({modelName:t,action:e,args:r,runtimeDataModel:n,extensions:i=Jt.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:m,previewFeatures:y,globalOmit:E,wrapRawValues:N}){let $=new mi({runtimeDataModel:n,modelName:t,action:e,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:m,previewFeatures:y,globalOmit:E,wrapRawValues:N});return{modelName:t,action:Jc[e],query:wr(r,$)}}function wr({select:t,include:e,...r}={},n){let i=r.omit;return delete r.omit,{arguments:Qs(r,n),selection:Gc(t,e,i,n)}}function Gc(t,e,r,n){return t?(e?n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:n.getSelectionPath()}):r&&n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:n.getSelectionPath()}),Kc(t,n)):Hc(n,e,r)}function Hc(t,e,r){let n={};return t.modelOrType&&!t.isRawAction()&&(n.$composites=!0,n.$scalars=!0),e&&zc(n,e,t),Wc(n,r,t),n}function zc(t,e,r){for(let[n,i]of Object.entries(e)){if(Le(i))continue;let o=r.nestSelection(n);if(gi(i,o),i===!1||i===void 0){t[n]=!1;continue}let s=r.findField(n);if(s&&s.kind!=="object"&&r.throwValidationError({kind:"IncludeOnScalar",selectionPath:r.getSelectionPath().concat(n),outputType:r.getOutputTypeDescription()}),s){t[n]=wr(i===!0?{}:i,o);continue}if(i===!0){t[n]=!0;continue}t[n]=wr(i,o)}}function Wc(t,e,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...e},o=Us(i,n);for(let[s,a]of Object.entries(o)){if(Le(a))continue;gi(a,r.nestSelection(s));let m=r.findField(s);n?.[s]&&!m||(t[s]=!a)}}function Kc(t,e){let r={},n=e.getComputedFields(),i=$s(t,n);for(let[o,s]of Object.entries(i)){if(Le(s))continue;let a=e.nestSelection(o);gi(s,a);let m=e.findField(o);if(!(n?.[o]&&!m)){if(s===!1||s===void 0||Le(s)){r[o]=!1;continue}if(s===!0){m?.kind==="object"?r[o]=wr({},a):r[o]=!0;continue}r[o]=wr(s,a)}}return r}function js(t,e){if(t===null)return null;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t;if(typeof t=="bigint")return{$type:"BigInt",value:String(t)};if(Lt(t)){if(_t(t))return{$type:"DateTime",value:t.toISOString()};e.throwValidationError({kind:"InvalidArgumentValue",selectionPath:e.getSelectionPath(),argumentPath:e.getArgumentPath(),argument:{name:e.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(Vs(t))return{$type:"Param",value:t.name};if(jt(t))return{$type:"FieldRef",value:{_ref:t.name,_container:t.modelName}};if(Array.isArray(t))return Xc(t,e);if(ArrayBuffer.isView(t)){let{buffer:r,byteOffset:n,byteLength:i}=t;return{$type:"Bytes",value:w.from(r,n,i).toString("base64")}}if(Zc(t))return t.values;if(Ft(t))return{$type:"Decimal",value:t.toFixed()};if(Qc(t)){let r=t._getName();if(r!=="DbNull"&&r!=="JsonNull"&&r!=="AnyNull")throw new Error(`Invalid ObjectEnumValue: expected DbNull, JsonNull, or AnyNull, got ${r}`);return{$type:"Enum",value:r}}if(Yc(t))return t.toJSON();if(typeof t=="object")return Qs(t,e);e.throwValidationError({kind:"InvalidArgumentValue",selectionPath:e.getSelectionPath(),argumentPath:e.getArgumentPath(),argument:{name:e.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(t)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function Qs(t,e){if(e.shouldWrapRawValues()&&t.$type)return{$type:"Raw",value:t};let r={};for(let n in t){let i=t[n],o=e.nestArgument(n);Le(i)||(i!==void 0?r[n]=js(i,o):e.isPreviewFeatureOn("strictUndefinedChecks")&&e.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:e.getSelectionPath(),argument:{name:e.getArgumentName(),typeNames:[]},underlyingError:Bs}))}return r}function Xc(t,e){let r=[];for(let n=0;n<t.length;n++){let i=e.nestArgument(String(n)),o=t[n];if(o===void 0||Le(o)){let s=o===void 0?"undefined":"Prisma.skip";e.throwValidationError({kind:"InvalidArgumentValue",selectionPath:i.getSelectionPath(),argumentPath:i.getArgumentPath(),argument:{name:`${e.getArgumentName()}[${n}]`,typeNames:[]},underlyingError:`Can not use \`${s}\` value within array. Use \`null\` or filter out \`${s}\` values`})}r.push(js(o,i))}return r}function Zc(t){return typeof t=="object"&&t!==null&&t.__prismaRawParameters__===!0}function Yc(t){return typeof t=="object"&&t!==null&&typeof t.toJSON=="function"}function gi(t,e){t===void 0&&e.isPreviewFeatureOn("strictUndefinedChecks")&&e.throwValidationError({kind:"InvalidSelectionValue",selectionPath:e.getSelectionPath(),underlyingError:Bs})}var mi=class t{constructor(e){this.params=e;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}modelOrType;throwValidationError(e){sn({errors:[e],originalMethod:this.params.originalMethod,args:this.params.rootArgs??{},callsite:this.params.callsite,errorFormat:this.params.errorFormat,clientVersion:this.params.clientVersion,globalOmit:this.params.globalOmit})}getSelectionPath(){return this.params.selectionPath}getArgumentPath(){return this.params.argumentPath}getArgumentName(){return this.params.argumentPath[this.params.argumentPath.length-1]}getOutputTypeDescription(){if(!(!this.params.modelName||!this.modelOrType))return{name:this.params.modelName,fields:this.modelOrType.fields.map(e=>({name:e.name,typeName:"boolean",isRelation:e.kind==="object"}))}}isRawAction(){return["executeRaw","queryRaw","runCommandRaw","findRaw","aggregateRaw"].includes(this.params.action)}isPreviewFeatureOn(e){return this.params.previewFeatures.includes(e)}shouldWrapRawValues(){return this.params.wrapRawValues??!0}getComputedFields(){if(this.params.modelName)return this.params.extensions.getAllComputedFields(this.params.modelName)}findField(e){return this.modelOrType?.fields.find(r=>r.name===e)}nestSelection(e){let r=this.findField(e),n=r?.kind==="object"?r.type:void 0;return new t({...this.params,modelName:n,selectionPath:this.params.selectionPath.concat(e)})}getGlobalOmit(){return this.params.modelName&&this.shouldApplyGlobalOmit()?this.params.globalOmit?.[st(this.params.modelName)]??{}:{}}shouldApplyGlobalOmit(){switch(this.params.action){case"findFirst":case"findFirstOrThrow":case"findUniqueOrThrow":case"findMany":case"upsert":case"findUnique":case"createManyAndReturn":case"create":case"update":case"updateManyAndReturn":case"delete":return!0;case"executeRaw":case"aggregateRaw":case"runCommandRaw":case"findRaw":case"createMany":case"deleteMany":case"groupBy":case"updateMany":case"count":case"aggregate":case"queryRaw":return!1;default:rt(this.params.action,"Unknown action")}}nestArgument(e){return new t({...this.params,argumentPath:this.params.argumentPath.concat(e)})}};u();l();c();p();d();function ep(t,e){let r=or(()=>tp(e));Object.defineProperty(t,"dmmf",{get:()=>r.get()})}function tp(t){throw new Error("Prisma.dmmf is not available when running in edge runtimes.")}function yi(t){return Object.entries(t).map(([e,r])=>({name:e,...r}))}u();l();c();p();d();var hi=new WeakMap,ln="$$PrismaTypedSql",br=class{constructor(e,r){hi.set(this,{sql:e,values:r}),Object.defineProperty(this,ln,{value:ln})}get sql(){return hi.get(this).sql}get values(){return hi.get(this).values}};function rp(t){return(...e)=>new br(t,e)}function cn(t){return t!=null&&t[ln]===ln}u();l();c();p();d();import{Sql as zm}from"@prisma/client-runtime-utils";u();l();c();p();d();Js();u();l();c();p();d();u();l();c();p();d();function xr(t){return{getKeys(){return Object.keys(t)},getPropertyValue(e){return t[e]}}}u();l();c();p();d();function Se(t,e){return{getKeys(){return[t]},getPropertyValue(){return e()}}}u();l();c();p();d();function gt(t){let e=new ze;return{getKeys(){return t.getKeys()},getPropertyValue(r){return e.getOrCreate(r,()=>t.getPropertyValue(r))},getPropertyDescriptor(r){return t.getPropertyDescriptor?.(r)}}}u();l();c();p();d();u();l();c();p();d();var dn={enumerable:!0,configurable:!0,writable:!0};function mn(t){let e=new Set(t);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>dn,has:(r,n)=>e.has(n),set:(r,n,i)=>e.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...e]}}var Gs=Symbol.for("nodejs.util.inspect.custom");function qe(t,e){let r=np(e),n=new Set,i=new Proxy(t,{get(o,s){if(n.has(s))return o[s];let a=r.get(s);return a?a.getPropertyValue(s):o[s]},has(o,s){if(n.has(s))return!0;let a=r.get(s);return a?a.has?.(s)??!0:Reflect.has(o,s)},ownKeys(o){let s=Hs(Reflect.ownKeys(o),r),a=Hs(Array.from(r.keys()),r);return[...new Set([...s,...a,...n])]},set(o,s,a){return r.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(n.add(s),Reflect.set(o,s,a))},getOwnPropertyDescriptor(o,s){let a=Reflect.getOwnPropertyDescriptor(o,s);if(a&&!a.configurable)return a;let m=r.get(s);return m?m.getPropertyDescriptor?{...dn,...m?.getPropertyDescriptor(s)}:dn:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[Gs]=function(){let o={...this};return delete o[Gs],o},i}function np(t){let e=new Map;for(let r of t){let n=r.getKeys();for(let i of n)e.set(i,r)}return e}function Hs(t,e){return t.filter(r=>e.get(r)?.has?.(r)??!0)}u();l();c();p();d();function Gt(t){return{getKeys(){return t},has(){return!1},getPropertyValue(){}}}u();l();c();p();d();function zs(t){if(t===void 0)return"";let e=Qt(t);return new $t(0,{colors:tn}).write(e).toString()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var wi=class{getLocation(){return null}};function ut(t){return typeof $EnabledCallSite=="function"&&t!=="minimal"?new $EnabledCallSite:new wi}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Ws={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function Ht(t={}){let e=op(t);return Object.entries(e).reduce((n,[i,o])=>(Ws[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function op(t={}){return typeof t._count=="boolean"?{...t,_count:{_all:t._count}}:t}function fn(t={}){return e=>(typeof t._count=="boolean"&&(e._count=e._count._all),e)}function Ks(t,e){let r=fn(t);return e({action:"aggregate",unpacker:r,argsMapper:Ht})(t)}u();l();c();p();d();function sp(t={}){let{select:e,...r}=t;return typeof e=="object"?Ht({...r,_count:e}):Ht({...r,_count:{_all:!0}})}function ap(t={}){return typeof t.select=="object"?e=>fn(t)(e)._count:e=>fn(t)(e)._count._all}function Xs(t,e){return e({action:"count",unpacker:ap(t),argsMapper:sp})(t)}u();l();c();p();d();function up(t={}){let e=Ht(t);if(Array.isArray(e.by))for(let r of e.by)typeof r=="string"&&(e.select[r]=!0);else typeof e.by=="string"&&(e.select[e.by]=!0);return e}function lp(t={}){return e=>(typeof t?._count=="boolean"&&e.forEach(r=>{r._count=r._count._all}),e)}function Zs(t,e){return e({action:"groupBy",unpacker:lp(t),argsMapper:up})(t)}function Ys(t,e,r){if(e==="aggregate")return n=>Ks(n,r);if(e==="count")return n=>Xs(n,r);if(e==="groupBy")return n=>Zs(n,r)}u();l();c();p();d();function ea(t,e){let r=e.fields.filter(i=>!i.relationName),n=Qo(r,"name");return new Proxy({},{get(i,o){if(o in i||typeof o=="symbol")return i[o];let s=n[o];if(s)return new yr(t,o,s.type,s.isList,s.kind==="enum")},...mn(Object.keys(n))})}u();l();c();p();d();u();l();c();p();d();var ta=t=>Array.isArray(t)?t:t.split("."),bi=(t,e)=>ta(e).reduce((r,n)=>r&&r[n],t),ra=(t,e,r)=>ta(e).reduceRight((n,i,o,s)=>Object.assign({},bi(t,s.slice(0,o)),{[i]:n}),r);function cp(t,e){return t===void 0||e===void 0?[]:[...e,"select",t]}function pp(t,e,r){return e===void 0?t??{}:ra(e,r,t||!0)}function xi(t,e,r,n,i,o){let s=t._runtimeDataModel.models[e],a;return m=>{let y=ut(t._errorFormat),E=cp(n,i),N=pp(m,o,E),$=r({dataPath:E,callsite:y})(N),U=dp(t,e);return new Proxy($,{get(B,q){if(!U.includes(q))return B[q];a??=Object.fromEntries(s.fields.map(z=>[z.name,z]));let X=[a[q].type,r,q],_=[E,N];return xi(t,...X,..._)},...mn([...U,...Object.getOwnPropertyNames($)])})}}function dp(t,e){return t._runtimeDataModel.models[e].fields.filter(r=>r.kind==="object").map(r=>r.name)}var mp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],fp=["aggregate","count","groupBy"];function Ei(t,e){let r=t._extensions.getAllModelExtensions(e)??{},n=[gp(t,e),hp(t,e),xr(r),Se("name",()=>e),Se("$name",()=>e),Se("$parent",()=>t._appliedParent)];return qe({},n)}function gp(t,e){let r=Ke(e),n=Object.keys(mr).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>m=>{let y=ut(t._errorFormat);return t._createPrismaPromise(E=>{let N={args:m,dataPath:[],action:o,model:e,clientMethod:`${r}.${i}`,jsModelName:r,transaction:E,callsite:y};return t._request({...N,...a})},{action:o,args:m,model:e})};return mp.includes(o)?xi(t,e,s):yp(i)?Ys(t,i,s):s({})}}}function yp(t){return fp.includes(t)}function hp(t,e){return gt(Se("fields",()=>{let r=t._runtimeDataModel.models[e];return ea(e,r)}))}u();l();c();p();d();function na(t){return t.replace(/^./,e=>e.toUpperCase())}var Pi=Symbol();function Er(t){let e=[wp(t),bp(t),Se(Pi,()=>t),Se("$parent",()=>t._appliedParent)],r=t._extensions.getAllClientExtensions();return r&&e.push(xr(r)),qe(t,e)}function wp(t){let e=Object.getPrototypeOf(t._originalClient),r=[...new Set(Object.getOwnPropertyNames(e))];return{getKeys(){return r},getPropertyValue(n){return t[n]}}}function bp(t){let e=Object.keys(t._runtimeDataModel.models),r=e.map(Ke),n=[...new Set(e.concat(r))];return gt({getKeys(){return n},getPropertyValue(i){let o=na(i);if(t._runtimeDataModel.models[o]!==void 0)return Ei(t,o);if(t._runtimeDataModel.models[i]!==void 0)return Ei(t,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function ia(t){return t[Pi]?t[Pi]:t}function oa(t){if(typeof t=="function")return t(this);let e=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(t)},_appliedParent:{value:this,configurable:!0},$on:{value:void 0}});return Er(e)}u();l();c();p();d();u();l();c();p();d();function sa({result:t,modelName:e,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(e);if(!o)return t;let s=[],a=[];for(let m of Object.values(o)){if(n){if(n[m.name])continue;let y=m.needs.filter(E=>n[E]);y.length>0&&a.push(Gt(y))}else if(r){if(!r[m.name])continue;let y=m.needs.filter(E=>!r[E]);y.length>0&&a.push(Gt(y))}xp(t,m.needs)&&s.push(Ep(m,qe(t,s),e))}return s.length>0||a.length>0?qe(t,[...s,...a]):t}function xp(t,e){return e.every(r=>ai(t,r))}function Ep(t,e,r){return gt(Se(t.name,()=>t.compute(e,r)))}u();l();c();p();d();function gn({visitor:t,result:e,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(e)){for(let s=0;s<e.length;s++)e[s]=gn({result:e[s],args:r,modelName:i,runtimeDataModel:n,visitor:t});return e}let o=t(e,i,r)??e;return r.include&&aa({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:t}),r.select&&aa({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:t}),o}function aa({includeOrSelect:t,result:e,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(t)){if(!s||e[o]==null||Le(s))continue;let m=n.models[r].fields.find(E=>E.name===o);if(!m||m.kind!=="object"||!m.relationName)continue;let y=typeof s=="object"?s:{};e[o]=gn({visitor:i,result:e[o],args:y,modelName:m.type,runtimeDataModel:n})}}function ua({result:t,modelName:e,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||t==null||typeof t!="object"||!i.models[e]?t:gn({result:t,args:r??{},modelName:e,runtimeDataModel:i,visitor:(a,m,y)=>{let E=Ke(m);return sa({result:a,modelName:E,select:y.select,omit:y.select?void 0:{...o?.[E],...y.omit},extensions:n})}})}u();l();c();p();d();u();l();c();p();d();import{Decimal as Tp,isObjectEnumValue as vp,Sql as ca}from"@prisma/client-runtime-utils";u();l();c();p();d();var Pp=["$connect","$disconnect","$on","$use","$extends"],la=Pp;function pa(t){if(t instanceof ca)return Sp(t);if(cn(t))return Ap(t);if(Array.isArray(t)){let r=[t[0]];for(let n=1;n<t.length;n++)r[n]=Pr(t[n]);return r}let e={};for(let r in t)e[r]=Pr(t[r]);return e}function Sp(t){return new ca(t.strings,t.values)}function Ap(t){return new br(t.sql,t.values)}function Pr(t){if(typeof t!="object"||t==null||vp(t)||jt(t)||Le(t))return t;if(Ft(t))return new Tp(t.toFixed());if(Lt(t))return new Date(+t);if(ArrayBuffer.isView(t))return t.slice(0);if(Array.isArray(t)){let e=t.length,r;for(r=Array(e);e--;)r[e]=Pr(t[e]);return r}if(typeof t=="object"){let e={};for(let r in t)r==="__proto__"?Object.defineProperty(e,r,{value:Pr(t[r]),configurable:!0,enumerable:!0,writable:!0}):e[r]=Pr(t[r]);return e}rt(t,"Unknown value")}function ma(t,e,r,n=0){return t._createPrismaPromise(i=>{let o=e.customDataProxyFetch;return"transaction"in e&&i!==void 0&&(e.transaction?.kind==="batch"&&e.transaction.lock.then(),e.transaction=i),n===r.length?t._executeRequest(e):r[n]({model:e.model,operation:e.model?e.action:e.clientMethod,args:pa(e.args??{}),__internalParams:e,query:(s,a=e)=>{let m=a.customDataProxyFetch;return a.customDataProxyFetch=ha(o,m),a.args=s,ma(t,a,r,n+1)}})})}function fa(t,e){let{jsModelName:r,action:n,clientMethod:i}=e,o=r?n:i;if(t._extensions.isEmpty())return t._executeRequest(e);let s=t._extensions.getAllQueryCallbacks(r??"$none",o);return ma(t,e,s)}function ga(t){return e=>{let r={requests:e},n=e[0].extensions.getAllBatchQueryCallbacks();return n.length?ya(r,n,0,t):t(r)}}function ya(t,e,r,n){if(r===e.length)return n(t);let i=t.customDataProxyFetch,o=t.requests[0].transaction;return e[r]({args:{queries:t.requests.map(s=>({model:s.modelName,operation:s.action,args:s.args})),transaction:o?{isolationLevel:o.kind==="batch"?o.isolationLevel:void 0}:void 0},__internalParams:t,query(s,a=t){let m=a.customDataProxyFetch;return a.customDataProxyFetch=ha(i,m),ya(a,e,r+1,n)}})}var da=t=>t;function ha(t=da,e=da){return r=>t(e(r))}u();l();c();p();d();function ba({dataPath:t,modelName:e,args:r,runtimeDataModel:n}){let i={modelName:e,args:r??{}},o=Rp(t);if(!o||o.length===0)return i;let s=e,a=r??{};for(let m of o){let y=n.models[s];if(!y)return i;let E=y.fields.find(N=>N.name===m);if(!E)throw new Error(`Could not resolve relation field "${m}" on model "${s}" from dataPath "${t.join(".")}"`);if(E.kind!=="object"||!E.relationName)return i;s=E.type,a=Cp(a,m)}return{modelName:s,args:a}}function Rp(t){let e=[];for(let r=0;r<t.length;r+=2){let n=t[r],i=t[r+1];if(n!=="select"&&n!=="include"||i===void 0)return;e.push(i)}return e}function Cp(t,e){let r=t.select?.[e];if(wa(r))return r;let n=t.include?.[e];return wa(n)?n:{}}function wa(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();import{Decimal as Ip}from"@prisma/client-runtime-utils";u();l();c();p();d();import{Decimal as yn}from"@prisma/client-runtime-utils";function zt(t){return ArrayBuffer.isView(t)&&Object.prototype.toString.call(t)==="[object Uint8Array]"}function Tr(t){return Object.prototype.toString.call(t)==="[object Date]"}function Z(t,e){throw new Error(e)}function vi(t,e){return t===e||t!==null&&e!==null&&typeof t=="object"&&typeof e=="object"&&Object.keys(t).length===Object.keys(e).length&&Object.keys(t).every(r=>vi(t[r],e[r]))}function Wt(t,e){let r=Object.keys(t),n=Object.keys(e);return(r.length<n.length?r:n).every(o=>{if(typeof t[o]==typeof e[o]&&typeof t[o]!="object")return t[o]===e[o];if(yn.isDecimal(t[o])||yn.isDecimal(e[o])){let s=xa(t[o]),a=xa(e[o]);return s&&a&&s.equals(a)}else if(zt(t[o])||zt(e[o])){let s=Ea(t[o]),a=Ea(e[o]);return s&&a&&s.equals(a)}else{if(Tr(t[o])||Tr(e[o]))return Pa(t[o])?.getTime()===Pa(e[o])?.getTime();if(typeof t[o]=="bigint"||typeof e[o]=="bigint")return Ta(t[o])===Ta(e[o]);if(typeof t[o]=="number"||typeof e[o]=="number")return va(t[o])===va(e[o])}return vi(t[o],e[o])})}function xa(t){return yn.isDecimal(t)?t:typeof t=="number"||typeof t=="string"?new yn(t):void 0}function Ea(t){return w.isBuffer(t)?t:zt(t)?w.from(t.buffer,t.byteOffset,t.byteLength):typeof t=="string"?w.from(t,"base64"):void 0}function Pa(t){return Tr(t)?t:typeof t=="string"||typeof t=="number"?new Date(t):void 0}function Ta(t){return typeof t=="bigint"?t:typeof t=="number"||typeof t=="string"?BigInt(t):void 0}function va(t){return typeof t=="number"?t:typeof t=="string"?Number(t):void 0}function Be(t){return JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString():ArrayBuffer.isView(r)?w.from(r.buffer,r.byteOffset,r.byteLength).toString("base64"):r)}var Ti=8192;function hn(t,e){if(e.length<=Ti){t.push(...e);return}for(let r=0;r<e.length;r+=Ti)t.push(...e.slice(r,r+Ti))}function Op(t){return t!==null&&typeof t=="object"&&typeof t.$type=="string"}function kp(t,e){let r={};for(let n of Object.keys(t))r[n]=e(t[n],n);return r}function Xe(t){return t===null?t:Array.isArray(t)?t.map(Xe):typeof t=="object"?Op(t)?Np(t):t.constructor!==null&&t.constructor.name!=="Object"?t:kp(t,Xe):t}function Np({$type:t,value:e}){switch(t){case"BigInt":return BigInt(e);case"Bytes":return new Uint8Array(w.from(e,"base64"));case"DateTime":return new Date(e);case"Decimal":return new Ip(e);case"Json":return JSON.parse(e);case"Raw":return e;case"FieldRef":throw new Error("FieldRef tagged values cannot be deserialized to JavaScript values");case"Enum":return e;default:Z(e,"Unknown tagged value")}}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function wn(t){return t.name==="DriverAdapterError"&&typeof t.cause=="object"}u();l();c();p();d();var G={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 he=class extends Error{name="UserFacingError";code;meta;constructor(e,r,n){super(e),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 lt(t){if(!wn(t))throw t;let e=_p(t),r=Aa(t);throw e!==void 0&&r!==void 0?new he(r,e,{driverAdapterError:t}):Lp(t.cause.kind)?Mp(t):t}function Ai(t){throw wn(t)?Dp(t):t}function Dp(t){let e=t.cause.originalCode??"N/A",r=Sa(t);return new he(`Raw query failed. Code: \`${e}\`. Message: \`${r}\``,"P2010",{driverAdapterError:t})}function Mp(t){let e=t.cause.originalCode??"N/A",r=Sa(t);return new he(`Database error. Code: \`${e}\`. Message: \`${r}\``,"P2039",{driverAdapterError:t})}function Sa(t){return t.cause.originalMessage??Aa(t)??t.message??"N/A"}function Lp(t){switch(t){case"postgres":case"mysql":case"sqlite":case"mssql":return!0;default:return!1}}function _p(t){switch(t.cause.kind){case"AuthenticationFailed":return"P1000";case"DatabaseNotReachable":return"P1001";case"DatabaseDoesNotExist":return"P1003";case"SocketTimeout":return"P1008";case"DatabaseAlreadyExists":return"P1009";case"DatabaseAccessDenied":return"P1010";case"TlsConnectionError":return"P1011";case"ConnectionClosed":return"P1017";case"TransactionAlreadyClosed":return"P1018";case"LengthMismatch":return"P2000";case"UniqueConstraintViolation":return"P2002";case"ForeignKeyConstraintViolation":case"RestrictViolation":return"P2003";case"InvalidInputValue":return"P2007";case"UnsupportedNativeDataType":return"P2010";case"NullConstraintViolation":return"P2011";case"ValueOutOfRange":return"P2020";case"TableDoesNotExist":return"P2021";case"ColumnNotFound":return"P2022";case"InvalidIsolationLevel":case"InconsistentColumnData":return"P2023";case"MissingFullTextSearchIndex":return"P2030";case"TransactionWriteConflict":return"P2034";case"GenericJs":return"P2036";case"TooManyConnections":return"P2037";case"postgres":case"sqlite":case"mysql":case"mssql":return;default:Z(t.cause,`Unknown error: ${Be(t.cause)}`)}}function Aa(t){switch(t.cause.kind){case"AuthenticationFailed":return`Authentication failed against the database server, the provided database credentials for \`${t.cause.user??"(not available)"}\` are not valid`;case"DatabaseNotReachable":{let e=t.cause.host&&t.cause.port?`${t.cause.host}:${t.cause.port}`:t.cause.host;return`Can't reach database server${e?` at ${e}`:""}`}case"DatabaseDoesNotExist":return`Database \`${t.cause.db??"(not available)"}\` does not exist on the database server`;case"SocketTimeout":return"Operation has timed out";case"DatabaseAlreadyExists":return`Database \`${t.cause.db??"(not available)"}\` already exists on the database server`;case"DatabaseAccessDenied":return`User was denied access on the database \`${t.cause.db??"(not available)"}\``;case"TlsConnectionError":return`Error opening a TLS connection: ${t.cause.reason}`;case"ConnectionClosed":return"Server has closed the connection.";case"TransactionAlreadyClosed":return t.cause.cause;case"LengthMismatch":return`The provided value for the column is too long for the column's type. Column: ${t.cause.column??"(not available)"}`;case"UniqueConstraintViolation":return`Unique constraint failed on the ${Si(t.cause.constraint)}`;case"ForeignKeyConstraintViolation":case"RestrictViolation":return`Foreign key constraint violated on the ${Si(t.cause.constraint)}`;case"UnsupportedNativeDataType":return`Failed to deserialize column of type '${t.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 ${Si(t.cause.constraint)}`;case"ValueOutOfRange":return`Value out of range for the type: ${t.cause.cause}`;case"TableDoesNotExist":return`The table \`${t.cause.table??"(not available)"}\` does not exist in the current database.`;case"ColumnNotFound":return`The column \`${t.cause.column??"(not available)"}\` does not exist in the current database.`;case"InvalidIsolationLevel":return`Error in connector: Conversion error: ${t.cause.level}`;case"InconsistentColumnData":return`Inconsistent column data: ${t.cause.cause}`;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 ${t.cause.id})`;case"TooManyConnections":return`Too many database connections opened: ${t.cause.cause}`;case"InvalidInputValue":return`Invalid input value: ${t.cause.message}`;case"sqlite":case"postgres":case"mysql":case"mssql":return;default:Z(t.cause,`Unknown error: ${Be(t.cause)}`)}}function Si(t){return t&&"fields"in t?`fields: (${t.fields.map(e=>`\`${e}\``).join(", ")})`:t&&"index"in t?`constraint: \`${t.index}\``:t&&"foreignKey"in t?"foreign key":"(not available)"}function Fp(t){if(typeof t!="object"||t===null)return!1;let e=t;return"$type"in e&&e.$type==="Param"||"prisma__type"in e&&e.prisma__type==="param"}function $p(t){return"prisma__type"in t?t.prisma__value?.name:t.value.name}function Up(t,e){let r={};for(let[n,i]of Object.entries(t))if(r[n]=i,Fp(i)){let o=$p(i);o&&o in e&&(r[n]=e[o])}return r}function Ra(t,e,r={}){let n=t.map(o=>e.keys.reduce((s,a)=>(s[a]=Xe(o[a]),s),{})),i=new Set(e.nestedSelection);return e.arguments.map(o=>{let s=Up(o,r),a=n.findIndex(m=>Wt(m,s));if(a===-1)return e.expectNonEmpty?new he("An operation failed because it depends on one or more records that were required but not found","P2025"):null;{let m=Object.entries(t[a]).filter(([y])=>i.has(y));return Object.fromEntries(m)}})}u();l();c();p();d();import{Decimal as Vp}from"@prisma/client-runtime-utils";var ie=class extends he{name="DataMapperError";constructor(e,r){super(e,"P2023",r)}},Ca=new WeakMap;function qp(t){let e=Ca.get(t);return e||(e=Object.entries(t),Ca.set(t,e)),e}function Ci(t,e,r){switch(e.type){case"affectedRows":if(typeof t!="number")throw new ie(`Expected an affected rows count, got: ${typeof t} (${t})`);return{count:t};case"object":return Ii(t,e.fields,r,e.skipNulls);case"field":return Ri(t,"<result>",e.fieldType,r);default:Z(e,`Invalid data mapping type: '${e.type}'`)}}function Ii(t,e,r,n){if(t===null)return null;if(Array.isArray(t)){let i=t;return n&&(i=i.filter(o=>o!==null)),i.map(o=>Ia(o,e,r))}if(typeof t=="object")return Ia(t,e,r);if(typeof t=="string"){let i;try{i=JSON.parse(t)}catch(o){throw new ie("Expected an array or object, got a string that is not valid JSON",{cause:o})}return Ii(i,e,r,n)}throw new ie(`Expected an array or an object, got: ${typeof t}`)}function Ia(t,e,r){if(typeof t!="object")throw new ie(`Expected an object, but got '${typeof t}'`);let n={};for(let[i,o]of qp(e))switch(o.type){case"affectedRows":throw new ie(`Unexpected 'AffectedRows' node in data mapping for field '${i}'`);case"object":{let{serializedName:s,fields:a,skipNulls:m}=o;if(s!==null&&!Object.hasOwn(t,s))throw new ie(`Missing data field (Object): '${i}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(t)}`);let y=s!==null?t[s]:t;n[i]=Ii(y,a,r,m);break}case"field":{let s=o.dbName;if(Object.hasOwn(t,s))n[i]=Bp(t[s],s,o.fieldType,r);else throw new ie(`Missing data field (Value): '${s}'; node: ${JSON.stringify(o)}; data: ${JSON.stringify(t)}`)}break;default:Z(o,`DataMapper: Invalid data mapping node type: '${o.type}'`)}return n}function Bp(t,e,r,n){return t===null?r.arity==="list"?[]:null:r.arity==="list"?t.map((o,s)=>Ri(o,`${e}[${s}]`,r,n)):Ri(t,e,r,n)}function Ri(t,e,r,n){switch(r.type){case"unsupported":return t;case"string":{if(typeof t!="string")throw new ie(`Expected a string in column '${e}', got ${typeof t}: ${t}`);return t}case"int":switch(typeof t){case"number":return Math.trunc(t);case"string":{let i=Math.trunc(Number(t));if(Number.isNaN(i)||!Number.isFinite(i))throw new ie(`Expected an integer in column '${e}', got string: ${t}`);if(!Number.isSafeInteger(i))throw new ie(`Integer value in column '${e}' is too large to represent as a JavaScript number without loss of precision, got: ${t}. Consider using BigInt type.`);return i}default:throw new ie(`Expected an integer in column '${e}', got ${typeof t}: ${t}`)}case"bigint":{if(typeof t!="number"&&typeof t!="string")throw new ie(`Expected a bigint in column '${e}', got ${typeof t}: ${t}`);return{$type:"BigInt",value:t}}case"float":{if(typeof t=="number")return t;if(typeof t=="string"){let i=Number(t);if(Number.isNaN(i)&&!/^[-+]?nan$/.test(t.toLowerCase()))throw new ie(`Expected a float in column '${e}', got string: ${t}`);return i}throw new ie(`Expected a float in column '${e}', got ${typeof t}: ${t}`)}case"boolean":{if(typeof t=="boolean")return t;if(typeof t=="number")return t===1;if(typeof t=="string"){if(t==="true"||t==="TRUE"||t==="1")return!0;if(t==="false"||t==="FALSE"||t==="0")return!1;throw new ie(`Expected a boolean in column '${e}', got ${typeof t}: ${t}`)}if(Array.isArray(t)||zt(t)){for(let i of t)if(i!==0)return!0;return!1}throw new ie(`Expected a boolean in column '${e}', got ${typeof t}: ${t}`)}case"decimal":if(typeof t!="number"&&typeof t!="string"&&!Vp.isDecimal(t))throw new ie(`Expected a decimal in column '${e}', got ${typeof t}: ${t}`);return{$type:"Decimal",value:t};case"datetime":{if(typeof t=="string")return{$type:"DateTime",value:Qp(t)};if(typeof t=="number"||Tr(t))return{$type:"DateTime",value:t};throw new ie(`Expected a date in column '${e}', got ${typeof t}: ${t}`)}case"object":return{$type:"Json",value:Be(t)};case"json":return{$type:"Json",value:`${t}`};case"bytes":{switch(r.encoding){case"base64":if(typeof t!="string")throw new ie(`Expected a base64-encoded byte array in column '${e}', got ${typeof t}: ${t}`);return{$type:"Bytes",value:t};case"hex":if(typeof t!="string"||!t.startsWith("\\x"))throw new ie(`Expected a hex-encoded byte array in column '${e}', got ${typeof t}: ${t}`);return{$type:"Bytes",value:w.from(t.slice(2),"hex").toString("base64")};case"array":if(Array.isArray(t))return{$type:"Bytes",value:w.from(t).toString("base64")};if(zt(t))return{$type:"Bytes",value:w.from(t).toString("base64")};throw new ie(`Expected a byte array in column '${e}', got ${typeof t}: ${t}`);default:Z(r.encoding,`DataMapper: Unknown bytes encoding: ${r.encoding}`)}break}case"enum":{let i=n[r.name];if(i===void 0)throw new ie(`Unknown enum '${r.name}'`);let o=i[`${t}`];if(o===void 0)throw new ie(`Value '${t}' not found in enum '${r.name}'`);return o}default:Z(r,`DataMapper: Unknown result type: ${r.type}`)}}var jp=/\d{2}:\d{2}:\d{2}(?:\.\d+)?(Z|[+-]\d{2}(:?\d{2})?)?$/;function Qp(t){let e=jp.exec(t);if(e===null)return`${t}T00:00:00Z`;let r=t,[n,i,o]=e;if(i!==void 0&&i!=="Z"&&o===void 0?r=`${t}:00`:i===void 0&&(r=`${t}Z`),n.length===t.length)return`1970-01-01T${r}`;let s=e.index-1;return r[s]===" "&&(r=`${r.slice(0,s)}T${r.slice(s+1)}`),r}u();l();c();p();d();u();l();c();p();d();function _e(t){if(typeof t!="object")return t;var e,r,n=Object.prototype.toString.call(t);if(n==="[object Object]"){if(t.constructor!==Object&&typeof t.constructor=="function"){r=new t.constructor;for(e in t)t.hasOwnProperty(e)&&r[e]!==t[e]&&(r[e]=_e(t[e]))}else{r={};for(e in t)e==="__proto__"?Object.defineProperty(r,e,{value:_e(t[e]),configurable:!0,enumerable:!0,writable:!0}):r[e]=_e(t[e])}return r}if(n==="[object Array]"){for(e=t.length,r=Array(e);e--;)r[e]=_e(t[e]);return r}return n==="[object Set]"?(r=new Set,t.forEach(function(i){r.add(_e(i))}),r):n==="[object Map]"?(r=new Map,t.forEach(function(i,o){r.set(_e(o),_e(i))}),r):n==="[object Date]"?new Date(+t):n==="[object RegExp]"?(r=new RegExp(t.source,t.flags),r.lastIndex=t.lastIndex,r):n==="[object DataView]"?new t.constructor(_e(t.buffer)):n==="[object ArrayBuffer]"?t.slice(0):n.slice(-6)==="Array]"?new t.constructor(t):t}u();l();c();p();d();function Jp(t){let e=Object.entries(t);return e.length===0?"":(e.sort(([n],[i])=>n.localeCompare(i)),`/*${e.map(([n,i])=>{let o=encodeURIComponent(n),s=encodeURIComponent(i).replace(/'/g,"\\'");return`${o}='${s}'`}).join(",")}*/`)}function bn(t,e){let r={};for(let n of t){let i=n(_e(e));for(let[o,s]of Object.entries(i))s!==void 0&&(r[o]=s)}return r}function Oa(t,e){let r=bn(t,e);return Jp(r)}function ka(t,e){return e?`${t} ${e}`:t}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var vr;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(vr||(vr={}));function Gp(t){switch(t){case"postgresql":case"postgres":case"prisma+postgres":return"postgresql";case"sqlserver":return"mssql";case"mysql":case"sqlite":case"cockroachdb":case"mongodb":return t;default:Z(t,`Unknown provider: ${t}`)}}async function xn({query:t,tracingHelper:e,provider:r,onQuery:n,execute:i}){let o=n===void 0?i:async()=>{let s=new Date,a=T.now(),m=await i(),y=T.now();return n({timestamp:s,duration:y-a,query:t.sql,params:t.args}),m};return e.isEnabled()?await e.runInChildSpan({name:"db_query",kind:vr.CLIENT,attributes:{"db.query.text":t.sql,"db.system.name":Gp(r)}},o):o()}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function yt(t,e){var r="000000000"+t;return r.substr(r.length-e)}var Na=It(us(),1);function Hp(){try{return Na.default.hostname()}catch{return b.env._CLUSTER_NETWORK_NAME_||b.env.COMPUTERNAME||"hostname"}}var Da=2,zp=yt(b.pid.toString(36),Da),Ma=Hp(),Wp=Ma.length,Kp=yt(Ma.split("").reduce(function(t,e){return+t+e.charCodeAt(0)},+Wp+36).toString(36),Da);function Oi(){return zp+Kp}u();l();c();p();d();u();l();c();p();d();function En(t){return typeof t=="string"&&/^c[a-z0-9]{20,32}$/.test(t)}function ki(t){let n=Math.pow(36,4),i=0;function o(){return yt((Math.random()*n<<0).toString(36),4)}function s(){return i=i<n?i:0,i++,i-1}function a(){var m="c",y=new Date().getTime().toString(36),E=yt(s().toString(36),4),N=t(),$=o()+o();return m+y+E+N+$}return a.fingerprint=t,a.isCuid=En,a}var Xp=ki(Oi);var La=Xp;u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var Pn=BigInt(4294967295),_a=BigInt(32);function Zp(t,e=!1){return e?{h:Number(t&Pn),l:Number(t>>_a&Pn)}:{h:Number(t>>_a&Pn)|0,l:Number(t&Pn)|0}}function Fa(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:s,l:a}=Zp(t[o],e);[n[o],i[o]]=[s,a]}return[n,i]}var $a=(t,e,r)=>t<<r|e>>>32-r,Ua=(t,e,r)=>e<<r|t>>>32-r,Va=(t,e,r)=>e<<r-32|t>>>64-r,qa=(t,e,r)=>t<<r-32|e>>>64-r;u();l();c();p();d();function Yp(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Tn(t,e=""){if(typeof t!="number"){let r=e&&`"${e}" `;throw new TypeError(`${r}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){let r=e&&`"${e}" `;throw new RangeError(`${r}expected integer >= 0, got ${t}`)}}function vn(t,e,r=""){let n=Yp(t),i=t?.length,o=e!==void 0;if(!n||o&&i!==e){let s=r&&`"${r}" `,a=o?` of length ${e}`:"",m=n?`length=${i}`:`type=${typeof t}`,y=s+"expected Uint8Array"+a+", got "+m;throw n?new RangeError(y):new TypeError(y)}return t}function Ni(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Ba(t,e){vn(t,void 0,"digestInto() output");let r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function ja(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Di(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}var ed=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function td(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function rd(t){for(let e=0;e<t.length;e++)t[e]=td(t[e]);return t}var Mi=ed?t=>t:rd;function Qa(t,e={}){let r=(i,o)=>t(o).update(i).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=i=>t(i),Object.assign(r,e),Object.freeze(r)}var Ja=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});var nd=BigInt(0),Sr=BigInt(1),id=BigInt(2),od=BigInt(7),sd=BigInt(256),ad=BigInt(113),za=[],Wa=[],Ka=[];for(let t=0,e=Sr,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],za.push(2*(5*n+r)),Wa.push((t+1)*(t+2)/2%64);let i=nd;for(let o=0;o<7;o++)e=(e<<Sr^(e>>od)*ad)%sd,e&id&&(i^=Sr<<(Sr<<BigInt(o))-Sr);Ka.push(i)}var Xa=Fa(Ka,!0),ud=Xa[0],ld=Xa[1],Ga=(t,e,r)=>r>32?Va(t,e,r):$a(t,e,r),Ha=(t,e,r)=>r>32?qa(t,e,r):Ua(t,e,r);function cd(t,e=24){if(Tn(e,"rounds"),e<1||e>24)throw new Error('"rounds" expected integer 1..24');let r=new Uint32Array(5*2);for(let n=24-e;n<24;n++){for(let s=0;s<10;s++)r[s]=t[s]^t[s+10]^t[s+20]^t[s+30]^t[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,m=(s+2)%10,y=r[m],E=r[m+1],N=Ga(y,E,1)^r[a],$=Ha(y,E,1)^r[a+1];for(let U=0;U<50;U+=10)t[s+U]^=N,t[s+U+1]^=$}let i=t[2],o=t[3];for(let s=0;s<24;s++){let a=Wa[s],m=Ga(i,o,a),y=Ha(i,o,a),E=za[s];i=t[E],o=t[E+1],t[E]=m,t[E+1]=y}for(let s=0;s<50;s+=10){let a=t[s],m=t[s+1],y=t[s+2],E=t[s+3];t[s]^=~t[s+2]&t[s+4],t[s+1]^=~t[s+3]&t[s+5],t[s+2]^=~t[s+4]&t[s+6],t[s+3]^=~t[s+5]&t[s+7],t[s+4]^=~t[s+6]&t[s+8],t[s+5]^=~t[s+7]&t[s+9],t[s+6]^=~t[s+8]&a,t[s+7]^=~t[s+9]&m,t[s+8]^=~a&y,t[s+9]^=~m&E}t[0]^=ud[n],t[1]^=ld[n]}Di(r)}var Li=class t{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;canXOF;enableXOF=!1;rounds;constructor(e,r,n,i=!1,o=24){if(this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.canXOF=i,this.rounds=o,Tn(n,"outputLen"),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ja(this.state)}clone(){return this._cloneInto()}keccak(){Mi(this.state32),cd(this.state32,this.rounds),Mi(this.state32),this.posOut=0,this.pos=0}update(e){Ni(this),vn(e);let{blockLen:r,state:n}=this,i=e.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++]^=e[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:r,pos:n,blockLen:i}=this;e[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){Ni(this,!1),vn(e),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,o=e.length;i<o;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);e.set(r.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Tn(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ba(e,this),this.finished)throw new Error("digest() was already called");this.writeInto(e.subarray(0,this.outputLen)),this.destroy()}digest(){let e=new Uint8Array(this.outputLen);return this.digestInto(e),e}destroy(){this.destroyed=!0,Di(this.state)}_cloneInto(e){let{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return e||=new t(r,n,i,s,o),e.blockLen=r,e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=i,e.enableXOF=s,e.canXOF=this.canXOF,e.destroyed=this.destroyed,e}},pd=(t,e,r,n={})=>Qa(()=>new Li(e,t,r),n);var Za=pd(6,72,64,Ja(10));u();l();c();p();d();var dd=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,_i=Math.ceil,$e=Math.floor,Ce="[BigNumber Error] ",Ya=Ce+"Number primitive has more than 15 significant digits: ",je=1e14,H=14,Fi=9007199254740991,$i=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ct=1e7,we=1e9;function eu(t){var e,r,n,i=_.prototype={constructor:_,toString:null,valueOf:null},o=new _(1),s=20,a=4,m=-7,y=21,E=-1e7,N=1e7,$=!1,U=1,B=0,q={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},J="0123456789abcdefghijklmnopqrstuvwxyz",X=!0;function _(f,g){var h,O,P,k,L,R,I,M,D=this;if(!(D instanceof _))return new _(f,g);if(g==null){if(f&&f._isBigNumber===!0){D.s=f.s,!f.c||f.e>N?D.c=D.e=null:f.e<E?D.c=[D.e=0]:(D.e=f.e,D.c=f.c.slice());return}if((R=typeof f=="number")&&f*0==0){if(D.s=1/f<0?(f=-f,-1):1,f===~~f){for(k=0,L=f;L>=10;L/=10,k++);k>N?D.c=D.e=null:(D.e=k,D.c=[f]);return}M=String(f)}else{if(!dd.test(M=String(f)))return n(D,M,R);D.s=M.charCodeAt(0)==45?(M=M.slice(1),-1):1}(k=M.indexOf("."))>-1&&(M=M.replace(".","")),(L=M.search(/e/i))>0?(k<0&&(k=L),k+=+M.slice(L+1),M=M.substring(0,L)):k<0&&(k=M.length)}else{if(se(g,2,J.length,"Base"),g==10&&X)return D=new _(f),Pe(D,s+D.e+1,a);if(M=String(f),R=typeof f=="number"){if(f*0!=0)return n(D,M,R,g);if(D.s=1/f<0?(M=M.slice(1),-1):1,_.DEBUG&&M.replace(/^0\.0*|\./,"").length>15)throw Error(Ya+f)}else D.s=M.charCodeAt(0)===45?(M=M.slice(1),-1):1;for(h=J.slice(0,g),k=L=0,I=M.length;L<I;L++)if(h.indexOf(O=M.charAt(L))<0){if(O=="."){if(L>k){k=I;continue}}else if(!P&&(M==M.toUpperCase()&&(M=M.toLowerCase())||M==M.toLowerCase()&&(M=M.toUpperCase()))){P=!0,L=-1,k=0;continue}return n(D,String(f),R,g)}R=!1,M=r(M,g,10,D.s),(k=M.indexOf("."))>-1?M=M.replace(".",""):k=M.length}for(L=0;M.charCodeAt(L)===48;L++);for(I=M.length;M.charCodeAt(--I)===48;);if(M=M.slice(L,++I)){if(I-=L,R&&_.DEBUG&&I>15&&(f>Fi||f!==$e(f)))throw Error(Ya+D.s*f);if((k=k-L-1)>N)D.c=D.e=null;else if(k<E)D.c=[D.e=0];else{if(D.e=k,D.c=[],L=(k+1)%H,k<0&&(L+=H),L<I){for(L&&D.c.push(+M.slice(0,L)),I-=H;L<I;)D.c.push(+M.slice(L,L+=H));L=H-(M=M.slice(L)).length}else L-=I;for(;L--;M+="0");D.c.push(+M)}}else D.c=[D.e=0]}_.clone=eu,_.ROUND_UP=0,_.ROUND_DOWN=1,_.ROUND_CEIL=2,_.ROUND_FLOOR=3,_.ROUND_HALF_UP=4,_.ROUND_HALF_DOWN=5,_.ROUND_HALF_EVEN=6,_.ROUND_HALF_CEIL=7,_.ROUND_HALF_FLOOR=8,_.EUCLID=9,_.config=_.set=function(f){var g,h;if(f!=null)if(typeof f=="object"){if(f.hasOwnProperty(g="DECIMAL_PLACES")&&(h=f[g],se(h,0,we,g),s=h),f.hasOwnProperty(g="ROUNDING_MODE")&&(h=f[g],se(h,0,8,g),a=h),f.hasOwnProperty(g="EXPONENTIAL_AT")&&(h=f[g],h&&h.pop?(se(h[0],-we,0,g),se(h[1],0,we,g),m=h[0],y=h[1]):(se(h,-we,we,g),m=-(y=h<0?-h:h))),f.hasOwnProperty(g="RANGE"))if(h=f[g],h&&h.pop)se(h[0],-we,-1,g),se(h[1],1,we,g),E=h[0],N=h[1];else if(se(h,-we,we,g),h)E=-(N=h<0?-h:h);else throw Error(Ce+g+" cannot be zero: "+h);if(f.hasOwnProperty(g="CRYPTO"))if(h=f[g],h===!!h)if(h)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))$=h;else throw $=!h,Error(Ce+"crypto unavailable");else $=h;else throw Error(Ce+g+" not true or false: "+h);if(f.hasOwnProperty(g="MODULO_MODE")&&(h=f[g],se(h,0,9,g),U=h),f.hasOwnProperty(g="POW_PRECISION")&&(h=f[g],se(h,0,we,g),B=h),f.hasOwnProperty(g="FORMAT"))if(h=f[g],typeof h=="object")q=h;else throw Error(Ce+g+" not an object: "+h);if(f.hasOwnProperty(g="ALPHABET"))if(h=f[g],typeof h=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(h))X=h.slice(0,10)=="0123456789",J=h;else throw Error(Ce+g+" invalid: "+h)}else throw Error(Ce+"Object expected: "+f);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[m,y],RANGE:[E,N],CRYPTO:$,MODULO_MODE:U,POW_PRECISION:B,FORMAT:q,ALPHABET:J}},_.isBigNumber=function(f){if(!f||f._isBigNumber!==!0)return!1;if(!_.DEBUG)return!0;var g,h,O=f.c,P=f.e,k=f.s;e:if({}.toString.call(O)=="[object Array]"){if((k===1||k===-1)&&P>=-we&&P<=we&&P===$e(P)){if(O[0]===0){if(P===0&&O.length===1)return!0;break e}if(g=(P+1)%H,g<1&&(g+=H),String(O[0]).length==g){for(g=0;g<O.length;g++)if(h=O[g],h<0||h>=je||h!==$e(h))break e;if(h!==0)return!0}}}else if(O===null&&P===null&&(k===null||k===1||k===-1))return!0;throw Error(Ce+"Invalid BigNumber: "+f)},_.maximum=_.max=function(){return le(arguments,-1)},_.minimum=_.min=function(){return le(arguments,1)},_.random=function(){var f=9007199254740992,g=Math.random()*f&2097151?function(){return $e(Math.random()*f)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(h){var O,P,k,L,R,I=0,M=[],D=new _(o);if(h==null?h=s:se(h,0,we),L=_i(h/H),$)if(crypto.getRandomValues){for(O=crypto.getRandomValues(new Uint32Array(L*=2));I<L;)R=O[I]*131072+(O[I+1]>>>11),R>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),O[I]=P[0],O[I+1]=P[1]):(M.push(R%1e14),I+=2);I=L/2}else if(crypto.randomBytes){for(O=crypto.randomBytes(L*=7);I<L;)R=(O[I]&31)*281474976710656+O[I+1]*1099511627776+O[I+2]*4294967296+O[I+3]*16777216+(O[I+4]<<16)+(O[I+5]<<8)+O[I+6],R>=9e15?crypto.randomBytes(7).copy(O,I):(M.push(R%1e14),I+=7);I=L/7}else throw $=!1,Error(Ce+"crypto unavailable");if(!$)for(;I<L;)R=g(),R<9e15&&(M[I++]=R%1e14);for(L=M[--I],h%=H,L&&h&&(R=$i[H-h],M[I]=$e(L/R)*R);M[I]===0;M.pop(),I--);if(I<0)M=[k=0];else{for(k=-1;M[0]===0;M.splice(0,1),k-=H);for(I=1,R=M[0];R>=10;R/=10,I++);I<H&&(k-=H-I)}return D.e=k,D.c=M,D}}(),_.sum=function(){for(var f=1,g=arguments,h=new _(g[0]);f<g.length;)h=h.plus(g[f++]);return h},r=function(){var f="0123456789";function g(h,O,P,k){for(var L,R=[0],I,M=0,D=h.length;M<D;){for(I=R.length;I--;R[I]*=O);for(R[0]+=k.indexOf(h.charAt(M++)),L=0;L<R.length;L++)R[L]>P-1&&(R[L+1]==null&&(R[L+1]=0),R[L+1]+=R[L]/P|0,R[L]%=P)}return R.reverse()}return function(h,O,P,k,L){var R,I,M,D,F,j,Q,K,ae=h.indexOf("."),me=s,W=a;for(ae>=0&&(D=B,B=0,h=h.replace(".",""),K=new _(O),j=K.pow(h.length-ae),B=D,K.c=g(nt(Fe(j.c),j.e,"0"),10,P,f),K.e=K.c.length),Q=g(h,O,P,L?(R=J,f):(R=f,J)),M=D=Q.length;Q[--D]==0;Q.pop());if(!Q[0])return R.charAt(0);if(ae<0?--M:(j.c=Q,j.e=M,j.s=k,j=e(j,K,me,W,P),Q=j.c,F=j.r,M=j.e),I=M+me+1,ae=Q[I],D=P/2,F=F||I<0||Q[I+1]!=null,F=W<4?(ae!=null||F)&&(W==0||W==(j.s<0?3:2)):ae>D||ae==D&&(W==4||F||W==6&&Q[I-1]&1||W==(j.s<0?8:7)),I<1||!Q[0])h=F?nt(R.charAt(1),-me,R.charAt(0)):R.charAt(0);else{if(Q.length=I,F)for(--P;++Q[--I]>P;)Q[I]=0,I||(++M,Q=[1].concat(Q));for(D=Q.length;!Q[--D];);for(ae=0,h="";ae<=D;h+=R.charAt(Q[ae++]));h=nt(h,M,R.charAt(0))}return h}}(),e=function(){function f(O,P,k){var L,R,I,M,D=0,F=O.length,j=P%ct,Q=P/ct|0;for(O=O.slice();F--;)I=O[F]%ct,M=O[F]/ct|0,L=Q*I+M*j,R=j*I+L%ct*ct+D,D=(R/k|0)+(L/ct|0)+Q*M,O[F]=R%k;return D&&(O=[D].concat(O)),O}function g(O,P,k,L){var R,I;if(k!=L)I=k>L?1:-1;else for(R=I=0;R<k;R++)if(O[R]!=P[R]){I=O[R]>P[R]?1:-1;break}return I}function h(O,P,k,L){for(var R=0;k--;)O[k]-=R,R=O[k]<P[k]?1:0,O[k]=R*L+O[k]-P[k];for(;!O[0]&&O.length>1;O.splice(0,1));}return function(O,P,k,L,R){var I,M,D,F,j,Q,K,ae,me,W,Y,Te,Ur,zn,Wn,Qe,rr,De=O.s==P.s?1:-1,ve=O.c,ue=P.c;if(!ve||!ve[0]||!ue||!ue[0])return new _(!O.s||!P.s||(ve?ue&&ve[0]==ue[0]:!ue)?NaN:ve&&ve[0]==0||!ue?De*0:De/0);for(ae=new _(De),me=ae.c=[],M=O.e-P.e,De=k+M+1,R||(R=je,M=Ue(O.e/H)-Ue(P.e/H),De=De/H|0),D=0;ue[D]==(ve[D]||0);D++);if(ue[D]>(ve[D]||0)&&M--,De<0)me.push(1),F=!0;else{for(zn=ve.length,Qe=ue.length,D=0,De+=2,j=$e(R/(ue[0]+1)),j>1&&(ue=f(ue,j,R),ve=f(ve,j,R),Qe=ue.length,zn=ve.length),Ur=Qe,W=ve.slice(0,Qe),Y=W.length;Y<Qe;W[Y++]=0);rr=ue.slice(),rr=[0].concat(rr),Wn=ue[0],ue[1]>=R/2&&Wn++;do{if(j=0,I=g(ue,W,Qe,Y),I<0){if(Te=W[0],Qe!=Y&&(Te=Te*R+(W[1]||0)),j=$e(Te/Wn),j>1)for(j>=R&&(j=R-1),Q=f(ue,j,R),K=Q.length,Y=W.length;g(Q,W,K,Y)==1;)j--,h(Q,Qe<K?rr:ue,K,R),K=Q.length,I=1;else j==0&&(I=j=1),Q=ue.slice(),K=Q.length;if(K<Y&&(Q=[0].concat(Q)),h(W,Q,Y,R),Y=W.length,I==-1)for(;g(ue,W,Qe,Y)<1;)j++,h(W,Qe<Y?rr:ue,Y,R),Y=W.length}else I===0&&(j++,W=[0]);me[D++]=j,W[0]?W[Y++]=ve[Ur]||0:(W=[ve[Ur]],Y=1)}while((Ur++<zn||W[0]!=null)&&De--);F=W[0]!=null,me[0]||me.splice(0,1)}if(R==je){for(D=1,De=me[0];De>=10;De/=10,D++);Pe(ae,k+(ae.e=D+M*H-1)+1,L,F)}else ae.e=M,ae.r=+F;return ae}}();function z(f,g,h,O){var P,k,L,R,I;if(h==null?h=a:se(h,0,8),!f.c)return f.toString();if(P=f.c[0],L=f.e,g==null)I=Fe(f.c),I=O==1||O==2&&(L<=m||L>=y)?An(I,L):nt(I,L,"0");else if(f=Pe(new _(f),g,h),k=f.e,I=Fe(f.c),R=I.length,O==1||O==2&&(g<=k||k<=m)){for(;R<g;I+="0",R++);I=An(I,k)}else if(g-=L+(O===2&&k>L),I=nt(I,k,"0"),k+1>R){if(--g>0)for(I+=".";g--;I+="0");}else if(g+=k-R,g>0)for(k+1==R&&(I+=".");g--;I+="0");return f.s<0&&P?"-"+I:I}function le(f,g){for(var h,O,P=1,k=new _(f[0]);P<f.length;P++)O=new _(f[P]),(!O.s||(h=ht(k,O))===g||h===0&&k.s===g)&&(k=O);return k}function Ae(f,g,h){for(var O=1,P=g.length;!g[--P];g.pop());for(P=g[0];P>=10;P/=10,O++);return(h=O+h*H-1)>N?f.c=f.e=null:h<E?f.c=[f.e=0]:(f.e=h,f.c=g),f}n=function(){var f=/^(-?)0([xbo])(?=\w[\w.]*$)/i,g=/^([^.]+)\.$/,h=/^\.([^.]+)$/,O=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(k,L,R,I){var M,D=R?L:L.replace(P,"");if(O.test(D))k.s=isNaN(D)?null:D<0?-1:1;else{if(!R&&(D=D.replace(f,function(F,j,Q){return M=(Q=Q.toLowerCase())=="x"?16:Q=="b"?2:8,!I||I==M?j:F}),I&&(M=I,D=D.replace(g,"$1").replace(h,"0.$1")),L!=D))return new _(D,M);if(_.DEBUG)throw Error(Ce+"Not a"+(I?" base "+I:"")+" number: "+L);k.s=null}k.c=k.e=null}}();function Pe(f,g,h,O){var P,k,L,R,I,M,D,F=f.c,j=$i;if(F){e:{for(P=1,R=F[0];R>=10;R/=10,P++);if(k=g-P,k<0)k+=H,L=g,I=F[M=0],D=$e(I/j[P-L-1]%10);else if(M=_i((k+1)/H),M>=F.length)if(O){for(;F.length<=M;F.push(0));I=D=0,P=1,k%=H,L=k-H+1}else break e;else{for(I=R=F[M],P=1;R>=10;R/=10,P++);k%=H,L=k-H+P,D=L<0?0:$e(I/j[P-L-1]%10)}if(O=O||g<0||F[M+1]!=null||(L<0?I:I%j[P-L-1]),O=h<4?(D||O)&&(h==0||h==(f.s<0?3:2)):D>5||D==5&&(h==4||O||h==6&&(k>0?L>0?I/j[P-L]:0:F[M-1])%10&1||h==(f.s<0?8:7)),g<1||!F[0])return F.length=0,O?(g-=f.e+1,F[0]=j[(H-g%H)%H],f.e=-g||0):F[0]=f.e=0,f;if(k==0?(F.length=M,R=1,M--):(F.length=M+1,R=j[H-k],F[M]=L>0?$e(I/j[P-L]%j[L])*R:0),O)for(;;)if(M==0){for(k=1,L=F[0];L>=10;L/=10,k++);for(L=F[0]+=R,R=1;L>=10;L/=10,R++);k!=R&&(f.e++,F[0]==je&&(F[0]=1));break}else{if(F[M]+=R,F[M]!=je)break;F[M--]=0,R=1}for(k=F.length;F[--k]===0;F.pop());}f.e>N?f.c=f.e=null:f.e<E&&(f.c=[f.e=0])}return f}function ce(f){var g,h=f.e;return h===null?f.toString():(g=Fe(f.c),g=h<=m||h>=y?An(g,h):nt(g,h,"0"),f.s<0?"-"+g:g)}return i.absoluteValue=i.abs=function(){var f=new _(this);return f.s<0&&(f.s=1),f},i.comparedTo=function(f,g){return ht(this,new _(f,g))},i.decimalPlaces=i.dp=function(f,g){var h,O,P,k=this;if(f!=null)return se(f,0,we),g==null?g=a:se(g,0,8),Pe(new _(k),f+k.e+1,g);if(!(h=k.c))return null;if(O=((P=h.length-1)-Ue(this.e/H))*H,P=h[P])for(;P%10==0;P/=10,O--);return O<0&&(O=0),O},i.dividedBy=i.div=function(f,g){return e(this,new _(f,g),s,a)},i.dividedToIntegerBy=i.idiv=function(f,g){return e(this,new _(f,g),0,1)},i.exponentiatedBy=i.pow=function(f,g){var h,O,P,k,L,R,I,M,D,F=this;if(f=new _(f),f.c&&!f.isInteger())throw Error(Ce+"Exponent not an integer: "+ce(f));if(g!=null&&(g=new _(g)),R=f.e>14,!F.c||!F.c[0]||F.c[0]==1&&!F.e&&F.c.length==1||!f.c||!f.c[0])return D=new _(Math.pow(+ce(F),R?f.s*(2-Sn(f)):+ce(f))),g?D.mod(g):D;if(I=f.s<0,g){if(g.c?!g.c[0]:!g.s)return new _(NaN);O=!I&&F.isInteger()&&g.isInteger(),O&&(F=F.mod(g))}else{if(f.e>9&&(F.e>0||F.e<-1||(F.e==0?F.c[0]>1||R&&F.c[1]>=24e7:F.c[0]<8e13||R&&F.c[0]<=9999975e7)))return k=F.s<0&&Sn(f)?-0:0,F.e>-1&&(k=1/k),new _(I?1/k:k);B&&(k=_i(B/H+2))}for(R?(h=new _(.5),I&&(f.s=1),M=Sn(f)):(P=Math.abs(+ce(f)),M=P%2),D=new _(o);;){if(M){if(D=D.times(F),!D.c)break;k?D.c.length>k&&(D.c.length=k):O&&(D=D.mod(g))}if(P){if(P=$e(P/2),P===0)break;M=P%2}else if(f=f.times(h),Pe(f,f.e+1,1),f.e>14)M=Sn(f);else{if(P=+ce(f),P===0)break;M=P%2}F=F.times(F),k?F.c&&F.c.length>k&&(F.c.length=k):O&&(F=F.mod(g))}return O?D:(I&&(D=o.div(D)),g?D.mod(g):k?Pe(D,B,a,L):D)},i.integerValue=function(f){var g=new _(this);return f==null?f=a:se(f,0,8),Pe(g,g.e+1,f)},i.isEqualTo=i.eq=function(f,g){return ht(this,new _(f,g))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(f,g){return ht(this,new _(f,g))>0},i.isGreaterThanOrEqualTo=i.gte=function(f,g){return(g=ht(this,new _(f,g)))===1||g===0},i.isInteger=function(){return!!this.c&&Ue(this.e/H)>this.c.length-2},i.isLessThan=i.lt=function(f,g){return ht(this,new _(f,g))<0},i.isLessThanOrEqualTo=i.lte=function(f,g){return(g=ht(this,new _(f,g)))===-1||g===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(f,g){var h,O,P,k,L=this,R=L.s;if(f=new _(f,g),g=f.s,!R||!g)return new _(NaN);if(R!=g)return f.s=-g,L.plus(f);var I=L.e/H,M=f.e/H,D=L.c,F=f.c;if(!I||!M){if(!D||!F)return D?(f.s=-g,f):new _(F?L:NaN);if(!D[0]||!F[0])return F[0]?(f.s=-g,f):new _(D[0]?L:a==3?-0:0)}if(I=Ue(I),M=Ue(M),D=D.slice(),R=I-M){for((k=R<0)?(R=-R,P=D):(M=I,P=F),P.reverse(),g=R;g--;P.push(0));P.reverse()}else for(O=(k=(R=D.length)<(g=F.length))?R:g,R=g=0;g<O;g++)if(D[g]!=F[g]){k=D[g]<F[g];break}if(k&&(P=D,D=F,F=P,f.s=-f.s),g=(O=F.length)-(h=D.length),g>0)for(;g--;D[h++]=0);for(g=je-1;O>R;){if(D[--O]<F[O]){for(h=O;h&&!D[--h];D[h]=g);--D[h],D[O]+=je}D[O]-=F[O]}for(;D[0]==0;D.splice(0,1),--M);return D[0]?Ae(f,D,M):(f.s=a==3?-1:1,f.c=[f.e=0],f)},i.modulo=i.mod=function(f,g){var h,O,P=this;return f=new _(f,g),!P.c||!f.s||f.c&&!f.c[0]?new _(NaN):!f.c||P.c&&!P.c[0]?new _(P):(U==9?(O=f.s,f.s=1,h=e(P,f,0,3),f.s=O,h.s*=O):h=e(P,f,0,U),f=P.minus(h.times(f)),!f.c[0]&&U==1&&(f.s=P.s),f)},i.multipliedBy=i.times=function(f,g){var h,O,P,k,L,R,I,M,D,F,j,Q,K,ae,me,W=this,Y=W.c,Te=(f=new _(f,g)).c;if(!Y||!Te||!Y[0]||!Te[0])return!W.s||!f.s||Y&&!Y[0]&&!Te||Te&&!Te[0]&&!Y?f.c=f.e=f.s=null:(f.s*=W.s,!Y||!Te?f.c=f.e=null:(f.c=[0],f.e=0)),f;for(O=Ue(W.e/H)+Ue(f.e/H),f.s*=W.s,I=Y.length,F=Te.length,I<F&&(K=Y,Y=Te,Te=K,P=I,I=F,F=P),P=I+F,K=[];P--;K.push(0));for(ae=je,me=ct,P=F;--P>=0;){for(h=0,j=Te[P]%me,Q=Te[P]/me|0,L=I,k=P+L;k>P;)M=Y[--L]%me,D=Y[L]/me|0,R=Q*M+D*j,M=j*M+R%me*me+K[k]+h,h=(M/ae|0)+(R/me|0)+Q*D,K[k--]=M%ae;K[k]=h}return h?++O:K.splice(0,1),Ae(f,K,O)},i.negated=function(){var f=new _(this);return f.s=-f.s||null,f},i.plus=function(f,g){var h,O=this,P=O.s;if(f=new _(f,g),g=f.s,!P||!g)return new _(NaN);if(P!=g)return f.s=-g,O.minus(f);var k=O.e/H,L=f.e/H,R=O.c,I=f.c;if(!k||!L){if(!R||!I)return new _(P/0);if(!R[0]||!I[0])return I[0]?f:new _(R[0]?O:P*0)}if(k=Ue(k),L=Ue(L),R=R.slice(),P=k-L){for(P>0?(L=k,h=I):(P=-P,h=R),h.reverse();P--;h.push(0));h.reverse()}for(P=R.length,g=I.length,P-g<0&&(h=I,I=R,R=h,g=P),P=0;g;)P=(R[--g]=R[g]+I[g]+P)/je|0,R[g]=je===R[g]?0:R[g]%je;return P&&(R=[P].concat(R),++L),Ae(f,R,L)},i.precision=i.sd=function(f,g){var h,O,P,k=this;if(f!=null&&f!==!!f)return se(f,1,we),g==null?g=a:se(g,0,8),Pe(new _(k),f,g);if(!(h=k.c))return null;if(P=h.length-1,O=P*H+1,P=h[P]){for(;P%10==0;P/=10,O--);for(P=h[0];P>=10;P/=10,O++);}return f&&k.e+1>O&&(O=k.e+1),O},i.shiftedBy=function(f){return se(f,-Fi,Fi),this.times("1e"+f)},i.squareRoot=i.sqrt=function(){var f,g,h,O,P,k=this,L=k.c,R=k.s,I=k.e,M=s+4,D=new _("0.5");if(R!==1||!L||!L[0])return new _(!R||R<0&&(!L||L[0])?NaN:L?k:1/0);if(R=Math.sqrt(+ce(k)),R==0||R==1/0?(g=Fe(L),(g.length+I)%2==0&&(g+="0"),R=Math.sqrt(+g),I=Ue((I+1)/2)-(I<0||I%2),R==1/0?g="5e"+I:(g=R.toExponential(),g=g.slice(0,g.indexOf("e")+1)+I),h=new _(g)):h=new _(R+""),h.c[0]){for(I=h.e,R=I+M,R<3&&(R=0);;)if(P=h,h=D.times(P.plus(e(k,P,M,1))),Fe(P.c).slice(0,R)===(g=Fe(h.c)).slice(0,R))if(h.e<I&&--R,g=g.slice(R-3,R+1),g=="9999"||!O&&g=="4999"){if(!O&&(Pe(P,P.e+s+2,0),P.times(P).eq(k))){h=P;break}M+=4,R+=4,O=1}else{(!+g||!+g.slice(1)&&g.charAt(0)=="5")&&(Pe(h,h.e+s+2,1),f=!h.times(h).eq(k));break}}return Pe(h,h.e+s+1,a,f)},i.toExponential=function(f,g){return f!=null&&(se(f,0,we),f++),z(this,f,g,1)},i.toFixed=function(f,g){return f!=null&&(se(f,0,we),f=f+this.e+1),z(this,f,g)},i.toFormat=function(f,g,h){var O,P=this;if(h==null)f!=null&&g&&typeof g=="object"?(h=g,g=null):f&&typeof f=="object"?(h=f,f=g=null):h=q;else if(typeof h!="object")throw Error(Ce+"Argument not an object: "+h);if(O=P.toFixed(f,g),P.c){var k,L=O.split("."),R=+h.groupSize,I=+h.secondaryGroupSize,M=h.groupSeparator||"",D=L[0],F=L[1],j=P.s<0,Q=j?D.slice(1):D,K=Q.length;if(I&&(k=R,R=I,I=k,K-=k),R>0&&K>0){for(k=K%R||R,D=Q.substr(0,k);k<K;k+=R)D+=M+Q.substr(k,R);I>0&&(D+=M+Q.slice(k)),j&&(D="-"+D)}O=F?D+(h.decimalSeparator||"")+((I=+h.fractionGroupSize)?F.replace(new RegExp("\\d{"+I+"}\\B","g"),"$&"+(h.fractionGroupSeparator||"")):F):D}return(h.prefix||"")+O+(h.suffix||"")},i.toFraction=function(f){var g,h,O,P,k,L,R,I,M,D,F,j,Q=this,K=Q.c;if(f!=null&&(R=new _(f),!R.isInteger()&&(R.c||R.s!==1)||R.lt(o)))throw Error(Ce+"Argument "+(R.isInteger()?"out of range: ":"not an integer: ")+ce(R));if(!K)return new _(Q);for(g=new _(o),M=h=new _(o),O=I=new _(o),j=Fe(K),k=g.e=j.length-Q.e-1,g.c[0]=$i[(L=k%H)<0?H+L:L],f=!f||R.comparedTo(g)>0?k>0?g:M:R,L=N,N=1/0,R=new _(j),I.c[0]=0;D=e(R,g,0,1),P=h.plus(D.times(O)),P.comparedTo(f)!=1;)h=O,O=P,M=I.plus(D.times(P=M)),I=P,g=R.minus(D.times(P=g)),R=P;return P=e(f.minus(h),O,0,1),I=I.plus(P.times(M)),h=h.plus(P.times(O)),I.s=M.s=Q.s,k=k*2,F=e(M,O,k,a).minus(Q).abs().comparedTo(e(I,h,k,a).minus(Q).abs())<1?[M,O]:[I,h],N=L,F},i.toNumber=function(){return+ce(this)},i.toPrecision=function(f,g){return f!=null&&se(f,1,we),z(this,f,g,2)},i.toString=function(f){var g,h=this,O=h.s,P=h.e;return P===null?O?(g="Infinity",O<0&&(g="-"+g)):g="NaN":(f==null?g=P<=m||P>=y?An(Fe(h.c),P):nt(Fe(h.c),P,"0"):f===10&&X?(h=Pe(new _(h),s+P+1,a),g=nt(Fe(h.c),h.e,"0")):(se(f,2,J.length,"Base"),g=r(nt(Fe(h.c),P,"0"),10,f,O,!0)),O<0&&h.c[0]&&(g="-"+g)),g},i.valueOf=i.toJSON=function(){return ce(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,t!=null&&_.set(t),_}function Ue(t){var e=t|0;return t>0||t===e?e:e-1}function Fe(t){for(var e,r,n=1,i=t.length,o=t[0]+"";n<i;){for(e=t[n++]+"",r=H-e.length;r--;e="0"+e);o+=e}for(i=o.length;o.charCodeAt(--i)===48;);return o.slice(0,i+1||1)}function ht(t,e){var r,n,i=t.c,o=e.c,s=t.s,a=e.s,m=t.e,y=e.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=m==y,!i||!o)return n?0:!i^r?1:-1;if(!n)return m>y^r?1:-1;for(a=(m=i.length)<(y=o.length)?m:y,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return m==y?0:m>y^r?1:-1}function se(t,e,r,n){if(t<e||t>r||t!==$e(t))throw Error(Ce+(n||"Argument")+(typeof t=="number"?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function Sn(t){var e=t.c.length-1;return Ue(t.e/H)==e&&t.c[e]%2!=0}function An(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function nt(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(n=t.length,++e>n){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}var md=eu(),tu=md;var fd=24,Ar=32,gd=()=>typeof globalThis<"u"&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues=="function"?()=>{let t=new Uint32Array(1);return globalThis.crypto.getRandomValues(t),t[0]/4294967296}:Math.random,Vi=gd(),Ui=(t=4,e=Vi)=>{let r="";for(;r.length<t;)r=r+Math.floor(e()*36).toString(36);return r};function yd(t){let e=new tu(0);for(let r of t.values())e=e.multipliedBy(256).plus(r);return e}var nu=(t="")=>{let e=new TextEncoder;return yd(Za(e.encode(t))).toString(36).slice(1)},ru=Array.from({length:26},(t,e)=>String.fromCharCode(e+97)),hd=t=>ru[Math.floor(t()*ru.length)],wd=({globalObj:t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},random:e=Vi}={})=>{let r=Object.keys(t).toString(),n=r.length?r+Ui(Ar,e):Ui(Ar,e);return nu(n).substring(0,Ar)},bd=t=>()=>t++,xd=476782367,iu=({random:t=Vi,counter:e=bd(Math.floor(t()*xd)),length:r=fd,fingerprint:n=wd({random:t})}={})=>{if(r>Ar)throw new Error(`Length must be between 2 and ${Ar}. Received: ${r}`);return function(){let o=hd(t),s=Date.now().toString(36),a=e().toString(36),m=Ui(r,t),y=`${s+m+a+n}`;return`${o+nu(y).substring(1,r)}`}},qi=Ed(iu);function Ed(t){let e;return()=>(e||(e=t()),e())}u();l();c();p();d();Jr();u();l();c();p();d();var ou="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Pd=128,wt,Kt;function Td(t){!wt||wt.length<t?(wt=w.allocUnsafe(t*Pd),lr.getRandomValues(wt),Kt=0):Kt+t>wt.length&&(lr.getRandomValues(wt),Kt=0),Kt+=t}function Bi(t=21){Td(t|=0);let e="";for(let r=Kt-t;r<Kt;r++)e+=ou[wt[r]&63];return e}u();l();c();p();d();Jr();var au="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Rr=32;var vd=16,uu=10,su=0xffffffffffff;var bt;(function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"})(bt||(bt={}));var xt=class extends Error{constructor(e,r){super(`${r} (${e})`),this.name="ULIDError",this.code=e}};function Sd(t){let e=Math.floor(t()*Rr);return e===Rr&&(e=Rr-1),au.charAt(e)}function Ad(t){let e=Rd(),r=e&&(e.crypto||e.msCrypto)||(typeof Dt<"u"?Dt: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(Dt?.randomBytes)return()=>Dt.randomBytes(1).readUInt8()/255;throw new xt(bt.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Rd(){return Od()?self:typeof window<"u"?window:typeof globalThis<"u"||typeof globalThis<"u"?globalThis:null}function Cd(t,e){let r="";for(;t>0;t--)r=Sd(e)+r;return r}function Id(t,e=uu){if(isNaN(t))throw new xt(bt.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>su)throw new xt(bt.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${su}: ${t}`);if(t<0)throw new xt(bt.EncodeTimeNegative,`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new xt(bt.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let r,n="";for(let i=e;i>0;i--)r=t%Rr,n=au.charAt(r)+n,t=(t-r)/Rr;return n}function Od(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function lu(t,e){let r=e||Ad(),n=!t||isNaN(t)?Date.now():t;return Id(n,uu)+Cd(vd,r)}u();l();c();p();d();u();l();c();p();d();var xe=[];for(let t=0;t<256;++t)xe.push((t+256).toString(16).slice(1));function Rn(t,e=0){return(xe[t[e+0]]+xe[t[e+1]]+xe[t[e+2]]+xe[t[e+3]]+"-"+xe[t[e+4]]+xe[t[e+5]]+"-"+xe[t[e+6]]+xe[t[e+7]]+"-"+xe[t[e+8]]+xe[t[e+9]]+"-"+xe[t[e+10]]+xe[t[e+11]]+xe[t[e+12]]+xe[t[e+13]]+xe[t[e+14]]+xe[t[e+15]]).toLowerCase()}u();l();c();p();d();var kd=new Uint8Array(16);function Xt(){return crypto.getRandomValues(kd)}u();l();c();p();d();function Nd(t,e,r){return!e&&!t&&crypto.randomUUID?crypto.randomUUID():Dd(t,e,r)}function Dd(t,e,r){t=t||{};let n=t.random??t.rng?.()??Xt();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,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[r+i]=n[i];return e}return Rn(n)}var ji=Nd;u();l();c();p();d();var Qi={};function Md(t,e,r){let n;if(t)n=cu(t.random??t.rng?.()??Xt(),t.msecs,t.seq,e,r);else{let i=Date.now(),o=Xt();Ld(Qi,i,o),n=cu(o,Qi.msecs,Qi.seq,e,r)}return e??Rn(n)}function Ld(t,e,r){return t.msecs??=-1/0,t.seq??=0,e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}function cu(t,e,r,n,i=0){if(t.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 e??=Date.now(),r??=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9],n[i++]=e/1099511627776&255,n[i++]=e/4294967296&255,n[i++]=e/16777216&255,n[i++]=e/65536&255,n[i++]=e/256&255,n[i++]=e&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|t[10]&3,n[i++]=t[11],n[i++]=t[12],n[i++]=t[13],n[i++]=t[14],n[i++]=t[15],n}var Ji=Md;var Cn=class{#e={};constructor(){this.register("uuid",new Hi),this.register("cuid",new zi),this.register("ulid",new Wi),this.register("nanoid",new Ki),this.register("product",new Xi)}snapshot(){return Object.create(this.#e,{now:{value:new Gi}})}register(e,r){this.#e[e]=r}},Gi=class{#e;generate(){return this.#e===void 0&&(this.#e=new Date),this.#e.toISOString()}},Hi=class{generate(e){if(e===4)return ji();if(e===7)return Ji();throw new Error("Invalid UUID generator arguments")}},zi=class{generate(e){if(e===1)return La();if(e===2)return qi();throw new Error("Invalid CUID generator arguments")}},Wi=class{generate(){return lu()}},Ki=class{generate(e){if(typeof e=="number")return Bi(e);if(e===void 0)return Bi();throw new Error("Invalid Nanoid generator arguments")}},Xi=class{generate(e,r){if(e===void 0||r===void 0)throw new Error("Invalid Product generator arguments");return Array.isArray(e)&&Array.isArray(r)?e.flatMap(n=>r.map(i=>[n,i])):Array.isArray(e)?e.map(n=>[n,r]):Array.isArray(r)?r.map(n=>[e,n]):[[e,r]]}};u();l();c();p();d();function Cr(t,e){return t==null?t:typeof t=="string"?Cr(JSON.parse(t),e):Array.isArray(t)?Fd(t,e):_d(t,e)}function _d(t,e){if(e.pagination){let{skip:r,take:n,cursor:i}=e.pagination;if(r!==null&&r>0||n===0||i!==null&&!Wt(t,i))return null}return du(t,e.nested)}function du(t,e){for(let[r,n]of Object.entries(e))t[r]=Cr(t[r],n);return t}function Fd(t,e){if(e.distinct!==null){let r=e.linkingFields!==null?[...e.distinct,...e.linkingFields]:e.distinct;t=$d(t,r)}return e.pagination&&(t=Ud(t,e.pagination,e.linkingFields)),e.reverse&&t.reverse(),Object.keys(e.nested).length===0?t:t.map(r=>du(r,e.nested))}function $d(t,e){let r=new Set,n=[];for(let i of t){let o=Et(i,e);r.has(o)||(r.add(o),n.push(i))}return n}function Ud(t,e,r){if(r===null)return pu(t,e);let n=new Map;for(let o of t){let s=Et(o,r);n.has(s)||n.set(s,[]),n.get(s).push(o)}let i=Array.from(n.entries());return i.sort(([o],[s])=>o<s?-1:o>s?1:0),i.flatMap(([,o])=>pu(o,e))}function pu(t,{cursor:e,skip:r,take:n}){let i=e!==null?t.findIndex(a=>Wt(a,e)):0;if(i===-1)return[];let o=i+(r??0),s=n!==null?o+n:t.length;return t.slice(o,s)}function Et(t,e,r){let n=e.map((i,o)=>r?.[o]?t[i]!==null?r[o](t[i]):null:t[i]);return JSON.stringify(n)}u();l();c();p();d();u();l();c();p();d();function Zi(t){return typeof t=="object"&&t!==null&&t.prisma__type==="param"}function Yi(t){return typeof t=="object"&&t!==null&&t.prisma__type==="generatorCall"}function ro(t,e,r,n){let i=t.args.map(o=>Ne(o,e,r));switch(t.type){case"rawSql":return[Bd(t.sql,i,t.argTypes)];case"templateSql":return(t.chunkable?Qd(t.fragments,i,n):[i]).map(s=>{let a=Vd(t.fragments,t.placeholderFormat,s,t.argTypes);if(n!==void 0&&a.args.length>n)throw new he("The query parameter limit supported by your database is exceeded.","P2029");return a});default:Z(t.type,"Invalid query type")}}function Ne(t,e,r){for(;jd(t);)if(Zi(t)){let n=e[t.prisma__value.name];if(n===void 0)throw new Error(`Missing value for query variable ${t.prisma__value.name}`);t.prisma__value.type==="DateTime"&&typeof n=="string"?t=new Date(n):t=n}else if(Yi(t)){let{name:n,args:i}=t.prisma__value,o=r[n];if(!o)throw new Error(`Encountered an unknown generator '${n}'`);t=o.generate(...i.map(s=>Ne(s,e,r)))}else Z(t,`Unexpected unevaluated value type: ${t}`);return Array.isArray(t)&&(t=t.map(n=>Ne(n,e,r))),t}function Vd(t,e,r,n){let i="",o={placeholderNumber:1},s=[],a=[];for(let m of to(t,r,n)){if(i+=qd(m,e,o),m.type==="stringChunk")continue;let y=Array.from(mu(m)),E=y.length;if(hn(s,y),m.argType.arity==="tuple"){if(E%m.argType.elements.length!==0)throw new Error(`Malformed query template. Expected the number of parameters to match the tuple arity, but got ${E} parameters for a tuple of arity ${m.argType.elements.length}.`);for(let N=0;N<E/m.argType.elements.length;N++)a.push(...m.argType.elements)}else for(let N=0;N<E;N++)a.push(m.argType)}return{sql:i,args:s,argTypes:a}}function qd(t,e,r){let n=t.type;switch(n){case"parameter":return eo(e,r.placeholderNumber++);case"stringChunk":return t.chunk;case"parameterTuple":return`(${t.value.length==0?"NULL":t.value.map(()=>{let o=eo(e,r.placeholderNumber++);return`${t.itemPrefix}${o}${t.itemSuffix}`}).join(t.itemSeparator)})`;case"parameterTupleList":return t.value.map(i=>{let o=i.map(()=>eo(e,r.placeholderNumber++)).join(t.itemSeparator);return`${t.itemPrefix}${o}${t.itemSuffix}`}).join(t.groupSeparator);default:Z(n,"Invalid fragment type")}}function eo(t,e){return t.hasNumbering?`${t.prefix}${e}`:t.prefix}function Bd(t,e,r){return{sql:t,args:e,argTypes:r}}function jd(t){return Zi(t)||Yi(t)}function*to(t,e,r){let n=0;for(let i of t)switch(i.type){case"parameter":{if(n>=e.length)throw new Error(`Malformed query template. Fragments attempt to read over ${e.length} parameters.`);yield{...i,value:e[n],argType:r?.[n]},n++;break}case"stringChunk":{yield i;break}case"parameterTuple":{if(n>=e.length)throw new Error(`Malformed query template. Fragments attempt to read over ${e.length} parameters.`);let o=e[n];yield{...i,value:Array.isArray(o)?o:[o],argType:r?.[n]},n++;break}case"parameterTupleList":{if(n>=e.length)throw new Error(`Malformed query template. Fragments attempt to read over ${e.length} parameters.`);let o=e[n];if(!Array.isArray(o))throw new Error("Malformed query template. Tuple list expected.");if(o.length===0)throw new Error("Malformed query template. Tuple list cannot be empty.");for(let s of o)if(!Array.isArray(s))throw new Error("Malformed query template. Tuple expected.");yield{...i,value:o,argType:r?.[n]},n++;break}}}function*mu(t){switch(t.type){case"parameter":yield t.value;break;case"stringChunk":break;case"parameterTuple":yield*t.value;break;case"parameterTupleList":for(let e of t.value)yield*e;break}}function Qd(t,e,r){let n=0,i=0;for(let s of to(t,e,void 0)){let a=0;for(let m of mu(s))a++;i=Math.max(i,a),n+=a}let o=[[]];for(let s of to(t,e,void 0))switch(s.type){case"parameter":{for(let a of o)a.push(s.value);break}case"stringChunk":break;case"parameterTuple":{let a=s.value.length,m=[];if(r&&o.length===1&&a===i&&n>r&&n-a<r){let y=r-(n-a);m=Jd(s.value,y)}else m=[s.value];o=o.flatMap(y=>m.map(E=>[...y,E]));break}case"parameterTupleList":{let a=s.value.reduce((N,$)=>N+$.length,0),m=[],y=[],E=0;for(let N of s.value)r&&o.length===1&&a===i&&y.length>0&&n-a+E+N.length>r&&(m.push(y),y=[],E=0),y.push(N),E+=N.length;y.length>0&&m.push(y),o=o.flatMap(N=>m.map($=>[...N,$]));break}}return o}function Jd(t,e){let r=[];for(let n=0;n<t.length;n+=e)r.push(t.slice(n,n+e));return r}u();l();c();p();d();function fu(t){return t.rows.map(e=>e.reduce((r,n,i)=>(r[t.columnNames[i]]=n,r),{}))}function gu(t){return{columns:t.columnNames,types:t.columnTypes.map(e=>Gd(e)),rows:t.rows.map(e=>e.map((r,n)=>Ir(r,t.columnTypes[n])))}}function Ir(t,e){if(t===null)return null;switch(e){case G.Int32:switch(typeof t){case"number":return Math.trunc(t);case"string":return Math.trunc(Number(t));default:throw new Error(`Cannot serialize value of type ${typeof t} as Int32`)}case G.Int32Array:if(!Array.isArray(t))throw new Error(`Cannot serialize value of type ${typeof t} as Int32Array`);return t.map(r=>Ir(r,G.Int32));case G.Int64:switch(typeof t){case"number":return BigInt(Math.trunc(t));case"string":return t;default:throw new Error(`Cannot serialize value of type ${typeof t} as Int64`)}case G.Int64Array:if(!Array.isArray(t))throw new Error(`Cannot serialize value of type ${typeof t} as Int64Array`);return t.map(r=>Ir(r,G.Int64));case G.Json:switch(typeof t){case"string":return JSON.parse(t);default:throw new Error(`Cannot serialize value of type ${typeof t} as Json`)}case G.JsonArray:if(!Array.isArray(t))throw new Error(`Cannot serialize value of type ${typeof t} as JsonArray`);return t.map(r=>Ir(r,G.Json));case G.Boolean:switch(typeof t){case"boolean":return t;case"string":return t==="true"||t==="1";case"number":return t===1;default:throw new Error(`Cannot serialize value of type ${typeof t} as Boolean`)}case G.BooleanArray:if(!Array.isArray(t))throw new Error(`Cannot serialize value of type ${typeof t} as BooleanArray`);return t.map(r=>Ir(r,G.Boolean));default:return t}}function Gd(t){switch(t){case G.Int32:return"int";case G.Int64:return"bigint";case G.Float:return"float";case G.Double:return"double";case G.Text:return"string";case G.Enum:return"enum";case G.Bytes:return"bytes";case G.Boolean:return"bool";case G.Character:return"char";case G.Numeric:return"decimal";case G.Json:return"json";case G.Uuid:return"uuid";case G.DateTime:return"datetime";case G.Date:return"date";case G.Time:return"time";case G.Int32Array:return"int-array";case G.Int64Array:return"bigint-array";case G.FloatArray:return"float-array";case G.DoubleArray:return"double-array";case G.TextArray:return"string-array";case G.EnumArray:return"string-array";case G.BytesArray:return"bytes-array";case G.BooleanArray:return"bool-array";case G.CharacterArray:return"char-array";case G.NumericArray:return"decimal-array";case G.JsonArray:return"json-array";case G.UuidArray:return"uuid-array";case G.DateTimeArray:return"datetime-array";case G.DateArray:return"date-array";case G.TimeArray:return"time-array";case G.UnknownNumber:return"unknown";case G.Set:return"string";default:Z(t,`Unexpected column type: ${t}`)}}u();l();c();p();d();function no(t,e,r){if(!e.every(n=>In(t,n))){let n=Hd(t,r),i=zd(r);throw new he(n,i,r.context)}}function In(t,e){switch(e.type){case"rowCountEq":return Array.isArray(t)?t.length===e.args:t===null?e.args===0:e.args===1;case"rowCountNeq":return Array.isArray(t)?t.length!==e.args:t===null?e.args!==0:e.args!==1;case"affectedRowCountEq":return t===e.args;case"never":return!1;default:Z(e,`Unknown rule type: ${e.type}`)}}function Hd(t,e){switch(e.errorIdentifier){case"RELATION_VIOLATION":return`The change you are trying to make would violate the required relation '${e.context.relation}' between the \`${e.context.modelA}\` and \`${e.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 ${e.context.operation}.`;case"MISSING_RELATED_RECORD":{let r=e.context.neededFor?` (needed to ${e.context.neededFor})`:"";return`An operation failed because it depends on one or more records that were required but not found. No '${e.context.model}' record${r} was found for ${e.context.operation} on ${e.context.relationType} relation '${e.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 ${e.context.expectedRows} records to be connected, found only ${Array.isArray(t)?t.length:t}.`;case"INCOMPLETE_CONNECT_OUTPUT":return`The required connected records were not found. Expected ${e.context.expectedRows} records to be connected after connect operation on ${e.context.relationType} relation '${e.context.relation}', found ${Array.isArray(t)?t.length:t}.`;case"RECORDS_NOT_CONNECTED":return`The records for relation \`${e.context.relation}\` between the \`${e.context.parent}\` and \`${e.context.child}\` models are not connected.`;default:Z(e,`Unknown error identifier: ${e}`)}}function zd(t){switch(t.errorIdentifier){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:Z(t,`Unknown error identifier: ${t}`)}}var Wd=be("prisma:client:queryInterpreter"),Nr=class t{#e;#t=new Cn;#r;#i;#o;#s;#a;constructor({onQuery:e,tracingHelper:r,serializer:n,rawSerializer:i,provider:o,connectionInfo:s}){this.#e=e,this.#r=r,this.#i=n,this.#o=i??n,this.#s=o,this.#a=s}static forSql(e){return new t({onQuery:e.onQuery,tracingHelper:e.tracingHelper,serializer:fu,rawSerializer:gu,provider:e.provider,connectionInfo:e.connectionInfo})}async run(e,r){let n=this.#t.snapshot(),i={...r,generators:n},o=Xd(e,a=>this.interpretNode(a,i))?.catch(a=>lt(a));if(o)try{return this.#n(await o,i.scope,n).value}catch(a){lt(a)}let{value:s}=await this.interpretNode(e,i).catch(a=>lt(a));return s}async interpretNode(e,r){switch(e.type){case"value":return{value:Ne(e.args,r.scope,r.generators),lastInsertId:e.lastInsertId};case"seq":{let n;for(let i of e.args)n=await this.interpretNode(i,r);return n??{value:void 0}}case"let":{let n=Object.create(r.scope);for(let i of e.args.bindings){let{value:o}=await this.interpretNode(i.expr,{...r,scope:n});n[i.name]=o}return this.interpretNode(e.args.expr,{...r,scope:n})}case"concat":{let n=await Promise.all(e.args.map(i=>this.interpretNode(i,r).then(o=>o.value)));return{value:n.length>0?n.reduce((i,o)=>i.concat(Zt(o)),[]):[]}}case"sum":{let n=await Promise.all(e.args.map(i=>this.interpretNode(i,r).then(o=>o.value)));return{value:n.length>0?n.reduce((i,o)=>Ve(i)+Ve(o)):0}}case"execute":{let n=ro(e.args,r.scope,r.generators,this.#p());return this.#l(n.length,r,async i=>{let o=0;for(let s of n){let a=bu(s,i.sqlCommenter);o+=await this.#d(a,i.queryable,()=>i.queryable.executeRaw(On(a)).catch(m=>e.args.type==="rawSql"?Ai(m):lt(m)))}return{value:o}})}case"query":{let n=ro(e.args,r.scope,r.generators,this.#p());return this.#l(n.length,r,async i=>{let o;for(let s of n){let a=bu(s,i.sqlCommenter),m=await this.#d(a,i.queryable,()=>i.queryable.queryRaw(On(a)).catch(y=>e.args.type==="rawSql"?Ai(y):lt(y)));o===void 0?o=m:(hn(o.rows,m.rows),o.lastInsertId=m.lastInsertId)}return{value:e.args.type==="rawSql"?this.#o(o):this.#i(o),lastInsertId:o?.lastInsertId}})}case"reverse":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args,r);return{value:Array.isArray(n)?n.reverse():n,lastInsertId:i}}case"unique":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args,r);if(!Array.isArray(n))return{value:n,lastInsertId:i};if(n.length>1)throw new Error(`Expected zero or one element, got ${n.length}`);return{value:n[0]??null,lastInsertId:i}}case"required":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args,r);if(io(n))throw new Error("Required value is empty");return{value:n,lastInsertId:i}}case"mapField":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.records,r);return{value:oo(n,e.args.field),lastInsertId:i}}case"join":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.parent,r);if(n===null)return{value:null,lastInsertId:i};let o=await Promise.all(e.args.children.map(async s=>({joinExpr:s,childRecords:(await this.interpretNode(s.child,r)).value})));return{value:yu(n,o,e.args.canAssumeStrictEquality),lastInsertId:i}}case"transaction":return this.#u(r,n=>this.interpretNode(e.args,n));case"dataMap":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.expr,r);return{value:Ci(n,e.args.structure,e.args.enums),lastInsertId:i}}case"validate":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.expr,r);return no(n,e.args.rules,e.args),{value:n,lastInsertId:i}}case"if":{let{value:n}=await this.interpretNode(e.args.value,r);return In(n,e.args.rule)?await this.interpretNode(e.args.then,r):await this.interpretNode(e.args.else,r)}case"diff":{let{value:n}=await this.interpretNode(e.args.from,r),{value:i}=await this.interpretNode(e.args.to,r),o=a=>a!==null?Et(Pt(a),e.args.fields):null,s=new Set(Zt(i).map(o));return{value:Zt(n).filter(a=>!s.has(o(a)))}}case"process":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.expr,r),o=On(e.args.operations);return so(o,r.scope,r.generators),{value:Cr(n,o),lastInsertId:i}}case"initializeRecord":{let{lastInsertId:n}=await this.interpretNode(e.args.expr,r),i={};for(let[o,s]of Object.entries(e.args.fields))i[o]=hu(s,n,r.scope,r.generators);return{value:i,lastInsertId:n}}case"mapRecord":{let{value:n,lastInsertId:i}=await this.interpretNode(e.args.expr,r),o=n===null?{}:Pt(n);for(let[s,a]of Object.entries(e.args.fields))o[s]=wu(a,o[s],r.scope,r.generators);return{value:o,lastInsertId:i}}default:return this.#n(e,r.scope,r.generators)}}#n(e,r,n){switch(e.type){case"value":return{value:Ne(e.args,r,n),lastInsertId:e.lastInsertId};case"seq":{let i;for(let o of e.args)i=this.#n(o,r,n);return i??{value:void 0}}case"get":return{value:r[e.args.name]};case"let":{let i=Object.create(r);for(let o of e.args.bindings){let{value:s}=this.#n(o.expr,i,n);i[o.name]=s}return this.#n(e.args.expr,i,n)}case"getFirstNonEmpty":{for(let i of e.args.names){let o=r[i];if(!io(o))return{value:o}}return{value:[]}}case"concat":{let i=e.args.map(o=>this.#n(o,r,n).value);return{value:i.length>0?i.reduce((o,s)=>o.concat(Zt(s)),[]):[]}}case"sum":{let i=e.args.map(o=>this.#n(o,r,n).value);return{value:i.length>0?i.reduce((o,s)=>Ve(o)+Ve(s)):0}}case"reverse":{let{value:i,lastInsertId:o}=this.#n(e.args,r,n);return{value:Array.isArray(i)?i.reverse():i,lastInsertId:o}}case"unique":{let{value:i,lastInsertId:o}=this.#n(e.args,r,n);if(!Array.isArray(i))return{value:i,lastInsertId:o};if(i.length>1)throw new Error(`Expected zero or one element, got ${i.length}`);return{value:i[0]??null,lastInsertId:o}}case"required":{let{value:i,lastInsertId:o}=this.#n(e.args,r,n);if(io(i))throw new Error("Required value is empty");return{value:i,lastInsertId:o}}case"mapField":{let{value:i,lastInsertId:o}=this.#n(e.args.records,r,n);return{value:oo(i,e.args.field),lastInsertId:o}}case"join":{let{value:i,lastInsertId:o}=this.#n(e.args.parent,r,n);if(i===null)return{value:null,lastInsertId:o};let s=e.args.children.map(a=>({joinExpr:a,childRecords:this.#n(a.child,r,n).value}));return{value:yu(i,s,e.args.canAssumeStrictEquality),lastInsertId:o}}case"dataMap":{let{value:i,lastInsertId:o}=this.#n(e.args.expr,r,n);return{value:Ci(i,e.args.structure,e.args.enums),lastInsertId:o}}case"validate":{let{value:i,lastInsertId:o}=this.#n(e.args.expr,r,n);return no(i,e.args.rules,e.args),{value:i,lastInsertId:o}}case"if":{let{value:i}=this.#n(e.args.value,r,n);return In(i,e.args.rule)?this.#n(e.args.then,r,n):this.#n(e.args.else,r,n)}case"unit":return{value:void 0};case"diff":{let{value:i}=this.#n(e.args.from,r,n),{value:o}=this.#n(e.args.to,r,n),s=m=>m!==null?Et(Pt(m),e.args.fields):null,a=new Set(Zt(o).map(s));return{value:Zt(i).filter(m=>!a.has(s(m)))}}case"process":{let{value:i,lastInsertId:o}=this.#n(e.args.expr,r,n),s=On(e.args.operations);return so(s,r,n),{value:Cr(i,s),lastInsertId:o}}case"initializeRecord":{let{lastInsertId:i}=this.#n(e.args.expr,r,n),o={};for(let[s,a]of Object.entries(e.args.fields))o[s]=hu(a,i,r,n);return{value:o,lastInsertId:i}}case"mapRecord":{let{value:i,lastInsertId:o}=this.#n(e.args.expr,r,n),s=i===null?{}:Pt(i);for(let[a,m]of Object.entries(e.args.fields))s[a]=wu(m,s[a],r,n);return{value:s,lastInsertId:o}}default:Z(e,`Unexpected node type: ${e.type}`)}}#l(e,r,n){return e<=1?n(r):this.#u(r,n)}async#u(e,r){if(!e.transactionManager.enabled)return r(e);let n=e.transactionManager.manager,i=await n.startInternalTransaction(),o=await n.getTransaction(i,"query");try{let s=await r({...e,queryable:o,transactionManager:{enabled:!1}});return await n.commitTransaction(i.id),s}catch(s){try{await n.rollbackTransaction(i.id)}catch(a){Wd("failed to roll back an internal transaction",a)}throw s}}#p(){return this.#a?.maxBindValues!==void 0?this.#a.maxBindValues:this.#c()}#c(){if(this.#s!==void 0)switch(this.#s){case"cockroachdb":case"postgres":case"postgresql":case"prisma+postgres":return 32766;case"mysql":return 65535;case"sqlite":return 999;case"sqlserver":return 2098;case"mongodb":return;default:Z(this.#s,`Unexpected provider: ${this.#s}`)}}#d(e,r,n){return xn({query:e,execute:n,provider:this.#s??r.provider,tracingHelper:this.#r,onQuery:this.#e})}};function io(t){return Array.isArray(t)?t.length===0:t==null}function Zt(t){return Array.isArray(t)?t:[t]}function Ve(t){if(typeof t=="number")return t;if(typeof t=="string")return Number(t);throw new Error(`Expected number, got ${typeof t}`)}function Pt(t){if(typeof t=="object"&&t!==null)return t;throw new Error(`Expected object, got ${typeof t}`)}function oo(t,e){return Array.isArray(t)?t.map(r=>oo(r,e)):typeof t=="object"&&t!==null?t[e]??null:t}function yu(t,e,r){for(let{joinExpr:n,childRecords:i}of e){let o=n.on.map(([E])=>E),s=n.on.map(([,E])=>E),a={},m=Array.isArray(t)?t:[t];for(let E of m){let N=Pt(E),$=Et(N,o);a[$]||(a[$]=[]),a[$].push(N),n.isRelationUnique?N[n.parentField]=null:N[n.parentField]=[]}let y=r?void 0:Kd(m,o);for(let E of Array.isArray(i)?i:[i]){if(E===null)continue;let N=Et(Pt(E),s,y);for(let $ of a[N]??[])n.isRelationUnique?$[n.parentField]=E:$[n.parentField].push(E)}}return t}function Kd(t,e){function r(o){switch(o){case"number":return Number;case"string":return String;case"boolean":return Boolean;case"bigint":return BigInt;default:return}}let n=Array.from({length:e.length}),i=0;for(let o of t){let s=Pt(o);for(let[a,m]of e.entries())if(s[m]!==null&&n[a]===void 0){let y=r(typeof s[m]);y!==void 0&&(n[a]=y),i++}if(i===e.length)break}return n}function hu(t,e,r,n){switch(t.type){case"value":return Ne(t.value,r,n);case"lastInsertId":return e;default:Z(t,`Unexpected field initializer type: ${t.type}`)}}function wu(t,e,r,n){switch(t.type){case"set":return Ne(t.value,r,n);case"add":return Ve(e)+Ve(Ne(t.value,r,n));case"subtract":return Ve(e)-Ve(Ne(t.value,r,n));case"multiply":return Ve(e)*Ve(Ne(t.value,r,n));case"divide":{let i=Ve(e),o=Ve(Ne(t.value,r,n));return o===0?null:i/o}default:Z(t,`Unexpected field operation type: ${t.type}`)}}function Xd(t,e){let r=kr(t);if(r)return e(r).then(n=>{let i={type:"value",args:n.value,lastInsertId:n.lastInsertId},o=Or(t,r,i);if(!o)throw new Error("Could not substitute the evaluated impure node into the query plan");return o})}function Or(t,e,r){if(t===e)return r;switch(t.type){case"seq":case"sum":case"concat":{for(let n=0;n<t.args.length;n++){let i=Or(t.args[n],e,r);if(i)return{...t,args:t.args.map((o,s)=>s===n?i:o)}}return}case"dataMap":case"validate":case"initializeRecord":case"mapRecord":case"process":{let n=Or(t.args.expr,e,r);return n&&{...t,args:{...t.args,expr:n}}}case"mapField":{let n=Or(t.args.records,e,r);return n&&{...t,args:{...t.args,records:n}}}case"reverse":case"unique":case"required":{let n=Or(t.args,e,r);return n&&{...t,args:n}}default:return}}function kr(t){switch(t.type){case"query":case"execute":return t;case"seq":case"sum":case"concat":{let e;for(let r of t.args){let n=kr(r);if(n===null)return null;if(n){if(e)return null;e=n}}return e}case"dataMap":case"validate":case"initializeRecord":case"mapRecord":case"process":return kr(t.args.expr);case"mapField":return kr(t.args.records);case"reverse":case"unique":case"required":return kr(t.args);case"let":case"join":case"diff":case"if":case"transaction":return null;case"value":case"get":case"getFirstNonEmpty":case"unit":return;default:Z(t,`Unexpected node type: ${t.type}`)}}function bu(t,e){if(!e||e.plugins.length===0)return t;let r=Oa(e.plugins,{query:e.queryInfo,sql:t.sql});return r?{...t,sql:ka(t.sql,r)}:t}function so(t,e,r){let n=t.pagination?.cursor;if(n)for(let[i,o]of Object.entries(n))n[i]=Ne(o,e,r);for(let i of Object.values(t.nested))so(i,e,r)}function On(t){return _e(t)}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();function xu(t){return new ao(t).deserialize()}function Zd(t){return w.from(t,"base64url")}var ao=class{#e;#t;#r=0;constructor(e){this.#e=e;let r=Zd(e.graph);this.#t=new DataView(r.buffer,r.byteOffset,r.byteLength)}deserialize(){let{inputNodeCount:e,outputNodeCount:r,rootCount:n}=this.#n(),i=this.#l(e),o=this.#u(r),s=this.#p(n);return{strings:this.#e.strings,inputNodes:i,outputNodes:o,roots:s}}#i(){let e=0,r=0,n;do n=this.#t.getUint8(this.#r++),e|=(n&127)<<r,r+=7;while(n>=128);return e}#o(){let e=this.#i();return e===0?void 0:e-1}#s(){let e=this.#t.getUint8(this.#r);return this.#r+=1,e}#a(){let e=this.#t.getUint16(this.#r,!0);return this.#r+=2,e}#n(){let e=this.#i(),r=this.#i(),n=this.#i();return{inputNodeCount:e,outputNodeCount:r,rootCount:n}}#l(e){let r=[];for(let n=0;n<e;n++){let i=this.#i(),o={};for(let s=0;s<i;s++){let a=this.#i(),m=this.#a(),y=this.#o(),E=this.#o(),$={flags:this.#s()};m!==0&&($.scalarMask=m),y!==void 0&&($.childNodeId=y),E!==void 0&&($.enumNameIndex=E),o[a]=$}r.push({edges:o})}return r}#u(e){let r=[];for(let n=0;n<e;n++){let i=this.#i(),o={};for(let s=0;s<i;s++){let a=this.#i(),m=this.#o(),y=this.#o(),E={};m!==void 0&&(E.argsNodeId=m),y!==void 0&&(E.outputNodeId=y),o[a]=E}r.push({edges:o})}return r}#p(e){let r={};for(let n=0;n<e;n++){let i=this.#i(),o=this.#o(),s=this.#o(),a=this.#e.strings[i],m={};o!==void 0&&(m.argsNodeId=o),s!==void 0&&(m.outputNodeId=s),r[a]=m}return r}};var Dr=class t{#e;#t;#r;constructor(e,r){this.#e=e,this.#r=r,this.#t=new Map;for(let n=0;n<e.strings.length;n++)this.#t.set(e.strings[n],n)}static deserialize(e,r){let n=xu(e);return new t(n,r)}static fromData(e,r){return new t(e,r)}root(e){let r=this.#e.roots[e];if(r)return{argsNodeId:r.argsNodeId,outputNodeId:r.outputNodeId}}inputNode(e){if(!(e===void 0||e<0||e>=this.#e.inputNodes.length))return{id:e}}outputNode(e){if(!(e===void 0||e<0||e>=this.#e.outputNodes.length))return{id:e}}inputEdge(e,r){if(!e)return;let n=this.#e.inputNodes[e.id];if(!n)return;let i=this.#t.get(r);if(i===void 0)return;let o=n.edges[i];if(o)return{flags:o.flags,childNodeId:o.childNodeId,scalarMask:o.scalarMask??0,enumNameIndex:o.enumNameIndex}}outputEdge(e,r){if(!e)return;let n=this.#e.outputNodes[e.id];if(!n)return;let i=this.#t.get(r);if(i===void 0)return;let o=n.edges[i];if(o)return{argsNodeId:o.argsNodeId,outputNodeId:o.outputNodeId}}enumValues(e){if(e?.enumNameIndex===void 0)return;let r=this.#e.strings[e.enumNameIndex];if(r)return this.#r(r)}getString(e){return this.#e.strings[e]}},Ze={ParamScalar:1,ParamEnum:2,ParamListScalar:4,ParamListEnum:8,ListObject:16,Object:32},Ee={String:1,Int:2,BigInt:4,Float:8,Decimal:16,Boolean:32,DateTime:64,Json:128,Bytes:256};function Ye(t,e){return(t.flags&e)!==0}function pt(t){return t.scalarMask}u();l();c();p();d();var Yd=new Set(["DateTime","Decimal","BigInt","Bytes","Json","Raw"]);function kn(t){if(t==null)return{kind:"null"};if(typeof t=="string")return{kind:"primitive",value:t};if(typeof t=="number")return{kind:"primitive",value:t};if(typeof t=="boolean")return{kind:"primitive",value:t};if(Array.isArray(t))return{kind:"array",items:t};if(typeof t=="object"){let e=t;if("$type"in e&&typeof e.$type=="string"){let r=e.$type;return Yd.has(r)?{kind:"taggedScalar",tag:r,value:e.value}:{kind:"structural",value:e.value}}return{kind:"object",entries:e}}return{kind:"structural",value:t}}function Eu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&!("$type"in t)}function Pu(t){return typeof t=="object"&&t!==null&&"$type"in t&&typeof t.$type=="string"}function uo(t,e){let r=new Nn(e),n=t.modelName?`${t.modelName}.${t.action}`:t.action,i=e.root(n);return{parameterizedQuery:{...t,query:r.parameterizeFieldSelection(t.query,i?.argsNodeId,i?.outputNodeId)},placeholderValues:r.getPlaceholderValues()}}function lo(t,e){let r=new Nn(e),n=[];for(let i=0;i<t.batch.length;i++){let o=t.batch[i],s=o.modelName?`${o.modelName}.${o.action}`:o.action,a=e.root(s);n.push({...o,query:r.parameterizeFieldSelection(o.query,a?.argsNodeId,a?.outputNodeId)})}return{parameterizedBatch:{...t,batch:n},placeholderValues:r.getPlaceholderValues()}}var Nn=class{#e;#t=new Map;#r=new Map;#i=1;constructor(e){this.#e=e}getPlaceholderValues(){return Object.fromEntries(this.#t)}#o(e,r){let n=tm(e,r),i=this.#r.get(n);if(i!==void 0)return Tu(i,r);let o=`%${this.#i++}`;return this.#r.set(n,o),this.#t.set(o,e),Tu(o,r)}parameterizeFieldSelection(e,r,n){let i=this.#e.inputNode(r),o=this.#e.outputNode(n),s={...e};return e.arguments&&e.arguments.$type!=="Raw"&&(s.arguments=this.#s(e.arguments,i)),e.selection&&(s.selection=this.#c(e.selection,o)),s}#s(e,r){if(!r)return e;let n={};for(let[i,o]of Object.entries(e)){let s=this.#e.inputEdge(r,i);s?n[i]=this.#a(o,s):n[i]=o}return n}#a(e,r){let n=kn(e);switch(n.kind){case"null":return e;case"structural":return e;case"primitive":return this.#n(n.value,r);case"taggedScalar":return this.#l(e,n.tag,r);case"array":return this.#u(n.items,e,r);case"object":return this.#p(n.entries,r);default:throw new Error(`Unknown value kind ${n.kind}`)}}#n(e,r){if(Ye(r,Ze.ParamEnum)&&r.enumNameIndex!==void 0&&typeof e=="string"){let o=this.#e.enumValues(r);if(o&&Object.hasOwn(o,e)){let s={type:"Enum"};return this.#o(o[e],s)}}if(!Ye(r,Ze.ParamScalar))return e;let n=pt(r);if(n===0)return e;let i=co(e);return Su(i,n)?(n&Ee.Json&&(e=JSON.stringify(e)),this.#o(e,i)):e}#l(e,r,n){if(!Ye(n,Ze.ParamScalar))return e;let i=pt(n);if(i===0||!Ru(r,i))return e;let o=Au(e.$type),s=Cu(e);return this.#o(s,o)}#u(e,r,n){if(Ye(n,Ze.ParamScalar)&&pt(n)&Ee.Json){let i=Be(Xe(e)),o={type:"Json"};return this.#o(i,o)}if(Ye(n,Ze.ParamEnum)){let i=this.#e.enumValues(n);if(i&&e.every(o=>typeof o=="string"&&Object.hasOwn(i,o))){let o={type:"List",inner:{type:"Enum"}};return this.#o(e,o)}}if(Ye(n,Ze.ParamListScalar)&&e.every(o=>sm(o,n))&&e.length>0){let o=e.map(m=>am(m)),a={type:"List",inner:im(e)};return this.#o(o,a)}if(Ye(n,Ze.ListObject)){let i=this.#e.inputNode(n.childNodeId);if(i)return e.map(o=>Eu(o)?this.#s(o,i):o)}return r}#p(e,r){if(Ye(r,Ze.Object)){let i=this.#e.inputNode(r.childNodeId);if(i)return this.#s(e,i)}if(pt(r)&Ee.Json){let i=Be(Xe(e)),o={type:"Json"};return this.#o(i,o)}return e}#c(e,r){if(!e||!r)return e;let n={};for(let[i,o]of Object.entries(e)){if(i==="$scalars"||i==="$composites"||typeof o=="boolean"){n[i]=o;continue}let s=this.#e.outputEdge(r,i);if(s){let a=o,m=this.#e.inputNode(s.argsNodeId),y=this.#e.outputNode(s.outputNodeId),E={selection:a.selection?this.#c(a.selection,y):{}};a.arguments&&(E.arguments=this.#s(a.arguments,m)),n[i]=E}else n[i]=o}return n}};function Tu(t,e){return{$type:"Param",value:{name:t,...e}}}function vu(t){return t.type==="List"?`List<${vu(t.inner)}>`:t.type}function em(t){return ArrayBuffer.isView(t)?w.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"):JSON.stringify(t)}function tm(t,e){let r=vu(e),n=em(t);return`${r}:${n}`}var rm=2**31-1,nm=-(2**31);function co(t){switch(typeof t){case"boolean":return{type:"Boolean"};case"number":return Number.isInteger(t)?nm<=t&&t<=rm?{type:"Int"}:{type:"BigInt"}:{type:"Float"};case"string":return{type:"String"};default:throw new Error("unreachable")}}function Su({type:t},e){switch(t){case"Boolean":return(e&Ee.Boolean)!==0;case"Int":return(e&(Ee.Int|Ee.BigInt|Ee.Float))!==0;case"BigInt":return(e&Ee.BigInt)!==0;case"Float":return(e&Ee.Float)!==0;case"String":return(e&Ee.String)!==0;default:return!1}}function Au(t){switch(t){case"BigInt":case"Bytes":case"DateTime":case"Json":return{type:t};case"Decimal":return{type:"Float"};default:return}}function im(t){let e={type:"Any"};for(let r of t){let n=kn(r),i;switch(n.kind){case"primitive":i=co(n.value);break;case"taggedScalar":i=Au(n.tag)??{type:"Any"};break;default:return{type:"Any"}}e=om(e,i)}return e}function om(t,e){if(t.type==="Any")return e;if(e.type==="Any"||t.type===e.type)return t;let r={Int:0,BigInt:1,Float:2},n=r[t.type],i=r[e.type];return n!==void 0&&i!==void 0?n>=i?t:e:{type:"Any"}}function Ru(t,e){switch(t){case"DateTime":return(e&Ee.DateTime)!==0;case"Decimal":return(e&Ee.Decimal)!==0;case"BigInt":return(e&Ee.BigInt)!==0;case"Bytes":return(e&Ee.Bytes)!==0;case"Json":return(e&Ee.Json)!==0;default:return!1}}function sm(t,e){let r=kn(t);switch(r.kind){case"structural":return!1;case"null":return!1;case"primitive":{let n=co(r.value),i=pt(e);return i!==0&&Su(n,i)}case"taggedScalar":{let n=pt(e);return n!==0&&Ru(r.tag,n)}default:return!1}}function am(t){return Pu(t)?Cu(t):t}function Cu(t){return t.value}u();l();c();p();d();u();l();c();p();d();async function um(){return globalThis.crypto??await Promise.resolve().then(()=>(Jr(),as))}async function Iu(){return(await um()).randomUUID()}u();l();c();p();d();async function Ou(t,e){return new Promise(r=>{t.addEventListener(e,r,{once:!0})})}u();l();c();p();d();var Ie=class extends he{name="TransactionManagerError";constructor(e,r){super("Transaction API error: "+e,"P2028",r)}},Tt=class extends Ie{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.")}},Dn=class extends Ie{constructor(e){super(`Transaction already closed: A ${e} cannot be executed on a committed transaction.`)}},Mn=class extends Ie{constructor(e){super(`Transaction already closed: A ${e} cannot be executed on a transaction that was rolled back.`)}},Mr=class extends Ie{constructor(){super("Unable to start a transaction in the given time.")}},Ln=class extends Ie{constructor(e,{timeout:r,timeTaken:n}){super(`A ${e} 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:e,timeout:r,timeTaken:n})}},et=class extends Ie{constructor(e){super(`Internal Consistency Error: ${e}`)}},_n=class extends Ie{constructor(e){super(`Invalid isolation level: ${e}`,{isolationLevel:e})}};var lm=100,cm=2e3;function pm(){let t,e=new Promise(r=>{t=r});return{abortController:new AbortController,settled:e,markSettled:t}}var vt=be("prisma:client:transactionManager"),dm=()=>({sql:"COMMIT",args:[],argTypes:[]}),ku=()=>({sql:"ROLLBACK",args:[],argTypes:[]}),mm=()=>({sql:'-- Implicit "COMMIT" query via underlying driver',args:[],argTypes:[]}),fm=()=>({sql:'-- Implicit "ROLLBACK" query via underlying driver',args:[],argTypes:[]}),Lr=class{transactions=new Map;closedTransactions=[];#e=new Set;driverAdapter;transactionOptions;tracingHelper;#t;#r;constructor({driverAdapter:e,transactionOptions:r,tracingHelper:n,onQuery:i,provider:o}){this.driverAdapter=e,this.transactionOptions=r,this.tracingHelper=n,this.#t=i,this.#r=o}async startInternalTransaction(e){let r=e!==void 0?this.#y(e):{};return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#i(r))}async startTransaction(e){let r=e!==void 0?this.#y(e):this.transactionOptions;return await this.tracingHelper.runInChildSpan("start_transaction",()=>this.#i(r))}async#i(e){if(e.newTxId)return await this.#d(e.newTxId,"start",async o=>{if(o.status!=="running")throw new et(`Transaction in invalid state ${o.status} when starting a nested transaction.`);if(!o.transaction)throw new et("Transaction missing underlying driver transaction when starting a nested transaction.");o.depth+=1;let s=this.#a(o);o.savepoints.push(s);try{await this.#n(o.transaction)(s)}catch(a){throw o.depth-=1,o.savepoints.pop(),a}return{id:o.id}});let r=pm(),{abortController:n}=r;this.#e.add(r);let i;try{let o={id:await Iu(),status:"waiting",timer:void 0,timeout:e.timeout,startedAt:Date.now(),transaction:void 0,operationQueue:Promise.resolve(),depth:1,savepoints:[],savepointCounter:0};if(n.signal.aborted)throw new Mr;let s=Nu(()=>n.abort(),e.maxWait);s?.unref?.();let a=this.driverAdapter.startTransaction(e.isolationLevel).catch(lt);switch(o.transaction=await Promise.race([a.finally(()=>clearTimeout(s)),Ou(n.signal,"abort").then(()=>{})]),this.transactions.set(o.id,o),o.status){case"waiting":if(n.signal.aborted)throw o.transaction=void 0,i=this.#o(a),await this.#f(o,"timed_out"),new Mr;return o.status="running",o.startedAt=Date.now(),o.timer=this.#c(o.id,e.timeout),{id:o.id};case"timed_out":case"running":case"committed":case"rolled_back":throw new et(`Transaction in invalid state ${o.status} although it just finished startup.`);default:return Z(o.status,"Unknown transaction status.")}}finally{this.#e.delete(r),i?i.finally(r.markSettled):r.markSettled()}}async#o(e){try{let r=await e;if(r.options.usePhantomQuery)await r.rollback();else try{await r.executeRaw(ku())}finally{await r.rollback()}}catch(r){vt("error in discarded transaction:",r)}}async commitTransaction(e){return await this.tracingHelper.runInChildSpan("commit_transaction",async()=>{await this.#d(e,"commit",async r=>{if(r.depth>1){if(!r.transaction)throw new Tt;let n=r.savepoints.at(-1);if(!n)throw new et(`Missing savepoint for nested commit. Depth: ${r.depth}, transactionId: ${r.id}`);try{await this.#u(r.transaction,n)}finally{r.savepoints.pop(),r.depth-=1}return}await this.#f(r,"committed")})})}async rollbackTransaction(e){return await this.tracingHelper.runInChildSpan("rollback_transaction",async()=>{await this.#d(e,"rollback",async r=>{if(r.depth>1){if(!r.transaction)throw new Tt;let n=r.savepoints.at(-1);if(!n)throw new et(`Missing savepoint for nested rollback. Depth: ${r.depth}, transactionId: ${r.id}`);try{await this.#l(r.transaction)(n),await this.#u(r.transaction,n)}finally{r.savepoints.pop(),r.depth-=1}return}await this.#f(r,"rolled_back")})})}async getTransaction(e,r){let n=this.#s(e.id,r);if(n.status==="closing"&&(await n.closing,n=this.#s(e.id,r)),!n.transaction)throw new Tt;return n.transaction}#s(e,r){let n=this.transactions.get(e);if(!n){let i=this.closedTransactions.find(o=>o.id===e);if(i)switch(vt("Transaction already closed.",{transactionId:e,status:i.status}),i.status){case"closing":case"waiting":case"running":throw new et("Active transaction found in closed transactions list.");case"committed":throw new Dn(r);case"rolled_back":throw new Mn(r);case"timed_out":throw new Ln(r,{timeout:i.timeout,timeTaken:Date.now()-i.startedAt})}else throw vt("Transaction not found.",e),new Tt}if(["committed","rolled_back","timed_out"].includes(n.status))throw new et("Closed transaction found in active transactions map.");return n}async cancelAllTransactions(){let e=[...this.#e];for(let{abortController:r}of e)r.abort();await Promise.allSettled([...[...this.transactions.values()].map(r=>this.#m(r,async()=>{let n=this.transactions.get(r.id);n&&await this.#f(n,"rolled_back")})),...e.map(({settled:r})=>gm(r,cm))])}#a(e){return`prisma_sp_${e.savepointCounter++}`}#n(e){if(e.createSavepoint)return e.createSavepoint.bind(e);throw new Ie(`Nested transactions are not supported by adapter "${e.adapterName}" (${e.provider}): createSavepoint is not implemented.`)}#l(e){if(e.rollbackToSavepoint)return e.rollbackToSavepoint.bind(e);throw new Ie(`Nested transactions are not supported by adapter "${e.adapterName}" (${e.provider}): rollbackToSavepoint is not implemented.`)}async#u(e,r){e.releaseSavepoint&&await e.releaseSavepoint(r)}#p(e){vt("Transaction already committed or rolled back when timeout happened.",e)}#c(e,r){let n=Date.now(),i=Nu(async()=>{try{vt("Transaction timed out.",{transactionId:e,timeoutStartedAt:n,timeout:r});let o=this.transactions.get(e);if(!o){this.#p(e);return}await this.#m(o,async()=>{let s=this.transactions.get(e);s&&["running","waiting"].includes(s.status)?await this.#f(s,"timed_out"):this.#p(e)})}catch(o){vt("Error while closing timed-out transaction.",{transactionId:e,error:o})}},r);return i?.unref?.(),i}async#d(e,r,n){let i=this.#s(e,r);return await this.#m(i,async()=>{let o=this.#s(e,r);return await n(o)})}async#m(e,r){let n=e.operationQueue,i;e.operationQueue=new Promise(o=>{i=o}),await n;try{return await r()}finally{i()}}async#f(e,r){let n=async()=>{vt("Closing transaction.",{transactionId:e.id,status:r});try{if(e.transaction&&r==="committed")if(e.transaction.options.usePhantomQuery)await this.#g(mm(),e.transaction,()=>e.transaction.commit());else{let i=dm();await this.#g(i,e.transaction,()=>e.transaction.executeRaw(i)).then(()=>e.transaction.commit(),o=>{let s=()=>Promise.reject(o);return e.transaction.rollback().then(s,s)})}else if(e.transaction)if(e.transaction.options.usePhantomQuery)await this.#g(fm(),e.transaction,()=>e.transaction.rollback());else{let i=ku();try{await this.#g(i,e.transaction,()=>e.transaction.executeRaw(i))}finally{await e.transaction.rollback()}}}finally{e.status=r,clearTimeout(e.timer),e.timer=void 0,this.transactions.delete(e.id),this.closedTransactions.push(e),this.closedTransactions.length>lm&&this.closedTransactions.shift()}};e.status==="closing"?(await e.closing,this.#s(e.id,r==="committed"?"commit":"rollback")):await Object.assign(e,{status:"closing",reason:r,closing:n()}).closing}#y(e){if(!e.timeout)throw new Ie("timeout is required");if(!e.maxWait)throw new Ie("maxWait is required");if(e.isolationLevel==="SNAPSHOT")throw new _n(e.isolationLevel);return{...e,timeout:e.timeout,maxWait:e.maxWait}}#g(e,r,n){return xn({query:e,execute:n,provider:this.#r??r.provider,tracingHelper:this.tracingHelper,onQuery:this.#t})}};function Nu(t,e){return e!==void 0?setTimeout(t,e):void 0}function gm(t,e){let r,n=new Promise(i=>{r=setTimeout(i,e),r?.unref?.()});return Promise.race([t,n]).finally(()=>clearTimeout(r))}import{PrismaClientInitializationError as go,PrismaClientKnownRequestError as yo,PrismaClientRustPanicError as _r,PrismaClientUnknownRequestError as Xu}from"@prisma/client-runtime-utils";var Fn="7.10.0-dev.41";u();l();c();p();d();var Du={bigint:"bigint",date:"datetime",decimal:"decimal",bytes:"bytes"};function Lu(t){let e;try{e=JSON.parse(t)}catch(i){throw new Error(`Received invalid serialized parameters: ${i.message}`)}if(!Array.isArray(e))throw new Error("Received invalid serialized parameters: expected an array");let r=e.map(i=>_u(i)),n=e.map(i=>hm(i));return{args:r,argTypes:n}}function _u(t){if(Array.isArray(t))return t.map(e=>_u(e));if(typeof t=="object"&&t!==null&&"prisma__value"in t){if(!("prisma__type"in t))throw new Error("Invalid serialized parameter, prisma__type should be present when prisma__value is present");return`${t.prisma__value}`}return typeof t=="object"&&t!==null?JSON.stringify(t):t}function hm(t){return Array.isArray(t)?{scalarType:t.length>0?Mu(t[0]):"unknown",arity:"list"}:{scalarType:Mu(t),arity:"scalar"}}function Mu(t){return typeof t=="object"&&t!==null&&"prisma__type"in t&&typeof t.prisma__type=="string"&&t.prisma__type in Du?Du[t.prisma__type]:typeof t=="number"?"decimal":typeof t=="string"?"string":"unknown"}u();l();c();p();d();function Fu(t,e){return{batch:t,transaction:e?.kind==="batch"?{isolationLevel:e.options.isolationLevel}:void 0}}u();l();c();p();d();u();l();c();p();d();function $u(t){return t?t.replace(/"(?:[^"\\]|\\.)*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,e=>`${e[0]}5`):""}u();l();c();p();d();function Uu(t){return t.split(`
7
7
  `).map(e=>e.replace(/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)\s*/,"").replace(/\+\d+\s*ms$/,"")).join(`
8
8
  `)}u();l();c();p();d();var Vu=It(ys());function qu({title:t,user:e="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,Vu.default)({user:e,repo:r,template:n,title:t,body:i})}function Bu({version:t,binaryTarget:e,title:r,description:n,engineVersion:i,database:o,query:s}){let a=rs(6e3-(s?.length??0)),m=Uu(Mt(a)),y=n?`# Description
9
9
  \`\`\`
@@ -57,7 +57,7 @@ Example:
57
57
  await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
58
58
 
59
59
  More Information: https://pris.ly/d/execute-raw
60
- `)}var wo=({clientMethod:t,activeProvider:e,clientVersion:r})=>n=>{let i="",o;if(cn(n))i=n.sql,o={values:Yt(n.values,r),__prismaRawParameters__:!0};else if(Array.isArray(n)){let[s,...a]=n;i=s,o={values:Yt(a||[],r),__prismaRawParameters__:!0}}else switch(e){case"sqlite":case"mysql":{i=n.sql,o={values:Yt(n.values,r),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{i=n.text,o={values:Yt(n.values,r),__prismaRawParameters__:!0};break}case"sqlserver":{i=il(n),o={values:Yt(n.values,r),__prismaRawParameters__:!0};break}default:throw new Error(`The ${e} provider does not support ${t}`)}return o?.values?ll(`prisma.${t}(${i}, ${o.values})`):ll(`prisma.${t}(${i})`),{query:i,parameters:o}},cl={requestArgsToMiddlewareArgs(t){return[t.strings,...t.values]},middlewareArgsToRequestArgs(t){let[e,...r]=t;return new Am(e,r)}},pl={requestArgsToMiddlewareArgs(t){return[t]},middlewareArgsToRequestArgs(t){return t[0]}};u();l();c();p();d();function bo(t){return function(r,n){let i,o=(s=t)=>{try{return s===void 0||s?.kind==="itx"?i??=dl(r(s)):dl(r(s))}catch(a){return Promise.reject(a)}};return{get spec(){return n},then(s,a){return o().then(s,a)},catch(s){return o().catch(s)},finally(s){return o().finally(s)},requestTransaction(s){let a=o(s);return a.requestTransaction?a.requestTransaction(s):a},[Symbol.toStringTag]:"PrismaPromise"}}}function dl(t){return typeof t.then=="function"?t:Promise.resolve(t)}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var ml={name:"@prisma/instrumentation-contract",version:"7.10.0-dev.40",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}};var Im=ml.version.split(".")[0],Om="PRISMA_INSTRUMENTATION",km=`V${Im}_PRISMA_INSTRUMENTATION`,fl=globalThis;function gl(){let t=fl[km];return t?.helper?t.helper:fl[Om]?.helper}var Nm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(t,e,r){for(let n of e)r(n)},getActiveContext(){},runInChildSpan(t,e){return e()}},xo=class{isEnabled(){return this.getTracingHelper().isEnabled()}getTraceParent(e){return this.getTracingHelper().getTraceParent(e)}dispatchEngineSpans(e,r,n){return this.getTracingHelper().dispatchEngineSpans(e,r,n)}getActiveContext(){return this.getTracingHelper().getActiveContext()}runInChildSpan(e,r){return this.getTracingHelper().runInChildSpan(e,r)}getTracingHelper(){return gl()??Nm}};function yl(){return new xo}u();l();c();p();d();function hl(t,e=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--t===0&&r(e()),i?.(n)}}}u();l();c();p();d();function wl(t){return typeof t=="string"?t:t.reduce((e,r)=>{let n=typeof r=="string"?r:r.level;return n==="query"?e:e&&(r==="info"||e==="info")?"info":n},void 0)}u();l();c();p();d();import{hasBatchIndex as _m}from"@prisma/client-runtime-utils";u();l();c();p();d();function Po(t){if(t.action!=="findUnique"&&t.action!=="findUniqueOrThrow")return;let e=[];return t.modelName&&e.push(t.modelName),t.query.arguments&&e.push(Eo(t.query.arguments)),e.push(Eo(t.query.selection)),e.join("")}function Eo(t){return`(${Object.keys(t).sort().map(r=>{let n=t[r];return typeof n=="object"&&n!==null?`(${r} ${Eo(n)})`:r}).join(" ")})`}u();l();c();p();d();var Dm={aggregate:!1,aggregateRaw:!1,createMany:!0,createManyAndReturn:!0,createOne:!0,deleteMany:!0,deleteOne:!0,executeRaw:!0,findFirst:!1,findFirstOrThrow:!1,findMany:!1,findRaw:!1,findUnique:!1,findUniqueOrThrow:!1,groupBy:!1,queryRaw:!1,runCommandRaw:!0,updateMany:!0,updateManyAndReturn:!0,updateOne:!0,upsertOne:!0};function To(t){return Dm[t]}u();l();c();p();d();var Jn=class{constructor(e){this.options=e;this.batches={}}batches;tickActive=!1;request(e){let r=this.options.batchBy(e);return r?(this.batches[r]||(this.batches[r]=[],this.tickActive||(this.tickActive=!0,b.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((n,i)=>{this.batches[r].push({request:e,resolve:n,reject:i})})):this.options.singleLoader(e)}dispatchBatches(){for(let e in this.batches){let r=this.batches[e];delete this.batches[e],r.length===1?this.options.singleLoader(r[0].request).then(n=>{n instanceof Error?r[0].reject(n):r[0].resolve(n)}).catch(n=>{r[0].reject(n)}):(r.sort((n,i)=>this.options.batchOrder(n.request,i.request)),this.options.batchLoader(r.map(n=>n.request)).then(n=>{if(n instanceof Error)for(let i=0;i<r.length;i++)r[i].reject(n);else for(let i=0;i<r.length;i++){let o=n[i];o instanceof Error?r[i].reject(o):r[i].resolve(o)}}).catch(n=>{for(let i=0;i<r.length;i++)r[i].reject(n)}))}}get[Symbol.toStringTag](){return"DataLoader"}};u();l();c();p();d();import{Decimal as Mm}from"@prisma/client-runtime-utils";function At(t,e){if(e===null)return e;switch(t){case"bigint":return BigInt(e);case"bytes":return new Uint8Array(w.from(e,"base64"));case"decimal":return new Mm(e);case"datetime":case"date":return new Date(e);case"time":return new Date(`1970-01-01T${e}Z`);case"bigint-array":return e.map(r=>At("bigint",r));case"bytes-array":return e.map(r=>At("bytes",r));case"decimal-array":return e.map(r=>At("decimal",r));case"datetime-array":return e.map(r=>At("datetime",r));case"date-array":return e.map(r=>At("date",r));case"time-array":return e.map(r=>At("time",r));default:return e}}function vo(t){let e=[],r=Lm(t);for(let n=0;n<t.rows.length;n++){let i=t.rows[n],o={...r};for(let s=0;s<i.length;s++)o[t.columns[s]]=At(t.types[s],i[s]);e.push(o)}return e}function Lm(t){let e={};for(let r=0;r<t.columns.length;r++)e[t.columns[r]]=null;return e}var Fm=be("prisma:client:request_handler"),Hn=class{client;dataloader;logEmitter;constructor(e,r){this.logEmitter=r,this.client=e,this.dataloader=new Jn({batchLoader:ga(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(N=>N.protocolQuery),m=this.client._tracingHelper.getTraceParent(s),y=n.some(N=>To(N.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:m,transaction:$m(o),containsWrite:y,customDataProxyFetch:i})).map((N,$)=>{if(N instanceof Error)return N;try{return this.mapQueryEngineResult(n[$],N)}catch(U){return U}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?bl(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:To(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>{if(n.transaction?.kind==="itx"){let i=Po(n.protocolQuery);return`itx-${n.transaction.id}${i?`-${i}`:""}`}return n.transaction?.id?`transaction-${n.transaction.id}`:Po(n.protocolQuery)},batchOrder(n,i){return n.transaction?.kind==="batch"&&i.transaction?.kind==="batch"?n.transaction.index-i.transaction.index:0}})}async request(e){try{return await this.dataloader.request(e)}catch(r){let{clientMethod:n,callsite:i,transaction:o,args:s,modelName:a}=e;this.handleAndLogRequestError({error:r,clientMethod:n,callsite:i,transaction:o,args:s,modelName:a,globalOmit:e.globalOmit})}}mapQueryEngineResult({dataPath:e,unpacker:r},n){let i=n?.data,o=this.unpack(i,e,r);return b.env.PRISMA_CLIENT_GET_TIME?{data:o}:o}handleAndLogRequestError(e){try{this.handleRequestError(e)}catch(r){throw this.logEmitter&&this.logEmitter.emit("error",{message:r.message,target:e.clientMethod,timestamp:new Date}),r}}handleRequestError({error:e,clientMethod:r,callsite:n,transaction:i,args:o,modelName:s,globalOmit:a}){if(Fm(e),Um(e,i))throw e;if(e instanceof So&&Vm(e)){let y=xl(e.meta);sn({args:o,errors:[y],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let m=e.message;if(n&&(m=Xr({callsite:n,originalMethod:r,isPanic:e.isPanic,showColors:this.client._errorFormat==="pretty",message:m})),m=this.sanitizeMessage(m),e.code){let y=s?{modelName:s,...e.meta}:e.meta;throw new So(m,{code:e.code,clientVersion:this.client._clientVersion,meta:y,batchRequestIdx:e.batchRequestIdx})}else{if(e.isPanic)throw new Gn(m,this.client._clientVersion);if(e instanceof Ao)throw new Ao(m,{clientVersion:this.client._clientVersion,batchRequestIdx:e.batchRequestIdx});if(e instanceof Rt)throw new Rt(m,this.client._clientVersion);if(e instanceof Gn)throw new Gn(m,this.client._clientVersion)}throw e.clientVersion=this.client._clientVersion,e}sanitizeMessage(e){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?Mt(e):e}unpack(e,r,n){if(!e||(e.data&&(e=e.data),!e))return e;let i=Object.keys(e)[0],o=Object.values(e)[0],s=qm(r),a=bi(o,s),m=i==="queryRaw"?vo(a):Xe(a);return n?n(m):m}get[Symbol.toStringTag](){return"RequestHandler"}};function $m(t){if(t){if(t.kind==="batch")return{kind:"batch",options:{isolationLevel:t.isolationLevel,maxWait:t.maxWait,timeout:t.timeout}};if(t.kind==="itx")return{kind:"itx",options:bl(t)};rt(t,"Unknown transaction kind")}}function bl(t){return{id:t.id,payload:t.payload}}function Um(t,e){return _m(t)&&e?.kind==="batch"&&t.batchRequestIdx!==e.index}function Vm(t){return t.code==="P2009"||t.code==="P2012"}function xl(t){if(t.kind==="Union")return{kind:"Union",errors:t.errors.map(xl)};if(Array.isArray(t.selectionPath)){let[,...e]=t.selectionPath;return{...t,selectionPath:e}}return t}function qm(t){let e=[];for(let r=1;r<t.length;r+=2)e.push(t[r]);return e}u();l();c();p();d();var Ro=Fn;u();l();c();p();d();var Sl=It(li());u();l();c();p();d();var te=class extends Error{constructor(e){super(e+`
60
+ `)}var wo=({clientMethod:t,activeProvider:e,clientVersion:r})=>n=>{let i="",o;if(cn(n))i=n.sql,o={values:Yt(n.values,r),__prismaRawParameters__:!0};else if(Array.isArray(n)){let[s,...a]=n;i=s,o={values:Yt(a||[],r),__prismaRawParameters__:!0}}else switch(e){case"sqlite":case"mysql":{i=n.sql,o={values:Yt(n.values,r),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{i=n.text,o={values:Yt(n.values,r),__prismaRawParameters__:!0};break}case"sqlserver":{i=il(n),o={values:Yt(n.values,r),__prismaRawParameters__:!0};break}default:throw new Error(`The ${e} provider does not support ${t}`)}return o?.values?ll(`prisma.${t}(${i}, ${o.values})`):ll(`prisma.${t}(${i})`),{query:i,parameters:o}},cl={requestArgsToMiddlewareArgs(t){return[t.strings,...t.values]},middlewareArgsToRequestArgs(t){let[e,...r]=t;return new Am(e,r)}},pl={requestArgsToMiddlewareArgs(t){return[t]},middlewareArgsToRequestArgs(t){return t[0]}};u();l();c();p();d();function bo(t){return function(r,n){let i,o=(s=t)=>{try{return s===void 0||s?.kind==="itx"?i??=dl(r(s)):dl(r(s))}catch(a){return Promise.reject(a)}};return{get spec(){return n},then(s,a){return o().then(s,a)},catch(s){return o().catch(s)},finally(s){return o().finally(s)},requestTransaction(s){let a=o(s);return a.requestTransaction?a.requestTransaction(s):a},[Symbol.toStringTag]:"PrismaPromise"}}}function dl(t){return typeof t.then=="function"?t:Promise.resolve(t)}u();l();c();p();d();u();l();c();p();d();u();l();c();p();d();var ml={name:"@prisma/instrumentation-contract",version:"7.10.0-dev.41",description:"Shared types and utilities for Prisma instrumentation",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{require:{types:"./dist/index.d.ts",default:"./dist/index.js"},import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"}}},license:"Apache-2.0",homepage:"https://www.prisma.io",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/instrumentation-contract"},bugs:"https://github.com/prisma/prisma/issues",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",prepublishOnly:"pnpm run build",test:"vitest run"},files:["dist"],sideEffects:!1,devDependencies:{"@opentelemetry/api":"1.9.0"},peerDependencies:{"@opentelemetry/api":"^1.8"}};var Im=ml.version.split(".")[0],Om="PRISMA_INSTRUMENTATION",km=`V${Im}_PRISMA_INSTRUMENTATION`,fl=globalThis;function gl(){let t=fl[km];return t?.helper?t.helper:fl[Om]?.helper}var Nm={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(t,e,r){for(let n of e)r(n)},getActiveContext(){},runInChildSpan(t,e){return e()}},xo=class{isEnabled(){return this.getTracingHelper().isEnabled()}getTraceParent(e){return this.getTracingHelper().getTraceParent(e)}dispatchEngineSpans(e,r,n){return this.getTracingHelper().dispatchEngineSpans(e,r,n)}getActiveContext(){return this.getTracingHelper().getActiveContext()}runInChildSpan(e,r){return this.getTracingHelper().runInChildSpan(e,r)}getTracingHelper(){return gl()??Nm}};function yl(){return new xo}u();l();c();p();d();function hl(t,e=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--t===0&&r(e()),i?.(n)}}}u();l();c();p();d();function wl(t){return typeof t=="string"?t:t.reduce((e,r)=>{let n=typeof r=="string"?r:r.level;return n==="query"?e:e&&(r==="info"||e==="info")?"info":n},void 0)}u();l();c();p();d();import{hasBatchIndex as _m}from"@prisma/client-runtime-utils";u();l();c();p();d();function Po(t){if(t.action!=="findUnique"&&t.action!=="findUniqueOrThrow")return;let e=[];return t.modelName&&e.push(t.modelName),t.query.arguments&&e.push(Eo(t.query.arguments)),e.push(Eo(t.query.selection)),e.join("")}function Eo(t){return`(${Object.keys(t).sort().map(r=>{let n=t[r];return typeof n=="object"&&n!==null?`(${r} ${Eo(n)})`:r}).join(" ")})`}u();l();c();p();d();var Dm={aggregate:!1,aggregateRaw:!1,createMany:!0,createManyAndReturn:!0,createOne:!0,deleteMany:!0,deleteOne:!0,executeRaw:!0,findFirst:!1,findFirstOrThrow:!1,findMany:!1,findRaw:!1,findUnique:!1,findUniqueOrThrow:!1,groupBy:!1,queryRaw:!1,runCommandRaw:!0,updateMany:!0,updateManyAndReturn:!0,updateOne:!0,upsertOne:!0};function To(t){return Dm[t]}u();l();c();p();d();var Jn=class{constructor(e){this.options=e;this.batches={}}batches;tickActive=!1;request(e){let r=this.options.batchBy(e);return r?(this.batches[r]||(this.batches[r]=[],this.tickActive||(this.tickActive=!0,b.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((n,i)=>{this.batches[r].push({request:e,resolve:n,reject:i})})):this.options.singleLoader(e)}dispatchBatches(){for(let e in this.batches){let r=this.batches[e];delete this.batches[e],r.length===1?this.options.singleLoader(r[0].request).then(n=>{n instanceof Error?r[0].reject(n):r[0].resolve(n)}).catch(n=>{r[0].reject(n)}):(r.sort((n,i)=>this.options.batchOrder(n.request,i.request)),this.options.batchLoader(r.map(n=>n.request)).then(n=>{if(n instanceof Error)for(let i=0;i<r.length;i++)r[i].reject(n);else for(let i=0;i<r.length;i++){let o=n[i];o instanceof Error?r[i].reject(o):r[i].resolve(o)}}).catch(n=>{for(let i=0;i<r.length;i++)r[i].reject(n)}))}}get[Symbol.toStringTag](){return"DataLoader"}};u();l();c();p();d();import{Decimal as Mm}from"@prisma/client-runtime-utils";function At(t,e){if(e===null)return e;switch(t){case"bigint":return BigInt(e);case"bytes":return new Uint8Array(w.from(e,"base64"));case"decimal":return new Mm(e);case"datetime":case"date":return new Date(e);case"time":return new Date(`1970-01-01T${e}Z`);case"bigint-array":return e.map(r=>At("bigint",r));case"bytes-array":return e.map(r=>At("bytes",r));case"decimal-array":return e.map(r=>At("decimal",r));case"datetime-array":return e.map(r=>At("datetime",r));case"date-array":return e.map(r=>At("date",r));case"time-array":return e.map(r=>At("time",r));default:return e}}function vo(t){let e=[],r=Lm(t);for(let n=0;n<t.rows.length;n++){let i=t.rows[n],o={...r};for(let s=0;s<i.length;s++)o[t.columns[s]]=At(t.types[s],i[s]);e.push(o)}return e}function Lm(t){let e={};for(let r=0;r<t.columns.length;r++)e[t.columns[r]]=null;return e}var Fm=be("prisma:client:request_handler"),Hn=class{client;dataloader;logEmitter;constructor(e,r){this.logEmitter=r,this.client=e,this.dataloader=new Jn({batchLoader:ga(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(N=>N.protocolQuery),m=this.client._tracingHelper.getTraceParent(s),y=n.some(N=>To(N.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:m,transaction:$m(o),containsWrite:y,customDataProxyFetch:i})).map((N,$)=>{if(N instanceof Error)return N;try{return this.mapQueryEngineResult(n[$],N)}catch(U){return U}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?bl(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:To(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>{if(n.transaction?.kind==="itx"){let i=Po(n.protocolQuery);return`itx-${n.transaction.id}${i?`-${i}`:""}`}return n.transaction?.id?`transaction-${n.transaction.id}`:Po(n.protocolQuery)},batchOrder(n,i){return n.transaction?.kind==="batch"&&i.transaction?.kind==="batch"?n.transaction.index-i.transaction.index:0}})}async request(e){try{return await this.dataloader.request(e)}catch(r){let{clientMethod:n,callsite:i,transaction:o,args:s,modelName:a}=e;this.handleAndLogRequestError({error:r,clientMethod:n,callsite:i,transaction:o,args:s,modelName:a,globalOmit:e.globalOmit})}}mapQueryEngineResult({dataPath:e,unpacker:r},n){let i=n?.data,o=this.unpack(i,e,r);return b.env.PRISMA_CLIENT_GET_TIME?{data:o}:o}handleAndLogRequestError(e){try{this.handleRequestError(e)}catch(r){throw this.logEmitter&&this.logEmitter.emit("error",{message:r.message,target:e.clientMethod,timestamp:new Date}),r}}handleRequestError({error:e,clientMethod:r,callsite:n,transaction:i,args:o,modelName:s,globalOmit:a}){if(Fm(e),Um(e,i))throw e;if(e instanceof So&&Vm(e)){let y=xl(e.meta);sn({args:o,errors:[y],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let m=e.message;if(n&&(m=Xr({callsite:n,originalMethod:r,isPanic:e.isPanic,showColors:this.client._errorFormat==="pretty",message:m})),m=this.sanitizeMessage(m),e.code){let y=s?{modelName:s,...e.meta}:e.meta;throw new So(m,{code:e.code,clientVersion:this.client._clientVersion,meta:y,batchRequestIdx:e.batchRequestIdx})}else{if(e.isPanic)throw new Gn(m,this.client._clientVersion);if(e instanceof Ao)throw new Ao(m,{clientVersion:this.client._clientVersion,batchRequestIdx:e.batchRequestIdx});if(e instanceof Rt)throw new Rt(m,this.client._clientVersion);if(e instanceof Gn)throw new Gn(m,this.client._clientVersion)}throw e.clientVersion=this.client._clientVersion,e}sanitizeMessage(e){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?Mt(e):e}unpack(e,r,n){if(!e||(e.data&&(e=e.data),!e))return e;let i=Object.keys(e)[0],o=Object.values(e)[0],s=qm(r),a=bi(o,s),m=i==="queryRaw"?vo(a):Xe(a);return n?n(m):m}get[Symbol.toStringTag](){return"RequestHandler"}};function $m(t){if(t){if(t.kind==="batch")return{kind:"batch",options:{isolationLevel:t.isolationLevel,maxWait:t.maxWait,timeout:t.timeout}};if(t.kind==="itx")return{kind:"itx",options:bl(t)};rt(t,"Unknown transaction kind")}}function bl(t){return{id:t.id,payload:t.payload}}function Um(t,e){return _m(t)&&e?.kind==="batch"&&t.batchRequestIdx!==e.index}function Vm(t){return t.code==="P2009"||t.code==="P2012"}function xl(t){if(t.kind==="Union")return{kind:"Union",errors:t.errors.map(xl)};if(Array.isArray(t.selectionPath)){let[,...e]=t.selectionPath;return{...t,selectionPath:e}}return t}function qm(t){let e=[];for(let r=1;r<t.length;r+=2)e.push(t[r]);return e}u();l();c();p();d();var Ro=Fn;u();l();c();p();d();var Sl=It(li());u();l();c();p();d();var te=class extends Error{constructor(e){super(e+`
61
61
  Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};dr(te,"PrismaClientConstructorValidationError");var El=["errorFormat","adapter","accelerateUrl","log","transactionOptions","omit","comments","queryPlanCacheMaxSize","__internal"],Pl=["pretty","colorless","minimal"],Tl=["info","query","warn","error"],Bm={adapter:()=>{},accelerateUrl:t=>{if(t!==void 0){if(typeof t!="string")throw new te(`Invalid value ${JSON.stringify(t)} for "accelerateUrl" provided to PrismaClient constructor.`);if(t.trim().length===0)throw new te('"accelerateUrl" provided to PrismaClient constructor must be a non-empty string.')}},errorFormat:t=>{if(t){if(typeof t!="string")throw new te(`Invalid value ${JSON.stringify(t)} for "errorFormat" provided to PrismaClient constructor.`);if(!Pl.includes(t)){let e=$r(t,Pl);throw new te(`Invalid errorFormat ${t} provided to PrismaClient constructor.${e}`)}}},log:t=>{if(!t)return;if(!Array.isArray(t))throw new te(`Invalid value ${JSON.stringify(t)} for "log" provided to PrismaClient constructor.`);function e(r){if(typeof r=="string"&&!Tl.includes(r)){let n=$r(r,Tl);throw new te(`Invalid log level "${r}" provided to PrismaClient constructor.${n}`)}}for(let r of t){e(r);let n={level:e,emit:i=>{let o=["stdout","event"];if(!o.includes(i)){let s=$r(i,o);throw new te(`Invalid value ${JSON.stringify(i)} for "emit" in logLevel provided to PrismaClient constructor.${s}`)}}};if(r&&typeof r=="object")for(let[i,o]of Object.entries(r))if(n[i])n[i](o);else throw new te(`Invalid property ${i} for "log" provided to PrismaClient constructor`)}},transactionOptions:t=>{if(!t)return;let e=t.maxWait;if(e!=null&&e<=0)throw new te(`Invalid value ${e} for maxWait in "transactionOptions" provided to PrismaClient constructor. maxWait needs to be greater than 0`);let r=t.timeout;if(r!=null&&r<=0)throw new te(`Invalid value ${r} for timeout in "transactionOptions" provided to PrismaClient constructor. timeout needs to be greater than 0`)},omit:(t,e)=>{if(typeof t!="object")throw new te('"omit" option is expected to be an object.');if(t===null)throw new te('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(t)){let o=Jm(n,e.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let m=o.fields.find(y=>y.name===s);if(!m){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(m.relationName){r.push({kind:"RelationInOmit",modelKey:n,fieldName:s});continue}typeof a!="boolean"&&r.push({kind:"InvalidFieldValue",modelKey:n,fieldName:s})}}if(r.length>0)throw new te(Gm(t,r))},queryPlanCacheMaxSize:t=>{if(t!==void 0){if(typeof t!="number")throw new te(`Invalid value ${JSON.stringify(t)} for "queryPlanCacheMaxSize" provided to PrismaClient constructor. Expected a number.`);if(!Number.isInteger(t))throw new te(`Invalid value ${t} for "queryPlanCacheMaxSize" provided to PrismaClient constructor. Expected an integer.`);if(t<0)throw new te(`Invalid value ${t} for "queryPlanCacheMaxSize" provided to PrismaClient constructor. Cache size needs to be greater or equal to 0.`)}},comments:t=>{if(t!==void 0){if(!Array.isArray(t))throw new te(`Invalid value ${JSON.stringify(t)} for "comments" provided to PrismaClient constructor. Expected an array of SQL commenter plugins.`);for(let e=0;e<t.length;e++)if(typeof t[e]!="function")throw new te(`Invalid value at index ${e} for "comments" provided to PrismaClient constructor. Each plugin must be a function.`)}},__internal:t=>{if(!t)return;let e=["debug","engine","configOverride"];if(typeof t!="object")throw new te(`Invalid value ${JSON.stringify(t)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(t))if(!e.includes(r)){let n=$r(r,e);throw new te(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function jm(t){let e=t.adapter!==void 0,r=t.accelerateUrl!==void 0;if(e&&r)throw new te('The "adapter" and "accelerateUrl" options are mutually exclusive. Please provide only one of them.');if(!e&&!r)throw new te(`PrismaClient requires a driver adapter to connect to your database, but none was provided.
62
62
 
63
63
  Pass a driver adapter to the PrismaClient constructor, for example: