@ms-cloudpack/link-proxy 0.2.13 → 0.2.15

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.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- export const __webpack_id__=293;export const __webpack_ids__=[293];export const __webpack_modules__={25:e=>{e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),a="/*# ".concat(s," */");return[t].concat([a]).join("\n")}return[t].join("\n")}},191:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,s,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(r)for(var o=0;o<this.length;o++){var c=this[o][0];null!=c&&(i[c]=!0)}for(var u=0;u<e.length;u++){var d=[].concat(e[u]);r&&i[d[0]]||(void 0!==a&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=a),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),s&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=s):d[4]="".concat(s)),t.push(d))}},t}},342:(e,t,n)=>{var r,s,a={};n.r(a),n.d(a,{BRAND:()=>$e,DIRTY:()=>b,EMPTY_PATH:()=>g,INVALID:()=>_,NEVER:()=>Tt,OK:()=>k,ParseStatus:()=>v,Schema:()=>P,ZodAny:()=>ue,ZodArray:()=>he,ZodBigInt:()=>re,ZodBoolean:()=>se,ZodBranded:()=>Le,ZodCatch:()=>Re,ZodDate:()=>ae,ZodDefault:()=>Ie,ZodDiscriminatedUnion:()=>ve,ZodEffects:()=>Ze,ZodEnum:()=>je,ZodError:()=>d,ZodFirstPartyTypeKind:()=>Be,ZodFunction:()=>Ce,ZodIntersection:()=>be,ZodIssueCode:()=>c,ZodLazy:()=>Se,ZodLiteral:()=>Ee,ZodMap:()=>we,ZodNaN:()=>De,ZodNativeEnum:()=>Pe,ZodNever:()=>le,ZodNull:()=>ce,ZodNullable:()=>Ne,ZodNumber:()=>ne,ZodObject:()=>me,ZodOptional:()=>Me,ZodParsedType:()=>i,ZodPipeline:()=>qe,ZodPromise:()=>Te,ZodReadonly:()=>ze,ZodRecord:()=>xe,ZodSchema:()=>P,ZodSet:()=>Ae,ZodString:()=>ee,ZodSymbol:()=>ie,ZodTransformer:()=>Ze,ZodTuple:()=>ke,ZodType:()=>P,ZodUndefined:()=>oe,ZodUnion:()=>ge,ZodUnknown:()=>de,ZodVoid:()=>pe,addIssueToContext:()=>y,any:()=>nt,array:()=>it,bigint:()=>Ye,boolean:()=>Ge,coerce:()=>Pt,custom:()=>Fe,date:()=>Qe,datetimeRegex:()=>Y,defaultErrorMap:()=>l,discriminatedUnion:()=>dt,effect:()=>xt,enum:()=>_t,function:()=>gt,getErrorMap:()=>f,getParsedType:()=>o,instanceof:()=>Ve,intersection:()=>lt,isAborted:()=>x,isAsync:()=>C,isDirty:()=>w,isValid:()=>A,late:()=>We,lazy:()=>yt,literal:()=>vt,makeIssue:()=>m,map:()=>ft,nan:()=>Je,nativeEnum:()=>bt,never:()=>st,null:()=>tt,nullable:()=>At,number:()=>He,object:()=>ot,objectUtil:()=>s,oboolean:()=>jt,onumber:()=>Ot,optional:()=>wt,ostring:()=>Et,pipeline:()=>St,preprocess:()=>Ct,promise:()=>kt,quotelessJson:()=>u,record:()=>ht,set:()=>mt,setErrorMap:()=>h,strictObject:()=>ct,string:()=>Ke,symbol:()=>Xe,transformer:()=>xt,tuple:()=>pt,undefined:()=>et,union:()=>ut,unknown:()=>rt,util:()=>r,void:()=>at}),function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(r||(r={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(s||(s={}));const i=r.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),o=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return Number.isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":return Array.isArray(e)?i.array:null===e?i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?i.promise:"undefined"!=typeof Map&&e instanceof Map?i.map:"undefined"!=typeof Set&&e instanceof Set?i.set:"undefined"!=typeof Date&&e instanceof Date?i.date:i.object;default:return i.unknown}},c=r.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),u=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class d extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(r);else if("invalid_return_type"===s.code)r(s.returnTypeError);else if("invalid_arguments"===s.code)r(s.argumentsError);else if(0===s.path.length)n._errors.push(t(s));else{let e=n,r=0;for(;r<s.path.length;){const n=s.path[r];r===s.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(s))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof d))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}d.create=e=>new d(e);const l=(e,t)=>{let n;switch(e.code){case c.invalid_type:n=e.received===i.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case c.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,r.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:n=`Unrecognized key(s) in object: ${r.joinValues(e.keys,", ")}`;break;case c.invalid_union:n="Invalid input";break;case c.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${r.joinValues(e.options)}`;break;case c.invalid_enum_value:n=`Invalid enum value. Expected ${r.joinValues(e.options)}, received '${e.received}'`;break;case c.invalid_arguments:n="Invalid function arguments";break;case c.invalid_return_type:n="Invalid function return type";break;case c.invalid_date:n="Invalid date";break;case c.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:r.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case c.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case c.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case c.custom:n="Invalid input";break;case c.invalid_intersection_types:n="Intersection results could not be merged";break;case c.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case c.not_finite:n="Number must be finite";break;default:n=t.defaultError,r.assertNever(e)}return{message:n}};let p=l;function h(e){p=e}function f(){return p}const m=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,a=[...n,...s.path||[]],i={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let o="";const c=r.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...s,path:a,message:o}},g=[];function y(e,t){const n=f(),r=m({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===l?void 0:l].filter(e=>!!e)});e.common.issues.push(r)}class v{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return _;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,r=await e.value;n.push({key:t,value:r})}return v.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:s}=r;if("aborted"===t.status)return _;if("aborted"===s.status)return _;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!r.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const _=Object.freeze({status:"aborted"}),b=e=>({status:"dirty",value:e}),k=e=>({status:"valid",value:e}),x=e=>"aborted"===e.status,w=e=>"dirty"===e.status,A=e=>"valid"===e.status,C=e=>"undefined"!=typeof Promise&&e instanceof Promise;var S;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(S||(S={}));class E{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const O=(e,t)=>{if(A(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new d(e.common.issues);return this._error=t,this._error}}};function j(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??s.defaultError}:void 0===s.data?{message:a??r??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:a??n??s.defaultError}},description:s}}class P{get description(){return this._def.description}_getType(e){return o(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new v,ctx:{common:e.parent.common,data:e.data,parsedType:o(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(C(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)},r=this._parseSync({data:e,path:n.path,parent:n});return O(n,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return A(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>A(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:o(e)},r=this._parse({data:e,path:n.path,parent:n}),s=await(C(r)?r:Promise.resolve(r));return O(n,s)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const s=e(t),a=()=>r.addIssue({code:c.custom,...n(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then(e=>!!e||(a(),!1)):!!s||(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new Ze({schema:this,typeName:Be.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Me.create(this,this._def)}nullable(){return Ne.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return he.create(this)}promise(){return Te.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return be.create(this,e,this._def)}transform(e){return new Ze({...j(this._def),schema:this,typeName:Be.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ie({...j(this._def),innerType:this,defaultValue:t,typeName:Be.ZodDefault})}brand(){return new Le({typeName:Be.ZodBranded,type:this,...j(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Re({...j(this._def),innerType:this,catchValue:t,typeName:Be.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return qe.create(this,e)}readonly(){return ze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const T=/^c[^\s-]{8,}$/i,Z=/^[0-9a-z]+$/,M=/^[0-9A-HJKMNP-TV-Z]{26}$/i,N=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,I=/^[a-z0-9_-]{21}$/i,R=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,D=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let L;const q=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,z=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,U=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,F=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,W=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,V="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",K=new RegExp(`^${V}$`);function H(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function J(e){return new RegExp(`^${H(e)}$`)}function Y(e){let t=`${V}T${H(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function G(e,t){return!("v4"!==t&&t||!q.test(e))||!("v6"!==t&&t||!U.test(e))}function Q(e,t){if(!R.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!("object"!=typeof s||null===s||"typ"in s&&"JWT"!==s?.typ||!s.alg||t&&s.alg!==t)}catch{return!1}}function X(e,t){return!("v4"!==t&&t||!z.test(e))||!("v6"!==t&&t||!F.test(e))}class ee extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==i.string){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.string,received:t.parsedType}),_}const t=new v;let n;for(const s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:c.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("max"===s.kind)e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:c.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("length"===s.kind){const r=e.data.length>s.value,a=e.data.length<s.value;(r||a)&&(n=this._getOrReturnCtx(e,n),r?y(n,{code:c.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&y(n,{code:c.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if("email"===s.kind)$.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"email",code:c.invalid_string,message:s.message}),t.dirty());else if("emoji"===s.kind)L||(L=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),L.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"emoji",code:c.invalid_string,message:s.message}),t.dirty());else if("uuid"===s.kind)N.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"uuid",code:c.invalid_string,message:s.message}),t.dirty());else if("nanoid"===s.kind)I.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"nanoid",code:c.invalid_string,message:s.message}),t.dirty());else if("cuid"===s.kind)T.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid",code:c.invalid_string,message:s.message}),t.dirty());else if("cuid2"===s.kind)Z.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cuid2",code:c.invalid_string,message:s.message}),t.dirty());else if("ulid"===s.kind)M.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ulid",code:c.invalid_string,message:s.message}),t.dirty());else if("url"===s.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),y(n,{validation:"url",code:c.invalid_string,message:s.message}),t.dirty()}else"regex"===s.kind?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"regex",code:c.invalid_string,message:s.message}),t.dirty())):"trim"===s.kind?e.data=e.data.trim():"includes"===s.kind?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),y(n,{code:c.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):"toLowerCase"===s.kind?e.data=e.data.toLowerCase():"toUpperCase"===s.kind?e.data=e.data.toUpperCase():"startsWith"===s.kind?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:c.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):"endsWith"===s.kind?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),y(n,{code:c.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):"datetime"===s.kind?Y(s).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:c.invalid_string,validation:"datetime",message:s.message}),t.dirty()):"date"===s.kind?K.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:c.invalid_string,validation:"date",message:s.message}),t.dirty()):"time"===s.kind?J(s).test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:c.invalid_string,validation:"time",message:s.message}),t.dirty()):"duration"===s.kind?D.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"duration",code:c.invalid_string,message:s.message}),t.dirty()):"ip"===s.kind?G(e.data,s.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"ip",code:c.invalid_string,message:s.message}),t.dirty()):"jwt"===s.kind?Q(e.data,s.alg)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"jwt",code:c.invalid_string,message:s.message}),t.dirty()):"cidr"===s.kind?X(e.data,s.version)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"cidr",code:c.invalid_string,message:s.message}),t.dirty()):"base64"===s.kind?W.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64",code:c.invalid_string,message:s.message}),t.dirty()):"base64url"===s.kind?B.test(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{validation:"base64url",code:c.invalid_string,message:s.message}),t.dirty()):r.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:c.invalid_string,...S.errToObj(n)})}_addCheck(e){return new ee({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...S.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...S.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...S.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new ee({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function te(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}ee.create=e=>new ee({checks:[],typeName:Be.ZodString,coerce:e?.coerce??!1,...j(e)});class ne extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==i.number){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.number,received:t.parsedType}),_}let t;const n=new v;for(const s of this._def.checks)"int"===s.kind?r.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),y(t,{code:c.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):"multipleOf"===s.kind?0!==te(e.data,s.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),y(t,{code:c.not_finite,message:s.message}),n.dirty()):r.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,n,r){return new ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:S.toString(r)}]})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&r.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ne.create=e=>new ne({checks:[],typeName:Be.ZodNumber,coerce:e?.coerce||!1,...j(e)});class re extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==i.bigint)return this._getInvalidInput(e);let t;const n=new v;for(const s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),y(t,{code:c.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):r.assertNever(s);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,n,r){return new re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:S.toString(r)}]})}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}re.create=e=>new re({checks:[],typeName:Be.ZodBigInt,coerce:e?.coerce??!1,...j(e)});class se extends P{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.boolean,received:t.parsedType}),_}return k(e.data)}}se.create=e=>new se({typeName:Be.ZodBoolean,coerce:e?.coerce||!1,...j(e)});class ae extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==i.date){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.date,received:t.parsedType}),_}if(Number.isNaN(e.data.getTime()))return y(this._getOrReturnCtx(e),{code:c.invalid_date}),_;const t=new v;let n;for(const s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:c.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),y(n,{code:c.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):r.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ae.create=e=>new ae({checks:[],coerce:e?.coerce||!1,typeName:Be.ZodDate,...j(e)});class ie extends P{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.symbol,received:t.parsedType}),_}return k(e.data)}}ie.create=e=>new ie({typeName:Be.ZodSymbol,...j(e)});class oe extends P{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.undefined,received:t.parsedType}),_}return k(e.data)}}oe.create=e=>new oe({typeName:Be.ZodUndefined,...j(e)});class ce extends P{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.null,received:t.parsedType}),_}return k(e.data)}}ce.create=e=>new ce({typeName:Be.ZodNull,...j(e)});class ue extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return k(e.data)}}ue.create=e=>new ue({typeName:Be.ZodAny,...j(e)});class de extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return k(e.data)}}de.create=e=>new de({typeName:Be.ZodUnknown,...j(e)});class le extends P{_parse(e){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.never,received:t.parsedType}),_}}le.create=e=>new le({typeName:Be.ZodNever,...j(e)});class pe extends P{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.void,received:t.parsedType}),_}return k(e.data)}}pe.create=e=>new pe({typeName:Be.ZodVoid,...j(e)});class he extends P{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==i.array)return y(t,{code:c.invalid_type,expected:i.array,received:t.parsedType}),_;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(e||s)&&(y(t,{code:e?c.too_big:c.too_small,minimum:s?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(y(t,{code:c.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(y(t,{code:c.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new E(t,e,t.path,n)))).then(e=>v.mergeArray(n,e));const s=[...t.data].map((e,n)=>r.type._parseSync(new E(t,e,t.path,n)));return v.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new he({...this._def,minLength:{value:e,message:S.toString(t)}})}max(e,t){return new he({...this._def,maxLength:{value:e,message:S.toString(t)}})}length(e,t){return new he({...this._def,exactLength:{value:e,message:S.toString(t)}})}nonempty(e){return this.min(1,e)}}function fe(e){if(e instanceof me){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Me.create(fe(r))}return new me({...e._def,shape:()=>t})}return e instanceof he?new he({...e._def,type:fe(e.element)}):e instanceof Me?Me.create(fe(e.unwrap())):e instanceof Ne?Ne.create(fe(e.unwrap())):e instanceof ke?ke.create(e.items.map(e=>fe(e))):e}he.create=(e,t)=>new he({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Be.ZodArray,...j(t)});class me extends P{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=r.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==i.object){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.object,received:t.parsedType}),_}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof le&&"strip"===this._def.unknownKeys))for(const e in n.data)s.includes(e)||a.push(e);const o=[];for(const e of s){const t=r[e],s=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new E(n,s,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof le){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of a)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)a.length>0&&(y(n,{code:c.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new E(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of o){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>v.mergeObjectSync(t,e)):v.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new me({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const r=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:S.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new me({...this._def,unknownKeys:"strip"})}passthrough(){return new me({...this._def,unknownKeys:"passthrough"})}extend(e){return new me({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new me({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Be.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new me({...this._def,catchall:e})}pick(e){const t={};for(const n of r.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new me({...this._def,shape:()=>t})}omit(e){const t={};for(const n of r.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new me({...this._def,shape:()=>t})}deepPartial(){return fe(this)}partial(e){const t={};for(const n of r.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new me({...this._def,shape:()=>t})}required(e){const t={};for(const n of r.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Me;)e=e._def.innerType;t[n]=e}return new me({...this._def,shape:()=>t})}keyof(){return Oe(r.objectKeys(this.shape))}}me.create=(e,t)=>new me({shape:()=>e,unknownKeys:"strip",catchall:le.create(),typeName:Be.ZodObject,...j(t)}),me.strictCreate=(e,t)=>new me({shape:()=>e,unknownKeys:"strict",catchall:le.create(),typeName:Be.ZodObject,...j(t)}),me.lazycreate=(e,t)=>new me({shape:e,unknownKeys:"strip",catchall:le.create(),typeName:Be.ZodObject,...j(t)});class ge extends P{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map(e=>new d(e.ctx.common.issues));return y(t,{code:c.invalid_union,unionErrors:n}),_});{let e;const r=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=r.map(e=>new d(e));return y(t,{code:c.invalid_union,unionErrors:s}),_}}get options(){return this._def.options}}ge.create=(e,t)=>new ge({options:e,typeName:Be.ZodUnion,...j(t)});const ye=e=>e instanceof Se?ye(e.schema):e instanceof Ze?ye(e.innerType()):e instanceof Ee?[e.value]:e instanceof je?e.options:e instanceof Pe?r.objectValues(e.enum):e instanceof Ie?ye(e._def.innerType):e instanceof oe?[void 0]:e instanceof ce?[null]:e instanceof Me?[void 0,...ye(e.unwrap())]:e instanceof Ne?[null,...ye(e.unwrap())]:e instanceof Le||e instanceof ze?ye(e.unwrap()):e instanceof Re?ye(e._def.innerType):[];class ve extends P{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return y(t,{code:c.invalid_type,expected:i.object,received:t.parsedType}),_;const n=this.discriminator,r=t.data[n],s=this.optionsMap.get(r);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(y(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=ye(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(r.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);r.set(s,n)}}return new ve({typeName:Be.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...j(n)})}}function _e(e,t){const n=o(e),s=o(t);if(e===t)return{valid:!0,data:e};if(n===i.object&&s===i.object){const n=r.objectKeys(t),s=r.objectKeys(e).filter(e=>-1!==n.indexOf(e)),a={...e,...t};for(const n of s){const r=_e(e[n],t[n]);if(!r.valid)return{valid:!1};a[n]=r.data}return{valid:!0,data:a}}if(n===i.array&&s===i.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const s=_e(e[r],t[r]);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}return n===i.date&&s===i.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class be extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(x(e)||x(r))return _;const s=_e(e.value,r.value);return s.valid?((w(e)||w(r))&&t.dirty(),{status:t.value,value:s.data}):(y(n,{code:c.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}be.create=(e,t,n)=>new be({left:e,right:t,typeName:Be.ZodIntersection,...j(n)});class ke extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.array)return y(n,{code:c.invalid_type,expected:i.array,received:n.parsedType}),_;if(n.data.length<this._def.items.length)return y(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&n.data.length>this._def.items.length&&(y(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new E(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>v.mergeArray(t,e)):v.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new ke({...this._def,rest:e})}}ke.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ke({items:e,typeName:Be.ZodTuple,rest:null,...j(t)})};class xe extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.object)return y(n,{code:c.invalid_type,expected:i.object,received:n.parsedType}),_;const r=[],s=this._def.keyType,a=this._def.valueType;for(const e in n.data)r.push({key:s._parse(new E(n,e,n.path,e)),value:a._parse(new E(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?v.mergeObjectAsync(t,r):v.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new xe(t instanceof P?{keyType:e,valueType:t,typeName:Be.ZodRecord,...j(n)}:{keyType:ee.create(),valueType:e,typeName:Be.ZodRecord,...j(t)})}}class we extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.map)return y(n,{code:c.invalid_type,expected:i.map,received:n.parsedType}),_;const r=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new E(n,e,n.path,[a,"key"])),value:s._parse(new E(n,t,n.path,[a,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of a){const r=await n.key,s=await n.value;if("aborted"===r.status||"aborted"===s.status)return _;"dirty"!==r.status&&"dirty"!==s.status||t.dirty(),e.set(r.value,s.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of a){const r=n.key,s=n.value;if("aborted"===r.status||"aborted"===s.status)return _;"dirty"!==r.status&&"dirty"!==s.status||t.dirty(),e.set(r.value,s.value)}return{status:t.value,value:e}}}}we.create=(e,t,n)=>new we({valueType:t,keyType:e,typeName:Be.ZodMap,...j(n)});class Ae extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.set)return y(n,{code:c.invalid_type,expected:i.set,received:n.parsedType}),_;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(y(n,{code:c.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(y(n,{code:c.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const s=this._def.valueType;function a(e){const n=new Set;for(const r of e){if("aborted"===r.status)return _;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map((e,t)=>s._parse(new E(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(e,t){return new Ae({...this._def,minSize:{value:e,message:S.toString(t)}})}max(e,t){return new Ae({...this._def,maxSize:{value:e,message:S.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ae.create=(e,t)=>new Ae({valueType:e,minSize:null,maxSize:null,typeName:Be.ZodSet,...j(t)});class Ce extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return y(t,{code:c.invalid_type,expected:i.function,received:t.parsedType}),_;function n(e,n){return m({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f(),l].filter(e=>!!e),issueData:{code:c.invalid_arguments,argumentsError:n}})}function r(e,n){return m({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,f(),l].filter(e=>!!e),issueData:{code:c.invalid_return_type,returnTypeError:n}})}const s={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Te){const e=this;return k(async function(...t){const i=new d([]),o=await e._def.args.parseAsync(t,s).catch(e=>{throw i.addIssue(n(t,e)),i}),c=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(c,s).catch(e=>{throw i.addIssue(r(c,e)),i})})}{const e=this;return k(function(...t){const i=e._def.args.safeParse(t,s);if(!i.success)throw new d([n(t,i.error)]);const o=Reflect.apply(a,this,i.data),c=e._def.returns.safeParse(o,s);if(!c.success)throw new d([r(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ce({...this._def,args:ke.create(e).rest(de.create())})}returns(e){return new Ce({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ce({args:e||ke.create([]).rest(de.create()),returns:t||de.create(),typeName:Be.ZodFunction,...j(n)})}}class Se extends P{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Se.create=(e,t)=>new Se({getter:e,typeName:Be.ZodLazy,...j(t)});class Ee extends P{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return y(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Oe(e,t){return new je({values:e,typeName:Be.ZodEnum,...j(t)})}Ee.create=(e,t)=>new Ee({value:e,typeName:Be.ZodLiteral,...j(t)});class je extends P{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return y(t,{expected:r.joinValues(n),received:t.parsedType,code:c.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return y(t,{received:t.data,code:c.invalid_enum_value,options:n}),_}return k(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return je.create(e,{...this._def,...t})}exclude(e,t=this._def){return je.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}je.create=Oe;class Pe extends P{_parse(e){const t=r.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==i.string&&n.parsedType!==i.number){const e=r.objectValues(t);return y(n,{expected:r.joinValues(e),received:n.parsedType,code:c.invalid_type}),_}if(this._cache||(this._cache=new Set(r.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=r.objectValues(t);return y(n,{received:n.data,code:c.invalid_enum_value,options:e}),_}return k(e.data)}get enum(){return this._def.values}}Pe.create=(e,t)=>new Pe({values:e,typeName:Be.ZodNativeEnum,...j(t)});class Te extends P{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return y(t,{code:c.invalid_type,expected:i.promise,received:t.parsedType}),_;const n=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return k(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Te.create=(e,t)=>new Te({type:e,typeName:Be.ZodPromise,...j(t)});class Ze extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Be.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:e=>{y(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===s.type){const e=s.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return _;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?_:"dirty"===r.status||"dirty"===t.value?b(r.value):r});{if("aborted"===t.value)return _;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?_:"dirty"===r.status||"dirty"===t.value?b(r.value):r}}if("refinement"===s.type){const e=e=>{const t=s.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?_:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?_:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===s.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!A(e))return _;const r=s.transform(e.value,a);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>A(e)?Promise.resolve(s.transform(e.value,a)).then(e=>({status:t.value,value:e})):_)}r.assertNever(s)}}Ze.create=(e,t,n)=>new Ze({schema:e,typeName:Be.ZodEffects,effect:t,...j(n)}),Ze.createWithPreprocess=(e,t,n)=>new Ze({schema:t,effect:{type:"preprocess",transform:e},typeName:Be.ZodEffects,...j(n)});class Me extends P{_parse(e){return this._getType(e)===i.undefined?k(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Me.create=(e,t)=>new Me({innerType:e,typeName:Be.ZodOptional,...j(t)});class Ne extends P{_parse(e){return this._getType(e)===i.null?k(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ne.create=(e,t)=>new Ne({innerType:e,typeName:Be.ZodNullable,...j(t)});class Ie extends P{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===i.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ie.create=(e,t)=>new Ie({innerType:e,typeName:Be.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...j(t)});class Re extends P{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return C(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new d(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new d(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Re.create=(e,t)=>new Re({innerType:e,typeName:Be.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...j(t)});class De extends P{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return y(t,{code:c.invalid_type,expected:i.nan,received:t.parsedType}),_}return{status:"valid",value:e.data}}}De.create=e=>new De({typeName:Be.ZodNaN,...j(e)});const $e=Symbol("zod_brand");class Le extends P{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class qe extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?_:"dirty"===e.status?(t.dirty(),b(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?_:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new qe({in:e,out:t,typeName:Be.ZodPipeline})}}class ze extends P{_parse(e){const t=this._def.innerType._parse(e),n=e=>(A(e)&&(e.value=Object.freeze(e.value)),e);return C(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}function Ue(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Fe(e,t={},n){return e?ue.create().superRefine((r,s)=>{const a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){const e=Ue(t,r),a=e.fatal??n??!0;s.addIssue({code:"custom",...e,fatal:a})}});if(!a){const e=Ue(t,r),a=e.fatal??n??!0;s.addIssue({code:"custom",...e,fatal:a})}}):ue.create()}ze.create=(e,t)=>new ze({innerType:e,typeName:Be.ZodReadonly,...j(t)});const We={object:me.lazycreate};var Be;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Be||(Be={}));const Ve=(e,t={message:`Input not instance of ${e.name}`})=>Fe(t=>t instanceof e,t),Ke=ee.create,He=ne.create,Je=De.create,Ye=re.create,Ge=se.create,Qe=ae.create,Xe=ie.create,et=oe.create,tt=ce.create,nt=ue.create,rt=de.create,st=le.create,at=pe.create,it=he.create,ot=me.create,ct=me.strictCreate,ut=ge.create,dt=ve.create,lt=be.create,pt=ke.create,ht=xe.create,ft=we.create,mt=Ae.create,gt=Ce.create,yt=Se.create,vt=Ee.create,_t=je.create,bt=Pe.create,kt=Te.create,xt=Ze.create,wt=Me.create,At=Ne.create,Ct=Ze.createWithPreprocess,St=qe.create,Et=()=>Ke().optional(),Ot=()=>He().optional(),jt=()=>Ge().optional(),Pt={string:e=>ee.create({...e,coerce:!0}),number:e=>ne.create({...e,coerce:!0}),boolean:e=>se.create({...e,coerce:!0}),bigint:e=>re.create({...e,coerce:!0}),date:e=>ae.create({...e,coerce:!0})},Tt=_,Zt=a,Mt=(Zt.object({status:Zt.literal("idle").or(Zt.literal("pending").or(Zt.literal("unknown"))),remainingTasks:Zt.number(),totalTasks:Zt.number(),totalErrors:Zt.number(),totalWarnings:Zt.number()}),Zt.object({id:Zt.string(),name:Zt.string().optional(),inputPath:Zt.string().optional(),outputPath:Zt.string().optional()}));function Nt(e){return ot(e).strict()}const It=Nt({file:Zt.string(),line:Zt.number().optional(),column:Zt.number().optional()}),Rt=Nt({text:Zt.string(),location:It.optional()}),Dt=Nt({text:Zt.string(),source:Zt.string(),location:It.optional(),notes:Zt.array(Rt).optional()}),$t=Zt.object({id:Zt.string(),errors:Zt.array(Dt).optional(),warnings:Zt.array(Dt).optional()}),Lt=Zt.object({name:Zt.string(),start:Zt.number(),end:Zt.number().optional(),threwException:Zt.boolean().optional()}),qt=Zt.object({status:Zt.literal("pending").or(Zt.literal("complete")).optional(),timings:Zt.array(Lt).optional(),startTime:Zt.number(),durationMilliseconds:Zt.number().optional(),lastUpdated:Zt.number().optional()}).extend(Mt.shape).extend($t.shape);ot({tasks:it(qt)});const zt=yt(()=>Nt({name:Ke(),version:Ke(),path:Ke(),dependencies:ht(Ke()),requiredBy:ht(Ke()),isExternal:Ge().optional(),isLinked:Ge().optional(),scopedVersions:ht(yt(()=>zt)).optional()})),Ut=ht(Ke(),zt),Ft=e=>ht(ut([e,et()])),Wt=ot({browser:ht(Ke()),node:ht(Ke())}),Bt=ht(Ke(),ut([et(),Ke()])).optional(),Vt=ot({name:Ke(),version:Ke(),exports:nt(),dependencies:Bt,peerDependencies:Bt}),Kt=Nt({path:Ke(),rootPath:Ke().optional(),includeAll:Ge().optional(),ignoredPackages:Ke().array().optional(),ignoreResolutions:Ge().optional(),resolveStrategy:_t(["dedupe","duplicate"]).optional(),remote:ot({resolveMap:Ut,hostUrl:Ke(),packages:ot({definitions:Ft(ot({})),transformedDefinitions:Ft(Vt)}),packageHashes:ot({hashesWithSource:Wt,hashesWithNoSource:Wt})}).optional()}),Ht=ot({linkedPath:Kt}),Jt=ot({resolveMap:Ut,linkedPaths:it(Kt)}),Yt=ot({packagePath:Ke(),hash:Ke().optional(),definition:Vt.optional()}),Gt=ot({name:Ke(),version:Ke().optional()}),Qt=ut([Ke(),Gt]),Xt=ut([Ke(),Gt.required()]),en=Nt({packageSettings:it(ot({match:ut([Qt,it(Qt)])}).passthrough()),generated:ot({packageSettings:it(ot({match:Xt}).passthrough())}).passthrough()}).passthrough(),tn=(Zt.number(),Zt.string(),{path:["link","update"],type:Yt}),nn={path:["link","config"],type:en},rn={path:["link","paths"],type:Ht},sn={path:["link","done"],type:Jt},an={path:["link","disconnected"],type:Zt.object({reason:Zt.enum(["lost","unreachable"])})};var on=Object.create,cn=Object.defineProperty,un=Object.getOwnPropertyDescriptor,dn=Object.getOwnPropertyNames,ln=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty,hn=(e,t)=>function(){return t||(0,e[dn(e)[0]])((t={exports:{}}).exports,t),t.exports},fn=(e,t,n)=>(n=null!=e?on(ln(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var s,a=dn(t),i=0,o=a.length;i<o;i++)s=a[i],pn.call(e,s)||undefined===s||cn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=un(t,s))||r.enumerable});return e})(!t&&e&&e.__esModule?n:cn(n,"default",{value:e,enumerable:!0}),e)),mn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),gn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=mn().default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=n(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports}}),yn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=mn().default,r=gn();t.exports=function(e){var t=r(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),vn=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=yn();t.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},t.exports.__esModule=!0,t.exports.default=t.exports}}),_n=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=vn();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}t.exports=function(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?r(Object(s),!0).forEach(function(t){n(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):r(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e},t.exports.__esModule=!0,t.exports.default=t.exports}});function bn(e){const t={subscribe(t){let n=null,r=!1,s=!1,a=!1;function i(){null!==n?s||(s=!0,"function"==typeof n?n():n&&n.unsubscribe()):a=!0}return n=e({next(e){var n;r||null===(n=t.next)||void 0===n||n.call(t,e)},error(e){var n;r||(r=!0,null===(n=t.error)||void 0===n||n.call(t,e),i())},complete(){var e;r||(r=!0,null===(e=t.complete)||void 0===e||e.call(t),i())}}),a&&i(),{unsubscribe:i}},pipe:(...e)=>e.reduce(kn,t)};return t}function kn(e,t){return t(e)}function xn(e){return bn(t=>function t(n=0,r=e.op){const s=e.links[n];if(!s)throw new Error("No more links to execute - did you forget to add an ending link?");return s({op:r,next:e=>t(n+1,e)})}().subscribe(t))}function wn(e){return Array.isArray(e)?e:[e]}function An(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}"function"==typeof Symbol&&Symbol.asyncIterator;const Cn=e=>e();function Sn(e=0){return new Promise(t=>setTimeout(t,e))}var En=fn(vn(),1),On=fn(_n(),1),jn=class e extends Error{constructor(t,n){var r,s;const a=null==n?void 0:n.cause;super(t,{cause:a}),(0,En.default)(this,"cause",void 0),(0,En.default)(this,"shape",void 0),(0,En.default)(this,"data",void 0),(0,En.default)(this,"meta",void 0),this.meta=null==n?void 0:n.meta,this.cause=a,this.shape=null==n||null===(r=n.result)||void 0===r?void 0:r.error,this.data=null==n||null===(s=n.result)||void 0===s?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,e.prototype)}static from(t,n={}){const r=t;return function(e){return e instanceof jn}(r)?(n.meta&&(r.meta=(0,On.default)((0,On.default)({},r.meta),n.meta)),r):An(s=r)&&An(s.error)&&"number"==typeof s.error.code&&"string"==typeof s.error.message?new e(r.error.message,(0,On.default)((0,On.default)({},n),{},{result:r})):new e("string"==typeof(a=r)?a:An(a)&&"string"==typeof a.message?a.message:"Unknown error",(0,On.default)((0,On.default)({},n),{},{cause:r}));var s,a}};function Pn(e){return e?"input"in e?e:{input:e,output:e}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}}const Tn=e=>"function"==typeof e;var Zn=fn(_n(),1);const Mn={query:"GET",mutation:"POST",subscription:"PATCH"};function Nn(e){return"input"in e?e.transformer.input.serialize(e.input):function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}(e.inputs.map(t=>e.transformer.input.serialize(t)))}const In=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const r=[];if(t[1]&&r.push(t[1]),"inputs"in e&&r.push("batch=1"),"query"===e.type||"subscription"===e.type){const t=Nn(e);void 0!==t&&"POST"!==e.methodOverride&&r.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return r.length&&(n+="?"+r.join("&")),n},Rn=e=>{if("query"===e.type&&"POST"!==e.methodOverride)return;const t=Nn(e);return void 0!==t?JSON.stringify(t):void 0};var Dn=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const $n=e=>{var t;if(null==e?void 0:e.aborted){if(null===(t=e.throwIfAborted)||void 0===t||t.call(e),"undefined"!=typeof DOMException)throw new DOMException("AbortError","AbortError");throw new Dn}};fn(_n(),1);var Ln=Object.create,qn=Object.defineProperty,zn=Object.getOwnPropertyDescriptor,Un=Object.getOwnPropertyNames,Fn=Object.getPrototypeOf,Wn=Object.prototype.hasOwnProperty,Bn=(e,t)=>function(){return t||(0,e[Un(e)[0]])((t={exports:{}}).exports,t),t.exports},Vn=(e,t,n)=>(n=null!=e?Ln(Fn(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var s,a=Un(t),i=0,o=a.length;i<o;i++)s=a[i],Wn.call(e,s)||undefined===s||qn(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=zn(t,s))||r.enumerable});return e})(!t&&e&&e.__esModule?n:qn(n,"default",{value:e,enumerable:!0}),e));const Kn=()=>{},Hn=e=>{Object.freeze&&Object.freeze(e)};function Jn(e,t,n){var r;const s=t.join(".");return null!==(r=n[s])&&void 0!==r||(n[s]=new Proxy(Kn,{get(r,s){if("string"==typeof s&&"then"!==s)return Jn(e,[...t,s],n)},apply(n,r,s){const a=t[t.length-1];let i={args:s,path:t};return"call"===a?i={args:s.length>=2?[s[1]]:[],path:t.slice(0,-1)}:"apply"===a&&(i={args:s.length>=2?s[1]:[],path:t.slice(0,-1)}),Hn(i.args),Hn(i.path),e(i)}})),n[s]}const Yn=e=>Jn(e,[],Object.create(null));var Gn=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Qn=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Gn().default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=n(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports}}),Xn=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Gn().default,r=Qn();t.exports=function(e){var t=r(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),er=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Xn();t.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},t.exports.__esModule=!0,t.exports.default=t.exports}}),tr=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=er();function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}t.exports=function(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?r(Object(s),!0).forEach(function(t){n(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):r(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e},t.exports.__esModule=!0,t.exports.default=t.exports}});Vn(tr(),1);Vn(er(),1),Error;Error;var nr=Vn(tr(),1),rr=class extends Error{constructor(){super("Unable to transform response from server")}};function sr(e,t){let n;try{n=function(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,nr.default)((0,nr.default)({},e),{},{error:n})}}return{ok:!0,result:(0,nr.default)((0,nr.default)({},e.result),(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.deserialize(e.result.data)})}}(e,t)}catch(e){throw new rr}if(!(n.ok||An(n.error.error)&&"number"==typeof n.error.error.code))throw new rr;if(n.ok&&!An(n.result))throw new rr;return n}Vn(tr(),1),Symbol("lazy"),Symbol();const ar=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function ir(e){let t=null,n=null;function r(){const r=function(t){const n=[[]];let r=0;for(;;){const i=t[r];if(!i)break;const o=n[n.length-1];var s,a;i.aborted?(null===(s=i.reject)||void 0===s||s.call(i,new Error("Aborted")),r++):e.validate(o.concat(i).map(e=>e.key))?(o.push(i),r++):0!==o.length?n.push([]):(null===(a=i.reject)||void 0===a||a.call(i,new Error("Input is too big for a single dispatch")),r++)}return n}(t);clearTimeout(n),n=null,t=null;for(const t of r){if(!t.length)continue;const n={items:t};for(const e of t)e.batch=n;e.fetch(n.items.map(e=>e.key)).then(async e=>{await Promise.all(e.map(async(e,t)=>{const r=n.items[t];try{var s;const t=await Promise.resolve(e);null===(s=r.resolve)||void 0===s||s.call(r,t)}catch(e){var a;null===(a=r.reject)||void 0===a||a.call(r,e)}r.batch=null,r.reject=null,r.resolve=null}));for(const e of n.items){var t;null===(t=e.reject)||void 0===t||t.call(e,new Error("Missing result")),e.batch=null}}).catch(e=>{for(const r of n.items){var t;null===(t=r.reject)||void 0===t||t.call(r,e),r.batch=null}})}}return{load:function(e){var s;const a={aborted:!1,key:e,batch:null,resolve:ar,reject:ar},i=new Promise((e,n)=>{var r;a.reject=n,a.resolve=e,null!==(r=t)&&void 0!==r||(t=[]),t.push(a)});return null!==(s=n)&&void 0!==s||(n=setTimeout(r)),i}}}var or=fn(_n(),1);function cr(e){var t,n;const r=function(e){return{url:e.url.toString(),fetch:e.fetch,transformer:Pn(e.transformer),methodOverride:e.methodOverride}}(e),s=null!==(t=e.maxURLLength)&&void 0!==t?t:1/0,a=null!==(n=e.maxItems)&&void 0!==n?n:1/0;return()=>{const t=t=>({validate(e){if(s===1/0&&a===1/0)return!0;if(e.length>a)return!1;const n=e.map(e=>e.path).join(","),i=e.map(e=>e.input);return In((0,or.default)((0,or.default)({},r),{},{type:t,path:n,inputs:i,signal:null})).length<=s},async fetch(n){const s=n.map(e=>e.path).join(","),a=n.map(e=>e.input),i=function(...e){const t=new AbortController,n=e.length;let r=0;const s=()=>{++r===n&&t.abort()};for(const t of e)(null==t?void 0:t.aborted)?s():null==t||t.addEventListener("abort",s,{once:!0});return t.signal}(...n.map(e=>e.signal)),o=await(e=>async function(e){const t={},n=await async function(e){var t;$n(e.signal);const n=e.getUrl(e),r=e.getBody(e),{type:s}=e,a=await(async()=>{const t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),i=(0,Zn.default)((0,Zn.default)((0,Zn.default)({},e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),a);return function(e){if(e)return e;if("undefined"!=typeof window&&Tn(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&Tn(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}(e.fetch)(n,{method:null!==(t=e.methodOverride)&&void 0!==t?t:Mn[s],signal:e.signal,body:r,headers:i})}(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}((0,Zn.default)((0,Zn.default)({},e),{},{contentTypeHeader:"application/json",getUrl:In,getBody:Rn})))((0,or.default)((0,or.default)({},r),{},{path:s,inputs:a,type:t,headers:()=>e.headers?"function"==typeof e.headers?e.headers({opList:n}):e.headers:{},signal:i}));return(Array.isArray(o.json)?o.json:n.map(()=>o.json)).map(e=>({meta:o.meta,json:e}))}}),n={query:ir(t("query")),mutation:ir(t("mutation"))};return({op:e})=>bn(t=>{if("subscription"===e.type)throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let s;return n[e.type].load(e).then(e=>{s=e;const n=sr(e.json,r.transformer.output);n.ok?(t.next({context:e.meta,result:n.result}),t.complete()):t.error(jn.from(n.error,{meta:e.meta}))}).catch(e=>{t.error(jn.from(e,{meta:null==s?void 0:s.meta}))}),()=>{}})}}function ur(e){let t=e;const n=[],r=bn(e=>((e=>{void 0!==t&&e.next(t),n.push(e)})(e),()=>{(e=>{n.splice(n.indexOf(e),1)})(e)}));return r.next=e=>{if(t!==e){t=e;for(const t of n)t.next(e)}},r.get=()=>t,r}fn(_n(),1),Symbol();const dr={enabled:!1,closeMs:0},lr={enabled:!1,pongTimeoutMs:1e3,intervalMs:5e3},pr=e=>0===e?0:Math.min(1e3*2**e,3e4),hr=(e,...t)=>"function"==typeof e?e(...t):e;var fr=fn(vn(),1),mr=class e extends Error{constructor(t){super(t.message,{cause:t.cause}),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,e.prototype)}},gr=class{constructor(e,t){this.onTimeout=e,this.timeoutMs=t,(0,fr.default)(this,"timeout",void 0)}reset(){this.timeout&&(clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs))}start(){clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs)}stop(){clearTimeout(this.timeout),this.timeout=void 0}};function yr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var vr=fn(vn(),1),_r=class{constructor(){(0,vr.default)(this,"outgoingRequests",new Array),(0,vr.default)(this,"pendingRequests",{})}register(e,t){const{promise:n,resolve:r}=yr();return this.outgoingRequests.push({id:String(e.id),message:e,end:n,callbacks:{next:t.next,complete:()=>{t.complete(),r()},error:e=>{t.error(e),r()}}}),()=>{this.delete(e.id),t.complete(),r()}}delete(e){null!==e&&(this.outgoingRequests=this.outgoingRequests.filter(({id:t})=>t!==String(e)),delete this.pendingRequests[String(e)])}flush(){const e=this.outgoingRequests;this.outgoingRequests=[];for(const t of e)this.pendingRequests[t.id]=t;return e}getPendingRequests(){return Object.values(this.pendingRequests)}getPendingRequest(e){return null===e?null:this.pendingRequests[String(e)]}getOutgoingRequests(){return this.outgoingRequests}getRequests(){return[...this.getOutgoingRequests().map(e=>({state:"outgoing",message:e.message,end:e.end,callbacks:e.callbacks})),...this.getPendingRequests().map(e=>({state:"pending",message:e.message,end:e.end,callbacks:e.callbacks}))]}hasPendingRequests(){return this.getPendingRequests().length>0}hasPendingSubscriptions(){return this.getPendingRequests().some(e=>"subscription"===e.message.method)}hasOutgoingRequests(){return this.outgoingRequests.length>0}},br=fn(vn(),1);function kr(e,{intervalMs:t,pongTimeoutMs:n}){let r,s;function a(){r=setTimeout(()=>{e.send("PING"),s=setTimeout(()=>{e.close()},n)},t)}e.addEventListener("open",a),e.addEventListener("message",({data:e})=>{clearTimeout(r),a(),"PONG"===e&&(clearTimeout(s),clearTimeout(r),a())}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var xr=class e{constructor(t){var n;if((0,br.default)(this,"id",++e.connectCount),(0,br.default)(this,"WebSocketPonyfill",void 0),(0,br.default)(this,"urlOptions",void 0),(0,br.default)(this,"keepAliveOpts",void 0),(0,br.default)(this,"wsObservable",ur(null)),(0,br.default)(this,"openPromise",null),this.WebSocketPonyfill=null!==(n=t.WebSocketPonyfill)&&void 0!==n?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++e.connectCount;const n=async function(e){const t=await hr(e.url);if(!e.connectionParams)return t;const n=t.includes("?")?"&":"?";return t+`${n}connectionParams=1`}(t.urlOptions).then(e=>new t.WebSocketPonyfill(e));t.openPromise=n.then(async e=>{t.ws=e,e.addEventListener("message",function({data:e}){"PING"===e&&this.send("PONG")}),t.keepAliveOpts.enabled&&kr(e,t.keepAliveOpts),e.addEventListener("close",()=>{t.ws===e&&(t.ws=null)}),await function(e){const{promise:t,resolve:n,reject:r}=yr();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}(e),t.urlOptions.connectionParams&&e.send(await async function(e){const t={method:"connectionParams",data:await hr(e)};return JSON.stringify(t)}(t.urlOptions.connectionParams))});try{await t.openPromise}finally{t.openPromise=null}}async close(){try{await this.openPromise}finally{var e;null===(e=this.ws)||void 0===e||e.close()}}};(0,br.default)(xr,"connectCount",0);var wr=fn(vn(),1),Ar=fn(_n(),1),Cr=class{constructor(e){var t;(0,wr.default)(this,"connectionState",void 0),(0,wr.default)(this,"allowReconnect",!1),(0,wr.default)(this,"requestManager",new _r),(0,wr.default)(this,"activeConnection",void 0),(0,wr.default)(this,"reconnectRetryDelay",void 0),(0,wr.default)(this,"inactivityTimeout",void 0),(0,wr.default)(this,"callbacks",void 0),(0,wr.default)(this,"lazyMode",void 0),(0,wr.default)(this,"reconnecting",null),this.callbacks={onOpen:e.onOpen,onClose:e.onClose,onError:e.onError};const n=(0,Ar.default)((0,Ar.default)({},dr),e.lazy);this.inactivityTimeout=new gr(()=>{this.requestManager.hasOutgoingRequests()||this.requestManager.hasPendingRequests()?this.inactivityTimeout.reset():this.close().catch(()=>null)},n.closeMs),this.activeConnection=new xr({WebSocketPonyfill:e.WebSocket,urlOptions:e,keepAlive:(0,Ar.default)((0,Ar.default)({},lr),e.keepAlive)}),this.activeConnection.wsObservable.subscribe({next:e=>{e&&this.setupWebSocketListeners(e)}}),this.reconnectRetryDelay=null!==(t=e.retryDelayMs)&&void 0!==t?t:pr,this.lazyMode=n.enabled,this.connectionState=ur({type:"state",state:n.enabled?"idle":"connecting",error:null}),this.lazyMode||this.open().catch(()=>null)}async open(){var e=this;e.allowReconnect=!0,"connecting"!==e.connectionState.get().state&&e.connectionState.next({type:"state",state:"connecting",error:null});try{await e.activeConnection.open()}catch(t){return e.reconnect(new mr({message:"Initialization error",cause:t})),e.reconnecting}}async close(){var e=this;e.allowReconnect=!1,e.inactivityTimeout.stop();const t=[];for(const n of e.requestManager.getRequests())"subscription"===n.message.method?n.callbacks.complete():"outgoing"===n.state?n.callbacks.error(jn.from(new mr({message:"Closed before connection was established"}))):t.push(n.end);await Promise.all(t).catch(()=>null),await e.activeConnection.close().catch(()=>null),e.connectionState.next({type:"state",state:"idle",error:null})}request({op:{id:e,type:t,path:n,input:r,signal:s},transformer:a,lastEventId:i}){return bn(o=>{const c=this.batchSend({id:e,method:t,params:{input:a.input.serialize(r),path:n,lastEventId:i}},(0,Ar.default)((0,Ar.default)({},o),{},{next(e){const t=sr(e,a.output);t.ok?o.next({result:t.result}):o.error(jn.from(t.error))}}));return()=>{c(),"subscription"===t&&this.activeConnection.isOpen()&&this.send({id:e,method:"subscription.stop"}),null==s||s.removeEventListener("abort",c)}})}get connection(){return(e=this.activeConnection).isOpen()?{id:e.id,state:"open",ws:e.ws}:e.isClosed()?{id:e.id,state:"closed",ws:e.ws}:e.ws?{id:e.id,state:"connecting",ws:e.ws}:null;var e}reconnect(e){var t=this;if(this.connectionState.next({type:"state",state:"connecting",error:jn.from(e)}),this.reconnecting)return;const n=async e=>{try{await Sn(t.reconnectRetryDelay(e)),t.allowReconnect&&(await t.activeConnection.close(),await t.activeConnection.open(),t.requestManager.hasPendingRequests()&&t.send(t.requestManager.getPendingRequests().map(({message:e})=>e))),t.reconnecting=null}catch(t){await n(e+1)}};this.reconnecting=n(0)}setupWebSocketListeners(e){var t=this;const n=e=>{const t=this.requestManager.getPendingRequests();for(const{message:n,callbacks:r}of t)"subscription"!==n.method&&(r.error(jn.from(null!=e?e:new mr({message:"WebSocket closed",cause:e}))),this.requestManager.delete(n.id))};e.addEventListener("open",()=>{Cn(async()=>{var e,n;t.lazyMode&&t.inactivityTimeout.start(),null===(e=(n=t.callbacks).onOpen)||void 0===e||e.call(n),t.connectionState.next({type:"state",state:"pending",error:null})}).catch(t=>{e.close(3e3),n(t)})}),e.addEventListener("message",({data:e})=>{if(this.inactivityTimeout.reset(),"string"!=typeof e||["PING","PONG"].includes(e))return;const t=JSON.parse(e);"method"in t?this.handleIncomingRequest(t):this.handleResponseMessage(t)}),e.addEventListener("close",e=>{var t,r;n(e),null===(t=(r=this.callbacks).onClose)||void 0===t||t.call(r,e),this.lazyMode&&!this.requestManager.hasPendingSubscriptions()||this.reconnect(new mr({message:"WebSocket closed",cause:e}))}),e.addEventListener("error",e=>{var t,r;n(e),null===(t=(r=this.callbacks).onError)||void 0===t||t.call(r,e),this.reconnect(new mr({message:"WebSocket closed",cause:e}))})}handleResponseMessage(e){const t=this.requestManager.getPendingRequest(e.id);if(!t)return;t.callbacks.next(e);let n=!0;"result"in e&&"subscription"===t.message.method&&("data"===e.result.type&&(t.message.params.lastEventId=e.result.id),"stopped"!==e.result.type&&(n=!1)),n&&(t.callbacks.complete(),this.requestManager.delete(e.id))}handleIncomingRequest(e){"reconnect"===e.method&&this.reconnect(new mr({message:"Server requested reconnect"}))}send(e){if(!this.activeConnection.isOpen())throw new Error("Active connection is not open");const t=e instanceof Array?e:[e];this.activeConnection.ws.send(JSON.stringify(1===t.length?t[0]:t))}batchSend(e,t){var n=this;return this.inactivityTimeout.reset(),Cn(async()=>{n.activeConnection.isOpen()||await n.open(),await Sn(0),n.requestManager.hasOutgoingRequests()&&n.send(n.requestManager.flush().map(({message:e})=>e))}).catch(n=>{this.requestManager.delete(e.id),t.error(jn.from(n))}),this.requestManager.register(e,t)}};function Sr(e){const{client:t}=e,n=Pn(e.transformer);return()=>({op:e})=>bn(r=>{const s="subscription"===e.type?t.connectionState.subscribe({next(t){r.next({result:t,context:e.context})}}):null,a=t.request({op:e,transformer:n}).subscribe(r);return()=>{a.unsubscribe(),null==s||s.unsubscribe()}})}var Er=fn(vn(),1),Or=fn(_n(),1),jr=class{constructor(e){(0,Er.default)(this,"links",void 0),(0,Er.default)(this,"runtime",void 0),(0,Er.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){var t;return xn({links:this.links,op:(0,Or.default)((0,Or.default)({},e),{},{context:null!==(t=e.context)&&void 0!==t?t:{},id:++this.requestId})}).pipe(e=>{let t=0,n=null;const r=[];return bn(s=>(t++,r.push(s),n||(n=e.subscribe({next(e){for(const n of r){var t;null===(t=n.next)||void 0===t||t.call(n,e)}},error(e){for(const n of r){var t;null===(t=n.error)||void 0===t||t.call(n,e)}},complete(){for(const t of r){var e;null===(e=t.complete)||void 0===e||e.call(t)}}})),{unsubscribe(){t--,function(){if(0===t&&n){const e=n;n=null,e.unsubscribe()}}();const e=r.findIndex(e=>e===s);e>-1&&r.splice(e,1)}}))})}async requestAsPromise(e){try{const t=this.$request(e);return(await function(e){const t=new AbortController;return new Promise((n,r)=>{let s=!1;function a(){s||(s=!0,i.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const i=e.subscribe({next(e){s=!0,n(e),a()},error(e){r(e)},complete(){t.abort(),a()}})})}(t)).result.data}catch(e){throw jn.from(e)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:null==n?void 0:n.context,signal:null==n?void 0:n.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:null==n?void 0:n.context,signal:null==n?void 0:n.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(e){switch(e.result.type){case"state":var t;null===(t=n.onConnectionStateChange)||void 0===t||t.call(n,e.result);break;case"started":var r;null===(r=n.onStarted)||void 0===r||r.call(n,{context:e.context});break;case"stopped":var s;null===(s=n.onStopped)||void 0===s||s.call(n);break;case"data":case void 0:var a;null===(a=n.onData)||void 0===a||a.call(n,e.result.data)}},error(e){var t;null===(t=n.onError)||void 0===t||t.call(n,e)},complete(){var e;null===(e=n.onComplete)||void 0===e||e.call(n)}})}};const Pr=Symbol.for("trpc_untypedClient"),Tr={query:"query",mutate:"mutation",subscribe:"subscription"};fn(_n(),1),fn(_n(),1),fn(hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return(n=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new n(e)}t.exports=function(e){var t,r,s,a=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,s=Symbol.iterator);a--;){if(r&&null!=(t=e[r]))return t.call(e);if(s&&null!=(t=e[s]))return new n(t.call(e));r="@@asyncIterator",s="@@iterator"}throw new TypeError("Object is not async iterable")},t.exports.__esModule=!0,t.exports.default=t.exports}})(),1),fn(_n(),1);var Zr=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){t.exports=function(){var e="function"==typeof SuppressedError?SuppressedError:function(e,t){var n=Error();return n.name="SuppressedError",n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(null!=t){if(Object(t)!==t)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(e)var r=t[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(void 0===r&&(r=t[Symbol.dispose||Symbol.for("Symbol.dispose")],e))var s=r;if("function"!=typeof r)throw new TypeError("Object is not disposable.");s&&(r=function(){try{s.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,s=this.e,a=0;function i(){for(;r=n.pop();)try{if(!r.a&&1===a)return a=0,n.push(r),Promise.resolve().then(i);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(i,o)}else a|=1}catch(e){return o(e)}if(1===a)return s!==t?Promise.reject(s):Promise.resolve();if(s!==t)throw s}function o(n){return s=s!==t?new e(n,s):n,i()}return i()}}},t.exports.__esModule=!0,t.exports.default=t.exports}}),Mr=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){t.exports=function(e,t){this.v=e,this.k=t},t.exports.__esModule=!0,t.exports.default=t.exports}}),Nr=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=Mr();t.exports=function(e){return new n(e,0)},t.exports.__esModule=!0,t.exports.default=t.exports}}),Ir=hn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=Mr();function r(e){var t,r;function s(t,r){try{var i=e[t](r),o=i.value,c=o instanceof n;Promise.resolve(c?o.v:o).then(function(n){if(c){var r="return"===t?"return":"next";if(!o.k||n.done)return s(r,n);n=e[r](n).value}a(i.done?"return":"normal",n)},function(e){s("throw",e)})}catch(e){a("throw",e)}}function a(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?s(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise(function(a,i){var o={key:e,arg:n,resolve:a,reject:i,next:null};r?r=r.next=o:(t=r=o,s(e,n))})},"function"!=typeof e.return&&(this.return=void 0)}r.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},r.prototype.next=function(e){return this._invoke("next",e)},r.prototype.throw=function(e){return this._invoke("throw",e)},r.prototype.return=function(e){return this._invoke("return",e)},t.exports=function(e){return function(){return new r(e.apply(this,arguments))}},t.exports.__esModule=!0,t.exports.default=t.exports}});async function Rr(e){await async function(){if("undefined"!=typeof global){const e=global;if(void 0===e.WebSocket){const{WebSocket:t}=await n.e(621).then(n.t.bind(n,621,19));e.WebSocket=t}}}(),function({reporter:e}){"undefined"!=typeof process&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",e?.ignoreLogMessage("Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable"))}({reporter:e.reporter});const t=new Cr(e),r=function(e,t){try{return new URL(e,t)}catch{throw new Error(`Invalid URL: "${e}", base: ""`)}}(e.url),s="wss:"===r.protocol;r.protocol=s?"https:":"http:";const a=r.toString().replace(/\/$/,""),i=function(e){return function(e){const t=Yn(({path:t,args:n})=>{const r=[...t],s=(a=r.pop(),Tr[a]);var a;const i=r.join(".");return e[s](i,...n)});return n=n=>n===Pr?e:t[n],new Proxy(Kn,{get(e,t){if("then"!==t)return n(t)}});var n}(new jr(e))}({links:[(o={condition:e=>"subscription"===e.type,true:Sr({client:t}),false:cr({url:a})},e=>{const t=wn(o.true).map(t=>t(e)),n=wn(o.false).map(t=>t(e));return e=>bn(r=>{const s=o.condition(e.op)?t:n;return xn({op:e.op,links:s}).subscribe(r)})})]});var o;return new Proxy({close:async()=>{await t.close()}},{get:(e,t)=>e.hasOwnProperty(t)?e[t]:i[t]})}fn(Zr(),1),fn(Nr(),1),fn(Ir(),1),fn(_n(),1);var Dr=n(606),$r=n.n(Dr),Lr=n(607),qr=n.n(Lr),zr=n(437),Ur=n.n(zr),Fr=n(750),Wr=n.n(Fr),Br=n(994),Vr=n.n(Br),Kr=n(415),Hr=n.n(Kr),Jr=n(941),Yr={};Yr.styleTagTransform=Hr(),Yr.setAttributes=Wr(),Yr.insert=Ur().bind(null,"head"),Yr.domAPI=qr(),Yr.insertStyleElement=Vr(),$r()(Jr.default,Yr);const Gr=Jr.default&&Jr.default.locals?Jr.default.locals:void 0;class Qr{element;constructor(e="root"){this.element=document.getElementById(e)}updateStatus(e){const{message:t,tip:n,isError:r=!1,data:s}=e;r?s?console.error(t,s):console.error(t):s?console.debug(t,s):console.debug(t),this.element&&(this.element.innerHTML=`\n <div class="${Gr.statusContainer+(r?` ${Gr.errorContainer}`:"")}">\n <h2 class="${Gr.title}">Cloudpack Link Proxy</h2>\n <p class="${Gr.message}">${r?"Error: ":""}${t}</p>\n ${n?`<p class="${Gr.message}"><strong>Tip:</strong> ${n}</p>`:""}\n <p class="${Gr.warning}">Do not close this page while Cloudpack link is running.</p>\n </div>\n `)}}class Xr{clients=new Map;connectionStates=new Map;checkInterval=null;checkIntervalMs=5e3;addClient(e,t){this.clients.set(e,t),this.connectionStates.set(e,!0)}getClient(e){return this.clients.get(e)}async checkConnection(e){const t=this.clients.get(e);if(!t)return!1;try{return await t.getSessionId.query(),!0}catch(t){return console.warn(`${e} client connection lost:`,t),!1}}startMonitoring(e){this.checkInterval&&window.clearInterval(this.checkInterval),this.checkInterval=window.setInterval(()=>{(async()=>{for(const[t,n]of this.clients){if("link"!=t&&"host"!=t)throw new Error(`Invalid client ID: ${t}`);const n=this.connectionStates.get(t)||!1,r=await this.checkConnection(t);n!==r&&await e({id:t,isConnected:r,wasConnected:n}),this.connectionStates.set(t,r)}})().catch(e=>{console.error("Error in connection monitoring:",e)})},this.checkIntervalMs)}stopMonitoring(){this.checkInterval&&(window.clearInterval(this.checkInterval),this.checkInterval=null)}async closeAll(){for(const[e,t]of this.clients)try{await t.close(),console.log(`Closed ${e} client`)}catch(t){console.error(`Error closing ${e} client:`,t)}this.clients.clear(),this.connectionStates.clear()}}async function es(e){console.debug(`[Cloudpack] Checking session at ${e}`);const t=await Rr({url:e});let n=!1;try{n=!!await t.getSessionId.query()}catch(e){}finally{await t.close()}return n}const ts=new class{ui;connectionManager;linkedPathData=null;constructor(){this.ui=new Qr,this.connectionManager=new Xr}handleConnectionChange=async e=>{const{id:t,isConnected:n,wasConnected:r}=e;r&&!n&&("host"===t?await this.handleHostDisconnection():"link"===t&&await this.handleLinkDisconnection())};async handleHostDisconnection(e){const t=e?.unreachable??!1,n=t?"unreachable":"lost";this.ui.updateStatus({message:`Connection to host ${n}. The session will be terminated.`,isError:!0});const r=this.connectionManager.getClient("link");let s,a=!1;if(r)try{await r.publishData.mutate({...an,data:{reason:n}}),a=!0}catch(e){this.ui.updateStatus({message:`Error notifying link client of host connection ${n}.`,isError:!0})}await this.cleanup(),t?s="Make sure you have a <code>cloudpack start</code> session running and use the URL from your app to run link with the following command: <code>cloudpack link --remote [URL]</code>":(s="If you did not close the start session terminal, this is a bug. Please report it.",a||(s+=" Link client was not successfully notified of host disconnection. You may need to terminate the link session in the terminal.")),this.ui.updateStatus({message:`Connection to host ${n}. You can close this page.`,tip:s,isError:!0})}async handleLinkDisconnection(){this.ui.updateStatus({message:"Connection to link client lost. Cleaning up linked paths...",isError:!0});const e=this.connectionManager.getClient("host");if(e&&this.linkedPathData){const{linkedPath:t}=this.linkedPathData,n=t.path;try{await e.unlinkPath.mutate({linkedPath:{path:n}}),this.ui.updateStatus({message:"Connection to link client lost. Successfully unlinked paths on host. You can close this page.",tip:"If you did not close the link client terminal. This is a bug. Please report it."})}catch(e){this.ui.updateStatus({message:"Connection to link client lost. Failed to unlink paths on host.",tip:"You may need to restart the host application to unlink the paths.",isError:!0,data:e})}}else this.ui.updateStatus({message:"Cannot clean up: host client or link data not available",tip:"You may need to restart the host application to unlink the paths.",isError:!0});await this.cleanup()}setupLinkUpdateHandler(){const e=this.connectionManager.getClient("link"),t=this.connectionManager.getClient("host");e&&t&&e.onDataChanged.subscribe(tn,{onData:e=>{this.ui.updateStatus({message:"Forwarding package update to the host...",data:e}),t.notifyLinkChange.mutate(e).then(()=>this.ui.updateStatus({message:"Cloudpack Link Proxy listening for updates..."})).catch(e=>{this.ui.updateStatus({message:"Error forwarding package update to the host. This is a bug. Please report it.",isError:!0,data:e})})}})}async setupLinkPathHandler(){const e=this.connectionManager.getClient("host"),t=this.connectionManager.getClient("link");t&&e&&(await t.getData.query(rn)||t.onDataChanged.subscribe(rn,{onData:n=>{this.ui.updateStatus({message:"Processing link setup...",data:n}),this.linkedPathData=n,e.linkPath.mutate(this.linkedPathData).then(e=>{const{resolveMap:n,linkedPaths:r}=e;this.ui.updateStatus({message:"Sending link setup result back to the link server...",data:e}),t.publishData.mutate({...sn,data:{resolveMap:n,linkedPaths:r}}).then(()=>{this.ui.updateStatus({message:"Cloudpack Link Proxy listening for updates..."})}).catch(e=>{this.ui.updateStatus({message:"Error sending link setup result back to the link server. Please try to run link again.",tip:"This is a bug. Please report it.",isError:!0,data:e})})})}}))}async setupConfig(){const e=this.connectionManager.getClient("link"),t=this.connectionManager.getClient("host");if(e&&t)try{if(!await e.getData.query(nn)){this.ui.updateStatus({message:"Fetching host configuration..."});const n=await t.getLinkConfig.query();this.ui.updateStatus({message:"Sending host configuration to the link server...",data:n}),await e.publishData.mutate({...nn,data:n}),this.ui.updateStatus({message:"Host configuration sent to the link server."})}}catch(e){this.ui.updateStatus({message:"Error setting up configuration. Please try to run link again.",tip:"This is a bug. Please report it.",isError:!0,data:e})}}async cleanup(){this.connectionManager.stopMonitoring(),await this.connectionManager.closeAll()}async initialize(){this.ui.updateStatus({message:"Initializing Cloudpack Link Proxy..."});try{if(!window.__cloudpack)throw this.ui.updateStatus({message:"Cloudpack context not found on window.",tip:"This is a bug. Please report it.",isError:!0}),new Error("Cloudpack not found on window.");const{pageSessionContext:e}=window.__cloudpack;if(!e)throw this.ui.updateStatus({message:"Session context not found on window.__cloudpack.",tip:"This is a bug. Please report it.",isError:!0,data:window.__cloudpack}),new Error("Session context not found on window.__cloudpack");const{apiUrl:t,hostApiServerUrls:n}=e;if(!n||n.length<=0)return void this.ui.updateStatus({message:"No host URL provided.",tip:"This is a bug. Please report it.",data:e,isError:!0});const r=await Rr({url:t});let s;this.connectionManager.addClient("link",r);for(const e of n)if(this.ui.updateStatus({message:`Checking host API server at ${e}...`}),await es(e)){this.ui.updateStatus({message:`Host API server is active at ${e}.`}),s=e;break}if(!s)return void await this.handleHostDisconnection({unreachable:!0});const a=await Rr({url:s});this.connectionManager.addClient("host",a);const i=await r.getSessionId.query(),o=await a.getSessionId.query();this.ui.updateStatus({message:`Link Session: ${i}, Host Session: ${o}`}),this.connectionManager.startMonitoring(this.handleConnectionChange),this.setupLinkUpdateHandler(),await this.setupLinkPathHandler(),await this.setupConfig()}catch(e){const t=e instanceof Error?e.message:String(e);this.ui.updateStatus({message:t,isError:!0,tip:"This is a bug. Please report it.",data:e}),await this.cleanup()}}};ts.initialize()},415:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},437:e=>{var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},606:e=>{var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var a={},i=[],o=0;o<e.length;o++){var c=e[o],u=r.base?c[0]+r.base:c[0],d=a[u]||0,l="".concat(u," ").concat(d);a[u]=d+1;var p=n(l),h={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==p)t[p].references++,t[p].updater(h);else{var f=s(h,r);r.byIndex=o,t.splice(o,0,{identifier:l,updater:f,references:1})}i.push(l)}return i}function s(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,s){var a=r(e=e||[],s=s||{});return function(e){e=e||[];for(var i=0;i<a.length;i++){var o=n(a[i]);t[o].references--}for(var c=r(e,s),u=0;u<a.length;u++){var d=n(a[u]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}a=c}}},607:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var s=void 0!==n.layer;s&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,s&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},750:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},941:(e,t,n)=>{n.d(t,{default:()=>o});var r=n(25),s=n.n(r),a=n(191),i=n.n(a)()(s());i.push([e.id,":root {\n --color-neutral-background1: #ffffff;\n --color-status-danger-background1: #fdf3f4;\n --color-neutral-background2: #fafafa;\n --color-status-danger-foreground1: #b10e1c;\n --color-neutral-foreground1: #242424;\n --color-neutral-foreground2: #424242;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --color-neutral-background1: #292929;\n --color-status-danger-background1: #3b0509;\n --color-neutral-background2: #1f1f1f;\n --color-status-danger-foreground1: #dc626d;\n --color-neutral-foreground1: #ffffff;\n --color-neutral-foreground2: #d6d6d6;\n }\n}\n\nbody {\n background-color: var(--color-neutral-background1);\n margin: 0;\n padding: 0;\n font-family:\n 'Segoe UI',\n 'Segoe UI Web (West European)',\n -apple-system,\n BlinkMacSystemFont,\n Roboto,\n 'Helvetica Neue',\n sans-serif;\n}\n\n.v64eNmuXrV4WWsOKdGgy {\n padding: 20px;\n border-radius: 4px;\n background-color: var(--color-neutral-background2);\n margin: 20px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr {\n background-color: var(--color-status-danger-background1);\n}\n\n.b6Vf2DbiFQkD7AEkJ7p_ h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n._05tS4aUzls4kEWk9hkA7 {\n color: var(--color-neutral-foreground1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr .b6Vf2DbiFQkD7AEkJ7p_ {\n color: var(--color-status-danger-foreground1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr ._05tS4aUzls4kEWk9hkA7 {\n color: var(--color-status-danger-foreground1);\n}\n\n._05tS4aUzls4kEWk9hkA7 code {\n background-color: var(--color-neutral-background1);\n padding: 2px 5px;\n border-radius: 3px;\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 0.9em;\n}\n\n.ScZ3E77NPMqtBzp0OwUr ._05tS4aUzls4kEWk9hkA7 code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.kheFps3bT2VbnjAMYfSr {\n font-weight: bold;\n margin-top: 20px;\n color: var(--color-neutral-foreground2);\n}\n","",{version:3,sources:["webpack://./src/UIManager.module.css"],names:[],mappings:"AAAA;EACE,oCAAoC;EACpC,0CAA0C;EAC1C,oCAAoC;EACpC,0CAA0C;EAC1C,oCAAoC;EACpC,oCAAoC;AACtC;;AAEA;EACE;IACE,oCAAoC;IACpC,0CAA0C;IAC1C,oCAAoC;IACpC,0CAA0C;IAC1C,oCAAoC;IACpC,oCAAoC;EACtC;AACF;;AAEA;EACE,kDAAkD;EAClD,SAAS;EACT,UAAU;EACV;;;;;;;cAOY;AACd;;AAEA;EACE,aAAa;EACb,kBAAkB;EAClB,kDAAkD;EAClD,YAAY;EACZ,wCAAwC;AAC1C;;AAEA;EACE,wDAAwD;AAC1D;;AAEA;EACE,uCAAuC;EACvC,aAAa;AACf;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,kDAAkD;EAClD,gBAAgB;EAChB,kBAAkB;EAClB,2DAA2D;EAC3D,gBAAgB;AAClB;;AAEA;EACE,oCAAoC;AACtC;;AAEA;EACE,iBAAiB;EACjB,gBAAgB;EAChB,uCAAuC;AACzC",sourcesContent:[":root {\n --color-neutral-background1: #ffffff;\n --color-status-danger-background1: #fdf3f4;\n --color-neutral-background2: #fafafa;\n --color-status-danger-foreground1: #b10e1c;\n --color-neutral-foreground1: #242424;\n --color-neutral-foreground2: #424242;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --color-neutral-background1: #292929;\n --color-status-danger-background1: #3b0509;\n --color-neutral-background2: #1f1f1f;\n --color-status-danger-foreground1: #dc626d;\n --color-neutral-foreground1: #ffffff;\n --color-neutral-foreground2: #d6d6d6;\n }\n}\n\n:global body {\n background-color: var(--color-neutral-background1);\n margin: 0;\n padding: 0;\n font-family:\n 'Segoe UI',\n 'Segoe UI Web (West European)',\n -apple-system,\n BlinkMacSystemFont,\n Roboto,\n 'Helvetica Neue',\n sans-serif;\n}\n\n.statusContainer {\n padding: 20px;\n border-radius: 4px;\n background-color: var(--color-neutral-background2);\n margin: 20px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.errorContainer {\n background-color: var(--color-status-danger-background1);\n}\n\n.title h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n.message {\n color: var(--color-neutral-foreground1);\n}\n\n.errorContainer .title {\n color: var(--color-status-danger-foreground1);\n}\n\n.errorContainer .message {\n color: var(--color-status-danger-foreground1);\n}\n\n.message code {\n background-color: var(--color-neutral-background1);\n padding: 2px 5px;\n border-radius: 3px;\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 0.9em;\n}\n\n.errorContainer .message code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.warning {\n font-weight: bold;\n margin-top: 20px;\n color: var(--color-neutral-foreground2);\n}\n"],sourceRoot:""}]),i.locals={statusContainer:"v64eNmuXrV4WWsOKdGgy",errorContainer:"ScZ3E77NPMqtBzp0OwUr",title:"b6Vf2DbiFQkD7AEkJ7p_",message:"_05tS4aUzls4kEWk9hkA7",warning:"kheFps3bT2VbnjAMYfSr"};const o=i},994:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}}};import e from"../runtime.js";import*as t from"./index.js";e.C(t),e(e.s=342);
2
+ export const __webpack_id__=293;export const __webpack_ids__=[293];export const __webpack_modules__={25:e=>{e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var o=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},191:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,o,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(o)for(var a=0;a<this.length;a++){var u=this[a][0];null!=u&&(i[u]=!0)}for(var c=0;c<e.length;c++){var l=[].concat(e[c]);o&&i[l[0]]||(void 0!==s&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=s),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),r&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=r):l[4]="".concat(r)),t.push(l))}},t}},415:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},437:e=>{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},606:e=>{var t=[];function n(e){for(var n=-1,o=0;o<t.length;o++)if(t[o].identifier===e){n=o;break}return n}function o(e,o){for(var s={},i=[],a=0;a<e.length;a++){var u=e[a],c=o.base?u[0]+o.base:u[0],l=s[c]||0,d="".concat(c," ").concat(l);s[c]=l+1;var p=n(d),f={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)t[p].references++,t[p].updater(f);else{var h=r(f,o);o.byIndex=a,t.splice(a,0,{identifier:d,updater:h,references:1})}i.push(d)}return i}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=o(e=e||[],r=r||{});return function(e){e=e||[];for(var i=0;i<s.length;i++){var a=n(s[i]);t[a].references--}for(var u=o(e,r),c=0;c<s.length;c++){var l=n(s[c]);0===t[l].references&&(t[l].updater(),t.splice(l,1))}s=u}}},607:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,r&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},750:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},851:(e,t,n)=>{function o(e,t,n){function o(n,o){var r;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(r=n._zod).traits??(r.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in i.prototype)e in n||Object.defineProperty(n,e,{value:i.prototype[e].bind(n)});n._zod.constr=i,n._zod.def=o}const r=n?.Parent??Object;class s extends r{}function i(e){var t;const r=n?.Parent?new s:this;o(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}Symbol("zod_brand");class r extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const s={};function i(e){return e&&Object.assign(s,e),s}function a(e,t){return"bigint"==typeof t?t.toString():t}function u(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function c(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function l(e,t,n){Object.defineProperty(e,t,{get(){{const o=n();return e[t]=o,o}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function d(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(e=10){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz"[Math.floor(26*Math.random())];return t}function f(e){return JSON.stringify(e)}const h=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function m(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const g=u(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function v(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function y(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function b(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n].continue)return!0;return!1}function w(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function k(e){return"string"==typeof e?e:e?.message}function A(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=k(e.inst?._zod.def?.error?.(e))??k(t?.error?.(e))??k(n.customError?.(e))??k(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}new Set(["string","number","symbol"]),new Set(["string","number","bigint","boolean","symbol","undefined"]),Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_VALUE,Number.MAX_VALUE;const x=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,a,2),enumerable:!0})},_=o("$ZodError",x),C=o("$ZodError",x,{Parent:Error}),S=e=>(t,n,o,s)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},a);if(u instanceof Promise)throw new r;if(u.issues.length){const t=new(s?.Err??e)(u.issues.map(e=>A(e,a,i())));throw h(t,s?.callee),t}return u.value},E=S(C),P=e=>async(t,n,o,r)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(r?.Err??e)(a.issues.map(e=>A(e,s,i())));throw h(t,r?.callee),t}return a.value},j=P(C),O=e=>(t,n,o)=>{const s=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new r;return a.issues.length?{success:!1,error:new(e??_)(a.issues.map(e=>A(e,s,i())))}:{success:!0,data:a.value}},z=O(C),M=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>A(e,r,i())))}:{success:!0,data:s.value}},T=M(C),$=/^-?\d+(?:\.\d+)?/i,q=/true|false/i;class I{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),o=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const R={major:4,minor:0,patch:0},D=o("$ZodType",(e,t)=>{var n;e??(e={}),l(e._zod,"id",()=>t.type+"_"+p(10)),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=R;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const t of o)for(const n of t._zod.onattach)n(e);if(0===o.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let o,s=b(e);for(const i of t){if(i._zod.when){if(!i._zod.when(e))continue}else if(s)continue;const t=e.issues.length,a=i._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new r;if(o||a instanceof Promise)o=(o??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(s||(s=b(e,t)))});else{if(e.issues.length===t)continue;s||(s=b(e,t))}}return o?o.then(()=>e):e};e._zod.run=(n,s)=>{const i=e._zod.parse(n,s);if(i instanceof Promise){if(!1===s.async)throw new r;return i.then(e=>t(e,o,s))}return t(i,o,s)}}e["~standard"]={validate:t=>{try{const n=z(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return T(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),N=o("$ZodString",(e,t)=>{var n;D.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),L=o("$ZodNumber",(e,t)=>{D.init(e,t),e._zod.pattern=e._zod.bag.pattern??$,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const r=n.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return n;const s="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...s?{received:s}:{}}),n}}),U=o("$ZodBoolean",(e,t)=>{D.init(e,t),e._zod.pattern=q,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Z=o("$ZodAny",(e,t)=>{D.init(e,t),e._zod.parse=e=>e}),W=o("$ZodUnknown",(e,t)=>{D.init(e,t),e._zod.parse=e=>e});function B(e,t,n){e.issues.length&&t.issues.push(...w(n,e.issues)),t.value[n]=e.value}const H=o("$ZodArray",(e,t)=>{D.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const s=[];for(let e=0;e<r.length;e++){const i=r[e],a=t.element._zod.run({value:i,issues:[]},o);a instanceof Promise?s.push(a.then(t=>B(t,n,e))):B(a,n,e)}return s.length?Promise.all(s).then(()=>n):n}});function F(e,t,n){e.issues.length&&t.issues.push(...w(n,e.issues)),t.value[n]=e.value}function J(e,t,n,o){e.issues.length?void 0===o[n]?t.value[n]=n in o?void 0:e.value:t.issues.push(...w(n,e.issues)):void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const G=o("$ZodObject",(e,t)=>{D.init(e,t);const n=u(()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof D))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=t.shape,Object.keys(o).filter(e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});let o;l(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n});const r=m,i=!s.jitless,a=i&&g.value,{catchall:c}=t;let d;e._zod.parse=(s,u)=>{d??(d=n.value);const l=s.value;if(!r(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;const h=[];if(i&&a&&!1===u?.async&&!0!==u.jitless)o||(o=(e=>{const t=new I(["shape","payload","ctx"]),{keys:o,optionalKeys:r}=n.value,s=e=>{const t=f(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);for(const e of o)i[e]=p(15);t.write("const newResult = {}");for(const e of o)if(r.has(e)){const n=i[e];t.write(`const ${n} = ${s(e)};`);const o=f(e);t.write(`\n if (${n}.issues.length) {\n if (input[${o}] === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${n}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}],\n }))\n );\n }\n } else if (${n}.value === undefined) {\n if (${o} in input) newResult[${o}] = undefined;\n } else {\n newResult[${o}] = ${n}.value;\n }\n `)}else{const n=i[e];t.write(`const ${n} = ${s(e)};`),t.write(`\n if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${f(e)}, ...iss.path] : [${f(e)}]\n })));`),t.write(`newResult[${f(e)}] = ${n}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),s=o(s,u);else{s.value={};const e=d.shape;for(const t of d.keys){const n=e[t],o=n._zod.run({value:l[t],issues:[]},u),r="optional"===n._zod.optin&&"optional"===n._zod.optout;o instanceof Promise?h.push(o.then(e=>r?J(e,s,t,l):F(e,s,t))):r?J(o,s,t,l):F(o,s,t)}}if(!c)return h.length?Promise.all(h).then(()=>s):s;const m=[],g=d.keySet,v=c._zod,y=v.def.type;for(const e of Object.keys(l)){if(g.has(e))continue;if("never"===y){m.push(e);continue}const t=v.run({value:l[e],issues:[]},u);t instanceof Promise?h.push(t.then(t=>F(t,s,e))):F(t,s,e)}return m.length&&s.issues.push({code:"unrecognized_keys",keys:m,input:l,inst:e}),h.length?Promise.all(h).then(()=>s):s}});function V(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>A(e,o,i())))}),t}const Y=o("$ZodUnion",(e,t)=>{D.init(e,t),l(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),l(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>c(e.source)).join("|")})$`)}}),e._zod.parse=(n,o)=>{let r=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)s.push(t),r=!0;else{if(0===t.issues.length)return t;s.push(t)}}return r?Promise.all(s).then(t=>V(t,n,e,o)):V(s,n,e,o)}}),K=o("$ZodRecord",(e,t)=>{D.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!function(e){if(!1===m(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==m(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const e of i)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const i=t.valueType._zod.run({value:r[e],issues:[]},o);i instanceof Promise?s.push(i.then(t=>{t.issues.length&&n.issues.push(...w(e,t.issues)),n.value[e]=t.value})):(i.issues.length&&n.issues.push(...w(e,i.issues)),n.value[e]=i.value)}let a;for(const e in r)i.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{n.value={};for(const a of Reflect.ownKeys(r)){if("__proto__"===a)continue;const u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:u.issues.map(e=>A(e,o,i())),input:a,path:[a],inst:e}),n.value[u.value]=u.value;continue}const c=t.valueType._zod.run({value:r[a],issues:[]},o);c instanceof Promise?s.push(c.then(e=>{e.issues.length&&n.issues.push(...w(a,e.issues)),n.value[u.value]=e.value})):(c.issues.length&&n.issues.push(...w(a,c.issues)),n.value[u.value]=c.value)}}return s.length?Promise.all(s).then(()=>n):n}}),X=o("$ZodLiteral",(e,t)=>{D.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(n,o)=>{const r=n.value;return e._zod.values.has(r)||n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),Q=o("$ZodOptional",(e,t)=>{D.init(e,t),e._zod.optin="optional",e._zod.optout="optional",l(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),l(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${c(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>void 0===e.value?e:t.innerType._zod.run(e,n)}),ee=o("$ZodNonOptional",(e,t)=>{D.init(e,t),l(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(t=>te(t,e)):te(r,e)}});function te(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}Symbol("ZodOutput"),Symbol("ZodInput");const ne=o("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");D.init(e,t),e.def=t,e.parse=(t,n)=>E(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>z(e,t,n),e.parseAsync=async(t,n)=>j(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>T(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,n)=>v(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e)}),oe=o("ZodMiniString",(e,t)=>{N.init(e,t),ne.init(e,t)});function re(e){return function(e,t){return new e({type:"string",...y(t)})}(oe,e)}const se=o("ZodMiniNumber",(e,t)=>{L.init(e,t),ne.init(e,t)});function ie(e){return function(e,t){return new e({type:"number",checks:[],...y(t)})}(se,e)}const ae=o("ZodMiniBoolean",(e,t)=>{U.init(e,t),ne.init(e,t)});function ue(e){return function(e,t){return new e({type:"boolean",...y(t)})}(ae,e)}const ce=o("ZodMiniAny",(e,t)=>{Z.init(e,t),ne.init(e,t)});function le(){return new ce({type:"any"})}const de=o("ZodMiniUnknown",(e,t)=>{W.init(e,t),ne.init(e,t)}),pe=o("ZodMiniArray",(e,t)=>{H.init(e,t),ne.init(e,t)});function fe(e,t){return new pe({type:"array",element:e,...y(t)})}const he=o("ZodMiniObject",(e,t)=>{G.init(e,t),ne.init(e,t),l(e,"shape",()=>t.shape)});function me(e,t){const n={type:"object",get shape(){return d(this,"shape",{...e}),this.shape},...y(t)};return new he(n)}function ge(e,t){return new he({type:"object",get shape(){return d(this,"shape",{...e}),this.shape},catchall:(n=de,new n({type:"unknown"})),...y(t)});var n}const ve=o("ZodMiniUnion",(e,t)=>{Y.init(e,t),ne.init(e,t)});function ye(e,t){return new ve({type:"union",options:e,...y(t)})}const be=o("ZodMiniRecord",(e,t)=>{K.init(e,t),ne.init(e,t)});function we(e,t,n){return new be({type:"record",keyType:e,valueType:t,...y(n)})}const ke=o("ZodMiniLiteral",(e,t)=>{X.init(e,t),ne.init(e,t)});function Ae(e,t){return new ke({type:"literal",values:Array.isArray(e)?e:[e],...y(t)})}const xe=o("ZodMiniOptional",(e,t)=>{Q.init(e,t),ne.init(e,t)});function _e(e){return new xe({type:"optional",innerType:e})}const Ce=o("ZodMiniNonOptional",(e,t)=>{ee.init(e,t),ne.init(e,t)});function Se(e){return me(e)}function Ee(e){return ge(e)}Se({status:Ae(["idle","pending"]),remainingTasks:ie(),totalTasks:ie(),totalErrors:ie(),totalWarnings:ie()});const Pe=Se({name:re(),start:ie(),end:_e(ie()),threwException:_e(ue())}),je=Se({file:re(),line:_e(ie()),column:_e(ie())}),Oe=Se({text:re(),location:_e(je)}),ze=Se({text:re(),source:re(),location:_e(je),notes:_e(fe(Oe))}),Me=Se({id:re(),name:re(),status:Ae(["pending","complete"]),inputPath:re(),outputPath:_e(re()),errors:_e(fe(ze)),warnings:_e(fe(ze)),startTime:ie(),duration:_e(ie()),lastUpdated:_e(ie()),timings:_e(fe(Pe))});Se({tasks:fe(Me)});const Te=Ee({name:re(),version:re()}),$e=Se({packagePath:re(),hash:_e(re()),definition:_e(Te)}),qe=me({browser:we(re(),re()),node:we(re(),re())}),Ie=Se({path:re(),rootPath:_e(re()),includeAll:_e(ue()),ignoredPackages:_e(fe(re())),ignoreResolutions:_e(ue()),resolveStrategy:_e(Ae(["dedupe","duplicate"])),remote:_e(Se({hostUrl:re(),resolveMap:we(re(),le()),packages:me({definitions:we(re(),le()),transformedDefinitions:we(re(),le())}),packageHashes:me({hashesWithSource:qe,hashesWithNoSource:qe})}))}),Re=Se({linkedPath:Ie}),De=Se({resolveMap:we(re(),le()),linkedPaths:fe(Ie)}),Ne=Se({name:re(),version:_e(re())}),Le=ye([re(),ge({...Ne.shape})]),Ue=ye([re(),(Ze=Ne,function(e,t){const n=t._zod.def.shape,o={...n};for(const t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return v(t,{...t._zod.def,shape:o,checks:[]})}(Ce,Ze))]);var Ze;const We=Ee({packageSettings:_e(fe(ge({match:ye([Le,fe(Le)])}))),generated:ge({packageSettings:fe(ge({match:Ue}))})}),Be=(ie(),re(),{path:["link","update"],type:$e}),He={path:["link","config"],type:We},Fe={path:["link","paths"],type:Re},Je={path:["link","done"],type:De},Ge={path:["link","disconnected"],type:me({reason:Ae(["lost","unreachable"])})};var Ve=Object.create,Ye=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Xe=Object.getOwnPropertyNames,Qe=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty,tt=(e,t)=>function(){return t||(0,e[Xe(e)[0]])((t={exports:{}}).exports,t),t.exports},nt=(e,t,n)=>(n=null!=e?Ve(Qe(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=Xe(t),i=0,a=s.length;i<a;i++)r=s[i],et.call(e,r)||undefined===r||Ye(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=Ke(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:Ye(n,"default",{value:e,enumerable:!0}),e)),ot=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),rt=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=ot().default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports}}),st=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=ot().default,o=rt();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),it=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=st();t.exports=function(e,t,o){return(t=n(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},t.exports.__esModule=!0,t.exports.default=t.exports}}),at=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=it();function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}t.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e},t.exports.__esModule=!0,t.exports.default=t.exports}});function ut(e){const t={subscribe(t){let n=null,o=!1,r=!1,s=!1;function i(){null!==n?r||(r=!0,"function"==typeof n?n():n&&n.unsubscribe()):s=!0}return n=e({next(e){var n;o||null===(n=t.next)||void 0===n||n.call(t,e)},error(e){var n;o||(o=!0,null===(n=t.error)||void 0===n||n.call(t,e),i())},complete(){var e;o||(o=!0,null===(e=t.complete)||void 0===e||e.call(t),i())}}),s&&i(),{unsubscribe:i}},pipe:(...e)=>e.reduce(ct,t)};return t}function ct(e,t){return t(e)}function lt(e){return ut(t=>function t(n=0,o=e.op){const r=e.links[n];if(!r)throw new Error("No more links to execute - did you forget to add an ending link?");return r({op:o,next:e=>t(n+1,e)})}().subscribe(t))}function dt(e){return Array.isArray(e)?e:[e]}function pt(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}"function"==typeof Symbol&&Symbol.asyncIterator;const ft=e=>e();function ht(e=0){return new Promise(t=>setTimeout(t,e))}var mt=nt(it(),1),gt=nt(at(),1),vt=class e extends Error{constructor(t,n){var o,r;const s=null==n?void 0:n.cause;super(t,{cause:s}),(0,mt.default)(this,"cause",void 0),(0,mt.default)(this,"shape",void 0),(0,mt.default)(this,"data",void 0),(0,mt.default)(this,"meta",void 0),this.meta=null==n?void 0:n.meta,this.cause=s,this.shape=null==n||null===(o=n.result)||void 0===o?void 0:o.error,this.data=null==n||null===(r=n.result)||void 0===r?void 0:r.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,e.prototype)}static from(t,n={}){const o=t;return function(e){return e instanceof vt}(o)?(n.meta&&(o.meta=(0,gt.default)((0,gt.default)({},o.meta),n.meta)),o):pt(r=o)&&pt(r.error)&&"number"==typeof r.error.code&&"string"==typeof r.error.message?new e(o.error.message,(0,gt.default)((0,gt.default)({},n),{},{result:o})):new e("string"==typeof(s=o)?s:pt(s)&&"string"==typeof s.message?s.message:"Unknown error",(0,gt.default)((0,gt.default)({},n),{},{cause:o}));var r,s}};function yt(e){return e?"input"in e?e:{input:e,output:e}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}}const bt=e=>"function"==typeof e;var wt=nt(at(),1);const kt={query:"GET",mutation:"POST",subscription:"PATCH"};function At(e){return"input"in e?e.transformer.input.serialize(e.input):function(e){const t={};for(let n=0;n<e.length;n++){const o=e[n];t[n]=o}return t}(e.inputs.map(t=>e.transformer.input.serialize(t)))}const xt=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const o=[];if(t[1]&&o.push(t[1]),"inputs"in e&&o.push("batch=1"),"query"===e.type||"subscription"===e.type){const t=At(e);void 0!==t&&"POST"!==e.methodOverride&&o.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return o.length&&(n+="?"+o.join("&")),n},_t=e=>{if("query"===e.type&&"POST"!==e.methodOverride)return;const t=At(e);return void 0!==t?JSON.stringify(t):void 0};var Ct=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const St=e=>{var t;if(null==e?void 0:e.aborted){if(null===(t=e.throwIfAborted)||void 0===t||t.call(e),"undefined"!=typeof DOMException)throw new DOMException("AbortError","AbortError");throw new Ct}};nt(at(),1);var Et=Object.create,Pt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Ot=Object.getOwnPropertyNames,zt=Object.getPrototypeOf,Mt=Object.prototype.hasOwnProperty,Tt=(e,t)=>function(){return t||(0,e[Ot(e)[0]])((t={exports:{}}).exports,t),t.exports},$t=(e,t,n)=>(n=null!=e?Et(zt(e)):{},((e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var r,s=Ot(t),i=0,a=s.length;i<a;i++)r=s[i],Mt.call(e,r)||undefined===r||Pt(e,r,{get:(e=>t[e]).bind(null,r),enumerable:!(o=jt(t,r))||o.enumerable});return e})(!t&&e&&e.__esModule?n:Pt(n,"default",{value:e,enumerable:!0}),e));const qt=()=>{},It=e=>{Object.freeze&&Object.freeze(e)};function Rt(e,t,n){var o;const r=t.join(".");return null!==(o=n[r])&&void 0!==o||(n[r]=new Proxy(qt,{get(o,r){if("string"==typeof r&&"then"!==r)return Rt(e,[...t,r],n)},apply(n,o,r){const s=t[t.length-1];let i={args:r,path:t};return"call"===s?i={args:r.length>=2?[r[1]]:[],path:t.slice(0,-1)}:"apply"===s&&(i={args:r.length>=2?r[1]:[],path:t.slice(0,-1)}),It(i.args),It(i.path),e(i)}})),n[r]}const Dt=e=>Rt(e,[],Object.create(null));var Nt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(e){return t.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Lt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=Nt().default;t.exports=function(e,t){if("object"!=n(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,t||"default");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},t.exports.__esModule=!0,t.exports.default=t.exports}}),Ut=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=Nt().default,o=Lt();t.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},t.exports.__esModule=!0,t.exports.default=t.exports}}),Zt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Ut();t.exports=function(e,t,o){return(t=n(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e},t.exports.__esModule=!0,t.exports.default=t.exports}}),Wt=Tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Zt();function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}t.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e},t.exports.__esModule=!0,t.exports.default=t.exports}});$t(Wt(),1);$t(Zt(),1),Error;Error;var Bt=$t(Wt(),1),Ht=class extends Error{constructor(){super("Unable to transform response from server")}};function Ft(e,t){let n;try{n=function(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,Bt.default)((0,Bt.default)({},e),{},{error:n})}}return{ok:!0,result:(0,Bt.default)((0,Bt.default)({},e.result),(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.deserialize(e.result.data)})}}(e,t)}catch(e){throw new Ht}if(!(n.ok||pt(n.error.error)&&"number"==typeof n.error.error.code))throw new Ht;if(n.ok&&!pt(n.result))throw new Ht;return n}$t(Wt(),1),Symbol("lazy"),Symbol();const Jt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Gt(e){let t=null,n=null;function o(){const o=function(t){const n=[[]];let o=0;for(;;){const i=t[o];if(!i)break;const a=n[n.length-1];if(i.aborted){var r;null===(r=i.reject)||void 0===r||r.call(i,new Error("Aborted")),o++;continue}var s;e.validate(a.concat(i).map(e=>e.key))?(a.push(i),o++):0!==a.length?n.push([]):(null===(s=i.reject)||void 0===s||s.call(i,new Error("Input is too big for a single dispatch")),o++)}return n}(t);clearTimeout(n),n=null,t=null;for(const t of o){if(!t.length)continue;const n={items:t};for(const e of t)e.batch=n;e.fetch(n.items.map(e=>e.key)).then(async e=>{await Promise.all(e.map(async(e,t)=>{const o=n.items[t];try{var r;const t=await Promise.resolve(e);null===(r=o.resolve)||void 0===r||r.call(o,t)}catch(e){var s;null===(s=o.reject)||void 0===s||s.call(o,e)}o.batch=null,o.reject=null,o.resolve=null}));for(const e of n.items){var t;null===(t=e.reject)||void 0===t||t.call(e,new Error("Missing result")),e.batch=null}}).catch(e=>{for(const o of n.items){var t;null===(t=o.reject)||void 0===t||t.call(o,e),o.batch=null}})}}return{load:function(e){var r;const s={aborted:!1,key:e,batch:null,resolve:Jt,reject:Jt},i=new Promise((e,n)=>{var o;s.reject=n,s.resolve=e,null!==(o=t)&&void 0!==o||(t=[]),t.push(s)});return null!==(r=n)&&void 0!==r||(n=setTimeout(o)),i}}}var Vt=nt(at(),1);function Yt(e){var t,n;const o=function(e){return{url:e.url.toString(),fetch:e.fetch,transformer:yt(e.transformer),methodOverride:e.methodOverride}}(e),r=null!==(t=e.maxURLLength)&&void 0!==t?t:1/0,s=null!==(n=e.maxItems)&&void 0!==n?n:1/0;return()=>{const t=t=>({validate(e){if(r===1/0&&s===1/0)return!0;if(e.length>s)return!1;const n=e.map(e=>e.path).join(","),i=e.map(e=>e.input);return xt((0,Vt.default)((0,Vt.default)({},o),{},{type:t,path:n,inputs:i,signal:null})).length<=r},async fetch(n){const r=n.map(e=>e.path).join(","),s=n.map(e=>e.input),i=function(...e){const t=new AbortController,n=e.length;let o=0;const r=()=>{++o===n&&t.abort()};for(const t of e)(null==t?void 0:t.aborted)?r():null==t||t.addEventListener("abort",r,{once:!0});return t.signal}(...n.map(e=>e.signal)),a=await(e=>async function(e){const t={},n=await async function(e){var t;St(e.signal);const n=e.getUrl(e),o=e.getBody(e),{type:r}=e,s=await(async()=>{const t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})(),i=(0,wt.default)((0,wt.default)((0,wt.default)({},e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),s);return function(e){if(e)return e;if("undefined"!=typeof window&&bt(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&bt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}(e.fetch)(n,{method:null!==(t=e.methodOverride)&&void 0!==t?t:kt[r],signal:e.signal,body:o,headers:i})}(e);t.response=n;const o=await n.json();return t.responseJSON=o,{json:o,meta:t}}((0,wt.default)((0,wt.default)({},e),{},{contentTypeHeader:"application/json",getUrl:xt,getBody:_t})))((0,Vt.default)((0,Vt.default)({},o),{},{path:r,inputs:s,type:t,headers:()=>e.headers?"function"==typeof e.headers?e.headers({opList:n}):e.headers:{},signal:i}));return(Array.isArray(a.json)?a.json:n.map(()=>a.json)).map(e=>({meta:a.meta,json:e}))}}),n={query:Gt(t("query")),mutation:Gt(t("mutation"))};return({op:e})=>ut(t=>{if("subscription"===e.type)throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let r;return n[e.type].load(e).then(e=>{r=e;const n=Ft(e.json,o.transformer.output);n.ok?(t.next({context:e.meta,result:n.result}),t.complete()):t.error(vt.from(n.error,{meta:e.meta}))}).catch(e=>{t.error(vt.from(e,{meta:null==r?void 0:r.meta}))}),()=>{}})}}function Kt(e){let t=e;const n=[],o=ut(e=>((e=>{void 0!==t&&e.next(t),n.push(e)})(e),()=>{(e=>{n.splice(n.indexOf(e),1)})(e)}));return o.next=e=>{if(t!==e){t=e;for(const t of n)t.next(e)}},o.get=()=>t,o}nt(at(),1),Symbol();const Xt={enabled:!1,closeMs:0},Qt={enabled:!1,pongTimeoutMs:1e3,intervalMs:5e3},en=e=>0===e?0:Math.min(1e3*2**e,3e4),tn=(e,...t)=>"function"==typeof e?e(...t):e;var nn=nt(it(),1),on=class e extends Error{constructor(t){super(t.message,{cause:t.cause}),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,e.prototype)}},rn=class{constructor(e,t){this.onTimeout=e,this.timeoutMs=t,(0,nn.default)(this,"timeout",void 0)}reset(){this.timeout&&(clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs))}start(){clearTimeout(this.timeout),this.timeout=setTimeout(this.onTimeout,this.timeoutMs)}stop(){clearTimeout(this.timeout),this.timeout=void 0}};function sn(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var an=nt(it(),1),un=class{constructor(){(0,an.default)(this,"outgoingRequests",new Array),(0,an.default)(this,"pendingRequests",{})}register(e,t){const{promise:n,resolve:o}=sn();return this.outgoingRequests.push({id:String(e.id),message:e,end:n,callbacks:{next:t.next,complete:()=>{t.complete(),o()},error:e=>{t.error(e),o()}}}),()=>{this.delete(e.id),t.complete(),o()}}delete(e){null!==e&&(this.outgoingRequests=this.outgoingRequests.filter(({id:t})=>t!==String(e)),delete this.pendingRequests[String(e)])}flush(){const e=this.outgoingRequests;this.outgoingRequests=[];for(const t of e)this.pendingRequests[t.id]=t;return e}getPendingRequests(){return Object.values(this.pendingRequests)}getPendingRequest(e){return null===e?null:this.pendingRequests[String(e)]}getOutgoingRequests(){return this.outgoingRequests}getRequests(){return[...this.getOutgoingRequests().map(e=>({state:"outgoing",message:e.message,end:e.end,callbacks:e.callbacks})),...this.getPendingRequests().map(e=>({state:"pending",message:e.message,end:e.end,callbacks:e.callbacks}))]}hasPendingRequests(){return this.getPendingRequests().length>0}hasPendingSubscriptions(){return this.getPendingRequests().some(e=>"subscription"===e.message.method)}hasOutgoingRequests(){return this.outgoingRequests.length>0}},cn=nt(it(),1);function ln(e,{intervalMs:t,pongTimeoutMs:n}){let o,r;function s(){o=setTimeout(()=>{e.send("PING"),r=setTimeout(()=>{e.close()},n)},t)}e.addEventListener("open",s),e.addEventListener("message",({data:e})=>{clearTimeout(o),s(),"PONG"===e&&(clearTimeout(r),clearTimeout(o),s())}),e.addEventListener("close",()=>{clearTimeout(o),clearTimeout(r)})}var dn=class e{constructor(t){var n;if((0,cn.default)(this,"id",++e.connectCount),(0,cn.default)(this,"WebSocketPonyfill",void 0),(0,cn.default)(this,"urlOptions",void 0),(0,cn.default)(this,"keepAliveOpts",void 0),(0,cn.default)(this,"wsObservable",Kt(null)),(0,cn.default)(this,"openPromise",null),this.WebSocketPonyfill=null!==(n=t.WebSocketPonyfill)&&void 0!==n?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++e.connectCount;const n=async function(e){const t=await tn(e.url);if(!e.connectionParams)return t;const n=t.includes("?")?"&":"?";return t+`${n}connectionParams=1`}(t.urlOptions).then(e=>new t.WebSocketPonyfill(e));t.openPromise=n.then(async e=>{t.ws=e,e.addEventListener("message",function({data:e}){"PING"===e&&this.send("PONG")}),t.keepAliveOpts.enabled&&ln(e,t.keepAliveOpts),e.addEventListener("close",()=>{t.ws===e&&(t.ws=null)}),await function(e){const{promise:t,resolve:n,reject:o}=sn();return e.addEventListener("open",()=>{e.removeEventListener("error",o),n()}),e.addEventListener("error",o),t}(e),t.urlOptions.connectionParams&&e.send(await async function(e){const t={method:"connectionParams",data:await tn(e)};return JSON.stringify(t)}(t.urlOptions.connectionParams))});try{await t.openPromise}finally{t.openPromise=null}}async close(){try{await this.openPromise}finally{var e;null===(e=this.ws)||void 0===e||e.close()}}};(0,cn.default)(dn,"connectCount",0);var pn=nt(it(),1),fn=nt(at(),1),hn=class{constructor(e){var t;(0,pn.default)(this,"connectionState",void 0),(0,pn.default)(this,"allowReconnect",!1),(0,pn.default)(this,"requestManager",new un),(0,pn.default)(this,"activeConnection",void 0),(0,pn.default)(this,"reconnectRetryDelay",void 0),(0,pn.default)(this,"inactivityTimeout",void 0),(0,pn.default)(this,"callbacks",void 0),(0,pn.default)(this,"lazyMode",void 0),(0,pn.default)(this,"reconnecting",null),this.callbacks={onOpen:e.onOpen,onClose:e.onClose,onError:e.onError};const n=(0,fn.default)((0,fn.default)({},Xt),e.lazy);this.inactivityTimeout=new rn(()=>{this.requestManager.hasOutgoingRequests()||this.requestManager.hasPendingRequests()?this.inactivityTimeout.reset():this.close().catch(()=>null)},n.closeMs),this.activeConnection=new dn({WebSocketPonyfill:e.WebSocket,urlOptions:e,keepAlive:(0,fn.default)((0,fn.default)({},Qt),e.keepAlive)}),this.activeConnection.wsObservable.subscribe({next:e=>{e&&this.setupWebSocketListeners(e)}}),this.reconnectRetryDelay=null!==(t=e.retryDelayMs)&&void 0!==t?t:en,this.lazyMode=n.enabled,this.connectionState=Kt({type:"state",state:n.enabled?"idle":"connecting",error:null}),this.lazyMode||this.open().catch(()=>null)}async open(){var e=this;e.allowReconnect=!0,"connecting"!==e.connectionState.get().state&&e.connectionState.next({type:"state",state:"connecting",error:null});try{await e.activeConnection.open()}catch(t){return e.reconnect(new on({message:"Initialization error",cause:t})),e.reconnecting}}async close(){var e=this;e.allowReconnect=!1,e.inactivityTimeout.stop();const t=[];for(const n of e.requestManager.getRequests())"subscription"===n.message.method?n.callbacks.complete():"outgoing"===n.state?n.callbacks.error(vt.from(new on({message:"Closed before connection was established"}))):t.push(n.end);await Promise.all(t).catch(()=>null),await e.activeConnection.close().catch(()=>null),e.connectionState.next({type:"state",state:"idle",error:null})}request({op:{id:e,type:t,path:n,input:o,signal:r},transformer:s,lastEventId:i}){return ut(a=>{const u=this.batchSend({id:e,method:t,params:{input:s.input.serialize(o),path:n,lastEventId:i}},(0,fn.default)((0,fn.default)({},a),{},{next(e){const t=Ft(e,s.output);t.ok?a.next({result:t.result}):a.error(vt.from(t.error))}}));return()=>{u(),"subscription"===t&&this.activeConnection.isOpen()&&this.send({id:e,method:"subscription.stop"}),null==r||r.removeEventListener("abort",u)}})}get connection(){return(e=this.activeConnection).isOpen()?{id:e.id,state:"open",ws:e.ws}:e.isClosed()?{id:e.id,state:"closed",ws:e.ws}:e.ws?{id:e.id,state:"connecting",ws:e.ws}:null;var e}reconnect(e){var t=this;if(this.connectionState.next({type:"state",state:"connecting",error:vt.from(e)}),this.reconnecting)return;const n=async e=>{try{await ht(t.reconnectRetryDelay(e)),t.allowReconnect&&(await t.activeConnection.close(),await t.activeConnection.open(),t.requestManager.hasPendingRequests()&&t.send(t.requestManager.getPendingRequests().map(({message:e})=>e))),t.reconnecting=null}catch(t){await n(e+1)}};this.reconnecting=n(0)}setupWebSocketListeners(e){var t=this;const n=e=>{const t=this.requestManager.getPendingRequests();for(const{message:n,callbacks:o}of t)"subscription"!==n.method&&(o.error(vt.from(null!=e?e:new on({message:"WebSocket closed",cause:e}))),this.requestManager.delete(n.id))};e.addEventListener("open",()=>{ft(async()=>{var e,n;t.lazyMode&&t.inactivityTimeout.start(),null===(e=(n=t.callbacks).onOpen)||void 0===e||e.call(n),t.connectionState.next({type:"state",state:"pending",error:null})}).catch(t=>{e.close(3e3),n(t)})}),e.addEventListener("message",({data:e})=>{if(this.inactivityTimeout.reset(),"string"!=typeof e||["PING","PONG"].includes(e))return;const t=JSON.parse(e);"method"in t?this.handleIncomingRequest(t):this.handleResponseMessage(t)}),e.addEventListener("close",e=>{var t,o;n(e),null===(t=(o=this.callbacks).onClose)||void 0===t||t.call(o,e),this.lazyMode&&!this.requestManager.hasPendingSubscriptions()||this.reconnect(new on({message:"WebSocket closed",cause:e}))}),e.addEventListener("error",e=>{var t,o;n(e),null===(t=(o=this.callbacks).onError)||void 0===t||t.call(o,e),this.reconnect(new on({message:"WebSocket closed",cause:e}))})}handleResponseMessage(e){const t=this.requestManager.getPendingRequest(e.id);if(!t)return;t.callbacks.next(e);let n=!0;"result"in e&&"subscription"===t.message.method&&("data"===e.result.type&&(t.message.params.lastEventId=e.result.id),"stopped"!==e.result.type&&(n=!1)),n&&(t.callbacks.complete(),this.requestManager.delete(e.id))}handleIncomingRequest(e){"reconnect"===e.method&&this.reconnect(new on({message:"Server requested reconnect"}))}send(e){if(!this.activeConnection.isOpen())throw new Error("Active connection is not open");const t=e instanceof Array?e:[e];this.activeConnection.ws.send(JSON.stringify(1===t.length?t[0]:t))}batchSend(e,t){var n=this;return this.inactivityTimeout.reset(),ft(async()=>{n.activeConnection.isOpen()||await n.open(),await ht(0),n.requestManager.hasOutgoingRequests()&&n.send(n.requestManager.flush().map(({message:e})=>e))}).catch(n=>{this.requestManager.delete(e.id),t.error(vt.from(n))}),this.requestManager.register(e,t)}};function mn(e){const{client:t}=e,n=yt(e.transformer);return()=>({op:e})=>ut(o=>{const r="subscription"===e.type?t.connectionState.subscribe({next(t){o.next({result:t,context:e.context})}}):null,s=t.request({op:e,transformer:n}).subscribe(o);return()=>{s.unsubscribe(),null==r||r.unsubscribe()}})}var gn=nt(it(),1),vn=nt(at(),1),yn=class{constructor(e){(0,gn.default)(this,"links",void 0),(0,gn.default)(this,"runtime",void 0),(0,gn.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}$request(e){var t;return lt({links:this.links,op:(0,vn.default)((0,vn.default)({},e),{},{context:null!==(t=e.context)&&void 0!==t?t:{},id:++this.requestId})}).pipe(e=>{let t=0,n=null;const o=[];return ut(r=>(t++,o.push(r),n||(n=e.subscribe({next(e){for(const n of o){var t;null===(t=n.next)||void 0===t||t.call(n,e)}},error(e){for(const n of o){var t;null===(t=n.error)||void 0===t||t.call(n,e)}},complete(){for(const t of o){var e;null===(e=t.complete)||void 0===e||e.call(t)}}})),{unsubscribe(){t--,function(){if(0===t&&n){const e=n;n=null,e.unsubscribe()}}();const e=o.findIndex(e=>e===r);e>-1&&o.splice(e,1)}}))})}async requestAsPromise(e){try{const t=this.$request(e);return(await function(e){const t=new AbortController;return new Promise((n,o)=>{let r=!1;function s(){r||(r=!0,i.unsubscribe())}t.signal.addEventListener("abort",()=>{o(t.signal.reason)});const i=e.subscribe({next(e){r=!0,n(e),s()},error(e){o(e)},complete(){t.abort(),s()}})})}(t)).result.data}catch(e){throw vt.from(e)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:null==n?void 0:n.context,signal:null==n?void 0:n.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:null==n?void 0:n.context,signal:null==n?void 0:n.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(e){switch(e.result.type){case"state":var t;null===(t=n.onConnectionStateChange)||void 0===t||t.call(n,e.result);break;case"started":var o;null===(o=n.onStarted)||void 0===o||o.call(n,{context:e.context});break;case"stopped":var r;null===(r=n.onStopped)||void 0===r||r.call(n);break;case"data":case void 0:var s;null===(s=n.onData)||void 0===s||s.call(n,e.result.data)}},error(e){var t;null===(t=n.onError)||void 0===t||t.call(n,e)},complete(){var e;null===(e=n.onComplete)||void 0===e||e.call(n)}})}};const bn=Symbol.for("trpc_untypedClient"),wn={query:"query",mutate:"mutation",subscribe:"subscription"};nt(at(),1),nt(at(),1),nt(tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function n(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return(n=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new n(e)}t.exports=function(e){var t,o,r,s=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(o&&null!=(t=e[o]))return t.call(e);if(r&&null!=(t=e[r]))return new n(t.call(e));o="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")},t.exports.__esModule=!0,t.exports.default=t.exports}})(),1),nt(at(),1);var kn=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){t.exports=function(){var e="function"==typeof SuppressedError?SuppressedError:function(e,t){var n=Error();return n.name="SuppressedError",n.error=e,n.suppressed=t,n},t={},n=[];function o(e,t){if(null!=t){if(Object(t)!==t)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(e)var o=t[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(void 0===o&&(o=t[Symbol.dispose||Symbol.for("Symbol.dispose")],e))var r=o;if("function"!=typeof o)throw new TypeError("Object is not disposable.");r&&(o=function(){try{r.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:o,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var o,r=this.e,s=0;function i(){for(;o=n.pop();)try{if(!o.a&&1===s)return s=0,n.push(o),Promise.resolve().then(i);if(o.d){var e=o.d.call(o.v);if(o.a)return s|=2,Promise.resolve(e).then(i,a)}else s|=1}catch(e){return a(e)}if(1===s)return r!==t?Promise.reject(r):Promise.resolve();if(r!==t)throw r}function a(n){return r=r!==t?new e(n,r):n,i()}return i()}}},t.exports.__esModule=!0,t.exports.default=t.exports}}),An=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){t.exports=function(e,t){this.v=e,this.k=t},t.exports.__esModule=!0,t.exports.default=t.exports}}),xn=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var n=An();t.exports=function(e){return new n(e,0)},t.exports.__esModule=!0,t.exports.default=t.exports}}),_n=tt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var n=An();function o(e){var t,o;function r(t,o){try{var i=e[t](o),a=i.value,u=a instanceof n;Promise.resolve(u?a.v:a).then(function(n){if(u){var o="return"===t?"return":"next";if(!a.k||n.done)return r(o,n);n=e[o](n).value}s(i.done?"return":"normal",n)},function(e){r("throw",e)})}catch(e){s("throw",e)}}function s(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?r(t.key,t.arg):o=null}this._invoke=function(e,n){return new Promise(function(s,i){var a={key:e,arg:n,resolve:s,reject:i,next:null};o?o=o.next=a:(t=o=a,r(e,n))})},"function"!=typeof e.return&&(this.return=void 0)}o.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(e){return this._invoke("next",e)},o.prototype.throw=function(e){return this._invoke("throw",e)},o.prototype.return=function(e){return this._invoke("return",e)},t.exports=function(e){return function(){return new o(e.apply(this,arguments))}},t.exports.__esModule=!0,t.exports.default=t.exports}});async function Cn(e){await async function(){if("undefined"!=typeof global){const e=global;if(void 0===e.WebSocket){const{WebSocket:t}=await n.e(621).then(n.t.bind(n,621,19));e.WebSocket=t}}}(),function({reporter:e}){"undefined"!=typeof process&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",e?.ignoreLogMessage("Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable"))}({reporter:e.reporter});const t=new hn(e),o=function(e,t){try{return new URL(e,t)}catch{throw new Error(`Invalid URL: "${e}", base: ""`)}}(e.url),r="wss:"===o.protocol;o.protocol=r?"https:":"http:";const s=o.toString().replace(/\/$/,""),i=function(e){return function(e){const t=Dt(({path:t,args:n})=>{const o=[...t],r=(s=o.pop(),wn[s]);var s;const i=o.join(".");return e[r](i,...n)});return n=n=>n===bn?e:t[n],new Proxy(qt,{get(e,t){if("then"!==t)return n(t)}});var n}(new yn(e))}({links:[(a={condition:e=>"subscription"===e.type,true:mn({client:t}),false:Yt({url:s})},e=>{const t=dt(a.true).map(t=>t(e)),n=dt(a.false).map(t=>t(e));return e=>ut(o=>{const r=a.condition(e.op)?t:n;return lt({op:e.op,links:r}).subscribe(o)})})]});var a;return new Proxy({close:async()=>{await t.close()}},{get:(e,t)=>e.hasOwnProperty(t)?e[t]:i[t]})}nt(kn(),1),nt(xn(),1),nt(_n(),1),nt(at(),1);var Sn=n(606),En=n.n(Sn),Pn=n(607),jn=n.n(Pn),On=n(437),zn=n.n(On),Mn=n(750),Tn=n.n(Mn),$n=n(994),qn=n.n($n),In=n(415),Rn=n.n(In),Dn=n(941),Nn={};Nn.styleTagTransform=Rn(),Nn.setAttributes=Tn(),Nn.insert=zn().bind(null,"head"),Nn.domAPI=jn(),Nn.insertStyleElement=qn(),En()(Dn.default,Nn);const Ln=Dn.default&&Dn.default.locals?Dn.default.locals:void 0;class Un{element;constructor(e="root"){this.element=document.getElementById(e)}updateStatus(e){const{message:t,tip:n,isError:o=!1,data:r}=e,s=o?"error":"debug";r?console[s](t,r):console[s](t),this.element&&(this.element.innerHTML=`\n <div class="${Ln.statusContainer+(o?` ${Ln.errorContainer}`:"")}">\n <h2 class="${Ln.title}">Cloudpack Link Proxy</h2>\n <p class="${Ln.message}">${o?"Error: ":""}${t}</p>\n ${n?`<p class="${Ln.message}"><strong>Tip:</strong> ${n}</p>`:""}\n <p class="${Ln.warning}">Do not close this page while Cloudpack link is running.</p>\n </div>\n `)}}class Zn{clients=new Map;connectionStates=new Map;checkInterval=null;checkIntervalMs=5e3;addClient(e,t){this.clients.set(e,t),this.connectionStates.set(e,!0)}getClient(e){return this.clients.get(e)}async checkConnection(e){const t=this.clients.get(e);if(!t)return!1;try{return await t.getSessionId.query(),!0}catch(t){return console.warn(`${e} client connection lost:`,t),!1}}startMonitoring(e){this.checkInterval&&window.clearInterval(this.checkInterval),this.checkInterval=window.setInterval(()=>{(async()=>{for(const[t,n]of this.clients){if("link"!=t&&"host"!=t)throw new Error(`Invalid client ID: ${t}`);const n=this.connectionStates.get(t)||!1,o=await this.checkConnection(t);n!==o&&await e({id:t,isConnected:o,wasConnected:n}),this.connectionStates.set(t,o)}})().catch(e=>{console.error("Error in connection monitoring:",e)})},this.checkIntervalMs)}stopMonitoring(){this.checkInterval&&(window.clearInterval(this.checkInterval),this.checkInterval=null)}async closeAll(){for(const[e,t]of this.clients)try{await t.close(),console.log(`Closed ${e} client`)}catch(t){console.error(`Error closing ${e} client:`,t)}this.clients.clear(),this.connectionStates.clear()}}async function Wn(e){console.debug(`[Cloudpack] Checking session at ${e}`);const t=await Cn({url:e});let n=!1;try{n=!!await t.getSessionId.query()}catch{}finally{await t.close()}return n}const Bn=new class{ui;connectionManager;linkedPathData=null;constructor(){this.ui=new Un,this.connectionManager=new Zn}handleConnectionChange=async e=>{const{id:t,isConnected:n,wasConnected:o}=e;o&&!n&&("host"===t?await this.handleHostDisconnection():"link"===t&&await this.handleLinkDisconnection())};async handleHostDisconnection(e){const t=e?.unreachable??!1,n=t?"unreachable":"lost";this.ui.updateStatus({message:`Connection to host ${n}. The session will be terminated.`,isError:!0});const o=this.connectionManager.getClient("link");let r,s=!1;if(o)try{await o.publishData.mutate({...Ge,data:{reason:n}}),s=!0}catch{this.ui.updateStatus({message:`Error notifying link client of host connection ${n}.`,isError:!0})}await this.cleanup(),t?r="Make sure you have a <code>cloudpack start</code> session running and use the URL from your app to run link with the following command: <code>cloudpack link --remote [URL]</code>":(r="If you did not close the start session terminal, this is a bug. Please report it.",s||(r+=" Link client was not successfully notified of host disconnection. You may need to terminate the link session in the terminal.")),this.ui.updateStatus({message:`Connection to host ${n}. You can close this page.`,tip:r,isError:!0})}async handleLinkDisconnection(){this.ui.updateStatus({message:"Connection to link client lost. Cleaning up linked paths...",isError:!0});const e=this.connectionManager.getClient("host");if(e&&this.linkedPathData){const{linkedPath:t}=this.linkedPathData,n=t.path;try{await e.unlinkPath.mutate({linkedPath:{path:n}}),this.ui.updateStatus({message:"Connection to link client lost. Successfully unlinked paths on host. You can close this page.",tip:"If you did not close the link client terminal. This is a bug. Please report it."})}catch(e){this.ui.updateStatus({message:"Connection to link client lost. Failed to unlink paths on host.",tip:"You may need to restart the host application to unlink the paths.",isError:!0,data:e})}}else this.ui.updateStatus({message:"Cannot clean up: host client or link data not available",tip:"You may need to restart the host application to unlink the paths.",isError:!0});await this.cleanup()}setupLinkUpdateHandler(){const e=this.connectionManager.getClient("link"),t=this.connectionManager.getClient("host");e&&t&&e.onDataChanged.subscribe(Be,{onData:e=>{this.ui.updateStatus({message:"Forwarding package update to the host...",data:e}),t.notifyLinkChange.mutate(e).then(()=>this.ui.updateStatus({message:"Cloudpack Link Proxy listening for updates..."})).catch(e=>{this.ui.updateStatus({message:"Error forwarding package update to the host. This is a bug. Please report it.",isError:!0,data:e})})}})}async setupLinkPathHandler(){const e=this.connectionManager.getClient("host"),t=this.connectionManager.getClient("link");t&&e&&(await t.getData.query(Fe)||t.onDataChanged.subscribe(Fe,{onData:n=>{this.ui.updateStatus({message:"Processing link setup...",data:n}),this.linkedPathData=n,e.linkPath.mutate(this.linkedPathData).then(e=>{const{resolveMap:n,linkedPaths:o}=e;this.ui.updateStatus({message:"Sending link setup result back to the link server...",data:e}),t.publishData.mutate({...Je,data:{resolveMap:n,linkedPaths:o}}).then(()=>{this.ui.updateStatus({message:"Cloudpack Link Proxy listening for updates..."})}).catch(e=>{this.ui.updateStatus({message:"Error sending link setup result back to the link server. Please try to run link again.",tip:"This is a bug. Please report it.",isError:!0,data:e})})})}}))}async setupConfig(){const e=this.connectionManager.getClient("link"),t=this.connectionManager.getClient("host");if(e&&t)try{if(!await e.getData.query(He)){this.ui.updateStatus({message:"Fetching host configuration..."});const n=await t.getLinkConfig.query();this.ui.updateStatus({message:"Sending host configuration to the link server...",data:n}),await e.publishData.mutate({...He,data:n}),this.ui.updateStatus({message:"Host configuration sent to the link server."})}}catch(e){this.ui.updateStatus({message:"Error setting up configuration. Please try to run link again.",tip:"This is a bug. Please report it.",isError:!0,data:e})}}async cleanup(){this.connectionManager.stopMonitoring(),await this.connectionManager.closeAll()}async initialize(){this.ui.updateStatus({message:"Initializing Cloudpack Link Proxy..."});try{if(!window.__cloudpack)throw this.ui.updateStatus({message:"Cloudpack context not found on window.",tip:"This is a bug. Please report it.",isError:!0}),new Error("Cloudpack not found on window.");const{pageSessionContext:e}=window.__cloudpack;if(!e)throw this.ui.updateStatus({message:"Session context not found on window.__cloudpack.",tip:"This is a bug. Please report it.",isError:!0,data:window.__cloudpack}),new Error("Session context not found on window.__cloudpack");const{apiUrl:t,hostApiServerUrls:n}=e;if(!n||n.length<=0)return void this.ui.updateStatus({message:"No host URL provided.",tip:"This is a bug. Please report it.",data:e,isError:!0});const o=await Cn({url:t});let r;this.connectionManager.addClient("link",o);for(const e of n)if(this.ui.updateStatus({message:`Checking host API server at ${e}...`}),await Wn(e)){this.ui.updateStatus({message:`Host API server is active at ${e}.`}),r=e;break}if(!r)return void await this.handleHostDisconnection({unreachable:!0});const s=await Cn({url:r});this.connectionManager.addClient("host",s);const i=await o.getSessionId.query(),a=await s.getSessionId.query();this.ui.updateStatus({message:`Link Session: ${i}, Host Session: ${a}`}),this.connectionManager.startMonitoring(this.handleConnectionChange),this.setupLinkUpdateHandler(),await this.setupLinkPathHandler(),await this.setupConfig()}catch(e){const t=e instanceof Error?e.message:String(e);this.ui.updateStatus({message:t,isError:!0,tip:"This is a bug. Please report it.",data:e}),await this.cleanup()}}};Bn.initialize()},941:(e,t,n)=>{n.d(t,{default:()=>a});var o=n(25),r=n.n(o),s=n(191),i=n.n(s)()(r());i.push([e.id,":root {\n --color-neutral-background1: #ffffff;\n --color-status-danger-background1: #fdf3f4;\n --color-neutral-background2: #fafafa;\n --color-status-danger-foreground1: #b10e1c;\n --color-neutral-foreground1: #242424;\n --color-neutral-foreground2: #424242;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --color-neutral-background1: #292929;\n --color-status-danger-background1: #3b0509;\n --color-neutral-background2: #1f1f1f;\n --color-status-danger-foreground1: #dc626d;\n --color-neutral-foreground1: #ffffff;\n --color-neutral-foreground2: #d6d6d6;\n }\n}\n\nbody {\n background-color: var(--color-neutral-background1);\n margin: 0;\n padding: 0;\n font-family:\n 'Segoe UI',\n 'Segoe UI Web (West European)',\n -apple-system,\n BlinkMacSystemFont,\n Roboto,\n 'Helvetica Neue',\n sans-serif;\n}\n\n.v64eNmuXrV4WWsOKdGgy {\n padding: 20px;\n border-radius: 4px;\n background-color: var(--color-neutral-background2);\n margin: 20px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr {\n background-color: var(--color-status-danger-background1);\n}\n\n.b6Vf2DbiFQkD7AEkJ7p_ h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n._05tS4aUzls4kEWk9hkA7 {\n color: var(--color-neutral-foreground1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr .b6Vf2DbiFQkD7AEkJ7p_ {\n color: var(--color-status-danger-foreground1);\n}\n\n.ScZ3E77NPMqtBzp0OwUr ._05tS4aUzls4kEWk9hkA7 {\n color: var(--color-status-danger-foreground1);\n}\n\n._05tS4aUzls4kEWk9hkA7 code {\n background-color: var(--color-neutral-background1);\n padding: 2px 5px;\n border-radius: 3px;\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 0.9em;\n}\n\n.ScZ3E77NPMqtBzp0OwUr ._05tS4aUzls4kEWk9hkA7 code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.kheFps3bT2VbnjAMYfSr {\n font-weight: bold;\n margin-top: 20px;\n color: var(--color-neutral-foreground2);\n}\n","",{version:3,sources:["webpack://./src/UIManager.module.css"],names:[],mappings:"AAAA;EACE,oCAAoC;EACpC,0CAA0C;EAC1C,oCAAoC;EACpC,0CAA0C;EAC1C,oCAAoC;EACpC,oCAAoC;AACtC;;AAEA;EACE;IACE,oCAAoC;IACpC,0CAA0C;IAC1C,oCAAoC;IACpC,0CAA0C;IAC1C,oCAAoC;IACpC,oCAAoC;EACtC;AACF;;AAEA;EACE,kDAAkD;EAClD,SAAS;EACT,UAAU;EACV;;;;;;;cAOY;AACd;;AAEA;EACE,aAAa;EACb,kBAAkB;EAClB,kDAAkD;EAClD,YAAY;EACZ,wCAAwC;AAC1C;;AAEA;EACE,wDAAwD;AAC1D;;AAEA;EACE,uCAAuC;EACvC,aAAa;AACf;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,6CAA6C;AAC/C;;AAEA;EACE,kDAAkD;EAClD,gBAAgB;EAChB,kBAAkB;EAClB,2DAA2D;EAC3D,gBAAgB;AAClB;;AAEA;EACE,oCAAoC;AACtC;;AAEA;EACE,iBAAiB;EACjB,gBAAgB;EAChB,uCAAuC;AACzC",sourcesContent:[":root {\n --color-neutral-background1: #ffffff;\n --color-status-danger-background1: #fdf3f4;\n --color-neutral-background2: #fafafa;\n --color-status-danger-foreground1: #b10e1c;\n --color-neutral-foreground1: #242424;\n --color-neutral-foreground2: #424242;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --color-neutral-background1: #292929;\n --color-status-danger-background1: #3b0509;\n --color-neutral-background2: #1f1f1f;\n --color-status-danger-foreground1: #dc626d;\n --color-neutral-foreground1: #ffffff;\n --color-neutral-foreground2: #d6d6d6;\n }\n}\n\n:global body {\n background-color: var(--color-neutral-background1);\n margin: 0;\n padding: 0;\n font-family:\n 'Segoe UI',\n 'Segoe UI Web (West European)',\n -apple-system,\n BlinkMacSystemFont,\n Roboto,\n 'Helvetica Neue',\n sans-serif;\n}\n\n.statusContainer {\n padding: 20px;\n border-radius: 4px;\n background-color: var(--color-neutral-background2);\n margin: 20px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.errorContainer {\n background-color: var(--color-status-danger-background1);\n}\n\n.title h2 {\n color: var(--color-neutral-foreground1);\n margin-top: 0;\n}\n\n.message {\n color: var(--color-neutral-foreground1);\n}\n\n.errorContainer .title {\n color: var(--color-status-danger-foreground1);\n}\n\n.errorContainer .message {\n color: var(--color-status-danger-foreground1);\n}\n\n.message code {\n background-color: var(--color-neutral-background1);\n padding: 2px 5px;\n border-radius: 3px;\n font-family: 'Consolas', 'Monaco', 'Courier New', monospace;\n font-size: 0.9em;\n}\n\n.errorContainer .message code {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\n.warning {\n font-weight: bold;\n margin-top: 20px;\n color: var(--color-neutral-foreground2);\n}\n"],sourceRoot:""}]),i.locals={statusContainer:"v64eNmuXrV4WWsOKdGgy",errorContainer:"ScZ3E77NPMqtBzp0OwUr",title:"b6Vf2DbiFQkD7AEkJ7p_",message:"_05tS4aUzls4kEWk9hkA7",warning:"kheFps3bT2VbnjAMYfSr"};const a=i},994:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}}};import e from"../runtime.js";import*as t from"./index.js";e.C(t),e(e.s=851);
3
3
  //# sourceMappingURL=index.js.map