@rizom/brain 0.2.0-alpha.47 → 0.2.0-alpha.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,504 +1,5 @@
1
1
  // @bun
2
- var Up=Object.create;var{getPrototypeOf:Gp,defineProperty:ZH,getOwnPropertyNames:Hp}=Object;var Dp=Object.prototype.hasOwnProperty;function Vp($){return this[$]}var Kp,Qp,n1=($,X,Y)=>{var W=$!=null&&typeof $==="object";if(W){var J=X?Kp??=new WeakMap:Qp??=new WeakMap,U=J.get($);if(U)return U}Y=$!=null?Up(Gp($)):{};let H=X||!$||!$.__esModule?ZH(Y,"default",{value:$,enumerable:!0}):Y;for(let D of Hp($))if(!Dp.call(H,D))ZH(H,D,{get:Vp.bind($,D),enumerable:!0});if(W)J.set($,H);return H};var X$=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var Fp=($)=>$;function qp($,X){this[$]=Fp.bind(null,X)}var e0=($,X)=>{for(var Y in X)ZH($,Y,{get:X[Y],enumerable:!0,configurable:!0,set:qp.bind(X,Y)})};var A=($,X)=>()=>($&&(X=$($=0)),X);var I4=import.meta.require;var F6,zH,O$,j0=($)=>{switch(typeof $){case"undefined":return O$.undefined;case"string":return O$.string;case"number":return Number.isNaN($)?O$.nan:O$.number;case"boolean":return O$.boolean;case"function":return O$.function;case"bigint":return O$.bigint;case"symbol":return O$.symbol;case"object":if(Array.isArray($))return O$.array;if($===null)return O$.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return O$.promise;if(typeof Map<"u"&&$ instanceof Map)return O$.map;if(typeof Set<"u"&&$ instanceof Set)return O$.set;if(typeof Date<"u"&&$ instanceof Date)return O$.date;return O$.object;default:return O$.unknown}};var O7=A(()=>{(function($){$.assertEqual=(J)=>{};function X(J){}$.assertIs=X;function Y(J){throw Error()}$.assertNever=Y,$.arrayToEnum=(J)=>{let U={};for(let H of J)U[H]=H;return U},$.getValidEnumValues=(J)=>{let U=$.objectKeys(J).filter((D)=>typeof J[J[D]]!=="number"),H={};for(let D of U)H[D]=J[D];return $.objectValues(H)},$.objectValues=(J)=>{return $.objectKeys(J).map(function(U){return J[U]})},$.objectKeys=typeof Object.keys==="function"?(J)=>Object.keys(J):(J)=>{let U=[];for(let H in J)if(Object.prototype.hasOwnProperty.call(J,H))U.push(H);return U},$.find=(J,U)=>{for(let H of J)if(U(H))return H;return},$.isInteger=typeof Number.isInteger==="function"?(J)=>Number.isInteger(J):(J)=>typeof J==="number"&&Number.isFinite(J)&&Math.floor(J)===J;function W(J,U=" | "){return J.map((H)=>typeof H==="string"?`'${H}'`:H).join(U)}$.joinValues=W,$.jsonStringifyReplacer=(J,U)=>{if(typeof U==="bigint")return U.toString();return U}})(F6||(F6={}));(function($){$.mergeShapes=(X,Y)=>{return{...X,...Y}}})(zH||(zH={}));O$=F6.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var K$,wp=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")},_4;var V2=A(()=>{O7();K$=F6.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"]);_4=class _4 extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Y)=>{this.issues=[...this.issues,Y]},this.addIssues=(Y=[])=>{this.issues=[...this.issues,...Y]};let X=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,X);else this.__proto__=X;this.name="ZodError",this.issues=$}format($){let X=$||function(J){return J.message},Y={_errors:[]},W=(J)=>{for(let U of J.issues)if(U.code==="invalid_union")U.unionErrors.map(W);else if(U.code==="invalid_return_type")W(U.returnTypeError);else if(U.code==="invalid_arguments")W(U.argumentsError);else if(U.path.length===0)Y._errors.push(X(U));else{let H=Y,D=0;while(D<U.path.length){let V=U.path[D];if(D!==U.path.length-1)H[V]=H[V]||{_errors:[]};else H[V]=H[V]||{_errors:[]},H[V]._errors.push(X(U));H=H[V],D++}}};return W(this),Y}static assert($){if(!($ instanceof _4))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,F6.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},Y=[];for(let W of this.issues)if(W.path.length>0){let J=W.path[0];X[J]=X[J]||[],X[J].push($(W))}else Y.push($(W));return{formErrors:Y,fieldErrors:X}}get formErrors(){return this.flatten()}};_4.create=($)=>{return new _4($)}});var Zp=($,X)=>{let Y;switch($.code){case K$.invalid_type:if($.received===O$.undefined)Y="Required";else Y=`Expected ${$.expected}, received ${$.received}`;break;case K$.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify($.expected,F6.jsonStringifyReplacer)}`;break;case K$.unrecognized_keys:Y=`Unrecognized key(s) in object: ${F6.joinValues($.keys,", ")}`;break;case K$.invalid_union:Y="Invalid input";break;case K$.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${F6.joinValues($.options)}`;break;case K$.invalid_enum_value:Y=`Invalid enum value. Expected ${F6.joinValues($.options)}, received '${$.received}'`;break;case K$.invalid_arguments:Y="Invalid function arguments";break;case K$.invalid_return_type:Y="Invalid function return type";break;case K$.invalid_date:Y="Invalid date";break;case K$.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Y=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Y=`${Y} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Y=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Y=`Invalid input: must end with "${$.validation.endsWith}"`;else F6.assertNever($.validation);else if($.validation!=="regex")Y=`Invalid ${$.validation}`;else Y="Invalid";break;case K$.too_small:if($.type==="array")Y=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Y=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Y=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Y=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Y=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Y="Invalid input";break;case K$.too_big:if($.type==="array")Y=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Y=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Y=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Y=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Y=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Y="Invalid input";break;case K$.custom:Y="Invalid input";break;case K$.invalid_intersection_types:Y="Intersection results could not be merged";break;case K$.not_multiple_of:Y=`Number must be a multiple of ${$.multipleOf}`;break;case K$.not_finite:Y="Number must be finite";break;default:Y=X.defaultError,F6.assertNever($)}return{message:Y}},$8;var OH=A(()=>{V2();O7();$8=Zp});function zp($){tO=$}function Q5(){return tO}var tO;var K2=A(()=>{OH();tO=$8});function _$($,X){let Y=Q5(),W=N7({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Y,Y===$8?void 0:$8].filter((J)=>!!J)});$.common.issues.push(W)}class T4{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,X){let Y=[];for(let W of X){if(W.status==="aborted")return c$;if(W.status==="dirty")$.dirty();Y.push(W.value)}return{status:$.value,value:Y}}static async mergeObjectAsync($,X){let Y=[];for(let W of X){let J=await W.key,U=await W.value;Y.push({key:J,value:U})}return T4.mergeObjectSync($,Y)}static mergeObjectSync($,X){let Y={};for(let W of X){let{key:J,value:U}=W;if(J.status==="aborted")return c$;if(U.status==="aborted")return c$;if(J.status==="dirty")$.dirty();if(U.status==="dirty")$.dirty();if(J.value!=="__proto__"&&(typeof U.value<"u"||W.alwaysSet))Y[J.value]=U.value}return{status:$.value,value:Y}}}var N7=($)=>{let{data:X,path:Y,errorMaps:W,issueData:J}=$,U=[...Y,...J.path||[]],H={...J,path:U};if(J.message!==void 0)return{...J,path:U,message:J.message};let D="",V=W.filter((K)=>!!K).slice().reverse();for(let K of V)D=K(H,{data:X,defaultError:D}).message;return{...J,path:U,message:D}},Op,c$,G9=($)=>({status:"dirty",value:$}),v4=($)=>({status:"valid",value:$}),Q2=($)=>$.status==="aborted",F2=($)=>$.status==="dirty",_8=($)=>$.status==="valid",F5=($)=>typeof Promise<"u"&&$ instanceof Promise;var NH=A(()=>{K2();OH();Op=[];c$=Object.freeze({status:"aborted"})});var eO=()=>{};var x$;var $N=A(()=>{(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X?.message})(x$||(x$={}))});class t1{constructor($,X,Y,W){this._cachedPath=[],this.parent=$,this.data=X,this._path=Y,this._key=W}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function Y6($){if(!$)return{};let{errorMap:X,invalid_type_error:Y,required_error:W,description:J}=$;if(X&&(Y||W))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:J};return{errorMap:(H,D)=>{let{message:V}=$;if(H.code==="invalid_enum_value")return{message:V??D.defaultError};if(typeof D.data>"u")return{message:V??W??D.defaultError};if(H.code!=="invalid_type")return{message:D.defaultError};return{message:V??Y??D.defaultError}},description:J}}class H6{get description(){return this._def.description}_getType($){return j0($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:j0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new T4,ctx:{common:$.parent.common,data:$.data,parsedType:j0($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(F5(X))throw Error("Synchronous parse encountered promise.");return X}_parseAsync($){let X=this._parse($);return Promise.resolve(X)}parse($,X){let Y=this.safeParse($,X);if(Y.success)return Y.data;throw Y.error}safeParse($,X){let Y={common:{issues:[],async:X?.async??!1,contextualErrorMap:X?.errorMap},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:j0($)},W=this._parseSync({data:$,path:Y.path,parent:Y});return XN(Y,W)}"~validate"($){let X={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:j0($)};if(!this["~standard"].async)try{let Y=this._parseSync({data:$,path:[],parent:X});return _8(Y)?{value:Y.value}:{issues:X.common.issues}}catch(Y){if(Y?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;X.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:X}).then((Y)=>_8(Y)?{value:Y.value}:{issues:X.common.issues})}async parseAsync($,X){let Y=await this.safeParseAsync($,X);if(Y.success)return Y.data;throw Y.error}async safeParseAsync($,X){let Y={common:{issues:[],contextualErrorMap:X?.errorMap,async:!0},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:j0($)},W=this._parse({data:$,path:Y.path,parent:Y}),J=await(F5(W)?W:Promise.resolve(W));return XN(Y,J)}refine($,X){let Y=(W)=>{if(typeof X==="string"||typeof X>"u")return{message:X};else if(typeof X==="function")return X(W);else return X};return this._refinement((W,J)=>{let U=$(W),H=()=>J.addIssue({code:K$.custom,...Y(W)});if(typeof Promise<"u"&&U instanceof Promise)return U.then((D)=>{if(!D)return H(),!1;else return!0});if(!U)return H(),!1;else return!0})}refinement($,X){return this._refinement((Y,W)=>{if(!$(Y))return W.addIssue(typeof X==="function"?X(Y,W):X),!1;else return!0})}_refinement($){return new e1({schema:this,typeName:q$.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,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:(X)=>this["~validate"](X)}}optional(){return s1.create(this,this._def)}nullable(){return Y8.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return a1.create(this)}promise(){return K9.create(this,this._def)}or($){return N5.create([this,$],this._def)}and($){return A5.create(this,$,this._def)}transform($){return new e1({...Y6(this._def),schema:this,typeName:q$.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new R5({...Y6(this._def),innerType:this,defaultValue:X,typeName:q$.ZodDefault})}brand(){return new w2({typeName:q$.ZodBranded,type:this,...Y6(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new L5({...Y6(this._def),innerType:this,catchValue:X,typeName:q$.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return L7.create(this,$)}readonly(){return E5.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function WN($){let X="[0-5]\\d";if($.precision)X=`${X}\\.\\d{${$.precision}}`;else if($.precision==null)X=`${X}(\\.\\d+)?`;let Y=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${X})${Y}`}function kp($){return new RegExp(`^${WN($)}$`)}function UN($){let X=`${JN}T${WN($)}`,Y=[];if(Y.push($.local?"Z?":"Z"),$.offset)Y.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Y.join("|")})`,new RegExp(`^${X}$`)}function vp($,X){if((X==="v4"||!X)&&Ip.test($))return!0;if((X==="v6"||!X)&&Tp.test($))return!0;return!1}function hp($,X){if(!Rp.test($))return!1;try{let[Y]=$.split(".");if(!Y)return!1;let W=Y.replace(/-/g,"+").replace(/_/g,"/").padEnd(Y.length+(4-Y.length%4)%4,"="),J=JSON.parse(atob(W));if(typeof J!=="object"||J===null)return!1;if("typ"in J&&J?.typ!=="JWT")return!1;if(!J.alg)return!1;if(X&&J.alg!==X)return!1;return!0}catch{return!1}}function yp($,X){if((X==="v4"||!X)&&_p.test($))return!0;if((X==="v6"||!X)&&Cp.test($))return!0;return!1}function fp($,X){let Y=($.toString().split(".")[1]||"").length,W=(X.toString().split(".")[1]||"").length,J=Y>W?Y:W,U=Number.parseInt($.toFixed(J).replace(".","")),H=Number.parseInt(X.toFixed(J).replace(".",""));return U%H/10**J}function q5($){if($ instanceof r6){let X={};for(let Y in $.shape){let W=$.shape[Y];X[Y]=s1.create(q5(W))}return new r6({...$._def,shape:()=>X})}else if($ instanceof a1)return new a1({...$._def,type:q5($.element)});else if($ instanceof s1)return s1.create(q5($.unwrap()));else if($ instanceof Y8)return Y8.create(q5($.unwrap()));else if($ instanceof L0)return L0.create($.items.map((X)=>q5(X)));else return $}function BH($,X){let Y=j0($),W=j0(X);if($===X)return{valid:!0,data:$};else if(Y===O$.object&&W===O$.object){let J=F6.objectKeys(X),U=F6.objectKeys($).filter((D)=>J.indexOf(D)!==-1),H={...$,...X};for(let D of U){let V=BH($[D],X[D]);if(!V.valid)return{valid:!1};H[D]=V.data}return{valid:!0,data:H}}else if(Y===O$.array&&W===O$.array){if($.length!==X.length)return{valid:!1};let J=[];for(let U=0;U<$.length;U++){let H=$[U],D=X[U],V=BH(H,D);if(!V.valid)return{valid:!1};J.push(V.data)}return{valid:!0,data:J}}else if(Y===O$.date&&W===O$.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}function GN($,X){return new b8({values:$,typeName:q$.ZodEnum,...Y6(X)})}function YN($,X){let Y=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof Y==="string"?{message:Y}:Y}function HN($,X={},Y){if($)return D9.create().superRefine((W,J)=>{let U=$(W);if(U instanceof Promise)return U.then((H)=>{if(!H){let D=YN(X,W),V=D.fatal??Y??!0;J.addIssue({code:"custom",...D,fatal:V})}});if(!U){let H=YN(X,W),D=H.fatal??Y??!0;J.addIssue({code:"custom",...H,fatal:D})}return});return D9.create()}var XN=($,X)=>{if(_8(X))return{success:!0,data:X.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Y=new _4($.common.issues);return this._error=Y,this._error}}}},Np,Ap,Bp,Mp,jp,Rp,Lp,Ep,Pp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",AH,Ip,_p,Tp,Cp,Sp,bp,JN="((\\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])))",xp,o1,C8,S8,Z5,H9,A7,z5,O5,D9,T8,R0,B7,a1,r6,N5,X8=($)=>{if($ instanceof B5)return X8($.schema);else if($ instanceof e1)return X8($.innerType());else if($ instanceof M5)return[$.value];else if($ instanceof b8)return $.options;else if($ instanceof j5)return F6.objectValues($.enum);else if($ instanceof R5)return X8($._def.innerType);else if($ instanceof z5)return[void 0];else if($ instanceof O5)return[null];else if($ instanceof s1)return[void 0,...X8($.unwrap())];else if($ instanceof Y8)return[null,...X8($.unwrap())];else if($ instanceof w2)return X8($.unwrap());else if($ instanceof E5)return X8($.unwrap());else if($ instanceof L5)return X8($._def.innerType);else return[]},q2,A5,L0,M7,j7,V9,w5,B5,M5,b8,j5,K9,e1,s1,Y8,R5,L5,R7,gp,w2,L7,E5,mp,q$,up=($,X={message:`Input not instance of ${$.name}`})=>HN((Y)=>Y instanceof $,X),DN,VN,pp,cp,KN,dp,lp,ip,rp,np,op,ap,sp,tp,ep,$c,Xc,Yc,Jc,Wc,Uc,Gc,Hc,Dc,Vc,Kc,Qc,Fc,qc,wc,Zc,zc,Oc,Nc,Ac=()=>DN().optional(),Bc=()=>VN().optional(),Mc=()=>KN().optional(),jc,Rc;var QN=A(()=>{V2();K2();$N();NH();O7();Np=/^c[^\s-]{8,}$/i,Ap=/^[0-9a-z]+$/,Bp=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Mp=/^[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,jp=/^[a-z0-9_-]{21}$/i,Rp=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Lp=/^[-+]?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)?)??$/,Ep=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ip=/^(?:(?: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])$/,_p=/^(?:(?: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])$/,Tp=/^(([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]))$/,Cp=/^(([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])$/,Sp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bp=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xp=new RegExp(`^${JN}$`);o1=class o1 extends H6{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==O$.string){let J=this._getOrReturnCtx($);return _$(J,{code:K$.invalid_type,expected:O$.string,received:J.parsedType}),c$}let Y=new T4,W=void 0;for(let J of this._def.checks)if(J.kind==="min"){if($.data.length<J.value)W=this._getOrReturnCtx($,W),_$(W,{code:K$.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),Y.dirty()}else if(J.kind==="max"){if($.data.length>J.value)W=this._getOrReturnCtx($,W),_$(W,{code:K$.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),Y.dirty()}else if(J.kind==="length"){let U=$.data.length>J.value,H=$.data.length<J.value;if(U||H){if(W=this._getOrReturnCtx($,W),U)_$(W,{code:K$.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});else if(H)_$(W,{code:K$.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});Y.dirty()}}else if(J.kind==="email"){if(!Ep.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"email",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="emoji"){if(!AH)AH=new RegExp(Pp,"u");if(!AH.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"emoji",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="uuid"){if(!Mp.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"uuid",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="nanoid"){if(!jp.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"nanoid",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="cuid"){if(!Np.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"cuid",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="cuid2"){if(!Ap.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"cuid2",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="ulid"){if(!Bp.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"ulid",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="url")try{new URL($.data)}catch{W=this._getOrReturnCtx($,W),_$(W,{validation:"url",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="regex"){if(J.regex.lastIndex=0,!J.regex.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"regex",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="trim")$.data=$.data.trim();else if(J.kind==="includes"){if(!$.data.includes(J.value,J.position))W=this._getOrReturnCtx($,W),_$(W,{code:K$.invalid_string,validation:{includes:J.value,position:J.position},message:J.message}),Y.dirty()}else if(J.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(J.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(J.kind==="startsWith"){if(!$.data.startsWith(J.value))W=this._getOrReturnCtx($,W),_$(W,{code:K$.invalid_string,validation:{startsWith:J.value},message:J.message}),Y.dirty()}else if(J.kind==="endsWith"){if(!$.data.endsWith(J.value))W=this._getOrReturnCtx($,W),_$(W,{code:K$.invalid_string,validation:{endsWith:J.value},message:J.message}),Y.dirty()}else if(J.kind==="datetime"){if(!UN(J).test($.data))W=this._getOrReturnCtx($,W),_$(W,{code:K$.invalid_string,validation:"datetime",message:J.message}),Y.dirty()}else if(J.kind==="date"){if(!xp.test($.data))W=this._getOrReturnCtx($,W),_$(W,{code:K$.invalid_string,validation:"date",message:J.message}),Y.dirty()}else if(J.kind==="time"){if(!kp(J).test($.data))W=this._getOrReturnCtx($,W),_$(W,{code:K$.invalid_string,validation:"time",message:J.message}),Y.dirty()}else if(J.kind==="duration"){if(!Lp.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"duration",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="ip"){if(!vp($.data,J.version))W=this._getOrReturnCtx($,W),_$(W,{validation:"ip",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="jwt"){if(!hp($.data,J.alg))W=this._getOrReturnCtx($,W),_$(W,{validation:"jwt",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="cidr"){if(!yp($.data,J.version))W=this._getOrReturnCtx($,W),_$(W,{validation:"cidr",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="base64"){if(!Sp.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"base64",code:K$.invalid_string,message:J.message}),Y.dirty()}else if(J.kind==="base64url"){if(!bp.test($.data))W=this._getOrReturnCtx($,W),_$(W,{validation:"base64url",code:K$.invalid_string,message:J.message}),Y.dirty()}else F6.assertNever(J);return{status:Y.value,value:$.data}}_regex($,X,Y){return this.refinement((W)=>$.test(W),{validation:X,code:K$.invalid_string,...x$.errToObj(Y)})}_addCheck($){return new o1({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...x$.errToObj($)})}url($){return this._addCheck({kind:"url",...x$.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...x$.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...x$.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...x$.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...x$.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...x$.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...x$.errToObj($)})}base64($){return this._addCheck({kind:"base64",...x$.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...x$.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...x$.errToObj($)})}ip($){return this._addCheck({kind:"ip",...x$.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...x$.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...x$.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...x$.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...x$.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...x$.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X?.position,...x$.errToObj(X?.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...x$.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...x$.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...x$.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...x$.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...x$.errToObj(X)})}nonempty($){return this.min(1,x$.errToObj($))}trim(){return new o1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new o1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new o1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxLength(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}};o1.create=($)=>{return new o1({checks:[],typeName:q$.ZodString,coerce:$?.coerce??!1,...Y6($)})};C8=class C8 extends H6{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==O$.number){let J=this._getOrReturnCtx($);return _$(J,{code:K$.invalid_type,expected:O$.number,received:J.parsedType}),c$}let Y=void 0,W=new T4;for(let J of this._def.checks)if(J.kind==="int"){if(!F6.isInteger($.data))Y=this._getOrReturnCtx($,Y),_$(Y,{code:K$.invalid_type,expected:"integer",received:"float",message:J.message}),W.dirty()}else if(J.kind==="min"){if(J.inclusive?$.data<J.value:$.data<=J.value)Y=this._getOrReturnCtx($,Y),_$(Y,{code:K$.too_small,minimum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),W.dirty()}else if(J.kind==="max"){if(J.inclusive?$.data>J.value:$.data>=J.value)Y=this._getOrReturnCtx($,Y),_$(Y,{code:K$.too_big,maximum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),W.dirty()}else if(J.kind==="multipleOf"){if(fp($.data,J.value)!==0)Y=this._getOrReturnCtx($,Y),_$(Y,{code:K$.not_multiple_of,multipleOf:J.value,message:J.message}),W.dirty()}else if(J.kind==="finite"){if(!Number.isFinite($.data))Y=this._getOrReturnCtx($,Y),_$(Y,{code:K$.not_finite,message:J.message}),W.dirty()}else F6.assertNever(J);return{status:W.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,x$.toString(X))}gt($,X){return this.setLimit("min",$,!1,x$.toString(X))}lte($,X){return this.setLimit("max",$,!0,x$.toString(X))}lt($,X){return this.setLimit("max",$,!1,x$.toString(X))}setLimit($,X,Y,W){return new C8({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Y,message:x$.toString(W)}]})}_addCheck($){return new C8({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:x$.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x$.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x$.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x$.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x$.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:x$.toString(X)})}finite($){return this._addCheck({kind:"finite",message:x$.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x$.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x$.toString($)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&F6.isInteger($.value))}get isFinite(){let $=null,X=null;for(let Y of this._def.checks)if(Y.kind==="finite"||Y.kind==="int"||Y.kind==="multipleOf")return!0;else if(Y.kind==="min"){if(X===null||Y.value>X)X=Y.value}else if(Y.kind==="max"){if($===null||Y.value<$)$=Y.value}return Number.isFinite(X)&&Number.isFinite($)}};C8.create=($)=>{return new C8({checks:[],typeName:q$.ZodNumber,coerce:$?.coerce||!1,...Y6($)})};S8=class S8 extends H6{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==O$.bigint)return this._getInvalidInput($);let Y=void 0,W=new T4;for(let J of this._def.checks)if(J.kind==="min"){if(J.inclusive?$.data<J.value:$.data<=J.value)Y=this._getOrReturnCtx($,Y),_$(Y,{code:K$.too_small,type:"bigint",minimum:J.value,inclusive:J.inclusive,message:J.message}),W.dirty()}else if(J.kind==="max"){if(J.inclusive?$.data>J.value:$.data>=J.value)Y=this._getOrReturnCtx($,Y),_$(Y,{code:K$.too_big,type:"bigint",maximum:J.value,inclusive:J.inclusive,message:J.message}),W.dirty()}else if(J.kind==="multipleOf"){if($.data%J.value!==BigInt(0))Y=this._getOrReturnCtx($,Y),_$(Y,{code:K$.not_multiple_of,multipleOf:J.value,message:J.message}),W.dirty()}else F6.assertNever(J);return{status:W.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return _$(X,{code:K$.invalid_type,expected:O$.bigint,received:X.parsedType}),c$}gte($,X){return this.setLimit("min",$,!0,x$.toString(X))}gt($,X){return this.setLimit("min",$,!1,x$.toString(X))}lte($,X){return this.setLimit("max",$,!0,x$.toString(X))}lt($,X){return this.setLimit("max",$,!1,x$.toString(X))}setLimit($,X,Y,W){return new S8({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Y,message:x$.toString(W)}]})}_addCheck($){return new S8({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x$.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x$.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x$.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x$.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:x$.toString(X)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}};S8.create=($)=>{return new S8({checks:[],typeName:q$.ZodBigInt,coerce:$?.coerce??!1,...Y6($)})};Z5=class Z5 extends H6{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==O$.boolean){let Y=this._getOrReturnCtx($);return _$(Y,{code:K$.invalid_type,expected:O$.boolean,received:Y.parsedType}),c$}return v4($.data)}};Z5.create=($)=>{return new Z5({typeName:q$.ZodBoolean,coerce:$?.coerce||!1,...Y6($)})};H9=class H9 extends H6{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==O$.date){let J=this._getOrReturnCtx($);return _$(J,{code:K$.invalid_type,expected:O$.date,received:J.parsedType}),c$}if(Number.isNaN($.data.getTime())){let J=this._getOrReturnCtx($);return _$(J,{code:K$.invalid_date}),c$}let Y=new T4,W=void 0;for(let J of this._def.checks)if(J.kind==="min"){if($.data.getTime()<J.value)W=this._getOrReturnCtx($,W),_$(W,{code:K$.too_small,message:J.message,inclusive:!0,exact:!1,minimum:J.value,type:"date"}),Y.dirty()}else if(J.kind==="max"){if($.data.getTime()>J.value)W=this._getOrReturnCtx($,W),_$(W,{code:K$.too_big,message:J.message,inclusive:!0,exact:!1,maximum:J.value,type:"date"}),Y.dirty()}else F6.assertNever(J);return{status:Y.value,value:new Date($.data.getTime())}}_addCheck($){return new H9({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:x$.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:x$.toString(X)})}get minDate(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $!=null?new Date($):null}};H9.create=($)=>{return new H9({checks:[],coerce:$?.coerce||!1,typeName:q$.ZodDate,...Y6($)})};A7=class A7 extends H6{_parse($){if(this._getType($)!==O$.symbol){let Y=this._getOrReturnCtx($);return _$(Y,{code:K$.invalid_type,expected:O$.symbol,received:Y.parsedType}),c$}return v4($.data)}};A7.create=($)=>{return new A7({typeName:q$.ZodSymbol,...Y6($)})};z5=class z5 extends H6{_parse($){if(this._getType($)!==O$.undefined){let Y=this._getOrReturnCtx($);return _$(Y,{code:K$.invalid_type,expected:O$.undefined,received:Y.parsedType}),c$}return v4($.data)}};z5.create=($)=>{return new z5({typeName:q$.ZodUndefined,...Y6($)})};O5=class O5 extends H6{_parse($){if(this._getType($)!==O$.null){let Y=this._getOrReturnCtx($);return _$(Y,{code:K$.invalid_type,expected:O$.null,received:Y.parsedType}),c$}return v4($.data)}};O5.create=($)=>{return new O5({typeName:q$.ZodNull,...Y6($)})};D9=class D9 extends H6{constructor(){super(...arguments);this._any=!0}_parse($){return v4($.data)}};D9.create=($)=>{return new D9({typeName:q$.ZodAny,...Y6($)})};T8=class T8 extends H6{constructor(){super(...arguments);this._unknown=!0}_parse($){return v4($.data)}};T8.create=($)=>{return new T8({typeName:q$.ZodUnknown,...Y6($)})};R0=class R0 extends H6{_parse($){let X=this._getOrReturnCtx($);return _$(X,{code:K$.invalid_type,expected:O$.never,received:X.parsedType}),c$}};R0.create=($)=>{return new R0({typeName:q$.ZodNever,...Y6($)})};B7=class B7 extends H6{_parse($){if(this._getType($)!==O$.undefined){let Y=this._getOrReturnCtx($);return _$(Y,{code:K$.invalid_type,expected:O$.void,received:Y.parsedType}),c$}return v4($.data)}};B7.create=($)=>{return new B7({typeName:q$.ZodVoid,...Y6($)})};a1=class a1 extends H6{_parse($){let{ctx:X,status:Y}=this._processInputParams($),W=this._def;if(X.parsedType!==O$.array)return _$(X,{code:K$.invalid_type,expected:O$.array,received:X.parsedType}),c$;if(W.exactLength!==null){let U=X.data.length>W.exactLength.value,H=X.data.length<W.exactLength.value;if(U||H)_$(X,{code:U?K$.too_big:K$.too_small,minimum:H?W.exactLength.value:void 0,maximum:U?W.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:W.exactLength.message}),Y.dirty()}if(W.minLength!==null){if(X.data.length<W.minLength.value)_$(X,{code:K$.too_small,minimum:W.minLength.value,type:"array",inclusive:!0,exact:!1,message:W.minLength.message}),Y.dirty()}if(W.maxLength!==null){if(X.data.length>W.maxLength.value)_$(X,{code:K$.too_big,maximum:W.maxLength.value,type:"array",inclusive:!0,exact:!1,message:W.maxLength.message}),Y.dirty()}if(X.common.async)return Promise.all([...X.data].map((U,H)=>{return W.type._parseAsync(new t1(X,U,X.path,H))})).then((U)=>{return T4.mergeArray(Y,U)});let J=[...X.data].map((U,H)=>{return W.type._parseSync(new t1(X,U,X.path,H))});return T4.mergeArray(Y,J)}get element(){return this._def.type}min($,X){return new a1({...this._def,minLength:{value:$,message:x$.toString(X)}})}max($,X){return new a1({...this._def,maxLength:{value:$,message:x$.toString(X)}})}length($,X){return new a1({...this._def,exactLength:{value:$,message:x$.toString(X)}})}nonempty($){return this.min(1,$)}};a1.create=($,X)=>{return new a1({type:$,minLength:null,maxLength:null,exactLength:null,typeName:q$.ZodArray,...Y6(X)})};r6=class r6 extends H6{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),X=F6.objectKeys($);return this._cached={shape:$,keys:X},this._cached}_parse($){if(this._getType($)!==O$.object){let V=this._getOrReturnCtx($);return _$(V,{code:K$.invalid_type,expected:O$.object,received:V.parsedType}),c$}let{status:Y,ctx:W}=this._processInputParams($),{shape:J,keys:U}=this._getCached(),H=[];if(!(this._def.catchall instanceof R0&&this._def.unknownKeys==="strip")){for(let V in W.data)if(!U.includes(V))H.push(V)}let D=[];for(let V of U){let K=J[V],Q=W.data[V];D.push({key:{status:"valid",value:V},value:K._parse(new t1(W,Q,W.path,V)),alwaysSet:V in W.data})}if(this._def.catchall instanceof R0){let V=this._def.unknownKeys;if(V==="passthrough")for(let K of H)D.push({key:{status:"valid",value:K},value:{status:"valid",value:W.data[K]}});else if(V==="strict"){if(H.length>0)_$(W,{code:K$.unrecognized_keys,keys:H}),Y.dirty()}else if(V==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let V=this._def.catchall;for(let K of H){let Q=W.data[K];D.push({key:{status:"valid",value:K},value:V._parse(new t1(W,Q,W.path,K)),alwaysSet:K in W.data})}}if(W.common.async)return Promise.resolve().then(async()=>{let V=[];for(let K of D){let Q=await K.key,q=await K.value;V.push({key:Q,value:q,alwaysSet:K.alwaysSet})}return V}).then((V)=>{return T4.mergeObjectSync(Y,V)});else return T4.mergeObjectSync(Y,D)}get shape(){return this._def.shape()}strict($){return x$.errToObj,new r6({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,Y)=>{let W=this._def.errorMap?.(X,Y).message??Y.defaultError;if(X.code==="unrecognized_keys")return{message:x$.errToObj($).message??W};return{message:W}}}:{}})}strip(){return new r6({...this._def,unknownKeys:"strip"})}passthrough(){return new r6({...this._def,unknownKeys:"passthrough"})}extend($){return new r6({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new r6({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:q$.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new r6({...this._def,catchall:$})}pick($){let X={};for(let Y of F6.objectKeys($))if($[Y]&&this.shape[Y])X[Y]=this.shape[Y];return new r6({...this._def,shape:()=>X})}omit($){let X={};for(let Y of F6.objectKeys(this.shape))if(!$[Y])X[Y]=this.shape[Y];return new r6({...this._def,shape:()=>X})}deepPartial(){return q5(this)}partial($){let X={};for(let Y of F6.objectKeys(this.shape)){let W=this.shape[Y];if($&&!$[Y])X[Y]=W;else X[Y]=W.optional()}return new r6({...this._def,shape:()=>X})}required($){let X={};for(let Y of F6.objectKeys(this.shape))if($&&!$[Y])X[Y]=this.shape[Y];else{let J=this.shape[Y];while(J instanceof s1)J=J._def.innerType;X[Y]=J}return new r6({...this._def,shape:()=>X})}keyof(){return GN(F6.objectKeys(this.shape))}};r6.create=($,X)=>{return new r6({shape:()=>$,unknownKeys:"strip",catchall:R0.create(),typeName:q$.ZodObject,...Y6(X)})};r6.strictCreate=($,X)=>{return new r6({shape:()=>$,unknownKeys:"strict",catchall:R0.create(),typeName:q$.ZodObject,...Y6(X)})};r6.lazycreate=($,X)=>{return new r6({shape:$,unknownKeys:"strip",catchall:R0.create(),typeName:q$.ZodObject,...Y6(X)})};N5=class N5 extends H6{_parse($){let{ctx:X}=this._processInputParams($),Y=this._def.options;function W(J){for(let H of J)if(H.result.status==="valid")return H.result;for(let H of J)if(H.result.status==="dirty")return X.common.issues.push(...H.ctx.common.issues),H.result;let U=J.map((H)=>new _4(H.ctx.common.issues));return _$(X,{code:K$.invalid_union,unionErrors:U}),c$}if(X.common.async)return Promise.all(Y.map(async(J)=>{let U={...X,common:{...X.common,issues:[]},parent:null};return{result:await J._parseAsync({data:X.data,path:X.path,parent:U}),ctx:U}})).then(W);else{let J=void 0,U=[];for(let D of Y){let V={...X,common:{...X.common,issues:[]},parent:null},K=D._parseSync({data:X.data,path:X.path,parent:V});if(K.status==="valid")return K;else if(K.status==="dirty"&&!J)J={result:K,ctx:V};if(V.common.issues.length)U.push(V.common.issues)}if(J)return X.common.issues.push(...J.ctx.common.issues),J.result;let H=U.map((D)=>new _4(D));return _$(X,{code:K$.invalid_union,unionErrors:H}),c$}}get options(){return this._def.options}};N5.create=($,X)=>{return new N5({options:$,typeName:q$.ZodUnion,...Y6(X)})};q2=class q2 extends H6{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==O$.object)return _$(X,{code:K$.invalid_type,expected:O$.object,received:X.parsedType}),c$;let Y=this.discriminator,W=X.data[Y],J=this.optionsMap.get(W);if(!J)return _$(X,{code:K$.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),c$;if(X.common.async)return J._parseAsync({data:X.data,path:X.path,parent:X});else return J._parseSync({data:X.data,path:X.path,parent:X})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,X,Y){let W=new Map;for(let J of X){let U=X8(J.shape[$]);if(!U.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let H of U){if(W.has(H))throw Error(`Discriminator property ${String($)} has duplicate value ${String(H)}`);W.set(H,J)}}return new q2({typeName:q$.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:W,...Y6(Y)})}};A5=class A5 extends H6{_parse($){let{status:X,ctx:Y}=this._processInputParams($),W=(J,U)=>{if(Q2(J)||Q2(U))return c$;let H=BH(J.value,U.value);if(!H.valid)return _$(Y,{code:K$.invalid_intersection_types}),c$;if(F2(J)||F2(U))X.dirty();return{status:X.value,value:H.data}};if(Y.common.async)return Promise.all([this._def.left._parseAsync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseAsync({data:Y.data,path:Y.path,parent:Y})]).then(([J,U])=>W(J,U));else return W(this._def.left._parseSync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseSync({data:Y.data,path:Y.path,parent:Y}))}};A5.create=($,X,Y)=>{return new A5({left:$,right:X,typeName:q$.ZodIntersection,...Y6(Y)})};L0=class L0 extends H6{_parse($){let{status:X,ctx:Y}=this._processInputParams($);if(Y.parsedType!==O$.array)return _$(Y,{code:K$.invalid_type,expected:O$.array,received:Y.parsedType}),c$;if(Y.data.length<this._def.items.length)return _$(Y,{code:K$.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c$;if(!this._def.rest&&Y.data.length>this._def.items.length)_$(Y,{code:K$.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let J=[...Y.data].map((U,H)=>{let D=this._def.items[H]||this._def.rest;if(!D)return null;return D._parse(new t1(Y,U,Y.path,H))}).filter((U)=>!!U);if(Y.common.async)return Promise.all(J).then((U)=>{return T4.mergeArray(X,U)});else return T4.mergeArray(X,J)}get items(){return this._def.items}rest($){return new L0({...this._def,rest:$})}};L0.create=($,X)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new L0({items:$,typeName:q$.ZodTuple,rest:null,...Y6(X)})};M7=class M7 extends H6{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Y}=this._processInputParams($);if(Y.parsedType!==O$.object)return _$(Y,{code:K$.invalid_type,expected:O$.object,received:Y.parsedType}),c$;let W=[],J=this._def.keyType,U=this._def.valueType;for(let H in Y.data)W.push({key:J._parse(new t1(Y,H,Y.path,H)),value:U._parse(new t1(Y,Y.data[H],Y.path,H)),alwaysSet:H in Y.data});if(Y.common.async)return T4.mergeObjectAsync(X,W);else return T4.mergeObjectSync(X,W)}get element(){return this._def.valueType}static create($,X,Y){if(X instanceof H6)return new M7({keyType:$,valueType:X,typeName:q$.ZodRecord,...Y6(Y)});return new M7({keyType:o1.create(),valueType:$,typeName:q$.ZodRecord,...Y6(X)})}};j7=class j7 extends H6{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Y}=this._processInputParams($);if(Y.parsedType!==O$.map)return _$(Y,{code:K$.invalid_type,expected:O$.map,received:Y.parsedType}),c$;let W=this._def.keyType,J=this._def.valueType,U=[...Y.data.entries()].map(([H,D],V)=>{return{key:W._parse(new t1(Y,H,Y.path,[V,"key"])),value:J._parse(new t1(Y,D,Y.path,[V,"value"]))}});if(Y.common.async){let H=new Map;return Promise.resolve().then(async()=>{for(let D of U){let V=await D.key,K=await D.value;if(V.status==="aborted"||K.status==="aborted")return c$;if(V.status==="dirty"||K.status==="dirty")X.dirty();H.set(V.value,K.value)}return{status:X.value,value:H}})}else{let H=new Map;for(let D of U){let{key:V,value:K}=D;if(V.status==="aborted"||K.status==="aborted")return c$;if(V.status==="dirty"||K.status==="dirty")X.dirty();H.set(V.value,K.value)}return{status:X.value,value:H}}}};j7.create=($,X,Y)=>{return new j7({valueType:X,keyType:$,typeName:q$.ZodMap,...Y6(Y)})};V9=class V9 extends H6{_parse($){let{status:X,ctx:Y}=this._processInputParams($);if(Y.parsedType!==O$.set)return _$(Y,{code:K$.invalid_type,expected:O$.set,received:Y.parsedType}),c$;let W=this._def;if(W.minSize!==null){if(Y.data.size<W.minSize.value)_$(Y,{code:K$.too_small,minimum:W.minSize.value,type:"set",inclusive:!0,exact:!1,message:W.minSize.message}),X.dirty()}if(W.maxSize!==null){if(Y.data.size>W.maxSize.value)_$(Y,{code:K$.too_big,maximum:W.maxSize.value,type:"set",inclusive:!0,exact:!1,message:W.maxSize.message}),X.dirty()}let J=this._def.valueType;function U(D){let V=new Set;for(let K of D){if(K.status==="aborted")return c$;if(K.status==="dirty")X.dirty();V.add(K.value)}return{status:X.value,value:V}}let H=[...Y.data.values()].map((D,V)=>J._parse(new t1(Y,D,Y.path,V)));if(Y.common.async)return Promise.all(H).then((D)=>U(D));else return U(H)}min($,X){return new V9({...this._def,minSize:{value:$,message:x$.toString(X)}})}max($,X){return new V9({...this._def,maxSize:{value:$,message:x$.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}};V9.create=($,X)=>{return new V9({valueType:$,minSize:null,maxSize:null,typeName:q$.ZodSet,...Y6(X)})};w5=class w5 extends H6{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==O$.function)return _$(X,{code:K$.invalid_type,expected:O$.function,received:X.parsedType}),c$;function Y(H,D){return N7({data:H,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,Q5(),$8].filter((V)=>!!V),issueData:{code:K$.invalid_arguments,argumentsError:D}})}function W(H,D){return N7({data:H,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,Q5(),$8].filter((V)=>!!V),issueData:{code:K$.invalid_return_type,returnTypeError:D}})}let J={errorMap:X.common.contextualErrorMap},U=X.data;if(this._def.returns instanceof K9){let H=this;return v4(async function(...D){let V=new _4([]),K=await H._def.args.parseAsync(D,J).catch((F)=>{throw V.addIssue(Y(D,F)),V}),Q=await Reflect.apply(U,this,K);return await H._def.returns._def.type.parseAsync(Q,J).catch((F)=>{throw V.addIssue(W(Q,F)),V})})}else{let H=this;return v4(function(...D){let V=H._def.args.safeParse(D,J);if(!V.success)throw new _4([Y(D,V.error)]);let K=Reflect.apply(U,this,V.data),Q=H._def.returns.safeParse(K,J);if(!Q.success)throw new _4([W(K,Q.error)]);return Q.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new w5({...this._def,args:L0.create($).rest(T8.create())})}returns($){return new w5({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,Y){return new w5({args:$?$:L0.create([]).rest(T8.create()),returns:X||T8.create(),typeName:q$.ZodFunction,...Y6(Y)})}};B5=class B5 extends H6{get schema(){return this._def.getter()}_parse($){let{ctx:X}=this._processInputParams($);return this._def.getter()._parse({data:X.data,path:X.path,parent:X})}};B5.create=($,X)=>{return new B5({getter:$,typeName:q$.ZodLazy,...Y6(X)})};M5=class M5 extends H6{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return _$(X,{received:X.data,code:K$.invalid_literal,expected:this._def.value}),c$}return{status:"valid",value:$.data}}get value(){return this._def.value}};M5.create=($,X)=>{return new M5({value:$,typeName:q$.ZodLiteral,...Y6(X)})};b8=class b8 extends H6{_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),Y=this._def.values;return _$(X,{expected:F6.joinValues(Y),received:X.parsedType,code:K$.invalid_type}),c$}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let X=this._getOrReturnCtx($),Y=this._def.values;return _$(X,{received:X.data,code:K$.invalid_enum_value,options:Y}),c$}return v4($.data)}get options(){return this._def.values}get enum(){let $={};for(let X of this._def.values)$[X]=X;return $}get Values(){let $={};for(let X of this._def.values)$[X]=X;return $}get Enum(){let $={};for(let X of this._def.values)$[X]=X;return $}extract($,X=this._def){return b8.create($,{...this._def,...X})}exclude($,X=this._def){return b8.create(this.options.filter((Y)=>!$.includes(Y)),{...this._def,...X})}};b8.create=GN;j5=class j5 extends H6{_parse($){let X=F6.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx($);if(Y.parsedType!==O$.string&&Y.parsedType!==O$.number){let W=F6.objectValues(X);return _$(Y,{expected:F6.joinValues(W),received:Y.parsedType,code:K$.invalid_type}),c$}if(!this._cache)this._cache=new Set(F6.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let W=F6.objectValues(X);return _$(Y,{received:Y.data,code:K$.invalid_enum_value,options:W}),c$}return v4($.data)}get enum(){return this._def.values}};j5.create=($,X)=>{return new j5({values:$,typeName:q$.ZodNativeEnum,...Y6(X)})};K9=class K9 extends H6{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==O$.promise&&X.common.async===!1)return _$(X,{code:K$.invalid_type,expected:O$.promise,received:X.parsedType}),c$;let Y=X.parsedType===O$.promise?X.data:Promise.resolve(X.data);return v4(Y.then((W)=>{return this._def.type.parseAsync(W,{path:X.path,errorMap:X.common.contextualErrorMap})}))}};K9.create=($,X)=>{return new K9({type:$,typeName:q$.ZodPromise,...Y6(X)})};e1=class e1 extends H6{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:Y}=this._processInputParams($),W=this._def.effect||null,J={addIssue:(U)=>{if(_$(Y,U),U.fatal)X.abort();else X.dirty()},get path(){return Y.path}};if(J.addIssue=J.addIssue.bind(J),W.type==="preprocess"){let U=W.transform(Y.data,J);if(Y.common.async)return Promise.resolve(U).then(async(H)=>{if(X.value==="aborted")return c$;let D=await this._def.schema._parseAsync({data:H,path:Y.path,parent:Y});if(D.status==="aborted")return c$;if(D.status==="dirty")return G9(D.value);if(X.value==="dirty")return G9(D.value);return D});else{if(X.value==="aborted")return c$;let H=this._def.schema._parseSync({data:U,path:Y.path,parent:Y});if(H.status==="aborted")return c$;if(H.status==="dirty")return G9(H.value);if(X.value==="dirty")return G9(H.value);return H}}if(W.type==="refinement"){let U=(H)=>{let D=W.refinement(H,J);if(Y.common.async)return Promise.resolve(D);if(D instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return H};if(Y.common.async===!1){let H=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(H.status==="aborted")return c$;if(H.status==="dirty")X.dirty();return U(H.value),{status:X.value,value:H.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((H)=>{if(H.status==="aborted")return c$;if(H.status==="dirty")X.dirty();return U(H.value).then(()=>{return{status:X.value,value:H.value}})})}if(W.type==="transform")if(Y.common.async===!1){let U=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!_8(U))return c$;let H=W.transform(U.value,J);if(H instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:H}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((U)=>{if(!_8(U))return c$;return Promise.resolve(W.transform(U.value,J)).then((H)=>({status:X.value,value:H}))});F6.assertNever(W)}};e1.create=($,X,Y)=>{return new e1({schema:$,typeName:q$.ZodEffects,effect:X,...Y6(Y)})};e1.createWithPreprocess=($,X,Y)=>{return new e1({schema:X,effect:{type:"preprocess",transform:$},typeName:q$.ZodEffects,...Y6(Y)})};s1=class s1 extends H6{_parse($){if(this._getType($)===O$.undefined)return v4(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};s1.create=($,X)=>{return new s1({innerType:$,typeName:q$.ZodOptional,...Y6(X)})};Y8=class Y8 extends H6{_parse($){if(this._getType($)===O$.null)return v4(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};Y8.create=($,X)=>{return new Y8({innerType:$,typeName:q$.ZodNullable,...Y6(X)})};R5=class R5 extends H6{_parse($){let{ctx:X}=this._processInputParams($),Y=X.data;if(X.parsedType===O$.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:X.path,parent:X})}removeDefault(){return this._def.innerType}};R5.create=($,X)=>{return new R5({innerType:$,typeName:q$.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...Y6(X)})};L5=class L5 extends H6{_parse($){let{ctx:X}=this._processInputParams($),Y={...X,common:{...X.common,issues:[]}},W=this._def.innerType._parse({data:Y.data,path:Y.path,parent:{...Y}});if(F5(W))return W.then((J)=>{return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new _4(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new _4(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};L5.create=($,X)=>{return new L5({innerType:$,typeName:q$.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...Y6(X)})};R7=class R7 extends H6{_parse($){if(this._getType($)!==O$.nan){let Y=this._getOrReturnCtx($);return _$(Y,{code:K$.invalid_type,expected:O$.nan,received:Y.parsedType}),c$}return{status:"valid",value:$.data}}};R7.create=($)=>{return new R7({typeName:q$.ZodNaN,...Y6($)})};gp=Symbol("zod_brand");w2=class w2 extends H6{_parse($){let{ctx:X}=this._processInputParams($),Y=X.data;return this._def.type._parse({data:Y,path:X.path,parent:X})}unwrap(){return this._def.type}};L7=class L7 extends H6{_parse($){let{status:X,ctx:Y}=this._processInputParams($);if(Y.common.async)return(async()=>{let J=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if(J.status==="aborted")return c$;if(J.status==="dirty")return X.dirty(),G9(J.value);else return this._def.out._parseAsync({data:J.value,path:Y.path,parent:Y})})();else{let W=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(W.status==="aborted")return c$;if(W.status==="dirty")return X.dirty(),{status:"dirty",value:W.value};else return this._def.out._parseSync({data:W.value,path:Y.path,parent:Y})}}static create($,X){return new L7({in:$,out:X,typeName:q$.ZodPipeline})}};E5=class E5 extends H6{_parse($){let X=this._def.innerType._parse($),Y=(W)=>{if(_8(W))W.value=Object.freeze(W.value);return W};return F5(X)?X.then((W)=>Y(W)):Y(X)}unwrap(){return this._def.innerType}};E5.create=($,X)=>{return new E5({innerType:$,typeName:q$.ZodReadonly,...Y6(X)})};mp={object:r6.lazycreate};(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(q$||(q$={}));DN=o1.create,VN=C8.create,pp=R7.create,cp=S8.create,KN=Z5.create,dp=H9.create,lp=A7.create,ip=z5.create,rp=O5.create,np=D9.create,op=T8.create,ap=R0.create,sp=B7.create,tp=a1.create,ep=r6.create,$c=r6.strictCreate,Xc=N5.create,Yc=q2.create,Jc=A5.create,Wc=L0.create,Uc=M7.create,Gc=j7.create,Hc=V9.create,Dc=w5.create,Vc=B5.create,Kc=M5.create,Qc=b8.create,Fc=j5.create,qc=K9.create,wc=e1.create,Zc=s1.create,zc=Y8.create,Oc=e1.createWithPreprocess,Nc=L7.create,jc={string:($)=>o1.create({...$,coerce:!0}),number:($)=>C8.create({...$,coerce:!0}),boolean:($)=>Z5.create({...$,coerce:!0}),bigint:($)=>S8.create({...$,coerce:!0}),date:($)=>H9.create({...$,coerce:!0})},Rc=c$});var Z={};e0(Z,{void:()=>sp,util:()=>F6,unknown:()=>op,union:()=>Xc,undefined:()=>ip,tuple:()=>Wc,transformer:()=>wc,symbol:()=>lp,string:()=>DN,strictObject:()=>$c,setErrorMap:()=>zp,set:()=>Hc,record:()=>Uc,quotelessJson:()=>wp,promise:()=>qc,preprocess:()=>Oc,pipeline:()=>Nc,ostring:()=>Ac,optional:()=>Zc,onumber:()=>Bc,oboolean:()=>Mc,objectUtil:()=>zH,object:()=>ep,number:()=>VN,nullable:()=>zc,null:()=>rp,never:()=>ap,nativeEnum:()=>Fc,nan:()=>pp,map:()=>Gc,makeIssue:()=>N7,literal:()=>Kc,lazy:()=>Vc,late:()=>mp,isValid:()=>_8,isDirty:()=>F2,isAsync:()=>F5,isAborted:()=>Q2,intersection:()=>Jc,instanceof:()=>up,getParsedType:()=>j0,getErrorMap:()=>Q5,function:()=>Dc,enum:()=>Qc,effect:()=>wc,discriminatedUnion:()=>Yc,defaultErrorMap:()=>$8,datetimeRegex:()=>UN,date:()=>dp,custom:()=>HN,coerce:()=>jc,boolean:()=>KN,bigint:()=>cp,array:()=>tp,any:()=>np,addIssueToContext:()=>_$,ZodVoid:()=>B7,ZodUnknown:()=>T8,ZodUnion:()=>N5,ZodUndefined:()=>z5,ZodType:()=>H6,ZodTuple:()=>L0,ZodTransformer:()=>e1,ZodSymbol:()=>A7,ZodString:()=>o1,ZodSet:()=>V9,ZodSchema:()=>H6,ZodRecord:()=>M7,ZodReadonly:()=>E5,ZodPromise:()=>K9,ZodPipeline:()=>L7,ZodParsedType:()=>O$,ZodOptional:()=>s1,ZodObject:()=>r6,ZodNumber:()=>C8,ZodNullable:()=>Y8,ZodNull:()=>O5,ZodNever:()=>R0,ZodNativeEnum:()=>j5,ZodNaN:()=>R7,ZodMap:()=>j7,ZodLiteral:()=>M5,ZodLazy:()=>B5,ZodIssueCode:()=>K$,ZodIntersection:()=>A5,ZodFunction:()=>w5,ZodFirstPartyTypeKind:()=>q$,ZodError:()=>_4,ZodEnum:()=>b8,ZodEffects:()=>e1,ZodDiscriminatedUnion:()=>q2,ZodDefault:()=>R5,ZodDate:()=>H9,ZodCatch:()=>L5,ZodBranded:()=>w2,ZodBoolean:()=>Z5,ZodBigInt:()=>S8,ZodArray:()=>a1,ZodAny:()=>D9,Schema:()=>H6,ParseStatus:()=>T4,OK:()=>v4,NEVER:()=>Rc,INVALID:()=>c$,EMPTY_PATH:()=>Op,DIRTY:()=>G9,BRAND:()=>gp});var Z2=A(()=>{K2();NH();eO();O7();QN();V2()});var P5=A(()=>{Z2();Z2()});var I5;var FN=A(()=>{P5();I5=Z.object({url:Z.string(),authToken:Z.string().optional()})});import{openSync as Lc,writeSync as Ec}from"fs";class Z6{static instance=null;level;context;useStderr;format;logFile;fileHandle;constructor($={},X){if(this.level=$.level??3,this.context=$.context??void 0,this.useStderr=$.useStderr??!1,this.format=$.format??"text",this.logFile=$.logFile,X!==void 0)this.fileHandle=X;else if(this.logFile)try{this.fileHandle=Lc(this.logFile,"a")}catch{}}static getInstance($){if(!Z6.instance)Z6.instance=new Z6($);else if($?.useStderr!==void 0)Z6.instance.useStderr=$.useStderr;return Z6.instance}static resetInstance(){Z6.instance=null}static createFresh($){return new Z6($)}formatEntry($,X,Y){let W=new Date().toISOString();if(this.format==="json"){let J={ts:W,level:$,msg:X};if(this.context)J.ctx=this.context;if(Y.length>0)J.data=Y;return JSON.stringify(J)}return this.context?`[${W}] [${this.context}] ${X}`:`[${W}] ${X}`}write($,X,Y,W){if(this.format==="json")$(this.formatEntry(X,Y,W));else if(W.length>0)$(this.formatEntry(X,Y,[]),...W);else $(this.formatEntry(X,Y,[]));if(this.fileHandle!==void 0){let J=this.formatJsonEntry(X,Y,W);try{Ec(this.fileHandle,J+`
3
- `)}catch{}}}formatJsonEntry($,X,Y){let W={ts:new Date().toISOString(),level:$,msg:X};if(this.context)W.ctx=this.context;if(Y.length>0)W.data=Y;return JSON.stringify(W)}silly($,...X){if(this.level<=0)this.write(console.debug.bind(console),"silly",$,X)}verbose($,...X){if(this.level<=1)this.write(console.debug.bind(console),"verbose",$,X)}debug($,...X){if(this.level<=2)this.write(console.debug.bind(console),"debug",$,X)}info($,...X){if(this.level<=3){let Y=this.useStderr?console.error.bind(console):console.info.bind(console);this.write(Y,"info",$,X)}}warn($,...X){if(this.level<=4)this.write(console.warn.bind(console),"warn",$,X)}error($,...X){if(this.level<=5)this.write(console.error.bind(console),"error",$,X)}child($){return new Z6({level:this.level,context:$,useStderr:this.useStderr,format:this.format},this.fileHandle)}setUseStderr($){this.useStderr=$}}var Pc;var MH=A(()=>{Pc=Z6.getInstance()});var E7=X$((rQ$,wN)=>{var Ic=Object.prototype.toString;wN.exports=function(X){if(X===void 0)return"undefined";if(X===null)return"null";var Y=typeof X;if(Y==="boolean")return"boolean";if(Y==="string")return"string";if(Y==="number")return"number";if(Y==="symbol")return"symbol";if(Y==="function")return bc(X)?"generatorfunction":"function";if(_c(X))return"array";if(vc(X))return"buffer";if(kc(X))return"arguments";if(Cc(X))return"date";if(Tc(X))return"error";if(Sc(X))return"regexp";switch(qN(X)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(xc(X))return"generator";switch(Y=Ic.call(X),Y){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return Y.slice(8,-1).toLowerCase().replace(/\s/g,"")};function qN($){return typeof $.constructor==="function"?$.constructor.name:null}function _c($){if(Array.isArray)return Array.isArray($);return $ instanceof Array}function Tc($){return $ instanceof Error||typeof $.message==="string"&&$.constructor&&typeof $.constructor.stackTraceLimit==="number"}function Cc($){if($ instanceof Date)return!0;return typeof $.toDateString==="function"&&typeof $.getDate==="function"&&typeof $.setDate==="function"}function Sc($){if($ instanceof RegExp)return!0;return typeof $.flags==="string"&&typeof $.ignoreCase==="boolean"&&typeof $.multiline==="boolean"&&typeof $.global==="boolean"}function bc($,X){return qN($)==="GeneratorFunction"}function xc($){return typeof $.throw==="function"&&typeof $.return==="function"&&typeof $.next==="function"}function kc($){try{if(typeof $.length==="number"&&typeof $.callee==="function")return!0}catch(X){if(X.message.indexOf("callee")!==-1)return!0}return!1}function vc($){if($.constructor&&typeof $.constructor.isBuffer==="function")return $.constructor.isBuffer($);return!1}});var zN=X$((nQ$,ZN)=>{/*!
4
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
5
- *
6
- * Copyright (c) 2015, Jon Schlinkert.
7
- * Licensed under the MIT License.
8
- */ZN.exports=function(X){return typeof X<"u"&&X!==null&&(typeof X==="object"||typeof X==="function")}});var AN=X$((oQ$,NN)=>{var ON=zN();NN.exports=function(X){if(!ON(X))X={};var Y=arguments.length;for(var W=1;W<Y;W++){var J=arguments[W];if(ON(J))hc(X,J)}return X};function hc($,X){for(var Y in X)if(yc(X,Y))$[Y]=X[Y]}function yc($,X){return Object.prototype.hasOwnProperty.call($,X)}});var jN=X$((aQ$,MN)=>{var fc=E7(),gc=AN();MN.exports=function($,X){if(typeof X==="function")X={parse:X};var Y=uc($),W={section_delimiter:"---",parse:cc},J=gc({},W,X),U=J.section_delimiter,H=Y.content.split(/\r?\n/),D=null,V=BN(),K=[],Q=[];function q(L){Y.content=L,D=[],K=[]}function F(L){if(Q.length)V.key=pc(Q[0],U),V.content=L,J.parse(V,D),D.push(V),V=BN(),K=[],Q=[]}for(var w=0;w<H.length;w++){var z=H[w],O=Q.length,N=z.trim();if(mc(N,U)){if(N.length===3&&w!==0){if(O===0||O===2){K.push(z);continue}Q.push(N),V.data=K.join(`
9
- `),K=[];continue}if(D===null)q(K.join(`
10
- `));if(O===2)F(K.join(`
11
- `));Q.push(N);continue}K.push(z)}if(D===null)q(K.join(`
12
- `));else F(K.join(`
13
- `));return Y.sections=D,Y};function mc($,X){if($.slice(0,X.length)!==X)return!1;if($.charAt(X.length+1)===X.slice(-1))return!1;return!0}function uc($){if(fc($)!=="object")$={content:$};if(typeof $.content!=="string"&&!dc($.content))throw TypeError("expected a buffer or string");return $.content=$.content.toString(),$.sections=[],$}function pc($,X){return $?$.slice(X.length).trim():""}function BN(){return{key:"",data:"",content:""}}function cc($){return $}function dc($){if($&&$.constructor&&typeof $.constructor.isBuffer==="function")return $.constructor.isBuffer($);return!1}});var F9=X$((ac,Q9)=>{function RN($){return typeof $>"u"||$===null}function lc($){return typeof $==="object"&&$!==null}function ic($){if(Array.isArray($))return $;else if(RN($))return[];return[$]}function rc($,X){var Y,W,J,U;if(X){U=Object.keys(X);for(Y=0,W=U.length;Y<W;Y+=1)J=U[Y],$[J]=X[J]}return $}function nc($,X){var Y="",W;for(W=0;W<X;W+=1)Y+=$;return Y}function oc($){return $===0&&Number.NEGATIVE_INFINITY===1/$}ac.isNothing=RN;ac.isObject=lc;ac.toArray=ic;ac.repeat=nc;ac.isNegativeZero=oc;ac.extend=rc});var _5=X$((sQ$,LN)=>{function P7($,X){if(Error.call(this),this.name="YAMLException",this.reason=$,this.mark=X,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else this.stack=Error().stack||""}P7.prototype=Object.create(Error.prototype);P7.prototype.constructor=P7;P7.prototype.toString=function(X){var Y=this.name+": ";if(Y+=this.reason||"(unknown reason)",!X&&this.mark)Y+=" "+this.mark.toString();return Y};LN.exports=P7});var IN=X$((tQ$,PN)=>{var EN=F9();function jH($,X,Y,W,J){this.name=$,this.buffer=X,this.position=Y,this.line=W,this.column=J}jH.prototype.getSnippet=function(X,Y){var W,J,U,H,D;if(!this.buffer)return null;X=X||4,Y=Y||75,W="",J=this.position;while(J>0&&`\x00\r
14
- \x85\u2028\u2029`.indexOf(this.buffer.charAt(J-1))===-1)if(J-=1,this.position-J>Y/2-1){W=" ... ",J+=5;break}U="",H=this.position;while(H<this.buffer.length&&`\x00\r
15
- \x85\u2028\u2029`.indexOf(this.buffer.charAt(H))===-1)if(H+=1,H-this.position>Y/2-1){U=" ... ",H-=5;break}return D=this.buffer.slice(J,H),EN.repeat(" ",X)+W+D+U+`
16
- `+EN.repeat(" ",X+this.position-J+W.length)+"^"};jH.prototype.toString=function(X){var Y,W="";if(this.name)W+='in "'+this.name+'" ';if(W+="at line "+(this.line+1)+", column "+(this.column+1),!X){if(Y=this.getSnippet(),Y)W+=`:
17
- `+Y}return W};PN.exports=jH});var w4=X$((eQ$,TN)=>{var _N=_5(),Jd=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],Wd=["scalar","sequence","mapping"];function Ud($){var X={};if($!==null)Object.keys($).forEach(function(Y){$[Y].forEach(function(W){X[String(W)]=Y})});return X}function Gd($,X){if(X=X||{},Object.keys(X).forEach(function(Y){if(Jd.indexOf(Y)===-1)throw new _N('Unknown option "'+Y+'" is met in definition of "'+$+'" YAML type.')}),this.tag=$,this.kind=X.kind||null,this.resolve=X.resolve||function(){return!0},this.construct=X.construct||function(Y){return Y},this.instanceOf=X.instanceOf||null,this.predicate=X.predicate||null,this.represent=X.represent||null,this.defaultStyle=X.defaultStyle||null,this.styleAliases=Ud(X.styleAliases||null),Wd.indexOf(this.kind)===-1)throw new _N('Unknown kind "'+this.kind+'" is specified for "'+$+'" YAML type.')}TN.exports=Gd});var q9=X$(($F$,SN)=>{var CN=F9(),z2=_5(),Hd=w4();function RH($,X,Y){var W=[];return $.include.forEach(function(J){Y=RH(J,X,Y)}),$[X].forEach(function(J){Y.forEach(function(U,H){if(U.tag===J.tag&&U.kind===J.kind)W.push(H)}),Y.push(J)}),Y.filter(function(J,U){return W.indexOf(U)===-1})}function Dd(){var $={scalar:{},sequence:{},mapping:{},fallback:{}},X,Y;function W(J){$[J.kind][J.tag]=$.fallback[J.tag]=J}for(X=0,Y=arguments.length;X<Y;X+=1)arguments[X].forEach(W);return $}function T5($){this.include=$.include||[],this.implicit=$.implicit||[],this.explicit=$.explicit||[],this.implicit.forEach(function(X){if(X.loadKind&&X.loadKind!=="scalar")throw new z2("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=RH(this,"implicit",[]),this.compiledExplicit=RH(this,"explicit",[]),this.compiledTypeMap=Dd(this.compiledImplicit,this.compiledExplicit)}T5.DEFAULT=null;T5.create=function(){var X,Y;switch(arguments.length){case 1:X=T5.DEFAULT,Y=arguments[0];break;case 2:X=arguments[0],Y=arguments[1];break;default:throw new z2("Wrong number of arguments for Schema.create function")}if(X=CN.toArray(X),Y=CN.toArray(Y),!X.every(function(W){return W instanceof T5}))throw new z2("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!Y.every(function(W){return W instanceof Hd}))throw new z2("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new T5({include:X,explicit:Y})};SN.exports=T5});var xN=X$((XF$,bN)=>{var Vd=w4();bN.exports=new Vd("tag:yaml.org,2002:str",{kind:"scalar",construct:function($){return $!==null?$:""}})});var vN=X$((YF$,kN)=>{var Kd=w4();kN.exports=new Kd("tag:yaml.org,2002:seq",{kind:"sequence",construct:function($){return $!==null?$:[]}})});var yN=X$((JF$,hN)=>{var Qd=w4();hN.exports=new Qd("tag:yaml.org,2002:map",{kind:"mapping",construct:function($){return $!==null?$:{}}})});var O2=X$((WF$,fN)=>{var Fd=q9();fN.exports=new Fd({explicit:[xN(),vN(),yN()]})});var mN=X$((UF$,gN)=>{var qd=w4();function wd($){if($===null)return!0;var X=$.length;return X===1&&$==="~"||X===4&&($==="null"||$==="Null"||$==="NULL")}function Zd(){return null}function zd($){return $===null}gN.exports=new qd("tag:yaml.org,2002:null",{kind:"scalar",resolve:wd,construct:Zd,predicate:zd,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var pN=X$((GF$,uN)=>{var Od=w4();function Nd($){if($===null)return!1;var X=$.length;return X===4&&($==="true"||$==="True"||$==="TRUE")||X===5&&($==="false"||$==="False"||$==="FALSE")}function Ad($){return $==="true"||$==="True"||$==="TRUE"}function Bd($){return Object.prototype.toString.call($)==="[object Boolean]"}uN.exports=new Od("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Nd,construct:Ad,predicate:Bd,represent:{lowercase:function($){return $?"true":"false"},uppercase:function($){return $?"TRUE":"FALSE"},camelcase:function($){return $?"True":"False"}},defaultStyle:"lowercase"})});var dN=X$((HF$,cN)=>{var Md=F9(),jd=w4();function Rd($){return 48<=$&&$<=57||65<=$&&$<=70||97<=$&&$<=102}function Ld($){return 48<=$&&$<=55}function Ed($){return 48<=$&&$<=57}function Pd($){if($===null)return!1;var X=$.length,Y=0,W=!1,J;if(!X)return!1;if(J=$[Y],J==="-"||J==="+")J=$[++Y];if(J==="0"){if(Y+1===X)return!0;if(J=$[++Y],J==="b"){Y++;for(;Y<X;Y++){if(J=$[Y],J==="_")continue;if(J!=="0"&&J!=="1")return!1;W=!0}return W&&J!=="_"}if(J==="x"){Y++;for(;Y<X;Y++){if(J=$[Y],J==="_")continue;if(!Rd($.charCodeAt(Y)))return!1;W=!0}return W&&J!=="_"}for(;Y<X;Y++){if(J=$[Y],J==="_")continue;if(!Ld($.charCodeAt(Y)))return!1;W=!0}return W&&J!=="_"}if(J==="_")return!1;for(;Y<X;Y++){if(J=$[Y],J==="_")continue;if(J===":")break;if(!Ed($.charCodeAt(Y)))return!1;W=!0}if(!W||J==="_")return!1;if(J!==":")return!0;return/^(:[0-5]?[0-9])+$/.test($.slice(Y))}function Id($){var X=$,Y=1,W,J,U=[];if(X.indexOf("_")!==-1)X=X.replace(/_/g,"");if(W=X[0],W==="-"||W==="+"){if(W==="-")Y=-1;X=X.slice(1),W=X[0]}if(X==="0")return 0;if(W==="0"){if(X[1]==="b")return Y*parseInt(X.slice(2),2);if(X[1]==="x")return Y*parseInt(X,16);return Y*parseInt(X,8)}if(X.indexOf(":")!==-1)return X.split(":").forEach(function(H){U.unshift(parseInt(H,10))}),X=0,J=1,U.forEach(function(H){X+=H*J,J*=60}),Y*X;return Y*parseInt(X,10)}function _d($){return Object.prototype.toString.call($)==="[object Number]"&&($%1===0&&!Md.isNegativeZero($))}cN.exports=new jd("tag:yaml.org,2002:int",{kind:"scalar",resolve:Pd,construct:Id,predicate:_d,represent:{binary:function($){return $>=0?"0b"+$.toString(2):"-0b"+$.toString(2).slice(1)},octal:function($){return $>=0?"0"+$.toString(8):"-0"+$.toString(8).slice(1)},decimal:function($){return $.toString(10)},hexadecimal:function($){return $>=0?"0x"+$.toString(16).toUpperCase():"-0x"+$.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var rN=X$((DF$,iN)=>{var lN=F9(),Td=w4(),Cd=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Sd($){if($===null)return!1;if(!Cd.test($)||$[$.length-1]==="_")return!1;return!0}function bd($){var X,Y,W,J;if(X=$.replace(/_/g,"").toLowerCase(),Y=X[0]==="-"?-1:1,J=[],"+-".indexOf(X[0])>=0)X=X.slice(1);if(X===".inf")return Y===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if(X===".nan")return NaN;else if(X.indexOf(":")>=0)return X.split(":").forEach(function(U){J.unshift(parseFloat(U,10))}),X=0,W=1,J.forEach(function(U){X+=U*W,W*=60}),Y*X;return Y*parseFloat(X,10)}var xd=/^[-+]?[0-9]+e/;function kd($,X){var Y;if(isNaN($))switch(X){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===$)switch(X){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===$)switch(X){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(lN.isNegativeZero($))return"-0.0";return Y=$.toString(10),xd.test(Y)?Y.replace("e",".e"):Y}function vd($){return Object.prototype.toString.call($)==="[object Number]"&&($%1!==0||lN.isNegativeZero($))}iN.exports=new Td("tag:yaml.org,2002:float",{kind:"scalar",resolve:Sd,construct:bd,predicate:vd,represent:kd,defaultStyle:"lowercase"})});var LH=X$((VF$,nN)=>{var hd=q9();nN.exports=new hd({include:[O2()],implicit:[mN(),pN(),dN(),rN()]})});var EH=X$((KF$,oN)=>{var yd=q9();oN.exports=new yd({include:[LH()]})});var eN=X$((QF$,tN)=>{var fd=w4(),aN=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),sN=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function gd($){if($===null)return!1;if(aN.exec($)!==null)return!0;if(sN.exec($)!==null)return!0;return!1}function md($){var X,Y,W,J,U,H,D,V=0,K=null,Q,q,F;if(X=aN.exec($),X===null)X=sN.exec($);if(X===null)throw Error("Date resolve error");if(Y=+X[1],W=+X[2]-1,J=+X[3],!X[4])return new Date(Date.UTC(Y,W,J));if(U=+X[4],H=+X[5],D=+X[6],X[7]){V=X[7].slice(0,3);while(V.length<3)V+="0";V=+V}if(X[9]){if(Q=+X[10],q=+(X[11]||0),K=(Q*60+q)*60000,X[9]==="-")K=-K}if(F=new Date(Date.UTC(Y,W,J,U,H,D,V)),K)F.setTime(F.getTime()-K);return F}function ud($){return $.toISOString()}tN.exports=new fd("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:gd,construct:md,instanceOf:Date,represent:ud})});var XA=X$((FF$,$A)=>{var pd=w4();function cd($){return $==="<<"||$===null}$A.exports=new pd("tag:yaml.org,2002:merge",{kind:"scalar",resolve:cd})});var JA=X$((qF$,YA)=>{var w9;try{PH=I4,w9=PH("buffer").Buffer}catch($){}var PH,dd=w4(),IH=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
18
- \r`;function ld($){if($===null)return!1;var X,Y,W=0,J=$.length,U=IH;for(Y=0;Y<J;Y++){if(X=U.indexOf($.charAt(Y)),X>64)continue;if(X<0)return!1;W+=6}return W%8===0}function id($){var X,Y,W=$.replace(/[\r\n=]/g,""),J=W.length,U=IH,H=0,D=[];for(X=0;X<J;X++){if(X%4===0&&X)D.push(H>>16&255),D.push(H>>8&255),D.push(H&255);H=H<<6|U.indexOf(W.charAt(X))}if(Y=J%4*6,Y===0)D.push(H>>16&255),D.push(H>>8&255),D.push(H&255);else if(Y===18)D.push(H>>10&255),D.push(H>>2&255);else if(Y===12)D.push(H>>4&255);if(w9)return w9.from?w9.from(D):new w9(D);return D}function rd($){var X="",Y=0,W,J,U=$.length,H=IH;for(W=0;W<U;W++){if(W%3===0&&W)X+=H[Y>>18&63],X+=H[Y>>12&63],X+=H[Y>>6&63],X+=H[Y&63];Y=(Y<<8)+$[W]}if(J=U%3,J===0)X+=H[Y>>18&63],X+=H[Y>>12&63],X+=H[Y>>6&63],X+=H[Y&63];else if(J===2)X+=H[Y>>10&63],X+=H[Y>>4&63],X+=H[Y<<2&63],X+=H[64];else if(J===1)X+=H[Y>>2&63],X+=H[Y<<4&63],X+=H[64],X+=H[64];return X}function nd($){return w9&&w9.isBuffer($)}YA.exports=new dd("tag:yaml.org,2002:binary",{kind:"scalar",resolve:ld,construct:id,predicate:nd,represent:rd})});var UA=X$((ZF$,WA)=>{var od=w4(),ad=Object.prototype.hasOwnProperty,sd=Object.prototype.toString;function td($){if($===null)return!0;var X=[],Y,W,J,U,H,D=$;for(Y=0,W=D.length;Y<W;Y+=1){if(J=D[Y],H=!1,sd.call(J)!=="[object Object]")return!1;for(U in J)if(ad.call(J,U))if(!H)H=!0;else return!1;if(!H)return!1;if(X.indexOf(U)===-1)X.push(U);else return!1}return!0}function ed($){return $!==null?$:[]}WA.exports=new od("tag:yaml.org,2002:omap",{kind:"sequence",resolve:td,construct:ed})});var HA=X$((zF$,GA)=>{var $l=w4(),Xl=Object.prototype.toString;function Yl($){if($===null)return!0;var X,Y,W,J,U,H=$;U=Array(H.length);for(X=0,Y=H.length;X<Y;X+=1){if(W=H[X],Xl.call(W)!=="[object Object]")return!1;if(J=Object.keys(W),J.length!==1)return!1;U[X]=[J[0],W[J[0]]]}return!0}function Jl($){if($===null)return[];var X,Y,W,J,U,H=$;U=Array(H.length);for(X=0,Y=H.length;X<Y;X+=1)W=H[X],J=Object.keys(W),U[X]=[J[0],W[J[0]]];return U}GA.exports=new $l("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Yl,construct:Jl})});var VA=X$((OF$,DA)=>{var Wl=w4(),Ul=Object.prototype.hasOwnProperty;function Gl($){if($===null)return!0;var X,Y=$;for(X in Y)if(Ul.call(Y,X)){if(Y[X]!==null)return!1}return!0}function Hl($){return $!==null?$:{}}DA.exports=new Wl("tag:yaml.org,2002:set",{kind:"mapping",resolve:Gl,construct:Hl})});var C5=X$((NF$,KA)=>{var Dl=q9();KA.exports=new Dl({include:[EH()],implicit:[eN(),XA()],explicit:[JA(),UA(),HA(),VA()]})});var FA=X$((AF$,QA)=>{var Vl=w4();function Kl(){return!0}function Ql(){return}function Fl(){return""}function ql($){return typeof $>"u"}QA.exports=new Vl("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:Kl,construct:Ql,predicate:ql,represent:Fl})});var wA=X$((BF$,qA)=>{var wl=w4();function Zl($){if($===null)return!1;if($.length===0)return!1;var X=$,Y=/\/([gim]*)$/.exec($),W="";if(X[0]==="/"){if(Y)W=Y[1];if(W.length>3)return!1;if(X[X.length-W.length-1]!=="/")return!1}return!0}function zl($){var X=$,Y=/\/([gim]*)$/.exec($),W="";if(X[0]==="/"){if(Y)W=Y[1];X=X.slice(1,X.length-W.length-1)}return new RegExp(X,W)}function Ol($){var X="/"+$.source+"/";if($.global)X+="g";if($.multiline)X+="m";if($.ignoreCase)X+="i";return X}function Nl($){return Object.prototype.toString.call($)==="[object RegExp]"}qA.exports=new wl("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:Zl,construct:zl,predicate:Nl,represent:Ol})});var zA=X$((MF$,ZA)=>{var N2;try{_H=I4,N2=_H("esprima")}catch($){if(typeof window<"u")N2=window.esprima}var _H,Al=w4();function Bl($){if($===null)return!1;try{var X="("+$+")",Y=N2.parse(X,{range:!0});if(Y.type!=="Program"||Y.body.length!==1||Y.body[0].type!=="ExpressionStatement"||Y.body[0].expression.type!=="ArrowFunctionExpression"&&Y.body[0].expression.type!=="FunctionExpression")return!1;return!0}catch(W){return!1}}function Ml($){var X="("+$+")",Y=N2.parse(X,{range:!0}),W=[],J;if(Y.type!=="Program"||Y.body.length!==1||Y.body[0].type!=="ExpressionStatement"||Y.body[0].expression.type!=="ArrowFunctionExpression"&&Y.body[0].expression.type!=="FunctionExpression")throw Error("Failed to resolve function");if(Y.body[0].expression.params.forEach(function(U){W.push(U.name)}),J=Y.body[0].expression.body.range,Y.body[0].expression.body.type==="BlockStatement")return Function(W,X.slice(J[0]+1,J[1]-1));return Function(W,"return "+X.slice(J[0],J[1]))}function jl($){return $.toString()}function Rl($){return Object.prototype.toString.call($)==="[object Function]"}ZA.exports=new Al("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:Bl,construct:Ml,predicate:Rl,represent:jl})});var I7=X$((RF$,NA)=>{var OA=q9();NA.exports=OA.DEFAULT=new OA({include:[C5()],explicit:[FA(),wA(),zA()]})});var fA=X$((rl,_7)=>{var J8=F9(),EA=_5(),Ll=IN(),PA=C5(),El=I7(),v8=Object.prototype.hasOwnProperty,A2=1,IA=2,_A=3,B2=4,TH=1,Pl=2,AA=3,Il=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,_l=/[\x85\u2028\u2029]/,Tl=/[,\[\]\{\}]/,TA=/^(?:!|!!|![a-z\-]+!)$/i,CA=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function BA($){return Object.prototype.toString.call($)}function E0($){return $===10||$===13}function Z9($){return $===9||$===32}function X1($){return $===9||$===32||$===10||$===13}function S5($){return $===44||$===91||$===93||$===123||$===125}function Cl($){var X;if(48<=$&&$<=57)return $-48;if(X=$|32,97<=X&&X<=102)return X-97+10;return-1}function Sl($){if($===120)return 2;if($===117)return 4;if($===85)return 8;return 0}function bl($){if(48<=$&&$<=57)return $-48;return-1}function MA($){return $===48?"\x00":$===97?"\x07":$===98?"\b":$===116?"\t":$===9?"\t":$===110?`
19
- `:$===118?"\v":$===102?"\f":$===114?"\r":$===101?"\x1B":$===32?" ":$===34?'"':$===47?"/":$===92?"\\":$===78?"\x85":$===95?"\xA0":$===76?"\u2028":$===80?"\u2029":""}function xl($){if($<=65535)return String.fromCharCode($);return String.fromCharCode(($-65536>>10)+55296,($-65536&1023)+56320)}function SA($,X,Y){if(X==="__proto__")Object.defineProperty($,X,{configurable:!0,enumerable:!0,writable:!0,value:Y});else $[X]=Y}var bA=Array(256),xA=Array(256);for(x8=0;x8<256;x8++)bA[x8]=MA(x8)?1:0,xA[x8]=MA(x8);var x8;function kl($,X){this.input=$,this.filename=X.filename||null,this.schema=X.schema||El,this.onWarning=X.onWarning||null,this.legacy=X.legacy||!1,this.json=X.json||!1,this.listener=X.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=$.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function kA($,X){return new EA(X,new Ll($.filename,$.input,$.position,$.line,$.position-$.lineStart))}function d$($,X){throw kA($,X)}function M2($,X){if($.onWarning)$.onWarning.call(null,kA($,X))}var jA={YAML:function(X,Y,W){var J,U,H;if(X.version!==null)d$(X,"duplication of %YAML directive");if(W.length!==1)d$(X,"YAML directive accepts exactly one argument");if(J=/^([0-9]+)\.([0-9]+)$/.exec(W[0]),J===null)d$(X,"ill-formed argument of the YAML directive");if(U=parseInt(J[1],10),H=parseInt(J[2],10),U!==1)d$(X,"unacceptable YAML version of the document");if(X.version=W[0],X.checkLineBreaks=H<2,H!==1&&H!==2)M2(X,"unsupported YAML version of the document")},TAG:function(X,Y,W){var J,U;if(W.length!==2)d$(X,"TAG directive accepts exactly two arguments");if(J=W[0],U=W[1],!TA.test(J))d$(X,"ill-formed tag handle (first argument) of the TAG directive");if(v8.call(X.tagMap,J))d$(X,'there is a previously declared suffix for "'+J+'" tag handle');if(!CA.test(U))d$(X,"ill-formed tag prefix (second argument) of the TAG directive");X.tagMap[J]=U}};function k8($,X,Y,W){var J,U,H,D;if(X<Y){if(D=$.input.slice(X,Y),W){for(J=0,U=D.length;J<U;J+=1)if(H=D.charCodeAt(J),!(H===9||32<=H&&H<=1114111))d$($,"expected valid JSON character")}else if(Il.test(D))d$($,"the stream contains non-printable characters");$.result+=D}}function RA($,X,Y,W){var J,U,H,D;if(!J8.isObject(Y))d$($,"cannot merge mappings; the provided source object is unacceptable");J=Object.keys(Y);for(H=0,D=J.length;H<D;H+=1)if(U=J[H],!v8.call(X,U))SA(X,U,Y[U]),W[U]=!0}function b5($,X,Y,W,J,U,H,D){var V,K;if(Array.isArray(J)){J=Array.prototype.slice.call(J);for(V=0,K=J.length;V<K;V+=1){if(Array.isArray(J[V]))d$($,"nested arrays are not supported inside keys");if(typeof J==="object"&&BA(J[V])==="[object Object]")J[V]="[object Object]"}}if(typeof J==="object"&&BA(J)==="[object Object]")J="[object Object]";if(J=String(J),X===null)X={};if(W==="tag:yaml.org,2002:merge")if(Array.isArray(U))for(V=0,K=U.length;V<K;V+=1)RA($,X,U[V],Y);else RA($,X,U,Y);else{if(!$.json&&!v8.call(Y,J)&&v8.call(X,J))$.line=H||$.line,$.position=D||$.position,d$($,"duplicated mapping key");SA(X,J,U),delete Y[J]}return X}function CH($){var X=$.input.charCodeAt($.position);if(X===10)$.position++;else if(X===13){if($.position++,$.input.charCodeAt($.position)===10)$.position++}else d$($,"a line break is expected");$.line+=1,$.lineStart=$.position}function U4($,X,Y){var W=0,J=$.input.charCodeAt($.position);while(J!==0){while(Z9(J))J=$.input.charCodeAt(++$.position);if(X&&J===35)do J=$.input.charCodeAt(++$.position);while(J!==10&&J!==13&&J!==0);if(E0(J)){CH($),J=$.input.charCodeAt($.position),W++,$.lineIndent=0;while(J===32)$.lineIndent++,J=$.input.charCodeAt(++$.position)}else break}if(Y!==-1&&W!==0&&$.lineIndent<Y)M2($,"deficient indentation");return W}function j2($){var X=$.position,Y;if(Y=$.input.charCodeAt(X),(Y===45||Y===46)&&Y===$.input.charCodeAt(X+1)&&Y===$.input.charCodeAt(X+2)){if(X+=3,Y=$.input.charCodeAt(X),Y===0||X1(Y))return!0}return!1}function SH($,X){if(X===1)$.result+=" ";else if(X>1)$.result+=J8.repeat(`
20
- `,X-1)}function vl($,X,Y){var W,J,U,H,D,V,K,Q,q=$.kind,F=$.result,w;if(w=$.input.charCodeAt($.position),X1(w)||S5(w)||w===35||w===38||w===42||w===33||w===124||w===62||w===39||w===34||w===37||w===64||w===96)return!1;if(w===63||w===45){if(J=$.input.charCodeAt($.position+1),X1(J)||Y&&S5(J))return!1}$.kind="scalar",$.result="",U=H=$.position,D=!1;while(w!==0){if(w===58){if(J=$.input.charCodeAt($.position+1),X1(J)||Y&&S5(J))break}else if(w===35){if(W=$.input.charCodeAt($.position-1),X1(W))break}else if($.position===$.lineStart&&j2($)||Y&&S5(w))break;else if(E0(w))if(V=$.line,K=$.lineStart,Q=$.lineIndent,U4($,!1,-1),$.lineIndent>=X){D=!0,w=$.input.charCodeAt($.position);continue}else{$.position=H,$.line=V,$.lineStart=K,$.lineIndent=Q;break}if(D)k8($,U,H,!1),SH($,$.line-V),U=H=$.position,D=!1;if(!Z9(w))H=$.position+1;w=$.input.charCodeAt(++$.position)}if(k8($,U,H,!1),$.result)return!0;return $.kind=q,$.result=F,!1}function hl($,X){var Y,W,J;if(Y=$.input.charCodeAt($.position),Y!==39)return!1;$.kind="scalar",$.result="",$.position++,W=J=$.position;while((Y=$.input.charCodeAt($.position))!==0)if(Y===39)if(k8($,W,$.position,!0),Y=$.input.charCodeAt(++$.position),Y===39)W=$.position,$.position++,J=$.position;else return!0;else if(E0(Y))k8($,W,J,!0),SH($,U4($,!1,X)),W=J=$.position;else if($.position===$.lineStart&&j2($))d$($,"unexpected end of the document within a single quoted scalar");else $.position++,J=$.position;d$($,"unexpected end of the stream within a single quoted scalar")}function yl($,X){var Y,W,J,U,H,D;if(D=$.input.charCodeAt($.position),D!==34)return!1;$.kind="scalar",$.result="",$.position++,Y=W=$.position;while((D=$.input.charCodeAt($.position))!==0)if(D===34)return k8($,Y,$.position,!0),$.position++,!0;else if(D===92){if(k8($,Y,$.position,!0),D=$.input.charCodeAt(++$.position),E0(D))U4($,!1,X);else if(D<256&&bA[D])$.result+=xA[D],$.position++;else if((H=Sl(D))>0){J=H,U=0;for(;J>0;J--)if(D=$.input.charCodeAt(++$.position),(H=Cl(D))>=0)U=(U<<4)+H;else d$($,"expected hexadecimal character");$.result+=xl(U),$.position++}else d$($,"unknown escape sequence");Y=W=$.position}else if(E0(D))k8($,Y,W,!0),SH($,U4($,!1,X)),Y=W=$.position;else if($.position===$.lineStart&&j2($))d$($,"unexpected end of the document within a double quoted scalar");else $.position++,W=$.position;d$($,"unexpected end of the stream within a double quoted scalar")}function fl($,X){var Y=!0,W,J=$.tag,U,H=$.anchor,D,V,K,Q,q,F={},w,z,O,N;if(N=$.input.charCodeAt($.position),N===91)V=93,q=!1,U=[];else if(N===123)V=125,q=!0,U={};else return!1;if($.anchor!==null)$.anchorMap[$.anchor]=U;N=$.input.charCodeAt(++$.position);while(N!==0){if(U4($,!0,X),N=$.input.charCodeAt($.position),N===V)return $.position++,$.tag=J,$.anchor=H,$.kind=q?"mapping":"sequence",$.result=U,!0;else if(!Y)d$($,"missed comma between flow collection entries");if(z=w=O=null,K=Q=!1,N===63){if(D=$.input.charCodeAt($.position+1),X1(D))K=Q=!0,$.position++,U4($,!0,X)}if(W=$.line,x5($,X,A2,!1,!0),z=$.tag,w=$.result,U4($,!0,X),N=$.input.charCodeAt($.position),(Q||$.line===W)&&N===58)K=!0,N=$.input.charCodeAt(++$.position),U4($,!0,X),x5($,X,A2,!1,!0),O=$.result;if(q)b5($,U,F,z,w,O);else if(K)U.push(b5($,null,F,z,w,O));else U.push(w);if(U4($,!0,X),N=$.input.charCodeAt($.position),N===44)Y=!0,N=$.input.charCodeAt(++$.position);else Y=!1}d$($,"unexpected end of the stream within a flow collection")}function gl($,X){var Y,W,J=TH,U=!1,H=!1,D=X,V=0,K=!1,Q,q;if(q=$.input.charCodeAt($.position),q===124)W=!1;else if(q===62)W=!0;else return!1;$.kind="scalar",$.result="";while(q!==0)if(q=$.input.charCodeAt(++$.position),q===43||q===45)if(TH===J)J=q===43?AA:Pl;else d$($,"repeat of a chomping mode identifier");else if((Q=bl(q))>=0)if(Q===0)d$($,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!H)D=X+Q-1,H=!0;else d$($,"repeat of an indentation width identifier");else break;if(Z9(q)){do q=$.input.charCodeAt(++$.position);while(Z9(q));if(q===35)do q=$.input.charCodeAt(++$.position);while(!E0(q)&&q!==0)}while(q!==0){CH($),$.lineIndent=0,q=$.input.charCodeAt($.position);while((!H||$.lineIndent<D)&&q===32)$.lineIndent++,q=$.input.charCodeAt(++$.position);if(!H&&$.lineIndent>D)D=$.lineIndent;if(E0(q)){V++;continue}if($.lineIndent<D){if(J===AA)$.result+=J8.repeat(`
21
- `,U?1+V:V);else if(J===TH){if(U)$.result+=`
22
- `}break}if(W)if(Z9(q))K=!0,$.result+=J8.repeat(`
23
- `,U?1+V:V);else if(K)K=!1,$.result+=J8.repeat(`
24
- `,V+1);else if(V===0){if(U)$.result+=" "}else $.result+=J8.repeat(`
25
- `,V);else $.result+=J8.repeat(`
26
- `,U?1+V:V);U=!0,H=!0,V=0,Y=$.position;while(!E0(q)&&q!==0)q=$.input.charCodeAt(++$.position);k8($,Y,$.position,!1)}return!0}function LA($,X){var Y,W=$.tag,J=$.anchor,U=[],H,D=!1,V;if($.anchor!==null)$.anchorMap[$.anchor]=U;V=$.input.charCodeAt($.position);while(V!==0){if(V!==45)break;if(H=$.input.charCodeAt($.position+1),!X1(H))break;if(D=!0,$.position++,U4($,!0,-1)){if($.lineIndent<=X){U.push(null),V=$.input.charCodeAt($.position);continue}}if(Y=$.line,x5($,X,_A,!1,!0),U.push($.result),U4($,!0,-1),V=$.input.charCodeAt($.position),($.line===Y||$.lineIndent>X)&&V!==0)d$($,"bad indentation of a sequence entry");else if($.lineIndent<X)break}if(D)return $.tag=W,$.anchor=J,$.kind="sequence",$.result=U,!0;return!1}function ml($,X,Y){var W,J,U,H,D=$.tag,V=$.anchor,K={},Q={},q=null,F=null,w=null,z=!1,O=!1,N;if($.anchor!==null)$.anchorMap[$.anchor]=K;N=$.input.charCodeAt($.position);while(N!==0){if(W=$.input.charCodeAt($.position+1),U=$.line,H=$.position,(N===63||N===58)&&X1(W)){if(N===63){if(z)b5($,K,Q,q,F,null),q=F=w=null;O=!0,z=!0,J=!0}else if(z)z=!1,J=!0;else d$($,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");$.position+=1,N=W}else if(x5($,Y,IA,!1,!0))if($.line===U){N=$.input.charCodeAt($.position);while(Z9(N))N=$.input.charCodeAt(++$.position);if(N===58){if(N=$.input.charCodeAt(++$.position),!X1(N))d$($,"a whitespace character is expected after the key-value separator within a block mapping");if(z)b5($,K,Q,q,F,null),q=F=w=null;O=!0,z=!1,J=!1,q=$.tag,F=$.result}else if(O)d$($,"can not read an implicit mapping pair; a colon is missed");else return $.tag=D,$.anchor=V,!0}else if(O)d$($,"can not read a block mapping entry; a multiline key may not be an implicit key");else return $.tag=D,$.anchor=V,!0;else break;if($.line===U||$.lineIndent>X){if(x5($,X,B2,!0,J))if(z)F=$.result;else w=$.result;if(!z)b5($,K,Q,q,F,w,U,H),q=F=w=null;U4($,!0,-1),N=$.input.charCodeAt($.position)}if($.lineIndent>X&&N!==0)d$($,"bad indentation of a mapping entry");else if($.lineIndent<X)break}if(z)b5($,K,Q,q,F,null);if(O)$.tag=D,$.anchor=V,$.kind="mapping",$.result=K;return O}function ul($){var X,Y=!1,W=!1,J,U,H;if(H=$.input.charCodeAt($.position),H!==33)return!1;if($.tag!==null)d$($,"duplication of a tag property");if(H=$.input.charCodeAt(++$.position),H===60)Y=!0,H=$.input.charCodeAt(++$.position);else if(H===33)W=!0,J="!!",H=$.input.charCodeAt(++$.position);else J="!";if(X=$.position,Y){do H=$.input.charCodeAt(++$.position);while(H!==0&&H!==62);if($.position<$.length)U=$.input.slice(X,$.position),H=$.input.charCodeAt(++$.position);else d$($,"unexpected end of the stream within a verbatim tag")}else{while(H!==0&&!X1(H)){if(H===33)if(!W){if(J=$.input.slice(X-1,$.position+1),!TA.test(J))d$($,"named tag handle cannot contain such characters");W=!0,X=$.position+1}else d$($,"tag suffix cannot contain exclamation marks");H=$.input.charCodeAt(++$.position)}if(U=$.input.slice(X,$.position),Tl.test(U))d$($,"tag suffix cannot contain flow indicator characters")}if(U&&!CA.test(U))d$($,"tag name cannot contain such characters: "+U);if(Y)$.tag=U;else if(v8.call($.tagMap,J))$.tag=$.tagMap[J]+U;else if(J==="!")$.tag="!"+U;else if(J==="!!")$.tag="tag:yaml.org,2002:"+U;else d$($,'undeclared tag handle "'+J+'"');return!0}function pl($){var X,Y;if(Y=$.input.charCodeAt($.position),Y!==38)return!1;if($.anchor!==null)d$($,"duplication of an anchor property");Y=$.input.charCodeAt(++$.position),X=$.position;while(Y!==0&&!X1(Y)&&!S5(Y))Y=$.input.charCodeAt(++$.position);if($.position===X)d$($,"name of an anchor node must contain at least one character");return $.anchor=$.input.slice(X,$.position),!0}function cl($){var X,Y,W;if(W=$.input.charCodeAt($.position),W!==42)return!1;W=$.input.charCodeAt(++$.position),X=$.position;while(W!==0&&!X1(W)&&!S5(W))W=$.input.charCodeAt(++$.position);if($.position===X)d$($,"name of an alias node must contain at least one character");if(Y=$.input.slice(X,$.position),!v8.call($.anchorMap,Y))d$($,'unidentified alias "'+Y+'"');return $.result=$.anchorMap[Y],U4($,!0,-1),!0}function x5($,X,Y,W,J){var U,H,D,V=1,K=!1,Q=!1,q,F,w,z,O;if($.listener!==null)$.listener("open",$);if($.tag=null,$.anchor=null,$.kind=null,$.result=null,U=H=D=B2===Y||_A===Y,W){if(U4($,!0,-1)){if(K=!0,$.lineIndent>X)V=1;else if($.lineIndent===X)V=0;else if($.lineIndent<X)V=-1}}if(V===1)while(ul($)||pl($))if(U4($,!0,-1)){if(K=!0,D=U,$.lineIndent>X)V=1;else if($.lineIndent===X)V=0;else if($.lineIndent<X)V=-1}else D=!1;if(D)D=K||J;if(V===1||B2===Y){if(A2===Y||IA===Y)z=X;else z=X+1;if(O=$.position-$.lineStart,V===1)if(D&&(LA($,O)||ml($,O,z))||fl($,z))Q=!0;else{if(H&&gl($,z)||hl($,z)||yl($,z))Q=!0;else if(cl($)){if(Q=!0,$.tag!==null||$.anchor!==null)d$($,"alias node should not have any properties")}else if(vl($,z,A2===Y)){if(Q=!0,$.tag===null)$.tag="?"}if($.anchor!==null)$.anchorMap[$.anchor]=$.result}else if(V===0)Q=D&&LA($,O)}if($.tag!==null&&$.tag!=="!")if($.tag==="?"){if($.result!==null&&$.kind!=="scalar")d$($,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+$.kind+'"');for(q=0,F=$.implicitTypes.length;q<F;q+=1)if(w=$.implicitTypes[q],w.resolve($.result)){if($.result=w.construct($.result),$.tag=w.tag,$.anchor!==null)$.anchorMap[$.anchor]=$.result;break}}else if(v8.call($.typeMap[$.kind||"fallback"],$.tag)){if(w=$.typeMap[$.kind||"fallback"][$.tag],$.result!==null&&w.kind!==$.kind)d$($,"unacceptable node kind for !<"+$.tag+'> tag; it should be "'+w.kind+'", not "'+$.kind+'"');if(!w.resolve($.result))d$($,"cannot resolve a node with !<"+$.tag+"> explicit tag");else if($.result=w.construct($.result),$.anchor!==null)$.anchorMap[$.anchor]=$.result}else d$($,"unknown tag !<"+$.tag+">");if($.listener!==null)$.listener("close",$);return $.tag!==null||$.anchor!==null||Q}function dl($){var X=$.position,Y,W,J,U=!1,H;$.version=null,$.checkLineBreaks=$.legacy,$.tagMap={},$.anchorMap={};while((H=$.input.charCodeAt($.position))!==0){if(U4($,!0,-1),H=$.input.charCodeAt($.position),$.lineIndent>0||H!==37)break;U=!0,H=$.input.charCodeAt(++$.position),Y=$.position;while(H!==0&&!X1(H))H=$.input.charCodeAt(++$.position);if(W=$.input.slice(Y,$.position),J=[],W.length<1)d$($,"directive name must not be less than one character in length");while(H!==0){while(Z9(H))H=$.input.charCodeAt(++$.position);if(H===35){do H=$.input.charCodeAt(++$.position);while(H!==0&&!E0(H));break}if(E0(H))break;Y=$.position;while(H!==0&&!X1(H))H=$.input.charCodeAt(++$.position);J.push($.input.slice(Y,$.position))}if(H!==0)CH($);if(v8.call(jA,W))jA[W]($,W,J);else M2($,'unknown document directive "'+W+'"')}if(U4($,!0,-1),$.lineIndent===0&&$.input.charCodeAt($.position)===45&&$.input.charCodeAt($.position+1)===45&&$.input.charCodeAt($.position+2)===45)$.position+=3,U4($,!0,-1);else if(U)d$($,"directives end mark is expected");if(x5($,$.lineIndent-1,B2,!1,!0),U4($,!0,-1),$.checkLineBreaks&&_l.test($.input.slice(X,$.position)))M2($,"non-ASCII line breaks are interpreted as content");if($.documents.push($.result),$.position===$.lineStart&&j2($)){if($.input.charCodeAt($.position)===46)$.position+=3,U4($,!0,-1);return}if($.position<$.length-1)d$($,"end of the stream or a document separator is expected");else return}function vA($,X){if($=String($),X=X||{},$.length!==0){if($.charCodeAt($.length-1)!==10&&$.charCodeAt($.length-1)!==13)$+=`
27
- `;if($.charCodeAt(0)===65279)$=$.slice(1)}var Y=new kl($,X),W=$.indexOf("\x00");if(W!==-1)Y.position=W,d$(Y,"null byte is not allowed in input");Y.input+="\x00";while(Y.input.charCodeAt(Y.position)===32)Y.lineIndent+=1,Y.position+=1;while(Y.position<Y.length-1)dl(Y);return Y.documents}function hA($,X,Y){if(X!==null&&typeof X==="object"&&typeof Y>"u")Y=X,X=null;var W=vA($,Y);if(typeof X!=="function")return W;for(var J=0,U=W.length;J<U;J+=1)X(W[J])}function yA($,X){var Y=vA($,X);if(Y.length===0)return;else if(Y.length===1)return Y[0];throw new EA("expected a single document in the stream, but found more")}function ll($,X,Y){if(typeof X==="object"&&X!==null&&typeof Y>"u")Y=X,X=null;return hA($,X,J8.extend({schema:PA},Y))}function il($,X){return yA($,J8.extend({schema:PA},X))}rl.loadAll=hA;rl.load=yA;rl.safeLoadAll=ll;rl.safeLoad=il});var HB=X$((bi,vH)=>{var C7=F9(),S7=_5(),tl=I7(),el=C5(),iA=Object.prototype.toString,rA=Object.prototype.hasOwnProperty,$i=9,T7=10,Xi=13,Yi=32,Ji=33,Wi=34,nA=35,Ui=37,Gi=38,Hi=39,Di=42,oA=44,Vi=45,aA=58,Ki=61,Qi=62,Fi=63,qi=64,sA=91,tA=93,wi=96,eA=123,Zi=124,$B=125,h4={};h4[0]="\\0";h4[7]="\\a";h4[8]="\\b";h4[9]="\\t";h4[10]="\\n";h4[11]="\\v";h4[12]="\\f";h4[13]="\\r";h4[27]="\\e";h4[34]="\\\"";h4[92]="\\\\";h4[133]="\\N";h4[160]="\\_";h4[8232]="\\L";h4[8233]="\\P";var zi=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function Oi($,X){var Y,W,J,U,H,D,V;if(X===null)return{};Y={},W=Object.keys(X);for(J=0,U=W.length;J<U;J+=1){if(H=W[J],D=String(X[H]),H.slice(0,2)==="!!")H="tag:yaml.org,2002:"+H.slice(2);if(V=$.compiledTypeMap.fallback[H],V&&rA.call(V.styleAliases,D))D=V.styleAliases[D];Y[H]=D}return Y}function gA($){var X,Y,W;if(X=$.toString(16).toUpperCase(),$<=255)Y="x",W=2;else if($<=65535)Y="u",W=4;else if($<=4294967295)Y="U",W=8;else throw new S7("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+Y+C7.repeat("0",W-X.length)+X}function Ni($){this.schema=$.schema||tl,this.indent=Math.max(1,$.indent||2),this.noArrayIndent=$.noArrayIndent||!1,this.skipInvalid=$.skipInvalid||!1,this.flowLevel=C7.isNothing($.flowLevel)?-1:$.flowLevel,this.styleMap=Oi(this.schema,$.styles||null),this.sortKeys=$.sortKeys||!1,this.lineWidth=$.lineWidth||80,this.noRefs=$.noRefs||!1,this.noCompatMode=$.noCompatMode||!1,this.condenseFlow=$.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function mA($,X){var Y=C7.repeat(" ",X),W=0,J=-1,U="",H,D=$.length;while(W<D){if(J=$.indexOf(`
28
- `,W),J===-1)H=$.slice(W),W=D;else H=$.slice(W,J+1),W=J+1;if(H.length&&H!==`
29
- `)U+=Y;U+=H}return U}function bH($,X){return`
30
- `+C7.repeat(" ",$.indent*X)}function Ai($,X){var Y,W,J;for(Y=0,W=$.implicitTypes.length;Y<W;Y+=1)if(J=$.implicitTypes[Y],J.resolve(X))return!0;return!1}function kH($){return $===Yi||$===$i}function k5($){return 32<=$&&$<=126||161<=$&&$<=55295&&$!==8232&&$!==8233||57344<=$&&$<=65533&&$!==65279||65536<=$&&$<=1114111}function Bi($){return k5($)&&!kH($)&&$!==65279&&$!==Xi&&$!==T7}function uA($,X){return k5($)&&$!==65279&&$!==oA&&$!==sA&&$!==tA&&$!==eA&&$!==$B&&$!==aA&&($!==nA||X&&Bi(X))}function Mi($){return k5($)&&$!==65279&&!kH($)&&$!==Vi&&$!==Fi&&$!==aA&&$!==oA&&$!==sA&&$!==tA&&$!==eA&&$!==$B&&$!==nA&&$!==Gi&&$!==Di&&$!==Ji&&$!==Zi&&$!==Ki&&$!==Qi&&$!==Hi&&$!==Wi&&$!==Ui&&$!==qi&&$!==wi}function XB($){var X=/^\n* /;return X.test($)}var YB=1,JB=2,WB=3,UB=4,R2=5;function ji($,X,Y,W,J){var U,H,D,V=!1,K=!1,Q=W!==-1,q=-1,F=Mi($.charCodeAt(0))&&!kH($.charCodeAt($.length-1));if(X)for(U=0;U<$.length;U++){if(H=$.charCodeAt(U),!k5(H))return R2;D=U>0?$.charCodeAt(U-1):null,F=F&&uA(H,D)}else{for(U=0;U<$.length;U++){if(H=$.charCodeAt(U),H===T7){if(V=!0,Q)K=K||U-q-1>W&&$[q+1]!==" ",q=U}else if(!k5(H))return R2;D=U>0?$.charCodeAt(U-1):null,F=F&&uA(H,D)}K=K||Q&&(U-q-1>W&&$[q+1]!==" ")}if(!V&&!K)return F&&!J($)?YB:JB;if(Y>9&&XB($))return R2;return K?UB:WB}function Ri($,X,Y,W){$.dump=function(){if(X.length===0)return"''";if(!$.noCompatMode&&zi.indexOf(X)!==-1)return"'"+X+"'";var J=$.indent*Math.max(1,Y),U=$.lineWidth===-1?-1:Math.max(Math.min($.lineWidth,40),$.lineWidth-J),H=W||$.flowLevel>-1&&Y>=$.flowLevel;function D(V){return Ai($,V)}switch(ji(X,H,$.indent,U,D)){case YB:return X;case JB:return"'"+X.replace(/'/g,"''")+"'";case WB:return"|"+pA(X,$.indent)+cA(mA(X,J));case UB:return">"+pA(X,$.indent)+cA(mA(Li(X,U),J));case R2:return'"'+Ei(X,U)+'"';default:throw new S7("impossible error: invalid scalar style")}}()}function pA($,X){var Y=XB($)?String(X):"",W=$[$.length-1]===`
31
- `,J=W&&($[$.length-2]===`
32
- `||$===`
33
- `),U=J?"+":W?"":"-";return Y+U+`
34
- `}function cA($){return $[$.length-1]===`
35
- `?$.slice(0,-1):$}function Li($,X){var Y=/(\n+)([^\n]*)/g,W=function(){var K=$.indexOf(`
36
- `);return K=K!==-1?K:$.length,Y.lastIndex=K,dA($.slice(0,K),X)}(),J=$[0]===`
37
- `||$[0]===" ",U,H;while(H=Y.exec($)){var D=H[1],V=H[2];U=V[0]===" ",W+=D+(!J&&!U&&V!==""?`
38
- `:"")+dA(V,X),J=U}return W}function dA($,X){if($===""||$[0]===" ")return $;var Y=/ [^ ]/g,W,J=0,U,H=0,D=0,V="";while(W=Y.exec($)){if(D=W.index,D-J>X)U=H>J?H:D,V+=`
39
- `+$.slice(J,U),J=U+1;H=D}if(V+=`
40
- `,$.length-J>X&&H>J)V+=$.slice(J,H)+`
41
- `+$.slice(H+1);else V+=$.slice(J);return V.slice(1)}function Ei($){var X="",Y,W,J;for(var U=0;U<$.length;U++){if(Y=$.charCodeAt(U),Y>=55296&&Y<=56319){if(W=$.charCodeAt(U+1),W>=56320&&W<=57343){X+=gA((Y-55296)*1024+W-56320+65536),U++;continue}}J=h4[Y],X+=!J&&k5(Y)?$[U]:J||gA(Y)}return X}function Pi($,X,Y){var W="",J=$.tag,U,H;for(U=0,H=Y.length;U<H;U+=1)if(z9($,X,Y[U],!1,!1)){if(U!==0)W+=","+(!$.condenseFlow?" ":"");W+=$.dump}$.tag=J,$.dump="["+W+"]"}function Ii($,X,Y,W){var J="",U=$.tag,H,D;for(H=0,D=Y.length;H<D;H+=1)if(z9($,X+1,Y[H],!0,!0)){if(!W||H!==0)J+=bH($,X);if($.dump&&T7===$.dump.charCodeAt(0))J+="-";else J+="- ";J+=$.dump}$.tag=U,$.dump=J||"[]"}function _i($,X,Y){var W="",J=$.tag,U=Object.keys(Y),H,D,V,K,Q;for(H=0,D=U.length;H<D;H+=1){if(Q="",H!==0)Q+=", ";if($.condenseFlow)Q+='"';if(V=U[H],K=Y[V],!z9($,X,V,!1,!1))continue;if($.dump.length>1024)Q+="? ";if(Q+=$.dump+($.condenseFlow?'"':"")+":"+($.condenseFlow?"":" "),!z9($,X,K,!1,!1))continue;Q+=$.dump,W+=Q}$.tag=J,$.dump="{"+W+"}"}function Ti($,X,Y,W){var J="",U=$.tag,H=Object.keys(Y),D,V,K,Q,q,F;if($.sortKeys===!0)H.sort();else if(typeof $.sortKeys==="function")H.sort($.sortKeys);else if($.sortKeys)throw new S7("sortKeys must be a boolean or a function");for(D=0,V=H.length;D<V;D+=1){if(F="",!W||D!==0)F+=bH($,X);if(K=H[D],Q=Y[K],!z9($,X+1,K,!0,!0,!0))continue;if(q=$.tag!==null&&$.tag!=="?"||$.dump&&$.dump.length>1024,q)if($.dump&&T7===$.dump.charCodeAt(0))F+="?";else F+="? ";if(F+=$.dump,q)F+=bH($,X);if(!z9($,X+1,Q,!0,q))continue;if($.dump&&T7===$.dump.charCodeAt(0))F+=":";else F+=": ";F+=$.dump,J+=F}$.tag=U,$.dump=J||"{}"}function lA($,X,Y){var W,J,U,H,D,V;J=Y?$.explicitTypes:$.implicitTypes;for(U=0,H=J.length;U<H;U+=1)if(D=J[U],(D.instanceOf||D.predicate)&&(!D.instanceOf||typeof X==="object"&&X instanceof D.instanceOf)&&(!D.predicate||D.predicate(X))){if($.tag=Y?D.tag:"?",D.represent){if(V=$.styleMap[D.tag]||D.defaultStyle,iA.call(D.represent)==="[object Function]")W=D.represent(X,V);else if(rA.call(D.represent,V))W=D.represent[V](X,V);else throw new S7("!<"+D.tag+'> tag resolver accepts not "'+V+'" style');$.dump=W}return!0}return!1}function z9($,X,Y,W,J,U){if($.tag=null,$.dump=Y,!lA($,Y,!1))lA($,Y,!0);var H=iA.call($.dump);if(W)W=$.flowLevel<0||$.flowLevel>X;var D=H==="[object Object]"||H==="[object Array]",V,K;if(D)V=$.duplicates.indexOf(Y),K=V!==-1;if($.tag!==null&&$.tag!=="?"||K||$.indent!==2&&X>0)J=!1;if(K&&$.usedDuplicates[V])$.dump="*ref_"+V;else{if(D&&K&&!$.usedDuplicates[V])$.usedDuplicates[V]=!0;if(H==="[object Object]"){if(W&&Object.keys($.dump).length!==0){if(Ti($,X,$.dump,J),K)$.dump="&ref_"+V+$.dump}else if(_i($,X,$.dump),K)$.dump="&ref_"+V+" "+$.dump}else if(H==="[object Array]"){var Q=$.noArrayIndent&&X>0?X-1:X;if(W&&$.dump.length!==0){if(Ii($,Q,$.dump,J),K)$.dump="&ref_"+V+$.dump}else if(Pi($,Q,$.dump),K)$.dump="&ref_"+V+" "+$.dump}else if(H==="[object String]"){if($.tag!=="?")Ri($,$.dump,X,U)}else{if($.skipInvalid)return!1;throw new S7("unacceptable kind of an object to dump "+H)}if($.tag!==null&&$.tag!=="?")$.dump="!<"+$.tag+"> "+$.dump}return!0}function Ci($,X){var Y=[],W=[],J,U;xH($,Y,W);for(J=0,U=W.length;J<U;J+=1)X.duplicates.push(Y[W[J]]);X.usedDuplicates=Array(U)}function xH($,X,Y){var W,J,U;if($!==null&&typeof $==="object")if(J=X.indexOf($),J!==-1){if(Y.indexOf(J)===-1)Y.push(J)}else if(X.push($),Array.isArray($))for(J=0,U=$.length;J<U;J+=1)xH($[J],X,Y);else{W=Object.keys($);for(J=0,U=W.length;J<U;J+=1)xH($[W[J]],X,Y)}}function GB($,X){X=X||{};var Y=new Ni(X);if(!Y.noRefs)Ci($,Y);if(z9(Y,0,$,!0,!0))return Y.dump+`
42
- `;return""}function Si($,X){return GB($,C7.extend({schema:el},X))}bi.dump=GB;bi.safeDump=Si});var VB=X$((vi,t6)=>{var L2=fA(),DB=HB();function E2($){return function(){throw Error("Function "+$+" is deprecated and cannot be used.")}}vi.Type=w4();vi.Schema=q9();vi.FAILSAFE_SCHEMA=O2();vi.JSON_SCHEMA=LH();vi.CORE_SCHEMA=EH();vi.DEFAULT_SAFE_SCHEMA=C5();vi.DEFAULT_FULL_SCHEMA=I7();vi.load=L2.load;vi.loadAll=L2.loadAll;vi.safeLoad=L2.safeLoad;vi.safeLoadAll=L2.safeLoadAll;vi.dump=DB.dump;vi.safeDump=DB.safeDump;vi.YAMLException=_5();vi.MINIMAL_SCHEMA=O2();vi.SAFE_SCHEMA=C5();vi.DEFAULT_SCHEMA=I7();vi.scan=E2("scan");vi.parse=E2("parse");vi.compose=E2("compose");vi.addConstructor=E2("addConstructor")});var QB=X$((LF$,KB)=>{var Jr=VB();KB.exports=Jr});var gH=X$((yH,fH)=>{var P2=QB(),hH=yH=fH.exports;hH.yaml={parse:P2.safeLoad.bind(P2),stringify:P2.safeDump.bind(P2)};hH.json={parse:JSON.parse.bind(JSON),stringify:function($,X){let Y=Object.assign({replacer:null,space:2},X);return JSON.stringify($,Y.replacer,Y.space)}};hH.javascript={parse:function parse(str,options,wrap){try{if(wrap!==!1)str=`(function() {
43
- return `+str.trim()+`;
44
- }());`;return eval(str)||{}}catch($){if(wrap!==!1&&/(unexpected|identifier)/i.test($.message))return parse(str,options,!1);throw SyntaxError($)}},stringify:function(){throw Error("stringifying JavaScript is not supported")}}});var qB=X$((EF$,FB)=>{/*!
45
- * strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
46
- *
47
- * Copyright (c) 2015, 2017, Jon Schlinkert.
48
- * Released under the MIT License.
49
- */FB.exports=function($){if(typeof $==="string"&&$.charAt(0)==="\uFEFF")return $.slice(1);return $}});var I2=X$((Wr)=>{var wB=qB(),ZB=E7();Wr.define=function($,X,Y){Reflect.defineProperty($,X,{enumerable:!1,configurable:!0,writable:!0,value:Y})};Wr.isBuffer=function($){return ZB($)==="buffer"};Wr.isObject=function($){return ZB($)==="object"};Wr.toBuffer=function($){return typeof $==="string"?Buffer.from($):$};Wr.toString=function($){if(Wr.isBuffer($))return wB(String($));if(typeof $!=="string")throw TypeError("expected input to be a string or buffer");return wB($)};Wr.arrayify=function($){return $?Array.isArray($)?$:[$]:[]};Wr.startsWith=function($,X,Y){if(typeof Y!=="number")Y=X.length;return $.slice(0,Y)===X}});var b7=X$((IF$,OB)=>{var Qr=gH(),Fr=I2();OB.exports=function($){let X=Object.assign({},$);if(X.delimiters=Fr.arrayify(X.delims||X.delimiters||"---"),X.delimiters.length===1)X.delimiters.push(X.delimiters[0]);return X.language=(X.language||X.lang||"yaml").toLowerCase(),X.engines=Object.assign({},Qr,X.parsers,X.engines),X}});var mH=X$((_F$,NB)=>{NB.exports=function($,X){let Y=X.engines[$]||X.engines[qr($)];if(typeof Y>"u")throw Error('gray-matter engine "'+$+'" is not registered');if(typeof Y==="function")Y={parse:Y};return Y};function qr($){switch($.toLowerCase()){case"js":case"javascript":return"javascript";case"coffee":case"coffeescript":case"cson":return"coffee";case"yaml":case"yml":return"yaml";default:return $}}});var uH=X$((TF$,AB)=>{var wr=E7(),Zr=mH(),zr=b7();AB.exports=function($,X,Y){if(X==null&&Y==null)switch(wr($)){case"object":X=$.data,Y={};break;case"string":return $;default:throw TypeError("expected file to be a string or object")}let W=$.content,J=zr(Y);if(X==null){if(!J.data)return $;X=J.data}let U=$.language||J.language,H=Zr(U,J);if(typeof H.stringify!=="function")throw TypeError('expected "'+U+'.stringify" to be a function');X=Object.assign({},$.data,X);let D=J.delimiters[0],V=J.delimiters[1],K=H.stringify(X,Y).trim(),Q="";if(K!=="{}")Q=v5(D)+v5(K)+v5(V);if(typeof $.excerpt==="string"&&$.excerpt!==""){if(W.indexOf($.excerpt.trim())===-1)Q+=v5($.excerpt)+v5(V)}return Q+v5(W)};function v5($){return $.slice(-1)!==`
50
- `?$+`
51
- `:$}});var MB=X$((CF$,BB)=>{var Or=b7();BB.exports=function($,X){let Y=Or(X);if($.data==null)$.data={};if(typeof Y.excerpt==="function")return Y.excerpt($,Y);let W=$.data.excerpt_separator||Y.excerpt_separator;if(W==null&&(Y.excerpt===!1||Y.excerpt==null))return $;let J=typeof Y.excerpt==="string"?Y.excerpt:W||Y.delimiters[0],U=$.content.indexOf(J);if(U!==-1)$.excerpt=$.content.slice(0,U);return $}});var LB=X$((SF$,RB)=>{var jB=E7(),Nr=uH(),h5=I2();RB.exports=function($){if(jB($)!=="object")$={content:$};if(jB($.data)!=="object")$.data={};if($.contents&&$.content==null)$.content=$.contents;return h5.define($,"orig",h5.toBuffer($.content)),h5.define($,"language",$.language||""),h5.define($,"matter",$.matter||""),h5.define($,"stringify",function(X,Y){if(Y&&Y.language)$.language=Y.language;return Nr($,X,Y)}),$.content=h5.toString($.content),$.isEmpty=!1,$.excerpt="",$}});var PB=X$((bF$,EB)=>{var Ar=mH(),Br=b7();EB.exports=function($,X,Y){let W=Br(Y),J=Ar($,W);if(typeof J.parse!=="function")throw TypeError('expected "'+$+'.parse" to be a function');return J.parse(X,W)}});var cH=X$((xF$,TB)=>{var Mr=I4("fs"),jr=jN(),pH=b7(),Rr=uH(),IB=MB(),Lr=gH(),Er=LB(),Pr=PB(),_B=I2();function i4($,X){if($==="")return{data:{},content:$,excerpt:"",orig:$};let Y=Er($),W=i4.cache[Y.content];if(!X){if(W)return Y=Object.assign({},W),Y.orig=W.orig,Y;i4.cache[Y.content]=Y}return Ir(Y,X)}function Ir($,X){let Y=pH(X),W=Y.delimiters[0],J=`
52
- `+Y.delimiters[1],U=$.content;if(Y.language)$.language=Y.language;let H=W.length;if(!_B.startsWith(U,W,H))return IB($,Y),$;if(U.charAt(H)===W.slice(-1))return $;U=U.slice(H);let D=U.length,V=i4.language(U,Y);if(V.name)$.language=V.name,U=U.slice(V.raw.length);let K=U.indexOf(J);if(K===-1)K=D;if($.matter=U.slice(0,K),$.matter.replace(/^\s*#[^\n]+/gm,"").trim()==="")$.isEmpty=!0,$.empty=$.content,$.data={};else $.data=Pr($.language,$.matter,Y);if(K===D)$.content="";else{if($.content=U.slice(K+J.length),$.content[0]==="\r")$.content=$.content.slice(1);if($.content[0]===`
53
- `)$.content=$.content.slice(1)}if(IB($,Y),Y.sections===!0||typeof Y.section==="function")jr($,Y.section);return $}i4.engines=Lr;i4.stringify=function($,X,Y){if(typeof $==="string")$=i4($,Y);return Rr($,X,Y)};i4.read=function($,X){let Y=Mr.readFileSync($,"utf8"),W=i4(Y,X);return W.path=$,W};i4.test=function($,X){return _B.startsWith($,pH(X).delimiters[0])};i4.language=function($,X){let W=pH(X).delimiters[0];if(i4.test($))$=$.slice(W.length);let J=$.slice(0,$.search(/\r?\n/));return{raw:J,name:J?J.trim():""}};i4.cache={};i4.clearCache=function(){i4.cache={}};TB.exports=i4});function lH(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function vB($){N9=$}function q1($,X){if(X){if(hB.test($))return $.replace(_r,CB)}else if(yB.test($))return $.replace(Tr,CB);return $}function br($){return $.replace(Sr,(X,Y)=>{if(Y=Y.toLowerCase(),Y==="colon")return":";if(Y.charAt(0)==="#")return Y.charAt(1)==="x"?String.fromCharCode(parseInt(Y.substring(2),16)):String.fromCharCode(+Y.substring(1));return""})}function h6($,X){let Y=typeof $==="string"?$:$.source;X=X||"";let W={replace:(J,U)=>{let H=typeof U==="string"?U:U.source;return H=H.replace(xr,"$1"),Y=Y.replace(J,H),W},getRegex:()=>{return new RegExp(Y,X)}};return W}function SB($){try{$=encodeURI($).replace(/%25/g,"%")}catch(X){return null}return $}function bB($,X){let Y=$.replace(/\|/g,(U,H,D)=>{let V=!1,K=H;while(--K>=0&&D[K]==="\\")V=!V;if(V)return"|";else return" |"}),W=Y.split(/ \|/),J=0;if(!W[0].trim())W.shift();if(W.length>0&&!W[W.length-1].trim())W.pop();if(X)if(W.length>X)W.splice(X);else while(W.length<X)W.push("");for(;J<W.length;J++)W[J]=W[J].trim().replace(/\\\|/g,"|");return W}function _2($,X,Y){let W=$.length;if(W===0)return"";let J=0;while(J<W){let U=$.charAt(W-J-1);if(U===X&&!Y)J++;else if(U!==X&&Y)J++;else break}return $.slice(0,W-J)}function kr($,X){if($.indexOf(X[1])===-1)return-1;let Y=0;for(let W=0;W<$.length;W++)if($[W]==="\\")W++;else if($[W]===X[0])Y++;else if($[W]===X[1]){if(Y--,Y<0)return W}return-1}function xB($,X,Y,W){let J=X.href,U=X.title?q1(X.title):null,H=$[1].replace(/\\([\[\]])/g,"$1");if($[0].charAt(0)!=="!"){W.state.inLink=!0;let D={type:"link",raw:Y,href:J,title:U,text:H,tokens:W.inlineTokens(H)};return W.state.inLink=!1,D}return{type:"image",raw:Y,href:J,title:U,text:q1(H)}}function vr($,X){let Y=$.match(/^(\s+)(?:```)/);if(Y===null)return X;let W=Y[1];return X.split(`
54
- `).map((J)=>{let U=J.match(/^\s+/);if(U===null)return J;let[H]=U;if(H.length>=W.length)return J.slice(W.length);return J}).join(`
55
- `)}class h7{options;rules;lexer;constructor($){this.options=$||N9}space($){let X=this.rules.block.newline.exec($);if(X&&X[0].length>0)return{type:"space",raw:X[0]}}code($){let X=this.rules.block.code.exec($);if(X){let Y=X[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:X[0],codeBlockStyle:"indented",text:!this.options.pedantic?_2(Y,`
56
- `):Y}}}fences($){let X=this.rules.block.fences.exec($);if(X){let Y=X[0],W=vr(Y,X[3]||"");return{type:"code",raw:Y,lang:X[2]?X[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):X[2],text:W}}}heading($){let X=this.rules.block.heading.exec($);if(X){let Y=X[2].trim();if(/#$/.test(Y)){let W=_2(Y,"#");if(this.options.pedantic)Y=W.trim();else if(!W||/ $/.test(W))Y=W.trim()}return{type:"heading",raw:X[0],depth:X[1].length,text:Y,tokens:this.lexer.inline(Y)}}}hr($){let X=this.rules.block.hr.exec($);if(X)return{type:"hr",raw:X[0]}}blockquote($){let X=this.rules.block.blockquote.exec($);if(X){let Y=X[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
57
- $1`);Y=_2(Y.replace(/^ *>[ \t]?/gm,""),`
58
- `);let W=this.lexer.state.top;this.lexer.state.top=!0;let J=this.lexer.blockTokens(Y);return this.lexer.state.top=W,{type:"blockquote",raw:X[0],tokens:J,text:Y}}}list($){let X=this.rules.block.list.exec($);if(X){let Y=X[1].trim(),W=Y.length>1,J={type:"list",raw:"",ordered:W,start:W?+Y.slice(0,-1):"",loose:!1,items:[]};if(Y=W?`\\d{1,9}\\${Y.slice(-1)}`:`\\${Y}`,this.options.pedantic)Y=W?Y:"[*+-]";let U=new RegExp(`^( {0,3}${Y})((?:[ ][^\\n]*)?(?:\\n|$))`),H="",D="",V=!1;while($){let K=!1;if(!(X=U.exec($)))break;if(this.rules.block.hr.test($))break;H=X[0],$=$.substring(H.length);let Q=X[2].split(`
59
- `,1)[0].replace(/^\t+/,(N)=>" ".repeat(3*N.length)),q=$.split(`
60
- `,1)[0],F=0;if(this.options.pedantic)F=2,D=Q.trimStart();else F=X[2].search(/[^ ]/),F=F>4?1:F,D=Q.slice(F),F+=X[1].length;let w=!1;if(!Q&&/^ *$/.test(q))H+=q+`
61
- `,$=$.substring(q.length+1),K=!0;if(!K){let N=new RegExp(`^ {0,${Math.min(3,F-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),L=new RegExp(`^ {0,${Math.min(3,F-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),P=new RegExp(`^ {0,${Math.min(3,F-1)}}(?:\`\`\`|~~~)`),j=new RegExp(`^ {0,${Math.min(3,F-1)}}#`);while($){let v=$.split(`
62
- `,1)[0];if(q=v,this.options.pedantic)q=q.replace(/^ {1,4}(?=( {4})*[^ ])/g," ");if(P.test(q))break;if(j.test(q))break;if(N.test(q))break;if(L.test($))break;if(q.search(/[^ ]/)>=F||!q.trim())D+=`
63
- `+q.slice(F);else{if(w)break;if(Q.search(/[^ ]/)>=4)break;if(P.test(Q))break;if(j.test(Q))break;if(L.test(Q))break;D+=`
64
- `+q}if(!w&&!q.trim())w=!0;H+=v+`
65
- `,$=$.substring(v.length+1),Q=q.slice(F)}}if(!J.loose){if(V)J.loose=!0;else if(/\n *\n *$/.test(H))V=!0}let z=null,O;if(this.options.gfm){if(z=/^\[[ xX]\] /.exec(D),z)O=z[0]!=="[ ] ",D=D.replace(/^\[[ xX]\] +/,"")}J.items.push({type:"list_item",raw:H,task:!!z,checked:O,loose:!1,text:D,tokens:[]}),J.raw+=H}J.items[J.items.length-1].raw=H.trimEnd(),J.items[J.items.length-1].text=D.trimEnd(),J.raw=J.raw.trimEnd();for(let K=0;K<J.items.length;K++)if(this.lexer.state.top=!1,J.items[K].tokens=this.lexer.blockTokens(J.items[K].text,[]),!J.loose){let Q=J.items[K].tokens.filter((F)=>F.type==="space"),q=Q.length>0&&Q.some((F)=>/\n.*\n/.test(F.raw));J.loose=q}if(J.loose)for(let K=0;K<J.items.length;K++)J.items[K].loose=!0;return J}}html($){let X=this.rules.block.html.exec($);if(X)return{type:"html",block:!0,raw:X[0],pre:X[1]==="pre"||X[1]==="script"||X[1]==="style",text:X[0]}}def($){let X=this.rules.block.def.exec($);if(X){let Y=X[1].toLowerCase().replace(/\s+/g," "),W=X[2]?X[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",J=X[3]?X[3].substring(1,X[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):X[3];return{type:"def",tag:Y,raw:X[0],href:W,title:J}}}table($){let X=this.rules.block.table.exec($);if(!X)return;if(!/[:|]/.test(X[2]))return;let Y=bB(X[1]),W=X[2].replace(/^\||\| *$/g,"").split("|"),J=X[3]&&X[3].trim()?X[3].replace(/\n[ \t]*$/,"").split(`
66
- `):[],U={type:"table",raw:X[0],header:[],align:[],rows:[]};if(Y.length!==W.length)return;for(let H of W)if(/^ *-+: *$/.test(H))U.align.push("right");else if(/^ *:-+: *$/.test(H))U.align.push("center");else if(/^ *:-+ *$/.test(H))U.align.push("left");else U.align.push(null);for(let H of Y)U.header.push({text:H,tokens:this.lexer.inline(H)});for(let H of J)U.rows.push(bB(H,U.header.length).map((D)=>{return{text:D,tokens:this.lexer.inline(D)}}));return U}lheading($){let X=this.rules.block.lheading.exec($);if(X)return{type:"heading",raw:X[0],depth:X[2].charAt(0)==="="?1:2,text:X[1],tokens:this.lexer.inline(X[1])}}paragraph($){let X=this.rules.block.paragraph.exec($);if(X){let Y=X[1].charAt(X[1].length-1)===`
67
- `?X[1].slice(0,-1):X[1];return{type:"paragraph",raw:X[0],text:Y,tokens:this.lexer.inline(Y)}}}text($){let X=this.rules.block.text.exec($);if(X)return{type:"text",raw:X[0],text:X[0],tokens:this.lexer.inline(X[0])}}escape($){let X=this.rules.inline.escape.exec($);if(X)return{type:"escape",raw:X[0],text:q1(X[1])}}tag($){let X=this.rules.inline.tag.exec($);if(X){if(!this.lexer.state.inLink&&/^<a /i.test(X[0]))this.lexer.state.inLink=!0;else if(this.lexer.state.inLink&&/^<\/a>/i.test(X[0]))this.lexer.state.inLink=!1;if(!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(X[0]))this.lexer.state.inRawBlock=!0;else if(this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(X[0]))this.lexer.state.inRawBlock=!1;return{type:"html",raw:X[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:X[0]}}}link($){let X=this.rules.inline.link.exec($);if(X){let Y=X[2].trim();if(!this.options.pedantic&&/^</.test(Y)){if(!/>$/.test(Y))return;let U=_2(Y.slice(0,-1),"\\");if((Y.length-U.length)%2===0)return}else{let U=kr(X[2],"()");if(U>-1){let D=(X[0].indexOf("!")===0?5:4)+X[1].length+U;X[2]=X[2].substring(0,U),X[0]=X[0].substring(0,D).trim(),X[3]=""}}let W=X[2],J="";if(this.options.pedantic){let U=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(W);if(U)W=U[1],J=U[3]}else J=X[3]?X[3].slice(1,-1):"";if(W=W.trim(),/^</.test(W))if(this.options.pedantic&&!/>$/.test(Y))W=W.slice(1);else W=W.slice(1,-1);return xB(X,{href:W?W.replace(this.rules.inline.anyPunctuation,"$1"):W,title:J?J.replace(this.rules.inline.anyPunctuation,"$1"):J},X[0],this.lexer)}}reflink($,X){let Y;if((Y=this.rules.inline.reflink.exec($))||(Y=this.rules.inline.nolink.exec($))){let W=(Y[2]||Y[1]).replace(/\s+/g," "),J=X[W.toLowerCase()];if(!J){let U=Y[0].charAt(0);return{type:"text",raw:U,text:U}}return xB(Y,J,Y[0],this.lexer)}}emStrong($,X,Y=""){let W=this.rules.inline.emStrongLDelim.exec($);if(!W)return;if(W[3]&&Y.match(/[\p{L}\p{N}]/u))return;if(!(W[1]||W[2])||!Y||this.rules.inline.punctuation.exec(Y)){let U=[...W[0]].length-1,H,D,V=U,K=0,Q=W[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;Q.lastIndex=0,X=X.slice(-1*$.length+U);while((W=Q.exec(X))!=null){if(H=W[1]||W[2]||W[3]||W[4]||W[5]||W[6],!H)continue;if(D=[...H].length,W[3]||W[4]){V+=D;continue}else if(W[5]||W[6]){if(U%3&&!((U+D)%3)){K+=D;continue}}if(V-=D,V>0)continue;D=Math.min(D,D+V+K);let q=[...W[0]][0].length,F=$.slice(0,U+W.index+q+D);if(Math.min(U,D)%2){let z=F.slice(1,-1);return{type:"em",raw:F,text:z,tokens:this.lexer.inlineTokens(z)}}let w=F.slice(2,-2);return{type:"strong",raw:F,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan($){let X=this.rules.inline.code.exec($);if(X){let Y=X[2].replace(/\n/g," "),W=/[^ ]/.test(Y),J=/^ /.test(Y)&&/ $/.test(Y);if(W&&J)Y=Y.substring(1,Y.length-1);return Y=q1(Y,!0),{type:"codespan",raw:X[0],text:Y}}}br($){let X=this.rules.inline.br.exec($);if(X)return{type:"br",raw:X[0]}}del($){let X=this.rules.inline.del.exec($);if(X)return{type:"del",raw:X[0],text:X[2],tokens:this.lexer.inlineTokens(X[2])}}autolink($){let X=this.rules.inline.autolink.exec($);if(X){let Y,W;if(X[2]==="@")Y=q1(X[1]),W="mailto:"+Y;else Y=q1(X[1]),W=Y;return{type:"link",raw:X[0],text:Y,href:W,tokens:[{type:"text",raw:Y,text:Y}]}}}url($){let X;if(X=this.rules.inline.url.exec($)){let Y,W;if(X[2]==="@")Y=q1(X[0]),W="mailto:"+Y;else{let J;do J=X[0],X[0]=this.rules.inline._backpedal.exec(X[0])?.[0]??"";while(J!==X[0]);if(Y=q1(X[0]),X[1]==="www.")W="http://"+X[0];else W=X[0]}return{type:"link",raw:X[0],text:Y,href:W,tokens:[{type:"text",raw:Y,text:Y}]}}}inlineText($){let X=this.rules.inline.text.exec($);if(X){let Y;if(this.lexer.state.inRawBlock)Y=X[0];else Y=q1(X[0]);return{type:"text",raw:X[0],text:Y}}}}class P0{tokens;options;state;tokenizer;inlineQueue;constructor($){this.tokens=[],this.tokens.links=Object.create(null),this.options=$||N9,this.options.tokenizer=this.options.tokenizer||new h7,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let X={block:T2.normal,inline:x7.normal};if(this.options.pedantic)X.block=T2.pedantic,X.inline=x7.pedantic;else if(this.options.gfm)if(X.block=T2.gfm,this.options.breaks)X.inline=x7.breaks;else X.inline=x7.gfm;this.tokenizer.rules=X}static get rules(){return{block:T2,inline:x7}}static lex($,X){return new P0(X).lex($)}static lexInline($,X){return new P0(X).inlineTokens($)}lex($){$=$.replace(/\r\n|\r/g,`
68
- `),this.blockTokens($,this.tokens);for(let X=0;X<this.inlineQueue.length;X++){let Y=this.inlineQueue[X];this.inlineTokens(Y.src,Y.tokens)}return this.inlineQueue=[],this.tokens}blockTokens($,X=[]){if(this.options.pedantic)$=$.replace(/\t/g," ").replace(/^ +$/gm,"");else $=$.replace(/^( *)(\t+)/gm,(H,D,V)=>{return D+" ".repeat(V.length)});let Y,W,J,U;while($){if(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((H)=>{if(Y=H.call({lexer:this},$,X))return $=$.substring(Y.raw.length),X.push(Y),!0;return!1}))continue;if(Y=this.tokenizer.space($)){if($=$.substring(Y.raw.length),Y.raw.length===1&&X.length>0)X[X.length-1].raw+=`
69
- `;else X.push(Y);continue}if(Y=this.tokenizer.code($)){if($=$.substring(Y.raw.length),W=X[X.length-1],W&&(W.type==="paragraph"||W.type==="text"))W.raw+=`
70
- `+Y.raw,W.text+=`
71
- `+Y.text,this.inlineQueue[this.inlineQueue.length-1].src=W.text;else X.push(Y);continue}if(Y=this.tokenizer.fences($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.heading($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.hr($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.blockquote($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.list($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.html($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.def($)){if($=$.substring(Y.raw.length),W=X[X.length-1],W&&(W.type==="paragraph"||W.type==="text"))W.raw+=`
72
- `+Y.raw,W.text+=`
73
- `+Y.raw,this.inlineQueue[this.inlineQueue.length-1].src=W.text;else if(!this.tokens.links[Y.tag])this.tokens.links[Y.tag]={href:Y.href,title:Y.title};continue}if(Y=this.tokenizer.table($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.lheading($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(J=$,this.options.extensions&&this.options.extensions.startBlock){let H=1/0,D=$.slice(1),V;if(this.options.extensions.startBlock.forEach((K)=>{if(V=K.call({lexer:this},D),typeof V==="number"&&V>=0)H=Math.min(H,V)}),H<1/0&&H>=0)J=$.substring(0,H+1)}if(this.state.top&&(Y=this.tokenizer.paragraph(J))){if(W=X[X.length-1],U&&W.type==="paragraph")W.raw+=`
74
- `+Y.raw,W.text+=`
75
- `+Y.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=W.text;else X.push(Y);U=J.length!==$.length,$=$.substring(Y.raw.length);continue}if(Y=this.tokenizer.text($)){if($=$.substring(Y.raw.length),W=X[X.length-1],W&&W.type==="text")W.raw+=`
76
- `+Y.raw,W.text+=`
77
- `+Y.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=W.text;else X.push(Y);continue}if($){let H="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(H);break}else throw Error(H)}}return this.state.top=!0,X}inline($,X=[]){return this.inlineQueue.push({src:$,tokens:X}),X}inlineTokens($,X=[]){let Y,W,J,U=$,H,D,V;if(this.tokens.links){let K=Object.keys(this.tokens.links);if(K.length>0){while((H=this.tokenizer.rules.inline.reflinkSearch.exec(U))!=null)if(K.includes(H[0].slice(H[0].lastIndexOf("[")+1,-1)))U=U.slice(0,H.index)+"["+"a".repeat(H[0].length-2)+"]"+U.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)}}while((H=this.tokenizer.rules.inline.blockSkip.exec(U))!=null)U=U.slice(0,H.index)+"["+"a".repeat(H[0].length-2)+"]"+U.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);while((H=this.tokenizer.rules.inline.anyPunctuation.exec(U))!=null)U=U.slice(0,H.index)+"++"+U.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);while($){if(!D)V="";if(D=!1,this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((K)=>{if(Y=K.call({lexer:this},$,X))return $=$.substring(Y.raw.length),X.push(Y),!0;return!1}))continue;if(Y=this.tokenizer.escape($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.tag($)){if($=$.substring(Y.raw.length),W=X[X.length-1],W&&Y.type==="text"&&W.type==="text")W.raw+=Y.raw,W.text+=Y.text;else X.push(Y);continue}if(Y=this.tokenizer.link($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.reflink($,this.tokens.links)){if($=$.substring(Y.raw.length),W=X[X.length-1],W&&Y.type==="text"&&W.type==="text")W.raw+=Y.raw,W.text+=Y.text;else X.push(Y);continue}if(Y=this.tokenizer.emStrong($,U,V)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.codespan($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.br($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.del($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(Y=this.tokenizer.autolink($)){$=$.substring(Y.raw.length),X.push(Y);continue}if(!this.state.inLink&&(Y=this.tokenizer.url($))){$=$.substring(Y.raw.length),X.push(Y);continue}if(J=$,this.options.extensions&&this.options.extensions.startInline){let K=1/0,Q=$.slice(1),q;if(this.options.extensions.startInline.forEach((F)=>{if(q=F.call({lexer:this},Q),typeof q==="number"&&q>=0)K=Math.min(K,q)}),K<1/0&&K>=0)J=$.substring(0,K+1)}if(Y=this.tokenizer.inlineText(J)){if($=$.substring(Y.raw.length),Y.raw.slice(-1)!=="_")V=Y.raw.slice(-1);if(D=!0,W=X[X.length-1],W&&W.type==="text")W.raw+=Y.raw,W.text+=Y.text;else X.push(Y);continue}if($){let K="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(K);break}else throw Error(K)}}return X}}class y7{options;constructor($){this.options=$||N9}code($,X,Y){let W=(X||"").match(/^\S*/)?.[0];if($=$.replace(/\n$/,"")+`
78
- `,!W)return"<pre><code>"+(Y?$:q1($,!0))+`</code></pre>
79
- `;return'<pre><code class="language-'+q1(W)+'">'+(Y?$:q1($,!0))+`</code></pre>
80
- `}blockquote($){return`<blockquote>
81
- ${$}</blockquote>
82
- `}html($,X){return $}heading($,X,Y){return`<h${X}>${$}</h${X}>
83
- `}hr(){return`<hr>
84
- `}list($,X,Y){let W=X?"ol":"ul",J=X&&Y!==1?' start="'+Y+'"':"";return"<"+W+J+`>
85
- `+$+"</"+W+`>
86
- `}listitem($,X,Y){return`<li>${$}</li>
87
- `}checkbox($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph($){return`<p>${$}</p>
88
- `}table($,X){if(X)X=`<tbody>${X}</tbody>`;return`<table>
89
- <thead>
90
- `+$+`</thead>
91
- `+X+`</table>
92
- `}tablerow($){return`<tr>
93
- ${$}</tr>
94
- `}tablecell($,X){let Y=X.header?"th":"td";return(X.align?`<${Y} align="${X.align}">`:`<${Y}>`)+$+`</${Y}>
95
- `}strong($){return`<strong>${$}</strong>`}em($){return`<em>${$}</em>`}codespan($){return`<code>${$}</code>`}br(){return"<br>"}del($){return`<del>${$}</del>`}link($,X,Y){let W=SB($);if(W===null)return Y;$=W;let J='<a href="'+$+'"';if(X)J+=' title="'+X+'"';return J+=">"+Y+"</a>",J}image($,X,Y){let W=SB($);if(W===null)return Y;$=W;let J=`<img src="${$}" alt="${Y}"`;if(X)J+=` title="${X}"`;return J+=">",J}text($){return $}}class b2{strong($){return $}em($){return $}codespan($){return $}del($){return $}html($){return $}text($){return $}link($,X,Y){return""+Y}image($,X,Y){return""+Y}br(){return""}}class I0{options;renderer;textRenderer;constructor($){this.options=$||N9,this.options.renderer=this.options.renderer||new y7,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new b2}static parse($,X){return new I0(X).parse($)}static parseInline($,X){return new I0(X).parseInline($)}parse($,X=!0){let Y="";for(let W=0;W<$.length;W++){let J=$[W];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[J.type]){let U=J,H=this.options.extensions.renderers[U.type].call({parser:this},U);if(H!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(U.type)){Y+=H||"";continue}}switch(J.type){case"space":continue;case"hr":{Y+=this.renderer.hr();continue}case"heading":{let U=J;Y+=this.renderer.heading(this.parseInline(U.tokens),U.depth,br(this.parseInline(U.tokens,this.textRenderer)));continue}case"code":{let U=J;Y+=this.renderer.code(U.text,U.lang,!!U.escaped);continue}case"table":{let U=J,H="",D="";for(let K=0;K<U.header.length;K++)D+=this.renderer.tablecell(this.parseInline(U.header[K].tokens),{header:!0,align:U.align[K]});H+=this.renderer.tablerow(D);let V="";for(let K=0;K<U.rows.length;K++){let Q=U.rows[K];D="";for(let q=0;q<Q.length;q++)D+=this.renderer.tablecell(this.parseInline(Q[q].tokens),{header:!1,align:U.align[q]});V+=this.renderer.tablerow(D)}Y+=this.renderer.table(H,V);continue}case"blockquote":{let U=J,H=this.parse(U.tokens);Y+=this.renderer.blockquote(H);continue}case"list":{let U=J,H=U.ordered,D=U.start,V=U.loose,K="";for(let Q=0;Q<U.items.length;Q++){let q=U.items[Q],F=q.checked,w=q.task,z="";if(q.task){let O=this.renderer.checkbox(!!F);if(V)if(q.tokens.length>0&&q.tokens[0].type==="paragraph"){if(q.tokens[0].text=O+" "+q.tokens[0].text,q.tokens[0].tokens&&q.tokens[0].tokens.length>0&&q.tokens[0].tokens[0].type==="text")q.tokens[0].tokens[0].text=O+" "+q.tokens[0].tokens[0].text}else q.tokens.unshift({type:"text",text:O+" "});else z+=O+" "}z+=this.parse(q.tokens,V),K+=this.renderer.listitem(z,w,!!F)}Y+=this.renderer.list(K,H,D);continue}case"html":{let U=J;Y+=this.renderer.html(U.text,U.block);continue}case"paragraph":{let U=J;Y+=this.renderer.paragraph(this.parseInline(U.tokens));continue}case"text":{let U=J,H=U.tokens?this.parseInline(U.tokens):U.text;while(W+1<$.length&&$[W+1].type==="text")U=$[++W],H+=`
96
- `+(U.tokens?this.parseInline(U.tokens):U.text);Y+=X?this.renderer.paragraph(H):H;continue}default:{let U='Token with "'+J.type+'" type was not found.';if(this.options.silent)return console.error(U),"";else throw Error(U)}}}return Y}parseInline($,X){X=X||this.renderer;let Y="";for(let W=0;W<$.length;W++){let J=$[W];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[J.type]){let U=this.options.extensions.renderers[J.type].call({parser:this},J);if(U!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(J.type)){Y+=U||"";continue}}switch(J.type){case"escape":{let U=J;Y+=X.text(U.text);break}case"html":{let U=J;Y+=X.html(U.text);break}case"link":{let U=J;Y+=X.link(U.href,U.title,this.parseInline(U.tokens,X));break}case"image":{let U=J;Y+=X.image(U.href,U.title,U.text);break}case"strong":{let U=J;Y+=X.strong(this.parseInline(U.tokens,X));break}case"em":{let U=J;Y+=X.em(this.parseInline(U.tokens,X));break}case"codespan":{let U=J;Y+=X.codespan(U.text);break}case"br":{Y+=X.br();break}case"del":{let U=J;Y+=X.del(this.parseInline(U.tokens,X));break}case"text":{let U=J;Y+=X.text(U.text);break}default:{let U='Token with "'+J.type+'" type was not found.';if(this.options.silent)return console.error(U),"";else throw Error(U)}}}return Y}}class x2{defaults=lH();options=this.setOptions;parse=this.#$(P0.lex,I0.parse);parseInline=this.#$(P0.lexInline,I0.parseInline);Parser=I0;Renderer=y7;TextRenderer=b2;Lexer=P0;Tokenizer=h7;Hooks=v7;constructor(...$){this.use(...$)}walkTokens($,X){let Y=[];for(let W of $)switch(Y=Y.concat(X.call(this,W)),W.type){case"table":{let J=W;for(let U of J.header)Y=Y.concat(this.walkTokens(U.tokens,X));for(let U of J.rows)for(let H of U)Y=Y.concat(this.walkTokens(H.tokens,X));break}case"list":{let J=W;Y=Y.concat(this.walkTokens(J.items,X));break}default:{let J=W;if(this.defaults.extensions?.childTokens?.[J.type])this.defaults.extensions.childTokens[J.type].forEach((U)=>{let H=J[U].flat(1/0);Y=Y.concat(this.walkTokens(H,X))});else if(J.tokens)Y=Y.concat(this.walkTokens(J.tokens,X))}}return Y}use(...$){let X=this.defaults.extensions||{renderers:{},childTokens:{}};return $.forEach((Y)=>{let W={...Y};if(W.async=this.defaults.async||W.async||!1,Y.extensions)Y.extensions.forEach((J)=>{if(!J.name)throw Error("extension name required");if("renderer"in J){let U=X.renderers[J.name];if(U)X.renderers[J.name]=function(...H){let D=J.renderer.apply(this,H);if(D===!1)D=U.apply(this,H);return D};else X.renderers[J.name]=J.renderer}if("tokenizer"in J){if(!J.level||J.level!=="block"&&J.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let U=X[J.level];if(U)U.unshift(J.tokenizer);else X[J.level]=[J.tokenizer];if(J.start){if(J.level==="block")if(X.startBlock)X.startBlock.push(J.start);else X.startBlock=[J.start];else if(J.level==="inline")if(X.startInline)X.startInline.push(J.start);else X.startInline=[J.start]}}if("childTokens"in J&&J.childTokens)X.childTokens[J.name]=J.childTokens}),W.extensions=X;if(Y.renderer){let J=this.defaults.renderer||new y7(this.defaults);for(let U in Y.renderer){if(!(U in J))throw Error(`renderer '${U}' does not exist`);if(U==="options")continue;let H=U,D=Y.renderer[H],V=J[H];J[H]=(...K)=>{let Q=D.apply(J,K);if(Q===!1)Q=V.apply(J,K);return Q||""}}W.renderer=J}if(Y.tokenizer){let J=this.defaults.tokenizer||new h7(this.defaults);for(let U in Y.tokenizer){if(!(U in J))throw Error(`tokenizer '${U}' does not exist`);if(["options","rules","lexer"].includes(U))continue;let H=U,D=Y.tokenizer[H],V=J[H];J[H]=(...K)=>{let Q=D.apply(J,K);if(Q===!1)Q=V.apply(J,K);return Q}}W.tokenizer=J}if(Y.hooks){let J=this.defaults.hooks||new v7;for(let U in Y.hooks){if(!(U in J))throw Error(`hook '${U}' does not exist`);if(U==="options")continue;let H=U,D=Y.hooks[H],V=J[H];if(v7.passThroughHooks.has(U))J[H]=(K)=>{if(this.defaults.async)return Promise.resolve(D.call(J,K)).then((q)=>{return V.call(J,q)});let Q=D.call(J,K);return V.call(J,Q)};else J[H]=(...K)=>{let Q=D.apply(J,K);if(Q===!1)Q=V.apply(J,K);return Q}}W.hooks=J}if(Y.walkTokens){let J=this.defaults.walkTokens,U=Y.walkTokens;W.walkTokens=function(H){let D=[];if(D.push(U.call(this,H)),J)D=D.concat(J.call(this,H));return D}}this.defaults={...this.defaults,...W}}),this}setOptions($){return this.defaults={...this.defaults,...$},this}lexer($,X){return P0.lex($,X??this.defaults)}parser($,X){return I0.parse($,X??this.defaults)}#$($,X){return(Y,W)=>{let J={...W},U={...this.defaults,...J};if(this.defaults.async===!0&&J.async===!1){if(!U.silent)console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.");U.async=!0}let H=this.#X(!!U.silent,!!U.async);if(typeof Y>"u"||Y===null)return H(Error("marked(): input parameter is undefined or null"));if(typeof Y!=="string")return H(Error("marked(): input parameter is of type "+Object.prototype.toString.call(Y)+", string expected"));if(U.hooks)U.hooks.options=U;if(U.async)return Promise.resolve(U.hooks?U.hooks.preprocess(Y):Y).then((D)=>$(D,U)).then((D)=>U.hooks?U.hooks.processAllTokens(D):D).then((D)=>U.walkTokens?Promise.all(this.walkTokens(D,U.walkTokens)).then(()=>D):D).then((D)=>X(D,U)).then((D)=>U.hooks?U.hooks.postprocess(D):D).catch(H);try{if(U.hooks)Y=U.hooks.preprocess(Y);let D=$(Y,U);if(U.hooks)D=U.hooks.processAllTokens(D);if(U.walkTokens)this.walkTokens(D,U.walkTokens);let V=X(D,U);if(U.hooks)V=U.hooks.postprocess(V);return V}catch(D){return H(D)}}}#X($,X){return(Y)=>{if(Y.message+=`
97
- Please report this to https://github.com/markedjs/marked.`,$){let W="<p>An error occurred:</p><pre>"+q1(Y.message+"",!0)+"</pre>";if(X)return Promise.resolve(W);return W}if(X)return Promise.reject(Y);throw Y}}}function v6($,X){return O9.parse($,X)}var N9,hB,_r,yB,Tr,Cr,CB=($)=>Cr[$],Sr,xr,k7,hr,yr,fr,f7,gr,fB,gB,iH,mr,rH,ur,pr,S2="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",nH,cr,mB,dr,oH,kB,lr,ir,uB,rr,pB,nr,g7="\\p{P}\\p{S}",or,ar,sr,tr,er,$n,Xn,Yn,Jn,C2,Wn,cB,dB,Un,aH,Gn,dH,Hn,T2,x7,v7,O9,kF$,vF$,hF$,yF$,fF$,gF$,mF$;var lB=A(()=>{N9=lH();hB=/[&<>"']/,_r=new RegExp(hB.source,"g"),yB=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Tr=new RegExp(yB.source,"g"),Cr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};Sr=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;xr=/(^|[^\[])\^/g;k7={exec:()=>null};hr=/^(?: *(?:\n|$))+/,yr=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,f7=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fB=/(?:[*+-]|\d{1,9}[.)])/,gB=h6(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,fB).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),iH=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,mr=/^[^\n]+/,rH=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ur=h6(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",rH).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pr=h6(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,fB).getRegex(),nH=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,cr=h6("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",nH).replace("tag",S2).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),mB=h6(iH).replace("hr",f7).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",S2).getRegex(),dr=h6(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",mB).getRegex(),oH={blockquote:dr,code:yr,def:ur,fences:fr,heading:gr,hr:f7,html:cr,lheading:gB,list:pr,newline:hr,paragraph:mB,table:k7,text:mr},kB=h6("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",f7).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",S2).getRegex(),lr={...oH,table:kB,paragraph:h6(iH).replace("hr",f7).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",kB).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",S2).getRegex()},ir={...oH,html:h6(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",nH).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:k7,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h6(iH).replace("hr",f7).replace("heading",` *#{1,6} *[^
98
- ]`).replace("lheading",gB).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},uB=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rr=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pB=/^( {2,}|\\)\n(?!\s*$)/,nr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,or=h6(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,g7).getRegex(),ar=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,sr=h6(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,g7).getRegex(),tr=h6("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,g7).getRegex(),er=h6("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,g7).getRegex(),$n=h6(/\\([punct])/,"gu").replace(/punct/g,g7).getRegex(),Xn=h6(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Yn=h6(nH).replace("(?:-->|$)","-->").getRegex(),Jn=h6("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Yn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),C2=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Wn=h6(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",C2).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),cB=h6(/^!?\[(label)\]\[(ref)\]/).replace("label",C2).replace("ref",rH).getRegex(),dB=h6(/^!?\[(ref)\](?:\[\])?/).replace("ref",rH).getRegex(),Un=h6("reflink|nolink(?!\\()","g").replace("reflink",cB).replace("nolink",dB).getRegex(),aH={_backpedal:k7,anyPunctuation:$n,autolink:Xn,blockSkip:ar,br:pB,code:rr,del:k7,emStrongLDelim:sr,emStrongRDelimAst:tr,emStrongRDelimUnd:er,escape:uB,link:Wn,nolink:dB,punctuation:or,reflink:cB,reflinkSearch:Un,tag:Jn,text:nr,url:k7},Gn={...aH,link:h6(/^!?\[(label)\]\((.*?)\)/).replace("label",C2).getRegex(),reflink:h6(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",C2).getRegex()},dH={...aH,escape:h6(uB).replace("])","~|])").getRegex(),url:h6(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Hn={...dH,br:h6(pB).replace("{2,}","*").getRegex(),text:h6(dH.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},T2={normal:oH,gfm:lr,pedantic:ir},x7={normal:aH,gfm:dH,breaks:Hn,pedantic:Gn};v7=class v7{options;constructor($){this.options=$||N9}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess($){return $}postprocess($){return $}processAllTokens($){return $}};O9=new x2;v6.options=v6.setOptions=function($){return O9.setOptions($),v6.defaults=O9.defaults,vB(v6.defaults),v6};v6.getDefaults=lH;v6.defaults=N9;v6.use=function(...$){return O9.use(...$),v6.defaults=O9.defaults,vB(v6.defaults),v6};v6.walkTokens=function($,X){return O9.walkTokens($,X)};v6.parseInline=O9.parseInline;v6.Parser=I0;v6.parser=I0.parse;v6.Renderer=y7;v6.TextRenderer=b2;v6.Lexer=P0;v6.lexer=P0.lex;v6.Tokenizer=h7;v6.Hooks=v7;v6.parse=v6;kF$=v6.options,vF$=v6.setOptions,hF$=v6.use,yF$=v6.walkTokens,fF$=v6.parseInline,gF$=I0.parse,mF$=P0.lex});var iB=()=>{};function x($,X){Dn(Boolean($),!1,!0,"ok","Expected value to be truthy",X)}function Dn($,X,Y,W,J,U){if(!$)throw U instanceof Error?U:new rB(U||J,X,Y,W,!U)}var rB;var P6=A(()=>{iB();rB=class rB extends Error{name="Assertion";code="ERR_ASSERTION";constructor($,X,Y,W,J){super($);if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);this.actual=X,this.expected=Y,this.generated=J,this.operator=W}}});function W8($,X){let Y=X||Vn,W=typeof Y.includeImageAlt==="boolean"?Y.includeImageAlt:!0,J=typeof Y.includeHtml==="boolean"?Y.includeHtml:!0;return oB($,W,J)}function oB($,X,Y){if(Kn($)){if("value"in $)return $.type==="html"&&!Y?"":$.value;if(X&&"alt"in $&&$.alt)return $.alt;if("children"in $)return nB($.children,X,Y)}if(Array.isArray($))return nB($,X,Y);return""}function nB($,X,Y){let W=[],J=-1;while(++J<$.length)W[J]=oB($[J],X,Y);return W.join("")}function Kn($){return Boolean($&&typeof $==="object")}var Vn;var aB=A(()=>{Vn={}});var m7=A(()=>{aB()});var sH;var sB=A(()=>{sH={AElig:"\xC6",AMP:"&",Aacute:"\xC1",Abreve:"\u0102",Acirc:"\xC2",Acy:"\u0410",Afr:"\uD835\uDD04",Agrave:"\xC0",Alpha:"\u0391",Amacr:"\u0100",And:"\u2A53",Aogon:"\u0104",Aopf:"\uD835\uDD38",ApplyFunction:"\u2061",Aring:"\xC5",Ascr:"\uD835\uDC9C",Assign:"\u2254",Atilde:"\xC3",Auml:"\xC4",Backslash:"\u2216",Barv:"\u2AE7",Barwed:"\u2306",Bcy:"\u0411",Because:"\u2235",Bernoullis:"\u212C",Beta:"\u0392",Bfr:"\uD835\uDD05",Bopf:"\uD835\uDD39",Breve:"\u02D8",Bscr:"\u212C",Bumpeq:"\u224E",CHcy:"\u0427",COPY:"\xA9",Cacute:"\u0106",Cap:"\u22D2",CapitalDifferentialD:"\u2145",Cayleys:"\u212D",Ccaron:"\u010C",Ccedil:"\xC7",Ccirc:"\u0108",Cconint:"\u2230",Cdot:"\u010A",Cedilla:"\xB8",CenterDot:"\xB7",Cfr:"\u212D",Chi:"\u03A7",CircleDot:"\u2299",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",Colon:"\u2237",Colone:"\u2A74",Congruent:"\u2261",Conint:"\u222F",ContourIntegral:"\u222E",Copf:"\u2102",Coproduct:"\u2210",CounterClockwiseContourIntegral:"\u2233",Cross:"\u2A2F",Cscr:"\uD835\uDC9E",Cup:"\u22D3",CupCap:"\u224D",DD:"\u2145",DDotrahd:"\u2911",DJcy:"\u0402",DScy:"\u0405",DZcy:"\u040F",Dagger:"\u2021",Darr:"\u21A1",Dashv:"\u2AE4",Dcaron:"\u010E",Dcy:"\u0414",Del:"\u2207",Delta:"\u0394",Dfr:"\uD835\uDD07",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",Diamond:"\u22C4",DifferentialD:"\u2146",Dopf:"\uD835\uDD3B",Dot:"\xA8",DotDot:"\u20DC",DotEqual:"\u2250",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",Downarrow:"\u21D3",Dscr:"\uD835\uDC9F",Dstrok:"\u0110",ENG:"\u014A",ETH:"\xD0",Eacute:"\xC9",Ecaron:"\u011A",Ecirc:"\xCA",Ecy:"\u042D",Edot:"\u0116",Efr:"\uD835\uDD08",Egrave:"\xC8",Element:"\u2208",Emacr:"\u0112",EmptySmallSquare:"\u25FB",EmptyVerySmallSquare:"\u25AB",Eogon:"\u0118",Eopf:"\uD835\uDD3C",Epsilon:"\u0395",Equal:"\u2A75",EqualTilde:"\u2242",Equilibrium:"\u21CC",Escr:"\u2130",Esim:"\u2A73",Eta:"\u0397",Euml:"\xCB",Exists:"\u2203",ExponentialE:"\u2147",Fcy:"\u0424",Ffr:"\uD835\uDD09",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",Fopf:"\uD835\uDD3D",ForAll:"\u2200",Fouriertrf:"\u2131",Fscr:"\u2131",GJcy:"\u0403",GT:">",Gamma:"\u0393",Gammad:"\u03DC",Gbreve:"\u011E",Gcedil:"\u0122",Gcirc:"\u011C",Gcy:"\u0413",Gdot:"\u0120",Gfr:"\uD835\uDD0A",Gg:"\u22D9",Gopf:"\uD835\uDD3E",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\uD835\uDCA2",Gt:"\u226B",HARDcy:"\u042A",Hacek:"\u02C7",Hat:"^",Hcirc:"\u0124",Hfr:"\u210C",HilbertSpace:"\u210B",Hopf:"\u210D",HorizontalLine:"\u2500",Hscr:"\u210B",Hstrok:"\u0126",HumpDownHump:"\u224E",HumpEqual:"\u224F",IEcy:"\u0415",IJlig:"\u0132",IOcy:"\u0401",Iacute:"\xCD",Icirc:"\xCE",Icy:"\u0418",Idot:"\u0130",Ifr:"\u2111",Igrave:"\xCC",Im:"\u2111",Imacr:"\u012A",ImaginaryI:"\u2148",Implies:"\u21D2",Int:"\u222C",Integral:"\u222B",Intersection:"\u22C2",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",Iogon:"\u012E",Iopf:"\uD835\uDD40",Iota:"\u0399",Iscr:"\u2110",Itilde:"\u0128",Iukcy:"\u0406",Iuml:"\xCF",Jcirc:"\u0134",Jcy:"\u0419",Jfr:"\uD835\uDD0D",Jopf:"\uD835\uDD41",Jscr:"\uD835\uDCA5",Jsercy:"\u0408",Jukcy:"\u0404",KHcy:"\u0425",KJcy:"\u040C",Kappa:"\u039A",Kcedil:"\u0136",Kcy:"\u041A",Kfr:"\uD835\uDD0E",Kopf:"\uD835\uDD42",Kscr:"\uD835\uDCA6",LJcy:"\u0409",LT:"<",Lacute:"\u0139",Lambda:"\u039B",Lang:"\u27EA",Laplacetrf:"\u2112",Larr:"\u219E",Lcaron:"\u013D",Lcedil:"\u013B",Lcy:"\u041B",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",LeftRightArrow:"\u2194",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",Leftarrow:"\u21D0",Leftrightarrow:"\u21D4",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",LessLess:"\u2AA1",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",Lfr:"\uD835\uDD0F",Ll:"\u22D8",Lleftarrow:"\u21DA",Lmidot:"\u013F",LongLeftArrow:"\u27F5",LongLeftRightArrow:"\u27F7",LongRightArrow:"\u27F6",Longleftarrow:"\u27F8",Longleftrightarrow:"\u27FA",Longrightarrow:"\u27F9",Lopf:"\uD835\uDD43",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",Lscr:"\u2112",Lsh:"\u21B0",Lstrok:"\u0141",Lt:"\u226A",Map:"\u2905",Mcy:"\u041C",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\uD835\uDD10",MinusPlus:"\u2213",Mopf:"\uD835\uDD44",Mscr:"\u2133",Mu:"\u039C",NJcy:"\u040A",Nacute:"\u0143",Ncaron:"\u0147",Ncedil:"\u0145",Ncy:"\u041D",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
99
- `,Nfr:"\uD835\uDD11",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",Not:"\u2AEC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",Nscr:"\uD835\uDCA9",Ntilde:"\xD1",Nu:"\u039D",OElig:"\u0152",Oacute:"\xD3",Ocirc:"\xD4",Ocy:"\u041E",Odblac:"\u0150",Ofr:"\uD835\uDD12",Ograve:"\xD2",Omacr:"\u014C",Omega:"\u03A9",Omicron:"\u039F",Oopf:"\uD835\uDD46",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",Or:"\u2A54",Oscr:"\uD835\uDCAA",Oslash:"\xD8",Otilde:"\xD5",Otimes:"\u2A37",Ouml:"\xD6",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",PartialD:"\u2202",Pcy:"\u041F",Pfr:"\uD835\uDD13",Phi:"\u03A6",Pi:"\u03A0",PlusMinus:"\xB1",Poincareplane:"\u210C",Popf:"\u2119",Pr:"\u2ABB",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",Prime:"\u2033",Product:"\u220F",Proportion:"\u2237",Proportional:"\u221D",Pscr:"\uD835\uDCAB",Psi:"\u03A8",QUOT:'"',Qfr:"\uD835\uDD14",Qopf:"\u211A",Qscr:"\uD835\uDCAC",RBarr:"\u2910",REG:"\xAE",Racute:"\u0154",Rang:"\u27EB",Rarr:"\u21A0",Rarrtl:"\u2916",Rcaron:"\u0158",Rcedil:"\u0156",Rcy:"\u0420",Re:"\u211C",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",Rfr:"\u211C",Rho:"\u03A1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",Rightarrow:"\u21D2",Ropf:"\u211D",RoundImplies:"\u2970",Rrightarrow:"\u21DB",Rscr:"\u211B",Rsh:"\u21B1",RuleDelayed:"\u29F4",SHCHcy:"\u0429",SHcy:"\u0428",SOFTcy:"\u042C",Sacute:"\u015A",Sc:"\u2ABC",Scaron:"\u0160",Scedil:"\u015E",Scirc:"\u015C",Scy:"\u0421",Sfr:"\uD835\uDD16",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",Sigma:"\u03A3",SmallCircle:"\u2218",Sopf:"\uD835\uDD4A",Sqrt:"\u221A",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",Sscr:"\uD835\uDCAE",Star:"\u22C6",Sub:"\u22D0",Subset:"\u22D0",SubsetEqual:"\u2286",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",SuchThat:"\u220B",Sum:"\u2211",Sup:"\u22D1",Superset:"\u2283",SupersetEqual:"\u2287",Supset:"\u22D1",THORN:"\xDE",TRADE:"\u2122",TSHcy:"\u040B",TScy:"\u0426",Tab:"\t",Tau:"\u03A4",Tcaron:"\u0164",Tcedil:"\u0162",Tcy:"\u0422",Tfr:"\uD835\uDD17",Therefore:"\u2234",Theta:"\u0398",ThickSpace:"\u205F\u200A",ThinSpace:"\u2009",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",Topf:"\uD835\uDD4B",TripleDot:"\u20DB",Tscr:"\uD835\uDCAF",Tstrok:"\u0166",Uacute:"\xDA",Uarr:"\u219F",Uarrocir:"\u2949",Ubrcy:"\u040E",Ubreve:"\u016C",Ucirc:"\xDB",Ucy:"\u0423",Udblac:"\u0170",Ufr:"\uD835\uDD18",Ugrave:"\xD9",Umacr:"\u016A",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",Uopf:"\uD835\uDD4C",UpArrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",UpEquilibrium:"\u296E",UpTee:"\u22A5",UpTeeArrow:"\u21A5",Uparrow:"\u21D1",Updownarrow:"\u21D5",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",Upsilon:"\u03A5",Uring:"\u016E",Uscr:"\uD835\uDCB0",Utilde:"\u0168",Uuml:"\xDC",VDash:"\u22AB",Vbar:"\u2AEB",Vcy:"\u0412",Vdash:"\u22A9",Vdashl:"\u2AE6",Vee:"\u22C1",Verbar:"\u2016",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\uD835\uDD19",Vopf:"\uD835\uDD4D",Vscr:"\uD835\uDCB1",Vvdash:"\u22AA",Wcirc:"\u0174",Wedge:"\u22C0",Wfr:"\uD835\uDD1A",Wopf:"\uD835\uDD4E",Wscr:"\uD835\uDCB2",Xfr:"\uD835\uDD1B",Xi:"\u039E",Xopf:"\uD835\uDD4F",Xscr:"\uD835\uDCB3",YAcy:"\u042F",YIcy:"\u0407",YUcy:"\u042E",Yacute:"\xDD",Ycirc:"\u0176",Ycy:"\u042B",Yfr:"\uD835\uDD1C",Yopf:"\uD835\uDD50",Yscr:"\uD835\uDCB4",Yuml:"\u0178",ZHcy:"\u0416",Zacute:"\u0179",Zcaron:"\u017D",Zcy:"\u0417",Zdot:"\u017B",ZeroWidthSpace:"\u200B",Zeta:"\u0396",Zfr:"\u2128",Zopf:"\u2124",Zscr:"\uD835\uDCB5",aacute:"\xE1",abreve:"\u0103",ac:"\u223E",acE:"\u223E\u0333",acd:"\u223F",acirc:"\xE2",acute:"\xB4",acy:"\u0430",aelig:"\xE6",af:"\u2061",afr:"\uD835\uDD1E",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",alpha:"\u03B1",amacr:"\u0101",amalg:"\u2A3F",amp:"&",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",aogon:"\u0105",aopf:"\uD835\uDD52",ap:"\u2248",apE:"\u2A70",apacir:"\u2A6F",ape:"\u224A",apid:"\u224B",apos:"'",approx:"\u2248",approxeq:"\u224A",aring:"\xE5",ascr:"\uD835\uDCB6",ast:"*",asymp:"\u2248",asympeq:"\u224D",atilde:"\xE3",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",bNot:"\u2AED",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",barvee:"\u22BD",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",beta:"\u03B2",beth:"\u2136",between:"\u226C",bfr:"\uD835\uDD1F",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bnot:"\u2310",bopf:"\uD835\uDD53",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxDL:"\u2557",boxDR:"\u2554",boxDl:"\u2556",boxDr:"\u2553",boxH:"\u2550",boxHD:"\u2566",boxHU:"\u2569",boxHd:"\u2564",boxHu:"\u2567",boxUL:"\u255D",boxUR:"\u255A",boxUl:"\u255C",boxUr:"\u2559",boxV:"\u2551",boxVH:"\u256C",boxVL:"\u2563",boxVR:"\u2560",boxVh:"\u256B",boxVl:"\u2562",boxVr:"\u255F",boxbox:"\u29C9",boxdL:"\u2555",boxdR:"\u2552",boxdl:"\u2510",boxdr:"\u250C",boxh:"\u2500",boxhD:"\u2565",boxhU:"\u2568",boxhd:"\u252C",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxuL:"\u255B",boxuR:"\u2558",boxul:"\u2518",boxur:"\u2514",boxv:"\u2502",boxvH:"\u256A",boxvL:"\u2561",boxvR:"\u255E",boxvh:"\u253C",boxvl:"\u2524",boxvr:"\u251C",bprime:"\u2035",breve:"\u02D8",brvbar:"\xA6",bscr:"\uD835\uDCB7",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",bumpeq:"\u224F",cacute:"\u0107",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",ccaps:"\u2A4D",ccaron:"\u010D",ccedil:"\xE7",ccirc:"\u0109",ccups:"\u2A4C",ccupssm:"\u2A50",cdot:"\u010B",cedil:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",cfr:"\uD835\uDD20",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",chi:"\u03C7",cir:"\u25CB",cirE:"\u29C3",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledR:"\xAE",circledS:"\u24C8",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",clubs:"\u2663",clubsuit:"\u2663",colon:":",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",conint:"\u222E",copf:"\uD835\uDD54",coprod:"\u2210",copy:"\xA9",copysr:"\u2117",crarr:"\u21B5",cross:"\u2717",cscr:"\uD835\uDCB8",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cup:"\u222A",cupbrcap:"\u2A48",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",dArr:"\u21D3",dHar:"\u2965",dagger:"\u2020",daleth:"\u2138",darr:"\u2193",dash:"\u2010",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",dcaron:"\u010F",dcy:"\u0434",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",ddotseq:"\u2A77",deg:"\xB0",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",dfr:"\uD835\uDD21",dharl:"\u21C3",dharr:"\u21C2",diam:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",dopf:"\uD835\uDD55",dot:"\u02D9",doteq:"\u2250",doteqdot:"\u2251",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",downarrow:"\u2193",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",dscr:"\uD835\uDCB9",dscy:"\u0455",dsol:"\u29F6",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",dzcy:"\u045F",dzigrarr:"\u27FF",eDDot:"\u2A77",eDot:"\u2251",eacute:"\xE9",easter:"\u2A6E",ecaron:"\u011B",ecir:"\u2256",ecirc:"\xEA",ecolon:"\u2255",ecy:"\u044D",edot:"\u0117",ee:"\u2147",efDot:"\u2252",efr:"\uD835\uDD22",eg:"\u2A9A",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",emptyv:"\u2205",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",eng:"\u014B",ensp:"\u2002",eogon:"\u0119",eopf:"\uD835\uDD56",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",equals:"=",equest:"\u225F",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erDot:"\u2253",erarr:"\u2971",escr:"\u212F",esdot:"\u2250",esim:"\u2242",eta:"\u03B7",eth:"\xF0",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",expectation:"\u2130",exponentiale:"\u2147",fallingdotseq:"\u2252",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",ffr:"\uD835\uDD23",filig:"\uFB01",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",fopf:"\uD835\uDD57",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",fscr:"\uD835\uDCBB",gE:"\u2267",gEl:"\u2A8C",gacute:"\u01F5",gamma:"\u03B3",gammad:"\u03DD",gap:"\u2A86",gbreve:"\u011F",gcirc:"\u011D",gcy:"\u0433",gdot:"\u0121",ge:"\u2265",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",gfr:"\uD835\uDD24",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",gjcy:"\u0453",gl:"\u2277",glE:"\u2A92",gla:"\u2AA5",glj:"\u2AA4",gnE:"\u2269",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",gopf:"\uD835\uDD58",grave:"`",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",hArr:"\u21D4",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",hardcy:"\u044A",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",hbar:"\u210F",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",hfr:"\uD835\uDD25",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",hopf:"\uD835\uDD59",horbar:"\u2015",hscr:"\uD835\uDCBD",hslash:"\u210F",hstrok:"\u0127",hybull:"\u2043",hyphen:"\u2010",iacute:"\xED",ic:"\u2063",icirc:"\xEE",icy:"\u0438",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",ifr:"\uD835\uDD26",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",ijlig:"\u0133",imacr:"\u012B",image:"\u2111",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",int:"\u222B",intcal:"\u22BA",integers:"\u2124",intercal:"\u22BA",intlarhk:"\u2A17",intprod:"\u2A3C",iocy:"\u0451",iogon:"\u012F",iopf:"\uD835\uDD5A",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",iscr:"\uD835\uDCBE",isin:"\u2208",isinE:"\u22F9",isindot:"\u22F5",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",itilde:"\u0129",iukcy:"\u0456",iuml:"\xEF",jcirc:"\u0135",jcy:"\u0439",jfr:"\uD835\uDD27",jmath:"\u0237",jopf:"\uD835\uDD5B",jscr:"\uD835\uDCBF",jsercy:"\u0458",jukcy:"\u0454",kappa:"\u03BA",kappav:"\u03F0",kcedil:"\u0137",kcy:"\u043A",kfr:"\uD835\uDD28",kgreen:"\u0138",khcy:"\u0445",kjcy:"\u045C",kopf:"\uD835\uDD5C",kscr:"\uD835\uDCC0",lAarr:"\u21DA",lArr:"\u21D0",lAtail:"\u291B",lBarr:"\u290E",lE:"\u2266",lEg:"\u2A8B",lHar:"\u2962",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",lambda:"\u03BB",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",laquo:"\xAB",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",lcaron:"\u013E",lcedil:"\u013C",lceil:"\u2308",lcub:"{",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",leftarrow:"\u2190",leftarrowtail:"\u21A2",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",leftthreetimes:"\u22CB",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",lessgtr:"\u2276",lesssim:"\u2272",lfisht:"\u297C",lfloor:"\u230A",lfr:"\uD835\uDD29",lg:"\u2276",lgE:"\u2A91",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",ljcy:"\u0459",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",llhard:"\u296B",lltri:"\u25FA",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnE:"\u2268",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",lopf:"\uD835\uDD5D",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",lscr:"\uD835\uDCC1",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",lstrok:"\u0142",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltrPar:"\u2996",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",mDDot:"\u223A",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",mcy:"\u043C",mdash:"\u2014",measuredangle:"\u2221",mfr:"\uD835\uDD2A",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",mopf:"\uD835\uDD5E",mp:"\u2213",mscr:"\uD835\uDCC2",mstpos:"\u223E",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nGg:"\u22D9\u0338",nGt:"\u226B\u20D2",nGtv:"\u226B\u0338",nLeftarrow:"\u21CD",nLeftrightarrow:"\u21CE",nLl:"\u22D8\u0338",nLt:"\u226A\u20D2",nLtv:"\u226A\u0338",nRightarrow:"\u21CF",nVDash:"\u22AF",nVdash:"\u22AE",nabla:"\u2207",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",ncaron:"\u0148",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",neArr:"\u21D7",nearhk:"\u2924",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",nexist:"\u2204",nexists:"\u2204",nfr:"\uD835\uDD2B",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",ngsim:"\u2275",ngt:"\u226F",ngtr:"\u226F",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",njcy:"\u045A",nlArr:"\u21CD",nlE:"\u2266\u0338",nlarr:"\u219A",nldr:"\u2025",nle:"\u2270",nleftarrow:"\u219A",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nlsim:"\u2274",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nmid:"\u2224",nopf:"\uD835\uDD5F",not:"\xAC",notin:"\u2209",notinE:"\u22F9\u0338",notindot:"\u22F5\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",nscr:"\uD835\uDCC3",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvDash:"\u22AD",nvHarr:"\u2904",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwArr:"\u21D6",nwarhk:"\u2923",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",oS:"\u24C8",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",ocirc:"\xF4",ocy:"\u043E",odash:"\u229D",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",oelig:"\u0153",ofcir:"\u29BF",ofr:"\uD835\uDD2C",ogon:"\u02DB",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",omacr:"\u014D",omega:"\u03C9",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",oopf:"\uD835\uDD60",opar:"\u29B7",operp:"\u29B9",oplus:"\u2295",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oscr:"\u2134",oslash:"\xF8",osol:"\u2298",otilde:"\xF5",otimes:"\u2297",otimesas:"\u2A36",ouml:"\xF6",ovbar:"\u233D",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",pfr:"\uD835\uDD2D",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",pointint:"\u2A15",popf:"\uD835\uDD61",pound:"\xA3",pr:"\u227A",prE:"\u2AB3",prap:"\u2AB7",prcue:"\u227C",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",prime:"\u2032",primes:"\u2119",prnE:"\u2AB5",prnap:"\u2AB9",prnsim:"\u22E8",prod:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",pscr:"\uD835\uDCC5",psi:"\u03C8",puncsp:"\u2008",qfr:"\uD835\uDD2E",qint:"\u2A0C",qopf:"\uD835\uDD62",qprime:"\u2057",qscr:"\uD835\uDCC6",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',rAarr:"\u21DB",rArr:"\u21D2",rAtail:"\u291C",rBarr:"\u290F",rHar:"\u2964",race:"\u223D\u0331",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",rarrtl:"\u21A3",rarrw:"\u219D",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",rcaron:"\u0159",rcedil:"\u0157",rceil:"\u2309",rcub:"}",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",reg:"\xAE",rfisht:"\u297D",rfloor:"\u230B",rfr:"\uD835\uDD2F",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",rho:"\u03C1",rhov:"\u03F1",rightarrow:"\u2192",rightarrowtail:"\u21A3",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",rightthreetimes:"\u22CC",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",ropf:"\uD835\uDD63",roplus:"\u2A2E",rotimes:"\u2A35",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",rsaquo:"\u203A",rscr:"\uD835\uDCC7",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",ruluhar:"\u2968",rx:"\u211E",sacute:"\u015B",sbquo:"\u201A",sc:"\u227B",scE:"\u2AB4",scap:"\u2AB8",scaron:"\u0161",sccue:"\u227D",sce:"\u2AB0",scedil:"\u015F",scirc:"\u015D",scnE:"\u2AB6",scnap:"\u2ABA",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",seArr:"\u21D8",searhk:"\u2925",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",sfr:"\uD835\uDD30",sfrown:"\u2322",sharp:"\u266F",shchcy:"\u0449",shcy:"\u0448",shortmid:"\u2223",shortparallel:"\u2225",shy:"\xAD",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",sopf:"\uD835\uDD64",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",square:"\u25A1",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",sscr:"\uD835\uDCC8",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",subE:"\u2AC5",subdot:"\u2ABD",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",sum:"\u2211",sung:"\u266A",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",sup:"\u2283",supE:"\u2AC6",supdot:"\u2ABE",supdsub:"\u2AD8",supe:"\u2287",supedot:"\u2AC4",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swArr:"\u21D9",swarhk:"\u2926",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",target:"\u2316",tau:"\u03C4",tbrk:"\u23B4",tcaron:"\u0165",tcedil:"\u0163",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",tfr:"\uD835\uDD31",there4:"\u2234",therefore:"\u2234",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223C",thorn:"\xFE",tilde:"\u02DC",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",topf:"\uD835\uDD65",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",tscr:"\uD835\uDCC9",tscy:"\u0446",tshcy:"\u045B",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",uArr:"\u21D1",uHar:"\u2963",uacute:"\xFA",uarr:"\u2191",ubrcy:"\u045E",ubreve:"\u016D",ucirc:"\xFB",ucy:"\u0443",udarr:"\u21C5",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",ufr:"\uD835\uDD32",ugrave:"\xF9",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",umacr:"\u016B",uml:"\xA8",uogon:"\u0173",uopf:"\uD835\uDD66",uparrow:"\u2191",updownarrow:"\u2195",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",upsi:"\u03C5",upsih:"\u03D2",upsilon:"\u03C5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",uring:"\u016F",urtri:"\u25F9",uscr:"\uD835\uDCCA",utdot:"\u22F0",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",uuml:"\xFC",uwangle:"\u29A7",vArr:"\u21D5",vBar:"\u2AE8",vBarv:"\u2AE9",vDash:"\u22A8",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",vcy:"\u0432",vdash:"\u22A2",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",vert:"|",vfr:"\uD835\uDD33",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",vopf:"\uD835\uDD67",vprop:"\u221D",vrtri:"\u22B3",vscr:"\uD835\uDCCB",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",vzigzag:"\u299A",wcirc:"\u0175",wedbar:"\u2A5F",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",wfr:"\uD835\uDD34",wopf:"\uD835\uDD68",wp:"\u2118",wr:"\u2240",wreath:"\u2240",wscr:"\uD835\uDCCC",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",xfr:"\uD835\uDD35",xhArr:"\u27FA",xharr:"\u27F7",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",xopf:"\uD835\uDD69",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",xscr:"\uD835\uDCCD",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",yacute:"\xFD",yacy:"\u044F",ycirc:"\u0177",ycy:"\u044B",yen:"\xA5",yfr:"\uD835\uDD36",yicy:"\u0457",yopf:"\uD835\uDD6A",yscr:"\uD835\uDCCE",yucy:"\u044E",yuml:"\xFF",zacute:"\u017A",zcaron:"\u017E",zcy:"\u0437",zdot:"\u017C",zeetrf:"\u2128",zeta:"\u03B6",zfr:"\uD835\uDD37",zhcy:"\u0436",zigrarr:"\u21DD",zopf:"\uD835\uDD6B",zscr:"\uD835\uDCCF",zwj:"\u200D",zwnj:"\u200C"}});function y5($){return Qn.call(sH,$)?sH[$]:!1}var Qn;var k2=A(()=>{sB();Qn={}.hasOwnProperty});var M;var tB=A(()=>{M={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533}});var Q$;var eB=A(()=>{Q$={attentionSideAfter:2,attentionSideBefore:1,atxHeadingOpeningFenceSizeMax:6,autolinkDomainSizeMax:63,autolinkSchemeSizeMax:32,cdataOpeningString:"CDATA[",characterGroupPunctuation:2,characterGroupWhitespace:1,characterReferenceDecimalSizeMax:7,characterReferenceHexadecimalSizeMax:6,characterReferenceNamedSizeMax:31,codeFencedSequenceSizeMin:3,contentTypeContent:"content",contentTypeDocument:"document",contentTypeFlow:"flow",contentTypeString:"string",contentTypeText:"text",hardBreakPrefixSizeMin:2,htmlBasic:6,htmlCdata:5,htmlComment:2,htmlComplete:7,htmlDeclaration:4,htmlInstruction:3,htmlRawSizeMax:8,htmlRaw:1,linkResourceDestinationBalanceMax:32,linkReferenceSizeMax:999,listItemValueSizeMax:10,numericBaseDecimal:10,numericBaseHexadecimal:16,tabSize:4,thematicBreakMarkerCountMin:3,v8MaxSafeChunkSize:1e4}});var B;var $M=A(()=>{B={data:"data",whitespace:"whitespace",lineEnding:"lineEnding",lineEndingBlank:"lineEndingBlank",linePrefix:"linePrefix",lineSuffix:"lineSuffix",atxHeading:"atxHeading",atxHeadingSequence:"atxHeadingSequence",atxHeadingText:"atxHeadingText",autolink:"autolink",autolinkEmail:"autolinkEmail",autolinkMarker:"autolinkMarker",autolinkProtocol:"autolinkProtocol",characterEscape:"characterEscape",characterEscapeValue:"characterEscapeValue",characterReference:"characterReference",characterReferenceMarker:"characterReferenceMarker",characterReferenceMarkerNumeric:"characterReferenceMarkerNumeric",characterReferenceMarkerHexadecimal:"characterReferenceMarkerHexadecimal",characterReferenceValue:"characterReferenceValue",codeFenced:"codeFenced",codeFencedFence:"codeFencedFence",codeFencedFenceSequence:"codeFencedFenceSequence",codeFencedFenceInfo:"codeFencedFenceInfo",codeFencedFenceMeta:"codeFencedFenceMeta",codeFlowValue:"codeFlowValue",codeIndented:"codeIndented",codeText:"codeText",codeTextData:"codeTextData",codeTextPadding:"codeTextPadding",codeTextSequence:"codeTextSequence",content:"content",definition:"definition",definitionDestination:"definitionDestination",definitionDestinationLiteral:"definitionDestinationLiteral",definitionDestinationLiteralMarker:"definitionDestinationLiteralMarker",definitionDestinationRaw:"definitionDestinationRaw",definitionDestinationString:"definitionDestinationString",definitionLabel:"definitionLabel",definitionLabelMarker:"definitionLabelMarker",definitionLabelString:"definitionLabelString",definitionMarker:"definitionMarker",definitionTitle:"definitionTitle",definitionTitleMarker:"definitionTitleMarker",definitionTitleString:"definitionTitleString",emphasis:"emphasis",emphasisSequence:"emphasisSequence",emphasisText:"emphasisText",escapeMarker:"escapeMarker",hardBreakEscape:"hardBreakEscape",hardBreakTrailing:"hardBreakTrailing",htmlFlow:"htmlFlow",htmlFlowData:"htmlFlowData",htmlText:"htmlText",htmlTextData:"htmlTextData",image:"image",label:"label",labelText:"labelText",labelLink:"labelLink",labelImage:"labelImage",labelMarker:"labelMarker",labelImageMarker:"labelImageMarker",labelEnd:"labelEnd",link:"link",paragraph:"paragraph",reference:"reference",referenceMarker:"referenceMarker",referenceString:"referenceString",resource:"resource",resourceDestination:"resourceDestination",resourceDestinationLiteral:"resourceDestinationLiteral",resourceDestinationLiteralMarker:"resourceDestinationLiteralMarker",resourceDestinationRaw:"resourceDestinationRaw",resourceDestinationString:"resourceDestinationString",resourceMarker:"resourceMarker",resourceTitle:"resourceTitle",resourceTitleMarker:"resourceTitleMarker",resourceTitleString:"resourceTitleString",setextHeading:"setextHeading",setextHeadingText:"setextHeadingText",setextHeadingLine:"setextHeadingLine",setextHeadingLineSequence:"setextHeadingLineSequence",strong:"strong",strongSequence:"strongSequence",strongText:"strongText",thematicBreak:"thematicBreak",thematicBreakSequence:"thematicBreakSequence",blockQuote:"blockQuote",blockQuotePrefix:"blockQuotePrefix",blockQuoteMarker:"blockQuoteMarker",blockQuotePrefixWhitespace:"blockQuotePrefixWhitespace",listOrdered:"listOrdered",listUnordered:"listUnordered",listItemIndent:"listItemIndent",listItemMarker:"listItemMarker",listItemPrefix:"listItemPrefix",listItemPrefixWhitespace:"listItemPrefixWhitespace",listItemValue:"listItemValue",chunkDocument:"chunkDocument",chunkContent:"chunkContent",chunkFlow:"chunkFlow",chunkText:"chunkText",chunkString:"chunkString"}});var w1;var XM=A(()=>{w1={ht:"\t",lf:`
100
- `,cr:"\r",space:" ",exclamationMark:"!",quotationMark:'"',numberSign:"#",dollarSign:"$",percentSign:"%",ampersand:"&",apostrophe:"'",leftParenthesis:"(",rightParenthesis:")",asterisk:"*",plusSign:"+",comma:",",dash:"-",dot:".",slash:"/",digit0:"0",digit1:"1",digit2:"2",digit3:"3",digit4:"4",digit5:"5",digit6:"6",digit7:"7",digit8:"8",digit9:"9",colon:":",semicolon:";",lessThan:"<",equalsTo:"=",greaterThan:">",questionMark:"?",atSign:"@",uppercaseA:"A",uppercaseB:"B",uppercaseC:"C",uppercaseD:"D",uppercaseE:"E",uppercaseF:"F",uppercaseG:"G",uppercaseH:"H",uppercaseI:"I",uppercaseJ:"J",uppercaseK:"K",uppercaseL:"L",uppercaseM:"M",uppercaseN:"N",uppercaseO:"O",uppercaseP:"P",uppercaseQ:"Q",uppercaseR:"R",uppercaseS:"S",uppercaseT:"T",uppercaseU:"U",uppercaseV:"V",uppercaseW:"W",uppercaseX:"X",uppercaseY:"Y",uppercaseZ:"Z",leftSquareBracket:"[",backslash:"\\",rightSquareBracket:"]",caret:"^",underscore:"_",graveAccent:"`",lowercaseA:"a",lowercaseB:"b",lowercaseC:"c",lowercaseD:"d",lowercaseE:"e",lowercaseF:"f",lowercaseG:"g",lowercaseH:"h",lowercaseI:"i",lowercaseJ:"j",lowercaseK:"k",lowercaseL:"l",lowercaseM:"m",lowercaseN:"n",lowercaseO:"o",lowercaseP:"p",lowercaseQ:"q",lowercaseR:"r",lowercaseS:"s",lowercaseT:"t",lowercaseU:"u",lowercaseV:"v",lowercaseW:"w",lowercaseX:"x",lowercaseY:"y",lowercaseZ:"z",leftCurlyBrace:"{",verticalBar:"|",rightCurlyBrace:"}",tilde:"~",replacementCharacter:"\uFFFD"}});var e$=A(()=>{tB();eB();$M();XM()});function C4($,X,Y,W){let J=$.length,U=0,H;if(X<0)X=-X>J?0:J+X;else X=X>J?J:X;if(Y=Y>0?Y:0,W.length<Q$.v8MaxSafeChunkSize)H=Array.from(W),H.unshift(X,Y),$.splice(...H);else{if(Y)$.splice(X,Y);while(U<W.length)H=W.slice(U,U+Q$.v8MaxSafeChunkSize),H.unshift(X,0),$.splice(...H),U+=Q$.v8MaxSafeChunkSize,X+=Q$.v8MaxSafeChunkSize}}function r4($,X){if($.length>0)return C4($,$.length,0,X),$;return X}var h8=A(()=>{e$()});function JM($){let X={},Y=-1;while(++Y<$.length)Fn(X,$[Y]);return X}function Fn($,X){let Y;for(Y in X){let J=(YM.call($,Y)?$[Y]:void 0)||($[Y]={}),U=X[Y],H;if(U)for(H in U){if(!YM.call(J,H))J[H]=[];let D=U[H];qn(J[H],Array.isArray(D)?D:D?[D]:[])}}}function qn($,X){let Y=-1,W=[];while(++Y<X.length)(X[Y].add==="after"?$:W).push(X[Y]);C4($,0,0,W)}var YM;var WM=A(()=>{h8();YM={}.hasOwnProperty});function v2($,X){let Y=Number.parseInt($,X);if(Y<M.ht||Y===M.vt||Y>M.cr&&Y<M.space||Y>M.tilde&&Y<160||Y>55295&&Y<57344||Y>64975&&Y<65008||(Y&65535)===65535||(Y&65535)===65534||Y>1114111)return w1.replacementCharacter;return String.fromCodePoint(Y)}var tH=A(()=>{e$()});function U8($){return $.replace(/[\t\n\r ]+/g,w1.space).replace(/^ | $/g,"").toLowerCase().toUpperCase()}var h2=A(()=>{e$()});function u7($){return $!==null&&($<M.space||$===M.del)}function M$($){return $!==null&&$<M.horizontalTab}function X4($){return $!==null&&($<M.nul||$===M.space)}function a$($){return $===M.horizontalTab||$===M.virtualSpace||$===M.space}function y8($){return X;function X(Y){return Y!==null&&Y>-1&&$.test(String.fromCharCode(Y))}}var Z1,n4,UM,p7,GM,HM,DM,VM;var T6=A(()=>{e$();Z1=y8(/[A-Za-z]/),n4=y8(/[\dA-Za-z]/),UM=y8(/[#-'*+\--9=?A-Z^-~]/);p7=y8(/\d/),GM=y8(/[\dA-Fa-f]/),HM=y8(/[!-/:-@[-`{-~]/);DM=y8(/\p{P}|\p{S}/u),VM=y8(/\s/)});function $6($,X,Y,W){let J=W?W-1:Number.POSITIVE_INFINITY,U=0;return H;function H(V){if(a$(V))return $.enter(Y),D(V);return X(V)}function D(V){if(a$(V)&&U++<J)return $.consume(V),D;return $.exit(Y),X(V)}}var M4=A(()=>{T6()});function wn($){let X=$.attempt(this.parser.constructs.contentInitial,W,J),Y;return X;function W(D){if(x(D===M.eof||M$(D),"expected eol or eof"),D===M.eof){$.consume(D);return}return $.enter(B.lineEnding),$.consume(D),$.exit(B.lineEnding),$6($,X,B.linePrefix)}function J(D){return x(D!==M.eof&&!M$(D),"expected anything other than a line ending or EOF"),$.enter(B.paragraph),U(D)}function U(D){let V=$.enter(B.chunkText,{contentType:Q$.contentTypeText,previous:Y});if(Y)Y.next=V;return Y=V,H(D)}function H(D){if(D===M.eof){$.exit(B.chunkText),$.exit(B.paragraph),$.consume(D);return}if(M$(D))return $.consume(D),$.exit(B.chunkText),U;return $.consume(D),H}}var KM;var QM=A(()=>{P6();M4();T6();e$();KM={tokenize:wn}});function Zn($){let X=this,Y=[],W=0,J,U,H;return D;function D(j){if(W<Y.length){let v=Y[W];return X.containerState=v[1],x(v[0].continuation,"expected `continuation` to be defined on container construct"),$.attempt(v[0].continuation,V,K)(j)}return K(j)}function V(j){if(x(X.containerState,"expected `containerState` to be defined after continuation"),W++,X.containerState._closeFlow){if(X.containerState._closeFlow=void 0,J)P();let v=X.events.length,y=v,E;while(y--)if(X.events[y][0]==="exit"&&X.events[y][1].type===B.chunkFlow){E=X.events[y][1].end;break}x(E,"could not find previous flow chunk"),L(W);let b=v;while(b<X.events.length)X.events[b][1].end={...E},b++;return C4(X.events,y+1,0,X.events.slice(v)),X.events.length=b,K(j)}return D(j)}function K(j){if(W===Y.length){if(!J)return F(j);if(J.currentConstruct&&J.currentConstruct.concrete)return z(j);X.interrupt=Boolean(J.currentConstruct&&!J._gfmTableDynamicInterruptHack)}return X.containerState={},$.check(FM,Q,q)(j)}function Q(j){if(J)P();return L(W),F(j)}function q(j){return X.parser.lazy[X.now().line]=W!==Y.length,H=X.now().offset,z(j)}function F(j){return X.containerState={},$.attempt(FM,w,z)(j)}function w(j){return x(X.currentConstruct,"expected `currentConstruct` to be defined on tokenizer"),x(X.containerState,"expected `containerState` to be defined on tokenizer"),W++,Y.push([X.currentConstruct,X.containerState]),F(j)}function z(j){if(j===M.eof){if(J)P();L(0),$.consume(j);return}return J=J||X.parser.flow(X.now()),$.enter(B.chunkFlow,{_tokenizer:J,contentType:Q$.contentTypeFlow,previous:U}),O(j)}function O(j){if(j===M.eof){N($.exit(B.chunkFlow),!0),L(0),$.consume(j);return}if(M$(j))return $.consume(j),N($.exit(B.chunkFlow)),W=0,X.interrupt=void 0,D;return $.consume(j),O}function N(j,v){x(J,"expected `childFlow` to be defined when continuing");let y=X.sliceStream(j);if(v)y.push(null);if(j.previous=U,U)U.next=j;if(U=j,J.defineSkip(j.start),J.write(y),X.parser.lazy[j.start.line]){let E=J.events.length;while(E--)if(J.events[E][1].start.offset<H&&(!J.events[E][1].end||J.events[E][1].end.offset>H))return;let b=X.events.length,R=b,I,d;while(R--)if(X.events[R][0]==="exit"&&X.events[R][1].type===B.chunkFlow){if(I){d=X.events[R][1].end;break}I=!0}x(d,"could not find previous flow chunk"),L(W),E=b;while(E<X.events.length)X.events[E][1].end={...d},E++;C4(X.events,R+1,0,X.events.slice(b)),X.events.length=E}}function L(j){let v=Y.length;while(v-- >j){let y=Y[v];X.containerState=y[1],x(y[0].exit,"expected `exit` to be defined on container construct"),y[0].exit.call(X,$)}Y.length=j}function P(){x(X.containerState,"expected `containerState` to be defined when closing flow"),x(J,"expected `childFlow` to be defined when closing it"),J.write([M.eof]),U=void 0,J=void 0,X.containerState._closeFlow=void 0}}function zn($,X,Y){return x(this.parser.constructs.disable.null,"expected `disable.null` to be populated"),$6($,$.attempt(this.parser.constructs.document,X,Y),B.linePrefix,this.parser.constructs.disable.null.includes("codeIndented")?void 0:Q$.tabSize)}var qM,FM;var wM=A(()=>{P6();M4();T6();h8();e$();qM={tokenize:Zn},FM={tokenize:zn}});function f5($){if($===M.eof||X4($)||VM($))return Q$.characterGroupWhitespace;if(DM($))return Q$.characterGroupPunctuation}var eH=A(()=>{T6();e$()});function g5($,X,Y){let W=[],J=-1;while(++J<$.length){let U=$[J].resolveAll;if(U&&!W.includes(U))X=U(X,Y),W.push(U)}return X}function On($,X){let Y=-1,W,J,U,H,D,V,K,Q;while(++Y<$.length)if($[Y][0]==="enter"&&$[Y][1].type==="attentionSequence"&&$[Y][1]._close){W=Y;while(W--)if($[W][0]==="exit"&&$[W][1].type==="attentionSequence"&&$[W][1]._open&&X.sliceSerialize($[W][1]).charCodeAt(0)===X.sliceSerialize($[Y][1]).charCodeAt(0)){if(($[W][1]._close||$[Y][1]._open)&&($[Y][1].end.offset-$[Y][1].start.offset)%3&&!(($[W][1].end.offset-$[W][1].start.offset+$[Y][1].end.offset-$[Y][1].start.offset)%3))continue;V=$[W][1].end.offset-$[W][1].start.offset>1&&$[Y][1].end.offset-$[Y][1].start.offset>1?2:1;let q={...$[W][1].end},F={...$[Y][1].start};if(ZM(q,-V),ZM(F,V),H={type:V>1?B.strongSequence:B.emphasisSequence,start:q,end:{...$[W][1].end}},D={type:V>1?B.strongSequence:B.emphasisSequence,start:{...$[Y][1].start},end:F},U={type:V>1?B.strongText:B.emphasisText,start:{...$[W][1].end},end:{...$[Y][1].start}},J={type:V>1?B.strong:B.emphasis,start:{...H.start},end:{...D.end}},$[W][1].end={...H.start},$[Y][1].start={...D.end},K=[],$[W][1].end.offset-$[W][1].start.offset)K=r4(K,[["enter",$[W][1],X],["exit",$[W][1],X]]);if(K=r4(K,[["enter",J,X],["enter",H,X],["exit",H,X],["enter",U,X]]),x(X.parser.constructs.insideSpan.null,"expected `insideSpan` to be populated"),K=r4(K,g5(X.parser.constructs.insideSpan.null,$.slice(W+1,Y),X)),K=r4(K,[["exit",U,X],["enter",D,X],["exit",D,X],["exit",J,X]]),$[Y][1].end.offset-$[Y][1].start.offset)Q=2,K=r4(K,[["enter",$[Y][1],X],["exit",$[Y][1],X]]);else Q=0;C4($,W-1,Y-W+3,K),Y=W+K.length-Q-2;break}}Y=-1;while(++Y<$.length)if($[Y][1].type==="attentionSequence")$[Y][1].type="data";return $}function Nn($,X){let Y=this.parser.constructs.attentionMarkers.null,W=this.previous,J=f5(W),U;return H;function H(V){return x(V===M.asterisk||V===M.underscore,"expected asterisk or underscore"),U=V,$.enter("attentionSequence"),D(V)}function D(V){if(V===U)return $.consume(V),D;let K=$.exit("attentionSequence"),Q=f5(V);x(Y,"expected `attentionMarkers` to be populated");let q=!Q||Q===Q$.characterGroupPunctuation&&J||Y.includes(V),F=!J||J===Q$.characterGroupPunctuation&&Q||Y.includes(W);return K._open=Boolean(U===M.asterisk?q:q&&(J||!F)),K._close=Boolean(U===M.asterisk?F:F&&(Q||!q)),X(V)}}function ZM($,X){$.column+=X,$.offset+=X,$._bufferIndex+=X}var c7;var zM=A(()=>{P6();h8();eH();e$();c7={name:"attention",resolveAll:On,tokenize:Nn}});function An($,X,Y){let W=0;return J;function J(w){return x(w===M.lessThan,"expected `<`"),$.enter(B.autolink),$.enter(B.autolinkMarker),$.consume(w),$.exit(B.autolinkMarker),$.enter(B.autolinkProtocol),U}function U(w){if(Z1(w))return $.consume(w),H;if(w===M.atSign)return Y(w);return K(w)}function H(w){if(w===M.plusSign||w===M.dash||w===M.dot||n4(w))return W=1,D(w);return K(w)}function D(w){if(w===M.colon)return $.consume(w),W=0,V;if((w===M.plusSign||w===M.dash||w===M.dot||n4(w))&&W++<Q$.autolinkSchemeSizeMax)return $.consume(w),D;return W=0,K(w)}function V(w){if(w===M.greaterThan)return $.exit(B.autolinkProtocol),$.enter(B.autolinkMarker),$.consume(w),$.exit(B.autolinkMarker),$.exit(B.autolink),X;if(w===M.eof||w===M.space||w===M.lessThan||u7(w))return Y(w);return $.consume(w),V}function K(w){if(w===M.atSign)return $.consume(w),Q;if(UM(w))return $.consume(w),K;return Y(w)}function Q(w){return n4(w)?q(w):Y(w)}function q(w){if(w===M.dot)return $.consume(w),W=0,Q;if(w===M.greaterThan)return $.exit(B.autolinkProtocol).type=B.autolinkEmail,$.enter(B.autolinkMarker),$.consume(w),$.exit(B.autolinkMarker),$.exit(B.autolink),X;return F(w)}function F(w){if((w===M.dash||n4(w))&&W++<Q$.autolinkDomainSizeMax){let z=w===M.dash?F:q;return $.consume(w),z}return Y(w)}}var $D;var OM=A(()=>{P6();T6();e$();$D={name:"autolink",tokenize:An}});function Bn($,X,Y){return W;function W(U){return a$(U)?$6($,J,B.linePrefix)(U):J(U)}function J(U){return U===M.eof||M$(U)?X(U):Y(U)}}var f8;var y2=A(()=>{M4();T6();e$();f8={partial:!0,tokenize:Bn}});function Mn($,X,Y){let W=this;return J;function J(H){if(H===M.greaterThan){let D=W.containerState;if(x(D,"expected `containerState` to be defined in container"),!D.open)$.enter(B.blockQuote,{_container:!0}),D.open=!0;return $.enter(B.blockQuotePrefix),$.enter(B.blockQuoteMarker),$.consume(H),$.exit(B.blockQuoteMarker),U}return Y(H)}function U(H){if(a$(H))return $.enter(B.blockQuotePrefixWhitespace),$.consume(H),$.exit(B.blockQuotePrefixWhitespace),$.exit(B.blockQuotePrefix),X;return $.exit(B.blockQuotePrefix),X(H)}}function jn($,X,Y){let W=this;return J;function J(H){if(a$(H))return x(W.parser.constructs.disable.null,"expected `disable.null` to be populated"),$6($,U,B.linePrefix,W.parser.constructs.disable.null.includes("codeIndented")?void 0:Q$.tabSize)(H);return U(H)}function U(H){return $.attempt(f2,X,Y)(H)}}function Rn($){$.exit(B.blockQuote)}var f2;var NM=A(()=>{P6();M4();T6();e$();f2={continuation:{tokenize:jn},exit:Rn,name:"blockQuote",tokenize:Mn}});function Ln($,X,Y){return W;function W(U){return x(U===M.backslash,"expected `\\`"),$.enter(B.characterEscape),$.enter(B.escapeMarker),$.consume(U),$.exit(B.escapeMarker),J}function J(U){if(HM(U))return $.enter(B.characterEscapeValue),$.consume(U),$.exit(B.characterEscapeValue),$.exit(B.characterEscape),X;return Y(U)}}var g2;var AM=A(()=>{P6();T6();e$();g2={name:"characterEscape",tokenize:Ln}});function En($,X,Y){let W=this,J=0,U,H;return D;function D(q){return x(q===M.ampersand,"expected `&`"),$.enter(B.characterReference),$.enter(B.characterReferenceMarker),$.consume(q),$.exit(B.characterReferenceMarker),V}function V(q){if(q===M.numberSign)return $.enter(B.characterReferenceMarkerNumeric),$.consume(q),$.exit(B.characterReferenceMarkerNumeric),K;return $.enter(B.characterReferenceValue),U=Q$.characterReferenceNamedSizeMax,H=n4,Q(q)}function K(q){if(q===M.uppercaseX||q===M.lowercaseX)return $.enter(B.characterReferenceMarkerHexadecimal),$.consume(q),$.exit(B.characterReferenceMarkerHexadecimal),$.enter(B.characterReferenceValue),U=Q$.characterReferenceHexadecimalSizeMax,H=GM,Q;return $.enter(B.characterReferenceValue),U=Q$.characterReferenceDecimalSizeMax,H=p7,Q(q)}function Q(q){if(q===M.semicolon&&J){let F=$.exit(B.characterReferenceValue);if(H===n4&&!y5(W.sliceSerialize(F)))return Y(q);return $.enter(B.characterReferenceMarker),$.consume(q),$.exit(B.characterReferenceMarker),$.exit(B.characterReference),X}if(H(q)&&J++<U)return $.consume(q),Q;return Y(q)}}var m2;var BM=A(()=>{P6();k2();T6();e$();m2={name:"characterReference",tokenize:En}});function Pn($,X,Y){let W=this,J={partial:!0,tokenize:y},U=0,H=0,D;return V;function V(E){return K(E)}function K(E){x(E===M.graveAccent||E===M.tilde,"expected `` ` `` or `~`");let b=W.events[W.events.length-1];return U=b&&b[1].type===B.linePrefix?b[2].sliceSerialize(b[1],!0).length:0,D=E,$.enter(B.codeFenced),$.enter(B.codeFencedFence),$.enter(B.codeFencedFenceSequence),Q(E)}function Q(E){if(E===D)return H++,$.consume(E),Q;if(H<Q$.codeFencedSequenceSizeMin)return Y(E);return $.exit(B.codeFencedFenceSequence),a$(E)?$6($,q,B.whitespace)(E):q(E)}function q(E){if(E===M.eof||M$(E))return $.exit(B.codeFencedFence),W.interrupt?X(E):$.check(MM,O,v)(E);return $.enter(B.codeFencedFenceInfo),$.enter(B.chunkString,{contentType:Q$.contentTypeString}),F(E)}function F(E){if(E===M.eof||M$(E))return $.exit(B.chunkString),$.exit(B.codeFencedFenceInfo),q(E);if(a$(E))return $.exit(B.chunkString),$.exit(B.codeFencedFenceInfo),$6($,w,B.whitespace)(E);if(E===M.graveAccent&&E===D)return Y(E);return $.consume(E),F}function w(E){if(E===M.eof||M$(E))return q(E);return $.enter(B.codeFencedFenceMeta),$.enter(B.chunkString,{contentType:Q$.contentTypeString}),z(E)}function z(E){if(E===M.eof||M$(E))return $.exit(B.chunkString),$.exit(B.codeFencedFenceMeta),q(E);if(E===M.graveAccent&&E===D)return Y(E);return $.consume(E),z}function O(E){return x(M$(E),"expected eol"),$.attempt(J,v,N)(E)}function N(E){return x(M$(E),"expected eol"),$.enter(B.lineEnding),$.consume(E),$.exit(B.lineEnding),L}function L(E){return U>0&&a$(E)?$6($,P,B.linePrefix,U+1)(E):P(E)}function P(E){if(E===M.eof||M$(E))return $.check(MM,O,v)(E);return $.enter(B.codeFlowValue),j(E)}function j(E){if(E===M.eof||M$(E))return $.exit(B.codeFlowValue),P(E);return $.consume(E),j}function v(E){return $.exit(B.codeFenced),X(E)}function y(E,b,R){let I=0;return d;function d(l){return x(M$(l),"expected eol"),E.enter(B.lineEnding),E.consume(l),E.exit(B.lineEnding),k}function k(l){return x(W.parser.constructs.disable.null,"expected `disable.null` to be populated"),E.enter(B.codeFencedFence),a$(l)?$6(E,t,B.linePrefix,W.parser.constructs.disable.null.includes("codeIndented")?void 0:Q$.tabSize)(l):t(l)}function t(l){if(l===D)return E.enter(B.codeFencedFenceSequence),h(l);return R(l)}function h(l){if(l===D)return I++,E.consume(l),h;if(I>=H)return E.exit(B.codeFencedFenceSequence),a$(l)?$6(E,f,B.whitespace)(l):f(l);return R(l)}function f(l){if(l===M.eof||M$(l))return E.exit(B.codeFencedFence),b(l);return R(l)}}}function In($,X,Y){let W=this;return J;function J(H){if(H===M.eof)return Y(H);return x(M$(H),"expected eol"),$.enter(B.lineEnding),$.consume(H),$.exit(B.lineEnding),U}function U(H){return W.parser.lazy[W.now().line]?Y(H):X(H)}}var MM,u2;var jM=A(()=>{P6();M4();T6();e$();MM={partial:!0,tokenize:In},u2={concrete:!0,name:"codeFenced",tokenize:Pn}});function Tn($,X,Y){let W=this;return J;function J(K){return x(a$(K)),$.enter(B.codeIndented),$6($,U,B.linePrefix,Q$.tabSize+1)(K)}function U(K){let Q=W.events[W.events.length-1];return Q&&Q[1].type===B.linePrefix&&Q[2].sliceSerialize(Q[1],!0).length>=Q$.tabSize?H(K):Y(K)}function H(K){if(K===M.eof)return V(K);if(M$(K))return $.attempt(_n,H,V)(K);return $.enter(B.codeFlowValue),D(K)}function D(K){if(K===M.eof||M$(K))return $.exit(B.codeFlowValue),H(K);return $.consume(K),D}function V(K){return $.exit(B.codeIndented),X(K)}}function Cn($,X,Y){let W=this;return J;function J(H){if(W.parser.lazy[W.now().line])return Y(H);if(M$(H))return $.enter(B.lineEnding),$.consume(H),$.exit(B.lineEnding),J;return $6($,U,B.linePrefix,Q$.tabSize+1)(H)}function U(H){let D=W.events[W.events.length-1];return D&&D[1].type===B.linePrefix&&D[2].sliceSerialize(D[1],!0).length>=Q$.tabSize?X(H):M$(H)?J(H):Y(H)}}var d7,_n;var RM=A(()=>{P6();M4();T6();e$();d7={name:"codeIndented",tokenize:Tn},_n={partial:!0,tokenize:Cn}});function Sn($){let X=$.length-4,Y=3,W,J;if(($[Y][1].type===B.lineEnding||$[Y][1].type==="space")&&($[X][1].type===B.lineEnding||$[X][1].type==="space")){W=Y;while(++W<X)if($[W][1].type===B.codeTextData){$[Y][1].type=B.codeTextPadding,$[X][1].type=B.codeTextPadding,Y+=2,X-=2;break}}W=Y-1,X++;while(++W<=X)if(J===void 0){if(W!==X&&$[W][1].type!==B.lineEnding)J=W}else if(W===X||$[W][1].type===B.lineEnding){if($[J][1].type=B.codeTextData,W!==J+2)$[J][1].end=$[W-1][1].end,$.splice(J+2,W-J-2),X-=W-J-2,W=J+2;J=void 0}return $}function LM($){return $!==M.graveAccent||this.events[this.events.length-1][1].type===B.characterEscape}function bn($,X,Y){let W=this,J=0,U,H;return D;function D(F){return x(F===M.graveAccent,"expected `` ` ``"),x(LM.call(W,W.previous),"expected correct previous"),$.enter(B.codeText),$.enter(B.codeTextSequence),V(F)}function V(F){if(F===M.graveAccent)return $.consume(F),J++,V;return $.exit(B.codeTextSequence),K(F)}function K(F){if(F===M.eof)return Y(F);if(F===M.space)return $.enter("space"),$.consume(F),$.exit("space"),K;if(F===M.graveAccent)return H=$.enter(B.codeTextSequence),U=0,q(F);if(M$(F))return $.enter(B.lineEnding),$.consume(F),$.exit(B.lineEnding),K;return $.enter(B.codeTextData),Q(F)}function Q(F){if(F===M.eof||F===M.space||F===M.graveAccent||M$(F))return $.exit(B.codeTextData),K(F);return $.consume(F),Q}function q(F){if(F===M.graveAccent)return $.consume(F),U++,q;if(U===J)return $.exit(B.codeTextSequence),$.exit(B.codeText),X(F);return H.type=B.codeTextData,Q(F)}}var XD;var EM=A(()=>{P6();T6();e$();XD={name:"codeText",previous:LM,resolve:Sn,tokenize:bn}});class YD{constructor($){this.left=$?[...$]:[],this.right=[]}get($){if($<0||$>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+$+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");if($<this.left.length)return this.left[$];return this.right[this.right.length-$+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice($,X){let Y=X===null||X===void 0?Number.POSITIVE_INFINITY:X;if(Y<this.left.length)return this.left.slice($,Y);if($>this.left.length)return this.right.slice(this.right.length-Y+this.left.length,this.right.length-$+this.left.length).reverse();return this.left.slice($).concat(this.right.slice(this.right.length-Y+this.left.length).reverse())}splice($,X,Y){let W=X||0;this.setCursor(Math.trunc($));let J=this.right.splice(this.right.length-W,Number.POSITIVE_INFINITY);if(Y)l7(this.left,Y);return J.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push($){this.setCursor(Number.POSITIVE_INFINITY),this.left.push($)}pushMany($){this.setCursor(Number.POSITIVE_INFINITY),l7(this.left,$)}unshift($){this.setCursor(0),this.right.push($)}unshiftMany($){this.setCursor(0),l7(this.right,$.reverse())}setCursor($){if($===this.left.length||$>this.left.length&&this.right.length===0||$<0&&this.left.length===0)return;if($<this.left.length){let X=this.left.splice($,Number.POSITIVE_INFINITY);l7(this.right,X.reverse())}else{let X=this.right.splice(this.left.length+this.right.length-$,Number.POSITIVE_INFINITY);l7(this.left,X.reverse())}}}function l7($,X){let Y=0;if(X.length<Q$.v8MaxSafeChunkSize)$.push(...X);else while(Y<X.length)$.push(...X.slice(Y,Y+Q$.v8MaxSafeChunkSize)),Y+=Q$.v8MaxSafeChunkSize}var PM=A(()=>{e$()});function p2($){let X={},Y=-1,W,J,U,H,D,V,K,Q=new YD($);while(++Y<Q.length){while(Y in X)Y=X[Y];if(W=Q.get(Y),Y&&W[1].type===B.chunkFlow&&Q.get(Y-1)[1].type===B.listItemPrefix){if(x(W[1]._tokenizer,"expected `_tokenizer` on subtokens"),V=W[1]._tokenizer.events,U=0,U<V.length&&V[U][1].type===B.lineEndingBlank)U+=2;if(U<V.length&&V[U][1].type===B.content)while(++U<V.length){if(V[U][1].type===B.content)break;if(V[U][1].type===B.chunkText)V[U][1]._isInFirstContentOfListItem=!0,U++}}if(W[0]==="enter"){if(W[1].contentType)Object.assign(X,xn(Q,Y)),Y=X[Y],K=!0}else if(W[1]._container){U=Y,J=void 0;while(U--)if(H=Q.get(U),H[1].type===B.lineEnding||H[1].type===B.lineEndingBlank){if(H[0]==="enter"){if(J)Q.get(J)[1].type=B.lineEndingBlank;H[1].type=B.lineEnding,J=U}}else if(H[1].type===B.linePrefix||H[1].type===B.listItemIndent);else break;if(J)W[1].end={...Q.get(J)[1].start},D=Q.slice(J,Y),D.unshift(W),Q.splice(J,Y-J+1,D)}}return C4($,0,Number.POSITIVE_INFINITY,Q.slice(0)),!K}function xn($,X){let Y=$.get(X)[1],W=$.get(X)[2],J=X-1,U=[];x(Y.contentType,"expected `contentType` on subtokens");let H=Y._tokenizer;if(!H){if(H=W.parser[Y.contentType](Y.start),Y._contentTypeTextTrailing)H._contentTypeTextTrailing=!0}let D=H.events,V=[],K={},Q,q,F=-1,w=Y,z=0,O=0,N=[O];while(w){while($.get(++J)[1]!==w);if(x(!q||w.previous===q,"expected previous to match"),x(!q||q.next===w,"expected next to match"),U.push(J),!w._tokenizer){if(Q=W.sliceStream(w),!w.next)Q.push(M.eof);if(q)H.defineSkip(w.start);if(w._isInFirstContentOfListItem)H._gfmTasklistFirstContentOfListItem=!0;if(H.write(Q),w._isInFirstContentOfListItem)H._gfmTasklistFirstContentOfListItem=void 0}q=w,w=w.next}w=Y;while(++F<D.length)if(D[F][0]==="exit"&&D[F-1][0]==="enter"&&D[F][1].type===D[F-1][1].type&&D[F][1].start.line!==D[F][1].end.line)x(w,"expected a current token"),O=F+1,N.push(O),w._tokenizer=void 0,w.previous=void 0,w=w.next;if(H.events=[],w)w._tokenizer=void 0,w.previous=void 0,x(!w.next,"expected no next token");else N.pop();F=N.length;while(F--){let L=D.slice(N[F],N[F+1]),P=U.pop();x(P!==void 0,"expected a start position when splicing"),V.push([P,P+L.length-1]),$.splice(P,2,L)}V.reverse(),F=-1;while(++F<V.length)K[z+V[F][0]]=z+V[F][1],z+=V[F][1]-V[F][0]-1;return K}var JD=A(()=>{P6();h8();e$();PM()});function vn($){return p2($),$}function hn($,X){let Y;return W;function W(D){return x(D!==M.eof&&!M$(D),"expected no eof or eol"),$.enter(B.content),Y=$.enter(B.chunkContent,{contentType:Q$.contentTypeContent}),J(D)}function J(D){if(D===M.eof)return U(D);if(M$(D))return $.check(kn,H,U)(D);return $.consume(D),J}function U(D){return $.exit(B.chunkContent),$.exit(B.content),X(D)}function H(D){return x(M$(D),"expected eol"),$.consume(D),$.exit(B.chunkContent),x(Y,"expected previous token"),Y.next=$.enter(B.chunkContent,{contentType:Q$.contentTypeContent,previous:Y}),Y=Y.next,J}}function yn($,X,Y){let W=this;return J;function J(H){return x(M$(H),"expected a line ending"),$.exit(B.chunkContent),$.enter(B.lineEnding),$.consume(H),$.exit(B.lineEnding),$6($,U,B.linePrefix)}function U(H){if(H===M.eof||M$(H))return Y(H);x(W.parser.constructs.disable.null,"expected `disable.null` to be populated");let D=W.events[W.events.length-1];if(!W.parser.constructs.disable.null.includes("codeIndented")&&D&&D[1].type===B.linePrefix&&D[2].sliceSerialize(D[1],!0).length>=Q$.tabSize)return X(H);return $.interrupt(W.parser.constructs.flow,Y,X)(H)}}var WD,kn;var IM=A(()=>{P6();M4();T6();JD();e$();WD={resolve:vn,tokenize:hn},kn={partial:!0,tokenize:yn}});function c2($,X,Y,W,J,U,H,D,V){let K=V||Number.POSITIVE_INFINITY,Q=0;return q;function q(L){if(L===M.lessThan)return $.enter(W),$.enter(J),$.enter(U),$.consume(L),$.exit(U),F;if(L===M.eof||L===M.space||L===M.rightParenthesis||u7(L))return Y(L);return $.enter(W),$.enter(H),$.enter(D),$.enter(B.chunkString,{contentType:Q$.contentTypeString}),O(L)}function F(L){if(L===M.greaterThan)return $.enter(U),$.consume(L),$.exit(U),$.exit(J),$.exit(W),X;return $.enter(D),$.enter(B.chunkString,{contentType:Q$.contentTypeString}),w(L)}function w(L){if(L===M.greaterThan)return $.exit(B.chunkString),$.exit(D),F(L);if(L===M.eof||L===M.lessThan||M$(L))return Y(L);return $.consume(L),L===M.backslash?z:w}function z(L){if(L===M.lessThan||L===M.greaterThan||L===M.backslash)return $.consume(L),w;return w(L)}function O(L){if(!Q&&(L===M.eof||L===M.rightParenthesis||X4(L)))return $.exit(B.chunkString),$.exit(D),$.exit(H),$.exit(W),X(L);if(Q<K&&L===M.leftParenthesis)return $.consume(L),Q++,O;if(L===M.rightParenthesis)return $.consume(L),Q--,O;if(L===M.eof||L===M.space||L===M.leftParenthesis||u7(L))return Y(L);return $.consume(L),L===M.backslash?N:O}function N(L){if(L===M.leftParenthesis||L===M.rightParenthesis||L===M.backslash)return $.consume(L),O;return O(L)}}var UD=A(()=>{T6();e$()});function d2($,X,Y,W,J,U){let H=this,D=0,V;return K;function K(w){return x(w===M.leftSquareBracket,"expected `[`"),$.enter(W),$.enter(J),$.consume(w),$.exit(J),$.enter(U),Q}function Q(w){if(D>Q$.linkReferenceSizeMax||w===M.eof||w===M.leftSquareBracket||w===M.rightSquareBracket&&!V||w===M.caret&&!D&&"_hiddenFootnoteSupport"in H.parser.constructs)return Y(w);if(w===M.rightSquareBracket)return $.exit(U),$.enter(J),$.consume(w),$.exit(J),$.exit(W),X;if(M$(w))return $.enter(B.lineEnding),$.consume(w),$.exit(B.lineEnding),Q;return $.enter(B.chunkString,{contentType:Q$.contentTypeString}),q(w)}function q(w){if(w===M.eof||w===M.leftSquareBracket||w===M.rightSquareBracket||M$(w)||D++>Q$.linkReferenceSizeMax)return $.exit(B.chunkString),Q(w);if($.consume(w),!V)V=!a$(w);return w===M.backslash?F:q}function F(w){if(w===M.leftSquareBracket||w===M.backslash||w===M.rightSquareBracket)return $.consume(w),D++,q;return q(w)}}var GD=A(()=>{P6();T6();e$()});function l2($,X,Y,W,J,U){let H;return D;function D(F){if(F===M.quotationMark||F===M.apostrophe||F===M.leftParenthesis)return $.enter(W),$.enter(J),$.consume(F),$.exit(J),H=F===M.leftParenthesis?M.rightParenthesis:F,V;return Y(F)}function V(F){if(F===H)return $.enter(J),$.consume(F),$.exit(J),$.exit(W),X;return $.enter(U),K(F)}function K(F){if(F===H)return $.exit(U),V(H);if(F===M.eof)return Y(F);if(M$(F))return $.enter(B.lineEnding),$.consume(F),$.exit(B.lineEnding),$6($,K,B.linePrefix);return $.enter(B.chunkString,{contentType:Q$.contentTypeString}),Q(F)}function Q(F){if(F===H||F===M.eof||M$(F))return $.exit(B.chunkString),K(F);return $.consume(F),F===M.backslash?q:Q}function q(F){if(F===H||F===M.backslash)return $.consume(F),Q;return Q(F)}}var HD=A(()=>{M4();T6();e$()});function A9($,X){let Y;return W;function W(J){if(M$(J))return $.enter(B.lineEnding),$.consume(J),$.exit(B.lineEnding),Y=!0,W;if(a$(J))return $6($,W,Y?B.linePrefix:B.lineSuffix)(J);return X(J)}}var DD=A(()=>{M4();T6();e$()});function gn($,X,Y){let W=this,J;return U;function U(w){return $.enter(B.definition),H(w)}function H(w){return x(w===M.leftSquareBracket,"expected `[`"),d2.call(W,$,D,Y,B.definitionLabel,B.definitionLabelMarker,B.definitionLabelString)(w)}function D(w){if(J=U8(W.sliceSerialize(W.events[W.events.length-1][1]).slice(1,-1)),w===M.colon)return $.enter(B.definitionMarker),$.consume(w),$.exit(B.definitionMarker),V;return Y(w)}function V(w){return X4(w)?A9($,K)(w):K(w)}function K(w){return c2($,Q,Y,B.definitionDestination,B.definitionDestinationLiteral,B.definitionDestinationLiteralMarker,B.definitionDestinationRaw,B.definitionDestinationString)(w)}function Q(w){return $.attempt(fn,q,q)(w)}function q(w){return a$(w)?$6($,F,B.whitespace)(w):F(w)}function F(w){if(w===M.eof||M$(w))return $.exit(B.definition),W.parser.defined.push(J),X(w);return Y(w)}}function mn($,X,Y){return W;function W(D){return X4(D)?A9($,J)(D):Y(D)}function J(D){return l2($,U,Y,B.definitionTitle,B.definitionTitleMarker,B.definitionTitleString)(D)}function U(D){return a$(D)?$6($,H,B.whitespace)(D):H(D)}function H(D){return D===M.eof||M$(D)?X(D):Y(D)}}var VD,fn;var _M=A(()=>{P6();UD();GD();M4();HD();DD();T6();h2();e$();VD={name:"definition",tokenize:gn},fn={partial:!0,tokenize:mn}});function un($,X,Y){return W;function W(U){return x(U===M.backslash,"expected `\\`"),$.enter(B.hardBreakEscape),$.consume(U),J}function J(U){if(M$(U))return $.exit(B.hardBreakEscape),X(U);return Y(U)}}var KD;var TM=A(()=>{P6();T6();e$();KD={name:"hardBreakEscape",tokenize:un}});function pn($,X){let Y=$.length-2,W=3,J,U;if($[W][1].type===B.whitespace)W+=2;if(Y-2>W&&$[Y][1].type===B.whitespace)Y-=2;if($[Y][1].type===B.atxHeadingSequence&&(W===Y-1||Y-4>W&&$[Y-2][1].type===B.whitespace))Y-=W+1===Y?2:4;if(Y>W)J={type:B.atxHeadingText,start:$[W][1].start,end:$[Y][1].end},U={type:B.chunkText,start:$[W][1].start,end:$[Y][1].end,contentType:Q$.contentTypeText},C4($,W,Y-W+1,[["enter",J,X],["enter",U,X],["exit",U,X],["exit",J,X]]);return $}function cn($,X,Y){let W=0;return J;function J(Q){return $.enter(B.atxHeading),U(Q)}function U(Q){return x(Q===M.numberSign,"expected `#`"),$.enter(B.atxHeadingSequence),H(Q)}function H(Q){if(Q===M.numberSign&&W++<Q$.atxHeadingOpeningFenceSizeMax)return $.consume(Q),H;if(Q===M.eof||X4(Q))return $.exit(B.atxHeadingSequence),D(Q);return Y(Q)}function D(Q){if(Q===M.numberSign)return $.enter(B.atxHeadingSequence),V(Q);if(Q===M.eof||M$(Q))return $.exit(B.atxHeading),X(Q);if(a$(Q))return $6($,D,B.whitespace)(Q);return $.enter(B.atxHeadingText),K(Q)}function V(Q){if(Q===M.numberSign)return $.consume(Q),V;return $.exit(B.atxHeadingSequence),D(Q)}function K(Q){if(Q===M.eof||Q===M.numberSign||X4(Q))return $.exit(B.atxHeadingText),D(Q);return $.consume(Q),K}}var QD;var CM=A(()=>{P6();M4();T6();h8();e$();QD={name:"headingAtx",resolve:pn,tokenize:cn}});var SM,FD;var bM=A(()=>{SM=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],FD=["pre","script","style","textarea"]});function rn($){let X=$.length;while(X--)if($[X][0]==="enter"&&$[X][1].type===B.htmlFlow)break;if(X>1&&$[X-2][1].type===B.linePrefix)$[X][1].start=$[X-2][1].start,$[X+1][1].start=$[X-2][1].start,$.splice(X-2,2);return $}function nn($,X,Y){let W=this,J,U,H,D,V;return K;function K(T){return Q(T)}function Q(T){return x(T===M.lessThan,"expected `<`"),$.enter(B.htmlFlow),$.enter(B.htmlFlowData),$.consume(T),q}function q(T){if(T===M.exclamationMark)return $.consume(T),F;if(T===M.slash)return $.consume(T),U=!0,O;if(T===M.questionMark)return $.consume(T),J=Q$.htmlInstruction,W.interrupt?X:_;if(Z1(T))return x(T!==null),$.consume(T),H=String.fromCharCode(T),N;return Y(T)}function F(T){if(T===M.dash)return $.consume(T),J=Q$.htmlComment,w;if(T===M.leftSquareBracket)return $.consume(T),J=Q$.htmlCdata,D=0,z;if(Z1(T))return $.consume(T),J=Q$.htmlDeclaration,W.interrupt?X:_;return Y(T)}function w(T){if(T===M.dash)return $.consume(T),W.interrupt?X:_;return Y(T)}function z(T){let B$=Q$.cdataOpeningString;if(T===B$.charCodeAt(D++)){if($.consume(T),D===B$.length)return W.interrupt?X:t;return z}return Y(T)}function O(T){if(Z1(T))return x(T!==null),$.consume(T),H=String.fromCharCode(T),N;return Y(T)}function N(T){if(T===M.eof||T===M.slash||T===M.greaterThan||X4(T)){let B$=T===M.slash,k$=H.toLowerCase();if(!B$&&!U&&FD.includes(k$))return J=Q$.htmlRaw,W.interrupt?X(T):t(T);if(SM.includes(H.toLowerCase())){if(J=Q$.htmlBasic,B$)return $.consume(T),L;return W.interrupt?X(T):t(T)}return J=Q$.htmlComplete,W.interrupt&&!W.parser.lazy[W.now().line]?Y(T):U?P(T):j(T)}if(T===M.dash||n4(T))return $.consume(T),H+=String.fromCharCode(T),N;return Y(T)}function L(T){if(T===M.greaterThan)return $.consume(T),W.interrupt?X:t;return Y(T)}function P(T){if(a$(T))return $.consume(T),P;return d(T)}function j(T){if(T===M.slash)return $.consume(T),d;if(T===M.colon||T===M.underscore||Z1(T))return $.consume(T),v;if(a$(T))return $.consume(T),j;return d(T)}function v(T){if(T===M.dash||T===M.dot||T===M.colon||T===M.underscore||n4(T))return $.consume(T),v;return y(T)}function y(T){if(T===M.equalsTo)return $.consume(T),E;if(a$(T))return $.consume(T),y;return j(T)}function E(T){if(T===M.eof||T===M.lessThan||T===M.equalsTo||T===M.greaterThan||T===M.graveAccent)return Y(T);if(T===M.quotationMark||T===M.apostrophe)return $.consume(T),V=T,b;if(a$(T))return $.consume(T),E;return R(T)}function b(T){if(T===V)return $.consume(T),V=null,I;if(T===M.eof||M$(T))return Y(T);return $.consume(T),b}function R(T){if(T===M.eof||T===M.quotationMark||T===M.apostrophe||T===M.slash||T===M.lessThan||T===M.equalsTo||T===M.greaterThan||T===M.graveAccent||X4(T))return y(T);return $.consume(T),R}function I(T){if(T===M.slash||T===M.greaterThan||a$(T))return j(T);return Y(T)}function d(T){if(T===M.greaterThan)return $.consume(T),k;return Y(T)}function k(T){if(T===M.eof||M$(T))return t(T);if(a$(T))return $.consume(T),k;return Y(T)}function t(T){if(T===M.dash&&J===Q$.htmlComment)return $.consume(T),o;if(T===M.lessThan&&J===Q$.htmlRaw)return $.consume(T),g;if(T===M.greaterThan&&J===Q$.htmlDeclaration)return $.consume(T),V$;if(T===M.questionMark&&J===Q$.htmlInstruction)return $.consume(T),_;if(T===M.rightSquareBracket&&J===Q$.htmlCdata)return $.consume(T),Y$;if(M$(T)&&(J===Q$.htmlBasic||J===Q$.htmlComplete))return $.exit(B.htmlFlowData),$.check(dn,o$,h)(T);if(T===M.eof||M$(T))return $.exit(B.htmlFlowData),h(T);return $.consume(T),t}function h(T){return $.check(ln,f,o$)(T)}function f(T){return x(M$(T)),$.enter(B.lineEnding),$.consume(T),$.exit(B.lineEnding),l}function l(T){if(T===M.eof||M$(T))return h(T);return $.enter(B.htmlFlowData),t(T)}function o(T){if(T===M.dash)return $.consume(T),_;return t(T)}function g(T){if(T===M.slash)return $.consume(T),H="",a;return t(T)}function a(T){if(T===M.greaterThan){let B$=H.toLowerCase();if(FD.includes(B$))return $.consume(T),V$;return t(T)}if(Z1(T)&&H.length<Q$.htmlRawSizeMax)return x(T!==null),$.consume(T),H+=String.fromCharCode(T),a;return t(T)}function Y$(T){if(T===M.rightSquareBracket)return $.consume(T),_;return t(T)}function _(T){if(T===M.greaterThan)return $.consume(T),V$;if(T===M.dash&&J===Q$.htmlComment)return $.consume(T),_;return t(T)}function V$(T){if(T===M.eof||M$(T))return $.exit(B.htmlFlowData),o$(T);return $.consume(T),V$}function o$(T){return $.exit(B.htmlFlow),X(T)}}function on($,X,Y){let W=this;return J;function J(H){if(M$(H))return $.enter(B.lineEnding),$.consume(H),$.exit(B.lineEnding),U;return Y(H)}function U(H){return W.parser.lazy[W.now().line]?Y(H):X(H)}}function an($,X,Y){return W;function W(J){return x(M$(J),"expected a line ending"),$.enter(B.lineEnding),$.consume(J),$.exit(B.lineEnding),$.attempt(f8,X,Y)}}var qD,dn,ln;var xM=A(()=>{P6();T6();bM();e$();y2();qD={concrete:!0,name:"htmlFlow",resolveTo:rn,tokenize:nn},dn={partial:!0,tokenize:an},ln={partial:!0,tokenize:on}});function sn($,X,Y){let W=this,J,U,H;return D;function D(_){return x(_===M.lessThan,"expected `<`"),$.enter(B.htmlText),$.enter(B.htmlTextData),$.consume(_),V}function V(_){if(_===M.exclamationMark)return $.consume(_),K;if(_===M.slash)return $.consume(_),y;if(_===M.questionMark)return $.consume(_),j;if(Z1(_))return $.consume(_),R;return Y(_)}function K(_){if(_===M.dash)return $.consume(_),Q;if(_===M.leftSquareBracket)return $.consume(_),U=0,z;if(Z1(_))return $.consume(_),P;return Y(_)}function Q(_){if(_===M.dash)return $.consume(_),w;return Y(_)}function q(_){if(_===M.eof)return Y(_);if(_===M.dash)return $.consume(_),F;if(M$(_))return H=q,g(_);return $.consume(_),q}function F(_){if(_===M.dash)return $.consume(_),w;return q(_)}function w(_){return _===M.greaterThan?o(_):_===M.dash?F(_):q(_)}function z(_){let V$=Q$.cdataOpeningString;if(_===V$.charCodeAt(U++))return $.consume(_),U===V$.length?O:z;return Y(_)}function O(_){if(_===M.eof)return Y(_);if(_===M.rightSquareBracket)return $.consume(_),N;if(M$(_))return H=O,g(_);return $.consume(_),O}function N(_){if(_===M.rightSquareBracket)return $.consume(_),L;return O(_)}function L(_){if(_===M.greaterThan)return o(_);if(_===M.rightSquareBracket)return $.consume(_),L;return O(_)}function P(_){if(_===M.eof||_===M.greaterThan)return o(_);if(M$(_))return H=P,g(_);return $.consume(_),P}function j(_){if(_===M.eof)return Y(_);if(_===M.questionMark)return $.consume(_),v;if(M$(_))return H=j,g(_);return $.consume(_),j}function v(_){return _===M.greaterThan?o(_):j(_)}function y(_){if(Z1(_))return $.consume(_),E;return Y(_)}function E(_){if(_===M.dash||n4(_))return $.consume(_),E;return b(_)}function b(_){if(M$(_))return H=b,g(_);if(a$(_))return $.consume(_),b;return o(_)}function R(_){if(_===M.dash||n4(_))return $.consume(_),R;if(_===M.slash||_===M.greaterThan||X4(_))return I(_);return Y(_)}function I(_){if(_===M.slash)return $.consume(_),o;if(_===M.colon||_===M.underscore||Z1(_))return $.consume(_),d;if(M$(_))return H=I,g(_);if(a$(_))return $.consume(_),I;return o(_)}function d(_){if(_===M.dash||_===M.dot||_===M.colon||_===M.underscore||n4(_))return $.consume(_),d;return k(_)}function k(_){if(_===M.equalsTo)return $.consume(_),t;if(M$(_))return H=k,g(_);if(a$(_))return $.consume(_),k;return I(_)}function t(_){if(_===M.eof||_===M.lessThan||_===M.equalsTo||_===M.greaterThan||_===M.graveAccent)return Y(_);if(_===M.quotationMark||_===M.apostrophe)return $.consume(_),J=_,h;if(M$(_))return H=t,g(_);if(a$(_))return $.consume(_),t;return $.consume(_),f}function h(_){if(_===J)return $.consume(_),J=void 0,l;if(_===M.eof)return Y(_);if(M$(_))return H=h,g(_);return $.consume(_),h}function f(_){if(_===M.eof||_===M.quotationMark||_===M.apostrophe||_===M.lessThan||_===M.equalsTo||_===M.graveAccent)return Y(_);if(_===M.slash||_===M.greaterThan||X4(_))return I(_);return $.consume(_),f}function l(_){if(_===M.slash||_===M.greaterThan||X4(_))return I(_);return Y(_)}function o(_){if(_===M.greaterThan)return $.consume(_),$.exit(B.htmlTextData),$.exit(B.htmlText),X;return Y(_)}function g(_){return x(H,"expected return state"),x(M$(_),"expected eol"),$.exit(B.htmlTextData),$.enter(B.lineEnding),$.consume(_),$.exit(B.lineEnding),a}function a(_){return x(W.parser.constructs.disable.null,"expected `disable.null` to be populated"),a$(_)?$6($,Y$,B.linePrefix,W.parser.constructs.disable.null.includes("codeIndented")?void 0:Q$.tabSize)(_):Y$(_)}function Y$(_){return $.enter(B.htmlTextData),H(_)}}var wD;var kM=A(()=>{P6();M4();T6();e$();wD={name:"htmlText",tokenize:sn}});function Xo($){let X=-1,Y=[];while(++X<$.length){let W=$[X][1];if(Y.push($[X]),W.type===B.labelImage||W.type===B.labelLink||W.type===B.labelEnd){let J=W.type===B.labelImage?4:2;W.type=B.data,X+=J}}if($.length!==Y.length)C4($,0,$.length,Y);return $}function Yo($,X){let Y=$.length,W=0,J,U,H,D;while(Y--)if(J=$[Y][1],U){if(J.type===B.link||J.type===B.labelLink&&J._inactive)break;if($[Y][0]==="enter"&&J.type===B.labelLink)J._inactive=!0}else if(H){if($[Y][0]==="enter"&&(J.type===B.labelImage||J.type===B.labelLink)&&!J._balanced){if(U=Y,J.type!==B.labelLink){W=2;break}}}else if(J.type===B.labelEnd)H=Y;x(U!==void 0,"`open` is supposed to be found"),x(H!==void 0,"`close` is supposed to be found");let V={type:$[U][1].type===B.labelLink?B.link:B.image,start:{...$[U][1].start},end:{...$[$.length-1][1].end}},K={type:B.label,start:{...$[U][1].start},end:{...$[H][1].end}},Q={type:B.labelText,start:{...$[U+W+2][1].end},end:{...$[H-2][1].start}};return D=[["enter",V,X],["enter",K,X]],D=r4(D,$.slice(U+1,U+W+3)),D=r4(D,[["enter",Q,X]]),x(X.parser.constructs.insideSpan.null,"expected `insideSpan.null` to be populated"),D=r4(D,g5(X.parser.constructs.insideSpan.null,$.slice(U+W+4,H-3),X)),D=r4(D,[["exit",Q,X],$[H-2],$[H-1],["exit",K,X]]),D=r4(D,$.slice(H+1)),D=r4(D,[["exit",V,X]]),C4($,U,$.length,D),$}function Jo($,X,Y){let W=this,J=W.events.length,U,H;while(J--)if((W.events[J][1].type===B.labelImage||W.events[J][1].type===B.labelLink)&&!W.events[J][1]._balanced){U=W.events[J][1];break}return D;function D(F){if(x(F===M.rightSquareBracket,"expected `]`"),!U)return Y(F);if(U._inactive)return q(F);return H=W.parser.defined.includes(U8(W.sliceSerialize({start:U.end,end:W.now()}))),$.enter(B.labelEnd),$.enter(B.labelMarker),$.consume(F),$.exit(B.labelMarker),$.exit(B.labelEnd),V}function V(F){if(F===M.leftParenthesis)return $.attempt(tn,Q,H?Q:q)(F);if(F===M.leftSquareBracket)return $.attempt(en,Q,H?K:q)(F);return H?Q(F):q(F)}function K(F){return $.attempt($o,Q,q)(F)}function Q(F){return X(F)}function q(F){return U._balanced=!0,Y(F)}}function Wo($,X,Y){return W;function W(q){return x(q===M.leftParenthesis,"expected left paren"),$.enter(B.resource),$.enter(B.resourceMarker),$.consume(q),$.exit(B.resourceMarker),J}function J(q){return X4(q)?A9($,U)(q):U(q)}function U(q){if(q===M.rightParenthesis)return Q(q);return c2($,H,D,B.resourceDestination,B.resourceDestinationLiteral,B.resourceDestinationLiteralMarker,B.resourceDestinationRaw,B.resourceDestinationString,Q$.linkResourceDestinationBalanceMax)(q)}function H(q){return X4(q)?A9($,V)(q):Q(q)}function D(q){return Y(q)}function V(q){if(q===M.quotationMark||q===M.apostrophe||q===M.leftParenthesis)return l2($,K,Y,B.resourceTitle,B.resourceTitleMarker,B.resourceTitleString)(q);return Q(q)}function K(q){return X4(q)?A9($,Q)(q):Q(q)}function Q(q){if(q===M.rightParenthesis)return $.enter(B.resourceMarker),$.consume(q),$.exit(B.resourceMarker),$.exit(B.resource),X;return Y(q)}}function Uo($,X,Y){let W=this;return J;function J(D){return x(D===M.leftSquareBracket,"expected left bracket"),d2.call(W,$,U,H,B.reference,B.referenceMarker,B.referenceString)(D)}function U(D){return W.parser.defined.includes(U8(W.sliceSerialize(W.events[W.events.length-1][1]).slice(1,-1)))?X(D):Y(D)}function H(D){return Y(D)}}function Go($,X,Y){return W;function W(U){return x(U===M.leftSquareBracket,"expected left bracket"),$.enter(B.reference),$.enter(B.referenceMarker),$.consume(U),$.exit(B.referenceMarker),J}function J(U){if(U===M.rightSquareBracket)return $.enter(B.referenceMarker),$.consume(U),$.exit(B.referenceMarker),$.exit(B.reference),X;return Y(U)}}var B9,tn,en,$o;var i2=A(()=>{P6();UD();GD();HD();DD();T6();h8();h2();e$();B9={name:"labelEnd",resolveAll:Xo,resolveTo:Yo,tokenize:Jo},tn={tokenize:Wo},en={tokenize:Uo},$o={tokenize:Go}});function Ho($,X,Y){let W=this;return J;function J(D){return x(D===M.exclamationMark,"expected `!`"),$.enter(B.labelImage),$.enter(B.labelImageMarker),$.consume(D),$.exit(B.labelImageMarker),U}function U(D){if(D===M.leftSquareBracket)return $.enter(B.labelMarker),$.consume(D),$.exit(B.labelMarker),$.exit(B.labelImage),H;return Y(D)}function H(D){return D===M.caret&&"_hiddenFootnoteSupport"in W.parser.constructs?Y(D):X(D)}}var ZD;var vM=A(()=>{P6();e$();i2();ZD={name:"labelStartImage",resolveAll:B9.resolveAll,tokenize:Ho}});function Do($,X,Y){let W=this;return J;function J(H){return x(H===M.leftSquareBracket,"expected `[`"),$.enter(B.labelLink),$.enter(B.labelMarker),$.consume(H),$.exit(B.labelMarker),$.exit(B.labelLink),U}function U(H){return H===M.caret&&"_hiddenFootnoteSupport"in W.parser.constructs?Y(H):X(H)}}var zD;var hM=A(()=>{P6();e$();i2();zD={name:"labelStartLink",resolveAll:B9.resolveAll,tokenize:Do}});function Vo($,X){return Y;function Y(W){return x(M$(W),"expected eol"),$.enter(B.lineEnding),$.consume(W),$.exit(B.lineEnding),$6($,X,B.linePrefix)}}var i7;var yM=A(()=>{P6();M4();T6();e$();i7={name:"lineEnding",tokenize:Vo}});function Ko($,X,Y){let W=0,J;return U;function U(K){return $.enter(B.thematicBreak),H(K)}function H(K){return x(K===M.asterisk||K===M.dash||K===M.underscore,"expected `*`, `-`, or `_`"),J=K,D(K)}function D(K){if(K===J)return $.enter(B.thematicBreakSequence),V(K);if(W>=Q$.thematicBreakMarkerCountMin&&(K===M.eof||M$(K)))return $.exit(B.thematicBreak),X(K);return Y(K)}function V(K){if(K===J)return $.consume(K),W++,V;return $.exit(B.thematicBreakSequence),a$(K)?$6($,D,B.whitespace)(K):D(K)}}var M9;var OD=A(()=>{P6();M4();T6();e$();M9={name:"thematicBreak",tokenize:Ko}});function qo($,X,Y){let W=this,J=W.events[W.events.length-1],U=J&&J[1].type===B.linePrefix?J[2].sliceSerialize(J[1],!0).length:0,H=0;return D;function D(w){x(W.containerState,"expected state");let z=W.containerState.type||(w===M.asterisk||w===M.plusSign||w===M.dash?B.listUnordered:B.listOrdered);if(z===B.listUnordered?!W.containerState.marker||w===W.containerState.marker:p7(w)){if(!W.containerState.type)W.containerState.type=z,$.enter(z,{_container:!0});if(z===B.listUnordered)return $.enter(B.listItemPrefix),w===M.asterisk||w===M.dash?$.check(M9,Y,K)(w):K(w);if(!W.interrupt||w===M.digit1)return $.enter(B.listItemPrefix),$.enter(B.listItemValue),V(w)}return Y(w)}function V(w){if(x(W.containerState,"expected state"),p7(w)&&++H<Q$.listItemValueSizeMax)return $.consume(w),V;if((!W.interrupt||H<2)&&(W.containerState.marker?w===W.containerState.marker:w===M.rightParenthesis||w===M.dot))return $.exit(B.listItemValue),K(w);return Y(w)}function K(w){return x(W.containerState,"expected state"),x(w!==M.eof,"eof (`null`) is not a marker"),$.enter(B.listItemMarker),$.consume(w),$.exit(B.listItemMarker),W.containerState.marker=W.containerState.marker||w,$.check(f8,W.interrupt?Y:Q,$.attempt(Qo,F,q))}function Q(w){return x(W.containerState,"expected state"),W.containerState.initialBlankLine=!0,U++,F(w)}function q(w){if(a$(w))return $.enter(B.listItemPrefixWhitespace),$.consume(w),$.exit(B.listItemPrefixWhitespace),F;return Y(w)}function F(w){return x(W.containerState,"expected state"),W.containerState.size=U+W.sliceSerialize($.exit(B.listItemPrefix),!0).length,X(w)}}function wo($,X,Y){let W=this;return x(W.containerState,"expected state"),W.containerState._closeFlow=void 0,$.check(f8,J,U);function J(D){return x(W.containerState,"expected state"),x(typeof W.containerState.size==="number","expected size"),W.containerState.furtherBlankLines=W.containerState.furtherBlankLines||W.containerState.initialBlankLine,$6($,X,B.listItemIndent,W.containerState.size+1)(D)}function U(D){if(x(W.containerState,"expected state"),W.containerState.furtherBlankLines||!a$(D))return W.containerState.furtherBlankLines=void 0,W.containerState.initialBlankLine=void 0,H(D);return W.containerState.furtherBlankLines=void 0,W.containerState.initialBlankLine=void 0,$.attempt(Fo,X,H)(D)}function H(D){return x(W.containerState,"expected state"),W.containerState._closeFlow=!0,W.interrupt=void 0,x(W.parser.constructs.disable.null,"expected `disable.null` to be populated"),$6($,$.attempt(y4,X,Y),B.linePrefix,W.parser.constructs.disable.null.includes("codeIndented")?void 0:Q$.tabSize)(D)}}function Zo($,X,Y){let W=this;return x(W.containerState,"expected state"),x(typeof W.containerState.size==="number","expected size"),$6($,J,B.listItemIndent,W.containerState.size+1);function J(U){x(W.containerState,"expected state");let H=W.events[W.events.length-1];return H&&H[1].type===B.listItemIndent&&H[2].sliceSerialize(H[1],!0).length===W.containerState.size?X(U):Y(U)}}function zo($){x(this.containerState,"expected state"),x(typeof this.containerState.type==="string","expected type"),$.exit(this.containerState.type)}function Oo($,X,Y){let W=this;return x(W.parser.constructs.disable.null,"expected `disable.null` to be populated"),$6($,J,B.listItemPrefixWhitespace,W.parser.constructs.disable.null.includes("codeIndented")?void 0:Q$.tabSize+1);function J(U){let H=W.events[W.events.length-1];return!a$(U)&&H&&H[1].type===B.listItemPrefixWhitespace?X(U):Y(U)}}var y4,Qo,Fo;var fM=A(()=>{P6();M4();T6();e$();y2();OD();y4={continuation:{tokenize:wo},exit:zo,name:"list",tokenize:qo},Qo={partial:!0,tokenize:Oo},Fo={partial:!0,tokenize:Zo}});function No($,X){let Y=$.length,W,J,U;while(Y--)if($[Y][0]==="enter"){if($[Y][1].type===B.content){W=Y;break}if($[Y][1].type===B.paragraph)J=Y}else{if($[Y][1].type===B.content)$.splice(Y,1);if(!U&&$[Y][1].type===B.definition)U=Y}x(J!==void 0,"expected a `text` index to be found"),x(W!==void 0,"expected a `text` index to be found"),x($[W][2]===X,"enter context should be same"),x($[$.length-1][2]===X,"enter context should be same");let H={type:B.setextHeading,start:{...$[W][1].start},end:{...$[$.length-1][1].end}};if($[J][1].type=B.setextHeadingText,U)$.splice(J,0,["enter",H,X]),$.splice(U+1,0,["exit",$[W][1],X]),$[W][1].end={...$[U][1].end};else $[W][1]=H;return $.push(["exit",H,X]),$}function Ao($,X,Y){let W=this,J;return U;function U(K){let Q=W.events.length,q;x(K===M.dash||K===M.equalsTo,"expected `=` or `-`");while(Q--)if(W.events[Q][1].type!==B.lineEnding&&W.events[Q][1].type!==B.linePrefix&&W.events[Q][1].type!==B.content){q=W.events[Q][1].type===B.paragraph;break}if(!W.parser.lazy[W.now().line]&&(W.interrupt||q))return $.enter(B.setextHeadingLine),J=K,H(K);return Y(K)}function H(K){return $.enter(B.setextHeadingLineSequence),D(K)}function D(K){if(K===J)return $.consume(K),D;return $.exit(B.setextHeadingLineSequence),a$(K)?$6($,V,B.lineSuffix)(K):V(K)}function V(K){if(K===M.eof||M$(K))return $.exit(B.setextHeadingLine),X(K);return Y(K)}}var r2;var gM=A(()=>{P6();M4();T6();e$();r2={name:"setextUnderline",resolveTo:No,tokenize:Ao}});var ND=A(()=>{zM();OM();y2();NM();AM();BM();jM();RM();EM();IM();_M();TM();CM();xM();kM();i2();vM();hM();yM();fM();gM();OD()});function Bo($){let X=this,Y=$.attempt(f8,W,$.attempt(this.parser.constructs.flowInitial,J,$6($,$.attempt(this.parser.constructs.flow,J,$.attempt(WD,J)),B.linePrefix)));return Y;function W(U){if(x(U===M.eof||M$(U),"expected eol or eof"),U===M.eof){$.consume(U);return}return $.enter(B.lineEndingBlank),$.consume(U),$.exit(B.lineEndingBlank),X.currentConstruct=void 0,Y}function J(U){if(x(U===M.eof||M$(U),"expected eol or eof"),U===M.eof){$.consume(U);return}return $.enter(B.lineEnding),$.consume(U),$.exit(B.lineEnding),X.currentConstruct=void 0,Y}}var mM;var uM=A(()=>{P6();ND();M4();T6();e$();mM={tokenize:Bo}});function lM($){return{resolveAll:iM($==="text"?Mo:void 0),tokenize:X};function X(Y){let W=this,J=this.parser.constructs[$],U=Y.attempt(J,H,D);return H;function H(Q){return K(Q)?U(Q):D(Q)}function D(Q){if(Q===M.eof){Y.consume(Q);return}return Y.enter(B.data),Y.consume(Q),V}function V(Q){if(K(Q))return Y.exit(B.data),U(Q);return Y.consume(Q),V}function K(Q){if(Q===M.eof)return!0;let q=J[Q],F=-1;if(q){x(Array.isArray(q),"expected `disable.null` to be populated");while(++F<q.length){let w=q[F];if(!w.previous||w.previous.call(W,W.previous))return!0}}return!1}}}function iM($){return X;function X(Y,W){let J=-1,U;while(++J<=Y.length)if(U===void 0){if(Y[J]&&Y[J][1].type===B.data)U=J,J++}else if(!Y[J]||Y[J][1].type!==B.data){if(J!==U+2)Y[U][1].end=Y[J-1][1].end,Y.splice(U+2,J-U-2),J=U+2;U=void 0}return $?$(Y,W):Y}}function Mo($,X){let Y=0;while(++Y<=$.length)if((Y===$.length||$[Y][1].type===B.lineEnding)&&$[Y-1][1].type===B.data){let W=$[Y-1][1],J=X.sliceStream(W),U=J.length,H=-1,D=0,V;while(U--){let K=J[U];if(typeof K==="string"){H=K.length;while(K.charCodeAt(H-1)===M.space)D++,H--;if(H)break;H=-1}else if(K===M.horizontalTab)V=!0,D++;else if(K===M.virtualSpace);else{U++;break}}if(X._contentTypeTextTrailing&&Y===$.length)D=0;if(D){let K={type:Y===$.length||V||D<Q$.hardBreakPrefixSizeMin?B.lineSuffix:B.hardBreakTrailing,start:{_bufferIndex:U?H:W.start._bufferIndex+H,_index:W.start._index+U,line:W.end.line,column:W.end.column-D,offset:W.end.offset-D},end:{...W.end}};if(W.end={...K.start},W.start.offset===W.end.offset)Object.assign(W,K);else $.splice(Y,0,["enter",K,X],["exit",K,X]),Y+=2}Y++}return $}var pM,cM,dM;var AD=A(()=>{P6();e$();pM={resolveAll:iM()},cM=lM("string"),dM=lM("text")});var BD={};e0(BD,{text:()=>Io,string:()=>Po,insideSpan:()=>_o,flowInitial:()=>Lo,flow:()=>Eo,document:()=>jo,disable:()=>Co,contentInitial:()=>Ro,attentionMarkers:()=>To});var jo,Ro,Lo,Eo,Po,Io,_o,To,Co;var rM=A(()=>{ND();e$();AD();jo={[M.asterisk]:y4,[M.plusSign]:y4,[M.dash]:y4,[M.digit0]:y4,[M.digit1]:y4,[M.digit2]:y4,[M.digit3]:y4,[M.digit4]:y4,[M.digit5]:y4,[M.digit6]:y4,[M.digit7]:y4,[M.digit8]:y4,[M.digit9]:y4,[M.greaterThan]:f2},Ro={[M.leftSquareBracket]:VD},Lo={[M.horizontalTab]:d7,[M.virtualSpace]:d7,[M.space]:d7},Eo={[M.numberSign]:QD,[M.asterisk]:M9,[M.dash]:[r2,M9],[M.lessThan]:qD,[M.equalsTo]:r2,[M.underscore]:M9,[M.graveAccent]:u2,[M.tilde]:u2},Po={[M.ampersand]:m2,[M.backslash]:g2},Io={[M.carriageReturn]:i7,[M.lineFeed]:i7,[M.carriageReturnLineFeed]:i7,[M.exclamationMark]:ZD,[M.ampersand]:m2,[M.asterisk]:c7,[M.lessThan]:[$D,wD],[M.leftSquareBracket]:zD,[M.backslash]:[KD,g2],[M.rightSquareBracket]:B9,[M.underscore]:c7,[M.graveAccent]:XD},_o={null:[c7,pM]},To={null:[M.asterisk,M.underscore]},Co={null:[]}});var oM=X$((aZ$,nM)=>{var m5=1000,u5=m5*60,p5=u5*60,j9=p5*24,So=j9*7,bo=j9*365.25;nM.exports=function($,X){X=X||{};var Y=typeof $;if(Y==="string"&&$.length>0)return xo($);else if(Y==="number"&&isFinite($))return X.long?vo($):ko($);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify($))};function xo($){if($=String($),$.length>100)return;var X=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec($);if(!X)return;var Y=parseFloat(X[1]),W=(X[2]||"ms").toLowerCase();switch(W){case"years":case"year":case"yrs":case"yr":case"y":return Y*bo;case"weeks":case"week":case"w":return Y*So;case"days":case"day":case"d":return Y*j9;case"hours":case"hour":case"hrs":case"hr":case"h":return Y*p5;case"minutes":case"minute":case"mins":case"min":case"m":return Y*u5;case"seconds":case"second":case"secs":case"sec":case"s":return Y*m5;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return Y;default:return}}function ko($){var X=Math.abs($);if(X>=j9)return Math.round($/j9)+"d";if(X>=p5)return Math.round($/p5)+"h";if(X>=u5)return Math.round($/u5)+"m";if(X>=m5)return Math.round($/m5)+"s";return $+"ms"}function vo($){var X=Math.abs($);if(X>=j9)return n2($,X,j9,"day");if(X>=p5)return n2($,X,p5,"hour");if(X>=u5)return n2($,X,u5,"minute");if(X>=m5)return n2($,X,m5,"second");return $+" ms"}function n2($,X,Y,W){var J=X>=Y*1.5;return Math.round($/Y)+" "+W+(J?"s":"")}});var MD=X$((sZ$,aM)=>{function ho($){Y.debug=Y,Y.default=Y,Y.coerce=V,Y.disable=H,Y.enable=J,Y.enabled=D,Y.humanize=oM(),Y.destroy=K,Object.keys($).forEach((Q)=>{Y[Q]=$[Q]}),Y.names=[],Y.skips=[],Y.formatters={};function X(Q){let q=0;for(let F=0;F<Q.length;F++)q=(q<<5)-q+Q.charCodeAt(F),q|=0;return Y.colors[Math.abs(q)%Y.colors.length]}Y.selectColor=X;function Y(Q){let q,F=null,w,z;function O(...N){if(!O.enabled)return;let L=O,P=Number(new Date),j=P-(q||P);if(L.diff=j,L.prev=q,L.curr=P,q=P,N[0]=Y.coerce(N[0]),typeof N[0]!=="string")N.unshift("%O");let v=0;N[0]=N[0].replace(/%([a-zA-Z%])/g,(E,b)=>{if(E==="%%")return"%";v++;let R=Y.formatters[b];if(typeof R==="function"){let I=N[v];E=R.call(L,I),N.splice(v,1),v--}return E}),Y.formatArgs.call(L,N),(L.log||Y.log).apply(L,N)}if(O.namespace=Q,O.useColors=Y.useColors(),O.color=Y.selectColor(Q),O.extend=W,O.destroy=Y.destroy,Object.defineProperty(O,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(F!==null)return F;if(w!==Y.namespaces)w=Y.namespaces,z=Y.enabled(Q);return z},set:(N)=>{F=N}}),typeof Y.init==="function")Y.init(O);return O}function W(Q,q){let F=Y(this.namespace+(typeof q>"u"?":":q)+Q);return F.log=this.log,F}function J(Q){Y.save(Q),Y.namespaces=Q,Y.names=[],Y.skips=[];let q=(typeof Q==="string"?Q:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let F of q)if(F[0]==="-")Y.skips.push(F.slice(1));else Y.names.push(F)}function U(Q,q){let F=0,w=0,z=-1,O=0;while(F<Q.length)if(w<q.length&&(q[w]===Q[F]||q[w]==="*"))if(q[w]==="*")z=w,O=F,w++;else F++,w++;else if(z!==-1)w=z+1,O++,F=O;else return!1;while(w<q.length&&q[w]==="*")w++;return w===q.length}function H(){let Q=[...Y.names,...Y.skips.map((q)=>"-"+q)].join(",");return Y.enable(""),Q}function D(Q){for(let q of Y.skips)if(U(Q,q))return!1;for(let q of Y.names)if(U(Q,q))return!0;return!1}function V(Q){if(Q instanceof Error)return Q.stack||Q.message;return Q}function K(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return Y.enable(Y.load()),Y}aM.exports=ho});var tM=X$((sM,o2)=>{sM.formatArgs=fo;sM.save=go;sM.load=mo;sM.useColors=yo;sM.storage=uo();sM.destroy=(()=>{let $=!1;return()=>{if(!$)$=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();sM.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function yo(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let $;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&($=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt($[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function fo($){if($[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+$[0]+(this.useColors?"%c ":" ")+"+"+o2.exports.humanize(this.diff),!this.useColors)return;let X="color: "+this.color;$.splice(1,0,X,"color: inherit");let Y=0,W=0;$[0].replace(/%[a-zA-Z%]/g,(J)=>{if(J==="%%")return;if(Y++,J==="%c")W=Y}),$.splice(W,0,X)}sM.log=console.debug||console.log||(()=>{});function go($){try{if($)sM.storage.setItem("debug",$);else sM.storage.removeItem("debug")}catch(X){}}function mo(){let $;try{$=sM.storage.getItem("debug")||sM.storage.getItem("DEBUG")}catch(X){}if(!$&&typeof process<"u"&&"env"in process)$=process.env.DEBUG;return $}function uo(){try{return localStorage}catch($){}}o2.exports=MD()(sM);var{formatters:po}=o2.exports;po.j=function($){try{return JSON.stringify($)}catch(X){return"[UnexpectedJSONParseError]: "+X.message}}});var $j=X$((eZ$,eM)=>{eM.exports=($,X=process.argv)=>{let Y=$.startsWith("-")?"":$.length===1?"-":"--",W=X.indexOf(Y+$),J=X.indexOf("--");return W!==-1&&(J===-1||W<J)}});var Jj=X$(($z$,Yj)=>{var so=I4("os"),Xj=I4("tty"),C1=$j(),{env:j4}=process,g8;if(C1("no-color")||C1("no-colors")||C1("color=false")||C1("color=never"))g8=0;else if(C1("color")||C1("colors")||C1("color=true")||C1("color=always"))g8=1;if("FORCE_COLOR"in j4)if(j4.FORCE_COLOR==="true")g8=1;else if(j4.FORCE_COLOR==="false")g8=0;else g8=j4.FORCE_COLOR.length===0?1:Math.min(parseInt(j4.FORCE_COLOR,10),3);function jD($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function RD($,X){if(g8===0)return 0;if(C1("color=16m")||C1("color=full")||C1("color=truecolor"))return 3;if(C1("color=256"))return 2;if($&&!X&&g8===void 0)return 0;let Y=g8||0;if(j4.TERM==="dumb")return Y;if(process.platform==="win32"){let W=so.release().split(".");if(Number(W[0])>=10&&Number(W[2])>=10586)return Number(W[2])>=14931?3:2;return 1}if("CI"in j4){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((W)=>(W in j4))||j4.CI_NAME==="codeship")return 1;return Y}if("TEAMCITY_VERSION"in j4)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(j4.TEAMCITY_VERSION)?1:0;if(j4.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in j4){let W=parseInt((j4.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(j4.TERM_PROGRAM){case"iTerm.app":return W>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(j4.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(j4.TERM))return 1;if("COLORTERM"in j4)return 1;return Y}function to($){let X=RD($,$&&$.isTTY);return jD(X)}Yj.exports={supportsColor:to,stdout:jD(RD(!0,Xj.isatty(1))),stderr:jD(RD(!0,Xj.isatty(2)))}});var Hj=X$((Uj,s2)=>{var eo=I4("tty"),a2=I4("util");Uj.init=Ga;Uj.log=Ja;Uj.formatArgs=Xa;Uj.save=Wa;Uj.load=Ua;Uj.useColors=$a;Uj.destroy=a2.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Uj.colors=[6,2,3,4,5,1];try{let $=Jj();if($&&($.stderr||$).level>=2)Uj.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch($){}Uj.inspectOpts=Object.keys(process.env).filter(($)=>{return/^debug_/i.test($)}).reduce(($,X)=>{let Y=X.substring(6).toLowerCase().replace(/_([a-z])/g,(J,U)=>{return U.toUpperCase()}),W=process.env[X];if(/^(yes|on|true|enabled)$/i.test(W))W=!0;else if(/^(no|off|false|disabled)$/i.test(W))W=!1;else if(W==="null")W=null;else W=Number(W);return $[Y]=W,$},{});function $a(){return"colors"in Uj.inspectOpts?Boolean(Uj.inspectOpts.colors):eo.isatty(process.stderr.fd)}function Xa($){let{namespace:X,useColors:Y}=this;if(Y){let W=this.color,J="\x1B[3"+(W<8?W:"8;5;"+W),U=` ${J};1m${X} \x1B[0m`;$[0]=U+$[0].split(`
101
- `).join(`
102
- `+U),$.push(J+"m+"+s2.exports.humanize(this.diff)+"\x1B[0m")}else $[0]=Ya()+X+" "+$[0]}function Ya(){if(Uj.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function Ja(...$){return process.stderr.write(a2.formatWithOptions(Uj.inspectOpts,...$)+`
103
- `)}function Wa($){if($)process.env.DEBUG=$;else delete process.env.DEBUG}function Ua(){return process.env.DEBUG}function Ga($){$.inspectOpts={};let X=Object.keys(Uj.inspectOpts);for(let Y=0;Y<X.length;Y++)$.inspectOpts[X[Y]]=Uj.inspectOpts[X[Y]]}s2.exports=MD()(Uj);var{formatters:Wj}=s2.exports;Wj.o=function($){return this.inspectOpts.colors=this.useColors,a2.inspect($,this.inspectOpts).split(`
104
- `).map((X)=>X.trim()).join(" ")};Wj.O=function($){return this.inspectOpts.colors=this.useColors,a2.inspect($,this.inspectOpts)}});var Dj=X$((Yz$,LD)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)LD.exports=tM();else LD.exports=Hj()});function Kj($,X,Y){let W={_bufferIndex:-1,_index:0,line:Y&&Y.line||1,column:Y&&Y.column||1,offset:Y&&Y.offset||0},J={},U=[],H=[],D=[],V=!0,K={attempt:I(b),check:I(R),consume:v,enter:y,exit:E,interrupt:I(R,{interrupt:!0})},Q={code:M.eof,containerState:{},defineSkip:L,events:[],now:N,parser:$,previous:M.eof,sliceSerialize:z,sliceStream:O,write:w},q=X.tokenize.call(Q,K),F;if(X.resolveAll)U.push(X);return Q;function w(h){if(H=r4(H,h),P(),H[H.length-1]!==M.eof)return[];return d(X,0),Q.events=g5(U,Q.events,Q),Q.events}function z(h,f){return Za(O(h),f)}function O(h){return wa(H,h)}function N(){let{_bufferIndex:h,_index:f,line:l,column:o,offset:g}=W;return{_bufferIndex:h,_index:f,line:l,column:o,offset:g}}function L(h){J[h.line]=h.column,t(),L9("position: define skip: `%j`",W)}function P(){let h;while(W._index<H.length){let f=H[W._index];if(typeof f==="string"){if(h=W._index,W._bufferIndex<0)W._bufferIndex=0;while(W._index===h&&W._bufferIndex<f.length)j(f.charCodeAt(W._bufferIndex))}else j(f)}}function j(h){x(V===!0,"expected character to be consumed"),V=void 0,L9("main: passing `%s` to %s",h,q&&q.name),F=h,x(typeof q==="function","expected state"),q=q(h)}function v(h){if(x(h===F,"expected given code to equal expected code"),L9("consume: `%s`",h),x(V===void 0,"expected code to not have been consumed: this might be because `return x(code)` instead of `return x` was used"),x(h===null?Q.events.length===0||Q.events[Q.events.length-1][0]==="exit":Q.events[Q.events.length-1][0]==="enter","expected last token to be open"),M$(h))W.line++,W.column=1,W.offset+=h===M.carriageReturnLineFeed?2:1,t(),L9("position: after eol: `%j`",W);else if(h!==M.virtualSpace)W.column++,W.offset++;if(W._bufferIndex<0)W._index++;else if(W._bufferIndex++,W._bufferIndex===H[W._index].length)W._bufferIndex=-1,W._index++;Q.previous=h,V=!0}function y(h,f){let l=f||{};return l.type=h,l.start=N(),x(typeof h==="string","expected string type"),x(h.length>0,"expected non-empty string"),L9("enter: `%s`",h),Q.events.push(["enter",l,Q]),D.push(l),l}function E(h){x(typeof h==="string","expected string type"),x(h.length>0,"expected non-empty string");let f=D.pop();return x(f,"cannot close w/o open tokens"),f.end=N(),x(h===f.type,"expected exit token to match current token"),x(!(f.start._index===f.end._index&&f.start._bufferIndex===f.end._bufferIndex),"expected non-empty token (`"+h+"`)"),L9("exit: `%s`",f.type),Q.events.push(["exit",f,Q]),f}function b(h,f){d(h,f.from)}function R(h,f){f.restore()}function I(h,f){return l;function l(o,g,a){let Y$,_,V$,o$;return Array.isArray(o)?B$(o):("tokenize"in o)?B$([o]):T(o);function T(H$){return F$;function F$(P$){let j$=P$!==null&&H$[P$],U$=P$!==null&&H$.null,n=[...Array.isArray(j$)?j$:j$?[j$]:[],...Array.isArray(U$)?U$:U$?[U$]:[]];return B$(n)(P$)}}function B$(H$){if(Y$=H$,_=0,H$.length===0)return x(a,"expected `bogusState` to be given"),a;return k$(H$[_])}function k$(H$){return F$;function F$(P$){if(o$=k(),V$=H$,!H$.partial)Q.currentConstruct=H$;if(x(Q.parser.constructs.disable.null,"expected `disable.null` to be populated"),H$.name&&Q.parser.constructs.disable.null.includes(H$.name))return T$(P$);return H$.tokenize.call(f?Object.assign(Object.create(Q),f):Q,K,m,T$)(P$)}}function m(H$){return x(H$===F,"expected code"),V=!0,h(V$,o$),g}function T$(H$){if(x(H$===F,"expected code"),V=!0,o$.restore(),++_<Y$.length)return k$(Y$[_]);return a}}}function d(h,f){if(h.resolveAll&&!U.includes(h))U.push(h);if(h.resolve)C4(Q.events,f,Q.events.length-f,h.resolve(Q.events.slice(f),Q));if(h.resolveTo)Q.events=h.resolveTo(Q.events,Q);x(h.partial||Q.events.length===0||Q.events[Q.events.length-1][0]==="exit","expected last token to end")}function k(){let h=N(),f=Q.previous,l=Q.currentConstruct,o=Q.events.length,g=Array.from(D);return{from:o,restore:a};function a(){W=h,Q.previous=f,Q.currentConstruct=l,Q.events.length=o,D=g,t(),L9("position: restore: `%j`",W)}}function t(){if(W.line in J&&W.column<2)W.column=J[W.line],W.offset+=J[W.line]-1}}function wa($,X){let Y=X.start._index,W=X.start._bufferIndex,J=X.end._index,U=X.end._bufferIndex,H;if(Y===J)x(U>-1,"expected non-negative end buffer index"),x(W>-1,"expected non-negative start buffer index"),H=[$[Y].slice(W,U)];else{if(H=$.slice(Y,J),W>-1){let D=H[0];if(typeof D==="string")H[0]=D.slice(W);else x(W===0,"expected `startBufferIndex` to be `0`"),H.shift()}if(U>0)H.push($[J].slice(0,U))}return H}function Za($,X){let Y=-1,W=[],J;while(++Y<$.length){let U=$[Y],H;if(typeof U==="string")H=U;else switch(U){case M.carriageReturn:{H=w1.cr;break}case M.lineFeed:{H=w1.lf;break}case M.carriageReturnLineFeed:{H=w1.cr+w1.lf;break}case M.horizontalTab:{H=X?w1.space:w1.ht;break}case M.virtualSpace:{if(!X&&J)continue;H=w1.space;break}default:x(typeof U==="number","expected number"),H=String.fromCharCode(U)}J=U===M.horizontalTab,W.push(H)}return W.join("")}var Vj,L9;var Qj=A(()=>{P6();T6();h8();e$();Vj=n1(Dj(),1),L9=Vj.default("micromark")});function ED($){let W={constructs:JM([BD,...($||{}).extensions||[]]),content:J(KM),defined:[],document:J(qM),flow:J(mM),lazy:{},string:J(cM),text:J(dM)};return W;function J(U){return H;function H(D){return Kj(W,U,D)}}}var Fj=A(()=>{WM();QM();wM();uM();AD();rM();Qj()});function PD($){while(!p2($));return $}var qj=A(()=>{JD()});function ID(){let $=1,X="",Y=!0,W;return J;function J(U,H,D){let V=[],K,Q,q,F,w;if(U=X+(typeof U==="string"?U.toString():new TextDecoder(H||void 0).decode(U)),q=0,X="",Y){if(U.charCodeAt(0)===M.byteOrderMarker)q++;Y=void 0}while(q<U.length){if(wj.lastIndex=q,K=wj.exec(U),F=K&&K.index!==void 0?K.index:U.length,w=U.charCodeAt(F),!K){X=U.slice(q);break}if(w===M.lf&&q===F&&W)V.push(M.carriageReturnLineFeed),W=void 0;else{if(W)V.push(M.carriageReturn),W=void 0;if(q<F)V.push(U.slice(q,F)),$+=F-q;switch(w){case M.nul:{V.push(M.replacementCharacter),$++;break}case M.ht:{Q=Math.ceil($/Q$.tabSize)*Q$.tabSize,V.push(M.horizontalTab);while($++<Q)V.push(M.virtualSpace);break}case M.lf:{V.push(M.lineFeed),$=1;break}default:W=!0,$=1}}q=F+1}if(D){if(W)V.push(M.carriageReturn);if(X)V.push(X);V.push(M.eof)}return V}}var wj;var Zj=A(()=>{e$();wj=/[\0\t\n\r]/g});var zj=A(()=>{Fj();qj();Zj()});function t2($){return $.replace(za,Oa)}function Oa($,X,Y){if(X)return X;if(Y.charCodeAt(0)===M.numberSign){let J=Y.charCodeAt(1),U=J===M.lowercaseX||J===M.uppercaseX;return v2(Y.slice(U?2:1),U?Q$.numericBaseHexadecimal:Q$.numericBaseDecimal)}return y5(Y)||$}var za;var _D=A(()=>{k2();tH();e$();za=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi});function m8($){if(!$||typeof $!=="object")return"";if("position"in $||"type"in $)return Oj($.position);if("start"in $||"end"in $)return Oj($);if("line"in $||"column"in $)return TD($);return""}function TD($){return Nj($&&$.line)+":"+Nj($&&$.column)}function Oj($){return TD($&&$.start)+"-"+TD($&&$.end)}function Nj($){return $&&typeof $==="number"?$:1}var CD=()=>{};function SD($,X,Y){if(X&&typeof X==="object")Y=X,X=void 0;return Na(Y)(PD(ED(Y).document().write(ID()($,X,!0))))}function Na($){let X={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:U(l4),autolinkProtocol:I,autolinkEmail:I,atxHeading:U(S$),blockQuote:U(P$),characterEscape:I,characterReference:I,codeFenced:U(j$),codeFencedFenceInfo:H,codeFencedFenceMeta:H,codeIndented:U(j$,H),codeText:U(U$,H),codeTextData:I,data:I,codeFlowValue:I,definition:U(n),definitionDestinationString:H,definitionLabelString:H,definitionTitleString:H,emphasis:U(G$),hardBreakEscape:U(v$),hardBreakTrailing:U(v$),htmlFlow:U(j6,H),htmlFlowData:I,htmlText:U(j6,H),htmlTextData:I,image:U(q4),label:H,link:U(l4),listItem:U(C),listItemValue:F,listOrdered:U($1,q),listUnordered:U($1),paragraph:U(w$),reference:T,referenceString:H,resourceDestinationString:H,resourceTitleString:H,setextHeading:U(S$),strong:U(f6),thematicBreak:U(F1)},exit:{atxHeading:V(),atxHeadingSequence:y,autolink:V(),autolinkEmail:F$,autolinkProtocol:H$,blockQuote:V(),characterEscapeValue:d,characterReferenceMarkerHexadecimal:k$,characterReferenceMarkerNumeric:k$,characterReferenceValue:m,characterReference:T$,codeFenced:V(N),codeFencedFence:O,codeFencedFenceInfo:w,codeFencedFenceMeta:z,codeFlowValue:d,codeIndented:V(L),codeText:V(l),codeTextData:d,data:d,definition:V(),definitionDestinationString:v,definitionLabelString:P,definitionTitleString:j,emphasis:V(),hardBreakEscape:V(t),hardBreakTrailing:V(t),htmlFlow:V(h),htmlFlowData:d,htmlText:V(f),htmlTextData:d,image:V(g),label:Y$,labelText:a,lineEnding:k,link:V(o),listItem:V(),listOrdered:V(),listUnordered:V(),paragraph:V(),referenceString:B$,resourceDestinationString:_,resourceTitleString:V$,resource:o$,setextHeading:V(R),setextHeadingLineSequence:b,setextHeadingText:E,strong:V(),thematicBreak:V()}};Mj(X,($||{}).mdastExtensions||[]);let Y={};return W;function W(i){let s={type:"root",children:[]},z$={stack:[s],tokenStack:[],config:X,enter:D,exit:K,buffer:H,resume:Q,data:Y},i$=[],w6=-1;while(++w6<i.length)if(i[w6][1].type===B.listOrdered||i[w6][1].type===B.listUnordered)if(i[w6][0]==="enter")i$.push(w6);else{let Q6=i$.pop();x(typeof Q6==="number","expected list to be open"),w6=J(i,Q6,w6)}w6=-1;while(++w6<i.length){let Q6=X[i[w6][0]];if(Bj.call(Q6,i[w6][1].type))Q6[i[w6][1].type].call(Object.assign({sliceSerialize:i[w6][2].sliceSerialize},z$),i[w6][1])}if(z$.tokenStack.length>0){let Q6=z$.tokenStack[z$.tokenStack.length-1];(Q6[1]||Aj).call(z$,void 0,Q6[0])}s.position={start:u8(i.length>0?i[0][1].start:{line:1,column:1,offset:0}),end:u8(i.length>0?i[i.length-2][1].end:{line:1,column:1,offset:0})},w6=-1;while(++w6<X.transforms.length)s=X.transforms[w6](s)||s;return s}function J(i,s,z$){let i$=s-1,w6=-1,Q6=!1,m$,O6,u$,N6;while(++i$<=z$){let u6=i[i$];switch(u6[1].type){case B.listUnordered:case B.listOrdered:case B.blockQuote:{if(u6[0]==="enter")w6++;else w6--;N6=void 0;break}case B.lineEndingBlank:{if(u6[0]==="enter"){if(m$&&!N6&&!w6&&!u$)u$=i$;N6=void 0}break}case B.linePrefix:case B.listItemValue:case B.listItemMarker:case B.listItemPrefix:case B.listItemPrefixWhitespace:break;default:N6=void 0}if(!w6&&u6[0]==="enter"&&u6[1].type===B.listItemPrefix||w6===-1&&u6[0]==="exit"&&(u6[1].type===B.listUnordered||u6[1].type===B.listOrdered)){if(m$){let D$=i$;O6=void 0;while(D$--){let K6=i[D$];if(K6[1].type===B.lineEnding||K6[1].type===B.lineEndingBlank){if(K6[0]==="exit")continue;if(O6)i[O6][1].type=B.lineEndingBlank,Q6=!0;K6[1].type=B.lineEnding,O6=D$}else if(K6[1].type===B.linePrefix||K6[1].type===B.blockQuotePrefix||K6[1].type===B.blockQuotePrefixWhitespace||K6[1].type===B.blockQuoteMarker||K6[1].type===B.listItemIndent);else break}if(u$&&(!O6||u$<O6))m$._spread=!0;m$.end=Object.assign({},O6?i[O6][1].start:u6[1].end),i.splice(O6||i$,0,["exit",m$,u6[2]]),i$++,z$++}if(u6[1].type===B.listItemPrefix){let D$={type:"listItem",_spread:!1,start:Object.assign({},u6[1].start),end:void 0};m$=D$,i.splice(i$,0,["enter",D$,u6[2]]),i$++,z$++,u$=void 0,N6=!0}}}return i[s][1]._spread=Q6,z$}function U(i,s){return z$;function z$(i$){if(D.call(this,i(i$),i$),s)s.call(this,i$)}}function H(){this.stack.push({type:"fragment",children:[]})}function D(i,s,z$){let i$=this.stack[this.stack.length-1];x(i$,"expected `parent`"),x("children"in i$,"expected `parent`"),i$.children.push(i),this.stack.push(i),this.tokenStack.push([s,z$||void 0]),i.position={start:u8(s.start),end:void 0}}function V(i){return s;function s(z$){if(i)i.call(this,z$);K.call(this,z$)}}function K(i,s){let z$=this.stack.pop();x(z$,"expected `node`");let i$=this.tokenStack.pop();if(!i$)throw Error("Cannot close `"+i.type+"` ("+m8({start:i.start,end:i.end})+"): it\u2019s not open");else if(i$[0].type!==i.type)if(s)s.call(this,i,i$[0]);else(i$[1]||Aj).call(this,i,i$[0]);x(z$.type!=="fragment","unexpected fragment `exit`ed"),x(z$.position,"expected `position` to be defined"),z$.position.end=u8(i.end)}function Q(){return W8(this.stack.pop())}function q(){this.data.expectingFirstListItemValue=!0}function F(i){if(this.data.expectingFirstListItemValue){let s=this.stack[this.stack.length-2];x(s,"expected nodes on stack"),x(s.type==="list","expected list on stack"),s.start=Number.parseInt(this.sliceSerialize(i),Q$.numericBaseDecimal),this.data.expectingFirstListItemValue=void 0}}function w(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="code","expected code on stack"),s.lang=i}function z(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="code","expected code on stack"),s.meta=i}function O(){if(this.data.flowCodeInside)return;this.buffer(),this.data.flowCodeInside=!0}function N(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="code","expected code on stack"),s.value=i.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function L(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="code","expected code on stack"),s.value=i.replace(/(\r?\n|\r)$/g,"")}function P(i){let s=this.resume(),z$=this.stack[this.stack.length-1];x(z$,"expected node on stack"),x(z$.type==="definition","expected definition on stack"),z$.label=s,z$.identifier=U8(this.sliceSerialize(i)).toLowerCase()}function j(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="definition","expected definition on stack"),s.title=i}function v(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="definition","expected definition on stack"),s.url=i}function y(i){let s=this.stack[this.stack.length-1];if(x(s,"expected node on stack"),x(s.type==="heading","expected heading on stack"),!s.depth){let z$=this.sliceSerialize(i).length;x(z$===1||z$===2||z$===3||z$===4||z$===5||z$===6,"expected `depth` between `1` and `6`"),s.depth=z$}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function b(i){let s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="heading","expected heading on stack"),s.depth=this.sliceSerialize(i).codePointAt(0)===M.equalsTo?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function I(i){let s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x("children"in s,"expected parent on stack");let z$=s.children,i$=z$[z$.length-1];if(!i$||i$.type!=="text")i$=N4(),i$.position={start:u8(i.start),end:void 0},z$.push(i$);this.stack.push(i$)}function d(i){let s=this.stack.pop();x(s,"expected a `node` to be on the stack"),x("value"in s,"expected a `literal` to be on the stack"),x(s.position,"expected `node` to have an open position"),s.value+=this.sliceSerialize(i),s.position.end=u8(i.end)}function k(i){let s=this.stack[this.stack.length-1];if(x(s,"expected `node`"),this.data.atHardBreak){x("children"in s,"expected `parent`");let z$=s.children[s.children.length-1];x(z$.position,"expected tail to have a starting position"),z$.position.end=u8(i.end),this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&X.canContainEols.includes(s.type))I.call(this,i),d.call(this,i)}function t(){this.data.atHardBreak=!0}function h(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="html","expected html on stack"),s.value=i}function f(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="html","expected html on stack"),s.value=i}function l(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="inlineCode","expected inline code on stack"),s.value=i}function o(){let i=this.stack[this.stack.length-1];if(x(i,"expected node on stack"),x(i.type==="link","expected link on stack"),this.data.inReference){let s=this.data.referenceType||"shortcut";i.type+="Reference",i.referenceType=s,delete i.url,delete i.title}else delete i.identifier,delete i.label;this.data.referenceType=void 0}function g(){let i=this.stack[this.stack.length-1];if(x(i,"expected node on stack"),x(i.type==="image","expected image on stack"),this.data.inReference){let s=this.data.referenceType||"shortcut";i.type+="Reference",i.referenceType=s,delete i.url,delete i.title}else delete i.identifier,delete i.label;this.data.referenceType=void 0}function a(i){let s=this.sliceSerialize(i),z$=this.stack[this.stack.length-2];x(z$,"expected ancestor on stack"),x(z$.type==="image"||z$.type==="link","expected image or link on stack"),z$.label=t2(s),z$.identifier=U8(s).toLowerCase()}function Y$(){let i=this.stack[this.stack.length-1];x(i,"expected node on stack"),x(i.type==="fragment","expected fragment on stack");let s=this.resume(),z$=this.stack[this.stack.length-1];if(x(z$,"expected node on stack"),x(z$.type==="image"||z$.type==="link","expected image or link on stack"),this.data.inReference=!0,z$.type==="link"){let i$=i.children;z$.children=i$}else z$.alt=s}function _(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="image"||s.type==="link","expected image or link on stack"),s.url=i}function V$(){let i=this.resume(),s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="image"||s.type==="link","expected image or link on stack"),s.title=i}function o$(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function B$(i){let s=this.resume(),z$=this.stack[this.stack.length-1];x(z$,"expected node on stack"),x(z$.type==="image"||z$.type==="link","expected image reference or link reference on stack"),z$.label=s,z$.identifier=U8(this.sliceSerialize(i)).toLowerCase(),this.data.referenceType="full"}function k$(i){x(i.type==="characterReferenceMarkerNumeric"||i.type==="characterReferenceMarkerHexadecimal"),this.data.characterReferenceType=i.type}function m(i){let s=this.sliceSerialize(i),z$=this.data.characterReferenceType,i$;if(z$)i$=v2(s,z$===B.characterReferenceMarkerNumeric?Q$.numericBaseDecimal:Q$.numericBaseHexadecimal),this.data.characterReferenceType=void 0;else{let Q6=y5(s);x(Q6!==!1,"expected reference to decode"),i$=Q6}let w6=this.stack[this.stack.length-1];x(w6,"expected `node`"),x("value"in w6,"expected `node.value`"),w6.value+=i$}function T$(i){let s=this.stack.pop();x(s,"expected `node`"),x(s.position,"expected `node.position`"),s.position.end=u8(i.end)}function H$(i){d.call(this,i);let s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="link","expected link on stack"),s.url=this.sliceSerialize(i)}function F$(i){d.call(this,i);let s=this.stack[this.stack.length-1];x(s,"expected node on stack"),x(s.type==="link","expected link on stack"),s.url="mailto:"+this.sliceSerialize(i)}function P$(){return{type:"blockquote",children:[]}}function j$(){return{type:"code",lang:null,meta:null,value:""}}function U$(){return{type:"inlineCode",value:""}}function n(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function G$(){return{type:"emphasis",children:[]}}function S$(){return{type:"heading",depth:0,children:[]}}function v$(){return{type:"break"}}function j6(){return{type:"html",value:""}}function q4(){return{type:"image",title:null,url:"",alt:null}}function l4(){return{type:"link",title:null,url:"",children:[]}}function $1(i){return{type:"list",ordered:i.type==="listOrdered",start:null,spread:i._spread,children:[]}}function C(i){return{type:"listItem",spread:i._spread,checked:null,children:[]}}function w$(){return{type:"paragraph",children:[]}}function f6(){return{type:"strong",children:[]}}function N4(){return{type:"text",value:""}}function F1(){return{type:"thematicBreak"}}}function u8($){return{line:$.line,column:$.column,offset:$.offset}}function Mj($,X){let Y=-1;while(++Y<X.length){let W=X[Y];if(Array.isArray(W))Mj($,W);else Aa($,W)}}function Aa($,X){let Y;for(Y in X)if(Bj.call(X,Y))switch(Y){case"canContainEols":{let W=X[Y];if(W)$[Y].push(...W);break}case"transforms":{let W=X[Y];if(W)$[Y].push(...W);break}case"enter":case"exit":{let W=X[Y];if(W)Object.assign($[Y],W);break}}}function Aj($,X){if($)throw Error("Cannot close `"+$.type+"` ("+m8({start:$.start,end:$.end})+"): a different token (`"+X.type+"`, "+m8({start:X.start,end:X.end})+") is open");else throw Error("Cannot close document, a token (`"+X.type+"`, "+m8({start:X.start,end:X.end})+") is still open")}var Bj;var jj=A(()=>{P6();m7();zj();tH();_D();h2();e$();k2();CD();Bj={}.hasOwnProperty});var Rj=A(()=>{jj()});function e2($){let X=this;X.parser=Y;function Y(W){return SD(W,{...X.data("settings"),...$,extensions:X.data("micromarkExtensions")||[],mdastExtensions:X.data("fromMarkdownExtensions")||[]})}}var Lj=A(()=>{Rj()});var Ej=A(()=>{Lj()});function Ij($,X){let Y=X||{};function W(J,...U){let{invalid:H,handlers:D}=W;if(J&&Pj.call(J,$)){let V=String(J[$]);H=Pj.call(D,V)?D[V]:W.unknown}if(H)return H.call(this,J,...U)}return W.handlers=Y.handlers||{},W.invalid=Y.invalid,W.unknown=Y.unknown,W}var Pj;var _j=A(()=>{Pj={}.hasOwnProperty});function bD($,X){let Y=-1,W;if(X.extensions)while(++Y<X.extensions.length)bD($,X.extensions[Y]);for(W in X)if(Ba.call(X,W))switch(W){case"extensions":break;case"unsafe":{Tj($[W],X[W]);break}case"join":{Tj($[W],X[W]);break}case"handlers":{Ma($[W],X[W]);break}default:$.options[W]=X[W]}return $}function Tj($,X){if(X)$.push(...X)}function Ma($,X){if(X)Object.assign($,X)}var Ba;var Cj=A(()=>{Ba={}.hasOwnProperty});function Sj($,X,Y,W){let J=Y.enter("blockquote"),U=Y.createTracker(W);U.move("> "),U.shift(2);let H=Y.indentLines(Y.containerFlow($,U.current()),ja);return J(),H}function ja($,X,Y){return">"+(Y?"":" ")+$}function $W($,X){return bj($,X.inConstruct,!0)&&!bj($,X.notInConstruct,!1)}function bj($,X,Y){if(typeof X==="string")X=[X];if(!X||X.length===0)return Y;let W=-1;while(++W<X.length)if($.includes(X[W]))return!0;return!1}function xD($,X,Y,W){let J=-1;while(++J<Y.unsafe.length)if(Y.unsafe[J].character===`
105
- `&&$W(Y.stack,Y.unsafe[J]))return/[ \t]/.test(W.before)?"":" ";return"\\\n"}var xj=()=>{};function kj($,X){let Y=String($),W=Y.indexOf(X),J=W,U=0,H=0;if(typeof X!=="string")throw TypeError("Expected substring");while(W!==-1){if(W===J){if(++U>H)H=U}else U=1;J=W+X.length,W=Y.indexOf(X,J)}return H}function n7($,X){return Boolean(X.options.fences===!1&&$.value&&!$.lang&&/[^ \r\n]/.test($.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test($.value))}function vj($){let X=$.options.fence||"`";if(X!=="`"&&X!=="~")throw Error("Cannot serialize code with `"+X+"` for `options.fence`, expected `` ` `` or `~`");return X}function hj($,X,Y,W){let J=vj(Y),U=$.value||"",H=J==="`"?"GraveAccent":"Tilde";if(n7($,Y)){let q=Y.enter("codeIndented"),F=Y.indentLines(U,Ra);return q(),F}let D=Y.createTracker(W),V=J.repeat(Math.max(kj(U,J)+1,3)),K=Y.enter("codeFenced"),Q=D.move(V);if($.lang){let q=Y.enter(`codeFencedLang${H}`);Q+=D.move(Y.safe($.lang,{before:Q,after:" ",encode:["`"],...D.current()})),q()}if($.lang&&$.meta){let q=Y.enter(`codeFencedMeta${H}`);Q+=D.move(" "),Q+=D.move(Y.safe($.meta,{before:Q,after:`
106
- `,encode:["`"],...D.current()})),q()}if(Q+=D.move(`
107
- `),U)Q+=D.move(U+`
108
- `);return Q+=D.move(V),K(),Q}function Ra($,X,Y){return(Y?"":" ")+$}var yj=()=>{};function c5($){let X=$.options.quote||'"';if(X!=='"'&&X!=="'")throw Error("Cannot serialize title with `"+X+"` for `options.quote`, expected `\"`, or `'`");return X}function fj($,X,Y,W){let J=c5(Y),U=J==='"'?"Quote":"Apostrophe",H=Y.enter("definition"),D=Y.enter("label"),V=Y.createTracker(W),K=V.move("[");if(K+=V.move(Y.safe(Y.associationId($),{before:K,after:"]",...V.current()})),K+=V.move("]: "),D(),!$.url||/[\0- \u007F]/.test($.url))D=Y.enter("destinationLiteral"),K+=V.move("<"),K+=V.move(Y.safe($.url,{before:K,after:">",...V.current()})),K+=V.move(">");else D=Y.enter("destinationRaw"),K+=V.move(Y.safe($.url,{before:K,after:$.title?" ":`
109
- `,...V.current()}));if(D(),$.title)D=Y.enter(`title${U}`),K+=V.move(" "+J),K+=V.move(Y.safe($.title,{before:K,after:J,...V.current()})),K+=V.move(J),D();return H(),K}var gj=()=>{};function mj($){let X=$.options.emphasis||"*";if(X!=="*"&&X!=="_")throw Error("Cannot serialize emphasis with `"+X+"` for `options.emphasis`, expected `*`, or `_`");return X}function z1($){return"&#x"+$.toString(16).toUpperCase()+";"}function d5($,X,Y){let W=f5($),J=f5(X);if(W===void 0)return J===void 0?Y==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:J===1?{inside:!0,outside:!0}:{inside:!1,outside:!0};if(W===1)return J===void 0?{inside:!1,outside:!1}:J===1?{inside:!0,outside:!0}:{inside:!1,outside:!1};return J===void 0?{inside:!1,outside:!1}:J===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}var kD=A(()=>{eH()});function vD($,X,Y,W){let J=mj(Y),U=Y.enter("emphasis"),H=Y.createTracker(W),D=H.move(J),V=H.move(Y.containerPhrasing($,{after:J,before:D,...H.current()})),K=V.charCodeAt(0),Q=d5(W.before.charCodeAt(W.before.length-1),K,J);if(Q.inside)V=z1(K)+V.slice(1);let q=V.charCodeAt(V.length-1),F=d5(W.after.charCodeAt(0),q,J);if(F.inside)V=V.slice(0,-1)+z1(q);let w=H.move(J);return U(),Y.attentionEncodeSurroundingInfo={after:F.outside,before:Q.outside},D+V+w}function La($,X,Y){return Y.options.emphasis||"*"}var uj=A(()=>{kD();vD.peek=La});function Ea($){let X=[],Y=-1;while(++Y<$.length)X[Y]=l5($[Y]);return XW(W);function W(...J){let U=-1;while(++U<X.length)if(X[U].apply(this,J))return!0;return!1}}function Pa($){let X=$;return XW(Y);function Y(W){let J=W,U;for(U in $)if(J[U]!==X[U])return!1;return!0}}function Ia($){return XW(X);function X(Y){return Y&&Y.type===$}}function XW($){return X;function X(Y,W,J){return Boolean(Ta(Y)&&$.call(this,Y,typeof W==="number"?W:void 0,J||void 0))}}function _a(){return!0}function Ta($){return $!==null&&typeof $==="object"&&"type"in $}var l5=function($){if($===null||$===void 0)return _a;if(typeof $==="function")return XW($);if(typeof $==="object")return Array.isArray($)?Ea($):Pa($);if(typeof $==="string")return Ia($);throw Error("Expected function, string, or object as test")};var hD=()=>{};function pj($){return"\x1B[33m"+$+"\x1B[39m"}function yD($,X,Y,W){let J;if(typeof X==="function"&&typeof Y!=="function")W=Y,Y=X;else J=X;let U=l5(J),H=W?-1:1;D($,void 0,[])();function D(V,K,Q){let q=V&&typeof V==="object"?V:{};if(typeof q.type==="string"){let w=typeof q.tagName==="string"?q.tagName:typeof q.name==="string"?q.name:void 0;Object.defineProperty(F,"name",{value:"node ("+pj(V.type+(w?"<"+w+">":""))+")"})}return F;function F(){let w=cj,z,O,N;if(!X||U(V,K,Q[Q.length-1]||void 0)){if(w=Ca(Y(V,Q)),w[0]===E9)return w}if("children"in V&&V.children){let L=V;if(L.children&&w[0]!==JW){O=(W?L.children.length:-1)+H,N=Q.concat(L);while(O>-1&&O<L.children.length){let P=L.children[O];if(z=D(P,O,N)(),z[0]===E9)return z;O=typeof z[1]==="number"?z[1]:O+H}}}return w}}}function Ca($){if(Array.isArray($))return $;if(typeof $==="number")return[YW,$];return $===null||$===void 0?cj:[$]}var cj,YW=!0,E9=!1,JW="skip";var dj=A(()=>{hD();cj=[]});var fD=A(()=>{dj()});function gD($,X,Y,W){let J,U,H;if(typeof X==="function"&&typeof Y!=="function")U=void 0,H=X,J=Y;else U=X,H=Y,J=W;yD($,U,D,J);function D(V,K){let Q=K[K.length-1],q=Q?Q.children.indexOf(V):void 0;return H(V,q,Q)}}var lj=A(()=>{fD();fD()});var ij=A(()=>{lj()});function WW($,X){let Y=!1;return gD($,function(W){if("value"in W&&/\r?\n|\r/.test(W.value)||W.type==="break")return Y=!0,E9}),Boolean((!$.depth||$.depth<3)&&W8($)&&(X.options.setext||Y))}var mD=A(()=>{ij();m7()});function rj($,X,Y,W){let J=Math.max(Math.min(6,$.depth||1),1),U=Y.createTracker(W);if(WW($,Y)){let Q=Y.enter("headingSetext"),q=Y.enter("phrasing"),F=Y.containerPhrasing($,{...U.current(),before:`
110
- `,after:`
111
- `});return q(),Q(),F+`
112
- `+(J===1?"=":"-").repeat(F.length-(Math.max(F.lastIndexOf("\r"),F.lastIndexOf(`
113
- `))+1))}let H="#".repeat(J),D=Y.enter("headingAtx"),V=Y.enter("phrasing");U.move(H+" ");let K=Y.containerPhrasing($,{before:"# ",after:`
114
- `,...U.current()});if(/^[\t ]/.test(K))K=z1(K.charCodeAt(0))+K.slice(1);if(K=K?H+" "+K:H,Y.options.closeAtx)K+=" "+H;return V(),D(),K}var nj=A(()=>{mD()});function uD($){return $.value||""}function Sa(){return"<"}var oj=A(()=>{uD.peek=Sa});function pD($,X,Y,W){let J=c5(Y),U=J==='"'?"Quote":"Apostrophe",H=Y.enter("image"),D=Y.enter("label"),V=Y.createTracker(W),K=V.move("![");if(K+=V.move(Y.safe($.alt,{before:K,after:"]",...V.current()})),K+=V.move("]("),D(),!$.url&&$.title||/[\0- \u007F]/.test($.url))D=Y.enter("destinationLiteral"),K+=V.move("<"),K+=V.move(Y.safe($.url,{before:K,after:">",...V.current()})),K+=V.move(">");else D=Y.enter("destinationRaw"),K+=V.move(Y.safe($.url,{before:K,after:$.title?" ":")",...V.current()}));if(D(),$.title)D=Y.enter(`title${U}`),K+=V.move(" "+J),K+=V.move(Y.safe($.title,{before:K,after:J,...V.current()})),K+=V.move(J),D();return K+=V.move(")"),H(),K}function ba(){return"!"}var aj=A(()=>{pD.peek=ba});function cD($,X,Y,W){let J=$.referenceType,U=Y.enter("imageReference"),H=Y.enter("label"),D=Y.createTracker(W),V=D.move("!["),K=Y.safe($.alt,{before:V,after:"]",...D.current()});V+=D.move(K+"]["),H();let Q=Y.stack;Y.stack=[],H=Y.enter("reference");let q=Y.safe(Y.associationId($),{before:V,after:"]",...D.current()});if(H(),Y.stack=Q,U(),J==="full"||!K||K!==q)V+=D.move(q+"]");else if(J==="shortcut")V=V.slice(0,-1);else V+=D.move("]");return V}function xa(){return"!"}var sj=A(()=>{cD.peek=xa});function dD($,X,Y){let W=$.value||"",J="`",U=-1;while(new RegExp("(^|[^`])"+J+"([^`]|$)").test(W))J+="`";if(/[^ \r\n]/.test(W)&&(/^[ \r\n]/.test(W)&&/[ \r\n]$/.test(W)||/^`|`$/.test(W)))W=" "+W+" ";while(++U<Y.unsafe.length){let H=Y.unsafe[U],D=Y.compilePattern(H),V;if(!H.atBreak)continue;while(V=D.exec(W)){let K=V.index;if(W.charCodeAt(K)===10&&W.charCodeAt(K-1)===13)K--;W=W.slice(0,K)+" "+W.slice(V.index+1)}}return J+W+J}function ka(){return"`"}var tj=A(()=>{dD.peek=ka});function lD($,X){let Y=W8($);return Boolean(!X.options.resourceLink&&$.url&&!$.title&&$.children&&$.children.length===1&&$.children[0].type==="text"&&(Y===$.url||"mailto:"+Y===$.url)&&/^[a-z][a-z+.-]+:/i.test($.url)&&!/[\0- <>\u007F]/.test($.url))}var ej=A(()=>{m7()});function iD($,X,Y,W){let J=c5(Y),U=J==='"'?"Quote":"Apostrophe",H=Y.createTracker(W),D,V;if(lD($,Y)){let Q=Y.stack;Y.stack=[],D=Y.enter("autolink");let q=H.move("<");return q+=H.move(Y.containerPhrasing($,{before:q,after:">",...H.current()})),q+=H.move(">"),D(),Y.stack=Q,q}D=Y.enter("link"),V=Y.enter("label");let K=H.move("[");if(K+=H.move(Y.containerPhrasing($,{before:K,after:"](",...H.current()})),K+=H.move("]("),V(),!$.url&&$.title||/[\0- \u007F]/.test($.url))V=Y.enter("destinationLiteral"),K+=H.move("<"),K+=H.move(Y.safe($.url,{before:K,after:">",...H.current()})),K+=H.move(">");else V=Y.enter("destinationRaw"),K+=H.move(Y.safe($.url,{before:K,after:$.title?" ":")",...H.current()}));if(V(),$.title)V=Y.enter(`title${U}`),K+=H.move(" "+J),K+=H.move(Y.safe($.title,{before:K,after:J,...H.current()})),K+=H.move(J),V();return K+=H.move(")"),D(),K}function va($,X,Y){return lD($,Y)?"<":"["}var $R=A(()=>{ej();iD.peek=va});function rD($,X,Y,W){let J=$.referenceType,U=Y.enter("linkReference"),H=Y.enter("label"),D=Y.createTracker(W),V=D.move("["),K=Y.containerPhrasing($,{before:V,after:"]",...D.current()});V+=D.move(K+"]["),H();let Q=Y.stack;Y.stack=[],H=Y.enter("reference");let q=Y.safe(Y.associationId($),{before:V,after:"]",...D.current()});if(H(),Y.stack=Q,U(),J==="full"||!K||K!==q)V+=D.move(q+"]");else if(J==="shortcut")V=V.slice(0,-1);else V+=D.move("]");return V}function ha(){return"["}var XR=A(()=>{rD.peek=ha});function i5($){let X=$.options.bullet||"*";if(X!=="*"&&X!=="+"&&X!=="-")throw Error("Cannot serialize items with `"+X+"` for `options.bullet`, expected `*`, `+`, or `-`");return X}function YR($){let X=i5($),Y=$.options.bulletOther;if(!Y)return X==="*"?"-":"*";if(Y!=="*"&&Y!=="+"&&Y!=="-")throw Error("Cannot serialize items with `"+Y+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(Y===X)throw Error("Expected `bullet` (`"+X+"`) and `bulletOther` (`"+Y+"`) to be different");return Y}var JR=()=>{};function WR($){let X=$.options.bulletOrdered||".";if(X!=="."&&X!==")")throw Error("Cannot serialize items with `"+X+"` for `options.bulletOrdered`, expected `.` or `)`");return X}function UW($){let X=$.options.rule||"*";if(X!=="*"&&X!=="-"&&X!=="_")throw Error("Cannot serialize rules with `"+X+"` for `options.rule`, expected `*`, `-`, or `_`");return X}function UR($,X,Y,W){let J=Y.enter("list"),U=Y.bulletCurrent,H=$.ordered?WR(Y):i5(Y),D=$.ordered?H==="."?")":".":YR(Y),V=X&&Y.bulletLastUsed?H===Y.bulletLastUsed:!1;if(!$.ordered){let Q=$.children?$.children[0]:void 0;if((H==="*"||H==="-")&&Q&&(!Q.children||!Q.children[0])&&Y.stack[Y.stack.length-1]==="list"&&Y.stack[Y.stack.length-2]==="listItem"&&Y.stack[Y.stack.length-3]==="list"&&Y.stack[Y.stack.length-4]==="listItem"&&Y.indexStack[Y.indexStack.length-1]===0&&Y.indexStack[Y.indexStack.length-2]===0&&Y.indexStack[Y.indexStack.length-3]===0)V=!0;if(UW(Y)===H&&Q){let q=-1;while(++q<$.children.length){let F=$.children[q];if(F&&F.type==="listItem"&&F.children&&F.children[0]&&F.children[0].type==="thematicBreak"){V=!0;break}}}}if(V)H=D;Y.bulletCurrent=H;let K=Y.containerFlow($,W);return Y.bulletLastUsed=H,Y.bulletCurrent=U,J(),K}var GR=A(()=>{JR()});function HR($){let X=$.options.listItemIndent||"one";if(X!=="tab"&&X!=="one"&&X!=="mixed")throw Error("Cannot serialize items with `"+X+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return X}function DR($,X,Y,W){let J=HR(Y),U=Y.bulletCurrent||i5(Y);if(X&&X.type==="list"&&X.ordered)U=(typeof X.start==="number"&&X.start>-1?X.start:1)+(Y.options.incrementListMarker===!1?0:X.children.indexOf($))+U;let H=U.length+1;if(J==="tab"||J==="mixed"&&(X&&X.type==="list"&&X.spread||$.spread))H=Math.ceil(H/4)*4;let D=Y.createTracker(W);D.move(U+" ".repeat(H-U.length)),D.shift(H);let V=Y.enter("listItem"),K=Y.indentLines(Y.containerFlow($,D.current()),Q);return V(),K;function Q(q,F,w){if(F)return(w?"":" ".repeat(H))+q;return(w?U:U+" ".repeat(H-U.length))+q}}var VR=()=>{};function KR($,X,Y,W){let J=Y.enter("paragraph"),U=Y.enter("phrasing"),H=Y.containerPhrasing($,W);return U(),J(),H}var nD;var QR=A(()=>{hD();nD=l5(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"])});var FR=A(()=>{QR()});function qR($,X,Y,W){return($.children.some(function(H){return nD(H)})?Y.containerPhrasing:Y.containerFlow).call(Y,$,W)}var wR=A(()=>{FR()});function ZR($){let X=$.options.strong||"*";if(X!=="*"&&X!=="_")throw Error("Cannot serialize strong with `"+X+"` for `options.strong`, expected `*`, or `_`");return X}function oD($,X,Y,W){let J=ZR(Y),U=Y.enter("strong"),H=Y.createTracker(W),D=H.move(J+J),V=H.move(Y.containerPhrasing($,{after:J,before:D,...H.current()})),K=V.charCodeAt(0),Q=d5(W.before.charCodeAt(W.before.length-1),K,J);if(Q.inside)V=z1(K)+V.slice(1);let q=V.charCodeAt(V.length-1),F=d5(W.after.charCodeAt(0),q,J);if(F.inside)V=V.slice(0,-1)+z1(q);let w=H.move(J+J);return U(),Y.attentionEncodeSurroundingInfo={after:F.outside,before:Q.outside},D+V+w}function ya($,X,Y){return Y.options.strong||"*"}var zR=A(()=>{kD();oD.peek=ya});function OR($,X,Y,W){return Y.safe($.value,W)}function NR($){let X=$.options.ruleRepetition||3;if(X<3)throw Error("Cannot serialize rules with repetition `"+X+"` for `options.ruleRepetition`, expected `3` or more");return X}function AR($,X,Y){let W=(UW(Y)+(Y.options.ruleSpaces?" ":"")).repeat(NR(Y));return Y.options.ruleSpaces?W.slice(0,-1):W}var BR=()=>{};var MR;var jR=A(()=>{xj();yj();gj();uj();nj();oj();aj();sj();tj();$R();XR();GR();VR();wR();zR();BR();MR={blockquote:Sj,break:xD,code:hj,definition:fj,emphasis:vD,hardBreak:xD,heading:rj,html:uD,image:pD,imageReference:cD,inlineCode:dD,link:iD,linkReference:rD,list:UR,listItem:DR,paragraph:KR,root:qR,strong:oD,text:OR,thematicBreak:AR}});function fa($,X,Y,W){if(X.type==="code"&&n7(X,W)&&($.type==="list"||$.type===X.type&&n7($,W)))return!1;if("spread"in Y&&typeof Y.spread==="boolean"){if($.type==="paragraph"&&($.type===X.type||X.type==="definition"||X.type==="heading"&&WW(X,W)))return;return Y.spread?1:0}}var RR;var LR=A(()=>{mD();RR=[fa]});var P9,ER;var PR=A(()=>{P9=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],ER=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
115
- `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:P9},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
116
- ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:P9},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
117
- *])`},{character:"*",inConstruct:"phrasing",notInConstruct:P9},{atBreak:!0,character:"+",after:`(?:[ \r
118
- ])`},{atBreak:!0,character:"-",after:`(?:[ \r
119
- -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
120
- ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:P9},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:P9},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:P9},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:P9},{atBreak:!0,character:"~"}]});function IR($){if($.label||!$.identifier)return $.label||"";return t2($.identifier)}var _R=A(()=>{_D()});function TR($){if(!$._compiled){let X=($.atBreak?"[\\r\\n][\\t ]*":"")+($.before?"(?:"+$.before+")":"");$._compiled=new RegExp((X?"("+X+")":"")+(/[|\\{}()[\]^$+*?.-]/.test($.character)?"\\":"")+$.character+($.after?"(?:"+$.after+")":""),"g")}return $._compiled}function CR($,X,Y){let W=X.indexStack,J=$.children||[],U=[],H=-1,D=Y.before,V;W.push(-1);let K=X.createTracker(Y);while(++H<J.length){let Q=J[H],q;if(W[W.length-1]=H,H+1<J.length){let z=X.handle.handlers[J[H+1].type];if(z&&z.peek)z=z.peek;q=z?z(J[H+1],$,X,{before:"",after:"",...K.current()}).charAt(0):""}else q=Y.after;if(U.length>0&&(D==="\r"||D===`
121
- `)&&Q.type==="html")U[U.length-1]=U[U.length-1].replace(/(\r?\n|\r)$/," "),D=" ",K=X.createTracker(Y),K.move(U.join(""));let F=X.handle(Q,$,X,{...K.current(),after:q,before:D});if(V&&V===F.slice(0,1))F=z1(V.charCodeAt(0))+F.slice(1);let w=X.attentionEncodeSurroundingInfo;if(X.attentionEncodeSurroundingInfo=void 0,V=void 0,w){if(U.length>0&&w.before&&D===U[U.length-1].slice(-1))U[U.length-1]=U[U.length-1].slice(0,-1)+z1(D.charCodeAt(0));if(w.after)V=q}K.move(F),U.push(F),D=F.slice(-1)}return W.pop(),U.join("")}var SR=()=>{};function bR($,X,Y){let W=X.indexStack,J=$.children||[],U=X.createTracker(Y),H=[],D=-1;W.push(-1);while(++D<J.length){let V=J[D];if(W[W.length-1]=D,H.push(U.move(X.handle(V,$,X,{before:`
122
- `,after:`
123
- `,...U.current()}))),V.type!=="list")X.bulletLastUsed=void 0;if(D<J.length-1)H.push(U.move(ga(V,J[D+1],$,X)))}return W.pop(),H.join("")}function ga($,X,Y,W){let J=W.join.length;while(J--){let U=W.join[J]($,X,Y,W);if(U===!0||U===1)break;if(typeof U==="number")return`
124
- `.repeat(1+U);if(U===!1)return`
2
+ function t(i){return i}var e={name:"@rizom/brain",version:"0.2.0-alpha.48",description:"Brain runtime + CLI \u2014 scaffold, run, and manage AI brain instances",type:"module",bin:{brain:"./dist/brain.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./cli":"./dist/brain.js","./plugins":{types:"./dist/plugins.d.ts",import:"./dist/plugins.js"},"./entities":{types:"./dist/entities.d.ts",import:"./dist/entities.js"},"./services":{types:"./dist/services.d.ts",import:"./dist/services.js"},"./interfaces":{types:"./dist/interfaces.d.ts",import:"./dist/interfaces.js"},"./templates":{types:"./dist/templates.d.ts",import:"./dist/templates.js"},"./site":{types:"./dist/site.d.ts",import:"./dist/site.js"},"./themes":{types:"./dist/themes.d.ts",import:"./dist/themes.js"},"./deploy":{types:"./dist/deploy.d.ts",import:"./dist/deploy.js"},"./tsconfig.instance.json":"./tsconfig.instance.json"},files:["dist","templates","tsconfig.instance.json"],scripts:{build:"bun scripts/build.ts",prepublishOnly:"bun scripts/build.ts","dev:start":"bun dist/brain.js start",typecheck:"tsc --noEmit",test:"bun test",lint:"eslint . --ext .ts"},dependencies:{"@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^1.24.0","@tailwindcss/postcss":"^4.1.13","@tailwindcss/typography":"^0.5.19",postcss:"^8.5.6",preact:"^10.27.2","preact-render-to-string":"^6.3.1",tailwindcss:"^4.1.11"},optionalDependencies:{"@libsql/client":"^0.15.7","@tailwindcss/oxide":"^4.1.4","better-sqlite3":"^11.8.1",lightningcss:"^1.29.2","react-devtools-core":"^6.1.1",sharp:"^0.34.5"},devDependencies:{"@brains/app":"workspace:*","@brains/deploy-templates":"workspace:*","@brains/eslint-config":"workspace:*","@brains/mcp-service":"workspace:*","@brains/plugins":"workspace:*","@brains/ranger":"workspace:*","@brains/relay":"workspace:*","@brains/rover":"workspace:*","@brains/site-composition":"workspace:*","@brains/site-default":"workspace:*","@brains/site-personal":"workspace:*","@brains/site-professional":"workspace:*","@brains/theme-default":"workspace:*","@brains/theme-rizom":"workspace:*","@brains/typescript-config":"workspace:*","@brains/utils":"workspace:*","@types/bun":"latest",rollup:"^4.60.2","rollup-plugin-dts":"^6.4.1",typescript:"^5.3.3"},publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/rizom-ai/brains.git",directory:"packages/brain-cli"},license:"Apache-2.0",author:"Yeehaa <yeehaa@rizom.ai> (https://rizom.ai)",homepage:"https://github.com/rizom-ai/brains/tree/main/packages/brain-cli#readme",bugs:"https://github.com/rizom-ai/brains/issues",engines:{bun:">=1.3.3"},keywords:["brain","ai","cli","mcp","agent","personal-ai","knowledge-management"]};var n=e.version;export{t as defineBrain,n as PLUGIN_API_VERSION};
125
3
 
126
- <!---->
127
-
128
- `}return`
129
-
130
- `}function xR($,X){let Y=[],W=0,J=0,U;while(U=ma.exec($))H($.slice(W,U.index)),Y.push(U[0]),W=U.index+U[0].length,J++;return H($.slice(W)),Y.join("");function H(D){Y.push(X(D,J,!D))}}var ma;var kR=A(()=>{ma=/\r?\n|\r/g});function hR($,X,Y){let W=(Y.before||"")+(X||"")+(Y.after||""),J=[],U=[],H={},D=-1;while(++D<$.unsafe.length){let Q=$.unsafe[D];if(!$W($.stack,Q))continue;let q=$.compilePattern(Q),F;while(F=q.exec(W)){let w="before"in Q||Boolean(Q.atBreak),z="after"in Q,O=F.index+(w?F[1].length:0);if(J.includes(O)){if(H[O].before&&!w)H[O].before=!1;if(H[O].after&&!z)H[O].after=!1}else J.push(O),H[O]={before:w,after:z}}}J.sort(ua);let V=Y.before?Y.before.length:0,K=W.length-(Y.after?Y.after.length:0);D=-1;while(++D<J.length){let Q=J[D];if(Q<V||Q>=K)continue;if(Q+1<K&&J[D+1]===Q+1&&H[Q].after&&!H[Q+1].before&&!H[Q+1].after||J[D-1]===Q-1&&H[Q].before&&!H[Q-1].before&&!H[Q-1].after)continue;if(V!==Q)U.push(vR(W.slice(V,Q),"\\"));if(V=Q,/[!-/:-@[-`{-~]/.test(W.charAt(Q))&&(!Y.encode||!Y.encode.includes(W.charAt(Q))))U.push("\\");else U.push(z1(W.charCodeAt(Q))),V++}return U.push(vR(W.slice(V,K),Y.after)),U.join("")}function ua($,X){return $-X}function vR($,X){let Y=/\\(?=[!-/:-@[-`{-~])/g,W=[],J=[],U=$+X,H=-1,D=0,V;while(V=Y.exec(U))W.push(V.index);while(++H<W.length){if(D!==W[H])J.push($.slice(D,W[H]));J.push("\\"),D=W[H]}return J.push($.slice(D)),J.join("")}var yR=()=>{};function fR($){let X=$||{},Y=X.now||{},W=X.lineShift||0,J=Y.line||1,U=Y.column||1;return{move:V,current:H,shift:D};function H(){return{now:{line:J,column:U},lineShift:W}}function D(K){W+=K}function V(K){let Q=K||"",q=Q.split(/\r?\n|\r/g),F=q[q.length-1];return J+=q.length-1,U=q.length===1?U+F.length:1+F.length+W,Q}}function aD($,X){let Y=X||{},W={associationId:IR,containerPhrasing:la,containerFlow:ia,createTracker:fR,compilePattern:TR,enter:U,handlers:{...MR},handle:void 0,indentLines:xR,indexStack:[],join:[...RR],options:{},safe:ra,stack:[],unsafe:[...ER]};if(bD(W,Y),W.options.tightDefinitions)W.join.push(da);W.handle=Ij("type",{invalid:pa,unknown:ca,handlers:W.handlers});let J=W.handle($,void 0,W,{before:`
131
- `,after:`
132
- `,now:{line:1,column:1},lineShift:0});if(J&&J.charCodeAt(J.length-1)!==10&&J.charCodeAt(J.length-1)!==13)J+=`
133
- `;return J;function U(H){return W.stack.push(H),D;function D(){W.stack.pop()}}}function pa($){throw Error("Cannot handle value `"+$+"`, expected node")}function ca($){throw Error("Cannot handle unknown node `"+$.type+"`")}function da($,X){if($.type==="definition"&&$.type===X.type)return 0}function la($,X){return CR($,this,X)}function ia($,X){return bR($,this,X)}function ra($,X){return hR(this,$,X)}var gR=A(()=>{_j();Cj();jR();LR();PR();_R();SR();kR();yR()});var mR=A(()=>{gR()});function GW($){let X=this;X.compiler=Y;function Y(W){return aD(W,{...X.data("settings"),...$,extensions:X.data("toMarkdownExtensions")||[]})}}var uR=A(()=>{mR()});var pR=A(()=>{uR()});function sD($){if($)throw $}var sR=X$((TA$,aR)=>{var HW=Object.prototype.hasOwnProperty,oR=Object.prototype.toString,cR=Object.defineProperty,dR=Object.getOwnPropertyDescriptor,lR=function(X){if(typeof Array.isArray==="function")return Array.isArray(X);return oR.call(X)==="[object Array]"},iR=function(X){if(!X||oR.call(X)!=="[object Object]")return!1;var Y=HW.call(X,"constructor"),W=X.constructor&&X.constructor.prototype&&HW.call(X.constructor.prototype,"isPrototypeOf");if(X.constructor&&!Y&&!W)return!1;var J;for(J in X);return typeof J>"u"||HW.call(X,J)},rR=function(X,Y){if(cR&&Y.name==="__proto__")cR(X,Y.name,{enumerable:!0,configurable:!0,value:Y.newValue,writable:!0});else X[Y.name]=Y.newValue},nR=function(X,Y){if(Y==="__proto__"){if(!HW.call(X,Y))return;else if(dR)return dR(X,Y).value}return X[Y]};aR.exports=function $(){var X,Y,W,J,U,H,D=arguments[0],V=1,K=arguments.length,Q=!1;if(typeof D==="boolean")Q=D,D=arguments[1]||{},V=2;if(D==null||typeof D!=="object"&&typeof D!=="function")D={};for(;V<K;++V)if(X=arguments[V],X!=null){for(Y in X)if(W=nR(D,Y),J=nR(X,Y),D!==J){if(Q&&J&&(iR(J)||(U=lR(J)))){if(U)U=!1,H=W&&lR(W)?W:[];else H=W&&iR(W)?W:{};rR(D,{name:Y,newValue:$(Q,H,J)})}else if(typeof J<"u")rR(D,{name:Y,newValue:J})}}return D}});function o7($){if(typeof $!=="object"||$===null)return!1;let X=Object.getPrototypeOf($);return(X===null||X===Object.prototype||Object.getPrototypeOf(X)===null)&&!(Symbol.toStringTag in $)&&!(Symbol.iterator in $)}function tD(){let $=[],X={run:Y,use:W};return X;function Y(...J){let U=-1,H=J.pop();if(typeof H!=="function")throw TypeError("Expected function as last argument, not "+H);D(null,...J);function D(V,...K){let Q=$[++U],q=-1;if(V){H(V);return}while(++q<J.length)if(K[q]===null||K[q]===void 0)K[q]=J[q];if(J=K,Q)tR(Q,D)(...K);else H(null,...K)}}function W(J){if(typeof J!=="function")throw TypeError("Expected `middelware` to be a function, not "+J);return $.push(J),X}}function tR($,X){let Y;return W;function W(...H){let D=$.length>H.length,V;if(D)H.push(J);try{V=$.apply(this,H)}catch(K){let Q=K;if(D&&Y)throw Q;return J(Q)}if(!D)if(V&&V.then&&typeof V.then==="function")V.then(U,J);else if(V instanceof Error)J(V);else U(V)}function J(H,...D){if(!Y)Y=!0,X(H,...D)}function U(H){J(null,H)}}var eR=()=>{};var S4;var $L=A(()=>{CD();S4=class S4 extends Error{constructor($,X,Y){super();if(typeof X==="string")Y=X,X=void 0;let W="",J={},U=!1;if(X)if("line"in X&&"column"in X)J={place:X};else if("start"in X&&"end"in X)J={place:X};else if("type"in X)J={ancestors:[X],place:X.position};else J={...X};if(typeof $==="string")W=$;else if(!J.cause&&$)U=!0,W=$.message,J.cause=$;if(!J.ruleId&&!J.source&&typeof Y==="string"){let D=Y.indexOf(":");if(D===-1)J.ruleId=Y;else J.source=Y.slice(0,D),J.ruleId=Y.slice(D+1)}if(!J.place&&J.ancestors&&J.ancestors){let D=J.ancestors[J.ancestors.length-1];if(D)J.place=D.position}let H=J.place&&"start"in J.place?J.place.start:J.place;this.ancestors=J.ancestors||void 0,this.cause=J.cause||void 0,this.column=H?H.column:void 0,this.fatal=void 0,this.file="",this.message=W,this.line=H?H.line:void 0,this.name=m8(J.place)||"1:1",this.place=J.place||void 0,this.reason=this.message,this.ruleId=J.ruleId||void 0,this.source=J.source||void 0,this.stack=U&&J.cause&&typeof J.cause.stack==="string"?J.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};S4.prototype.file="";S4.prototype.name="";S4.prototype.reason="";S4.prototype.message="";S4.prototype.stack="";S4.prototype.column=void 0;S4.prototype.line=void 0;S4.prototype.ancestors=void 0;S4.prototype.cause=void 0;S4.prototype.fatal=void 0;S4.prototype.place=void 0;S4.prototype.ruleId=void 0;S4.prototype.source=void 0});var XL=A(()=>{$L()});import{default as $0}from"path";var YL=()=>{};import{default as JL}from"process";var WL=()=>{};function DW($){return Boolean($!==null&&typeof $==="object"&&"href"in $&&$.href&&"protocol"in $&&$.protocol&&$.auth===void 0)}import{fileURLToPath as UL}from"url";var GL=()=>{};class VW{constructor($){let X;if(!$)X={};else if(DW($))X={path:$};else if(typeof $==="string"||na($))X={value:$};else X=$;this.cwd="cwd"in X?"":JL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let Y=-1;while(++Y<eD.length){let J=eD[Y];if(J in X&&X[J]!==void 0&&X[J]!==null)this[J]=J==="history"?[...X[J]]:X[J]}let W;for(W in X)if(!eD.includes(W))this[W]=X[W]}get basename(){return typeof this.path==="string"?$0.basename(this.path):void 0}set basename($){XV($,"basename"),$V($,"basename"),this.path=$0.join(this.dirname||"",$)}get dirname(){return typeof this.path==="string"?$0.dirname(this.path):void 0}set dirname($){HL(this.basename,"dirname"),this.path=$0.join($||"",this.basename)}get extname(){return typeof this.path==="string"?$0.extname(this.path):void 0}set extname($){if($V($,"extname"),HL(this.dirname,"extname"),$){if($.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if($.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=$0.join(this.dirname,this.stem+($||""))}get path(){return this.history[this.history.length-1]}set path($){if(DW($))$=UL($);if(XV($,"path"),this.path!==$)this.history.push($)}get stem(){return typeof this.path==="string"?$0.basename(this.path,this.extname):void 0}set stem($){XV($,"stem"),$V($,"stem"),this.path=$0.join(this.dirname||"",$+(this.extname||""))}fail($,X,Y){let W=this.message($,X,Y);throw W.fatal=!0,W}info($,X,Y){let W=this.message($,X,Y);return W.fatal=void 0,W}message($,X,Y){let W=new S4($,X,Y);if(this.path)W.name=this.path+":"+W.name,W.file=this.path;return W.fatal=!1,this.messages.push(W),W}toString($){if(this.value===void 0)return"";if(typeof this.value==="string")return this.value;return new TextDecoder($||void 0).decode(this.value)}}function $V($,X){if($&&$.includes($0.sep))throw Error("`"+X+"` cannot be a path: did not expect `"+$0.sep+"`")}function XV($,X){if(!$)throw Error("`"+X+"` cannot be empty")}function HL($,X){if(!$)throw Error("Setting `"+X+"` requires `path` to be set too")}function na($){return Boolean($&&typeof $==="object"&&"byteLength"in $&&"byteOffset"in $)}var eD;var DL=A(()=>{XL();YL();WL();GL();eD=["history","path","basename","stem","extname","dirname"]});var VL=A(()=>{DL()});var KL=function($){let W=this.constructor.prototype,J=W[$],U=function(){return J.apply(U,arguments)};return Object.setPrototypeOf(U,W),U};function YV($,X){if(typeof X!=="function")throw TypeError("Cannot `"+$+"` without `parser`")}function JV($,X){if(typeof X!=="function")throw TypeError("Cannot `"+$+"` without `compiler`")}function WV($,X){if(X)throw Error("Cannot call `"+$+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function QL($){if(!o7($)||typeof $.type!=="string")throw TypeError("Expected node, got `"+$+"`")}function FL($,X,Y){if(!Y)throw Error("`"+$+"` finished async. Use `"+X+"` instead")}function KW($){return aa($)?$:new VW($)}function aa($){return Boolean($&&typeof $==="object"&&"message"in $&&"messages"in $)}function sa($){return typeof $==="string"||ta($)}function ta($){return Boolean($&&typeof $==="object"&&"byteLength"in $&&"byteOffset"in $)}var QW,oa,UV,GV;var qL=A(()=>{P6();eR();VL();QW=n1(sR(),1),oa={}.hasOwnProperty;UV=class UV extends KL{constructor(){super("copy");this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=tD()}copy(){let $=new UV,X=-1;while(++X<this.attachers.length){let Y=this.attachers[X];$.use(...Y)}return $.data(QW.default(!0,{},this.namespace)),$}data($,X){if(typeof $==="string"){if(arguments.length===2)return WV("data",this.frozen),this.namespace[$]=X,this;return oa.call(this.namespace,$)&&this.namespace[$]||void 0}if($)return WV("data",this.frozen),this.namespace=$,this;return this.namespace}freeze(){if(this.frozen)return this;let $=this;while(++this.freezeIndex<this.attachers.length){let[X,...Y]=this.attachers[this.freezeIndex];if(Y[0]===!1)continue;if(Y[0]===!0)Y[0]=void 0;let W=X.call($,...Y);if(typeof W==="function")this.transformers.use(W)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse($){this.freeze();let X=KW($),Y=this.parser||this.Parser;return YV("parse",Y),Y(String(X),X)}process($,X){let Y=this;return this.freeze(),YV("process",this.parser||this.Parser),JV("process",this.compiler||this.Compiler),X?W(void 0,X):new Promise(W);function W(J,U){let H=KW($),D=Y.parse(H);Y.run(D,H,function(K,Q,q){if(K||!Q||!q)return V(K);let F=Q,w=Y.stringify(F,q);if(sa(w))q.value=w;else q.result=w;V(K,q)});function V(K,Q){if(K||!Q)U(K);else if(J)J(Q);else x(X,"`done` is defined if `resolve` is not"),X(void 0,Q)}}}processSync($){let X=!1,Y;return this.freeze(),YV("processSync",this.parser||this.Parser),JV("processSync",this.compiler||this.Compiler),this.process($,W),FL("processSync","process",X),x(Y,"we either bailed on an error or have a tree"),Y;function W(J,U){X=!0,sD(J),Y=U}}run($,X,Y){QL($),this.freeze();let W=this.transformers;if(!Y&&typeof X==="function")Y=X,X=void 0;return Y?J(void 0,Y):new Promise(J);function J(U,H){x(typeof X!=="function","`file` can\u2019t be a `done` anymore, we checked");let D=KW(X);W.run($,D,V);function V(K,Q,q){let F=Q||$;if(K)H(K);else if(U)U(F);else x(Y,"`done` is defined if `resolve` is not"),Y(void 0,F,q)}}}runSync($,X){let Y=!1,W;return this.run($,X,J),FL("runSync","run",Y),x(W,"we either bailed on an error or have a tree"),W;function J(U,H){sD(U),W=H,Y=!0}}stringify($,X){this.freeze();let Y=KW(X),W=this.compiler||this.Compiler;return JV("stringify",W),QL($),W($,Y)}use($,...X){let Y=this.attachers,W=this.namespace;if(WV("use",this.frozen),$===null||$===void 0);else if(typeof $==="function")D($,X);else if(typeof $==="object")if(Array.isArray($))H($);else U($);else throw TypeError("Expected usable value, not `"+$+"`");return this;function J(V){if(typeof V==="function")D(V,[]);else if(typeof V==="object")if(Array.isArray(V)){let[K,...Q]=V;D(K,Q)}else U(V);else throw TypeError("Expected usable value, not `"+V+"`")}function U(V){if(!("plugins"in V)&&!("settings"in V))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");if(H(V.plugins),V.settings)W.settings=QW.default(!0,W.settings,V.settings)}function H(V){let K=-1;if(V===null||V===void 0);else if(Array.isArray(V))while(++K<V.length){let Q=V[K];J(Q)}else throw TypeError("Expected a list of plugins, not `"+V+"`")}function D(V,K){let Q=-1,q=-1;while(++Q<Y.length)if(Y[Q][0]===V){q=Q;break}if(q===-1)Y.push([V,...K]);else if(K.length>0){let[F,...w]=K,z=Y[q][1];if(o7(z)&&o7(F))F=QW.default(!0,z,F);Y[q]=[V,F,...w]}}}};GV=new UV().freeze()});var wL=A(()=>{qL()});var FW;var HV=A(()=>{Ej();pR();wL();FW=GV().use(e2).use(GW).freeze()});function ZL($){let{data:X,content:Y}=DV.default($);return{frontmatter:{...X},content:Y.trim()}}function zL($,X){return DV.default.stringify(X,$)}function VV($){let X=ea.parse($);return W8(X)}function OL($,X,Y){let{frontmatter:W,content:J}=ZL($);if(Y===null||Y===void 0)delete W[X];else W[X]=Y;return zL(W,J)}function KV($,X){let Y=OL($.content,"coverImageId",X);return{...$,content:Y}}var DV,ea,zB$;var NL=A(()=>{lB();HV();m7();DV=n1(cH(),1),ea=FW();zB$=new x2({gfm:!0,breaks:!0})});class p8{callback;heartbeatInterval;constructor($){this.callback=$}static from($){if(!$)return;return new p8($)}createSub($){let{scale:X}=$??{};if(X){let{start:Y,end:W}=X,J=W-Y;return new p8(async(U)=>{let H=Y+U.progress/(U.total??100)*J;await this.callback({...U,progress:H,total:100})})}return new p8(this.callback)}async report($){await this.callback($)}startHeartbeat($,X=5000){this.stopHeartbeat(),this.heartbeatInterval=setInterval(()=>{this.report({message:$,progress:0}).catch(()=>{})},X)}stopHeartbeat(){if(this.heartbeatInterval)clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0}toCallback(){return this.callback}}function kL($){return typeof $>"u"||$===null}function $s($){return typeof $==="object"&&$!==null}function Xs($){if(Array.isArray($))return $;else if(kL($))return[];return[$]}function Ys($,X){var Y,W,J,U;if(X){U=Object.keys(X);for(Y=0,W=U.length;Y<W;Y+=1)J=U[Y],$[J]=X[J]}return $}function Js($,X){var Y="",W;for(W=0;W<X;W+=1)Y+=$;return Y}function Ws($){return $===0&&Number.NEGATIVE_INFINITY===1/$}function vL($,X){var Y="",W=$.reason||"(unknown reason)";if(!$.mark)return W;if($.mark.name)Y+='in "'+$.mark.name+'" ';if(Y+="("+($.mark.line+1)+":"+($.mark.column+1)+")",!X&&$.mark.snippet)Y+=`
134
-
135
- `+$.mark.snippet;return W+" "+Y}function s7($,X){if(Error.call(this),this.name="YAMLException",this.reason=$,this.mark=X,this.message=vL(this,!1),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else this.stack=Error().stack||""}function QV($,X,Y,W,J){var U="",H="",D=Math.floor(J/2)-1;if(W-X>D)U=" ... ",X=W-D+U.length;if(Y-W>D)H=" ...",Y=W+D-H.length;return{str:U+$.slice(X,Y).replace(/\t/g,"\u2192")+H,pos:W-X+U.length}}function FV($,X){return Z4.repeat(" ",X-$.length)+$}function Qs($,X){if(X=Object.create(X||null),!$.buffer)return null;if(!X.maxLength)X.maxLength=79;if(typeof X.indent!=="number")X.indent=1;if(typeof X.linesBefore!=="number")X.linesBefore=3;if(typeof X.linesAfter!=="number")X.linesAfter=2;var Y=/\r?\n|\r|\0/g,W=[0],J=[],U,H=-1;while(U=Y.exec($.buffer))if(J.push(U.index),W.push(U.index+U[0].length),$.position<=U.index&&H<0)H=W.length-2;if(H<0)H=W.length-1;var D="",V,K,Q=Math.min($.line+X.linesAfter,J.length).toString().length,q=X.maxLength-(X.indent+Q+3);for(V=1;V<=X.linesBefore;V++){if(H-V<0)break;K=QV($.buffer,W[H-V],J[H-V],$.position-(W[H]-W[H-V]),q),D=Z4.repeat(" ",X.indent)+FV(($.line-V+1).toString(),Q)+" | "+K.str+`
136
- `+D}K=QV($.buffer,W[H],J[H],$.position,q),D+=Z4.repeat(" ",X.indent)+FV(($.line+1).toString(),Q)+" | "+K.str+`
137
- `,D+=Z4.repeat("-",X.indent+Q+3+K.pos)+`^
138
- `;for(V=1;V<=X.linesAfter;V++){if(H+V>=J.length)break;K=QV($.buffer,W[H+V],J[H+V],$.position-(W[H]-W[H+V]),q),D+=Z4.repeat(" ",X.indent)+FV(($.line+V+1).toString(),Q)+" | "+K.str+`
139
- `}return D.replace(/\n$/,"")}function Zs($){var X={};if($!==null)Object.keys($).forEach(function(Y){$[Y].forEach(function(W){X[String(W)]=Y})});return X}function zs($,X){if(X=X||{},Object.keys(X).forEach(function(Y){if(qs.indexOf(Y)===-1)throw new Y1('Unknown option "'+Y+'" is met in definition of "'+$+'" YAML type.')}),this.options=X,this.tag=$,this.kind=X.kind||null,this.resolve=X.resolve||function(){return!0},this.construct=X.construct||function(Y){return Y},this.instanceOf=X.instanceOf||null,this.predicate=X.predicate||null,this.represent=X.represent||null,this.representName=X.representName||null,this.defaultStyle=X.defaultStyle||null,this.multi=X.multi||!1,this.styleAliases=Zs(X.styleAliases||null),ws.indexOf(this.kind)===-1)throw new Y1('Unknown kind "'+this.kind+'" is specified for "'+$+'" YAML type.')}function AL($,X){var Y=[];return $[X].forEach(function(W){var J=Y.length;Y.forEach(function(U,H){if(U.tag===W.tag&&U.kind===W.kind&&U.multi===W.multi)J=H}),Y[J]=W}),Y}function Os(){var $={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},X,Y;function W(J){if(J.multi)$.multi[J.kind].push(J),$.multi.fallback.push(J);else $[J.kind][J.tag]=$.fallback[J.tag]=J}for(X=0,Y=arguments.length;X<Y;X+=1)arguments[X].forEach(W);return $}function wV($){return this.extend($)}function Rs($){if($===null)return!0;var X=$.length;return X===1&&$==="~"||X===4&&($==="null"||$==="Null"||$==="NULL")}function Ls(){return null}function Es($){return $===null}function Is($){if($===null)return!1;var X=$.length;return X===4&&($==="true"||$==="True"||$==="TRUE")||X===5&&($==="false"||$==="False"||$==="FALSE")}function _s($){return $==="true"||$==="True"||$==="TRUE"}function Ts($){return Object.prototype.toString.call($)==="[object Boolean]"}function Ss($){return 48<=$&&$<=57||65<=$&&$<=70||97<=$&&$<=102}function bs($){return 48<=$&&$<=55}function xs($){return 48<=$&&$<=57}function ks($){if($===null)return!1;var X=$.length,Y=0,W=!1,J;if(!X)return!1;if(J=$[Y],J==="-"||J==="+")J=$[++Y];if(J==="0"){if(Y+1===X)return!0;if(J=$[++Y],J==="b"){Y++;for(;Y<X;Y++){if(J=$[Y],J==="_")continue;if(J!=="0"&&J!=="1")return!1;W=!0}return W&&J!=="_"}if(J==="x"){Y++;for(;Y<X;Y++){if(J=$[Y],J==="_")continue;if(!Ss($.charCodeAt(Y)))return!1;W=!0}return W&&J!=="_"}if(J==="o"){Y++;for(;Y<X;Y++){if(J=$[Y],J==="_")continue;if(!bs($.charCodeAt(Y)))return!1;W=!0}return W&&J!=="_"}}if(J==="_")return!1;for(;Y<X;Y++){if(J=$[Y],J==="_")continue;if(!xs($.charCodeAt(Y)))return!1;W=!0}if(!W||J==="_")return!1;return!0}function vs($){var X=$,Y=1,W;if(X.indexOf("_")!==-1)X=X.replace(/_/g,"");if(W=X[0],W==="-"||W==="+"){if(W==="-")Y=-1;X=X.slice(1),W=X[0]}if(X==="0")return 0;if(W==="0"){if(X[1]==="b")return Y*parseInt(X.slice(2),2);if(X[1]==="x")return Y*parseInt(X.slice(2),16);if(X[1]==="o")return Y*parseInt(X.slice(2),8)}return Y*parseInt(X,10)}function hs($){return Object.prototype.toString.call($)==="[object Number]"&&($%1===0&&!Z4.isNegativeZero($))}function gs($){if($===null)return!1;if(!fs.test($)||$[$.length-1]==="_")return!1;return!0}function ms($){var X,Y;if(X=$.replace(/_/g,"").toLowerCase(),Y=X[0]==="-"?-1:1,"+-".indexOf(X[0])>=0)X=X.slice(1);if(X===".inf")return Y===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if(X===".nan")return NaN;return Y*parseFloat(X,10)}function ps($,X){var Y;if(isNaN($))switch(X){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===$)switch(X){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===$)switch(X){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Z4.isNegativeZero($))return"-0.0";return Y=$.toString(10),us.test(Y)?Y.replace("e",".e"):Y}function cs($){return Object.prototype.toString.call($)==="[object Number]"&&($%1!==0||Z4.isNegativeZero($))}function rs($){if($===null)return!1;if(hL.exec($)!==null)return!0;if(yL.exec($)!==null)return!0;return!1}function ns($){var X,Y,W,J,U,H,D,V=0,K=null,Q,q,F;if(X=hL.exec($),X===null)X=yL.exec($);if(X===null)throw Error("Date resolve error");if(Y=+X[1],W=+X[2]-1,J=+X[3],!X[4])return new Date(Date.UTC(Y,W,J));if(U=+X[4],H=+X[5],D=+X[6],X[7]){V=X[7].slice(0,3);while(V.length<3)V+="0";V=+V}if(X[9]){if(Q=+X[10],q=+(X[11]||0),K=(Q*60+q)*60000,X[9]==="-")K=-K}if(F=new Date(Date.UTC(Y,W,J,U,H,D,V)),K)F.setTime(F.getTime()-K);return F}function os($){return $.toISOString()}function ss($){return $==="<<"||$===null}function es($){if($===null)return!1;var X,Y,W=0,J=$.length,U=AV;for(Y=0;Y<J;Y++){if(X=U.indexOf($.charAt(Y)),X>64)continue;if(X<0)return!1;W+=6}return W%8===0}function $t($){var X,Y,W=$.replace(/[\r\n=]/g,""),J=W.length,U=AV,H=0,D=[];for(X=0;X<J;X++){if(X%4===0&&X)D.push(H>>16&255),D.push(H>>8&255),D.push(H&255);H=H<<6|U.indexOf(W.charAt(X))}if(Y=J%4*6,Y===0)D.push(H>>16&255),D.push(H>>8&255),D.push(H&255);else if(Y===18)D.push(H>>10&255),D.push(H>>2&255);else if(Y===12)D.push(H>>4&255);return new Uint8Array(D)}function Xt($){var X="",Y=0,W,J,U=$.length,H=AV;for(W=0;W<U;W++){if(W%3===0&&W)X+=H[Y>>18&63],X+=H[Y>>12&63],X+=H[Y>>6&63],X+=H[Y&63];Y=(Y<<8)+$[W]}if(J=U%3,J===0)X+=H[Y>>18&63],X+=H[Y>>12&63],X+=H[Y>>6&63],X+=H[Y&63];else if(J===2)X+=H[Y>>10&63],X+=H[Y>>4&63],X+=H[Y<<2&63],X+=H[64];else if(J===1)X+=H[Y>>2&63],X+=H[Y<<4&63],X+=H[64],X+=H[64];return X}function Yt($){return Object.prototype.toString.call($)==="[object Uint8Array]"}function Gt($){if($===null)return!0;var X=[],Y,W,J,U,H,D=$;for(Y=0,W=D.length;Y<W;Y+=1){if(J=D[Y],H=!1,Ut.call(J)!=="[object Object]")return!1;for(U in J)if(Wt.call(J,U))if(!H)H=!0;else return!1;if(!H)return!1;if(X.indexOf(U)===-1)X.push(U);else return!1}return!0}function Ht($){return $!==null?$:[]}function Kt($){if($===null)return!0;var X,Y,W,J,U,H=$;U=Array(H.length);for(X=0,Y=H.length;X<Y;X+=1){if(W=H[X],Vt.call(W)!=="[object Object]")return!1;if(J=Object.keys(W),J.length!==1)return!1;U[X]=[J[0],W[J[0]]]}return!0}function Qt($){if($===null)return[];var X,Y,W,J,U,H=$;U=Array(H.length);for(X=0,Y=H.length;X<Y;X+=1)W=H[X],J=Object.keys(W),U[X]=[J[0],W[J[0]]];return U}function wt($){if($===null)return!0;var X,Y=$;for(X in Y)if(qt.call(Y,X)){if(Y[X]!==null)return!1}return!0}function Zt($){return $!==null?$:{}}function ML($){return Object.prototype.toString.call($)}function _0($){return $===10||$===13}function I9($){return $===9||$===32}function J1($){return $===9||$===32||$===10||$===13}function n5($){return $===44||$===91||$===93||$===123||$===125}function Mt($){var X;if(48<=$&&$<=57)return $-48;if(X=$|32,97<=X&&X<=102)return X-97+10;return-1}function jt($){if($===120)return 2;if($===117)return 4;if($===85)return 8;return 0}function Rt($){if(48<=$&&$<=57)return $-48;return-1}function jL($){return $===48?"\x00":$===97?"\x07":$===98?"\b":$===116?"\t":$===9?"\t":$===110?`
140
- `:$===118?"\v":$===102?"\f":$===114?"\r":$===101?"\x1B":$===32?" ":$===34?'"':$===47?"/":$===92?"\\":$===78?"\x85":$===95?"\xA0":$===76?"\u2028":$===80?"\u2029":""}function Lt($){if($<=65535)return String.fromCharCode($);return String.fromCharCode(($-65536>>10)+55296,($-65536&1023)+56320)}function cL($,X,Y){if(X==="__proto__")Object.defineProperty($,X,{configurable:!0,enumerable:!0,writable:!0,value:Y});else $[X]=Y}function Et($,X){this.input=$,this.filename=X.filename||null,this.schema=X.schema||fL,this.onWarning=X.onWarning||null,this.legacy=X.legacy||!1,this.json=X.json||!1,this.listener=X.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=$.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function iL($,X){var Y={name:$.filename,buffer:$.input.slice(0,-1),position:$.position,line:$.line,column:$.position-$.lineStart};return Y.snippet=Fs(Y),new Y1(X,Y)}function h$($,X){throw iL($,X)}function ZW($,X){if($.onWarning)$.onWarning.call(null,iL($,X))}function d8($,X,Y,W){var J,U,H,D;if(X<Y){if(D=$.input.slice(X,Y),W){for(J=0,U=D.length;J<U;J+=1)if(H=D.charCodeAt(J),!(H===9||32<=H&&H<=1114111))h$($,"expected valid JSON character")}else if(Nt.test(D))h$($,"the stream contains non-printable characters");$.result+=D}}function LL($,X,Y,W){var J,U,H,D;if(!Z4.isObject(Y))h$($,"cannot merge mappings; the provided source object is unacceptable");J=Object.keys(Y);for(H=0,D=J.length;H<D;H+=1)if(U=J[H],!l8.call(X,U))cL(X,U,Y[U]),W[U]=!0}function o5($,X,Y,W,J,U,H,D,V){var K,Q;if(Array.isArray(J)){J=Array.prototype.slice.call(J);for(K=0,Q=J.length;K<Q;K+=1){if(Array.isArray(J[K]))h$($,"nested arrays are not supported inside keys");if(typeof J==="object"&&ML(J[K])==="[object Object]")J[K]="[object Object]"}}if(typeof J==="object"&&ML(J)==="[object Object]")J="[object Object]";if(J=String(J),X===null)X={};if(W==="tag:yaml.org,2002:merge")if(Array.isArray(U))for(K=0,Q=U.length;K<Q;K+=1)LL($,X,U[K],Y);else LL($,X,U,Y);else{if(!$.json&&!l8.call(Y,J)&&l8.call(X,J))$.line=H||$.line,$.lineStart=D||$.lineStart,$.position=V||$.position,h$($,"duplicated mapping key");cL(X,J,U),delete Y[J]}return X}function BV($){var X=$.input.charCodeAt($.position);if(X===10)$.position++;else if(X===13){if($.position++,$.input.charCodeAt($.position)===10)$.position++}else h$($,"a line break is expected");$.line+=1,$.lineStart=$.position,$.firstTabInLine=-1}function G4($,X,Y){var W=0,J=$.input.charCodeAt($.position);while(J!==0){while(I9(J)){if(J===9&&$.firstTabInLine===-1)$.firstTabInLine=$.position;J=$.input.charCodeAt(++$.position)}if(X&&J===35)do J=$.input.charCodeAt(++$.position);while(J!==10&&J!==13&&J!==0);if(_0(J)){BV($),J=$.input.charCodeAt($.position),W++,$.lineIndent=0;while(J===32)$.lineIndent++,J=$.input.charCodeAt(++$.position)}else break}if(Y!==-1&&W!==0&&$.lineIndent<Y)ZW($,"deficient indentation");return W}function NW($){var X=$.position,Y;if(Y=$.input.charCodeAt(X),(Y===45||Y===46)&&Y===$.input.charCodeAt(X+1)&&Y===$.input.charCodeAt(X+2)){if(X+=3,Y=$.input.charCodeAt(X),Y===0||J1(Y))return!0}return!1}function MV($,X){if(X===1)$.result+=" ";else if(X>1)$.result+=Z4.repeat(`
141
- `,X-1)}function Pt($,X,Y){var W,J,U,H,D,V,K,Q,q=$.kind,F=$.result,w;if(w=$.input.charCodeAt($.position),J1(w)||n5(w)||w===35||w===38||w===42||w===33||w===124||w===62||w===39||w===34||w===37||w===64||w===96)return!1;if(w===63||w===45){if(J=$.input.charCodeAt($.position+1),J1(J)||Y&&n5(J))return!1}$.kind="scalar",$.result="",U=H=$.position,D=!1;while(w!==0){if(w===58){if(J=$.input.charCodeAt($.position+1),J1(J)||Y&&n5(J))break}else if(w===35){if(W=$.input.charCodeAt($.position-1),J1(W))break}else if($.position===$.lineStart&&NW($)||Y&&n5(w))break;else if(_0(w))if(V=$.line,K=$.lineStart,Q=$.lineIndent,G4($,!1,-1),$.lineIndent>=X){D=!0,w=$.input.charCodeAt($.position);continue}else{$.position=H,$.line=V,$.lineStart=K,$.lineIndent=Q;break}if(D)d8($,U,H,!1),MV($,$.line-V),U=H=$.position,D=!1;if(!I9(w))H=$.position+1;w=$.input.charCodeAt(++$.position)}if(d8($,U,H,!1),$.result)return!0;return $.kind=q,$.result=F,!1}function It($,X){var Y,W,J;if(Y=$.input.charCodeAt($.position),Y!==39)return!1;$.kind="scalar",$.result="",$.position++,W=J=$.position;while((Y=$.input.charCodeAt($.position))!==0)if(Y===39)if(d8($,W,$.position,!0),Y=$.input.charCodeAt(++$.position),Y===39)W=$.position,$.position++,J=$.position;else return!0;else if(_0(Y))d8($,W,J,!0),MV($,G4($,!1,X)),W=J=$.position;else if($.position===$.lineStart&&NW($))h$($,"unexpected end of the document within a single quoted scalar");else $.position++,J=$.position;h$($,"unexpected end of the stream within a single quoted scalar")}function _t($,X){var Y,W,J,U,H,D;if(D=$.input.charCodeAt($.position),D!==34)return!1;$.kind="scalar",$.result="",$.position++,Y=W=$.position;while((D=$.input.charCodeAt($.position))!==0)if(D===34)return d8($,Y,$.position,!0),$.position++,!0;else if(D===92){if(d8($,Y,$.position,!0),D=$.input.charCodeAt(++$.position),_0(D))G4($,!1,X);else if(D<256&&dL[D])$.result+=lL[D],$.position++;else if((H=jt(D))>0){J=H,U=0;for(;J>0;J--)if(D=$.input.charCodeAt(++$.position),(H=Mt(D))>=0)U=(U<<4)+H;else h$($,"expected hexadecimal character");$.result+=Lt(U),$.position++}else h$($,"unknown escape sequence");Y=W=$.position}else if(_0(D))d8($,Y,W,!0),MV($,G4($,!1,X)),Y=W=$.position;else if($.position===$.lineStart&&NW($))h$($,"unexpected end of the document within a double quoted scalar");else $.position++,W=$.position;h$($,"unexpected end of the stream within a double quoted scalar")}function Tt($,X){var Y=!0,W,J,U,H=$.tag,D,V=$.anchor,K,Q,q,F,w,z=Object.create(null),O,N,L,P;if(P=$.input.charCodeAt($.position),P===91)Q=93,w=!1,D=[];else if(P===123)Q=125,w=!0,D={};else return!1;if($.anchor!==null)$.anchorMap[$.anchor]=D;P=$.input.charCodeAt(++$.position);while(P!==0){if(G4($,!0,X),P=$.input.charCodeAt($.position),P===Q)return $.position++,$.tag=H,$.anchor=V,$.kind=w?"mapping":"sequence",$.result=D,!0;else if(!Y)h$($,"missed comma between flow collection entries");else if(P===44)h$($,"expected the node content, but found ','");if(N=O=L=null,q=F=!1,P===63){if(K=$.input.charCodeAt($.position+1),J1(K))q=F=!0,$.position++,G4($,!0,X)}if(W=$.line,J=$.lineStart,U=$.position,a5($,X,qW,!1,!0),N=$.tag,O=$.result,G4($,!0,X),P=$.input.charCodeAt($.position),(F||$.line===W)&&P===58)q=!0,P=$.input.charCodeAt(++$.position),G4($,!0,X),a5($,X,qW,!1,!0),L=$.result;if(w)o5($,D,z,N,O,L,W,J,U);else if(q)D.push(o5($,null,z,N,O,L,W,J,U));else D.push(O);if(G4($,!0,X),P=$.input.charCodeAt($.position),P===44)Y=!0,P=$.input.charCodeAt(++$.position);else Y=!1}h$($,"unexpected end of the stream within a flow collection")}function Ct($,X){var Y,W,J=qV,U=!1,H=!1,D=X,V=0,K=!1,Q,q;if(q=$.input.charCodeAt($.position),q===124)W=!1;else if(q===62)W=!0;else return!1;$.kind="scalar",$.result="";while(q!==0)if(q=$.input.charCodeAt(++$.position),q===43||q===45)if(qV===J)J=q===43?BL:Ot;else h$($,"repeat of a chomping mode identifier");else if((Q=Rt(q))>=0)if(Q===0)h$($,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!H)D=X+Q-1,H=!0;else h$($,"repeat of an indentation width identifier");else break;if(I9(q)){do q=$.input.charCodeAt(++$.position);while(I9(q));if(q===35)do q=$.input.charCodeAt(++$.position);while(!_0(q)&&q!==0)}while(q!==0){BV($),$.lineIndent=0,q=$.input.charCodeAt($.position);while((!H||$.lineIndent<D)&&q===32)$.lineIndent++,q=$.input.charCodeAt(++$.position);if(!H&&$.lineIndent>D)D=$.lineIndent;if(_0(q)){V++;continue}if($.lineIndent<D){if(J===BL)$.result+=Z4.repeat(`
142
- `,U?1+V:V);else if(J===qV){if(U)$.result+=`
143
- `}break}if(W)if(I9(q))K=!0,$.result+=Z4.repeat(`
144
- `,U?1+V:V);else if(K)K=!1,$.result+=Z4.repeat(`
145
- `,V+1);else if(V===0){if(U)$.result+=" "}else $.result+=Z4.repeat(`
146
- `,V);else $.result+=Z4.repeat(`
147
- `,U?1+V:V);U=!0,H=!0,V=0,Y=$.position;while(!_0(q)&&q!==0)q=$.input.charCodeAt(++$.position);d8($,Y,$.position,!1)}return!0}function EL($,X){var Y,W=$.tag,J=$.anchor,U=[],H,D=!1,V;if($.firstTabInLine!==-1)return!1;if($.anchor!==null)$.anchorMap[$.anchor]=U;V=$.input.charCodeAt($.position);while(V!==0){if($.firstTabInLine!==-1)$.position=$.firstTabInLine,h$($,"tab characters must not be used in indentation");if(V!==45)break;if(H=$.input.charCodeAt($.position+1),!J1(H))break;if(D=!0,$.position++,G4($,!0,-1)){if($.lineIndent<=X){U.push(null),V=$.input.charCodeAt($.position);continue}}if(Y=$.line,a5($,X,mL,!1,!0),U.push($.result),G4($,!0,-1),V=$.input.charCodeAt($.position),($.line===Y||$.lineIndent>X)&&V!==0)h$($,"bad indentation of a sequence entry");else if($.lineIndent<X)break}if(D)return $.tag=W,$.anchor=J,$.kind="sequence",$.result=U,!0;return!1}function St($,X,Y){var W,J,U,H,D,V,K=$.tag,Q=$.anchor,q={},F=Object.create(null),w=null,z=null,O=null,N=!1,L=!1,P;if($.firstTabInLine!==-1)return!1;if($.anchor!==null)$.anchorMap[$.anchor]=q;P=$.input.charCodeAt($.position);while(P!==0){if(!N&&$.firstTabInLine!==-1)$.position=$.firstTabInLine,h$($,"tab characters must not be used in indentation");if(W=$.input.charCodeAt($.position+1),U=$.line,(P===63||P===58)&&J1(W)){if(P===63){if(N)o5($,q,F,w,z,null,H,D,V),w=z=O=null;L=!0,N=!0,J=!0}else if(N)N=!1,J=!0;else h$($,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");$.position+=1,P=W}else{if(H=$.line,D=$.lineStart,V=$.position,!a5($,Y,gL,!1,!0))break;if($.line===U){P=$.input.charCodeAt($.position);while(I9(P))P=$.input.charCodeAt(++$.position);if(P===58){if(P=$.input.charCodeAt(++$.position),!J1(P))h$($,"a whitespace character is expected after the key-value separator within a block mapping");if(N)o5($,q,F,w,z,null,H,D,V),w=z=O=null;L=!0,N=!1,J=!1,w=$.tag,z=$.result}else if(L)h$($,"can not read an implicit mapping pair; a colon is missed");else return $.tag=K,$.anchor=Q,!0}else if(L)h$($,"can not read a block mapping entry; a multiline key may not be an implicit key");else return $.tag=K,$.anchor=Q,!0}if($.line===U||$.lineIndent>X){if(N)H=$.line,D=$.lineStart,V=$.position;if(a5($,X,wW,!0,J))if(N)z=$.result;else O=$.result;if(!N)o5($,q,F,w,z,O,H,D,V),w=z=O=null;G4($,!0,-1),P=$.input.charCodeAt($.position)}if(($.line===U||$.lineIndent>X)&&P!==0)h$($,"bad indentation of a mapping entry");else if($.lineIndent<X)break}if(N)o5($,q,F,w,z,null,H,D,V);if(L)$.tag=K,$.anchor=Q,$.kind="mapping",$.result=q;return L}function bt($){var X,Y=!1,W=!1,J,U,H;if(H=$.input.charCodeAt($.position),H!==33)return!1;if($.tag!==null)h$($,"duplication of a tag property");if(H=$.input.charCodeAt(++$.position),H===60)Y=!0,H=$.input.charCodeAt(++$.position);else if(H===33)W=!0,J="!!",H=$.input.charCodeAt(++$.position);else J="!";if(X=$.position,Y){do H=$.input.charCodeAt(++$.position);while(H!==0&&H!==62);if($.position<$.length)U=$.input.slice(X,$.position),H=$.input.charCodeAt(++$.position);else h$($,"unexpected end of the stream within a verbatim tag")}else{while(H!==0&&!J1(H)){if(H===33)if(!W){if(J=$.input.slice(X-1,$.position+1),!uL.test(J))h$($,"named tag handle cannot contain such characters");W=!0,X=$.position+1}else h$($,"tag suffix cannot contain exclamation marks");H=$.input.charCodeAt(++$.position)}if(U=$.input.slice(X,$.position),Bt.test(U))h$($,"tag suffix cannot contain flow indicator characters")}if(U&&!pL.test(U))h$($,"tag name cannot contain such characters: "+U);try{U=decodeURIComponent(U)}catch(D){h$($,"tag name is malformed: "+U)}if(Y)$.tag=U;else if(l8.call($.tagMap,J))$.tag=$.tagMap[J]+U;else if(J==="!")$.tag="!"+U;else if(J==="!!")$.tag="tag:yaml.org,2002:"+U;else h$($,'undeclared tag handle "'+J+'"');return!0}function xt($){var X,Y;if(Y=$.input.charCodeAt($.position),Y!==38)return!1;if($.anchor!==null)h$($,"duplication of an anchor property");Y=$.input.charCodeAt(++$.position),X=$.position;while(Y!==0&&!J1(Y)&&!n5(Y))Y=$.input.charCodeAt(++$.position);if($.position===X)h$($,"name of an anchor node must contain at least one character");return $.anchor=$.input.slice(X,$.position),!0}function kt($){var X,Y,W;if(W=$.input.charCodeAt($.position),W!==42)return!1;W=$.input.charCodeAt(++$.position),X=$.position;while(W!==0&&!J1(W)&&!n5(W))W=$.input.charCodeAt(++$.position);if($.position===X)h$($,"name of an alias node must contain at least one character");if(Y=$.input.slice(X,$.position),!l8.call($.anchorMap,Y))h$($,'unidentified alias "'+Y+'"');return $.result=$.anchorMap[Y],G4($,!0,-1),!0}function a5($,X,Y,W,J){var U,H,D,V=1,K=!1,Q=!1,q,F,w,z,O,N;if($.listener!==null)$.listener("open",$);if($.tag=null,$.anchor=null,$.kind=null,$.result=null,U=H=D=wW===Y||mL===Y,W){if(G4($,!0,-1)){if(K=!0,$.lineIndent>X)V=1;else if($.lineIndent===X)V=0;else if($.lineIndent<X)V=-1}}if(V===1)while(bt($)||xt($))if(G4($,!0,-1)){if(K=!0,D=U,$.lineIndent>X)V=1;else if($.lineIndent===X)V=0;else if($.lineIndent<X)V=-1}else D=!1;if(D)D=K||J;if(V===1||wW===Y){if(qW===Y||gL===Y)O=X;else O=X+1;if(N=$.position-$.lineStart,V===1)if(D&&(EL($,N)||St($,N,O))||Tt($,O))Q=!0;else{if(H&&Ct($,O)||It($,O)||_t($,O))Q=!0;else if(kt($)){if(Q=!0,$.tag!==null||$.anchor!==null)h$($,"alias node should not have any properties")}else if(Pt($,O,qW===Y)){if(Q=!0,$.tag===null)$.tag="?"}if($.anchor!==null)$.anchorMap[$.anchor]=$.result}else if(V===0)Q=D&&EL($,N)}if($.tag===null){if($.anchor!==null)$.anchorMap[$.anchor]=$.result}else if($.tag==="?"){if($.result!==null&&$.kind!=="scalar")h$($,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+$.kind+'"');for(q=0,F=$.implicitTypes.length;q<F;q+=1)if(z=$.implicitTypes[q],z.resolve($.result)){if($.result=z.construct($.result),$.tag=z.tag,$.anchor!==null)$.anchorMap[$.anchor]=$.result;break}}else if($.tag!=="!"){if(l8.call($.typeMap[$.kind||"fallback"],$.tag))z=$.typeMap[$.kind||"fallback"][$.tag];else{z=null,w=$.typeMap.multi[$.kind||"fallback"];for(q=0,F=w.length;q<F;q+=1)if($.tag.slice(0,w[q].tag.length)===w[q].tag){z=w[q];break}}if(!z)h$($,"unknown tag !<"+$.tag+">");if($.result!==null&&z.kind!==$.kind)h$($,"unacceptable node kind for !<"+$.tag+'> tag; it should be "'+z.kind+'", not "'+$.kind+'"');if(!z.resolve($.result,$.tag))h$($,"cannot resolve a node with !<"+$.tag+"> explicit tag");else if($.result=z.construct($.result,$.tag),$.anchor!==null)$.anchorMap[$.anchor]=$.result}if($.listener!==null)$.listener("close",$);return $.tag!==null||$.anchor!==null||Q}function vt($){var X=$.position,Y,W,J,U=!1,H;$.version=null,$.checkLineBreaks=$.legacy,$.tagMap=Object.create(null),$.anchorMap=Object.create(null);while((H=$.input.charCodeAt($.position))!==0){if(G4($,!0,-1),H=$.input.charCodeAt($.position),$.lineIndent>0||H!==37)break;U=!0,H=$.input.charCodeAt(++$.position),Y=$.position;while(H!==0&&!J1(H))H=$.input.charCodeAt(++$.position);if(W=$.input.slice(Y,$.position),J=[],W.length<1)h$($,"directive name must not be less than one character in length");while(H!==0){while(I9(H))H=$.input.charCodeAt(++$.position);if(H===35){do H=$.input.charCodeAt(++$.position);while(H!==0&&!_0(H));break}if(_0(H))break;Y=$.position;while(H!==0&&!J1(H))H=$.input.charCodeAt(++$.position);J.push($.input.slice(Y,$.position))}if(H!==0)BV($);if(l8.call(RL,W))RL[W]($,W,J);else ZW($,'unknown document directive "'+W+'"')}if(G4($,!0,-1),$.lineIndent===0&&$.input.charCodeAt($.position)===45&&$.input.charCodeAt($.position+1)===45&&$.input.charCodeAt($.position+2)===45)$.position+=3,G4($,!0,-1);else if(U)h$($,"directives end mark is expected");if(a5($,$.lineIndent-1,wW,!1,!0),G4($,!0,-1),$.checkLineBreaks&&At.test($.input.slice(X,$.position)))ZW($,"non-ASCII line breaks are interpreted as content");if($.documents.push($.result),$.position===$.lineStart&&NW($)){if($.input.charCodeAt($.position)===46)$.position+=3,G4($,!0,-1);return}if($.position<$.length-1)h$($,"end of the stream or a document separator is expected");else return}function rL($,X){if($=String($),X=X||{},$.length!==0){if($.charCodeAt($.length-1)!==10&&$.charCodeAt($.length-1)!==13)$+=`
148
- `;if($.charCodeAt(0)===65279)$=$.slice(1)}var Y=new Et($,X),W=$.indexOf("\x00");if(W!==-1)Y.position=W,h$(Y,"null byte is not allowed in input");Y.input+="\x00";while(Y.input.charCodeAt(Y.position)===32)Y.lineIndent+=1,Y.position+=1;while(Y.position<Y.length-1)vt(Y);return Y.documents}function ht($,X,Y){if(X!==null&&typeof X==="object"&&typeof Y>"u")Y=X,X=null;var W=rL($,Y);if(typeof X!=="function")return W;for(var J=0,U=W.length;J<U;J+=1)X(W[J])}function yt($,X){var Y=rL($,X);if(Y.length===0)return;else if(Y.length===1)return Y[0];throw new Y1("expected a single document in the stream, but found more")}function We($,X){var Y,W,J,U,H,D,V;if(X===null)return{};Y={},W=Object.keys(X);for(J=0,U=W.length;J<U;J+=1){if(H=W[J],D=String(X[H]),H.slice(0,2)==="!!")H="tag:yaml.org,2002:"+H.slice(2);if(V=$.compiledTypeMap.fallback[H],V&&aL.call(V.styleAliases,D))D=V.styleAliases[D];Y[H]=D}return Y}function Ue($){var X,Y,W;if(X=$.toString(16).toUpperCase(),$<=255)Y="x",W=2;else if($<=65535)Y="u",W=4;else if($<=4294967295)Y="U",W=8;else throw new Y1("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+Y+Z4.repeat("0",W-X.length)+X}function He($){this.schema=$.schema||fL,this.indent=Math.max(1,$.indent||2),this.noArrayIndent=$.noArrayIndent||!1,this.skipInvalid=$.skipInvalid||!1,this.flowLevel=Z4.isNothing($.flowLevel)?-1:$.flowLevel,this.styleMap=We(this.schema,$.styles||null),this.sortKeys=$.sortKeys||!1,this.lineWidth=$.lineWidth||80,this.noRefs=$.noRefs||!1,this.noCompatMode=$.noCompatMode||!1,this.condenseFlow=$.condenseFlow||!1,this.quotingType=$.quotingType==='"'?e7:Ge,this.forceQuotes=$.forceQuotes||!1,this.replacer=typeof $.replacer==="function"?$.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function PL($,X){var Y=Z4.repeat(" ",X),W=0,J=-1,U="",H,D=$.length;while(W<D){if(J=$.indexOf(`
149
- `,W),J===-1)H=$.slice(W),W=D;else H=$.slice(W,J+1),W=J+1;if(H.length&&H!==`
150
- `)U+=Y;U+=H}return U}function zV($,X){return`
151
- `+Z4.repeat(" ",$.indent*X)}function De($,X){var Y,W,J;for(Y=0,W=$.implicitTypes.length;Y<W;Y+=1)if(J=$.implicitTypes[Y],J.resolve(X))return!0;return!1}function OW($){return $===pt||$===mt}function $Y($){return 32<=$&&$<=126||161<=$&&$<=55295&&$!==8232&&$!==8233||57344<=$&&$<=65533&&$!==jV||65536<=$&&$<=1114111}function IL($){return $Y($)&&$!==jV&&$!==ut&&$!==t7}function _L($,X,Y){var W=IL($),J=W&&!OW($);return(Y?W:W&&$!==sL&&$!==tL&&$!==eL&&$!==$E&&$!==XE)&&$!==ZV&&!(X===zW&&!J)||IL(X)&&!OW(X)&&$===ZV||X===zW&&J}function Ve($){return $Y($)&&$!==jV&&!OW($)&&$!==ot&&$!==tt&&$!==zW&&$!==sL&&$!==tL&&$!==eL&&$!==$E&&$!==XE&&$!==ZV&&$!==it&&$!==nt&&$!==ct&&$!==Xe&&$!==at&&$!==st&&$!==rt&&$!==dt&&$!==lt&&$!==et&&$!==$e}function Ke($){return!OW($)&&$!==zW}function a7($,X){var Y=$.charCodeAt(X),W;if(Y>=55296&&Y<=56319&&X+1<$.length){if(W=$.charCodeAt(X+1),W>=56320&&W<=57343)return(Y-55296)*1024+W-56320+65536}return Y}function YE($){var X=/^\n* /;return X.test($)}function Qe($,X,Y,W,J,U,H,D){var V,K=0,Q=null,q=!1,F=!1,w=W!==-1,z=-1,O=Ve(a7($,0))&&Ke(a7($,$.length-1));if(X||H)for(V=0;V<$.length;K>=65536?V+=2:V++){if(K=a7($,V),!$Y(K))return r5;O=O&&_L(K,Q,D),Q=K}else{for(V=0;V<$.length;K>=65536?V+=2:V++){if(K=a7($,V),K===t7){if(q=!0,w)F=F||V-z-1>W&&$[z+1]!==" ",z=V}else if(!$Y(K))return r5;O=O&&_L(K,Q,D),Q=K}F=F||w&&(V-z-1>W&&$[z+1]!==" ")}if(!q&&!F){if(O&&!H&&!J($))return JE;return U===e7?r5:OV}if(Y>9&&YE($))return r5;if(!H)return F?UE:WE;return U===e7?r5:OV}function Fe($,X,Y,W,J){$.dump=function(){if(X.length===0)return $.quotingType===e7?'""':"''";if(!$.noCompatMode){if(Ye.indexOf(X)!==-1||Je.test(X))return $.quotingType===e7?'"'+X+'"':"'"+X+"'"}var U=$.indent*Math.max(1,Y),H=$.lineWidth===-1?-1:Math.max(Math.min($.lineWidth,40),$.lineWidth-U),D=W||$.flowLevel>-1&&Y>=$.flowLevel;function V(K){return De($,K)}switch(Qe(X,D,$.indent,H,V,$.quotingType,$.forceQuotes&&!W,J)){case JE:return X;case OV:return"'"+X.replace(/'/g,"''")+"'";case WE:return"|"+TL(X,$.indent)+CL(PL(X,U));case UE:return">"+TL(X,$.indent)+CL(PL(qe(X,H),U));case r5:return'"'+we(X)+'"';default:throw new Y1("impossible error: invalid scalar style")}}()}function TL($,X){var Y=YE($)?String(X):"",W=$[$.length-1]===`
152
- `,J=W&&($[$.length-2]===`
153
- `||$===`
154
- `),U=J?"+":W?"":"-";return Y+U+`
155
- `}function CL($){return $[$.length-1]===`
156
- `?$.slice(0,-1):$}function qe($,X){var Y=/(\n+)([^\n]*)/g,W=function(){var K=$.indexOf(`
157
- `);return K=K!==-1?K:$.length,Y.lastIndex=K,SL($.slice(0,K),X)}(),J=$[0]===`
158
- `||$[0]===" ",U,H;while(H=Y.exec($)){var D=H[1],V=H[2];U=V[0]===" ",W+=D+(!J&&!U&&V!==""?`
159
- `:"")+SL(V,X),J=U}return W}function SL($,X){if($===""||$[0]===" ")return $;var Y=/ [^ ]/g,W,J=0,U,H=0,D=0,V="";while(W=Y.exec($)){if(D=W.index,D-J>X)U=H>J?H:D,V+=`
160
- `+$.slice(J,U),J=U+1;H=D}if(V+=`
161
- `,$.length-J>X&&H>J)V+=$.slice(J,H)+`
162
- `+$.slice(H+1);else V+=$.slice(J);return V.slice(1)}function we($){var X="",Y=0,W;for(var J=0;J<$.length;Y>=65536?J+=2:J++)if(Y=a7($,J),W=g4[Y],!W&&$Y(Y)){if(X+=$[J],Y>=65536)X+=$[J+1]}else X+=W||Ue(Y);return X}function Ze($,X,Y){var W="",J=$.tag,U,H,D;for(U=0,H=Y.length;U<H;U+=1){if(D=Y[U],$.replacer)D=$.replacer.call(Y,String(U),D);if(G8($,X,D,!1,!1)||typeof D>"u"&&G8($,X,null,!1,!1)){if(W!=="")W+=","+(!$.condenseFlow?" ":"");W+=$.dump}}$.tag=J,$.dump="["+W+"]"}function bL($,X,Y,W){var J="",U=$.tag,H,D,V;for(H=0,D=Y.length;H<D;H+=1){if(V=Y[H],$.replacer)V=$.replacer.call(Y,String(H),V);if(G8($,X+1,V,!0,!0,!1,!0)||typeof V>"u"&&G8($,X+1,null,!0,!0,!1,!0)){if(!W||J!=="")J+=zV($,X);if($.dump&&t7===$.dump.charCodeAt(0))J+="-";else J+="- ";J+=$.dump}}$.tag=U,$.dump=J||"[]"}function ze($,X,Y){var W="",J=$.tag,U=Object.keys(Y),H,D,V,K,Q;for(H=0,D=U.length;H<D;H+=1){if(Q="",W!=="")Q+=", ";if($.condenseFlow)Q+='"';if(V=U[H],K=Y[V],$.replacer)K=$.replacer.call(Y,V,K);if(!G8($,X,V,!1,!1))continue;if($.dump.length>1024)Q+="? ";if(Q+=$.dump+($.condenseFlow?'"':"")+":"+($.condenseFlow?"":" "),!G8($,X,K,!1,!1))continue;Q+=$.dump,W+=Q}$.tag=J,$.dump="{"+W+"}"}function Oe($,X,Y,W){var J="",U=$.tag,H=Object.keys(Y),D,V,K,Q,q,F;if($.sortKeys===!0)H.sort();else if(typeof $.sortKeys==="function")H.sort($.sortKeys);else if($.sortKeys)throw new Y1("sortKeys must be a boolean or a function");for(D=0,V=H.length;D<V;D+=1){if(F="",!W||J!=="")F+=zV($,X);if(K=H[D],Q=Y[K],$.replacer)Q=$.replacer.call(Y,K,Q);if(!G8($,X+1,K,!0,!0,!0))continue;if(q=$.tag!==null&&$.tag!=="?"||$.dump&&$.dump.length>1024,q)if($.dump&&t7===$.dump.charCodeAt(0))F+="?";else F+="? ";if(F+=$.dump,q)F+=zV($,X);if(!G8($,X+1,Q,!0,q))continue;if($.dump&&t7===$.dump.charCodeAt(0))F+=":";else F+=": ";F+=$.dump,J+=F}$.tag=U,$.dump=J||"{}"}function xL($,X,Y){var W,J,U,H,D,V;J=Y?$.explicitTypes:$.implicitTypes;for(U=0,H=J.length;U<H;U+=1)if(D=J[U],(D.instanceOf||D.predicate)&&(!D.instanceOf||typeof X==="object"&&X instanceof D.instanceOf)&&(!D.predicate||D.predicate(X))){if(Y)if(D.multi&&D.representName)$.tag=D.representName(X);else $.tag=D.tag;else $.tag="?";if(D.represent){if(V=$.styleMap[D.tag]||D.defaultStyle,oL.call(D.represent)==="[object Function]")W=D.represent(X,V);else if(aL.call(D.represent,V))W=D.represent[V](X,V);else throw new Y1("!<"+D.tag+'> tag resolver accepts not "'+V+'" style');$.dump=W}return!0}return!1}function G8($,X,Y,W,J,U,H){if($.tag=null,$.dump=Y,!xL($,Y,!1))xL($,Y,!0);var D=oL.call($.dump),V=W,K;if(W)W=$.flowLevel<0||$.flowLevel>X;var Q=D==="[object Object]"||D==="[object Array]",q,F;if(Q)q=$.duplicates.indexOf(Y),F=q!==-1;if($.tag!==null&&$.tag!=="?"||F||$.indent!==2&&X>0)J=!1;if(F&&$.usedDuplicates[q])$.dump="*ref_"+q;else{if(Q&&F&&!$.usedDuplicates[q])$.usedDuplicates[q]=!0;if(D==="[object Object]"){if(W&&Object.keys($.dump).length!==0){if(Oe($,X,$.dump,J),F)$.dump="&ref_"+q+$.dump}else if(ze($,X,$.dump),F)$.dump="&ref_"+q+" "+$.dump}else if(D==="[object Array]"){if(W&&$.dump.length!==0){if($.noArrayIndent&&!H&&X>0)bL($,X-1,$.dump,J);else bL($,X,$.dump,J);if(F)$.dump="&ref_"+q+$.dump}else if(Ze($,X,$.dump),F)$.dump="&ref_"+q+" "+$.dump}else if(D==="[object String]"){if($.tag!=="?")Fe($,$.dump,X,U,V)}else if(D==="[object Undefined]")return!1;else{if($.skipInvalid)return!1;throw new Y1("unacceptable kind of an object to dump "+D)}if($.tag!==null&&$.tag!=="?"){if(K=encodeURI($.tag[0]==="!"?$.tag.slice(1):$.tag).replace(/!/g,"%21"),$.tag[0]==="!")K="!"+K;else if(K.slice(0,18)==="tag:yaml.org,2002:")K="!!"+K.slice(18);else K="!<"+K+">";$.dump=K+" "+$.dump}}return!0}function Ne($,X){var Y=[],W=[],J,U;NV($,Y,W);for(J=0,U=W.length;J<U;J+=1)X.duplicates.push(Y[W[J]]);X.usedDuplicates=Array(U)}function NV($,X,Y){var W,J,U;if($!==null&&typeof $==="object")if(J=X.indexOf($),J!==-1){if(Y.indexOf(J)===-1)Y.push(J)}else if(X.push($),Array.isArray($))for(J=0,U=$.length;J<U;J+=1)NV($[J],X,Y);else{W=Object.keys($);for(J=0,U=W.length;J<U;J+=1)NV($[W[J]],X,Y)}}function Ae($,X){X=X||{};var Y=new He(X);if(!Y.noRefs)Ne($,Y);var W=$;if(Y.replacer)W=Y.replacer.call({"":W},"",W);if(G8(Y,0,W,!0,!0))return Y.dump+`
163
- `;return""}function RV($,X){return function(){throw Error("Function yaml."+$+" is removed in js-yaml 4. Use yaml."+X+" instead, which is now safe by default.")}}var Us,Gs,Hs,Ds,Vs,Ks,Z4,Y1,Fs,qs,ws,f4,Ns,As,Bs,Ms,js,Ps,Cs,ys,fs,us,ds,ls,is,hL,yL,as,ts,AV=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
164
- \r`,Jt,Wt,Ut,Dt,Vt,Ft,qt,zt,fL,l8,qW=1,gL=2,mL=3,wW=4,qV=1,Ot=2,BL=3,Nt,At,Bt,uL,pL,dL,lL,c8,RL,ft,gt,nL,oL,aL,jV=65279,mt=9,t7=10,ut=13,pt=32,ct=33,dt=34,ZV=35,lt=37,it=38,rt=39,nt=42,sL=44,ot=45,zW=58,at=61,st=62,tt=63,et=64,tL=91,eL=93,$e=96,$E=123,Xe=124,XE=125,g4,Ye,Je,Ge=1,e7=2,JE=1,OV=2,WE=3,UE=4,r5=5,Be,Me,GE,AB$,HE,BB$,MB$,jB$;var AW=A(()=>{/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */Us=kL,Gs=$s,Hs=Xs,Ds=Js,Vs=Ws,Ks=Ys,Z4={isNothing:Us,isObject:Gs,toArray:Hs,repeat:Ds,isNegativeZero:Vs,extend:Ks};s7.prototype=Object.create(Error.prototype);s7.prototype.constructor=s7;s7.prototype.toString=function(X){return this.name+": "+vL(this,X)};Y1=s7;Fs=Qs,qs=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],ws=["scalar","sequence","mapping"];f4=zs;wV.prototype.extend=function(X){var Y=[],W=[];if(X instanceof f4)W.push(X);else if(Array.isArray(X))W=W.concat(X);else if(X&&(Array.isArray(X.implicit)||Array.isArray(X.explicit))){if(X.implicit)Y=Y.concat(X.implicit);if(X.explicit)W=W.concat(X.explicit)}else throw new Y1("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");Y.forEach(function(U){if(!(U instanceof f4))throw new Y1("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(U.loadKind&&U.loadKind!=="scalar")throw new Y1("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(U.multi)throw new Y1("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),W.forEach(function(U){if(!(U instanceof f4))throw new Y1("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var J=Object.create(wV.prototype);return J.implicit=(this.implicit||[]).concat(Y),J.explicit=(this.explicit||[]).concat(W),J.compiledImplicit=AL(J,"implicit"),J.compiledExplicit=AL(J,"explicit"),J.compiledTypeMap=Os(J.compiledImplicit,J.compiledExplicit),J};Ns=wV,As=new f4("tag:yaml.org,2002:str",{kind:"scalar",construct:function($){return $!==null?$:""}}),Bs=new f4("tag:yaml.org,2002:seq",{kind:"sequence",construct:function($){return $!==null?$:[]}}),Ms=new f4("tag:yaml.org,2002:map",{kind:"mapping",construct:function($){return $!==null?$:{}}}),js=new Ns({explicit:[As,Bs,Ms]});Ps=new f4("tag:yaml.org,2002:null",{kind:"scalar",resolve:Rs,construct:Ls,predicate:Es,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});Cs=new f4("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Is,construct:_s,predicate:Ts,represent:{lowercase:function($){return $?"true":"false"},uppercase:function($){return $?"TRUE":"FALSE"},camelcase:function($){return $?"True":"False"}},defaultStyle:"lowercase"});ys=new f4("tag:yaml.org,2002:int",{kind:"scalar",resolve:ks,construct:vs,predicate:hs,represent:{binary:function($){return $>=0?"0b"+$.toString(2):"-0b"+$.toString(2).slice(1)},octal:function($){return $>=0?"0o"+$.toString(8):"-0o"+$.toString(8).slice(1)},decimal:function($){return $.toString(10)},hexadecimal:function($){return $>=0?"0x"+$.toString(16).toUpperCase():"-0x"+$.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),fs=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");us=/^[-+]?[0-9]+e/;ds=new f4("tag:yaml.org,2002:float",{kind:"scalar",resolve:gs,construct:ms,predicate:cs,represent:ps,defaultStyle:"lowercase"}),ls=js.extend({implicit:[Ps,Cs,ys,ds]}),is=ls,hL=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),yL=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");as=new f4("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:rs,construct:ns,instanceOf:Date,represent:os});ts=new f4("tag:yaml.org,2002:merge",{kind:"scalar",resolve:ss});Jt=new f4("tag:yaml.org,2002:binary",{kind:"scalar",resolve:es,construct:$t,predicate:Yt,represent:Xt}),Wt=Object.prototype.hasOwnProperty,Ut=Object.prototype.toString;Dt=new f4("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Gt,construct:Ht}),Vt=Object.prototype.toString;Ft=new f4("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Kt,construct:Qt}),qt=Object.prototype.hasOwnProperty;zt=new f4("tag:yaml.org,2002:set",{kind:"mapping",resolve:wt,construct:Zt}),fL=is.extend({implicit:[as,ts],explicit:[Jt,Dt,Ft,zt]}),l8=Object.prototype.hasOwnProperty,Nt=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,At=/[\x85\u2028\u2029]/,Bt=/[,\[\]\{\}]/,uL=/^(?:!|!!|![a-z\-]+!)$/i,pL=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;dL=Array(256),lL=Array(256);for(c8=0;c8<256;c8++)dL[c8]=jL(c8)?1:0,lL[c8]=jL(c8);RL={YAML:function(X,Y,W){var J,U,H;if(X.version!==null)h$(X,"duplication of %YAML directive");if(W.length!==1)h$(X,"YAML directive accepts exactly one argument");if(J=/^([0-9]+)\.([0-9]+)$/.exec(W[0]),J===null)h$(X,"ill-formed argument of the YAML directive");if(U=parseInt(J[1],10),H=parseInt(J[2],10),U!==1)h$(X,"unacceptable YAML version of the document");if(X.version=W[0],X.checkLineBreaks=H<2,H!==1&&H!==2)ZW(X,"unsupported YAML version of the document")},TAG:function(X,Y,W){var J,U;if(W.length!==2)h$(X,"TAG directive accepts exactly two arguments");if(J=W[0],U=W[1],!uL.test(J))h$(X,"ill-formed tag handle (first argument) of the TAG directive");if(l8.call(X.tagMap,J))h$(X,'there is a previously declared suffix for "'+J+'" tag handle');if(!pL.test(U))h$(X,"ill-formed tag prefix (second argument) of the TAG directive");try{U=decodeURIComponent(U)}catch(H){h$(X,"tag prefix is malformed: "+U)}X.tagMap[J]=U}};ft=ht,gt=yt,nL={loadAll:ft,load:gt},oL=Object.prototype.toString,aL=Object.prototype.hasOwnProperty,g4={};g4[0]="\\0";g4[7]="\\a";g4[8]="\\b";g4[9]="\\t";g4[10]="\\n";g4[11]="\\v";g4[12]="\\f";g4[13]="\\r";g4[27]="\\e";g4[34]="\\\"";g4[92]="\\\\";g4[133]="\\N";g4[160]="\\_";g4[8232]="\\L";g4[8233]="\\P";Ye=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Je=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;Be=Ae,Me={dump:Be};GE=nL.load,AB$=nL.loadAll,HE=Me.dump,BB$=RV("safeLoad","load"),MB$=RV("safeLoadAll","loadAll"),jB$=RV("safeDump","dump")});var DE=A(()=>{AW()});var XY=()=>{};var s5=A(()=>{P5()});var xB$;var VE=A(()=>{XY();s5();xB$=Z.object({message:Z.string()})});var YY,KE,PV,IV;var BW=A(()=>{s5();YY=Z.object({message:Z.string().describe("Natural language response to the query"),summary:Z.string().optional().describe("Brief summary if applicable"),topics:Z.array(Z.string()).optional().describe("Related topics mentioned"),sources:Z.array(Z.object({id:Z.string(),type:Z.string(),excerpt:Z.string().optional(),relevance:Z.number().min(0).max(1).optional()})).optional().describe("Source entities used to answer the query"),metadata:Z.record(Z.string(),Z.unknown()).optional()}).describe("defaultQueryResponse"),KE=Z.object({message:Z.string()}).describe("simpleTextResponse"),PV=Z.object({success:Z.boolean(),entityId:Z.string().optional(),message:Z.string()}).describe("createEntityResponse"),IV=Z.object({success:Z.boolean(),entityId:Z.string(),changes:Z.array(Z.string()).optional(),message:Z.string()}).describe("updateEntityResponse")});var QE=A(()=>{XY();BW()});var FE=A(()=>{XY();BW()});class qE{schema;config;processor=FW();constructor($,X){this.schema=$;this.config=X}getLabels(){let $={};for(let X of this.config.mappings)$[X.key]=X.label;return $}generateBodyTemplate(){if(this.config.mappings.length===0)return"";let $=[];for(let X of this.config.mappings)$.push(`## ${X.label}`,"",`<!-- Write your ${X.label.toLowerCase()} here -->`,"");return $.join(`
165
- `).trimEnd()+`
166
- `}format($){try{let X=[`# ${this.config.title}`,""];for(let Y of this.config.mappings)this.formatField($,Y,X,2);return X.join(`
167
- `)}catch{throw Error("Failed to format structured content")}}parse($){try{let X=this.processor.parse($),Y=this.extractSections(X,2),W=this.buildDataFromSections(Y,this.config.mappings);return this.schema.parse(W)}catch{throw Error("Failed to parse structured content")}}formatField($,X,Y,W){let J="#".repeat(W)+" "+X.label,U=this.getValueByPath($,X.key);if(X.type==="custom"&&X.formatter){if(U!==void 0&&U!==null){Y.push(J,"");let H=X.formatter(U);if(H)Y.push(H,"")}return}switch(X.type){case"string":case"number":Y.push(J,String(U??""),"");break;case"object":if(Y.push(J),X.children&&U)for(let H of X.children)this.formatField(U,H,Y,W+1);break;case"array":if(Y.push(J,""),Array.isArray(U))if(X.itemType==="object"&&X.itemMappings)U.forEach((H,D)=>{if(Y.push(`${"#".repeat(W+1)} ${X.label.slice(0,-1)} ${D+1}`),Y.push(""),X.itemMappings)for(let V of X.itemMappings)this.formatField(H,V,Y,W+2)});else{for(let H of U){let D=this.defaultArrayItemFormat(H);Y.push(`- ${D}`)}Y.push("")}break}}getValueByPath($,X){let Y=X.split("."),W=$;for(let J of Y)if(W&&typeof W==="object"&&J in W)W=W[J];else return;return W}defaultArrayItemFormat($){if(typeof $==="string"||typeof $==="number")return String($);return JSON.stringify($)}extractSections($,X){let Y=new Map,W=null,J=[];for(let U of $.children)if(U.type==="heading"&&U.depth===X){if(W)Y.set(W.toLowerCase(),J);W=this.getHeadingText(U),J=[]}else if(W)J.push(U);if(W)Y.set(W.toLowerCase(),J);return Y}extractSubsections($,X){let Y=new Map,W=null,J=[];for(let U of $)if(U.type==="heading"&&U.depth===X){if(W)Y.set(W.toLowerCase(),J);W=this.getHeadingText(U),J=[]}else if(W)J.push(U);if(W)Y.set(W.toLowerCase(),J);return Y}textNodeSchema=Z.object({type:Z.literal("text"),value:Z.string()});extractTextValue($){let X=this.textNodeSchema.safeParse($);return X.success?X.data.value:""}getHeadingText($){return $.children.filter((Y)=>Y.type==="text").map((Y)=>this.extractTextValue(Y)).join("")}buildDataFromSections($,X,Y=2){let W={};for(let J of X){let U=$.get(J.label.toLowerCase());if(J.type==="custom"&&J.parser&&U){let H=this.getTextFromSection(U),D=J.parser(H);this.setValueByPath(W,J.key,D)}else if(J.type==="object"&&J.children&&U){let H=this.extractSubsections(U,Y+1),D=this.buildDataFromSections(H,J.children,Y+1);this.setValueByPath(W,J.key,D)}else if(J.type==="array"&&U)if(J.itemType==="object"&&J.itemMappings){let H=this.extractObjectArrayItems(U,Y+1,J.itemMappings);this.setValueByPath(W,J.key,H)}else{let H=this.extractSimpleArrayItems(U);this.setValueByPath(W,J.key,H)}else if(U){let H=this.getTextFromSection(U),D=J.type==="number"?Number(H):H;this.setValueByPath(W,J.key,D)}}return W}setValueByPath($,X,Y){let W=X.split("."),J=$;for(let H=0;H<W.length-1;H++){let D=W[H];if(!D)continue;if(!(D in J))J[D]={};J=J[D]}let U=W[W.length-1];if(U)J[U]=Y}getTextFromSection($){let X=[];for(let Y of $)if(Y.type==="paragraph"){let W=this.extractTextFromParagraph(Y);if(W)X.push(W)}else if(Y.type==="list"){let W=Y;for(let J of W.children){let U=this.extractTextFromListItem(J);if(U)X.push(`- ${U}`)}}return X.join(`
168
- `)}extractTextFromParagraph($){return this.extractInlineText($.children).trim()}extractInlineText($){let X=[];for(let Y of $)if(Y.type==="text")X.push(this.extractTextValue(Y));else if(Y.type==="emphasis"){let W=this.extractInlineText(Y.children);if(W)X.push(`*${W}*`)}else if(Y.type==="strong"){let W=this.extractInlineText(Y.children);if(W)X.push(`**${W}**`)}return X.join("")}extractSimpleArrayItems($){let X=[];for(let Y of $)if(Y.type==="list"){let W=Y;for(let J of W.children){let U=this.extractTextFromListItem(J);if(U)X.push(U)}}return X}extractObjectArrayItems($,X,Y){let W=[],J=[],U=!1;for(let H of $)if(H.type==="heading"&&H.depth===X){if(U&&J.length>0){let D=this.extractSubsections(J,X+1),V=this.buildDataFromSections(D,Y,X+1);W.push(V)}J=[],U=!0}else if(U)J.push(H);if(U&&J.length>0){let H=this.extractSubsections(J,X+1),D=this.buildDataFromSections(H,Y,X+1);W.push(D)}return W}extractTextFromListItem($){let X=[];for(let Y of $.children)if(Y.type==="paragraph"){let W=this.extractTextFromParagraph(Y);if(W)X.push(W)}return X.join(`
169
- `)}}var wE=A(()=>{s5();HV()});var ZE=A(()=>{AW()});class MW{format($){return $.message}parse($){return{message:$.trim()}}}var zE=A(()=>{AW()});var OE=A(()=>{XY();VE();QE();FE();wE();ZE();zE()});var wM$;var NE=A(()=>{s5();wM$=Z.object({slug:Z.string(),title:Z.string(),type:Z.string(),entityId:Z.string(),contentHash:Z.string()})});var AE=A(()=>{OE();NE()});var BE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";import{webcrypto as ME}from"crypto";function Re($){if(!_9||_9.length<$)_9=Buffer.allocUnsafe($*je),ME.getRandomValues(_9),t5=0;else if(t5+$>_9.length)ME.getRandomValues(_9),t5=0;t5+=$}function jE($=21){Re($|=0);let X="";for(let Y=t5-$;Y<t5;Y++)X+=BE[_9[Y]&63];return X}var je=128,_9,t5;var RE=()=>{};function W1($=12){return jE($)}var LE=A(()=>{RE()});function _V($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function TV($){if(Le.has($.toLowerCase()))return $;if($.endsWith("y")&&$.length>1){let X=$[$.length-2];if(!"aeiou".includes(X?.toLowerCase()??""))return $.slice(0,-1)+"ies"}if($.endsWith("s")||$.endsWith("x")||$.endsWith("ch"))return $+"es";return $+"s"}var Le;var CV=A(()=>{Le=new Set(["series","species","sheep","deer","fish"])});class i8{static instance=null;entityDisplay;constructor(){}static getInstance(){return i8.instance??=new i8,i8.instance}configure($){this.entityDisplay=$}static resetInstance(){i8.instance=null}hasRoute($){return this.entityDisplay?.[$]!==void 0}generateUrl($,X){let Y=this.entityDisplay?.[$];if(Y)return`/${Y.pluralName??Y.label.toLowerCase()+"s"}/${X}`;return`/${TV($)}/${X}`}}var EE=A(()=>{CV()});var PE=()=>{};function g6($){return $ instanceof Error?$.message:String($)}function T0($){return $ instanceof Error?$:Error(String($))}var IE=()=>{};var Ee;var _E=A(()=>{P5();Ee=Z.object({success:Z.boolean(),entityId:Z.string().optional(),error:Z.string().optional()})});var TE=()=>{};var CE=()=>{};var SE=()=>{};var bE=()=>{};var R$=A(()=>{FN();MH();MH();NL();DE();LE();CV();EE();BW();s5();PE();IE();_E();TE();CE();SE();bE();AE()});var be,kE;var vE=A(()=>{R$();be=Z.object({status:Z.enum(["healthy","warning","error","unknown"]),message:Z.string().optional(),lastCheck:Z.date().optional(),details:Z.record(Z.string(),Z.unknown()).optional()}),kE=Z.object({name:Z.string(),pluginId:Z.string(),status:Z.string(),health:be.optional()})});class X0{anchors;trusted;rules;constructor($){this.anchors=new Set($.anchors??[]),this.trusted=new Set($.trusted??[]),this.rules=$.rules??[]}determineUserLevel($,X){let Y=`${$}:${X}`;if(this.anchors.has(Y))return"anchor";if(this.trusted.has(Y))return"trusted";for(let W of this.rules)if(this.matchesPattern(Y,W.pattern))return W.level;return"public"}hasPermission($,X){return X0.hasPermission($,X)}filterByPermission($,X){return $.filter((Y)=>{let W=Y.visibility??"public";return this.hasPermission(X,W)})}static hasPermission($,X){if(X==="public")return!0;if(X==="trusted")return $==="trusted"||$==="anchor";return $==="anchor"}matchesPattern($,X){let W="^"+X.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(W).test($)}}var SV;var bV=A(()=>{R$();SV=Z.enum(["anchor","trusted","public"])});var xe;var hE=A(()=>{R$();bV();xe=Z.object({name:Z.string(),description:Z.string(),schema:Z.any(),basePrompt:Z.string().optional(),useKnowledgeContext:Z.boolean().optional(),requiredPermission:SV,formatter:Z.any().optional(),layout:Z.object({component:Z.any(),fullscreen:Z.boolean().optional()}).optional(),dataSourceId:Z.string().optional()})});class r8{static canGenerate($){return!!$.basePrompt&&!!$.dataSourceId&&$.dataSourceId.includes("ai-content")}static canFetch($){return!!$.dataSourceId&&!this.canGenerate($)}static canRender($){return!!$.layout?.component}static isStaticOnly($){return!this.canGenerate($)&&!this.canFetch($)}static getCapabilities($){return{canGenerate:this.canGenerate($),canFetch:this.canFetch($),canRender:this.canRender($),isStaticOnly:this.isStaticOnly($)}}static validate($){let X=[];if($.dataSourceId?.includes("ai-content")&&!$.basePrompt)X.push(`Template "${$.name}" has AI-content dataSourceId but no basePrompt. AI generation requires a basePrompt.`);if($.basePrompt&&(!$.dataSourceId||!$.dataSourceId.includes("ai-content")))X.push(`Template "${$.name}" has basePrompt but no AI-content dataSourceId. The basePrompt won't be used.`);return X}static logCapabilities($,X){let Y=this.getCapabilities($),W=this.validate($);if(X)X.debug(`Template capabilities for "${$.name}":`,{...Y,errors:W.length>0?W:void 0})}}class Y0{static instance=null;templates=new Map;logger;static getInstance($){if(!Y0.instance)Y0.instance=new Y0($);return Y0.instance}static resetInstance(){Y0.instance=null}static createFresh($){return new Y0($)}constructor($){this.logger=$}register($,X){this.templates.set($,X);let Y=r8.validate(X);if(Y.length>0)Y.forEach((W)=>{this.logger?.error(`Template configuration error: ${W}`)});r8.logCapabilities(X,this.logger),this.logger?.debug(`Registered template: ${$}`)}get($){return this.templates.get($)}getAll(){return new Map(this.templates)}has($){return this.templates.has($)}getNames(){return Array.from(this.templates.keys())}list(){return Array.from(this.templates.values())}unregister($){let X=this.templates.has($);if(X)this.templates.delete($),this.logger?.debug(`Unregistered template: ${$}`);return X}clear(){let $=this.templates.size;this.templates.clear(),this.logger?.debug(`Cleared ${$} templates from registry`)}size(){return this.templates.size}getPluginTemplates($){let X=`${$}:`;return Array.from(this.templates.entries()).filter(([Y])=>Y.startsWith(X)).map(([,Y])=>Y)}getPluginTemplateNames($){let X=`${$}:`;return Array.from(this.templates.keys()).filter((Y)=>Y.startsWith(X))}}var yE=()=>{};class C0{static instance=null;templateRegistry;static getInstance($){return C0.instance??=new C0($),C0.instance}static resetInstance(){C0.instance=null}static createFresh($){return new C0($)}constructor($){this.templateRegistry=$}get($){let X=this.templateRegistry.get($);if(!X?.layout?.component)return;let Y=$.split(":"),W=Y.length>=2&&Y[0]?Y[0]:"shell",J={name:$,schema:X.schema,description:X.description,pluginId:W,renderers:{web:X.layout.component}};if(X.layout.fullscreen)J.fullscreen=X.layout.fullscreen;if(X.runtimeScripts&&X.runtimeScripts.length>0)J.runtimeScripts=X.runtimeScripts;return J}list(){return this.templateRegistry.getNames().map(($)=>this.get($)).filter(($)=>$!==void 0)}validate($,X){let Y=this.templateRegistry.get($);if(!Y?.layout?.component)return!1;try{return Y.schema.parse(X),!0}catch{return!1}}findViewTemplate($){return this.list().find((Y)=>{if($.name&&Y.name!==$.name)return!1;if($.pluginId&&Y.pluginId!==$.pluginId)return!1;if($.namePattern){if(!new RegExp($.namePattern).test(Y.name))return!1}return!0})}getRenderer($,X){let Y=this.get($);if(!Y)return;return Y.renderers[X]}hasRenderer($,X){return this.getRenderer($,X)!==void 0}listFormats($){let X=this.get($);if(!X)return[];let Y=[];if(X.renderers.web)Y.push("web");return Y}}var ke,ve,he,ye;var fE=A(()=>{R$();ke=Z.enum(["site-content-preview","site-content-production"]),ve=Z.object({name:Z.string(),schema:Z.any(),description:Z.string().optional(),pluginId:Z.string(),renderers:Z.object({web:Z.union([Z.function(),Z.string()]).optional()})}),he=Z.object({enableContentGeneration:Z.boolean().default(!1),outputDir:Z.string(),workingDir:Z.string().optional(),environment:Z.enum(["preview","production"]).default("preview"),siteConfig:Z.object({title:Z.string(),description:Z.string(),url:Z.string().optional()}).optional()}),ye=Z.object({success:Z.boolean(),routesBuilt:Z.number(),errors:Z.array(Z.string()).optional(),warnings:Z.array(Z.string()).optional()})});var e5=A(()=>{hE();yE();bV();fE()});import{McpServer as gE}from"@modelcontextprotocol/sdk/server/mcp.js";import{ResourceTemplate as ge}from"@modelcontextprotocol/sdk/server/mcp.js";class S0{static instance=null;mcpServer;logger;messageBus;registeredTools=new Map;registeredResources=new Map;registeredTemplates=[];registeredPrompts=[];pluginInstructions=new Map;permissionLevel="anchor";static getInstance($,X){return S0.instance??=new S0($,X),S0.instance}static resetInstance(){S0.instance=null}static createFresh($,X){return new S0($,X)}constructor($,X){this.messageBus=$,this.logger=X.child("MCPService"),this.mcpServer=new gE({name:"brain-mcp",version:"1.0.0"}),this.logger.debug("MCPService initialized")}getMcpServer(){return this.mcpServer}createMcpServer($){let X=$??this.permissionLevel,Y=new gE({name:"brain-mcp",version:"1.0.0"});for(let[,{pluginId:W,tool:J}]of this.registeredTools){let U=J.visibility??"anchor";if(!X0.hasPermission(X,U))continue;this.registerToolOnServer(Y,W,J)}for(let[,{pluginId:W,resource:J}]of this.registeredResources)this.registerResourceOnServer(Y,W,J);for(let{template:W}of this.registeredTemplates)this.registerResourceTemplateOnServer(Y,W);for(let{prompt:W}of this.registeredPrompts)this.registerPromptOnServer(Y,W);return Y}serializeResponse($){if("success"in $&&!$.success)throw Error($.error??"Operation failed");return JSON.stringify("data"in $?$.data:$,null,2)}setPermissionLevel($){this.permissionLevel=$,this.logger.debug(`Permission level set to ${$}`)}registerTool($,X){this.registeredTools.set(X.name,{pluginId:$,tool:X});let Y=X.visibility??"anchor";if(X0.hasPermission(this.permissionLevel,Y))this.registerToolOnServer(this.mcpServer,$,X);this.logger.debug(`Registered tool ${X.name} from ${$}`)}registerResource($,X){this.registeredResources.set(X.uri,{pluginId:$,resource:X});let Y="anchor";if(X0.hasPermission(this.permissionLevel,Y))this.registerResourceOnServer(this.mcpServer,$,X);this.logger.debug(`Registered resource ${X.uri} from ${$}`)}registerPromptOnServer($,X){let Y=Object.fromEntries(Object.entries(X.args).map(([W,J])=>[W,J.required?Z.string().describe(J.description):Z.string().optional().describe(J.description)]));$.prompt(X.name,X.description??"Prompt",Y,async(W)=>X.handler(W))}registerToolOnServer($,X,Y){$.tool(Y.name,Y.description,Y.inputSchema,async(W,J)=>{let U=J._meta?.interfaceType??"mcp",H=J._meta?.userId??"mcp-user",D=J._meta?.channelId,V=J._meta?.progressToken;this.logger.debug("MCP client metadata",{tool:Y.name,pluginId:X,interfaceType:U,userId:H,channelId:D,progressToken:V});try{let K=await this.messageBus.send(`plugin:${X}:tool:execute`,{toolName:Y.name,args:W,progressToken:V,hasProgress:V!==void 0,interfaceType:U,userId:H,channelId:D},"MCPService");return{content:[{type:"text",text:this.serializeResponse(K)}]}}catch(K){throw this.logger.error(`Tool execution error for ${Y.name}`,K),K}})}registerResourceOnServer($,X,Y){$.resource(Y.name,Y.uri,{description:Y.description,mimeType:Y.mimeType},async()=>Y.handler())}registerResourceTemplate($,X){this.registerResourceTemplateOnServer(this.mcpServer,X),this.registeredTemplates.push({pluginId:$,template:X}),this.logger.debug(`Registered resource template ${X.uriTemplate} from ${$}`)}registerResourceTemplateOnServer($,X){let Y=X.list,W=new ge(X.uriTemplate,{list:Y?async()=>({resources:(await Y()).map((J)=>({uri:J.uri,name:J.name}))}):void 0,...X.complete&&{complete:Object.fromEntries(Object.entries(X.complete).map(([J,U])=>[J,(H)=>U(H)]))}});$.registerResource(X.name,W,{description:X.description,mimeType:X.mimeType},async(J,U)=>{let H={};for(let[D,V]of Object.entries(U))H[D]=Array.isArray(V)?V[0]??"":V;return X.handler(H)})}registerPrompt($,X){this.registerPromptOnServer(this.mcpServer,X),this.registeredPrompts.push({pluginId:$,prompt:X}),this.logger.debug(`Registered prompt ${X.name} from ${$}`)}listTools(){return Array.from(this.registeredTools.values())}getCliTools(){return this.listTools().filter(({tool:$})=>$.cli!==void 0)}listToolsForPermissionLevel($){return this.listTools().filter(({tool:Y})=>{let W=Y.visibility??"anchor";return X0.hasPermission($,W)})}listResources(){return Array.from(this.registeredResources.values())}registerInstructions($,X){this.pluginInstructions.set($,X),this.logger.debug(`Registered instructions from plugin: ${$}`)}getInstructions(){return Array.from(this.pluginInstructions.values())}}var mE=A(()=>{e5();R$()});var jW,RW,uE,LW,JY;var pE=A(()=>{R$();jW=Z.object({interfaceType:Z.string(),userId:Z.string(),channelId:Z.string().optional(),channelName:Z.string().optional()}),RW=Z.object({success:Z.literal(!0),data:Z.unknown(),message:Z.string().optional()}),uE=Z.object({success:Z.literal(!1),error:Z.string(),code:Z.string().optional()}),LW=Z.object({needsConfirmation:Z.literal(!0),toolName:Z.string(),description:Z.string(),args:Z.unknown()}),JY=Z.union([RW,uE,LW])});function S1($,X,Y,W,J,U={}){let{visibility:H="anchor",debug:D=!1,cli:V}=U,K=D?Z6.createFresh({context:$}):null;return{name:`${$}_${X}`,description:Y,inputSchema:W.shape,handler:async(Q,q)=>{K?.debug(`Tool ${X} started`);try{let F=W.safeParse(Q);if(!F.success){let z=F.error.errors.map((O)=>`${O.path.join(".")}: ${O.message}`).join(", ");return K?.debug(`Tool ${X} validation failed: ${z}`),{success:!1,error:`Invalid input: ${z}`}}let w=await J(F.data,q);return K?.debug(`Tool ${X} completed`),w}catch(F){return K?.error(`Tool ${X} failed`,F),{success:!1,error:g6(F)}}},visibility:H,...V?{cli:V}:{}}}var cE;var dE=A(()=>{R$();cE=Z.union([Z.object({success:Z.literal(!0),data:Z.unknown(),message:Z.string().optional()}),Z.object({success:Z.literal(!1),error:Z.string(),code:Z.string().optional()})])});var lE=A(()=>{R$()});var $X=A(()=>{mE();pE();dE();lE()});var tR$,eR$,EW,ce,$L$,XL$,WY;var xV=A(()=>{R$();R$();vE();$X();tR$=Z.object({id:Z.string(),type:Z.string(),version:Z.string(),status:Z.string()}),eR$=Z.object({name:Z.string(),description:Z.string()}),EW=Z.object({label:Z.string(),url:Z.string(),pluginId:Z.string(),priority:Z.number().default(100)}),ce=Z.object({model:Z.string(),version:Z.string(),uptime:Z.number(),entities:Z.number(),embeddings:Z.number(),ai:Z.object({model:Z.string(),embeddingModel:Z.string()}),daemons:Z.array(kE),endpoints:Z.array(EW)}),$L$=Z.object({pluginId:Z.string(),tool:Z.object({name:Z.string(),description:Z.string(),inputSchema:Z.record(Z.string(),Z.unknown()),handler:Z.function(),visibility:Z.enum(["public","trusted","anchor"]).optional()}),timestamp:Z.number()}),XL$=Z.object({pluginId:Z.string(),resource:Z.object({uri:Z.string(),name:Z.string(),description:Z.string().optional(),mimeType:Z.string().optional(),handler:Z.function()}),timestamp:Z.number()}),WY=Z.object({id:Z.string(),version:Z.string(),type:Z.enum(["core","entity","service","interface"]),description:Z.string().optional(),dependencies:Z.array(Z.string()).optional(),packageName:Z.string()})});var HL$,DL$;var PW=A(()=>{xV();R$();R$();HL$=Z.object({toolName:Z.string(),args:Z.unknown(),progressToken:Z.union([Z.string(),Z.number()]).optional(),hasProgress:Z.boolean().optional(),...jW.shape}),DL$=Z.object({resourceUri:Z.string()})});var QL$;var kV=A(()=>{R$();QL$=Z.object({name:Z.string(),schema:Z.custom(($)=>$ instanceof Z.ZodType)})});function J$($,X){if(!$||typeof $!=="object")return!1;if($ instanceof X)return!0;if(!Object.prototype.hasOwnProperty.call(X,r))throw Error(`Class "${X.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let Y=Object.getPrototypeOf($).constructor;if(Y)while(Y){if(r in Y&&Y[r]===X[r])return!0;Y=Object.getPrototypeOf(Y)}return!1}var r;var r$=A(()=>{r=Symbol.for("drizzle:entityKind")});var C6;var J0=A(()=>{r$();C6=class C6{constructor($,X){this.table=$,this.config=X,this.name=X.name,this.keyAsName=X.keyAsName,this.notNull=X.notNull,this.default=X.default,this.defaultFn=X.defaultFn,this.onUpdateFn=X.onUpdateFn,this.hasDefault=X.hasDefault,this.primary=X.primaryKey,this.isUnique=X.isUnique,this.uniqueName=X.uniqueName,this.uniqueType=X.uniqueType,this.dataType=X.dataType,this.columnType=X.columnType,this.generated=X.generated,this.generatedIdentity=X.generatedIdentity}static[r]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue($){return $}mapToDriverValue($){return $}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}});var vV;var hV=A(()=>{r$();vV=class vV{static[r]="ColumnBuilder";config;constructor($,X,Y){this.config={name:$,keyAsName:$==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:X,columnType:Y,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default($){return this.config.default=$,this.config.hasDefault=!0,this}$defaultFn($){return this.config.defaultFn=$,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn($){return this.config.onUpdateFn=$,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName($){if(this.config.name!=="")return;this.config.name=$}}});var O1;var UY=A(()=>{O1=Symbol.for("drizzle:Name")});function iE($,...X){return $(...X)}var rE=()=>{};function nE($,X){return`${$[O1]}_${X.join("_")}_unique`}var oE=A(()=>{UY()});var GY,de;var aE=A(()=>{J0();r$();oE();GY=class GY extends C6{constructor($,X){if(!X.uniqueName)X.uniqueName=nE($,[X.name]);super($,X);this.table=$}static[r]="PgColumn"};de=class de extends GY{static[r]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op($){return this.indexConfig.opClass=$,this}}});function tE($){return!!$&&typeof $==="function"&&sE in $&&$[sE]===!0}var le,sE,ie;var eE=A(()=>{r$();aE();le=class le extends GY{static[r]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor($,X){super($,X);this.enum=X.enum}getSQLType(){return this.enum.enumName}};sE=Symbol.for("drizzle:isPgEnum");ie=class ie extends GY{static[r]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor($,X){super($,X);this.enum=X.enum}getSQLType(){return this.enum.enumName}}});var H4,HY;var W0=A(()=>{r$();H4=class H4{static[r]="Subquery";constructor($,X,Y,W=!1,J=[]){this._={brand:"Subquery",sql:$,selectedFields:X,alias:Y,isWith:W,usedTables:J}}};HY=class HY extends H4{static[r]="WithSubquery"}});var $P="0.44.7";var XP=()=>{};var yV,fV,YP;var JP=A(()=>{rE();XP();YP={startActiveSpan($,X){if(!yV)return X();if(!fV)fV=yV.trace.getTracer("drizzle-orm",$P);return iE((Y,W)=>W.startActiveSpan($,(J)=>{try{return X(J)}catch(U){throw J.setStatus({code:Y.SpanStatusCode.ERROR,message:U instanceof Error?U.message:"Unknown error"}),U}finally{J.end()}}),yV,fV)}}});var n6;var H8=A(()=>{n6=Symbol.for("drizzle:ViewBaseConfig")});function n8($){return $[O1]}function T9($){return`${$[IW]??"public"}.${$[O1]}`}var IW,_W,WP,gV,mV,DY,UP,re,N$;var m4=A(()=>{r$();UY();IW=Symbol.for("drizzle:Schema"),_W=Symbol.for("drizzle:Columns"),WP=Symbol.for("drizzle:ExtraConfigColumns"),gV=Symbol.for("drizzle:OriginalName"),mV=Symbol.for("drizzle:BaseName"),DY=Symbol.for("drizzle:IsAlias"),UP=Symbol.for("drizzle:ExtraConfigBuilder"),re=Symbol.for("drizzle:IsDrizzleTable");N$=class N${static[r]="Table";static Symbol={Name:O1,Schema:IW,OriginalName:gV,Columns:_W,ExtraConfigColumns:WP,BaseName:mV,IsAlias:DY,ExtraConfigBuilder:UP};[O1];[gV];[IW];[_W];[WP];[mV];[DY]=!1;[re]=!0;[UP]=void 0;constructor($,X,Y){this[O1]=this[gV]=$,this[IW]=X,this[mV]=Y}}});function uV($){return $!==null&&$!==void 0&&typeof $.getSQL==="function"}function ne($){let X={sql:"",params:[]};for(let Y of $)if(X.sql+=Y.sql,X.params.push(...Y.params),Y.typings?.length){if(!X.typings)X.typings=[];X.typings.push(...Y.typings)}return X}function GP($){return typeof $==="object"&&$!==null&&"mapToDriverValue"in $&&typeof $.mapToDriverValue==="function"}function S($,...X){let Y=[];if(X.length>0||$.length>0&&$[0]!=="")Y.push(new z4($[0]));for(let[W,J]of X.entries())Y.push(J,new z4($[W+1]));return new b$(Y)}function VY($,X){return $.map((Y)=>{if(J$(Y,o8)){if(!(Y.name in X))throw Error(`No value for placeholder "${Y.name}" was provided`);return X[Y.name]}if(J$(Y,N1)&&J$(Y.value,o8)){if(!(Y.value.name in X))throw Error(`No value for placeholder "${Y.value.name}" was provided`);return Y.encoder.mapToDriverValue(X[Y.value.name])}return Y})}var z4,b$,TW,HP,DP,rL$,N1,o8,oe,b1;var R4=A(()=>{r$();eE();W0();JP();H8();J0();m4();z4=class z4{static[r]="StringChunk";value;constructor($){this.value=Array.isArray($)?$:[$]}getSQL(){return new b$([this])}};b$=class b${constructor($){this.queryChunks=$;for(let X of $)if(J$(X,N$)){let Y=X[N$.Symbol.Schema];this.usedTables.push(Y===void 0?X[N$.Symbol.Name]:Y+"."+X[N$.Symbol.Name])}}static[r]="SQL";decoder=HP;shouldInlineParams=!1;usedTables=[];append($){return this.queryChunks.push(...$.queryChunks),this}toQuery($){return YP.startActiveSpan("drizzle.buildSQL",(X)=>{let Y=this.buildQueryFromSourceParams(this.queryChunks,$);return X?.setAttributes({"drizzle.query.text":Y.sql,"drizzle.query.params":JSON.stringify(Y.params)}),Y})}buildQueryFromSourceParams($,X){let Y=Object.assign({},X,{inlineParams:X.inlineParams||this.shouldInlineParams,paramStartIndex:X.paramStartIndex||{value:0}}),{casing:W,escapeName:J,escapeParam:U,prepareTyping:H,inlineParams:D,paramStartIndex:V}=Y;return ne($.map((K)=>{if(J$(K,z4))return{sql:K.value.join(""),params:[]};if(J$(K,TW))return{sql:J(K.value),params:[]};if(K===void 0)return{sql:"",params:[]};if(Array.isArray(K)){let Q=[new z4("(")];for(let[q,F]of K.entries())if(Q.push(F),q<K.length-1)Q.push(new z4(", "));return Q.push(new z4(")")),this.buildQueryFromSourceParams(Q,Y)}if(J$(K,b$))return this.buildQueryFromSourceParams(K.queryChunks,{...Y,inlineParams:D||K.shouldInlineParams});if(J$(K,N$)){let Q=K[N$.Symbol.Schema],q=K[N$.Symbol.Name];return{sql:Q===void 0||K[DY]?J(q):J(Q)+"."+J(q),params:[]}}if(J$(K,C6)){let Q=W.getColumnCasing(K);if(X.invokeSource==="indexes")return{sql:J(Q),params:[]};let q=K.table[N$.Symbol.Schema];return{sql:K.table[DY]||q===void 0?J(K.table[N$.Symbol.Name])+"."+J(Q):J(q)+"."+J(K.table[N$.Symbol.Name])+"."+J(Q),params:[]}}if(J$(K,b1)){let Q=K[n6].schema,q=K[n6].name;return{sql:Q===void 0||K[n6].isAlias?J(q):J(Q)+"."+J(q),params:[]}}if(J$(K,N1)){if(J$(K.value,o8))return{sql:U(V.value++,K),params:[K],typings:["none"]};let Q=K.value===null?null:K.encoder.mapToDriverValue(K.value);if(J$(Q,b$))return this.buildQueryFromSourceParams([Q],Y);if(D)return{sql:this.mapInlineParam(Q,Y),params:[]};let q=["none"];if(H)q=[H(K.encoder)];return{sql:U(V.value++,Q),params:[Q],typings:q}}if(J$(K,o8))return{sql:U(V.value++,K),params:[K],typings:["none"]};if(J$(K,b$.Aliased)&&K.fieldAlias!==void 0)return{sql:J(K.fieldAlias),params:[]};if(J$(K,H4)){if(K._.isWith)return{sql:J(K._.alias),params:[]};return this.buildQueryFromSourceParams([new z4("("),K._.sql,new z4(") "),new TW(K._.alias)],Y)}if(tE(K)){if(K.schema)return{sql:J(K.schema)+"."+J(K.enumName),params:[]};return{sql:J(K.enumName),params:[]}}if(uV(K)){if(K.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([K.getSQL()],Y);return this.buildQueryFromSourceParams([new z4("("),K.getSQL(),new z4(")")],Y)}if(D)return{sql:this.mapInlineParam(K,Y),params:[]};return{sql:U(V.value++,K),params:[K],typings:["none"]}}))}mapInlineParam($,{escapeString:X}){if($===null)return"null";if(typeof $==="number"||typeof $==="boolean")return $.toString();if(typeof $==="string")return X($);if(typeof $==="object"){let Y=$.toString();if(Y==="[object Object]")return X(JSON.stringify($));return X(Y)}throw Error("Unexpected param value: "+$)}getSQL(){return this}as($){if($===void 0)return this;return new b$.Aliased(this,$)}mapWith($){return this.decoder=typeof $==="function"?{mapFromDriverValue:$}:$,this}inlineParams(){return this.shouldInlineParams=!0,this}if($){return $?this:void 0}};TW=class TW{constructor($){this.value=$}static[r]="Name";brand;getSQL(){return new b$([this])}};HP={mapFromDriverValue:($)=>$},DP={mapToDriverValue:($)=>$},rL$={...HP,...DP};N1=class N1{constructor($,X=DP){this.value=$,this.encoder=X}static[r]="Param";brand;getSQL(){return new b$([this])}};(($)=>{function X(){return new b$([])}$.empty=X;function Y(V){return new b$(V)}$.fromList=Y;function W(V){return new b$([new z4(V)])}$.raw=W;function J(V,K){let Q=[];for(let[q,F]of V.entries()){if(q>0&&K!==void 0)Q.push(K);Q.push(F)}return new b$(Q)}$.join=J;function U(V){return new TW(V)}$.identifier=U;function H(V){return new o8(V)}$.placeholder=H;function D(V,K){return new N1(V,K)}$.param=D})(S||(S={}));(($)=>{class X{constructor(Y,W){this.sql=Y,this.fieldAlias=W}static[r]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new X(this.sql,this.fieldAlias)}}$.Aliased=X})(b$||(b$={}));o8=class o8{constructor($){this.name=$}static[r]="Placeholder";getSQL(){return new b$([this])}};oe=Symbol.for("drizzle:IsDrizzleView");b1=class b1{static[r]="View";[n6];[oe]=!0;constructor({name:$,schema:X,selectedFields:Y,query:W}){this[n6]={name:$,originalName:$,schema:X,selectedFields:Y,query:W,isExisting:!W,isAlias:!1}}getSQL(){return new b$([this])}};C6.prototype.getSQL=function(){return new b$([this])};N$.prototype.getSQL=function(){return new b$([this])};H4.prototype.getSQL=function(){return new b$([this])}});function CW($,X){return new Proxy($,new KY(X,!1))}function b0($,X){return new Proxy($,new XX(new Proxy($.table,new KY(X,!1))))}function pV($,X){return new b$.Aliased(QY($.sql,X),$.fieldAlias)}function QY($,X){return S.join($.queryChunks.map((Y)=>{if(J$(Y,C6))return b0(Y,X);if(J$(Y,b$))return QY(Y,X);if(J$(Y,b$.Aliased))return pV(Y,X);return Y}))}var XX,KY;var SW=A(()=>{J0();r$();R4();m4();H8();XX=class XX{constructor($){this.table=$}static[r]="ColumnAliasProxyHandler";get($,X){if(X==="table")return this.table;return $[X]}};KY=class KY{constructor($,X){this.alias=$,this.replaceOriginalName=X}static[r]="TableAliasProxyHandler";get($,X){if(X===N$.Symbol.IsAlias)return!0;if(X===N$.Symbol.Name)return this.alias;if(this.replaceOriginalName&&X===N$.Symbol.OriginalName)return this.alias;if(X===n6)return{...$[n6],name:this.alias,isAlias:!0};if(X===N$.Symbol.Columns){let W=$[N$.Symbol.Columns];if(!W)return W;let J={};return Object.keys(W).map((U)=>{J[U]=new Proxy(W[U],new XX(new Proxy($,this)))}),J}let Y=$[X];if(J$(Y,C6))return new Proxy(Y,new XX(new Proxy($,this)));return Y}}});var YX,D8,cV;var bW=A(()=>{r$();YX=class YX extends Error{static[r]="DrizzleError";constructor({message:$,cause:X}){super($);this.name="DrizzleError",this.cause=X}};D8=class D8 extends Error{constructor($,X,Y){super(`Failed query: ${$}
170
- params: ${X}`);if(this.query=$,this.params=X,this.cause=Y,Error.captureStackTrace(this,D8),Y)this.cause=Y}};cV=class cV extends YX{static[r]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}});var VP,dV,lV;var xW=A(()=>{r$();VP=class VP{static[r]="ConsoleLogWriter";write($){console.log($)}};dV=class dV{static[r]="DefaultLogger";writer;constructor($){this.writer=$?.writer??new VP}logQuery($,X){let Y=X.map((J)=>{try{return JSON.stringify(J)}catch{return String(J)}}),W=Y.length?` -- params: [${Y.join(", ")}]`:"";this.writer.write(`Query: ${$}${W}`)}};lV=class lV{static[r]="NoopLogger";logQuery(){}}});var o4;var V8=A(()=>{r$();o4=class o4{static[r]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch($){return this.then(void 0,$)}finally($){return this.then((X)=>{return $?.(),X},(X)=>{throw $?.(),X})}then($,X){return this.execute().then($,X)}}});function iV($,X,Y){let W={},J=$.reduce((U,{path:H,field:D},V)=>{let K;if(J$(D,C6))K=D;else if(J$(D,b$))K=D.decoder;else K=D.sql.decoder;let Q=U;for(let[q,F]of H.entries())if(q<H.length-1){if(!(F in Q))Q[F]={};Q=Q[F]}else{let w=X[V],z=Q[F]=w===null?null:K.mapFromDriverValue(w);if(Y&&J$(D,C6)&&H.length===2){let O=H[0];if(!(O in W))W[O]=z===null?n8(D.table):!1;else if(typeof W[O]==="string"&&W[O]!==n8(D.table))W[O]=!1}}return U},{});if(Y&&Object.keys(W).length>0){for(let[U,H]of Object.entries(W))if(typeof H==="string"&&!Y[H])J[U]=null}return J}function x1($,X){return Object.entries($).reduce((Y,[W,J])=>{if(typeof W!=="string")return Y;let U=X?[...X,W]:[W];if(J$(J,C6)||J$(J,b$)||J$(J,b$.Aliased))Y.push({path:U,field:J});else if(J$(J,N$))Y.push(...x1(J[N$.Symbol.Columns],U));else Y.push(...x1(J,U));return Y},[])}function FY($,X){let Y=Object.keys($),W=Object.keys(X);if(Y.length!==W.length)return!1;for(let[J,U]of Y.entries())if(U!==W[J])return!1;return!0}function kW($,X){let Y=Object.entries(X).filter(([,W])=>W!==void 0).map(([W,J])=>{if(J$(J,b$)||J$(J,C6))return[W,J];else return[W,new N1(J,$[N$.Symbol.Columns][W])]});if(Y.length===0)throw Error("No values to set");return Object.fromEntries(Y)}function KP($,X){for(let Y of X)for(let W of Object.getOwnPropertyNames(Y.prototype)){if(W==="constructor")continue;Object.defineProperty($.prototype,W,Object.getOwnPropertyDescriptor(Y.prototype,W)||Object.create(null))}}function QP($){return $[N$.Symbol.Columns]}function qY($){return J$($,H4)?$._.alias:J$($,b1)?$[n6].name:J$($,b$)?void 0:$[N$.Symbol.IsAlias]?$[N$.Symbol.Name]:$[N$.Symbol.BaseName]}function x0($,X){return{name:typeof $==="string"&&$.length>0?$:"",config:typeof $==="object"?$:X}}function FP($){if(typeof $!=="object"||$===null)return!1;if($.constructor.name!=="Object")return!1;if("logger"in $){let X=typeof $.logger;if(X!=="boolean"&&(X!=="object"||typeof $.logger.logQuery!=="function")&&X!=="undefined")return!1;return!0}if("schema"in $){let X=typeof $.schema;if(X!=="object"&&X!=="undefined")return!1;return!0}if("casing"in $){let X=typeof $.casing;if(X!=="string"&&X!=="undefined")return!1;return!0}if("mode"in $){if($.mode!=="default"||$.mode!=="planetscale"||$.mode!==void 0)return!1;return!0}if("connection"in $){let X=typeof $.connection;if(X!=="string"&&X!=="object"&&X!=="undefined")return!1;return!0}if("client"in $){let X=typeof $.client;if(X!=="object"&&X!=="function"&&X!=="undefined")return!1;return!0}if(Object.keys($).length===0)return!0;return!1}var rV;var U1=A(()=>{J0();r$();R4();W0();m4();H8();rV=typeof TextDecoder>"u"?null:new TextDecoder});var qP,wP,nV;var ZP=A(()=>{r$();m4();qP=Symbol.for("drizzle:PgInlineForeignKeys"),wP=Symbol.for("drizzle:EnableRLS");nV=class nV extends N${static[r]="PgTable";static Symbol=Object.assign({},N$.Symbol,{InlineForeignKeys:qP,EnableRLS:wP});[qP]=[];[wP]=!1;[N$.Symbol.ExtraConfigBuilder]=void 0;[N$.Symbol.ExtraConfigColumns]={}}});var oV,zP;var OP=A(()=>{r$();ZP();oV=class oV{static[r]="PgPrimaryKeyBuilder";columns;name;constructor($,X){this.columns=$,this.name=X}build($){return new zP($,this.columns,this.name)}};zP=class zP{constructor($,X,Y){this.table=$,this.columns=X,this.name=Y}static[r]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[nV.Symbol.Name]}_${this.columns.map(($)=>$.name).join("_")}_pk`}}});function G1($,X){if(GP(X)&&!uV($)&&!J$($,N1)&&!J$($,o8)&&!J$($,C6)&&!J$($,N$)&&!J$($,b1))return new N1($,X);return $}function Y4(...$){let X=$.filter((Y)=>Y!==void 0);if(X.length===0)return;if(X.length===1)return new b$(X);return new b$([new z4("("),S.join(X,new z4(" and ")),new z4(")")])}function wY(...$){let X=$.filter((Y)=>Y!==void 0);if(X.length===0)return;if(X.length===1)return new b$(X);return new b$([new z4("("),S.join(X,new z4(" or ")),new z4(")")])}function AP($){return S`not ${$}`}function vW($,X){if(Array.isArray(X)){if(X.length===0)return S`false`;return S`${$} in ${X.map((Y)=>G1(Y,$))}`}return S`${$} in ${G1(X,$)}`}function RP($,X){if(Array.isArray(X)){if(X.length===0)return S`true`;return S`${$} not in ${X.map((Y)=>G1(Y,$))}`}return S`${$} not in ${G1(X,$)}`}function LP($){return S`${$} is null`}function JX($){return S`${$} is not null`}function EP($){return S`exists ${$}`}function PP($){return S`not exists ${$}`}function IP($,X,Y){return S`${$} between ${G1(X,$)} and ${G1(Y,$)}`}function _P($,X,Y){return S`${$} not between ${G1(X,$)} and ${G1(Y,$)}`}function TP($,X){return S`${$} like ${X}`}function CP($,X){return S`${$} not like ${X}`}function SP($,X){return S`${$} ilike ${X}`}function bP($,X){return S`${$} not ilike ${X}`}var t$=($,X)=>{return S`${$} = ${G1(X,$)}`},NP=($,X)=>{return S`${$} <> ${G1(X,$)}`},BP=($,X)=>{return S`${$} > ${G1(X,$)}`},MP=($,X)=>{return S`${$} >= ${G1(X,$)}`},jP=($,X)=>{return S`${$} < ${G1(X,$)}`},ZY=($,X)=>{return S`${$} <= ${G1(X,$)}`};var xP=A(()=>{J0();r$();m4();R4()});function k1($){return S`${$} asc`}function A1($){return S`${$} desc`}var kP=A(()=>{R4()});var aV=A(()=>{xP();kP()});function hP(){return{and:Y4,between:IP,eq:t$,exists:EP,gt:BP,gte:MP,ilike:SP,inArray:vW,isNull:LP,isNotNull:JX,like:TP,lt:jP,lte:ZY,ne:NP,not:AP,notBetween:_P,notExists:PP,notLike:CP,notIlike:bP,notInArray:RP,or:wY,sql:S}}function yP(){return{sql:S,asc:k1,desc:A1}}function fP($,X){if(Object.keys($).length===1&&"default"in $&&!J$($.default,N$))$=$.default;let Y={},W={},J={};for(let[U,H]of Object.entries($))if(J$(H,N$)){let D=T9(H),V=W[D];Y[D]=U,J[U]={tsName:U,dbName:H[N$.Symbol.Name],schema:H[N$.Symbol.Schema],columns:H[N$.Symbol.Columns],relations:V?.relations??{},primaryKey:V?.primaryKey??[]};for(let Q of Object.values(H[N$.Symbol.Columns]))if(Q.primary)J[U].primaryKey.push(Q);let K=H[N$.Symbol.ExtraConfigBuilder]?.(H[N$.Symbol.ExtraConfigColumns]);if(K){for(let Q of Object.values(K))if(J$(Q,oV))J[U].primaryKey.push(...Q.columns)}}else if(J$(H,vP)){let D=T9(H.table),V=Y[D],K=H.config(X(H.table)),Q;for(let[q,F]of Object.entries(K))if(V){let w=J[V];if(w.relations[q]=F,Q)w.primaryKey.push(...Q)}else{if(!(D in W))W[D]={relations:{},primaryKey:Q};W[D].relations[q]=F}}return{tables:J,tableNamesMap:Y}}function ae($){return function(Y,W){return new a8($,Y,W,W?.fields.reduce((J,U)=>J&&U.notNull,!0)??!1)}}function se($){return function(Y,W){return new zY($,Y,W)}}function gP($,X,Y){if(J$(Y,a8)&&Y.config)return{fields:Y.config.fields,references:Y.config.references};let W=X[T9(Y.referencedTable)];if(!W)throw Error(`Table "${Y.referencedTable[N$.Symbol.Name]}" not found in schema`);let J=$[W];if(!J)throw Error(`Table "${W}" not found in schema`);let U=Y.sourceTable,H=X[T9(U)];if(!H)throw Error(`Table "${U[N$.Symbol.Name]}" not found in schema`);let D=[];for(let V of Object.values(J.relations))if(Y.relationName&&Y!==V&&V.relationName===Y.relationName||!Y.relationName&&V.referencedTable===Y.sourceTable)D.push(V);if(D.length>1)throw Y.relationName?Error(`There are multiple relations with name "${Y.relationName}" in table "${W}"`):Error(`There are multiple relations between "${W}" and "${Y.sourceTable[N$.Symbol.Name]}". Please specify relation name`);if(D[0]&&J$(D[0],a8)&&D[0].config)return{fields:D[0].config.references,references:D[0].config.fields};throw Error(`There is not enough information to infer relation "${H}.${Y.fieldName}"`)}function mP($){return{one:ae($),many:se($)}}function hW($,X,Y,W,J=(U)=>U){let U={};for(let[H,D]of W.entries())if(D.isJson){let V=X.relations[D.tsKey],K=Y[H],Q=typeof K==="string"?JSON.parse(K):K;U[D.tsKey]=J$(V,a8)?Q&&hW($,$[D.relationTableTsKey],Q,D.selection,J):Q.map((q)=>hW($,$[D.relationTableTsKey],q,D.selection,J))}else{let V=J(Y[H]),K=D.field,Q;if(J$(K,C6))Q=K;else if(J$(K,b$))Q=K.decoder;else Q=K.sql.decoder;U[D.tsKey]=V===null?null:Q.mapFromDriverValue(V)}return U}var sV,vP,a8,zY;var OY=A(()=>{m4();J0();r$();OP();aV();R4();sV=class sV{constructor($,X,Y){this.sourceTable=$,this.referencedTable=X,this.relationName=Y,this.referencedTableName=X[N$.Symbol.Name]}static[r]="Relation";referencedTableName;fieldName};vP=class vP{constructor($,X){this.table=$,this.config=X}static[r]="Relations"};a8=class a8 extends sV{constructor($,X,Y,W){super($,X,Y?.relationName);this.config=Y,this.isNullable=W}static[r]="One";withFieldName($){let X=new a8(this.sourceTable,this.referencedTable,this.config,this.isNullable);return X.fieldName=$,X}};zY=class zY extends sV{constructor($,X,Y){super($,X,Y?.relationName);this.config=Y}static[r]="Many";withFieldName($){let X=new zY(this.sourceTable,this.referencedTable,this.config);return X.fieldName=$,X}}});function uP($){return S`count(${$||S.raw("*")})`.mapWith(Number)}var pP=A(()=>{R4()});var cP=()=>{};var dP=A(()=>{pP();cP()});var tV=A(()=>{aV();dP();R4()});var K8=A(()=>{SW();hV();J0();r$();bW();xW();V8();OY();tV();W0();m4();U1();H8()});var lP=()=>{};var iP=()=>{};var eV,rP;var $K=A(()=>{r$();UY();eV=class eV{static[r]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor($,X){if(this.reference=()=>{let{name:Y,columns:W,foreignColumns:J}=$();return{name:Y,columns:W,foreignTable:J[0].table,foreignColumns:J}},X)this._onUpdate=X.onUpdate,this._onDelete=X.onDelete}onUpdate($){return this._onUpdate=$,this}onDelete($){return this._onDelete=$,this}build($){return new rP($,this)}};rP=class rP{constructor($,X){this.table=$,this.reference=X.reference,this.onUpdate=X._onUpdate,this.onDelete=X._onDelete}static[r]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:$,columns:X,foreignColumns:Y}=this.reference(),W=X.map((H)=>H.name),J=Y.map((H)=>H.name),U=[this.table[O1],...W,Y[0].table[O1],...J];return $??`${U.join("_")}_fk`}}});function nP($,X){return`${$[O1]}_${X.join("_")}_unique`}var XK=A(()=>{UY()});var L4,e6;var s8=A(()=>{hV();J0();r$();$K();XK();L4=class L4 extends vV{static[r]="SQLiteColumnBuilder";foreignKeyConfigs=[];references($,X={}){return this.foreignKeyConfigs.push({ref:$,actions:X}),this}unique($){return this.config.isUnique=!0,this.config.uniqueName=$,this}generatedAlwaysAs($,X){return this.config.generated={as:$,type:"always",mode:X?.mode??"virtual"},this}buildForeignKeys($,X){return this.foreignKeyConfigs.map(({ref:Y,actions:W})=>{return((J,U)=>{let H=new eV(()=>{let D=J();return{columns:[$],foreignColumns:[D]}});if(U.onUpdate)H.onUpdate(U.onUpdate);if(U.onDelete)H.onDelete(U.onDelete);return H.build(X)})(Y,W)})}};e6=class e6 extends C6{constructor($,X){if(!X.uniqueName)X.uniqueName=nP($,[X.name]);super($,X);this.table=$}static[r]="SQLiteColumn"}});function XI($,X){let{name:Y,config:W}=x0($,X);if(W?.mode==="json")return new sP(Y);if(W?.mode==="bigint")return new oP(Y);return new eP(Y)}var oP,aP,sP,tP,eP,$I;var YK=A(()=>{r$();U1();s8();oP=class oP extends L4{static[r]="SQLiteBigIntBuilder";constructor($){super($,"bigint","SQLiteBigInt")}build($){return new aP($,this.config)}};aP=class aP extends e6{static[r]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue($){if(typeof Buffer<"u"&&Buffer.from){let X=Buffer.isBuffer($)?$:$ instanceof ArrayBuffer?Buffer.from($):$.buffer?Buffer.from($.buffer,$.byteOffset,$.byteLength):Buffer.from($);return BigInt(X.toString("utf8"))}return BigInt(rV.decode($))}mapToDriverValue($){return Buffer.from($.toString())}};sP=class sP extends L4{static[r]="SQLiteBlobJsonBuilder";constructor($){super($,"json","SQLiteBlobJson")}build($){return new tP($,this.config)}};tP=class tP extends e6{static[r]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue($){if(typeof Buffer<"u"&&Buffer.from){let X=Buffer.isBuffer($)?$:$ instanceof ArrayBuffer?Buffer.from($):$.buffer?Buffer.from($.buffer,$.byteOffset,$.byteLength):Buffer.from($);return JSON.parse(X.toString("utf8"))}return JSON.parse(rV.decode($))}mapToDriverValue($){return Buffer.from(JSON.stringify($))}};eP=class eP extends L4{static[r]="SQLiteBlobBufferBuilder";constructor($){super($,"buffer","SQLiteBlobBuffer")}build($){return new $I($,this.config)}};$I=class $I extends e6{static[r]="SQLiteBlobBuffer";mapFromDriverValue($){if(Buffer.isBuffer($))return $;return Buffer.from($)}getSQLType(){return"blob"}}});function yW($){return(X,Y)=>{let{name:W,config:J}=x0(X,Y);return new YI(W,J,$)}}var YI,JI;var JK=A(()=>{r$();U1();s8();YI=class YI extends L4{static[r]="SQLiteCustomColumnBuilder";constructor($,X,Y){super($,"custom","SQLiteCustomColumn");this.config.fieldConfig=X,this.config.customTypeParams=Y}build($){return new JI($,this.config)}};JI=class JI extends e6{static[r]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor($,X){super($,X);this.sqlName=X.customTypeParams.dataType(X.fieldConfig),this.mapTo=X.customTypeParams.toDriver,this.mapFrom=X.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue($){return typeof this.mapFrom==="function"?this.mapFrom($):$}mapToDriverValue($){return typeof this.mapTo==="function"?this.mapTo($):$}}});function a4($,X){let{name:Y,config:W}=x0($,X);if(W?.mode==="timestamp"||W?.mode==="timestamp_ms")return new GI(Y,W.mode);if(W?.mode==="boolean")return new DI(Y,W.mode);return new WI(Y)}var fW,gW,WI,UI,GI,HI,DI,VI;var WK=A(()=>{r$();R4();U1();s8();fW=class fW extends L4{static[r]="SQLiteBaseIntegerBuilder";constructor($,X,Y){super($,X,Y);this.config.autoIncrement=!1}primaryKey($){if($?.autoIncrement)this.config.autoIncrement=!0;return this.config.hasDefault=!0,super.primaryKey()}};gW=class gW extends e6{static[r]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}};WI=class WI extends fW{static[r]="SQLiteIntegerBuilder";constructor($){super($,"number","SQLiteInteger")}build($){return new UI($,this.config)}};UI=class UI extends gW{static[r]="SQLiteInteger"};GI=class GI extends fW{static[r]="SQLiteTimestampBuilder";constructor($,X){super($,"date","SQLiteTimestamp");this.config.mode=X}defaultNow(){return this.default(S`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build($){return new HI($,this.config)}};HI=class HI extends gW{static[r]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue($){if(this.config.mode==="timestamp")return new Date($*1000);return new Date($)}mapToDriverValue($){let X=$.getTime();if(this.config.mode==="timestamp")return Math.floor(X/1000);return X}};DI=class DI extends fW{static[r]="SQLiteBooleanBuilder";constructor($,X){super($,"boolean","SQLiteBoolean");this.config.mode=X}build($){return new VI($,this.config)}};VI=class VI extends gW{static[r]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue($){return Number($)===1}mapToDriverValue($){return $?1:0}}});function zI($,X){let{name:Y,config:W}=x0($,X),J=W?.mode;return J==="number"?new FI(Y):J==="bigint"?new wI(Y):new KI(Y)}var KI,QI,FI,qI,wI,ZI;var UK=A(()=>{r$();U1();s8();KI=class KI extends L4{static[r]="SQLiteNumericBuilder";constructor($){super($,"string","SQLiteNumeric")}build($){return new QI($,this.config)}};QI=class QI extends e6{static[r]="SQLiteNumeric";mapFromDriverValue($){if(typeof $==="string")return $;return String($)}getSQLType(){return"numeric"}};FI=class FI extends L4{static[r]="SQLiteNumericNumberBuilder";constructor($){super($,"number","SQLiteNumericNumber")}build($){return new qI($,this.config)}};qI=class qI extends e6{static[r]="SQLiteNumericNumber";mapFromDriverValue($){if(typeof $==="number")return $;return Number($)}mapToDriverValue=String;getSQLType(){return"numeric"}};wI=class wI extends L4{static[r]="SQLiteNumericBigIntBuilder";constructor($){super($,"bigint","SQLiteNumericBigInt")}build($){return new ZI($,this.config)}};ZI=class ZI extends e6{static[r]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}});function AI($){return new OI($??"")}var OI,NI;var GK=A(()=>{r$();s8();OI=class OI extends L4{static[r]="SQLiteRealBuilder";constructor($){super($,"number","SQLiteReal")}build($){return new NI($,this.config)}};NI=class NI extends e6{static[r]="SQLiteReal";getSQLType(){return"real"}}});function W6($,X={}){let{name:Y,config:W}=x0($,X);if(W.mode==="json")return new jI(Y);return new BI(Y,W)}var BI,MI,jI,RI;var HK=A(()=>{r$();U1();s8();BI=class BI extends L4{static[r]="SQLiteTextBuilder";constructor($,X){super($,"string","SQLiteText");this.config.enumValues=X.enum,this.config.length=X.length}build($){return new MI($,this.config)}};MI=class MI extends e6{static[r]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor($,X){super($,X)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}};jI=class jI extends L4{static[r]="SQLiteTextJsonBuilder";constructor($){super($,"json","SQLiteTextJson")}build($){return new RI($,this.config)}};RI=class RI extends e6{static[r]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue($){return JSON.parse($)}mapToDriverValue($){return JSON.stringify($)}}});var DK=A(()=>{YK();s8();JK();WK();UK();GK();HK()});var D4;var WX=A(()=>{SW();J0();r$();R4();W0();H8();D4=class D4{static[r]="SelectionProxyHandler";config;constructor($){this.config={...$}}get($,X){if(X==="_")return{...$._,selectedFields:new Proxy($._.selectedFields,this)};if(X===n6)return{...$[n6],selectedFields:new Proxy($[n6].selectedFields,this)};if(typeof X==="symbol")return $[X];let W=(J$($,H4)?$._.selectedFields:J$($,b1)?$[n6].selectedFields:$)[X];if(J$(W,b$.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!W.isSelectionField)return W.sql;let J=W.clone();return J.isSelectionField=!0,J}if(J$(W,b$)){if(this.config.sqlBehavior==="sql")return W;throw Error(`You tried to reference "${X}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(J$(W,C6)){if(this.config.alias)return new Proxy(W,new XX(new Proxy(W.table,new KY(this.config.alias,this.config.replaceOriginalName??!1))));return W}if(typeof W!=="object"||W===null)return W;return new Proxy(W,new D4(this.config))}}});function LI(){return{blob:XI,customType:yW,integer:a4,numeric:zI,real:AI,text:W6}}var EI=A(()=>{YK();JK();WK();UK();GK();HK()});function te($,X,Y,W,J=$){let U=new V4($,W,J),H=typeof X==="function"?X(LI()):X,D=Object.fromEntries(Object.entries(H).map(([K,Q])=>{let q=Q;q.setName(K);let F=q.build(U);return U[VK].push(...q.buildForeignKeys(F,U)),[K,F]})),V=Object.assign(U,D);if(V[N$.Symbol.Columns]=D,V[N$.Symbol.ExtraConfigColumns]=D,Y)V[V4.Symbol.ExtraConfigBuilder]=Y;return V}var VK,V4,k0=($,X,Y)=>{return te($,X,Y)};var t8=A(()=>{r$();m4();EI();VK=Symbol.for("drizzle:SQLiteInlineForeignKeys");V4=class V4 extends N${static[r]="SQLiteTable";static Symbol=Object.assign({},N$.Symbol,{InlineForeignKeys:VK});[N$.Symbol.Columns];[VK]=[];[N$.Symbol.ExtraConfigBuilder]=void 0}});function U0($){return new PI($,!1)}var PI,II,_I;var TI=A(()=>{r$();PI=class PI{constructor($,X){this.name=$,this.unique=X}static[r]="SQLiteIndexBuilderOn";on(...$){return new II(this.name,$,this.unique)}};II=class II{static[r]="SQLiteIndexBuilder";config;constructor($,X,Y){this.config={name:$,columns:X,unique:Y,where:void 0}}where($){return this.config.where=$,this}build($){return new _I(this.config,$)}};_I=class _I{static[r]="SQLiteIndex";config;constructor($,X){this.config={...$,table:X}}}});function mW(...$){if($[0].columns)return new KK($[0].columns,$[0].name);return new KK($)}var KK,CI;var SI=A(()=>{r$();t8();KK=class KK{static[r]="SQLitePrimaryKeyBuilder";columns;name;constructor($,X){this.columns=$,this.name=X}build($){return new CI($,this.columns,this.name)}};CI=class CI{constructor($,X,Y){this.table=$,this.columns=X,this.name=Y}static[r]="SQLitePrimaryKey";columns;name;getName(){return this.name??`${this.table[V4.Symbol.Name]}_${this.columns.map(($)=>$.name).join("_")}_pk`}}});function G0($){if(J$($,V4))return[`${$[N$.Symbol.BaseName]}`];if(J$($,H4))return $._.usedTables??[];if(J$($,b$))return $.usedTables??[];return[]}var UX=A(()=>{r$();R4();W0();m4();t8()});var uW;var bI=A(()=>{r$();V8();WX();t8();m4();U1();UX();uW=class uW extends o4{constructor($,X,Y,W){super();this.table=$,this.session=X,this.dialect=Y,this.config={table:$,withList:W}}static[r]="SQLiteDelete";config;where($){return this.config.where=$,this}orderBy(...$){if(typeof $[0]==="function"){let X=$[0](new Proxy(this.config.table[N$.Symbol.Columns],new D4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Y=Array.isArray(X)?X:[X];this.config.orderBy=Y}else{let X=$;this.config.orderBy=X}return this}limit($){return this.config.limit=$,this}returning($=this.table[V4.Symbol.Columns]){return this.config.returning=x1($),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($=!0){return this.session[$?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:G0(this.config.table)})}prepare(){return this._prepare(!1)}run=($)=>{return this._prepare().run($)};all=($)=>{return this._prepare().all($)};get=($)=>{return this._prepare().get($)};values=($)=>{return this._prepare().values($)};async execute($){return this._prepare().execute($)}$dynamic(){return this}}});function ee($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((Y)=>Y.toLowerCase()).join("_")}function $$$($){return($.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((Y,W,J)=>{let U=J===0?W.toLowerCase():`${W[0].toUpperCase()}${W.slice(1)}`;return Y+U},"")}function X$$($){return $}var QK;var xI=A(()=>{r$();m4();QK=class QK{static[r]="CasingCache";cache={};cachedTables={};convert;constructor($){this.convert=$==="snake_case"?ee:$==="camelCase"?$$$:X$$}getColumnCasing($){if(!$.keyAsName)return $.name;let X=$.table[N$.Symbol.Schema]??"public",Y=$.table[N$.Symbol.OriginalName],W=`${X}.${Y}.${$.name}`;if(!this.cache[W])this.cacheTable($.table);return this.cache[W]}cacheTable($){let X=$[N$.Symbol.Schema]??"public",Y=$[N$.Symbol.OriginalName],W=`${X}.${Y}`;if(!this.cachedTables[W]){for(let J of Object.values($[N$.Symbol.Columns])){let U=`${W}.${J.name}`;this.cache[U]=this.convert(J.name)}this.cachedTables[W]=!0}}clearCache(){this.cache={},this.cachedTables={}}}});var C9;var pW=A(()=>{r$();R4();C9=class C9 extends b1{static[r]="SQLiteViewBase"}});var GX,FK,qK;var cW=A(()=>{SW();xI();J0();r$();bW();OY();tV();R4();DK();t8();W0();m4();U1();H8();pW();GX=class GX{static[r]="SQLiteDialect";casing;constructor($){this.casing=new QK($?.casing)}escapeName($){return`"${$}"`}escapeParam($){return"?"}escapeString($){return`'${$.replace(/'/g,"''")}'`}buildWithCTE($){if(!$?.length)return;let X=[S`with `];for(let[Y,W]of $.entries())if(X.push(S`${S.identifier(W._.alias)} as (${W._.sql})`),Y<$.length-1)X.push(S`, `);return X.push(S` `),S.join(X)}buildDeleteQuery({table:$,where:X,returning:Y,withList:W,limit:J,orderBy:U}){let H=this.buildWithCTE(W),D=Y?S` returning ${this.buildSelection(Y,{isSingleTable:!0})}`:void 0,V=X?S` where ${X}`:void 0,K=this.buildOrderBy(U),Q=this.buildLimit(J);return S`${H}delete from ${$}${V}${D}${K}${Q}`}buildUpdateSet($,X){let Y=$[N$.Symbol.Columns],W=Object.keys(Y).filter((U)=>X[U]!==void 0||Y[U]?.onUpdateFn!==void 0),J=W.length;return S.join(W.flatMap((U,H)=>{let D=Y[U],V=X[U]??S.param(D.onUpdateFn(),D),K=S`${S.identifier(this.casing.getColumnCasing(D))} = ${V}`;if(H<J-1)return[K,S.raw(", ")];return[K]}))}buildUpdateQuery({table:$,set:X,where:Y,returning:W,withList:J,joins:U,from:H,limit:D,orderBy:V}){let K=this.buildWithCTE(J),Q=this.buildUpdateSet($,X),q=H&&S.join([S.raw(" from "),this.buildFromTable(H)]),F=this.buildJoins(U),w=W?S` returning ${this.buildSelection(W,{isSingleTable:!0})}`:void 0,z=Y?S` where ${Y}`:void 0,O=this.buildOrderBy(V),N=this.buildLimit(D);return S`${K}update ${$} set ${Q}${q}${F}${z}${w}${O}${N}`}buildSelection($,{isSingleTable:X=!1}={}){let Y=$.length,W=$.flatMap(({field:J},U)=>{let H=[];if(J$(J,b$.Aliased)&&J.isSelectionField)H.push(S.identifier(J.fieldAlias));else if(J$(J,b$.Aliased)||J$(J,b$)){let D=J$(J,b$.Aliased)?J.sql:J;if(X)H.push(new b$(D.queryChunks.map((V)=>{if(J$(V,C6))return S.identifier(this.casing.getColumnCasing(V));return V})));else H.push(D);if(J$(J,b$.Aliased))H.push(S` as ${S.identifier(J.fieldAlias)}`)}else if(J$(J,C6)){let D=J.table[N$.Symbol.Name];if(J.columnType==="SQLiteNumericBigInt")if(X)H.push(S`cast(${S.identifier(this.casing.getColumnCasing(J))} as text)`);else H.push(S`cast(${S.identifier(D)}.${S.identifier(this.casing.getColumnCasing(J))} as text)`);else if(X)H.push(S.identifier(this.casing.getColumnCasing(J)));else H.push(S`${S.identifier(D)}.${S.identifier(this.casing.getColumnCasing(J))}`)}if(U<Y-1)H.push(S`, `);return H});return S.join(W)}buildJoins($){if(!$||$.length===0)return;let X=[];if($)for(let[Y,W]of $.entries()){if(Y===0)X.push(S` `);let J=W.table,U=W.on?S` on ${W.on}`:void 0;if(J$(J,V4)){let H=J[V4.Symbol.Name],D=J[V4.Symbol.Schema],V=J[V4.Symbol.OriginalName],K=H===V?void 0:W.alias;X.push(S`${S.raw(W.joinType)} join ${D?S`${S.identifier(D)}.`:void 0}${S.identifier(V)}${K&&S` ${S.identifier(K)}`}${U}`)}else X.push(S`${S.raw(W.joinType)} join ${J}${U}`);if(Y<$.length-1)X.push(S` `)}return S.join(X)}buildLimit($){return typeof $==="object"||typeof $==="number"&&$>=0?S` limit ${$}`:void 0}buildOrderBy($){let X=[];if($){for(let[Y,W]of $.entries())if(X.push(W),Y<$.length-1)X.push(S`, `)}return X.length>0?S` order by ${S.join(X)}`:void 0}buildFromTable($){if(J$($,N$)&&$[N$.Symbol.IsAlias])return S`${S`${S.identifier($[N$.Symbol.Schema]??"")}.`.if($[N$.Symbol.Schema])}${S.identifier($[N$.Symbol.OriginalName])} ${S.identifier($[N$.Symbol.Name])}`;return $}buildSelectQuery({withList:$,fields:X,fieldsFlat:Y,where:W,having:J,table:U,joins:H,orderBy:D,groupBy:V,limit:K,offset:Q,distinct:q,setOperators:F}){let w=Y??x1(X);for(let t of w)if(J$(t.field,C6)&&n8(t.field.table)!==(J$(U,H4)?U._.alias:J$(U,C9)?U[n6].name:J$(U,b$)?void 0:n8(U))&&!((h)=>H?.some(({alias:f})=>f===(h[N$.Symbol.IsAlias]?n8(h):h[N$.Symbol.BaseName])))(t.field.table)){let h=n8(t.field.table);throw Error(`Your "${t.path.join("->")}" field references a column "${h}"."${t.field.name}", but the table "${h}" is not part of the query! Did you forget to join it?`)}let z=!H||H.length===0,O=this.buildWithCTE($),N=q?S` distinct`:void 0,L=this.buildSelection(w,{isSingleTable:z}),P=this.buildFromTable(U),j=this.buildJoins(H),v=W?S` where ${W}`:void 0,y=J?S` having ${J}`:void 0,E=[];if(V){for(let[t,h]of V.entries())if(E.push(h),t<V.length-1)E.push(S`, `)}let b=E.length>0?S` group by ${S.join(E)}`:void 0,R=this.buildOrderBy(D),I=this.buildLimit(K),d=Q?S` offset ${Q}`:void 0,k=S`${O}select${N} ${L} from ${P}${j}${v}${b}${y}${R}${I}${d}`;if(F.length>0)return this.buildSetOperations(k,F);return k}buildSetOperations($,X){let[Y,...W]=X;if(!Y)throw Error("Cannot pass undefined values to any set operator");if(W.length===0)return this.buildSetOperationQuery({leftSelect:$,setOperator:Y});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:$,setOperator:Y}),W)}buildSetOperationQuery({leftSelect:$,setOperator:{type:X,isAll:Y,rightSelect:W,limit:J,orderBy:U,offset:H}}){let D=S`${$.getSQL()} `,V=S`${W.getSQL()}`,K;if(U&&U.length>0){let w=[];for(let z of U)if(J$(z,e6))w.push(S.identifier(z.name));else if(J$(z,b$)){for(let O=0;O<z.queryChunks.length;O++){let N=z.queryChunks[O];if(J$(N,e6))z.queryChunks[O]=S.identifier(this.casing.getColumnCasing(N))}w.push(S`${z}`)}else w.push(S`${z}`);K=S` order by ${S.join(w,S`, `)}`}let Q=typeof J==="object"||typeof J==="number"&&J>=0?S` limit ${J}`:void 0,q=S.raw(`${X} ${Y?"all ":""}`),F=H?S` offset ${H}`:void 0;return S`${D}${q}${V}${K}${Q}${F}`}buildInsertQuery({table:$,values:X,onConflict:Y,returning:W,withList:J,select:U}){let H=[],D=$[N$.Symbol.Columns],V=Object.entries(D).filter(([z,O])=>!O.shouldDisableInsert()),K=V.map(([,z])=>S.identifier(this.casing.getColumnCasing(z)));if(U){let z=X;if(J$(z,b$))H.push(z);else H.push(z.getSQL())}else{let z=X;H.push(S.raw("values "));for(let[O,N]of z.entries()){let L=[];for(let[P,j]of V){let v=N[P];if(v===void 0||J$(v,N1)&&v.value===void 0){let y;if(j.default!==null&&j.default!==void 0)y=J$(j.default,b$)?j.default:S.param(j.default,j);else if(j.defaultFn!==void 0){let E=j.defaultFn();y=J$(E,b$)?E:S.param(E,j)}else if(!j.default&&j.onUpdateFn!==void 0){let E=j.onUpdateFn();y=J$(E,b$)?E:S.param(E,j)}else y=S`null`;L.push(y)}else L.push(v)}if(H.push(L),O<z.length-1)H.push(S`, `)}}let Q=this.buildWithCTE(J),q=S.join(H),F=W?S` returning ${this.buildSelection(W,{isSingleTable:!0})}`:void 0,w=Y?.length?S.join(Y):void 0;return S`${Q}insert into ${$} ${K} ${q}${w}${F}`}sqlToQuery($,X){return $.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:X})}buildRelationalQuery({fullSchema:$,schema:X,tableNamesMap:Y,table:W,tableConfig:J,queryConfig:U,tableAlias:H,nestedQueryRelation:D,joinOn:V}){let K=[],Q,q,F=[],w,z=[];if(U===!0)K=Object.entries(J.columns).map(([L,P])=>({dbKey:P.name,tsKey:L,field:b0(P,H),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let N=Object.fromEntries(Object.entries(J.columns).map(([E,b])=>[E,b0(b,H)]));if(U.where){let E=typeof U.where==="function"?U.where(N,hP()):U.where;w=E&&QY(E,H)}let L=[],P=[];if(U.columns){let E=!1;for(let[b,R]of Object.entries(U.columns)){if(R===void 0)continue;if(b in J.columns){if(!E&&R===!0)E=!0;P.push(b)}}if(P.length>0)P=E?P.filter((b)=>U.columns?.[b]===!0):Object.keys(J.columns).filter((b)=>!P.includes(b))}else P=Object.keys(J.columns);for(let E of P){let b=J.columns[E];L.push({tsKey:E,value:b})}let j=[];if(U.with)j=Object.entries(U.with).filter((E)=>!!E[1]).map(([E,b])=>({tsKey:E,queryConfig:b,relation:J.relations[E]}));let v;if(U.extras){v=typeof U.extras==="function"?U.extras(N,{sql:S}):U.extras;for(let[E,b]of Object.entries(v))L.push({tsKey:E,value:pV(b,H)})}for(let{tsKey:E,value:b}of L)K.push({dbKey:J$(b,b$.Aliased)?b.fieldAlias:J.columns[E].name,tsKey:E,field:J$(b,C6)?b0(b,H):b,relationTableTsKey:void 0,isJson:!1,selection:[]});let y=typeof U.orderBy==="function"?U.orderBy(N,yP()):U.orderBy??[];if(!Array.isArray(y))y=[y];F=y.map((E)=>{if(J$(E,C6))return b0(E,H);return QY(E,H)}),Q=U.limit,q=U.offset;for(let{tsKey:E,queryConfig:b,relation:R}of j){let I=gP(X,Y,R),d=T9(R.referencedTable),k=Y[d],t=`${H}_${E}`,h=Y4(...I.fields.map((o,g)=>t$(b0(I.references[g],t),b0(o,H)))),f=this.buildRelationalQuery({fullSchema:$,schema:X,tableNamesMap:Y,table:$[k],tableConfig:X[k],queryConfig:J$(R,a8)?b===!0?{limit:1}:{...b,limit:1}:b,tableAlias:t,joinOn:h,nestedQueryRelation:R}),l=S`(${f.sql})`.as(E);K.push({dbKey:E,tsKey:E,field:l,relationTableTsKey:k,isJson:!0,selection:f.selection})}}if(K.length===0)throw new YX({message:`No fields selected for table "${J.tsName}" ("${H}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let O;if(w=Y4(V,w),D){let N=S`json_array(${S.join(K.map(({field:j})=>J$(j,e6)?S.identifier(this.casing.getColumnCasing(j)):J$(j,b$.Aliased)?j.sql:j),S`, `)})`;if(J$(D,zY))N=S`coalesce(json_group_array(${N}), json_array())`;let L=[{dbKey:"data",tsKey:"data",field:N.as("data"),isJson:!0,relationTableTsKey:J.tsName,selection:K}];if(Q!==void 0||q!==void 0||F.length>0)O=this.buildSelectQuery({table:CW(W,H),fields:{},fieldsFlat:[{path:[],field:S.raw("*")}],where:w,limit:Q,offset:q,orderBy:F,setOperators:[]}),w=void 0,Q=void 0,q=void 0,F=void 0;else O=CW(W,H);O=this.buildSelectQuery({table:J$(O,V4)?O:new H4(O,{},H),fields:{},fieldsFlat:L.map(({field:j})=>({path:[],field:J$(j,C6)?b0(j,H):j})),joins:z,where:w,limit:Q,offset:q,orderBy:F,setOperators:[]})}else O=this.buildSelectQuery({table:CW(W,H),fields:{},fieldsFlat:K.map(({field:N})=>({path:[],field:J$(N,C6)?b0(N,H):N})),joins:z,where:w,limit:Q,offset:q,orderBy:F,setOperators:[]});return{tableTsKey:J.tsName,sql:O,selection:K}}};FK=class FK extends GX{static[r]="SQLiteSyncDialect";migrate($,X,Y){let W=Y===void 0?"__drizzle_migrations":typeof Y==="string"?"__drizzle_migrations":Y.migrationsTable??"__drizzle_migrations",J=S`
171
- CREATE TABLE IF NOT EXISTS ${S.identifier(W)} (
172
- id SERIAL PRIMARY KEY,
173
- hash text NOT NULL,
174
- created_at numeric
175
- )
176
- `;X.run(J);let H=X.values(S`SELECT id, hash, created_at FROM ${S.identifier(W)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;X.run(S`BEGIN`);try{for(let D of $)if(!H||Number(H[2])<D.folderMillis){for(let V of D.sql)X.run(S.raw(V));X.run(S`INSERT INTO ${S.identifier(W)} ("hash", "created_at") VALUES(${D.hash}, ${D.folderMillis})`)}X.run(S`COMMIT`)}catch(D){throw X.run(S`ROLLBACK`),D}}};qK=class qK extends GX{static[r]="SQLiteAsyncDialect";async migrate($,X,Y){let W=Y===void 0?"__drizzle_migrations":typeof Y==="string"?"__drizzle_migrations":Y.migrationsTable??"__drizzle_migrations",J=S`
177
- CREATE TABLE IF NOT EXISTS ${S.identifier(W)} (
178
- id SERIAL PRIMARY KEY,
179
- hash text NOT NULL,
180
- created_at numeric
181
- )
182
- `;await X.run(J);let H=(await X.values(S`SELECT id, hash, created_at FROM ${S.identifier(W)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await X.transaction(async(D)=>{for(let V of $)if(!H||Number(H[2])<V.folderMillis){for(let K of V.sql)await D.run(S.raw(K));await D.run(S`INSERT INTO ${S.identifier(W)} ("hash", "created_at") VALUES(${V.hash}, ${V.folderMillis})`)}})}}});var wK;var kI=A(()=>{r$();wK=class wK{static[r]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}});function dW($,X){return(Y,W,...J)=>{let U=[W,...J].map((H)=>({type:$,isAll:X,rightSelect:H}));for(let H of U)if(!FY(Y.getSelectedFields(),H.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return Y.addSetOperators(U)}}var H0,vI,ZK,Y$$=()=>({union:J$$,unionAll:W$$,intersect:U$$,except:G$$}),J$$,W$$,U$$,G$$;var zK=A(()=>{r$();kI();V8();WX();R4();W0();m4();U1();H8();UX();pW();H0=class H0{static[r]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor($){this.fields=$.fields,this.session=$.session,this.dialect=$.dialect,this.withList=$.withList,this.distinct=$.distinct}from($){let X=!!this.fields,Y;if(this.fields)Y=this.fields;else if(J$($,H4))Y=Object.fromEntries(Object.keys($._.selectedFields).map((W)=>[W,$[W]]));else if(J$($,C9))Y=$[n6].selectedFields;else if(J$($,b$))Y={};else Y=QP($);return new ZK({table:$,fields:Y,isPartialSelect:X,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}};vI=class vI extends wK{static[r]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:$,fields:X,isPartialSelect:Y,session:W,dialect:J,withList:U,distinct:H}){super();this.config={withList:U,table:$,fields:{...X},distinct:H,setOperators:[]},this.isPartialSelect=Y,this.session=W,this.dialect=J,this._={selectedFields:X,config:this.config},this.tableName=qY($),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let D of G0($))this.usedTables.add(D)}getUsedTables(){return[...this.usedTables]}createJoin($){return(X,Y)=>{let W=this.tableName,J=qY(X);for(let U of G0(X))this.usedTables.add(U);if(typeof J==="string"&&this.config.joins?.some((U)=>U.alias===J))throw Error(`Alias "${J}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof W==="string")this.config.fields={[W]:this.config.fields};if(typeof J==="string"&&!J$(X,b$)){let U=J$(X,H4)?X._.selectedFields:J$(X,b1)?X[n6].selectedFields:X[N$.Symbol.Columns];this.config.fields[J]=U}}if(typeof Y==="function")Y=Y(new Proxy(this.config.fields,new D4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:Y,table:X,joinType:$,alias:J}),typeof J==="string")switch($){case"left":{this.joinsNotNullableMap[J]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([U])=>[U,!1])),this.joinsNotNullableMap[J]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[J]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([U])=>[U,!1])),this.joinsNotNullableMap[J]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator($,X){return(Y)=>{let W=typeof Y==="function"?Y(Y$$()):Y;if(!FY(this.getSelectedFields(),W.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:$,isAll:X,rightSelect:W}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators($){return this.config.setOperators.push(...$),this}where($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new D4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=$,this}having($){if(typeof $==="function")$=$(new Proxy(this.config.fields,new D4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=$,this}groupBy(...$){if(typeof $[0]==="function"){let X=$[0](new Proxy(this.config.fields,new D4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(X)?X:[X]}else this.config.groupBy=$;return this}orderBy(...$){if(typeof $[0]==="function"){let X=$[0](new Proxy(this.config.fields,new D4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Y=Array.isArray(X)?X:[X];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Y;else this.config.orderBy=Y}else{let X=$;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=X;else this.config.orderBy=X}return this}limit($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=$;else this.config.limit=$;return this}offset($){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=$;else this.config.offset=$;return this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}as($){let X=[];if(X.push(...G0(this.config.table)),this.config.joins)for(let Y of this.config.joins)X.push(...G0(Y.table));return new Proxy(new H4(this.getSQL(),this.config.fields,$,!1,[...new Set(X)]),new D4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new D4({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}};ZK=class ZK extends vI{static[r]="SQLiteSelect";_prepare($=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let X=x1(this.config.fields),Y=this.session[$?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),X,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return Y.joinsNotNullableMap=this.joinsNotNullableMap,Y}$withCache($){return this.cacheConfig=$===void 0?{config:{},enable:!0,autoInvalidate:!0}:$===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...$},this}prepare(){return this._prepare(!1)}run=($)=>{return this._prepare().run($)};all=($)=>{return this._prepare().all($)};get=($)=>{return this._prepare().get($)};values=($)=>{return this._prepare().values($)};async execute(){return this.all()}};KP(ZK,[o4]);J$$=dW("union",!1),W$$=dW("union",!0),U$$=dW("intersect",!1),G$$=dW("except",!1)});var NY;var OK=A(()=>{r$();WX();cW();W0();zK();NY=class NY{static[r]="SQLiteQueryBuilder";dialect;dialectConfig;constructor($){this.dialect=J$($,GX)?$:void 0,this.dialectConfig=J$($,GX)?void 0:$}$with=($,X)=>{let Y=this;return{as:(J)=>{if(typeof J==="function")J=J(Y);return new Proxy(new HY(J.getSQL(),X??("getSelectedFields"in J?J.getSelectedFields()??{}:{}),$,!0),new D4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...$){let X=this;function Y(J){return new H0({fields:J??void 0,session:void 0,dialect:X.getDialect(),withList:$})}function W(J){return new H0({fields:J??void 0,session:void 0,dialect:X.getDialect(),withList:$,distinct:!0})}return{select:Y,selectDistinct:W}}select($){return new H0({fields:$??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct($){return new H0({fields:$??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){if(!this.dialect)this.dialect=new FK(this.dialectConfig);return this.dialect}}});var lW,NK;var hI=A(()=>{r$();V8();R4();t8();m4();U1();UX();OK();lW=class lW{constructor($,X,Y,W){this.table=$,this.session=X,this.dialect=Y,this.withList=W}static[r]="SQLiteInsertBuilder";values($){if($=Array.isArray($)?$:[$],$.length===0)throw Error("values() must be called with at least one value");let X=$.map((Y)=>{let W={},J=this.table[N$.Symbol.Columns];for(let U of Object.keys(Y)){let H=Y[U];W[U]=J$(H,b$)?H:new N1(H,J[U])}return W});return new NK(this.table,X,this.session,this.dialect,this.withList)}select($){let X=typeof $==="function"?$(new NY):$;if(!J$(X,b$)&&!FY(this.table[_W],X._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new NK(this.table,X,this.session,this.dialect,this.withList,!0)}};NK=class NK extends o4{constructor($,X,Y,W,J,U){super();this.session=Y,this.dialect=W,this.config={table:$,values:X,withList:J,select:U}}static[r]="SQLiteInsert";config;returning($=this.config.table[V4.Symbol.Columns]){return this.config.returning=x1($),this}onConflictDoNothing($={}){if(!this.config.onConflict)this.config.onConflict=[];if($.target===void 0)this.config.onConflict.push(S` on conflict do nothing`);else{let X=Array.isArray($.target)?S`${$.target}`:S`${[$.target]}`,Y=$.where?S` where ${$.where}`:S``;this.config.onConflict.push(S` on conflict ${X} do nothing${Y}`)}return this}onConflictDoUpdate($){if($.where&&($.targetWhere||$.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');if(!this.config.onConflict)this.config.onConflict=[];let X=$.where?S` where ${$.where}`:void 0,Y=$.targetWhere?S` where ${$.targetWhere}`:void 0,W=$.setWhere?S` where ${$.setWhere}`:void 0,J=Array.isArray($.target)?S`${$.target}`:S`${[$.target]}`,U=this.dialect.buildUpdateSet(this.config.table,kW(this.config.table,$.set));return this.config.onConflict.push(S` on conflict ${J}${Y} do update set ${U}${X}${W}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($=!0){return this.session[$?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:G0(this.config.table)})}prepare(){return this._prepare(!1)}run=($)=>{return this._prepare().run($)};all=($)=>{return this._prepare().all($)};get=($)=>{return this._prepare().get($)};values=($)=>{return this._prepare().values($)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}});var iW,yI;var fI=A(()=>{r$();V8();WX();t8();W0();m4();U1();H8();UX();pW();iW=class iW{constructor($,X,Y,W){this.table=$,this.session=X,this.dialect=Y,this.withList=W}static[r]="SQLiteUpdateBuilder";set($){return new yI(this.table,kW(this.table,$),this.session,this.dialect,this.withList)}};yI=class yI extends o4{constructor($,X,Y,W,J){super();this.session=Y,this.dialect=W,this.config={set:X,table:$,withList:J,joins:[]}}static[r]="SQLiteUpdate";config;from($){return this.config.from=$,this}createJoin($){return(X,Y)=>{let W=qY(X);if(typeof W==="string"&&this.config.joins.some((J)=>J.alias===W))throw Error(`Alias "${W}" is already used in this query`);if(typeof Y==="function"){let J=this.config.from?J$(X,V4)?X[N$.Symbol.Columns]:J$(X,H4)?X._.selectedFields:J$(X,C9)?X[n6].selectedFields:void 0:void 0;Y=Y(new Proxy(this.config.table[N$.Symbol.Columns],new D4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),J&&new Proxy(J,new D4({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:Y,table:X,joinType:$,alias:W}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where($){return this.config.where=$,this}orderBy(...$){if(typeof $[0]==="function"){let X=$[0](new Proxy(this.config.table[N$.Symbol.Columns],new D4({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Y=Array.isArray(X)?X:[X];this.config.orderBy=Y}else{let X=$;this.config.orderBy=X}return this}limit($){return this.config.limit=$,this}returning($=this.config.table[V4.Symbol.Columns]){return this.config.returning=x1($),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:$,...X}=this.dialect.sqlToQuery(this.getSQL());return X}_prepare($=!0){return this.session[$?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:G0(this.config.table)})}prepare(){return this._prepare(!1)}run=($)=>{return this._prepare().run($)};all=($)=>{return this._prepare().all($)};get=($)=>{return this._prepare().get($)};values=($)=>{return this._prepare().values($)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}});var AK=A(()=>{bI();hI();OK();zK();fI()});var AY;var gI=A(()=>{r$();R4();AY=class AY extends b${constructor($){super(AY.buildEmbeddedCount($.source,$.filters).queryChunks);this.params=$,this.session=$.session,this.sql=AY.buildCount($.source,$.filters)}sql;static[r]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount($,X){return S`(select count(*) from ${$}${S.raw(" where ").if(X)}${X})`}static buildCount($,X){return S`select count(*) from ${$}${S.raw(" where ").if(X)}${X}`}then($,X){return Promise.resolve(this.session.count(this.sql)).then($,X)}catch($){return this.then(void 0,$)}finally($){return this.then((X)=>{return $?.(),X},(X)=>{throw $?.(),X})}}});var MK,rW,BK;var mI=A(()=>{r$();V8();OY();MK=class MK{constructor($,X,Y,W,J,U,H,D){this.mode=$,this.fullSchema=X,this.schema=Y,this.tableNamesMap=W,this.table=J,this.tableConfig=U,this.dialect=H,this.session=D}static[r]="SQLiteAsyncRelationalQueryBuilder";findMany($){return this.mode==="sync"?new BK(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?$:{},"many"):new rW(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?$:{},"many")}findFirst($){return this.mode==="sync"?new BK(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?{...$,limit:1}:{limit:1},"first"):new rW(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,$?{...$,limit:1}:{limit:1},"first")}};rW=class rW extends o4{constructor($,X,Y,W,J,U,H,D,V){super();this.fullSchema=$,this.schema=X,this.tableNamesMap=Y,this.table=W,this.tableConfig=J,this.dialect=U,this.session=H,this.config=D,this.mode=V}static[r]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare($=!1){let{query:X,builtQuery:Y}=this._toSQL();return this.session[$?"prepareOneTimeQuery":"prepareQuery"](Y,void 0,this.mode==="first"?"get":"all",!0,(W,J)=>{let U=W.map((H)=>hW(this.schema,this.tableConfig,H,X.selection,J));if(this.mode==="first")return U[0];return U})}prepare(){return this._prepare(!1)}_toSQL(){let $=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),X=this.dialect.sqlToQuery($.sql);return{query:$,builtQuery:X}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare(!1).get();return this._prepare(!1).all()}async execute(){return this.executeRaw()}};BK=class BK extends rW{static[r]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}});var HX;var uI=A(()=>{r$();V8();HX=class HX extends o4{constructor($,X,Y,W,J){super();this.execute=$,this.getSQL=X,this.dialect=W,this.mapBatchResult=J,this.config={action:Y}}static[r]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult($,X){return X?this.mapBatchResult($):$}_prepare(){return this}isResponseInArrayMode(){return!1}}});var BY;var nW=A(()=>{r$();WX();R4();AK();W0();gI();mI();uI();BY=class BY{constructor($,X,Y,W){this.resultKind=$,this.dialect=X,this.session=Y,this._=W?{schema:W.schema,fullSchema:W.fullSchema,tableNamesMap:W.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};let J=this.query;if(this._.schema)for(let[U,H]of Object.entries(this._.schema))J[U]=new MK($,W.fullSchema,this._.schema,this._.tableNamesMap,W.fullSchema[U],H,X,Y);this.$cache={invalidate:async(U)=>{}}}static[r]="BaseSQLiteDatabase";query;$with=($,X)=>{let Y=this;return{as:(J)=>{if(typeof J==="function")J=J(new NY(Y.dialect));return new Proxy(new HY(J.getSQL(),X??("getSelectedFields"in J?J.getSelectedFields()??{}:{}),$,!0),new D4({alias:$,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count($,X){return new AY({source:$,filters:X,session:this.session})}with(...$){let X=this;function Y(D){return new H0({fields:D??void 0,session:X.session,dialect:X.dialect,withList:$})}function W(D){return new H0({fields:D??void 0,session:X.session,dialect:X.dialect,withList:$,distinct:!0})}function J(D){return new iW(D,X.session,X.dialect,$)}function U(D){return new lW(D,X.session,X.dialect,$)}function H(D){return new uW(D,X.session,X.dialect,$)}return{select:Y,selectDistinct:W,update:J,insert:U,delete:H}}select($){return new H0({fields:$??void 0,session:this.session,dialect:this.dialect})}selectDistinct($){return new H0({fields:$??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update($){return new iW($,this.session,this.dialect)}$cache;insert($){return new lW($,this.session,this.dialect)}delete($){return new uW($,this.session,this.dialect)}run($){let X=typeof $==="string"?S.raw($):$.getSQL();if(this.resultKind==="async")return new HX(async()=>this.session.run(X),()=>X,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session));return this.session.run(X)}all($){let X=typeof $==="string"?S.raw($):$.getSQL();if(this.resultKind==="async")return new HX(async()=>this.session.all(X),()=>X,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session));return this.session.all(X)}get($){let X=typeof $==="string"?S.raw($):$.getSQL();if(this.resultKind==="async")return new HX(async()=>this.session.get(X),()=>X,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session));return this.session.get(X)}values($){let X=typeof $==="string"?S.raw($):$.getSQL();if(this.resultKind==="async")return new HX(async()=>this.session.values(X),()=>X,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session));return this.session.values(X)}transaction($,X){return this.session.transaction($,X)}}});async function jK($,X){let Y=`${$}-${JSON.stringify(X)}`,J=new TextEncoder().encode(Y),U=await crypto.subtle.digest("SHA-256",J);return[...new Uint8Array(U)].map((V)=>V.toString(16).padStart(2,"0")).join("")}var pI,MY;var RK=A(()=>{r$();pI=class pI{static[r]="Cache"};MY=class MY extends pI{strategy(){return"all"}static[r]="NoopCache";async get($){return}async put($,X,Y,W){}async onMutate($){}}});var cI,LK,EK,PK;var IK=A(()=>{RK();r$();bW();V8();nW();cI=class cI extends o4{constructor($){super();this.resultCb=$}static[r]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}};LK=class LK{constructor($,X,Y,W,J,U){if(this.mode=$,this.executeMethod=X,this.query=Y,this.cache=W,this.queryMetadata=J,this.cacheConfig=U,W&&W.strategy()==="all"&&U===void 0)this.cacheConfig={enable:!0,autoInvalidate:!0};if(!this.cacheConfig?.enable)this.cacheConfig=void 0}static[r]="PreparedQuery";joinsNotNullableMap;async queryWithCache($,X,Y){if(this.cache===void 0||J$(this.cache,MY)||this.queryMetadata===void 0)try{return await Y()}catch(W){throw new D8($,X,W)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await Y()}catch(W){throw new D8($,X,W)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[W]=await Promise.all([Y(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return W}catch(W){throw new D8($,X,W)}if(!this.cacheConfig)try{return await Y()}catch(W){throw new D8($,X,W)}if(this.queryMetadata.type==="select"){let W=await this.cache.get(this.cacheConfig.tag??await jK($,X),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(W===void 0){let J;try{J=await Y()}catch(U){throw new D8($,X,U)}return await this.cache.put(this.cacheConfig.tag??await jK($,X),J,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),J}return W}try{return await Y()}catch(W){throw new D8($,X,W)}}getQuery(){return this.query}mapRunResult($,X){return $}mapAllResult($,X){throw Error("Not implemented")}mapGetResult($,X){throw Error("Not implemented")}execute($){if(this.mode==="async")return this[this.executeMethod]($);return new cI(()=>this[this.executeMethod]($))}mapResult($,X){switch(this.executeMethod){case"run":return this.mapRunResult($,X);case"all":return this.mapAllResult($,X);case"get":return this.mapGetResult($,X)}}};EK=class EK{constructor($){this.dialect=$}static[r]="SQLiteSession";prepareOneTimeQuery($,X,Y,W,J,U,H){return this.prepareQuery($,X,Y,W,J,U,H)}run($){let X=this.dialect.sqlToQuery($);try{return this.prepareOneTimeQuery(X,void 0,"run",!1).run()}catch(Y){throw new YX({cause:Y,message:`Failed to run the query '${X.sql}'`})}}extractRawRunValueFromBatchResult($){return $}all($){return this.prepareOneTimeQuery(this.dialect.sqlToQuery($),void 0,"run",!1).all()}extractRawAllValueFromBatchResult($){throw Error("Not implemented")}get($){return this.prepareOneTimeQuery(this.dialect.sqlToQuery($),void 0,"run",!1).get()}extractRawGetValueFromBatchResult($){throw Error("Not implemented")}values($){return this.prepareOneTimeQuery(this.dialect.sqlToQuery($),void 0,"run",!1).values()}async count($){return(await this.values($))[0][0]}extractRawValuesValueFromBatchResult($){throw Error("Not implemented")}};PK=class PK extends BY{constructor($,X,Y,W,J=0){super($,X,Y,W);this.schema=W,this.nestedIndex=J}static[r]="SQLiteTransaction";rollback(){throw new cV}}});var dI=()=>{};var S9=A(()=>{lP();iP();DK();nW();cW();$K();TI();SI();AK();IK();t8();XK();UX();dI()});var X6;var oW=A(()=>{S9();R$();X6=k0("job_queue",{id:W6("id").primaryKey().$defaultFn(()=>W1()),type:W6("type").notNull(),data:W6("data").notNull(),result:W6("result",{mode:"json"}),source:W6("source"),metadata:W6("metadata",{mode:"json"}).$type().notNull(),status:W6("status",{enum:["pending","processing","completed","failed"]}).notNull().default("pending"),priority:a4("priority").notNull().default(0),retryCount:a4("retryCount").notNull().default(0),maxRetries:a4("maxRetries").notNull().default(3),lastError:W6("lastError"),createdAt:a4("createdAt").notNull().$defaultFn(()=>Date.now()),scheduledFor:a4("scheduledFor").notNull().$defaultFn(()=>Date.now()),startedAt:a4("startedAt"),completedAt:a4("completedAt")},($)=>({queueReadyIdx:U0("idx_job_queue_ready").on($.status,$.priority,$.scheduledFor),jobTypeIdx:U0("idx_job_queue_type").on($.type,$.status),jobSourceIdx:U0("idx_job_queue_source").on($.source)}))});var lI,iI,jY,lT$;var aW=A(()=>{R$();lI=Z.enum(["file_operations","content_operations","data_processing","batch_processing"]),iI=Z.object({pluginId:Z.string().optional(),progressToken:Z.union([Z.string(),Z.number()]).optional(),operationType:lI,operationTarget:Z.string().optional(),interfaceType:Z.string().optional(),channelId:Z.string().optional()}),jY=iI.extend({rootJobId:Z.string()}),lT$=Z.enum(["none","skip","replace","coalesce"])});var _K,rI,S6,H$$,D$$,TK;var DX=A(()=>{R$();aW();_K=Z.enum(["pending","processing","completed","failed"]),rI=Z.enum(["completed","failed"]),S6={PENDING:"pending",PROCESSING:"processing",COMPLETED:"completed",FAILED:"failed"},H$$=Z.object({id:Z.string(),type:Z.string(),status:_K,data:Z.unknown(),result:Z.unknown().optional(),lastError:Z.string().optional().nullable(),attempts:Z.number(),maxRetries:Z.number(),priority:Z.number(),createdAt:Z.date(),updatedAt:Z.date(),processedAt:Z.date().optional().nullable(),completedAt:Z.date().optional().nullable(),failedAt:Z.date().optional().nullable()}),D$$=Z.object({jobId:Z.string(),type:Z.string(),status:rI,result:Z.unknown().optional(),error:Z.string().optional()}),TK=Z.object({id:Z.string(),type:Z.enum(["job","batch"]),status:_K,message:Z.string().optional(),progress:Z.object({current:Z.number(),total:Z.number(),percentage:Z.number()}).optional(),aggregationKey:Z.string().optional(),batchDetails:Z.object({totalOperations:Z.number(),completedOperations:Z.number(),failedOperations:Z.number(),currentOperation:Z.string().optional(),errors:Z.array(Z.string()).optional()}).optional(),jobDetails:Z.object({jobType:Z.string(),priority:Z.number(),retryCount:Z.number()}).optional(),metadata:jY})});var nI=A(()=>{RK()});function oI($){return Object.keys($).reduce((X,Y)=>{if(Object.prototype.propertyIsEnumerable.call($,Y))X[Y]=$[Y];return X},{})}function sW($){if(typeof ArrayBuffer<"u"&&$ instanceof ArrayBuffer){if(typeof Buffer<"u"){if(!($ instanceof Buffer))return Buffer.from($);return $}if(typeof TextDecoder<"u")return new TextDecoder().decode($);throw Error("TextDecoder is not available. Please provide either Buffer or TextDecoder polyfill.")}return $}var tW,CK,aI;var SK=A(()=>{nI();r$();xW();R4();S9();IK();U1();tW=class tW extends EK{constructor($,X,Y,W,J){super(X);this.client=$,this.schema=Y,this.options=W,this.tx=J,this.logger=W.logger??new lV,this.cache=W.cache??new MY}static[r]="LibSQLSession";logger;cache;prepareQuery($,X,Y,W,J,U,H){return new aI(this.client,$,this.logger,this.cache,U,H,X,this.tx,Y,W,J)}async batch($){let X=[],Y=[];for(let J of $){let U=J._prepare(),H=U.getQuery();X.push(U),Y.push({sql:H.sql,args:H.params})}return(await this.client.batch(Y)).map((J,U)=>X[U].mapResult(J,!0))}async migrate($){let X=[],Y=[];for(let J of $){let U=J._prepare(),H=U.getQuery();X.push(U),Y.push({sql:H.sql,args:H.params})}return(await this.client.migrate(Y)).map((J,U)=>X[U].mapResult(J,!0))}async transaction($,X){let Y=await this.client.transaction(),W=new tW(this.client,this.dialect,this.schema,this.options,Y),J=new CK("async",this.dialect,W,this.schema);try{let U=await $(J);return await Y.commit(),U}catch(U){throw await Y.rollback(),U}}extractRawAllValueFromBatchResult($){return $.rows}extractRawGetValueFromBatchResult($){return $.rows[0]}extractRawValuesValueFromBatchResult($){return $.rows}};CK=class CK extends PK{static[r]="LibSQLTransaction";async transaction($){let X=`sp${this.nestedIndex}`,Y=new CK("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(S.raw(`savepoint ${X}`));try{let W=await $(Y);return await this.session.run(S.raw(`release savepoint ${X}`)),W}catch(W){throw await this.session.run(S.raw(`rollback to savepoint ${X}`)),W}}};aI=class aI extends LK{constructor($,X,Y,W,J,U,H,D,V,K,Q){super("async",V,X,W,J,U);this.client=$,this.logger=Y,this.fields=H,this.tx=D,this._isResponseInArrayMode=K,this.customResultMapper=Q,this.customResultMapper=Q,this.fields=H}static[r]="LibSQLPreparedQuery";async run($){let X=VY(this.query.params,$??{});return this.logger.logQuery(this.query.sql,X),await this.queryWithCache(this.query.sql,X,async()=>{let Y={sql:this.query.sql,args:X};return this.tx?this.tx.execute(Y):this.client.execute(Y)})}async all($){let{fields:X,logger:Y,query:W,tx:J,client:U,customResultMapper:H}=this;if(!X&&!H){let V=VY(W.params,$??{});return Y.logQuery(W.sql,V),await this.queryWithCache(W.sql,V,async()=>{let K={sql:W.sql,args:V};return(J?J.execute(K):U.execute(K)).then(({rows:Q})=>this.mapAllResult(Q))})}let D=await this.values($);return this.mapAllResult(D)}mapAllResult($,X){if(X)$=$.rows;if(!this.fields&&!this.customResultMapper)return $.map((Y)=>oI(Y));if(this.customResultMapper)return this.customResultMapper($,sW);return $.map((Y)=>{return iV(this.fields,Array.prototype.slice.call(Y).map((W)=>sW(W)),this.joinsNotNullableMap)})}async get($){let{fields:X,logger:Y,query:W,tx:J,client:U,customResultMapper:H}=this;if(!X&&!H){let V=VY(W.params,$??{});return Y.logQuery(W.sql,V),await this.queryWithCache(W.sql,V,async()=>{let K={sql:W.sql,args:V};return(J?J.execute(K):U.execute(K)).then(({rows:Q})=>this.mapGetResult(Q))})}let D=await this.values($);return this.mapGetResult(D)}mapGetResult($,X){if(X)$=$.rows;let Y=$[0];if(!this.fields&&!this.customResultMapper)return oI(Y);if(!Y)return;if(this.customResultMapper)return this.customResultMapper($,sW);return iV(this.fields,Array.prototype.slice.call(Y).map((W)=>sW(W)),this.joinsNotNullableMap)}async values($){let X=VY(this.query.params,$??{});return this.logger.logQuery(this.query.sql,X),await this.queryWithCache(this.query.sql,X,async()=>{let Y={sql:this.query.sql,args:X};return(this.tx?this.tx.execute(Y):this.client.execute(Y)).then(({rows:W})=>W)})}isResponseInArrayMode(){return this._isResponseInArrayMode}}});function VX($,X={}){let Y=new qK({casing:X.casing}),W;if(X.logger===!0)W=new dV;else if(X.logger!==!1)W=X.logger;let J;if(X.schema){let D=fP(X.schema,mP);J={fullSchema:X.schema,schema:D.tables,tableNamesMap:D.tableNamesMap}}let U=new tW($,Y,J,{logger:W,cache:X.cache},void 0),H=new sI("async",Y,U,J);if(H.$client=$,H.$cache=X.cache,H.$cache)H.$cache.invalidate=X.cache?.onMutate;return H}var sI;var tI=A(()=>{r$();xW();OY();nW();cW();SK();sI=class sI extends BY{static[r]="LibSQLDatabase";async batch($){return this.session.batch($)}}});import{createClient as bK}from"@libsql/client";function v0(...$){if(typeof $[0]==="string"){let X=bK({url:$[0]});return VX(X,$[1])}if(FP($[0])){let{connection:X,client:Y,...W}=$[0];if(Y)return VX(Y,W);let J=typeof X==="string"?bK({url:X}):bK(X);return VX(J,W)}return VX($[0],$[1])}var eI=A(()=>{U1();tI();(($)=>{function X(Y){return VX({},Y)}$.mock=X})(v0||(v0={}))});var RY=A(()=>{eI();SK()});import{createClient as $_}from"@libsql/client";function xK($){let X=$.url,Y=$.authToken??process.env.JOB_QUEUE_DATABASE_AUTH_TOKEN,W=Y?$_({url:X,authToken:Y}):$_({url:X});return{db:v0(W,{schema:{jobQueue:X6}}),client:W,url:X}}async function kK($,X){if(X.startsWith("file:"))await $.execute("PRAGMA journal_mode = WAL"),await $.execute("PRAGMA busy_timeout = 5000")}var vK=A(()=>{RY();oW()});class hK{handlers=new Map;logger;constructor($){this.logger=$.child("HandlerRegistry")}registerHandler($,X,Y){this.handlers.set($,X),this.logger.debug("Registered job handler",{type:$,pluginId:Y})}unregisterHandler($){this.handlers.delete($),this.logger.debug("Unregistered job handler",{type:$})}unregisterPluginHandlers($){let X=`${$}:`,Y=[];for(let W of this.handlers.keys())if(W.startsWith(X))Y.push(W);for(let W of Y)this.handlers.delete(W);if(Y.length>0)this.logger.debug("Unregistered plugin handlers",{pluginId:$,count:Y.length,types:Y})}getRegisteredTypes(){return Array.from(this.handlers.keys())}getHandler($){return this.handlers.get($)}}class yK{db;logger;constructor($,X){this.db=$;this.logger=X.child("JobOperations")}async complete($,X){let Y=Date.now();await this.db.update(X6).set({status:S6.COMPLETED,result:JSON.stringify(X),completedAt:Y}).where(t$(X6.id,$)),this.logger.debug("Job completed",{jobId:$,hasResult:X!==void 0})}async update($,X){await this.db.update(X6).set({data:JSON.stringify(X)}).where(t$(X6.id,$)),this.logger.debug("Job data updated",{jobId:$})}async fail($,X){let W=(await this.db.select().from(X6).where(t$(X6.id,$)).limit(1))[0];if(!W){this.logger.warn("Job not found for failure update",{jobId:$});return}let{maxRetries:J,retryCount:U}=W,H=Date.now();if(U<J){let D=Math.min(1000*Math.pow(2,U),60000),V=H+D;await this.db.update(X6).set({status:S6.PENDING,retryCount:U+1,lastError:X.message,scheduledFor:V}).where(t$(X6.id,$)),this.logger.debug("Job scheduled for retry",{jobId:$,retryCount:U+1,backoffMs:D,scheduledFor:new Date(V).toISOString()})}else await this.db.update(X6).set({status:S6.FAILED,lastError:X.message,completedAt:H}).where(t$(X6.id,$)),this.logger.error("Job failed after max retries",{jobId:$,type:W.type,retryCount:U,error:X.message})}async markProcessing($){let X=Date.now();await this.db.update(X6).set({status:S6.PROCESSING,startedAt:X}).where(t$(X6.id,$)),this.logger.debug("Job marked as processing",{jobId:$})}}var X_=A(()=>{K8();oW();DX()});class v1{static instance=null;db;client;logger;handlerRegistry;jobOperations;static getInstance($,X){return v1.instance??=new v1($,X??Z6.getInstance()),v1.instance}static resetInstance(){if(v1.instance)v1.instance.close(),v1.instance=null}close(){this.client.close()}static createFresh($,X){return new v1($,X??Z6.getInstance())}constructor($,X){let{db:Y,client:W,url:J}=xK($);this.db=Y,this.client=W,this.logger=(X??Z6.getInstance()).child("JobQueueService"),this.handlerRegistry=new hK(this.logger),this.jobOperations=new yK(this.db,this.logger),kK(W,J).catch((U)=>{this.logger.warn("Failed to enable WAL mode (non-fatal)",U)})}registerHandler($,X,Y){this.handlerRegistry.registerHandler($,X,Y)}unregisterHandler($){this.handlerRegistry.unregisterHandler($)}unregisterPluginHandlers($){this.handlerRegistry.unregisterPluginHandlers($)}getRegisteredTypes(){return this.handlerRegistry.getRegisteredTypes()}getHandler($){return this.handlerRegistry.getHandler($)}async checkForDuplicate($,X,Y){if(!X||X==="none")return null;let W=await this.getActiveJobs([$]),J=Y?W.filter((U)=>{try{return JSON.parse(U.data).deduplicationKey===Y}catch{return!1}}):W;if(J.length===0)return null;if(X==="skip")return J.find((U)=>U.status===S6.PENDING)??null;return J[0]??null}async enqueue($,X,Y){let W=await this.checkForDuplicate($,Y?.deduplication,Y?.deduplicationKey);if(W){if(Y?.deduplication==="skip")return this.logger.debug("Skipping duplicate job (already pending)",{type:$,existingJobId:W.id}),W.id;if(Y?.deduplication==="replace")this.logger.debug("Replacing duplicate job",{type:$,oldJobId:W.id}),await this.db.update(X6).set({status:S6.FAILED,lastError:"Replaced by newer job"}).where(t$(X6.id,W.id));if(Y?.deduplication==="coalesce")return this.logger.debug("Coalescing with existing job",{type:$,existingJobId:W.id}),await this.db.update(X6).set({scheduledFor:Date.now()}).where(t$(X6.id,W.id)),W.id}let J=this.handlerRegistry.getHandler($);if(!J)throw Error(`No handler registered for job type: ${$}`);let U=J.validateAndParse(X);if(U===null)throw Error(`Invalid job data for type: ${$}`);let H=Date.now(),D=W1(),V=Y?.deduplicationKey?{...U,deduplicationKey:Y.deduplicationKey}:U,K={id:D,type:$,data:JSON.stringify(V),status:S6.PENDING,priority:Y?.priority??0,maxRetries:Y?.maxRetries??3,retryCount:0,source:Y?.source??null,metadata:{operationType:"data_processing",...Y?.metadata,rootJobId:Y?.rootJobId??D},createdAt:H,scheduledFor:Y?.delayMs?H+Y.delayMs:H,result:null,lastError:null,startedAt:null,completedAt:null};try{return await this.db.insert(X6).values(K),this.logger.debug("Job enqueued",{id:D,type:$,priority:K.priority,rootJobId:K.metadata.rootJobId}),D}catch(Q){throw this.logger.error("Failed to enqueue job",{type:$,error:Q instanceof Error?Q.message:Q}),Q}}async dequeue(){let $=Date.now(),Y=(await this.db.select().from(X6).where(Y4(t$(X6.status,S6.PENDING),ZY(X6.scheduledFor,$))).orderBy(k1(X6.priority),k1(X6.createdAt)).limit(1))[0];if(!Y)return null;return await this.jobOperations.markProcessing(Y.id),Y.status=S6.PROCESSING,Y.startedAt=Date.now(),this.logger.debug("Job dequeued",{id:Y.id,type:Y.type,priority:Y.priority,retryCount:Y.retryCount}),Y}async complete($,X){await this.jobOperations.complete($,X)}async update($,X){await this.jobOperations.update($,X)}async fail($,X){await this.jobOperations.fail($,X)}async getStatus($){return(await this.db.select().from(X6).where(t$(X6.id,$)).limit(1))[0]??null}async getStatusByEntityId($){return(await this.db.select().from(X6).where(S`json_extract(${X6.data}, '$.id') = ${$}`).orderBy(A1(X6.createdAt)).limit(1))[0]??null}async getStats(){let $=await this.db.select({status:X6.status,count:S`count(*)`}).from(X6).groupBy(X6.status),X={pending:0,processing:0,failed:0,completed:0,total:0};for(let Y of $){let W=Number(Y.count);X[Y.status]=W,X.total+=W}return X}async cleanup($){let X=Date.now()-$,W=(await this.db.delete(X6).where(Y4(wY(t$(X6.status,S6.COMPLETED),t$(X6.status,S6.FAILED)),ZY(X6.completedAt,X)))).rowsAffected;if(W>0)this.logger.info("Cleaned up old jobs",{deletedCount:W,olderThanMs:$});return W}async getActiveJobs($){let X=wY(t$(X6.status,S6.PENDING),t$(X6.status,S6.PROCESSING)),Y=$&&$.length>0?Y4(X,vW(X6.type,$)):X;return this.db.select().from(X6).where(Y).orderBy(A1(X6.createdAt))}}var Y_=A(()=>{K8();oW();R$();DX();vK();X_()});class h0{static instance=null;logger;jobQueueService;progressMonitor;config;isRunning=!1;shouldStop=!1;activeJobs=new Set;stats;startTime=0;pollTimeout=null;processingPromises=new Map;static getInstance($,X,Y,W){return h0.instance??=new h0($,X,Y,W),h0.instance}static resetInstance(){h0.instance=null}static createFresh($,X,Y,W){return new h0($,X,Y,W)}constructor($,X,Y,W){if(this.logger=Y.child("JobQueueWorker"),this.jobQueueService=$,this.progressMonitor=X,this.config={concurrency:W?.concurrency??1,pollInterval:W?.pollInterval??1000,maxJobs:W?.maxJobs??0,autoStart:W?.autoStart??!1},this.stats={processedJobs:0,failedJobs:0,activeJobs:0,uptime:0,isRunning:!1},this.logger.debug("JobQueueWorker initialized",{concurrency:this.config.concurrency,pollInterval:this.config.pollInterval,maxJobs:this.config.maxJobs,autoStart:this.config.autoStart}),this.config.autoStart)this.start()}async start(){if(this.isRunning){this.logger.warn("Worker is already running");return}this.logger.debug("Starting JobQueueWorker"),this.isRunning=!0,this.shouldStop=!1,this.startTime=Date.now(),this.stats.isRunning=!0,this.scheduleNextPoll()}async stop(){if(!this.isRunning){this.logger.warn("Worker is not running");return}if(this.logger.debug("Stopping JobQueueWorker"),this.shouldStop=!0,this.pollTimeout)clearTimeout(this.pollTimeout),this.pollTimeout=null;if(this.processingPromises.size>0)this.logger.debug("Waiting for active jobs to complete",{activeJobs:this.processingPromises.size}),await Promise.all(this.processingPromises.values());this.isRunning=!1,this.stats.isRunning=!1,this.logger.debug("JobQueueWorker stopped")}getStats(){return{...this.stats,activeJobs:this.activeJobs.size,uptime:this.isRunning?Date.now()-this.startTime:0}}isWorkerRunning(){return this.isRunning}async processAvailableJobs(){if(!this.isRunning||this.shouldStop)return;try{let $=this.config.concurrency-this.activeJobs.size;if($<=0)return;if(this.config.maxJobs>0&&this.stats.processedJobs>=this.config.maxJobs){this.logger.debug("Maximum job limit reached, stopping worker",{maxJobs:this.config.maxJobs,processedJobs:this.stats.processedJobs}),await this.stop();return}let X=[];for(let Y=0;Y<$;Y++){let W=await this.jobQueueService.dequeue();if(W)X.push(W);else break}for(let Y of X){let W=this.processJobWrapper(Y);this.processingPromises.set(Y.id,W)}}catch($){this.logger.error("Error processing available jobs",{error:$}),this.stats.lastError=g6($)}}async processJobWrapper($){let X=$.id;this.activeJobs.add(X);try{this.logger.debug("Processing job",{jobId:X,type:$.type,priority:$.priority,retryCount:$.retryCount});let Y=await this.processJob($);if(Y.status==="completed")this.stats.processedJobs++,this.logger.debug("Job completed successfully",{jobId:X,type:Y.type});else this.stats.failedJobs++,this.logger.warn("Job failed",{jobId:X,type:Y.type,error:Y.error})}catch(Y){this.stats.failedJobs++,this.logger.error("Error processing job",{jobId:X,type:$.type,error:Y}),this.stats.lastError=g6(Y)}finally{this.activeJobs.delete(X),this.processingPromises.delete(X)}}scheduleNextPoll(){if(!this.isRunning||this.shouldStop)return;this.pollTimeout=setTimeout(async()=>{await this.processAvailableJobs(),this.scheduleNextPoll()},this.config.pollInterval)}async processJob($){let X=this.jobQueueService.getHandler($.type);if(!X){let Y=Error(`No handler registered for job type: ${$.type}`);return await this.jobQueueService.fail($.id,Y),{jobId:$.id,type:$.type,status:S6.FAILED,error:Y.message}}try{this.logger.debug("Processing job",{jobId:$.id,type:$.type});let Y=JSON.parse($.data),W=X.validateAndParse(Y);if(W===null)throw Error(`Invalid job data for type: ${$.type}`);let J=this.progressMonitor.createProgressReporter($.id),U=await X.process(W,$.id,J),H=V$$.safeParse(U);if(H.success){let D=H.data.error??"Handler returned failure";return await this.jobQueueService.fail($.id,Error(D)),await this.progressMonitor.handleJobStatusChange($.id,"failed",$.metadata),{jobId:$.id,type:$.type,status:S6.FAILED,error:D}}return await this.jobQueueService.complete($.id,U),await this.progressMonitor.handleJobStatusChange($.id,"completed",$.metadata),{jobId:$.id,type:$.type,status:S6.COMPLETED,result:U}}catch(Y){let W=T0(Y);try{let U=JSON.parse($.data),H=X.validateAndParse(U);if(H!==null){let D=this.progressMonitor.createProgressReporter($.id);await X.onError?.(W,H,$.id,D)}}catch(U){this.logger.error("Job handler error callback failed",{jobId:$.id,error:U})}if(await this.jobQueueService.fail($.id,W),(await this.jobQueueService.getStatus($.id))?.status===S6.FAILED)await this.progressMonitor.handleJobStatusChange($.id,"failed",$.metadata);return{jobId:$.id,type:$.type,status:S6.FAILED,error:W.message}}}}var V$$;var J_=A(()=>{R$();DX();V$$=Z.object({success:Z.literal(!1),error:Z.string().optional()})});class y0{jobQueue;logger;static instance=null;batches=new Map;static getInstance($,X){return y0.instance??=new y0($,X),y0.instance}static resetInstance(){y0.instance=null}static createFresh($,X){return new y0($,X)}constructor($,X){this.jobQueue=$;this.logger=X}async enqueueBatch($,X,Y,W){if($.length===0)throw Error("Cannot enqueue empty batch");let J=[];try{for(let U of $){let H={...X,rootJobId:Y,metadata:{...X.metadata,operationTarget:U.type}},D=await this.jobQueue.enqueue(U.type,U.data,H,W);J.push(D)}return this.batches.set(Y,{jobIds:J,operations:$,source:X.source,startedAt:new Date().toISOString(),metadata:{...X.metadata,rootJobId:Y}}),this.logger.debug("Enqueued batch operations",{batchId:Y,operationCount:$.length,jobIds:J,rootJobId:Y}),Y}catch(U){throw this.logger.error("Failed to enqueue batch operations",{error:U,operationCount:$.length,enqueuedJobs:J.length}),U}}async getBatchStatus($){let X=this.batches.get($);if(!X)return null;try{let Y=await Promise.all(X.jobIds.map((K)=>this.jobQueue.getStatus(K))),W=0,J=0,U=0,H=[];for(let K of Y){if(!K)continue;switch(K.status){case"completed":W++;break;case"failed":if(J++,K.lastError)H.push(K.lastError);break;case"processing":case"pending":U++;break}}let D;if(U>0)D=S6.PROCESSING;else if(J>0)D=S6.FAILED;else D=S6.COMPLETED;let V;for(let K=0;K<X.jobIds.length;K++){let Q=Y[K];if(Q&&Q.status!=="completed"&&Q.status!=="failed"){let q=X.operations[K];if(q)V=`Processing ${q.type}`;break}}return{batchId:$,totalOperations:X.operations.length,completedOperations:W,failedOperations:J,errors:H,status:D,currentOperation:V,metadata:X.metadata}}catch(Y){throw this.logger.error("Failed to get batch status",{batchId:$,error:Y}),Y}}async cleanup($){let X=Date.now()-$,Y=0;for(let[W,J]of this.batches.entries())if(new Date(J.startedAt).getTime()<X){let H=await this.getBatchStatus(W);if(H&&(H.status===S6.COMPLETED||H.status===S6.FAILED))this.batches.delete(W),Y++}return this.logger.debug("Cleaned up batch metadata",{cleaned:Y}),Y}registerBatch($,X,Y,W,J){this.batches.set($,{jobIds:X,operations:Y,source:W,startedAt:new Date().toISOString(),metadata:J}),this.logger.debug("Registered batch metadata",{batchId:$,operationCount:Y.length,jobIds:X})}async getActiveBatches(){let $=[];try{for(let[X,Y]of this.batches){let W=await this.getBatchStatus(X);if(W&&(W.status==="pending"||W.status==="processing"))$.push({batchId:X,status:W,metadata:{operations:Y.operations,source:Y.source,startedAt:Y.startedAt,metadata:Y.metadata}})}return this.logger.debug("Retrieved active batches",{count:$.length}),$}catch(X){throw this.logger.error("Failed to get active batches",{error:X}),X}}}var W_=A(()=>{DX()});class f0{jobQueueService;messageBus;batchJobManager;logger;static instance=null;static getInstance($,X,Y,W){return f0.instance??=new f0($,X,Y,W),f0.instance}static resetInstance(){f0.instance=null}static createFresh($,X,Y,W){return new f0($,X,Y,W)}constructor($,X,Y,W){this.jobQueueService=$;this.messageBus=X;this.batchJobManager=Y;this.logger=W}start(){this.logger.debug("Job progress monitor ready (event-driven mode)")}stop(){this.logger.debug("Job progress monitor stopped")}createProgressReporter($){let X=p8.from(async(Y)=>{await this.emitJobProgress($,Y)});if(!X)throw Error("Failed to create ProgressReporter");return X}async emitBatchProgress($,X,Y){try{let W={totalOperations:X.totalOperations,completedOperations:X.completedOperations,failedOperations:X.failedOperations,currentOperation:X.currentOperation??"Processing batch...",errors:X.errors},J={id:$,type:"batch",status:X.status,metadata:Y,batchDetails:W};if(X.totalOperations>0)J.progress={current:X.completedOperations,total:X.totalOperations,percentage:Math.round(X.completedOperations/X.totalOperations*100)};await this.messageBus.send("job-progress",J,"job-progress-monitor",void 0,void 0,!0),this.logger.debug("Emitted batch progress update",{batchId:$,status:X.status,progress:`${X.completedOperations}/${X.totalOperations}`})}catch(W){this.logger.error("Error emitting batch progress update",{batchId:$,error:W})}}isBatchChild($,X){return!!X&&X!==$}async broadcastEvent($){await this.messageBus.send("job-progress",$,"job-progress-monitor",void 0,void 0,!0)}async emitJobProgress($,X){try{let Y=await this.jobQueueService.getStatus($);if(!Y){this.logger.warn("Job not found for progress update",{jobId:$});return}if(this.isBatchChild($,Y.metadata.rootJobId)){this.logger.debug("Skipping individual job progress for batch operation",{jobId:$,rootJobId:Y.metadata.rootJobId});return}let W=X.total??0,J={id:$,type:"job",status:"processing",metadata:Y.metadata,message:X.message};if(W>0)J.progress={current:X.progress,total:W,percentage:Math.round(X.progress/W*100)};await this.broadcastEvent(J)}catch(Y){this.logger.error("Error emitting job progress",{jobId:$,error:Y})}}async emitJobCompletion($){await this.emitJobStatusEvent($,"completed")}async emitJobFailure($){await this.emitJobStatusEvent($,"failed")}async emitJobStatusEvent($,X){try{let Y=await this.jobQueueService.getStatus($);if(!Y){this.logger.warn(`Cannot emit ${X} for unknown job`,{jobId:$});return}if(this.isBatchChild($,Y.metadata.rootJobId)){this.logger.debug(`Skipping individual job ${X} for batch operation`,{jobId:$,rootJobId:Y.metadata.rootJobId});return}let W={id:$,type:"job",status:X,message:this.extractStatusMessage(Y,X),metadata:Y.metadata,jobDetails:{jobType:Y.type,priority:Y.priority,retryCount:Y.retryCount}};await this.broadcastEvent(W),this.logger.debug(`Emitted job ${X} event`,{jobId:$})}catch(Y){this.logger.error(`Error emitting job ${X} event`,{jobId:$,error:Y})}}extractStatusMessage($,X){if(X==="failed")return $.lastError??void 0;if(!$.result)return;try{let Y=typeof $.result==="string"?JSON.parse($.result):$.result;if(Y.message)return Y.message;if(Y.routesBuilt!==void 0)return`${Y.routesBuilt} routes built`}catch{}return}getStats(){return{isRunning:!0}}async handleJobStatusChange($,X,Y){try{if(await this.emitJobStatusEvent($,X),Y&&this.isBatchChild($,Y.rootJobId))try{let W=Y.rootJobId,J=await this.batchJobManager.getBatchStatus(W);if(J){let U=J.metadata??Y;await this.emitBatchProgress(W,J,U)}}catch(W){this.logger.warn("Failed to emit batch progress",{jobId:$,rootJobId:Y.rootJobId,error:W})}}catch(W){this.logger.error("Failed to handle job status change",{jobId:$,status:X,error:W})}}}var U_=A(()=>{R$()});var G_=A(()=>{R$()});var K$$;var H_=A(()=>{aW();R$();K$$=Z.object({id:Z.string(),type:Z.string(),data:Z.string(),status:Z.enum(["pending","processing","completed","failed"]),source:Z.string().nullable(),priority:Z.number(),retryCount:Z.number(),maxRetries:Z.number(),lastError:Z.string().nullable(),createdAt:Z.number(),scheduledFor:Z.number(),startedAt:Z.number().nullable(),completedAt:Z.number().nullable(),metadata:jY,result:Z.unknown().nullable().optional()})});function eW($,X,Y){return async(W,J,U,H)=>{let{metadata:D,...V}=H??{},K={source:X,...H?.rootJobId&&{rootJobId:H.rootJobId},...V,metadata:{operationType:"data_processing",pluginId:X,...U&&{interfaceType:U.interfaceType,channelId:U.channelId},...D}},Q=Y&&!W.includes(":")?`${X}:${W}`:W;return $.enqueue(Q,J,K)}}function $U($,X){return async(Y,W)=>{let J=W1(),U=Y.map((D)=>({...D,type:D.type.includes(":")?D.type:`${X}:${D.type}`})),H={...W,source:X,rootJobId:J,metadata:{...W?.metadata,operationType:"batch_processing",pluginId:X}};return await $.enqueueBatch(U,H,J,X),J}}function XU($,X){return(Y,W)=>{let J=Y.includes(":")?Y:`${X}:${Y}`;$.registerHandler(J,W,X)}}var D_=A(()=>{R$()});var b9=A(()=>{Y_();J_();W_();U_();G_();H_();DX();aW();D_()});var LY=A(()=>{R$();kV();b9()});var y$;var EY=A(()=>{K8();S9();y$=k0("entities",{id:W6("id").notNull(),entityType:W6("entityType").notNull(),content:W6("content").notNull(),contentHash:W6("contentHash").notNull(),metadata:W6("metadata",{mode:"json"}).$type().notNull().default(S`'{}'`),created:a4("created").notNull().$defaultFn(()=>Date.now()),updated:a4("updated").notNull().$defaultFn(()=>Date.now())},($)=>{return{pk:mW({columns:[$.id,$.entityType]})}})});import{createClient as K_}from"@libsql/client";function fK($){let X=$.url,Y=$.authToken??process.env.DATABASE_AUTH_TOKEN,W=Y?K_({url:X,authToken:Y}):K_({url:X});return{db:v0(W,{schema:{entities:y$}}),client:W,url:X}}async function gK($,X){if(X.startsWith("file:"))await $.execute("PRAGMA journal_mode = WAL"),await $.execute("PRAGMA busy_timeout = 5000")}async function mK($){await $.execute(`
183
- CREATE VIRTUAL TABLE IF NOT EXISTS entity_fts USING fts5(
184
- entity_id UNINDEXED,
185
- entity_type UNINDEXED,
186
- content
187
- )
188
- `)}var uK=A(()=>{RY();EY()});var Q_;var F_=A(()=>{S9();Q_=yW({dataType(){return"F32_BLOB(1536)"},toDriver($){return Buffer.from($.buffer)},fromDriver($){return new Float32Array($.buffer,$.byteOffset,$.byteLength/4)}})});var h1;var PY=A(()=>{S9();F_();h1=k0("embeddings",{entityId:W6("entity_id").notNull(),entityType:W6("entity_type").notNull(),embedding:Q_("embedding").notNull(),contentHash:W6("content_hash").notNull()},($)=>{return{pk:mW({columns:[$.entityId,$.entityType]})}})});import{createClient as q_}from"@libsql/client";function pK($){let X=$.url,Y=$.authToken??process.env.DATABASE_AUTH_TOKEN,W=Y?q_({url:X,authToken:Y}):q_({url:X});return{db:v0(W,{schema:{embeddings:h1}}),client:W,url:X}}async function cK($,X){if(X.startsWith("file:"))await $.execute("PRAGMA journal_mode = WAL"),await $.execute("PRAGMA busy_timeout = 5000")}async function dK($,X){await $.execute(`
189
- CREATE TABLE IF NOT EXISTS embeddings (
190
- entity_id TEXT NOT NULL,
191
- entity_type TEXT NOT NULL,
192
- embedding F32_BLOB(${X}) NOT NULL,
193
- content_hash TEXT NOT NULL,
194
- PRIMARY KEY(entity_id, entity_type)
195
- )
196
- `)}async function lK($){await $.execute(`
197
- CREATE INDEX IF NOT EXISTS embeddings_embedding_idx
198
- ON embeddings(libsql_vector_idx(embedding))
199
- `)}async function iK($,X){await $.execute(`ATTACH DATABASE '${X}' AS emb`)}function rK($){return $.startsWith("file:")?$.slice(5):$}var nK=A(()=>{RY();PY()});class y1{static instance=null;entitySchemas=new Map;entityAdapters=new Map;entityConfigs=new Map;createInterceptors=new Map;frontmatterExtensions=new Map;logger;static getInstance($){return y1.instance??=new y1($),y1.instance}static resetInstance(){y1.instance=null}static createFresh($){return new y1($)}constructor($){this.logger=$}registerEntityType($,X,Y,W){if(this.logger.debug(`Registering entity type: ${$}`),this.entitySchemas.has($))throw Error(`Entity type registration failed for ${$}: Entity type is already registered`);if(this.entitySchemas.set($,X),this.entityAdapters.set($,Y),W)this.entityConfigs.set($,W);this.logger.debug(`Registered entity type: ${$}`)}getSchema($){let X=this.entitySchemas.get($);if(!X)throw Error(`Entity type registration failed for ${$}: No schema registered for entity type`);return X}getAdapter($){let X=this.entityAdapters.get($);if(!X)throw Error(`Entity type registration failed for ${$}: No adapter registered for entity type`);let Y=this.mergeExtensions($,X.frontmatterSchema);if(!Y||Y===X.frontmatterSchema)return X;return Object.create(X,{frontmatterSchema:{value:Y,enumerable:!0}})}hasEntityType($){return this.entitySchemas.has($)&&this.entityAdapters.has($)}validateEntity($,X){return this.getSchema($).parse(X)}getAllEntityTypes(){return Array.from(this.entitySchemas.keys())}getEntityTypeConfig($){return this.entityConfigs.get($)??{}}getWeightMap(){let $={};for(let[X,Y]of this.entityConfigs)if(Y.weight!==void 0)$[X]=Y.weight;return $}registerCreateInterceptor($,X){this.createInterceptors.set($,X)}getCreateInterceptor($){return this.createInterceptors.get($)}extendFrontmatterSchema($,X){let Y=this.entityAdapters.get($);if(!Y)throw Error(`Cannot extend frontmatter schema for ${$}: entity type is not registered`);if(!Y.frontmatterSchema)throw Error(`Cannot extend frontmatter schema for ${$}: adapter has no frontmatterSchema`);let W=this.frontmatterExtensions.get($)??[];W.push(X),this.frontmatterExtensions.set($,W),this.logger.debug(`Extended frontmatter schema for entity type: ${$}`)}getEffectiveFrontmatterSchema($){let X=this.entityAdapters.get($);return this.mergeExtensions($,X?.frontmatterSchema)}mergeExtensions($,X){if(!X)return;let Y=this.frontmatterExtensions.get($);if(!Y?.length)return X;let W=X;for(let J of Y)W=W.extend(J.shape);return W}}class Q8{static instance=null;logger;embeddingService;entityService;messageBus;static getInstance($,X,Y){return Q8.instance??=new Q8($,X,Y),Q8.instance}static resetInstance(){Q8.instance=null}static createFresh($,X,Y){return new Q8($,X,Y)}constructor($,X,Y){if(this.logger=Z6.getInstance().child("EmbeddingJobHandler"),this.embeddingService=X,this.entityService=$,Y)this.messageBus=Y}async process($,X,Y){try{this.logger.debug("Processing embedding job",{jobId:X,entityId:$.id,entityType:$.entityType,contentHash:$.contentHash}),await Y.report({progress:0,total:2,message:`Generating embedding for ${$.entityType} ${$.id}`});let W=await this.entityService.getEntity($.entityType,$.id);if(!W){this.logger.warn("Entity no longer exists, skipping embedding job",{jobId:X,entityId:$.id,entityType:$.entityType,operation:$.operation});return}if(W.contentHash!==$.contentHash){this.logger.info("Entity content changed since job created, skipping stale embedding",{jobId:X,entityId:$.id,entityType:$.entityType,jobContentHash:$.contentHash,currentContentHash:W.contentHash});return}let{embedding:J,usage:U}=await this.embeddingService.generateEmbedding(W.content);if(this.logger.info("ai:usage",{operation:"embedding",provider:"openai",model:"text-embedding-3-small",inputTokens:U.tokens,outputTokens:0}),await Y.report({progress:1,total:2,message:`Storing embedding for ${$.entityType} ${$.id}`}),await this.entityService.storeEmbedding({entityId:$.id,entityType:$.entityType,embedding:J,contentHash:$.contentHash}),this.messageBus)this.logger.debug(`Emitting entity:embedding:ready event for ${$.entityType}:${$.id}`),await this.messageBus.send("entity:embedding:ready",{entityType:$.entityType,entityId:$.id,entity:W},"entity-service",void 0,void 0,!0);await Y.report({progress:2,total:2,message:`Completed embedding for ${$.entityType} ${$.id}`}),this.logger.debug("Embedding job completed successfully",{jobId:X,entityId:$.id,embeddingDimensions:J.length})}catch(W){throw this.logger.error("Embedding job failed",{jobId:X,entityId:$.id,entityType:$.entityType,error:W}),W}}async onError($,X,Y){this.logger.error("Embedding job error handler called",{jobId:Y,entityId:X.id,entityType:X.entityType,contentHash:X.contentHash,errorMessage:$.message,errorStack:$.stack})}validateAndParse($){try{let X=Q$$.parse($);return this.logger.debug("Embedding job data validation successful",{entityId:X.id,entityType:X.entityType,contentHash:X.contentHash}),X}catch(X){return this.logger.warn("Invalid embedding job data",{data:$,validationError:X instanceof Z.ZodError?X.issues:X}),null}}}var Q$$;var oK=A(()=>{R$();Q$$=Z.object({id:Z.string().min(1,"Entity ID is required"),entityType:Z.string().min(1,"Entity type is required"),contentHash:Z.string().min(1,"Content hash is required"),operation:Z.enum(["create","update"])})});function w_($,X,Y=F$$){let W=$.trim().replace(/\s+/g," ");if(W.length<=Y)return W;return X?.warn("Truncating search query that exceeds max length",{originalLength:W.length,truncatedLength:Y}),W.slice(0,Y)}class YU{db;embeddingService;serializer;logger;constructor($,X,Y,W){this.db=$,this.embeddingService=X,this.serializer=Y,this.logger=W.child("EntitySearch")}async search($,X){let Y=q$$.parse(X??{}),{limit:W,offset:J,types:U,excludeTypes:H,weight:D}=Y,V=D&&Object.keys(D).length>0,K=w_($,this.logger);this.logger.debug(`Searching entities with query (${K.length} chars)`);let{embedding:Q}=await this.embeddingService.generateEmbedding(K),q=JSON.stringify(Array.from(Q)),F="1.0";if(V)F=`CASE ${Object.entries(D).map(([O,N])=>`WHEN entityType = '${O}' THEN ${N}`).join(" ")} ELSE 1.0 END`;let w=[];if(U.length>0)w.push(S`${y$.entityType} IN (${S.join(U.map((z)=>S`${z}`),S`, `)})`);if(H.length>0)w.push(S`${y$.entityType} NOT IN (${S.join(H.map((z)=>S`${z}`),S`, `)})`);return this.searchWithAttachedDb(q,F,w,W,J,K)}static FTS_ALPHA=0.3;async searchWithAttachedDb($,X,Y,W,J,U){let H=YU.FTS_ALPHA,D=S`(1.0 - vector_distance_cos(emb_e.embedding, vector32(${$})) / 2.0) * ${S.raw(X)}`,V=S`vector_distance_cos(emb_e.embedding, vector32(${$}))`,K='"'+U.replace(/"/g,'""')+'"',Q=S`CASE WHEN EXISTS (
200
- SELECT 1 FROM entity_fts WHERE entity_fts MATCH ${K}
201
- AND entity_id = ${y$.id} AND entity_type = ${y$.entityType}
202
- ) THEN 1.0 ELSE 0.0 END`,q=S`(${1-H} * ${D}) + (${H} * ${Q})`,F=await this.db.select({id:y$.id,entityType:y$.entityType,content:y$.content,contentHash:y$.contentHash,created:y$.created,updated:y$.updated,metadata:y$.metadata,distance:V,weighted_score:q}).from(y$).innerJoin(S`emb.embeddings AS emb_e`,S`${y$.id} = emb_e.entity_id AND ${y$.entityType} = emb_e.entity_type`).where(Y4(S`${V} < 0.82`,...Y)).orderBy(A1(q)).limit(W).offset(J);return this.mapSearchResults(F,U)}async searchEntities($,X,Y){let W={types:[$],limit:Y?.limit??20,offset:0,sortBy:"relevance",sortDirection:"desc"};return this.search(X,W)}async searchWithDistances($){let X=w_($,this.logger),{embedding:Y}=await this.embeddingService.generateEmbedding(X),W=JSON.stringify(Array.from(Y)),J=S`vector_distance_cos(emb_e.embedding, vector32(${W}))`;return await this.db.select({entityId:y$.id,entityType:y$.entityType,distance:J}).from(y$).innerJoin(S`emb.embeddings AS emb_e`,S`${y$.id} = emb_e.entity_id AND ${y$.entityType} = emb_e.entity_type`).orderBy(S`${J} ASC`)}mapSearchResults($,X){let Y=[];for(let J of $)try{let U=typeof J.metadata==="string"?JSON.parse(J.metadata):J.metadata,H=this.serializer.reconstructEntity({id:J.id,entityType:J.entityType,content:J.content,contentHash:J.contentHash,created:J.created,updated:J.updated,metadata:U});Y.push({entity:H,score:J.weighted_score,excerpt:this.createExcerpt(J.content,X)})}catch(U){this.logger.error(`Failed to parse entity during search: ${U}`)}let W=X.length>50?X.substring(0,50)+"...":X;return this.logger.debug(`Found ${Y.length} results for query "${W}"`),Y}createExcerpt($,X){let W=X.toLowerCase(),U=$.toLowerCase().indexOf(W);if(U!==-1){let H=Math.max(0,U-50),D=Math.min($.length,U+W.length+50),V=$.slice(H,D);if(H>0)V="..."+V;if(D<$.length)V=V+"...";return V}return $.slice(0,200)+($.length>200?"...":"")}}var F$$=12000,q$$;var Z_=A(()=>{R$();K8();EY();q$$=Z.object({limit:Z.number().int().positive().optional().default(20),offset:Z.number().int().min(0).optional().default(0),types:Z.array(Z.string()).optional().default([]),excludeTypes:Z.array(Z.string()).optional().default([]),weight:Z.record(Z.string(),Z.number()).optional()})});class aK{entityRegistry;logger;constructor($,X){this.entityRegistry=$,this.logger=X.child("EntitySerializer")}serializeEntity($){return this.entityRegistry.getAdapter($.entityType).toMarkdown($)}deserializeEntity($,X){return this.entityRegistry.getAdapter(X).fromMarkdown($)}async convertToEntity($){try{return this.reconstructEntity($)}catch(X){let Y=g6(X);return this.logger.error(`Failed to parse entity of type ${$.entityType} with ID ${$.id}: ${Y}`),null}}async convertToEntities($,X){let Y=[];for(let W of $)try{Y.push(this.reconstructEntity(W))}catch(J){let U=g6(J);this.logger.error(`Failed to parse entity of type ${X} with ID ${W.id}: ${U}`)}return Y}reconstructEntity($){let Y=this.entityRegistry.getAdapter($.entityType).fromMarkdown($.content),{metadata:W,...J}=Y,U={id:$.id,entityType:$.entityType,content:$.content,contentHash:$.contentHash,created:new Date($.created).toISOString(),updated:new Date($.updated).toISOString(),...J,...$.metadata,metadata:$.metadata};return this.entityRegistry.validateEntity($.entityType,U)}prepareEntityForStorage($,X){let Y=this.entityRegistry.getAdapter(X),W=Y.toMarkdown($),J=Y.extractMetadata($);return{markdown:W,metadata:J}}}var z_=A(()=>{R$()});class sK{db;embeddingDb;serializer;logger;constructor($){this.db=$.db,this.embeddingDb=$.embeddingDb,this.serializer=$.serializer,this.logger=$.logger.child("EntityQueries")}async getEntityData($,X){this.logger.debug(`Getting entity of type ${$} with ID ${X}`);let Y=await this.db.select().from(y$).where(Y4(t$(y$.id,X),t$(y$.entityType,$))).limit(1);if(Y.length===0)return this.logger.debug(`Entity of type ${$} with ID ${X} not found`),null;let W=Y[0];if(!W)return null;return{id:W.id,entityType:W.entityType,content:W.content,contentHash:W.contentHash,created:W.created,updated:W.updated,metadata:W.metadata??{}}}async listEntities($,X={}){let Y=Z$$.parse(X),{limit:W,offset:J,sortFields:U,filter:H,publishedOnly:D}=Y;this.logger.debug(`Listing entities of type ${$} (limit: ${W}, offset: ${J}, filter: ${JSON.stringify(H)}, publishedOnly: ${D})`);let V=this.buildWhereConditions($,D,H?.metadata),K=this.buildOrderByClauses(U),Q=this.db.select().from(y$).where(Y4(...V)).orderBy(...K).offset(J),q=W!==void 0?await Q.limit(W):await Q,F=await this.serializer.convertToEntities(q.map((w)=>({id:w.id,entityType:w.entityType,content:w.content,contentHash:w.contentHash,created:w.created,updated:w.updated,metadata:w.metadata??{}})),$);return this.logger.debug(`Listed ${F.length} entities of type ${$}`),F}buildWhereConditions($,X,Y){let W=[t$(y$.entityType,$)];if(X)W.push(S`(json_extract(${y$.metadata}, '$.status') = 'published' OR json_extract(${y$.metadata}, '$.status') = 'active' OR json_extract(${y$.metadata}, '$.status') IS NULL)`);if(Y){for(let[J,U]of Object.entries(Y))if(U!==void 0){let H=`$.${J}`;W.push(S`json_extract(${y$.metadata}, ${H}) = ${U}`)}}return W}buildOrderByClauses($){if(!$||$.length===0)return[A1(y$.updated)];return $.flatMap(({field:X,direction:Y,nullsFirst:W})=>{let J=Y==="desc"?A1:k1;if(X==="created"){let H=y$.created;if(W)return[k1(JX(H)),J(H)];return[J(H)]}if(X==="updated"){let H=y$.updated;if(W)return[k1(JX(H)),J(H)];return[J(H)]}let U=S`json_extract(${y$.metadata}, '$.' || ${X})`;if(W)return[k1(JX(U)),J(U)];return[J(U)]})}async countEntities($,X={}){let Y=this.buildWhereConditions($,X.publishedOnly,X.filter?.metadata),W=await this.db.select({count:S`COUNT(*)`}).from(y$).where(Y4(...Y));return Number(W[0]?.count??0)}async getEntityCounts(){this.logger.debug("Getting entity counts by type");let $=await this.db.select({entityType:y$.entityType,count:S`COUNT(*)`.as("count")}).from(y$).groupBy(y$.entityType);return this.logger.debug(`Found ${$.length} entity types`),$.map((X)=>({entityType:X.entityType,count:Number(X.count)}))}async entityExists($,X){return(await this.db.select({id:y$.id}).from(y$).where(Y4(t$(y$.entityType,$),t$(y$.id,X))).limit(1)).length>0}async deleteEntity($,X){if(this.logger.debug(`Deleting entity of type ${$} with ID ${X}`),!await this.entityExists($,X))return this.logger.debug(`Entity of type ${$} with ID ${X} not found for deletion`),!1;return await this.embeddingDb.delete(h1).where(Y4(t$(h1.entityType,$),t$(h1.entityId,X))),await this.db.run(S`DELETE FROM entity_fts WHERE entity_id = ${X} AND entity_type = ${$}`),await this.db.delete(y$).where(Y4(t$(y$.entityType,$),t$(y$.id,X))),this.logger.debug(`Deleted entity of type ${$} with ID ${X}`),!0}}var w$$,Z$$;var O_=A(()=>{EY();PY();K8();R$();w$$=Z.object({field:Z.string(),direction:Z.enum(["asc","desc"]),nullsFirst:Z.boolean().optional()}),Z$$=Z.object({limit:Z.number().int().positive().optional(),offset:Z.number().int().min(0).optional().default(0),sortFields:Z.array(w$$).optional(),filter:Z.object({metadata:Z.record(Z.string(),Z.unknown()).optional()}).optional(),publishedOnly:Z.boolean().optional()})});import{createHash as z$$}from"crypto";function IY($){return z$$("sha256").update($).digest("hex")}var N_=()=>{};class tK{db;embeddingDb;entityRegistry;entitySerializer;entityQueries;jobQueueService;messageBus;logger;constructor($){if(this.db=$.db,this.embeddingDb=$.embeddingDb,this.entityRegistry=$.entityRegistry,this.entitySerializer=$.entitySerializer,this.entityQueries=$.entityQueries,this.jobQueueService=$.jobQueueService,this.logger=$.logger.child("EntityMutations"),$.messageBus)this.messageBus=$.messageBus}async createEntity($,X){this.logger.debug(`Creating entity asynchronously of type: ${$.entityType}`);let Y=new Date().toISOString(),W={...$,id:$.id??W1(),created:$.created??Y,updated:$.updated??Y,contentHash:IY($.content)},J=this.entityRegistry.validateEntity($.entityType,W),{markdown:U,metadata:H}=this.entitySerializer.prepareEntityForStorage(J,J.entityType),D=IY(U),V=J.id;if(X?.deduplicateId)V=await this.resolveUniqueId(J.id,J.entityType);return await this.db.insert(y$).values({id:V,entityType:J.entityType,content:U,contentHash:D,metadata:H,created:new Date(J.created).getTime(),updated:new Date(J.updated).getTime()}),await this.upsertFtsIndex(V,J.entityType,U),this.logger.debug(`Persisted entity ${J.entityType}:${V} immediately`),await this.emitEntityEvent("entity:created",J.entityType,V,{...J,id:V}),this.enqueueEmbeddingJob({entityId:V,entityType:J.entityType,contentHash:D,operation:"create",...X?.priority!==void 0&&{priority:X.priority},...X?.maxRetries!==void 0&&{maxRetries:X.maxRetries}})}async updateEntity($,X){this.logger.debug(`Updating entity asynchronously: ${$.entityType} with ID ${$.id}`);let Y={...$,updated:new Date().toISOString(),contentHash:IY($.content)},W=this.entityRegistry.validateEntity($.entityType,Y),{markdown:J,metadata:U}=this.entitySerializer.prepareEntityForStorage(W,W.entityType),H=IY(J);if((await this.db.select({contentHash:y$.contentHash}).from(y$).where(Y4(t$(y$.id,W.id),t$(y$.entityType,W.entityType))).limit(1))[0]?.contentHash===H)return this.logger.debug(`Skipping no-op update for ${W.entityType}:${W.id}`),{entityId:W.id,jobId:"",skipped:!0};return await this.db.update(y$).set({content:J,contentHash:H,metadata:U,updated:new Date(W.updated).getTime()}).where(Y4(t$(y$.id,W.id),t$(y$.entityType,W.entityType))),await this.upsertFtsIndex(W.id,W.entityType,J),this.logger.debug(`Updated entity ${W.entityType}:${W.id} immediately`),await this.emitEntityEvent("entity:updated",W.entityType,W.id,W),this.enqueueEmbeddingJob({entityId:W.id,entityType:W.entityType,contentHash:H,operation:"update",...X?.priority!==void 0&&{priority:X.priority},...X?.maxRetries!==void 0&&{maxRetries:X.maxRetries}})}async deleteEntity($,X){let Y=await this.entityQueries.deleteEntity($,X);if(Y)await this.emitEntityEvent("entity:deleted",$,X);return Y}async upsertEntity($,X){if(this.logger.debug(`Upserting entity of type ${$.entityType} with ID ${$.id}`),await this.entityQueries.entityExists($.entityType,$.id))return{...await this.updateEntity($,X),created:!1};else return{...await this.createEntity($,X),created:!0}}async storeEmbedding($){await this.embeddingDb.insert(h1).values({entityId:$.entityId,entityType:$.entityType,embedding:$.embedding,contentHash:$.contentHash}).onConflictDoUpdate({target:[h1.entityId,h1.entityType],set:{embedding:$.embedding,contentHash:$.contentHash}})}async upsertFtsIndex($,X,Y){await this.db.run(S`DELETE FROM entity_fts WHERE entity_id = ${$} AND entity_type = ${X}`),await this.db.run(S`INSERT INTO entity_fts (entity_id, entity_type, content) VALUES (${$}, ${X}, ${Y})`)}async resolveUniqueId($,X){if(!await this.entityQueries.entityExists(X,$))return $;for(let J=2;J<=100;J++){let U=`${$}-${J}`;if(!await this.entityQueries.entityExists(X,U))return this.logger.debug(`Deduplicated entity ID: ${$} \u2192 ${U}`),U}let W=`${$}-${W1().slice(0,8)}`;return this.logger.warn(`Could not deduplicate entity ID after 100 attempts, using random suffix: ${W}`),W}async emitEntityEvent($,X,Y,W){if(!this.messageBus)return;this.logger.debug(`Emitting ${$} for ${X}:${Y}`);let J={entityType:X,entityId:Y};if(W)J.entity=W;await this.messageBus.send($,J,"entity-service",void 0,void 0,!0)}async enqueueEmbeddingJob($){let{entityId:X,entityType:Y,contentHash:W,operation:J,priority:U,maxRetries:H}=$;if(this.entityRegistry.getEntityTypeConfig(Y).embeddable===!1)return this.logger.debug(`Skipping embedding for non-embeddable entity type: ${Y}:${X}`),{entityId:X,jobId:"",skipped:!1};let V={id:X,entityType:Y,contentHash:W,operation:J},K=W1(),Q=await this.jobQueueService.enqueue("shell:embedding",V,{...U!==void 0&&{priority:U},...H!==void 0&&{maxRetries:H},source:"entity-service",rootJobId:K,metadata:{operationType:"data_processing",operationTarget:X}});return this.logger.debug(`Queued embedding job for ${Y}:${X} (job: ${Q})`),{entityId:X,jobId:Q,skipped:!1}}}var A_=A(()=>{R$();N_();EY();PY();K8()});function N$$($){return $.includes("entity://image/")}function B_($){return!A$$.has($)}class eK{logger;constructor($){this.logger=$.child("ContentResolver")}detectReferences($){let X=[],Y=new RegExp(O$$.source,"g"),W;while((W=Y.exec($))!==null)X.push({alt:W[1]??"",imageId:W[2]??"",originalMarkdown:W[0]});return X}async resolve($,X){if(!N$$($))return{content:$,resolvedCount:0,failedCount:0};let Y=this.detectReferences($);if(Y.length===0)return{content:$,resolvedCount:0,failedCount:0};let W=[...new Set(Y.map((V)=>V.imageId))],J=new Map;for(let V of W)try{let K=await X.getEntityRaw("image",V);if(K?.content)J.set(V,K.content);else this.logger.warn("Image entity not found",{imageId:V})}catch(K){this.logger.warn("Failed to fetch image entity",{imageId:V,error:g6(K)})}let U=$,H=0,D=0;for(let V of Y){let K=J.get(V.imageId);if(K){let Q=`![${V.alt}](${K})`;U=U.replace(V.originalMarkdown,Q),H++}else D++}if(H>0)this.logger.debug("Resolved image references",{resolvedCount:H,failedCount:D});return{content:U,resolvedCount:H,failedCount:D}}}var O$$,A$$;var M_=A(()=>{R$();O$$=/!\[([^\]]*)\]\(entity:\/\/image\/([^)]+)\)/g;A$$=new Set(["image"])});class f1{static instance=null;db;dbClient;dbUrl;embeddingDb;embeddingDbClient;dbInitPromise;entityRegistry;logger;jobQueueService;entitySearch;entitySerializer;entityQueries;entityMutations;contentResolver;static getInstance($){return f1.instance??=new f1($),f1.instance}static resetInstance(){if(f1.instance)f1.instance.close(),f1.instance=null}close(){this.embeddingDbClient.close(),this.dbClient.close()}static createFresh($){return new f1($)}constructor($){let{db:X,client:Y,url:W}=fK($.dbConfig);this.db=X,this.dbClient=Y,this.dbUrl=W;let J=pK($.embeddingDbConfig);if(this.embeddingDb=J.db,this.embeddingDbClient=J.client,this.entityRegistry=$.entityRegistry??y1.getInstance(Z6.getInstance()),this.logger=($.logger??Z6.getInstance()).child("EntityService"),!$.jobQueueService)throw Error("JobQueueService is required for EntityService initialization");this.jobQueueService=$.jobQueueService,this.entitySerializer=new aK(this.entityRegistry,this.logger),this.entityQueries=new sK({db:this.db,serializer:this.entitySerializer,logger:this.logger,embeddingDb:this.embeddingDb}),this.entitySearch=new YU(this.db,$.embeddingService,this.entitySerializer,this.logger),this.entityMutations=new tK({db:this.db,entityRegistry:this.entityRegistry,entitySerializer:this.entitySerializer,entityQueries:this.entityQueries,jobQueueService:this.jobQueueService,logger:this.logger,...$.messageBus&&{messageBus:$.messageBus},embeddingDb:this.embeddingDb}),this.contentResolver=new eK(this.logger);let U=Q8.createFresh(this,$.embeddingService,$.messageBus);this.jobQueueService.registerHandler("shell:embedding",U),this.dbInitPromise=this.initializeDatabase($.embeddingDbConfig,$.embeddingService.dimensions).catch((H)=>{this.logger.warn("Failed to initialize database settings (non-fatal)",H)})}async initialize(){await this.dbInitPromise}async initializeDatabase($,X){await gK(this.dbClient,this.dbUrl),await mK(this.dbClient),await cK(this.embeddingDbClient,$.url),await dK(this.embeddingDbClient,X),await lK(this.embeddingDbClient),await iK(this.dbClient,rK($.url))}async createEntity($,X){return this.entityMutations.createEntity($,X)}async createEntityFromMarkdown($,X){let Y=this.entitySerializer.deserializeEntity($.markdown,$.entityType);return this.entityMutations.createEntity({...Y,id:$.id,entityType:$.entityType,content:$.markdown,metadata:Y.metadata??{}},X)}async updateEntity($,X){return this.entityMutations.updateEntity($,X)}async deleteEntity($,X){return this.entityMutations.deleteEntity($,X)}async upsertEntity($,X){return this.entityMutations.upsertEntity($,X)}async storeEmbedding($){return this.entityMutations.storeEmbedding($)}async getEntity($,X){let Y=await this.getEntityRaw($,X);if(!Y)return null;if(B_($)&&Y.content){let W=await this.contentResolver.resolve(Y.content,this);if(W.resolvedCount>0)return{...Y,content:W.content}}return Y}async getEntityRaw($,X){let Y=await this.entityQueries.getEntityData($,X);if(!Y)return null;return this.entitySerializer.convertToEntity(Y)}async listEntities($,X){return this.entityQueries.listEntities($,X)}async countEntities($,X){return this.entityQueries.countEntities($,X)}async getEntityCounts(){return this.entityQueries.getEntityCounts()}async search($,X){return this.entitySearch.search($,X)}async searchEntities($,X,Y){return this.entitySearch.searchEntities($,X,Y)}async searchWithDistances($){return this.entitySearch.searchWithDistances($)}async countEmbeddings(){return(await this.embeddingDb.select({count:S`count(*)`}).from(h1))[0]?.count??0}serializeEntity($){return this.entitySerializer.serializeEntity($)}deserializeEntity($,X){return this.entitySerializer.deserializeEntity($,X)}getEntityTypes(){return this.entityRegistry.getAllEntityTypes()}hasEntityType($){return this.entityRegistry.hasEntityType($)}getWeightMap(){return this.entityRegistry.getWeightMap()}async getAsyncJobStatus($){let X=await this.jobQueueService.getStatus($);if(!X)return null;return{status:X.status,...X.lastError&&{error:X.lastError}}}}var j_=A(()=>{uK();nK();PY();K8();R$();oK();Z_();z_();O_();A_();M_()});function KX($,X){if(Object.keys(X).length===0)return $;let Y=Object.fromEntries(Object.entries(X).filter(([,W])=>W!==void 0));return JU.default.stringify($,Y)}function $Q($){if($ instanceof Date)return $.toISOString();if(Array.isArray($))return $.map($Q);if($!==null&&typeof $==="object"){let X={};for(let[Y,W]of Object.entries($))X[Y]=$Q(W);return X}return $}function B1($,X){let{content:Y,data:W}=JU.default($),J=$Q(W);return{content:Y.trim(),metadata:X.parse(J)}}function XQ($){if(Object.keys($).length===0)return"";let Y=JU.default.stringify("",$).match(/^---\n[\s\S]*?\n---/);return Y?Y[0]:""}var JU;var WU=A(()=>{JU=n1(cH(),1)});class UU{format($){let X=[];X.push(`\\[${$.id}\\]`);let Y=$.content,W={};if($.content.trim())try{let J=B1($.content,Z.record(Z.string(),Z.unknown()));Y=J.content,W=J.metadata}catch{Y=$.content}if(Y.trim()){let J=Y.trim();J=VV(J);let U=W.title??$.metadata.title??$.metadata.name;if(U){if(J.split(`
203
- `)[0]?.trim().toLowerCase()===String(U).toLowerCase())J=J.split(`
204
- `).slice(1).join(`
205
- `).trim()}if(J){let H=J.replace(/\s+/g," ").trim(),D=H.length>500?H.substring(0,500)+"...":H;X.push(D)}}return X.join(`
206
-
207
- `)}parse($){throw Error("BaseEntityFormatter is for display only. Use BaseEntityAdapter for parsing operations.")}}var R_=A(()=>{R$();WU()});class g0{entityType;schema;frontmatterSchema;isSingleton;hasBody;supportsCoverImage;fmSchema;bodyFormatter;constructor($){if(this.entityType=$.entityType,this.schema=$.schema,this.frontmatterSchema=$.frontmatterSchema,this.fmSchema=$.frontmatterSchema,this.bodyFormatter=$.bodyFormatter??B$$,$.isSingleton!==void 0)this.isSingleton=$.isSingleton;if($.hasBody!==void 0)this.hasBody=$.hasBody;if($.supportsCoverImage!==void 0)this.supportsCoverImage=$.supportsCoverImage}toMarkdown($){let X=this.renderBody($),W={...this.readExistingFrontmatter($.content)},J=Object.keys(this.frontmatterSchema.shape);for(let[U,H]of Object.entries($.metadata))if(J.includes(U))W[U]=H;return this.buildMarkdown(X,W)}renderBody($){return this.extractBody($.content)}readExistingFrontmatter($){try{return B1($,Z.record(Z.unknown())).metadata}catch{return{}}}extractMetadata($){return $.metadata}parseFrontMatter($,X){return B1($,X).metadata}getBodyTemplate(){return this.bodyFormatter.generateBodyTemplate()}generateFrontMatter($){let X=$.metadata;return XQ(X)}extractBody($){try{return B1($,Z.record(Z.unknown())).content}catch{return $}}parseFrontmatter($){return B1($,this.fmSchema).metadata}buildMarkdown($,X){return KX($,X)}}var B$$;var YQ=A(()=>{R$();WU();B$$={generateBodyTemplate:()=>""}});var D0;var JQ=A(()=>{R$();D0=Z.object({id:Z.string(),entityType:Z.string(),content:Z.string(),created:Z.string().datetime(),updated:Z.string().datetime(),metadata:Z.record(Z.string(),Z.unknown()),contentHash:Z.string()})});var _Y;var L_=A(()=>{R$();JQ();YQ();_Y=class _Y extends g0{constructor(){super({entityType:"base",schema:D0,frontmatterSchema:Z.object({})})}toMarkdown($){return $.content}fromMarkdown($){return{content:$}}}});var E_=A(()=>{YQ();L_()});class QX{cache=null;cacheParseError=null;logger;entityService;entityType;defaultBody;constructor($,X,Y,W){this.entityService=$,this.logger=X.child(this.constructor.name),this.entityType=Y,this.defaultBody=W}async initialize(){if(await this.load(),!this.cache){if(await this.load(),this.cache)return;this.logger.info(`No ${this.entityType} found, creating default ${this.entityType}`);try{let $=this.createContent(this.defaultBody);await this.entityService.createEntity({id:this.entityType,entityType:this.entityType,content:$,metadata:{}}),await this.load(),this.logger.info(`Default ${this.entityType} created successfully`)}catch($){this.logger.error(`Failed to create default ${this.entityType}`,{error:$})}}}get(){if(this.cache&&!this.cacheParseError)return this.parseBody(this.cache.content);return this.defaultBody}getContent(){if(this.cache)return this.cache.content;return this.createContent(this.defaultBody)}async refreshCache(){await this.load()}async load(){try{let $=await this.entityService.getEntity(this.entityType,this.entityType);if(this.cache=$,this.cacheParseError=null,$)try{this.parseBody($.content),this.logger.debug(`${this.entityType} loaded`)}catch(X){this.cacheParseError=X instanceof Error?X:Error(String(X)),this.logger.error(`Failed to parse ${this.entityType} \u2014 using default. Fix the entity content to clear this error.`,{error:this.cacheParseError.message})}else this.logger.debug(`No ${this.entityType} found in database`)}catch($){this.logger.warn(`Failed to load ${this.entityType}`,{error:$}),this.cache=null,this.cacheParseError=null}}}class m0{static instance=null;dataSources=new Map;logger;static getInstance($){return m0.instance??=new m0($),m0.instance}static resetInstance(){m0.instance=null}static createFresh($){return new m0($)}constructor($){this.logger=$.child("DataSourceRegistry")}register($){let X=$.id.includes(":")?$.id:`shell:${$.id}`;this.registerWithId(X,$)}registerWithId($,X){if(this.dataSources.has($)){let Y=Error(`DataSource with id "${$}" already exists`);throw this.logger.error("DataSource registration failed",{error:Y,id:$}),Y}this.dataSources.set($,X),this.logger.debug("DataSource registered",{id:$,name:X.name})}unregister($){if(this.dataSources.delete($))this.logger.debug("DataSource unregistered",{id:$});else this.logger.warn("Attempted to unregister non-existent DataSource",{id:$})}get($){return this.dataSources.get($)}has($){return this.dataSources.has($)}list(){return Array.from(this.dataSources.values())}getIds(){return Array.from(this.dataSources.keys())}getByCapability($){return this.list().filter((X)=>{switch($){case"canFetch":return!!X.fetch;case"canGenerate":return!!X.generate;case"canTransform":return!!X.transform;default:return!1}})}find($){return this.list().filter($)}clear(){let $=this.dataSources.size;this.dataSources.clear(),this.logger.debug("DataSource registry cleared",{count:$})}}var P_;var I_=A(()=>{R$();P_=Z.object({currentPage:Z.number(),totalPages:Z.number(),totalItems:Z.number(),pageSize:Z.number(),hasNextPage:Z.boolean(),hasPrevPage:Z.boolean()})});async function __($,X,Y,W){try{let J=await $.getEntity(X,Y);if(J)return J;let U=await $.listEntities(X,{limit:1,filter:{metadata:{slug:Y}}});if(U[0])return U[0];let H=await $.listEntities(X,{limit:1,filter:{metadata:{title:Y}}});if(H[0])return H[0];return null}catch(J){if(W)W.error(`Failed to find entity ${X}:${Y}`,{error:J});return null}}async function x9($,X,Y,W,J="Entity"){let U=await __($,X,Y,W);if(!U)return{ok:!1,error:`${J} not found: ${X}/${Y}`};return{ok:!0,entity:U}}var H1=A(()=>{j_();oK();R_();E_();nK();JQ();WU();I_()});function j$$($){return $.replace(/:/g,"-")}function R$$($){return $.split(/[:.-]/).map((X)=>X.charAt(0).toUpperCase()+X.slice(1)).join(" ")}async function FX($,X,Y){let W=WQ.get(X);if(W!==void 0)return W;let J=j$$(X),U;try{U=await $.getEntity("prompt",J)}catch{return Y}if(U?.content){let H=B1(U.content,Z.record(Z.unknown())).content;return WQ.set(X,H),H}try{let H=R$$(X),D=KX(Y,{title:H,target:X});await $.createEntity({id:J,entityType:"prompt",content:D,metadata:{title:H,target:X,slug:J}})}catch{}return WQ.set(X,Y),Y}async function UQ($,X){let Y=$.list().filter((W)=>!!W.basePrompt);return await Promise.all(Y.map((W)=>FX(X,W.name,W.basePrompt))),Y.length}var WQ;var GU=A(()=>{H1();R$();WQ=new Map});var HQ=A(()=>{LY();GU();e5()});var C_=A(()=>{PW();HQ()});var DQ=A(()=>{LY();GU()});var Vx$;var S_=A(()=>{PW();R$();DQ();Vx$=Z.object({})});var VQ=A(()=>{LY()});var KQ=A(()=>{PW();VQ()});var QQ;var b_=A(()=>{QQ={pluginsRegistered:"system:plugins:ready",initialSyncCompleted:"sync:initial:completed"}});var x_,I$$;var k_=A(()=>{H1();R$();x_=Z.object({id:Z.string().optional(),limit:Z.number().optional(),page:Z.number().optional(),pageSize:Z.number().optional(),baseUrl:Z.string().optional()}).passthrough(),I$$=Z.object({entityType:Z.string().optional(),query:x_.optional()}).passthrough()});var v_=A(()=>{b9();R$()});var b4,u4,k9;var FQ=A(()=>{S9();b4=k0("conversations",{id:W6("id").primaryKey(),sessionId:W6("session_id").notNull(),interfaceType:W6("interface_type").notNull(),channelId:W6("channel_id").notNull(),started:W6("started").notNull(),lastActive:W6("last_active").notNull(),metadata:W6("metadata"),created:W6("created").notNull(),updated:W6("updated").notNull()},($)=>({sessionIdx:U0("idx_conversations_session").on($.sessionId),channelIdx:U0("idx_conversations_channel").on($.channelId),interfaceSessionIdx:U0("idx_conversations_interface_session").on($.interfaceType,$.sessionId),interfaceChannelIdx:U0("idx_conversations_interface_channel").on($.interfaceType,$.channelId)})),u4=k0("messages",{id:W6("id").primaryKey(),conversationId:W6("conversation_id").notNull().references(()=>b4.id,{onDelete:"cascade"}),role:W6("role").notNull(),content:W6("content").notNull(),timestamp:W6("timestamp").notNull(),metadata:W6("metadata")},($)=>({conversationIdx:U0("idx_messages_conversation").on($.conversationId),timestampIdx:U0("idx_messages_timestamp").on($.timestamp)})),k9=k0("summary_tracking",{conversationId:W6("conversation_id").primaryKey().references(()=>b4.id,{onDelete:"cascade"}),lastSummarizedAt:W6("last_summarized_at"),lastMessageId:W6("last_message_id"),messagesSinceSummary:a4("messages_since_summary").default(0),updated:W6("updated").notNull()})});import{createClient as h_}from"@libsql/client";function qQ($){let X=$.url,Y=$.authToken??process.env.CONVERSATION_DATABASE_AUTH_TOKEN,W=Y?h_({url:X,authToken:Y}):h_({url:X});return{db:v0(W,{schema:{conversations:b4,messages:u4,summaryTracking:k9}}),client:W,url:X}}var wQ=A(()=>{RY();FQ()});class M1{db;logger;static instance=null;messageBus;config;dbClient=null;constructor($,X,Y,W={}){this.db=$;this.logger=X;this.messageBus=Y,this.config={digestTriggerInterval:5,digestWindowSize:10,...W}}static getInstance($,X,Y,W){if(!M1.instance){let{db:J,client:U}=qQ(Y),H=new M1(J,$,X,W);H.dbClient=U,M1.instance=H}return M1.instance}static resetInstance(){if(M1.instance)M1.instance.close(),M1.instance=null}close(){this.dbClient?.close()}static createFresh($,X,Y,W){return new M1($,X,Y,W)}async startConversation($,X,Y,W){let J=new Date().toISOString();if(await this.getConversation($))return await this.db.update(b4).set({lastActive:J,updated:J}).where(t$(b4.id,$)),this.logger.debug("Resumed existing conversation",{conversationId:$,interfaceType:X}),$;let H={id:$,sessionId:$,interfaceType:X,channelId:Y,started:J,lastActive:J,created:J,updated:J,metadata:JSON.stringify(W)};await this.db.insert(b4).values(H);let D={conversationId:$,messagesSinceSummary:0,updated:J};return await this.db.insert(k9).values(D),this.logger.debug("Started new conversation",{conversationId:$,sessionId:$,interfaceType:X}),await this.messageBus.send("conversation:started",{conversationId:$,sessionId:$,interfaceType:X,timestamp:J},"conversation-service",void 0,void 0,!0),$}async addMessage($,X,Y,W){let J=new Date().toISOString(),U=W1(12),H={id:U,conversationId:$,role:X,content:Y,timestamp:J,metadata:W?JSON.stringify(W):null};await this.db.insert(u4).values(H),await this.db.update(b4).set({lastActive:J,updated:J}).where(t$(b4.id,$)),await this.db.update(k9).set({messagesSinceSummary:S`${k9.messagesSinceSummary} + 1`,lastMessageId:U,updated:J}).where(t$(k9.conversationId,$)),this.logger.debug("Added message to conversation",{conversationId:$,role:X,messageId:U}),await this.messageBus.send("conversation:messageAdded",{conversationId:$,messageId:U,role:X,content:Y,metadata:W,timestamp:J},"conversation-service",void 0,void 0,!0),await this.checkAndBroadcastDigest($,J)}async getMessages($,X={}){let{limit:Y=20,range:W}=X;if(W){let J=W.start-1,U=W.end-W.start+1;return await this.db.select().from(u4).where(t$(u4.conversationId,$)).orderBy(k1(u4.timestamp)).limit(U).offset(J)}else return(await this.db.select().from(u4).where(t$(u4.conversationId,$)).orderBy(A1(u4.timestamp)).limit(Y)).reverse()}async getConversation($){return(await this.db.select().from(b4).where(t$(b4.id,$)).limit(1))[0]??null}async searchConversations($,X){let Y=`%${$.toLowerCase()}%`;return(await this.db.selectDistinct({conversation:b4}).from(b4).leftJoin(u4,t$(u4.conversationId,b4.id)).where(X?S`lower(${u4.content}) LIKE ${Y} AND ${b4.sessionId} = ${X}`:S`lower(${u4.content}) LIKE ${Y}`).orderBy(A1(b4.lastActive))).map((J)=>J.conversation)}async checkAndBroadcastDigest($,X){let[Y]=await this.db.select({count:uP()}).from(u4).where(t$(u4.conversationId,$)),W=Number(Y?.count??0),J=this.config.digestTriggerInterval??10;if(W>0&&W%J===0)await this.broadcastDigest($,W,X)}async broadcastDigest($,X,Y){let W=this.config.digestWindowSize??20,J=Math.max(1,X-W+1),U=X,H=await this.getMessages($,{range:{start:J,end:U}}),D={conversationId:$,messageCount:X,messages:H,windowStart:J,windowEnd:U,windowSize:H.length,timestamp:Y};await this.messageBus.send("conversation:digest",D,"conversation-service",void 0,void 0,!0),this.logger.debug("Broadcast conversation digest",{conversationId:$,messageCount:X,windowStart:J,windowEnd:U,windowSize:H.length})}}var y_=A(()=>{wQ();FQ();R$();K8()});var _$$,f_;var g_=A(()=>{R$();_$$=Z.object({id:Z.string(),conversationId:Z.string(),role:Z.string(),content:Z.string(),timestamp:Z.string(),metadata:Z.string().nullable()}),f_=Z.object({conversationId:Z.string(),messageCount:Z.number(),messages:Z.array(_$$),windowStart:Z.number(),windowEnd:Z.number(),windowSize:Z.number(),timestamp:Z.string()})});var ZQ=A(()=>{y_();g_()});var zQ=A(()=>{b9()});var m_;var u_=A(()=>{KQ();zQ();R$();m_=Z.object({captureUrls:Z.boolean().default(!1),blockedUrlDomains:Z.array(Z.string()).default(["meet.google.com","zoom.us","teams.microsoft.com","whereby.com","gather.town","calendly.com","cal.com","discord.com","discord.gg","cdn.discordapp.com","media.discordapp.net","giphy.com","tenor.com","wetransfer.com","file.io"])})});var p_=()=>{};var c_=A(()=>{u_();zQ();p_()});var d_=A(()=>{R$()});var h$$,l_,y$$,i_,f$$,g$$,m$$,u$$;var r_=A(()=>{R$();h$$=Z.object({id:Z.string(),template:Z.string(),content:Z.unknown().optional(),dataQuery:Z.object({entityType:Z.string().optional(),template:Z.string().optional(),query:Z.object({id:Z.string().optional(),limit:Z.number().optional(),offset:Z.number().optional()}).passthrough().optional()}).passthrough().optional(),order:Z.number().optional()}),l_=["primary","secondary"],y$$=Z.object({show:Z.boolean().default(!1),label:Z.string().optional(),slot:Z.enum(l_).default("primary"),priority:Z.number().min(0).max(100).default(50)}).optional(),i_=Z.object({id:Z.string(),path:Z.string(),title:Z.string().default(""),description:Z.string().default(""),sections:Z.array(h$$).default([]),layout:Z.string().default("default"),fullscreen:Z.boolean().optional(),pluginId:Z.string().optional(),sourceEntityType:Z.string().optional(),external:Z.boolean().optional(),navigation:y$$}),f$$=Z.object({routes:Z.array(i_),pluginId:Z.string()}),g$$=Z.object({paths:Z.array(Z.string()).optional(),pluginId:Z.string().optional()}),m$$=Z.object({pluginId:Z.string().optional()}),u$$=Z.object({path:Z.string()})});var p$$;var n_=A(()=>{R$();p$$=Z.object({enabled:Z.boolean().describe("Whether the plugin is enabled"),debug:Z.boolean().describe("Enable debug logging for this plugin")})});var OQ,qX;var NQ=A(()=>{R$();H1();OQ=D0.extend({id:Z.literal("brain-character"),entityType:Z.literal("brain-character")}),qX=Z.object({name:Z.string().describe("The brain's friendly display name"),role:Z.string().describe("The brain's primary role"),purpose:Z.string().describe("The brain's purpose and goals"),values:Z.array(Z.string()).describe("Core values that guide behavior")})});var wX;var AQ=A(()=>{H1();NQ();wX=class wX extends g0{constructor(){super({entityType:"brain-character",schema:OQ,frontmatterSchema:qX,isSingleton:!0,hasBody:!1})}createCharacterContent($){return this.buildMarkdown("",$)}parseCharacterBody($){return this.parseFrontmatter($)}toMarkdown($){let X=this.parseFrontmatter($.content);return this.buildMarkdown("",X)}fromMarkdown($){return{content:$,entityType:"brain-character"}}extractMetadata($){let X=this.parseFrontmatter($.content);return{role:X.role,values:X.values}}generateFrontMatter($){let X=this.parseFrontmatter($.content);return this.buildMarkdown("",X)}}});var V0;var o_=A(()=>{H1();AQ();V0=class V0 extends QX{static instance=null;adapter=new wX;static getDefaultCharacter(){return{name:"Brain",role:"Knowledge assistant",purpose:"Help organize, understand, and retrieve information from your knowledge base",values:["clarity","accuracy","helpfulness"]}}static getInstance($,X,Y){return V0.instance??=new V0($,X,Y),V0.instance}static resetInstance(){V0.instance=null}static createFresh($,X,Y){return new V0($,X,Y)}constructor($,X,Y){super($,X,"brain-character",Y??V0.getDefaultCharacter())}parseBody($){return this.adapter.parseCharacterBody($)}createContent($){return this.adapter.createCharacterContent($)}getCharacter(){return this.get()}getCharacterContent(){return this.getContent()}}});var a_;var s_=A(()=>{R$();a_=Z.object({tagline:Z.string().optional().describe("Short, punchy one-liner for homepage"),intro:Z.string().optional().describe("Optional longer introduction for homepage"),story:Z.string().optional().describe("Extended bio/narrative (multi-paragraph markdown)")})});var BQ,ZX;var MQ=A(()=>{R$();H1();BQ=D0.extend({id:Z.literal("anchor-profile"),entityType:Z.literal("anchor-profile")}),ZX=Z.object({name:Z.string().describe("Name (person or organization)"),kind:Z.enum(["professional","team","collective"]).describe("Type of anchor: professional (individual), team, or collective"),organization:Z.string().optional().describe("Organization the anchor belongs to"),description:Z.string().optional().describe("Short description or biography"),avatar:Z.string().optional().describe("URL or asset path to avatar/logo"),website:Z.string().optional().describe("Primary website URL"),email:Z.string().optional().describe("Contact email"),socialLinks:Z.array(Z.object({platform:Z.enum(["github","instagram","linkedin","email","website"]).describe("Social media platform"),url:Z.string().describe("Profile or contact URL"),label:Z.string().optional().describe("Optional display label")})).optional().describe("Social media and contact links")})});var zX;var jQ=A(()=>{H1();MQ();zX=class zX extends g0{constructor(){super({entityType:"anchor-profile",schema:BQ,frontmatterSchema:ZX,isSingleton:!0,hasBody:!0})}createProfileContent($){let X=ZX.parse($);return this.buildMarkdown("",X)}parseProfileBody($,X){if(X){let{metadata:Y,content:W}=B1($,X);return W?{...Y,story:W}:Y}return this.parseFrontmatter($)}fromMarkdown($){return{content:$,entityType:"anchor-profile"}}extractMetadata($){let X=this.parseFrontmatter($.content);return{name:X.name,email:X.email,website:X.website}}generateFrontMatter($){let X=this.parseFrontmatter($.content);return this.buildMarkdown("",X)}}});var g1;var t_=A(()=>{H1();jQ();g1=class g1 extends QX{static instance=null;adapter=new zX;static getDefaultProfile(){return{name:"Unknown",kind:"professional"}}static getInstance($,X,Y){return g1.instance??=new g1($,X,Y),g1.instance}static resetInstance(){g1.instance=null}static createFresh($,X,Y){return new g1($,X,Y)}constructor($,X,Y){super($,X,"anchor-profile",Y??g1.getDefaultProfile())}parseBody($){return this.adapter.parseProfileBody($)}createContent($){return this.adapter.createProfileContent($)}getProfile(){return this.get()}getProfileContent(){return this.getContent()}}});var OX=A(()=>{o_();AQ();NQ();s_();t_();jQ();MQ()});var e_,d$$,l$$,i$$;var $T=A(()=>{R$();OX();e_=Z.object({id:Z.string(),description:Z.string(),name:Z.string().optional(),tags:Z.array(Z.string()).optional().default([])}).passthrough(),d$$=Z.object({uri:Z.string(),params:Z.record(Z.unknown()).optional()}).passthrough(),l$$=Z.object({name:Z.string(),url:Z.string(),description:Z.string().optional(),skills:Z.array(e_).optional().default([]),capabilities:Z.object({extensions:Z.array(d$$).optional().default([])}).passthrough().optional()}).passthrough(),i$$=Z.object({name:Z.string(),description:Z.string(),tags:Z.array(Z.string()),examples:Z.array(Z.string())})});var v9=()=>{};var K0;var TY=A(()=>{K0=class K0 extends Error{pluginId;constructor($,X){super(`Plugin ${$}: ${X}`);this.name="PluginError",this.pluginId=$}}});class RQ{plugins;events;daemonRegistry;logger;constructor($,X,Y,W){this.plugins=$;this.events=X;this.daemonRegistry=Y;this.logger=W.child("PluginLifecycle")}async initializePlugin($,X,Y){let W=this.plugins.get($);if(!W)throw new K0($,"Registration failed: Plugin is not registered");let J=W.plugin;this.logger.debug(`Initializing plugin: ${$}`),this.events.emit("plugin:before_initialize",$,J);try{let U=await J.register(X,Y);return W.status="initialized",this.logger.debug(`Initialized plugin: ${$}`),this.events.emit("plugin:initialized",$,J),U}catch(U){let H=g6(U);throw this.logger.error(`Error initializing plugin ${$}: ${H}`),W.status="error",W.error=T0(U),this.events.emit("plugin:error",$,U),U}}async readyPlugin($){let X=this.plugins.get($);if(!X)throw new K0($,"Ready failed: Plugin is not registered");if(X.status!=="initialized"){this.logger.debug(`Skipping ready hook for non-initialized plugin: ${$}`);return}try{await X.plugin.ready?.(),this.logger.debug(`Ready hook completed for plugin: ${$}`)}catch(Y){let W=T0(Y);throw X.status="error",X.error=W,this.events.emit("plugin:error",$,W),W}}async startPluginDaemons($){let X=this.plugins.get($);if(X?.status!=="initialized")return;try{await this.daemonRegistry.startPlugin($),this.logger.debug(`Started daemons for plugin: ${$}`)}catch(Y){if(X.plugin.requiresDaemonStartup?.())throw Y;this.logger.warn(`Daemon ${$} failed to start: ${g6(Y)}`)}}async disablePlugin($){let X=this.plugins.get($);if(!X){this.logger.warn(`Cannot disable plugin ${$}: not registered`);return}this.logger.debug(`Disabling plugin: ${$}`);try{await this.daemonRegistry.stopPlugin($),this.logger.debug(`Stopped daemons for plugin: ${$}`)}catch(Y){this.logger.error(`Failed to stop daemons for plugin: ${$}`,Y)}if(X.plugin.shutdown)try{await X.plugin.shutdown(),this.logger.debug(`Shutdown completed for plugin: ${$}`)}catch(Y){this.logger.error(`Plugin shutdown failed for ${$}:`,Y)}X.status="disabled",this.events.emit("plugin:disabled",$,X.plugin),this.logger.debug(`Disabled plugin: ${$}`)}async enablePlugin($){let X=this.plugins.get($);if(!X){this.logger.warn(`Cannot enable plugin ${$}: not registered`);return}if(X.status!=="disabled"){this.logger.warn(`Cannot enable plugin ${$}: not disabled`);return}this.logger.debug(`Enabling plugin: ${$}`),X.status="initialized";try{await this.daemonRegistry.startPlugin($),this.logger.debug(`Started daemons for plugin: ${$}`)}catch(Y){this.logger.error(`Failed to start daemons for plugin: ${$}`,Y)}this.events.emit("plugin:enabled",$,X.plugin),this.logger.debug(`Enabled plugin: ${$}`)}}var XT=A(()=>{R$();v9();TY()});class LQ{plugins;events;logger;constructor($,X,Y){this.plugins=$;this.events=X;this.logger=Y.child("DependencyResolver")}async resolveInitializationOrder($){this.logger.debug("Resolving plugin initialization order...");let X=Array.from(this.plugins.keys()),Y=new Set,W=!0;while(W&&Y.size<X.length){W=!1;for(let H of X){if(Y.has(H))continue;if(!this.plugins.get(H))continue;if(this.getUnmetDependencies(H).length===0)try{await $(H),Y.add(H),W=!0}catch(K){let Q=g6(K);this.logger.error(`Failed to initialize plugin ${H}: ${Q}`),Y.add(H),W=!0}}}let J=X.filter((H)=>!Y.has(H));if(J.length>0){let H=J.join(", ");this.logger.error(`Failed to initialize plugins due to dependency issues: ${H}`);for(let D of J){let V=this.getUnmetDependencies(D);this.logger.error(`Plugin ${D} has unmet dependencies: ${V.join(", ")}`);let K=this.plugins.get(D);if(K)K.status="error",K.error=new K0(D,`Unmet dependencies: ${V.join(", ")}`);this.events.emit("plugin:error",D,K?.error)}}let U=new Set;for(let[H,D]of this.plugins)if(D.status==="initialized")U.add(H);return this.logger.debug(`Resolved ${U.size} of ${X.length} plugins`),{initialized:U,failed:J}}getUnmetDependencies($){let X=this.plugins.get($);if(!X)return[];let{dependencies:Y}=X,W=[];for(let J of Y){let U=this.plugins.get(J);if(!U){W.push(J);continue}if(U.status!=="initialized")W.push(J)}return W}}var YT=A(()=>{R$();v9();TY()});class EQ{logger;constructor($){this.logger=$.child("CapabilityRegistrar")}async registerCapabilities($,X,Y){if(Y.tools.length>0)$.registerTools(X,Y.tools),this.logger.debug(`Registered ${Y.tools.length} tools from ${X}`);if(Y.resources.length>0)$.registerResources(X,Y.resources),this.logger.debug(`Registered ${Y.resources.length} resources from ${X}`);if(Y.instructions)$.registerInstructions(X,Y.instructions),this.logger.debug(`Registered instructions from ${X}`)}}import{EventEmitter as JT}from"events";class Q0{static instance=null;plugins=new Map;logger;events=new JT;daemonRegistry;shell=null;initializedPluginIds=[];pluginLifecycle;dependencyResolver;capabilityRegistrar;static getInstance($,X){return Q0.instance??=new Q0($,X),Q0.instance}static resetInstance(){Q0.instance=null}static createFresh($,X){return new Q0($,X)}setShell($){this.shell=$}constructor($,X){this.logger=$.child("PluginManager"),this.events=new JT,this.daemonRegistry=X,this.pluginLifecycle=new RQ(this.plugins,this.events,this.daemonRegistry,$),this.dependencyResolver=new LQ(this.plugins,this.events,$),this.capabilityRegistrar=new EQ($)}registerPlugin($){if(!$.id)throw new K0("unknown","Registration failed: Plugin must have an id");if(this.logger.debug(`Registering plugin: ${$.id} (${$.version})`),this.plugins.has($.id)){let J=this.plugins.get($.id)?.plugin.version;throw new K0($.id,`Registration failed: Plugin is already registered with version ${J}`)}let X=$.dependencies??[],Y={plugin:$,status:"registered",dependencies:X};this.plugins.set($.id,Y),this.logger.debug(`Registered plugin: ${$.id} (${$.version})`),this.events.emit("plugin:registered",$.id,$)}async initializePlugins($){this.logger.debug("Initializing plugins..."),this.initializedPluginIds=[];let X=await this.dependencyResolver.resolveInitializationOrder(async(Y)=>{await this.initializePlugin(Y,$)});this.logger.debug(`Initialized ${X.initialized.size} of ${this.plugins.size} plugins`)}async initializePlugin($,X){if(!this.shell)throw new K0($,"Cannot initialize plugin: Shell not set. Call setShell() first.");let Y=this.shell,W=await this.pluginLifecycle.initializePlugin($,Y,X);await this.capabilityRegistrar.registerCapabilities(Y,$,W),this.initializedPluginIds.push($)}async readyPlugins(){this.logger.debug("Dispatching plugin ready hooks..."),await Promise.all(this.initializedPluginIds.map(($)=>this.pluginLifecycle.readyPlugin($)))}async startPluginDaemons(){this.logger.debug("Starting plugin daemons..."),await Promise.all(this.initializedPluginIds.map(($)=>this.pluginLifecycle.startPluginDaemons($)))}getPlugin($){return this.plugins.get($)?.plugin}getPluginStatus($){return this.plugins.get($)?.status}hasPlugin($){return this.plugins.has($)}isPluginInitialized($){return this.plugins.get($)?.status==="initialized"}getAllPluginIds(){return Array.from(this.plugins.keys())}getAllPlugins(){return new Map(this.plugins)}getFailedPlugins(){return Array.from(this.plugins.entries()).filter(($)=>$[1].status==="error"&&$[1].error!==void 0).map(([$,X])=>({id:$,error:X.error}))}getPluginPackageName($){return this.plugins.get($)?.plugin.packageName}async disablePlugin($){await this.pluginLifecycle.disablePlugin($)}async enablePlugin($){await this.pluginLifecycle.enablePlugin($)}on($,X){this.events.on($,X)}once($,X){this.events.once($,X)}off($,X){this.events.off($,X)}getEventEmitter(){return this.events}}var WT=A(()=>{v9();TY();XT();YT();v9()});var UT=A(()=>{v9()});var GT=A(()=>{WT();UT();v9()});var h9=A(()=>{C_();S_();DQ();GU();KQ();b_();kV();HQ();LY();VQ();xV();H1();k_();H1();b9();v_();e5();ZQ();c_();$X();d_();R$();r_();n_();OX();$T();GT();TY()});function PQ(){return{database:{url:`file:${y9.dataDir}/brain.db`,authToken:process.env.DATABASE_AUTH_TOKEN},jobQueueDatabase:{url:`file:${y9.dataDir}/brain-jobs.db`,authToken:process.env.JOB_QUEUE_DATABASE_AUTH_TOKEN},conversationDatabase:{url:`file:${y9.dataDir}/conversations.db`,authToken:process.env.CONVERSATION_DATABASE_AUTH_TOKEN},embeddingDatabase:{url:`file:${y9.dataDir}/embeddings.db`,authToken:process.env.DATABASE_AUTH_TOKEN},embedding:{cacheDir:`${y9.cacheDir}/embeddings`}}}function SY($={}){let X=PQ(),Y={name:$.name??"brain-app",version:$.version??"1.0.0",database:$.database??X.database,jobQueueDatabase:$.jobQueueDatabase??X.jobQueueDatabase,conversationDatabase:$.conversationDatabase??X.conversationDatabase,embeddingDatabase:$.embeddingDatabase??X.embeddingDatabase,ai:{apiKey:$.ai?.apiKey??"",...$.ai?.imageApiKey?{imageApiKey:$.ai.imageApiKey}:{},...$.ai?.model?{model:$.ai.model}:{},temperature:$.ai?.temperature??0.7,maxTokens:$.ai?.maxTokens??1000,webSearch:$.ai?.webSearch??!0},embedding:$.embedding??X.embedding,logging:{level:$.logging?.level??"info",format:$.logging?.format??"text",...$.logging?.file?{file:$.logging.file}:{},context:$.logging?.context??"shell"},features:{},plugins:$.plugins??[],permissions:$.permissions??{},...$.dataDir&&{dataDir:$.dataDir},...$.siteBaseUrl&&{siteBaseUrl:$.siteBaseUrl},...$.entityDisplay&&{entityDisplay:$.entityDisplay}},W=IQ.parse(Y),{entityDisplay:J,...U}=W,H={...U,plugins:Y.plugins,permissions:Y.permissions};if($.identity!==void 0)H.identity=$.identity;if($.profile!==void 0)H.profile=$.profile;if($.evalHandlerRegistry!==void 0)H.evalHandlerRegistry=$.evalHandlerRegistry;if($.siteBaseUrl!==void 0)H.siteBaseUrl=$.siteBaseUrl;if(J!==void 0)H.entityDisplay=J;return H}var y9,IQ;var HT=A(()=>{R$();h9();y9={dataDir:process.env.XDG_DATA_HOME??"./data",cacheDir:process.env.XDG_CACHE_HOME??"./cache",distDir:"./dist"};IQ=Z.object({name:Z.string().default("brain-app"),version:Z.string().default("1.0.0"),database:I5,jobQueueDatabase:I5,conversationDatabase:I5,embeddingDatabase:I5,ai:Z.object({apiKey:Z.string(),imageApiKey:Z.string().optional(),model:Z.string(),temperature:Z.number().min(0).max(2).default(0.7),maxTokens:Z.number().positive().default(1000),webSearch:Z.boolean().default(!0)}),embedding:Z.object({model:Z.enum(["fast-all-MiniLM-L6-v2"]).default("fast-all-MiniLM-L6-v2"),cacheDir:Z.string()}),logging:Z.object({level:Z.enum(["debug","info","warn","error"]).default("info"),format:Z.enum(["text","json"]).default("text"),file:Z.string().optional(),context:Z.string().default("shell")}).default({level:"info",context:"shell"}),features:Z.object({}).default({}),plugins:Z.array(WY).default([]),dataDir:Z.string().default("./brain-data"),siteBaseUrl:Z.string().optional(),entityDisplay:Z.record(Z.object({label:Z.string().min(1)}).passthrough()).optional()})});var _Q=A(()=>{HT()});var m1,bY,TQ;var xY=A(()=>{m1={BASE:"base",BRAIN_CHARACTER:"brain-character",ANCHOR_PROFILE:"anchor-profile"},bY={KNOWLEDGE_QUERY:"shell:knowledge-query",BASE_ENTITY_DISPLAY:"shell:base-entity-display",CONTENT_GENERATION:"shell:content-generation"},TQ={ENTITIES:"shell:entities"}});class DU{aiService;entityService;templateRegistry;getIdentityContent;getProfileContent;siteBaseUrl;id="ai-content";name="AI Content Generator";description="Generates content using AI based on templates and prompts";constructor($,X,Y,W,J,U){this.aiService=$;this.entityService=X;this.templateRegistry=Y;this.getIdentityContent=W;this.getProfileContent=J;this.siteBaseUrl=U}async generate($,X){let Y=r$$.parse($),W=this.templateRegistry.get(Y.templateName);if(!W)throw Error(`Template not found: ${Y.templateName}`);if(!W.basePrompt)throw Error(`Template ${Y.templateName} must have basePrompt for content generation`);let J=await FX(this.entityService,Y.templateName,W.basePrompt),U=[J,Y.prompt].filter(Boolean).join(" "),H=U.length>0&&W.useKnowledgeContext===!0,D=this.entityService.getWeightMap(),V=Object.keys(D).length>0,K=H?await this.entityService.search(U,{limit:5,...V&&{weight:D}}):[],Q=await this.buildPrompt({basePrompt:J},Y,K),q=this.buildSystemPrompt(J),F=await this.aiService.generateObject(q,Q,W.schema);return X.parse(F.object)}buildSystemPrompt($){return["# Your Identity",this.getIdentityContent(),"","# About the Person You Represent",this.getProfileContent(),"","# Instructions",$].join(`
208
- `)}async buildPrompt($,X,Y=[]){let W=$.basePrompt;if(X.conversationHistory)W+=`
209
-
210
- Recent conversation context:
211
- ${X.conversationHistory}`;if(Y.length>0){let J=i8.getInstance(),U=Y.map((H)=>{let{entity:D,excerpt:V}=H,K=D.entityType,q=Z.object({slug:Z.string()}).safeParse(D.metadata),F=q.success?q.data.slug:D.id;if(this.siteBaseUrl&&J.hasRoute(K)){let w=J.generateUrl(K,F),z=`https://${this.siteBaseUrl}${w}`;return`[${K}] ${D.id}: ${V} (${z})`}return`[${K}] ${D.id}: ${V}`}).join(`
212
- `);W+=`
213
-
214
- Relevant context from your knowledge base:
215
- ${U}`}if(X.data)W+=`
216
-
217
- Context data:
218
- ${JSON.stringify(X.data,null,2)}`;if(X.prompt)W+=`
219
-
220
- Additional instructions: ${X.prompt}`;return W}}var r$$;var VT=A(()=>{R$();h9();r$$=Z.object({prompt:Z.string().optional(),conversationHistory:Z.string().optional(),data:Z.record(Z.string(),Z.unknown()).optional(),templateName:Z.string()})});class VU{entityService;id=TQ.ENTITIES;name="Entity DataSource";description="Fetches entity content from the entity service";constructor($){this.entityService=$}async fetch($,X,Y){let W=n$$.safeParse($);if(!W.success){let H=W.error.issues.map((D)=>`${D.path.join(".")}: ${D.message}`).join(", ");throw Error(`EntityDataSource: Invalid query - ${H}`)}let J=W.data,U=await this.entityService.getEntity(J.entityType,J.query.id);if(!U)throw Error(`EntityDataSource: Entity not found (${J.entityType}:${J.query.id})`);return X.parse({markdown:U.content})}}var n$$;var KT=A(()=>{R$();xY();n$$=Z.object({entityType:Z.string(),query:Z.object({id:Z.string()})})});var QT=A(()=>{VT();KT()});function F0($){if($==null)return"unknown error";if(typeof $==="string")return $;if($ instanceof Error)return $.message;return JSON.stringify($)}function KU($){if($===null||typeof $==="string"||typeof $==="number"||typeof $==="boolean")return!0;if(Array.isArray($))return $.every(KU);if(typeof $==="object")return Object.entries($).every(([X,Y])=>typeof X==="string"&&(Y===void 0||KU(Y)));return!1}function SQ($){return Array.isArray($)&&$.every(KU)}function vY($){return $!=null&&typeof $==="object"&&Object.entries($).every(([X,Y])=>typeof X==="string"&&(Y===void 0||KU(Y)))}var mT="vercel.ai.error",o$$,FT,qT,A$,uT="AI_APICallError",pT,a$$,wT,ZT,R6,cT="AI_EmptyResponseBodyError",dT,s$$,zT,OT,lT,iT="AI_InvalidArgumentError",rT,t$$,NT,AT,NX,nT="AI_InvalidPromptError",oT,e$$,BT,MT,F8,aT="AI_InvalidResponseDataError",sT,$6$,jT,RT,QU,tT="AI_JSONParseError",eT,X6$,LT,ET,f9,$C="AI_LoadAPIKeyError",XC,Y6$,PT,IT,kY,YC="AI_LoadSettingError",JC,J6$,_T,TT,Hh$,WC="AI_NoContentGeneratedError",UC,W6$,CT,ST,Dh$,GC="AI_NoSuchModelError",HC,U6$,bT,xT,CQ,DC="AI_TooManyEmbeddingValuesForCallError",VC,G6$,kT,vT,FU,KC="AI_TypeValidationError",QC,H6$,hT,yT,K4,FC="AI_UnsupportedFunctionalityError",qC,D6$,fT,gT,L6;var f$=A(()=>{o$$=Symbol.for(mT),A$=class $ extends(qT=Error,FT=o$$,qT){constructor({name:X,message:Y,cause:W}){super(Y);this[FT]=!0,this.name=X,this.cause=W}static isInstance(X){return $.hasMarker(X,mT)}static hasMarker(X,Y){let W=Symbol.for(Y);return X!=null&&typeof X==="object"&&W in X&&typeof X[W]==="boolean"&&X[W]===!0}},pT=`vercel.ai.error.${uT}`,a$$=Symbol.for(pT),R6=class extends(ZT=A$,wT=a$$,ZT){constructor({message:$,url:X,requestBodyValues:Y,statusCode:W,responseHeaders:J,responseBody:U,cause:H,isRetryable:D=W!=null&&(W===408||W===409||W===429||W>=500),data:V}){super({name:uT,message:$,cause:H});this[wT]=!0,this.url=X,this.requestBodyValues=Y,this.statusCode=W,this.responseHeaders=J,this.responseBody=U,this.isRetryable=D,this.data=V}static isInstance($){return A$.hasMarker($,pT)}},dT=`vercel.ai.error.${cT}`,s$$=Symbol.for(dT),lT=class extends(OT=A$,zT=s$$,OT){constructor({message:$="Empty response body"}={}){super({name:cT,message:$});this[zT]=!0}static isInstance($){return A$.hasMarker($,dT)}};rT=`vercel.ai.error.${iT}`,t$$=Symbol.for(rT),NX=class extends(AT=A$,NT=t$$,AT){constructor({message:$,cause:X,argument:Y}){super({name:iT,message:$,cause:X});this[NT]=!0,this.argument=Y}static isInstance($){return A$.hasMarker($,rT)}},oT=`vercel.ai.error.${nT}`,e$$=Symbol.for(oT),F8=class extends(MT=A$,BT=e$$,MT){constructor({prompt:$,message:X,cause:Y}){super({name:nT,message:`Invalid prompt: ${X}`,cause:Y});this[BT]=!0,this.prompt=$}static isInstance($){return A$.hasMarker($,oT)}},sT=`vercel.ai.error.${aT}`,$6$=Symbol.for(sT),QU=class extends(RT=A$,jT=$6$,RT){constructor({data:$,message:X=`Invalid response data: ${JSON.stringify($)}.`}){super({name:aT,message:X});this[jT]=!0,this.data=$}static isInstance($){return A$.hasMarker($,sT)}},eT=`vercel.ai.error.${tT}`,X6$=Symbol.for(eT),f9=class extends(ET=A$,LT=X6$,ET){constructor({text:$,cause:X}){super({name:tT,message:`JSON parsing failed: Text: ${$}.
221
- Error message: ${F0(X)}`,cause:X});this[LT]=!0,this.text=$}static isInstance($){return A$.hasMarker($,eT)}},XC=`vercel.ai.error.${$C}`,Y6$=Symbol.for(XC),kY=class extends(IT=A$,PT=Y6$,IT){constructor({message:$}){super({name:$C,message:$});this[PT]=!0}static isInstance($){return A$.hasMarker($,XC)}},JC=`vercel.ai.error.${YC}`,J6$=Symbol.for(JC),Hh$=class extends(TT=A$,_T=J6$,TT){constructor({message:$}){super({name:YC,message:$});this[_T]=!0}static isInstance($){return A$.hasMarker($,JC)}},UC=`vercel.ai.error.${WC}`,W6$=Symbol.for(UC),Dh$=class extends(ST=A$,CT=W6$,ST){constructor({message:$="No content generated."}={}){super({name:WC,message:$});this[CT]=!0}static isInstance($){return A$.hasMarker($,UC)}},HC=`vercel.ai.error.${GC}`,U6$=Symbol.for(HC),CQ=class extends(xT=A$,bT=U6$,xT){constructor({errorName:$=GC,modelId:X,modelType:Y,message:W=`No such ${Y}: ${X}`}){super({name:$,message:W});this[bT]=!0,this.modelId=X,this.modelType=Y}static isInstance($){return A$.hasMarker($,HC)}},VC=`vercel.ai.error.${DC}`,G6$=Symbol.for(VC),FU=class extends(vT=A$,kT=G6$,vT){constructor($){super({name:DC,message:`Too many values for a single embedding call. The ${$.provider} model "${$.modelId}" can only embed up to ${$.maxEmbeddingsPerCall} values per call, but ${$.values.length} values were provided.`});this[kT]=!0,this.provider=$.provider,this.modelId=$.modelId,this.maxEmbeddingsPerCall=$.maxEmbeddingsPerCall,this.values=$.values}static isInstance($){return A$.hasMarker($,VC)}},QC=`vercel.ai.error.${KC}`,H6$=Symbol.for(QC),K4=class $ extends(yT=A$,hT=H6$,yT){constructor({value:X,cause:Y,context:W}){let J="Type validation failed";if(W==null?void 0:W.field)J+=` for ${W.field}`;if((W==null?void 0:W.entityName)||(W==null?void 0:W.entityId)){J+=" (";let U=[];if(W.entityName)U.push(W.entityName);if(W.entityId)U.push(`id: "${W.entityId}"`);J+=U.join(", "),J+=")"}super({name:KC,message:`${J}: Value: ${JSON.stringify(X)}.
222
- Error message: ${F0(Y)}`,cause:Y});this[hT]=!0,this.value=X,this.context=W}static isInstance(X){return A$.hasMarker(X,QC)}static wrap({value:X,cause:Y,context:W}){var J,U,H;if($.isInstance(Y)&&Y.value===X&&((J=Y.context)==null?void 0:J.field)===(W==null?void 0:W.field)&&((U=Y.context)==null?void 0:U.entityName)===(W==null?void 0:W.entityName)&&((H=Y.context)==null?void 0:H.entityId)===(W==null?void 0:W.entityId))return Y;return new $({value:X,cause:Y,context:W})}},qC=`vercel.ai.error.${FC}`,D6$=Symbol.for(qC),L6=class extends(gT=A$,fT=D6$,gT){constructor({functionality:$,message:X=`'${$}' functionality not supported.`}){super({name:FC,message:X});this[fT]=!0,this.functionality=$}static isInstance($){return A$.hasMarker($,qC)}}});function c($,X,Y){function W(D,V){var K;Object.defineProperty(D,"_zod",{value:D._zod??{},enumerable:!1}),(K=D._zod).traits??(K.traits=new Set),D._zod.traits.add($),X(D,V);for(let Q in H.prototype)if(!(Q in D))Object.defineProperty(D,Q,{value:H.prototype[Q].bind(D)});D._zod.constr=H,D._zod.def=V}let J=Y?.Parent??Object;class U extends J{}Object.defineProperty(U,"name",{value:$});function H(D){var V;let K=Y?.Parent?new U:this;W(K,D),(V=K._zod).deferred??(V.deferred=[]);for(let Q of K._zod.deferred)Q();return K}return Object.defineProperty(H,"init",{value:W}),Object.defineProperty(H,Symbol.hasInstance,{value:(D)=>{if(Y?.Parent&&D instanceof Y.Parent)return!0;return D?._zod?.traits?.has($)}}),Object.defineProperty(H,"name",{value:$}),H}function Q4($){if($)Object.assign(hY,$);return hY}var bQ,xQ,q8,hY;var AX=A(()=>{bQ=Object.freeze({status:"aborted"});xQ=Symbol("zod_brand");q8=class q8 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};hY={}});var E$={};e0(E$,{unwrapMessage:()=>yY,stringifyPrimitive:()=>L$,required:()=>E6$,randomString:()=>z6$,propertyKeyTypes:()=>uY,promiseAllObject:()=>Z6$,primitiveTypes:()=>gQ,prefixIssues:()=>D1,pick:()=>B6$,partial:()=>L6$,optionalKeys:()=>mQ,omit:()=>M6$,numKeys:()=>O6$,nullish:()=>e8,normalizeParams:()=>Z$,merge:()=>R6$,jsonStringifyReplacer:()=>vQ,joinValues:()=>e,issue:()=>cQ,isPlainObject:()=>MX,isObject:()=>BX,getSizableOrigin:()=>pY,getParsedType:()=>N6$,getLengthableOrigin:()=>cY,getEnumValues:()=>fY,getElementAtPath:()=>w6$,floatSafeRemainder:()=>hQ,finalizeIssue:()=>R1,extend:()=>j6$,escapeRegex:()=>w8,esc:()=>g9,defineLazy:()=>I6,createTransparentProxy:()=>A6$,clone:()=>j1,cleanRegex:()=>mY,cleanEnum:()=>P6$,captureStackTrace:()=>qU,cached:()=>gY,assignProp:()=>yQ,assertNotEqual:()=>K6$,assertNever:()=>F6$,assertIs:()=>Q6$,assertEqual:()=>V6$,assert:()=>q6$,allowsEval:()=>fQ,aborted:()=>m9,NUMBER_FORMAT_RANGES:()=>uQ,Class:()=>wC,BIGINT_FORMAT_RANGES:()=>pQ});function V6$($){return $}function K6$($){return $}function Q6$($){}function F6$($){throw Error()}function q6$($){}function fY($){let X=Object.values($).filter((W)=>typeof W==="number");return Object.entries($).filter(([W,J])=>X.indexOf(+W)===-1).map(([W,J])=>J)}function e($,X="|"){return $.map((Y)=>L$(Y)).join(X)}function vQ($,X){if(typeof X==="bigint")return X.toString();return X}function gY($){return{get value(){{let Y=$();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function e8($){return $===null||$===void 0}function mY($){let X=$.startsWith("^")?1:0,Y=$.endsWith("$")?$.length-1:$.length;return $.slice(X,Y)}function hQ($,X){let Y=($.toString().split(".")[1]||"").length,W=(X.toString().split(".")[1]||"").length,J=Y>W?Y:W,U=Number.parseInt($.toFixed(J).replace(".","")),H=Number.parseInt(X.toFixed(J).replace(".",""));return U%H/10**J}function I6($,X,Y){Object.defineProperty($,X,{get(){{let J=Y();return $[X]=J,J}throw Error("cached value already set")},set(J){Object.defineProperty($,X,{value:J})},configurable:!0})}function yQ($,X,Y){Object.defineProperty($,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function w6$($,X){if(!X)return $;return X.reduce((Y,W)=>Y?.[W],$)}function Z6$($){let X=Object.keys($),Y=X.map((W)=>$[W]);return Promise.all(Y).then((W)=>{let J={};for(let U=0;U<X.length;U++)J[X[U]]=W[U];return J})}function z6$($=10){let Y="";for(let W=0;W<$;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function g9($){return JSON.stringify($)}function BX($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function MX($){if(BX($)===!1)return!1;let X=$.constructor;if(X===void 0)return!0;let Y=X.prototype;if(BX(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function O6$($){let X=0;for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))X++;return X}function w8($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function j1($,X,Y){let W=new $._zod.constr(X??$._zod.def);if(!X||Y?.parent)W._zod.parent=$;return W}function Z$($){let X=$;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function A6$($){let X;return new Proxy({},{get(Y,W,J){return X??(X=$()),Reflect.get(X,W,J)},set(Y,W,J,U){return X??(X=$()),Reflect.set(X,W,J,U)},has(Y,W){return X??(X=$()),Reflect.has(X,W)},deleteProperty(Y,W){return X??(X=$()),Reflect.deleteProperty(X,W)},ownKeys(Y){return X??(X=$()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Y,W){return X??(X=$()),Reflect.getOwnPropertyDescriptor(X,W)},defineProperty(Y,W,J){return X??(X=$()),Reflect.defineProperty(X,W,J)}})}function L$($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function mQ($){return Object.keys($).filter((X)=>{return $[X]._zod.optin==="optional"&&$[X]._zod.optout==="optional"})}function B6$($,X){let Y={},W=$._zod.def;for(let J in X){if(!(J in W.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;Y[J]=W.shape[J]}return j1($,{...$._zod.def,shape:Y,checks:[]})}function M6$($,X){let Y={...$._zod.def.shape},W=$._zod.def;for(let J in X){if(!(J in W.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;delete Y[J]}return j1($,{...$._zod.def,shape:Y,checks:[]})}function j6$($,X){if(!MX(X))throw Error("Invalid input to extend: expected a plain object");let Y={...$._zod.def,get shape(){let W={...$._zod.def.shape,...X};return yQ(this,"shape",W),W},checks:[]};return j1($,Y)}function R6$($,X){return j1($,{...$._zod.def,get shape(){let Y={...$._zod.def.shape,...X._zod.def.shape};return yQ(this,"shape",Y),Y},catchall:X._zod.def.catchall,checks:[]})}function L6$($,X,Y){let W=X._zod.def.shape,J={...W};if(Y)for(let U in Y){if(!(U in W))throw Error(`Unrecognized key: "${U}"`);if(!Y[U])continue;J[U]=$?new $({type:"optional",innerType:W[U]}):W[U]}else for(let U in W)J[U]=$?new $({type:"optional",innerType:W[U]}):W[U];return j1(X,{...X._zod.def,shape:J,checks:[]})}function E6$($,X,Y){let W=X._zod.def.shape,J={...W};if(Y)for(let U in Y){if(!(U in J))throw Error(`Unrecognized key: "${U}"`);if(!Y[U])continue;J[U]=new $({type:"nonoptional",innerType:W[U]})}else for(let U in W)J[U]=new $({type:"nonoptional",innerType:W[U]});return j1(X,{...X._zod.def,shape:J,checks:[]})}function m9($,X=0){for(let Y=X;Y<$.issues.length;Y++)if($.issues[Y]?.continue!==!0)return!0;return!1}function D1($,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift($),Y})}function yY($){return typeof $==="string"?$:$?.message}function R1($,X,Y){let W={...$,path:$.path??[]};if(!$.message){let J=yY($.inst?._zod.def?.error?.($))??yY(X?.error?.($))??yY(Y.customError?.($))??yY(Y.localeError?.($))??"Invalid input";W.message=J}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function pY($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function cY($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function cQ(...$){let[X,Y,W]=$;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function P6$($){return Object.entries($).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}class wC{constructor(...$){}}var qU,fQ,N6$=($)=>{let X=typeof $;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},uY,gQ,uQ,pQ;var n$=A(()=>{qU=Error.captureStackTrace?Error.captureStackTrace:(...$)=>{};fQ=gY(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});uY=new Set(["string","number","symbol"]),gQ=new Set(["string","number","bigint","boolean","symbol","undefined"]);uQ={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},pQ={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function lY($,X=(Y)=>Y.message){let Y={},W=[];for(let J of $.issues)if(J.path.length>0)Y[J.path[0]]=Y[J.path[0]]||[],Y[J.path[0]].push(X(J));else W.push(X(J));return{formErrors:W,fieldErrors:Y}}function iY($,X){let Y=X||function(U){return U.message},W={_errors:[]},J=(U)=>{for(let H of U.issues)if(H.code==="invalid_union"&&H.errors.length)H.errors.map((D)=>J({issues:D}));else if(H.code==="invalid_key")J({issues:H.issues});else if(H.code==="invalid_element")J({issues:H.issues});else if(H.path.length===0)W._errors.push(Y(H));else{let D=W,V=0;while(V<H.path.length){let K=H.path[V];if(V!==H.path.length-1)D[K]=D[K]||{_errors:[]};else D[K]=D[K]||{_errors:[]},D[K]._errors.push(Y(H));D=D[K],V++}}};return J($),W}function dQ($,X){let Y=X||function(U){return U.message},W={errors:[]},J=(U,H=[])=>{var D,V;for(let K of U.issues)if(K.code==="invalid_union"&&K.errors.length)K.errors.map((Q)=>J({issues:Q},K.path));else if(K.code==="invalid_key")J({issues:K.issues},K.path);else if(K.code==="invalid_element")J({issues:K.issues},K.path);else{let Q=[...H,...K.path];if(Q.length===0){W.errors.push(Y(K));continue}let q=W,F=0;while(F<Q.length){let w=Q[F],z=F===Q.length-1;if(typeof w==="string")q.properties??(q.properties={}),(D=q.properties)[w]??(D[w]={errors:[]}),q=q.properties[w];else q.items??(q.items=[]),(V=q.items)[w]??(V[w]={errors:[]}),q=q.items[w];if(z)q.errors.push(Y(K));F++}}};return J($),W}function zC($){let X=[];for(let Y of $)if(typeof Y==="number")X.push(`[${Y}]`);else if(typeof Y==="symbol")X.push(`[${JSON.stringify(String(Y))}]`);else if(/[^\w$]/.test(Y))X.push(`[${JSON.stringify(Y)}]`);else{if(X.length)X.push(".");X.push(Y)}return X.join("")}function lQ($){let X=[],Y=[...$.issues].sort((W,J)=>W.path.length-J.path.length);for(let W of Y)if(X.push(`\u2716 ${W.message}`),W.path?.length)X.push(` \u2192 at ${zC(W.path)}`);return X.join(`
223
- `)}var ZC=($,X)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:X,enumerable:!1}),Object.defineProperty($,"message",{get(){return JSON.stringify(X,vQ,2)},enumerable:!0}),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},dY,jX;var iQ=A(()=>{AX();n$();dY=c("$ZodError",ZC),jX=c("$ZodError",ZC,{Parent:Error})});var wU=($)=>(X,Y,W,J)=>{let U=W?Object.assign(W,{async:!1}):{async:!1},H=X._zod.run({value:Y,issues:[]},U);if(H instanceof Promise)throw new q8;if(H.issues.length){let D=new(J?.Err??$)(H.issues.map((V)=>R1(V,U,Q4())));throw qU(D,J?.callee),D}return H.value},ZU,zU=($)=>async(X,Y,W,J)=>{let U=W?Object.assign(W,{async:!0}):{async:!0},H=X._zod.run({value:Y,issues:[]},U);if(H instanceof Promise)H=await H;if(H.issues.length){let D=new(J?.Err??$)(H.issues.map((V)=>R1(V,U,Q4())));throw qU(D,J?.callee),D}return H.value},OU,NU=($)=>(X,Y,W)=>{let J=W?{...W,async:!1}:{async:!1},U=X._zod.run({value:Y,issues:[]},J);if(U instanceof Promise)throw new q8;return U.issues.length?{success:!1,error:new($??dY)(U.issues.map((H)=>R1(H,J,Q4())))}:{success:!0,data:U.value}},rQ,AU=($)=>async(X,Y,W)=>{let J=W?Object.assign(W,{async:!0}):{async:!0},U=X._zod.run({value:Y,issues:[]},J);if(U instanceof Promise)U=await U;return U.issues.length?{success:!1,error:new $(U.issues.map((H)=>R1(H,J,Q4())))}:{success:!0,data:U.value}},nQ;var BU=A(()=>{AX();iQ();n$();ZU=wU(jX),OU=zU(jX),rQ=NU(jX),nQ=AU(jX)});var p9={};e0(p9,{xid:()=>tQ,uuid7:()=>S6$,uuid6:()=>C6$,uuid4:()=>T6$,uuid:()=>u9,uppercase:()=>RF,unicodeEmail:()=>k6$,undefined:()=>MF,ulid:()=>sQ,time:()=>qF,string:()=>ZF,rfc5322Email:()=>x6$,number:()=>NF,null:()=>BF,nanoid:()=>$F,lowercase:()=>jF,ksuid:()=>eQ,ipv6:()=>GF,ipv4:()=>UF,integer:()=>OF,html5Email:()=>b6$,hostname:()=>KF,guid:()=>YF,extendedDuration:()=>_6$,emoji:()=>WF,email:()=>JF,e164:()=>QF,duration:()=>XF,domain:()=>y6$,datetime:()=>wF,date:()=>FF,cuid2:()=>aQ,cuid:()=>oQ,cidrv6:()=>DF,cidrv4:()=>HF,browserEmail:()=>v6$,boolean:()=>AF,bigint:()=>zF,base64url:()=>MU,base64:()=>VF,_emoji:()=>h6$});function WF(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}function NC($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function qF($){return new RegExp(`^${NC($)}$`)}function wF($){let X=NC({precision:$.precision}),Y=["Z"];if($.local)Y.push("");if($.offset)Y.push("([+-]\\d{2}:\\d{2})");let W=`${X}(?:${Y.join("|")})`;return new RegExp(`^${OC}T(?:${W})$`)}var oQ,aQ,sQ,tQ,eQ,$F,XF,_6$,YF,u9=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},T6$,C6$,S6$,JF,b6$,x6$,k6$,v6$,h6$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",UF,GF,HF,DF,VF,MU,KF,y6$,QF,OC="(?:(?:\\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])))",FF,ZF=($)=>{let X=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)},zF,OF,NF,AF,BF,MF,jF,RF;var jU=A(()=>{oQ=/^[cC][^\s-]{8,}$/,aQ=/^[0-9a-z]+$/,sQ=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tQ=/^[0-9a-vA-V]{20}$/,eQ=/^[A-Za-z0-9]{27}$/,$F=/^[a-zA-Z0-9_-]{21}$/,XF=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_6$=/^[-+]?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)?)??$/,YF=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,T6$=u9(4),C6$=u9(6),S6$=u9(7),JF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,b6$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,x6$=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,k6$=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,v6$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;UF=/^(?:(?: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])$/,GF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,HF=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,DF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VF=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,MU=/^[A-Za-z0-9_-]*$/,KF=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,y6$=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,QF=/^\+(?:[0-9]){6,14}[0-9]$/,FF=new RegExp(`^${OC}$`);zF=/^\d+n?$/,OF=/^\d+$/,NF=/^-?\d+(?:\.\d+)?/i,AF=/true|false/i,BF=/null/i,MF=/undefined/i,jF=/^[^A-Z]*$/,RF=/^[^a-z]*$/});function AC($,X,Y){if($.issues.length)X.issues.push(...D1(Y,$.issues))}var o6,BC,RU,LU,LF,EF,PF,IF,_F,TF,CF,SF,bF,RX,xF,kF,vF,hF,yF,fF,gF,mF,uF;var EU=A(()=>{AX();jU();n$();o6=c("$ZodCheck",($,X)=>{var Y;$._zod??($._zod={}),$._zod.def=X,(Y=$._zod).onattach??(Y.onattach=[])}),BC={number:"number",bigint:"bigint",object:"date"},RU=c("$ZodCheckLessThan",($,X)=>{o6.init($,X);let Y=BC[typeof X.value];$._zod.onattach.push((W)=>{let J=W._zod.bag,U=(X.inclusive?J.maximum:J.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<U)if(X.inclusive)J.maximum=X.value;else J.exclusiveMaximum=X.value}),$._zod.check=(W)=>{if(X.inclusive?W.value<=X.value:W.value<X.value)return;W.issues.push({origin:Y,code:"too_big",maximum:X.value,input:W.value,inclusive:X.inclusive,inst:$,continue:!X.abort})}}),LU=c("$ZodCheckGreaterThan",($,X)=>{o6.init($,X);let Y=BC[typeof X.value];$._zod.onattach.push((W)=>{let J=W._zod.bag,U=(X.inclusive?J.minimum:J.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>U)if(X.inclusive)J.minimum=X.value;else J.exclusiveMinimum=X.value}),$._zod.check=(W)=>{if(X.inclusive?W.value>=X.value:W.value>X.value)return;W.issues.push({origin:Y,code:"too_small",minimum:X.value,input:W.value,inclusive:X.inclusive,inst:$,continue:!X.abort})}}),LF=c("$ZodCheckMultipleOf",($,X)=>{o6.init($,X),$._zod.onattach.push((Y)=>{var W;(W=Y._zod.bag).multipleOf??(W.multipleOf=X.value)}),$._zod.check=(Y)=>{if(typeof Y.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof Y.value==="bigint"?Y.value%X.value===BigInt(0):hQ(Y.value,X.value)===0)return;Y.issues.push({origin:typeof Y.value,code:"not_multiple_of",divisor:X.value,input:Y.value,inst:$,continue:!X.abort})}}),EF=c("$ZodCheckNumberFormat",($,X)=>{o6.init($,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[J,U]=uQ[X.format];$._zod.onattach.push((H)=>{let D=H._zod.bag;if(D.format=X.format,D.minimum=J,D.maximum=U,Y)D.pattern=OF}),$._zod.check=(H)=>{let D=H.value;if(Y){if(!Number.isInteger(D)){H.issues.push({expected:W,format:X.format,code:"invalid_type",input:D,inst:$});return}if(!Number.isSafeInteger(D)){if(D>0)H.issues.push({input:D,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:W,continue:!X.abort});else H.issues.push({input:D,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:W,continue:!X.abort});return}}if(D<J)H.issues.push({origin:"number",input:D,code:"too_small",minimum:J,inclusive:!0,inst:$,continue:!X.abort});if(D>U)H.issues.push({origin:"number",input:D,code:"too_big",maximum:U,inst:$})}}),PF=c("$ZodCheckBigIntFormat",($,X)=>{o6.init($,X);let[Y,W]=pQ[X.format];$._zod.onattach.push((J)=>{let U=J._zod.bag;U.format=X.format,U.minimum=Y,U.maximum=W}),$._zod.check=(J)=>{let U=J.value;if(U<Y)J.issues.push({origin:"bigint",input:U,code:"too_small",minimum:Y,inclusive:!0,inst:$,continue:!X.abort});if(U>W)J.issues.push({origin:"bigint",input:U,code:"too_big",maximum:W,inst:$})}}),IF=c("$ZodCheckMaxSize",($,X)=>{var Y;o6.init($,X),(Y=$._zod.def).when??(Y.when=(W)=>{let J=W.value;return!e8(J)&&J.size!==void 0}),$._zod.onattach.push((W)=>{let J=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<J)W._zod.bag.maximum=X.maximum}),$._zod.check=(W)=>{let J=W.value;if(J.size<=X.maximum)return;W.issues.push({origin:pY(J),code:"too_big",maximum:X.maximum,input:J,inst:$,continue:!X.abort})}}),_F=c("$ZodCheckMinSize",($,X)=>{var Y;o6.init($,X),(Y=$._zod.def).when??(Y.when=(W)=>{let J=W.value;return!e8(J)&&J.size!==void 0}),$._zod.onattach.push((W)=>{let J=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>J)W._zod.bag.minimum=X.minimum}),$._zod.check=(W)=>{let J=W.value;if(J.size>=X.minimum)return;W.issues.push({origin:pY(J),code:"too_small",minimum:X.minimum,input:J,inst:$,continue:!X.abort})}}),TF=c("$ZodCheckSizeEquals",($,X)=>{var Y;o6.init($,X),(Y=$._zod.def).when??(Y.when=(W)=>{let J=W.value;return!e8(J)&&J.size!==void 0}),$._zod.onattach.push((W)=>{let J=W._zod.bag;J.minimum=X.size,J.maximum=X.size,J.size=X.size}),$._zod.check=(W)=>{let J=W.value,U=J.size;if(U===X.size)return;let H=U>X.size;W.issues.push({origin:pY(J),...H?{code:"too_big",maximum:X.size}:{code:"too_small",minimum:X.size},inclusive:!0,exact:!0,input:W.value,inst:$,continue:!X.abort})}}),CF=c("$ZodCheckMaxLength",($,X)=>{var Y;o6.init($,X),(Y=$._zod.def).when??(Y.when=(W)=>{let J=W.value;return!e8(J)&&J.length!==void 0}),$._zod.onattach.push((W)=>{let J=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<J)W._zod.bag.maximum=X.maximum}),$._zod.check=(W)=>{let J=W.value;if(J.length<=X.maximum)return;let H=cY(J);W.issues.push({origin:H,code:"too_big",maximum:X.maximum,inclusive:!0,input:J,inst:$,continue:!X.abort})}}),SF=c("$ZodCheckMinLength",($,X)=>{var Y;o6.init($,X),(Y=$._zod.def).when??(Y.when=(W)=>{let J=W.value;return!e8(J)&&J.length!==void 0}),$._zod.onattach.push((W)=>{let J=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>J)W._zod.bag.minimum=X.minimum}),$._zod.check=(W)=>{let J=W.value;if(J.length>=X.minimum)return;let H=cY(J);W.issues.push({origin:H,code:"too_small",minimum:X.minimum,inclusive:!0,input:J,inst:$,continue:!X.abort})}}),bF=c("$ZodCheckLengthEquals",($,X)=>{var Y;o6.init($,X),(Y=$._zod.def).when??(Y.when=(W)=>{let J=W.value;return!e8(J)&&J.length!==void 0}),$._zod.onattach.push((W)=>{let J=W._zod.bag;J.minimum=X.length,J.maximum=X.length,J.length=X.length}),$._zod.check=(W)=>{let J=W.value,U=J.length;if(U===X.length)return;let H=cY(J),D=U>X.length;W.issues.push({origin:H,...D?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:$,continue:!X.abort})}}),RX=c("$ZodCheckStringFormat",($,X)=>{var Y,W;if(o6.init($,X),$._zod.onattach.push((J)=>{let U=J._zod.bag;if(U.format=X.format,X.pattern)U.patterns??(U.patterns=new Set),U.patterns.add(X.pattern)}),X.pattern)(Y=$._zod).check??(Y.check=(J)=>{if(X.pattern.lastIndex=0,X.pattern.test(J.value))return;J.issues.push({origin:"string",code:"invalid_format",format:X.format,input:J.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:$,continue:!X.abort})});else(W=$._zod).check??(W.check=()=>{})}),xF=c("$ZodCheckRegex",($,X)=>{RX.init($,X),$._zod.check=(Y)=>{if(X.pattern.lastIndex=0,X.pattern.test(Y.value))return;Y.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Y.value,pattern:X.pattern.toString(),inst:$,continue:!X.abort})}}),kF=c("$ZodCheckLowerCase",($,X)=>{X.pattern??(X.pattern=jF),RX.init($,X)}),vF=c("$ZodCheckUpperCase",($,X)=>{X.pattern??(X.pattern=RF),RX.init($,X)}),hF=c("$ZodCheckIncludes",($,X)=>{o6.init($,X);let Y=w8(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=W,$._zod.onattach.push((J)=>{let U=J._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(W)}),$._zod.check=(J)=>{if(J.value.includes(X.includes,X.position))return;J.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:J.value,inst:$,continue:!X.abort})}}),yF=c("$ZodCheckStartsWith",($,X)=>{o6.init($,X);let Y=new RegExp(`^${w8(X.prefix)}.*`);X.pattern??(X.pattern=Y),$._zod.onattach.push((W)=>{let J=W._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(Y)}),$._zod.check=(W)=>{if(W.value.startsWith(X.prefix))return;W.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:W.value,inst:$,continue:!X.abort})}}),fF=c("$ZodCheckEndsWith",($,X)=>{o6.init($,X);let Y=new RegExp(`.*${w8(X.suffix)}$`);X.pattern??(X.pattern=Y),$._zod.onattach.push((W)=>{let J=W._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(Y)}),$._zod.check=(W)=>{if(W.value.endsWith(X.suffix))return;W.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:W.value,inst:$,continue:!X.abort})}});gF=c("$ZodCheckProperty",($,X)=>{o6.init($,X),$._zod.check=(Y)=>{let W=X.schema._zod.run({value:Y.value[X.property],issues:[]},{});if(W instanceof Promise)return W.then((J)=>AC(J,Y,X.property));AC(W,Y,X.property);return}}),mF=c("$ZodCheckMimeType",($,X)=>{o6.init($,X);let Y=new Set(X.mime);$._zod.onattach.push((W)=>{W._zod.bag.mime=X.mime}),$._zod.check=(W)=>{if(Y.has(W.value.type))return;W.issues.push({code:"invalid_value",values:X.mime,input:W.value.type,inst:$})}}),uF=c("$ZodCheckOverwrite",($,X)=>{o6.init($,X),$._zod.check=(Y)=>{Y.value=X.tx(Y.value)}})});class PU{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let Y=$.split(`
224
- `).filter((U)=>U),W=Math.min(...Y.map((U)=>U.length-U.trimStart().length)),J=Y.map((U)=>U.slice(W)).map((U)=>" ".repeat(this.indent*2)+U);for(let U of J)this.content.push(U)}compile(){let $=Function,X=this?.args,W=[...(this?.content??[""]).map((J)=>` ${J}`)];return new $(...X,W.join(`
225
- `))}}var pF;var cF=A(()=>{pF={major:4,minor:0,patch:0}});function K3($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function xC($){if(!MU.test($))return!1;let X=$.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return K3(Y)}function kC($,X=null){try{let Y=$.split(".");if(Y.length!==3)return!1;let[W]=Y;if(!W)return!1;let J=JSON.parse(atob(W));if("typ"in J&&J?.typ!=="JWT")return!1;if(!J.alg)return!1;if(X&&(!("alg"in J)||J.alg!==X))return!1;return!0}catch{return!1}}function jC($,X,Y){if($.issues.length)X.issues.push(...D1(Y,$.issues));X.value[Y]=$.value}function IU($,X,Y){if($.issues.length)X.issues.push(...D1(Y,$.issues));X.value[Y]=$.value}function RC($,X,Y,W){if($.issues.length)if(W[Y]===void 0)if(Y in W)X.value[Y]=void 0;else X.value[Y]=$.value;else X.issues.push(...D1(Y,$.issues));else if($.value===void 0){if(Y in W)X.value[Y]=void 0}else X.value[Y]=$.value}function LC($,X,Y,W){for(let J of $)if(J.issues.length===0)return X.value=J.value,X;return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:$.map((J)=>J.issues.map((U)=>R1(U,W,Q4())))}),X}function dF($,X){if($===X)return{valid:!0,data:$};if($ instanceof Date&&X instanceof Date&&+$===+X)return{valid:!0,data:$};if(MX($)&&MX(X)){let Y=Object.keys(X),W=Object.keys($).filter((U)=>Y.indexOf(U)!==-1),J={...$,...X};for(let U of W){let H=dF($[U],X[U]);if(!H.valid)return{valid:!1,mergeErrorPath:[U,...H.mergeErrorPath]};J[U]=H.data}return{valid:!0,data:J}}if(Array.isArray($)&&Array.isArray(X)){if($.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let W=0;W<$.length;W++){let J=$[W],U=X[W],H=dF(J,U);if(!H.valid)return{valid:!1,mergeErrorPath:[W,...H.mergeErrorPath]};Y.push(H.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function EC($,X,Y){if(X.issues.length)$.issues.push(...X.issues);if(Y.issues.length)$.issues.push(...Y.issues);if(m9($))return $;let W=dF(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return $.value=W.data,$}function _U($,X,Y){if($.issues.length)X.issues.push(...D1(Y,$.issues));X.value[Y]=$.value}function PC($,X,Y,W,J,U,H){if($.issues.length)if(uY.has(typeof W))Y.issues.push(...D1(W,$.issues));else Y.issues.push({origin:"map",code:"invalid_key",input:J,inst:U,issues:$.issues.map((D)=>R1(D,H,Q4()))});if(X.issues.length)if(uY.has(typeof W))Y.issues.push(...D1(W,X.issues));else Y.issues.push({origin:"map",code:"invalid_element",input:J,inst:U,key:W,issues:X.issues.map((D)=>R1(D,H,Q4()))});Y.value.set($.value,X.value)}function IC($,X){if($.issues.length)X.issues.push(...$.issues);X.value.add($.value)}function _C($,X){if($.value===void 0)$.value=X.defaultValue;return $}function TC($,X){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:X});return $}function CC($,X,Y){if(m9($))return $;return X.out._zod.run({value:$.value,issues:$.issues},Y)}function SC($){return $.value=Object.freeze($.value),$}function bC($,X,Y,W){if(!$){let J={code:"custom",input:Y,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)J.params=W._zod.def.params;X.issues.push(cQ(J))}}var s$,c9,y6,lF,iF,rF,nF,oF,aF,sF,tF,eF,$3,X3,Y3,J3,W3,U3,G3,H3,D3,V3,Q3,F3,q3,w3,Z3,TU,z3,rY,CU,O3,N3,A3,B3,M3,LX,j3,R3,L3,nY,E3,SU,P3,I3,d9,_3,T3,C3,S3,b3,x3,oY,k3,v3,h3,y3,f3,g3,m3,u3,aY,p3,c3,d3,l3,i3;var sY=A(()=>{EU();AX();BU();jU();n$();cF();n$();s$=c("$ZodType",($,X)=>{var Y;$??($={}),$._zod.def=X,$._zod.bag=$._zod.bag||{},$._zod.version=pF;let W=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))W.unshift($);for(let J of W)for(let U of J._zod.onattach)U($);if(W.length===0)(Y=$._zod).deferred??(Y.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let J=(U,H,D)=>{let V=m9(U),K;for(let Q of H){if(Q._zod.def.when){if(!Q._zod.def.when(U))continue}else if(V)continue;let q=U.issues.length,F=Q._zod.check(U);if(F instanceof Promise&&D?.async===!1)throw new q8;if(K||F instanceof Promise)K=(K??Promise.resolve()).then(async()=>{if(await F,U.issues.length===q)return;if(!V)V=m9(U,q)});else{if(U.issues.length===q)continue;if(!V)V=m9(U,q)}}if(K)return K.then(()=>{return U});return U};$._zod.run=(U,H)=>{let D=$._zod.parse(U,H);if(D instanceof Promise){if(H.async===!1)throw new q8;return D.then((V)=>J(V,W,H))}return J(D,W,H)}}$["~standard"]={validate:(J)=>{try{let U=rQ($,J);return U.success?{value:U.data}:{issues:U.error?.issues}}catch(U){return nQ($,J).then((H)=>H.success?{value:H.data}:{issues:H.error?.issues})}},vendor:"zod",version:1}}),c9=c("$ZodString",($,X)=>{s$.init($,X),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??ZF($._zod.bag),$._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=String(Y.value)}catch(J){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:$}),Y}}),y6=c("$ZodStringFormat",($,X)=>{RX.init($,X),c9.init($,X)}),lF=c("$ZodGUID",($,X)=>{X.pattern??(X.pattern=YF),y6.init($,X)}),iF=c("$ZodUUID",($,X)=>{if(X.version){let W={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(W===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=u9(W))}else X.pattern??(X.pattern=u9());y6.init($,X)}),rF=c("$ZodEmail",($,X)=>{X.pattern??(X.pattern=JF),y6.init($,X)}),nF=c("$ZodURL",($,X)=>{y6.init($,X),$._zod.check=(Y)=>{try{let W=Y.value,J=new URL(W),U=J.href;if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(J.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:KF.source,input:Y.value,inst:$,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Y.value,inst:$,continue:!X.abort})}if(!W.endsWith("/")&&U.endsWith("/"))Y.value=U.slice(0,-1);else Y.value=U;return}catch(W){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:$,continue:!X.abort})}}}),oF=c("$ZodEmoji",($,X)=>{X.pattern??(X.pattern=WF()),y6.init($,X)}),aF=c("$ZodNanoID",($,X)=>{X.pattern??(X.pattern=$F),y6.init($,X)}),sF=c("$ZodCUID",($,X)=>{X.pattern??(X.pattern=oQ),y6.init($,X)}),tF=c("$ZodCUID2",($,X)=>{X.pattern??(X.pattern=aQ),y6.init($,X)}),eF=c("$ZodULID",($,X)=>{X.pattern??(X.pattern=sQ),y6.init($,X)}),$3=c("$ZodXID",($,X)=>{X.pattern??(X.pattern=tQ),y6.init($,X)}),X3=c("$ZodKSUID",($,X)=>{X.pattern??(X.pattern=eQ),y6.init($,X)}),Y3=c("$ZodISODateTime",($,X)=>{X.pattern??(X.pattern=wF(X)),y6.init($,X)}),J3=c("$ZodISODate",($,X)=>{X.pattern??(X.pattern=FF),y6.init($,X)}),W3=c("$ZodISOTime",($,X)=>{X.pattern??(X.pattern=qF(X)),y6.init($,X)}),U3=c("$ZodISODuration",($,X)=>{X.pattern??(X.pattern=XF),y6.init($,X)}),G3=c("$ZodIPv4",($,X)=>{X.pattern??(X.pattern=UF),y6.init($,X),$._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv4"})}),H3=c("$ZodIPv6",($,X)=>{X.pattern??(X.pattern=GF),y6.init($,X),$._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv6"}),$._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:$,continue:!X.abort})}}}),D3=c("$ZodCIDRv4",($,X)=>{X.pattern??(X.pattern=HF),y6.init($,X)}),V3=c("$ZodCIDRv6",($,X)=>{X.pattern??(X.pattern=DF),y6.init($,X),$._zod.check=(Y)=>{let[W,J]=Y.value.split("/");try{if(!J)throw Error();let U=Number(J);if(`${U}`!==J)throw Error();if(U<0||U>128)throw Error();new URL(`http://[${W}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:$,continue:!X.abort})}}});Q3=c("$ZodBase64",($,X)=>{X.pattern??(X.pattern=VF),y6.init($,X),$._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),$._zod.check=(Y)=>{if(K3(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:$,continue:!X.abort})}});F3=c("$ZodBase64URL",($,X)=>{X.pattern??(X.pattern=MU),y6.init($,X),$._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),$._zod.check=(Y)=>{if(xC(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:$,continue:!X.abort})}}),q3=c("$ZodE164",($,X)=>{X.pattern??(X.pattern=QF),y6.init($,X)});w3=c("$ZodJWT",($,X)=>{y6.init($,X),$._zod.check=(Y)=>{if(kC(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:$,continue:!X.abort})}}),Z3=c("$ZodCustomStringFormat",($,X)=>{y6.init($,X),$._zod.check=(Y)=>{if(X.fn(Y.value))return;Y.issues.push({code:"invalid_format",format:X.format,input:Y.value,inst:$,continue:!X.abort})}}),TU=c("$ZodNumber",($,X)=>{s$.init($,X),$._zod.pattern=$._zod.bag.pattern??NF,$._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch(H){}let J=Y.value;if(typeof J==="number"&&!Number.isNaN(J)&&Number.isFinite(J))return Y;let U=typeof J==="number"?Number.isNaN(J)?"NaN":!Number.isFinite(J)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:J,inst:$,...U?{received:U}:{}}),Y}}),z3=c("$ZodNumber",($,X)=>{EF.init($,X),TU.init($,X)}),rY=c("$ZodBoolean",($,X)=>{s$.init($,X),$._zod.pattern=AF,$._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(U){}let J=Y.value;if(typeof J==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:J,inst:$}),Y}}),CU=c("$ZodBigInt",($,X)=>{s$.init($,X),$._zod.pattern=zF,$._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=BigInt(Y.value)}catch(J){}if(typeof Y.value==="bigint")return Y;return Y.issues.push({expected:"bigint",code:"invalid_type",input:Y.value,inst:$}),Y}}),O3=c("$ZodBigInt",($,X)=>{PF.init($,X),CU.init($,X)}),N3=c("$ZodSymbol",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=Y.value;if(typeof J==="symbol")return Y;return Y.issues.push({expected:"symbol",code:"invalid_type",input:J,inst:$}),Y}}),A3=c("$ZodUndefined",($,X)=>{s$.init($,X),$._zod.pattern=MF,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(Y,W)=>{let J=Y.value;if(typeof J>"u")return Y;return Y.issues.push({expected:"undefined",code:"invalid_type",input:J,inst:$}),Y}}),B3=c("$ZodNull",($,X)=>{s$.init($,X),$._zod.pattern=BF,$._zod.values=new Set([null]),$._zod.parse=(Y,W)=>{let J=Y.value;if(J===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:J,inst:$}),Y}}),M3=c("$ZodAny",($,X)=>{s$.init($,X),$._zod.parse=(Y)=>Y}),LX=c("$ZodUnknown",($,X)=>{s$.init($,X),$._zod.parse=(Y)=>Y}),j3=c("$ZodNever",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:$}),Y}}),R3=c("$ZodVoid",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=Y.value;if(typeof J>"u")return Y;return Y.issues.push({expected:"void",code:"invalid_type",input:J,inst:$}),Y}}),L3=c("$ZodDate",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=new Date(Y.value)}catch(D){}let J=Y.value,U=J instanceof Date;if(U&&!Number.isNaN(J.getTime()))return Y;return Y.issues.push({expected:"date",code:"invalid_type",input:J,...U?{received:"Invalid Date"}:{},inst:$}),Y}});nY=c("$ZodArray",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=Y.value;if(!Array.isArray(J))return Y.issues.push({expected:"array",code:"invalid_type",input:J,inst:$}),Y;Y.value=Array(J.length);let U=[];for(let H=0;H<J.length;H++){let D=J[H],V=X.element._zod.run({value:D,issues:[]},W);if(V instanceof Promise)U.push(V.then((K)=>jC(K,Y,H)));else jC(V,Y,H)}if(U.length)return Promise.all(U).then(()=>Y);return Y}});E3=c("$ZodObject",($,X)=>{s$.init($,X);let Y=gY(()=>{let q=Object.keys(X.shape);for(let w of q)if(!(X.shape[w]instanceof s$))throw Error(`Invalid element at key "${w}": expected a Zod schema`);let F=mQ(X.shape);return{shape:X.shape,keys:q,keySet:new Set(q),numKeys:q.length,optionalKeys:new Set(F)}});I6($._zod,"propValues",()=>{let q=X.shape,F={};for(let w in q){let z=q[w]._zod;if(z.values){F[w]??(F[w]=new Set);for(let O of z.values)F[w].add(O)}}return F});let W=(q)=>{let F=new PU(["shape","payload","ctx"]),w=Y.value,z=(P)=>{let j=g9(P);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};F.write("const input = payload.value;");let O=Object.create(null),N=0;for(let P of w.keys)O[P]=`key_${N++}`;F.write("const newResult = {}");for(let P of w.keys)if(w.optionalKeys.has(P)){let j=O[P];F.write(`const ${j} = ${z(P)};`);let v=g9(P);F.write(`
226
- if (${j}.issues.length) {
227
- if (input[${v}] === undefined) {
228
- if (${v} in input) {
229
- newResult[${v}] = undefined;
230
- }
231
- } else {
232
- payload.issues = payload.issues.concat(
233
- ${j}.issues.map((iss) => ({
234
- ...iss,
235
- path: iss.path ? [${v}, ...iss.path] : [${v}],
236
- }))
237
- );
238
- }
239
- } else if (${j}.value === undefined) {
240
- if (${v} in input) newResult[${v}] = undefined;
241
- } else {
242
- newResult[${v}] = ${j}.value;
243
- }
244
- `)}else{let j=O[P];F.write(`const ${j} = ${z(P)};`),F.write(`
245
- if (${j}.issues.length) payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
246
- ...iss,
247
- path: iss.path ? [${g9(P)}, ...iss.path] : [${g9(P)}]
248
- })));`),F.write(`newResult[${g9(P)}] = ${j}.value`)}F.write("payload.value = newResult;"),F.write("return payload;");let L=F.compile();return(P,j)=>L(q,P,j)},J,U=BX,H=!hY.jitless,V=H&&fQ.value,K=X.catchall,Q;$._zod.parse=(q,F)=>{Q??(Q=Y.value);let w=q.value;if(!U(w))return q.issues.push({expected:"object",code:"invalid_type",input:w,inst:$}),q;let z=[];if(H&&V&&F?.async===!1&&F.jitless!==!0){if(!J)J=W(X.shape);q=J(q,F)}else{q.value={};let j=Q.shape;for(let v of Q.keys){let y=j[v],E=y._zod.run({value:w[v],issues:[]},F),b=y._zod.optin==="optional"&&y._zod.optout==="optional";if(E instanceof Promise)z.push(E.then((R)=>b?RC(R,q,v,w):IU(R,q,v)));else if(b)RC(E,q,v,w);else IU(E,q,v)}}if(!K)return z.length?Promise.all(z).then(()=>q):q;let O=[],N=Q.keySet,L=K._zod,P=L.def.type;for(let j of Object.keys(w)){if(N.has(j))continue;if(P==="never"){O.push(j);continue}let v=L.run({value:w[j],issues:[]},F);if(v instanceof Promise)z.push(v.then((y)=>IU(y,q,j)));else IU(v,q,j)}if(O.length)q.issues.push({code:"unrecognized_keys",keys:O,input:w,inst:$});if(!z.length)return q;return Promise.all(z).then(()=>{return q})}});SU=c("$ZodUnion",($,X)=>{s$.init($,X),I6($._zod,"optin",()=>X.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),I6($._zod,"optout",()=>X.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),I6($._zod,"values",()=>{if(X.options.every((Y)=>Y._zod.values))return new Set(X.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),I6($._zod,"pattern",()=>{if(X.options.every((Y)=>Y._zod.pattern)){let Y=X.options.map((W)=>W._zod.pattern);return new RegExp(`^(${Y.map((W)=>mY(W.source)).join("|")})$`)}return}),$._zod.parse=(Y,W)=>{let J=!1,U=[];for(let H of X.options){let D=H._zod.run({value:Y.value,issues:[]},W);if(D instanceof Promise)U.push(D),J=!0;else{if(D.issues.length===0)return D;U.push(D)}}if(!J)return LC(U,Y,$,W);return Promise.all(U).then((H)=>{return LC(H,Y,$,W)})}}),P3=c("$ZodDiscriminatedUnion",($,X)=>{SU.init($,X);let Y=$._zod.parse;I6($._zod,"propValues",()=>{let J={};for(let U of X.options){let H=U._zod.propValues;if(!H||Object.keys(H).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(U)}"`);for(let[D,V]of Object.entries(H)){if(!J[D])J[D]=new Set;for(let K of V)J[D].add(K)}}return J});let W=gY(()=>{let J=X.options,U=new Map;for(let H of J){let D=H._zod.propValues[X.discriminator];if(!D||D.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(H)}"`);for(let V of D){if(U.has(V))throw Error(`Duplicate discriminator value "${String(V)}"`);U.set(V,H)}}return U});$._zod.parse=(J,U)=>{let H=J.value;if(!BX(H))return J.issues.push({code:"invalid_type",expected:"object",input:H,inst:$}),J;let D=W.value.get(H?.[X.discriminator]);if(D)return D._zod.run(J,U);if(X.unionFallback)return Y(J,U);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:H,path:[X.discriminator],inst:$}),J}}),I3=c("$ZodIntersection",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=Y.value,U=X.left._zod.run({value:J,issues:[]},W),H=X.right._zod.run({value:J,issues:[]},W);if(U instanceof Promise||H instanceof Promise)return Promise.all([U,H]).then(([V,K])=>{return EC(Y,V,K)});return EC(Y,U,H)}});d9=c("$ZodTuple",($,X)=>{s$.init($,X);let Y=X.items,W=Y.length-[...Y].reverse().findIndex((J)=>J._zod.optin!=="optional");$._zod.parse=(J,U)=>{let H=J.value;if(!Array.isArray(H))return J.issues.push({input:H,inst:$,expected:"tuple",code:"invalid_type"}),J;J.value=[];let D=[];if(!X.rest){let K=H.length>Y.length,Q=H.length<W-1;if(K||Q)return J.issues.push({input:H,inst:$,origin:"array",...K?{code:"too_big",maximum:Y.length}:{code:"too_small",minimum:Y.length}}),J}let V=-1;for(let K of Y){if(V++,V>=H.length){if(V>=W)continue}let Q=K._zod.run({value:H[V],issues:[]},U);if(Q instanceof Promise)D.push(Q.then((q)=>_U(q,J,V)));else _U(Q,J,V)}if(X.rest){let K=H.slice(Y.length);for(let Q of K){V++;let q=X.rest._zod.run({value:Q,issues:[]},U);if(q instanceof Promise)D.push(q.then((F)=>_U(F,J,V)));else _U(q,J,V)}}if(D.length)return Promise.all(D).then(()=>J);return J}});_3=c("$ZodRecord",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=Y.value;if(!MX(J))return Y.issues.push({expected:"record",code:"invalid_type",input:J,inst:$}),Y;let U=[];if(X.keyType._zod.values){let H=X.keyType._zod.values;Y.value={};for(let V of H)if(typeof V==="string"||typeof V==="number"||typeof V==="symbol"){let K=X.valueType._zod.run({value:J[V],issues:[]},W);if(K instanceof Promise)U.push(K.then((Q)=>{if(Q.issues.length)Y.issues.push(...D1(V,Q.issues));Y.value[V]=Q.value}));else{if(K.issues.length)Y.issues.push(...D1(V,K.issues));Y.value[V]=K.value}}let D;for(let V in J)if(!H.has(V))D=D??[],D.push(V);if(D&&D.length>0)Y.issues.push({code:"unrecognized_keys",input:J,inst:$,keys:D})}else{Y.value={};for(let H of Reflect.ownKeys(J)){if(H==="__proto__")continue;let D=X.keyType._zod.run({value:H,issues:[]},W);if(D instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(D.issues.length){Y.issues.push({origin:"record",code:"invalid_key",issues:D.issues.map((K)=>R1(K,W,Q4())),input:H,path:[H],inst:$}),Y.value[D.value]=D.value;continue}let V=X.valueType._zod.run({value:J[H],issues:[]},W);if(V instanceof Promise)U.push(V.then((K)=>{if(K.issues.length)Y.issues.push(...D1(H,K.issues));Y.value[D.value]=K.value}));else{if(V.issues.length)Y.issues.push(...D1(H,V.issues));Y.value[D.value]=V.value}}}if(U.length)return Promise.all(U).then(()=>Y);return Y}}),T3=c("$ZodMap",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=Y.value;if(!(J instanceof Map))return Y.issues.push({expected:"map",code:"invalid_type",input:J,inst:$}),Y;let U=[];Y.value=new Map;for(let[H,D]of J){let V=X.keyType._zod.run({value:H,issues:[]},W),K=X.valueType._zod.run({value:D,issues:[]},W);if(V instanceof Promise||K instanceof Promise)U.push(Promise.all([V,K]).then(([Q,q])=>{PC(Q,q,Y,H,J,$,W)}));else PC(V,K,Y,H,J,$,W)}if(U.length)return Promise.all(U).then(()=>Y);return Y}});C3=c("$ZodSet",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=Y.value;if(!(J instanceof Set))return Y.issues.push({input:J,inst:$,expected:"set",code:"invalid_type"}),Y;let U=[];Y.value=new Set;for(let H of J){let D=X.valueType._zod.run({value:H,issues:[]},W);if(D instanceof Promise)U.push(D.then((V)=>IC(V,Y)));else IC(D,Y)}if(U.length)return Promise.all(U).then(()=>Y);return Y}});S3=c("$ZodEnum",($,X)=>{s$.init($,X);let Y=fY(X.entries);$._zod.values=new Set(Y),$._zod.pattern=new RegExp(`^(${Y.filter((W)=>uY.has(typeof W)).map((W)=>typeof W==="string"?w8(W):W.toString()).join("|")})$`),$._zod.parse=(W,J)=>{let U=W.value;if($._zod.values.has(U))return W;return W.issues.push({code:"invalid_value",values:Y,input:U,inst:$}),W}}),b3=c("$ZodLiteral",($,X)=>{s$.init($,X),$._zod.values=new Set(X.values),$._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?w8(Y):Y?Y.toString():String(Y)).join("|")})$`),$._zod.parse=(Y,W)=>{let J=Y.value;if($._zod.values.has(J))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:J,inst:$}),Y}}),x3=c("$ZodFile",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=Y.value;if(J instanceof File)return Y;return Y.issues.push({expected:"file",code:"invalid_type",input:J,inst:$}),Y}}),oY=c("$ZodTransform",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=X.transform(Y.value,Y);if(W.async)return(J instanceof Promise?J:Promise.resolve(J)).then((H)=>{return Y.value=H,Y});if(J instanceof Promise)throw new q8;return Y.value=J,Y}}),k3=c("$ZodOptional",($,X)=>{s$.init($,X),$._zod.optin="optional",$._zod.optout="optional",I6($._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),I6($._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${mY(Y.source)})?$`):void 0}),$._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional")return X.innerType._zod.run(Y,W);if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),v3=c("$ZodNullable",($,X)=>{s$.init($,X),I6($._zod,"optin",()=>X.innerType._zod.optin),I6($._zod,"optout",()=>X.innerType._zod.optout),I6($._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${mY(Y.source)}|null)$`):void 0}),I6($._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),$._zod.parse=(Y,W)=>{if(Y.value===null)return Y;return X.innerType._zod.run(Y,W)}}),h3=c("$ZodDefault",($,X)=>{s$.init($,X),$._zod.optin="optional",I6($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,W)=>{if(Y.value===void 0)return Y.value=X.defaultValue,Y;let J=X.innerType._zod.run(Y,W);if(J instanceof Promise)return J.then((U)=>_C(U,X));return _C(J,X)}});y3=c("$ZodPrefault",($,X)=>{s$.init($,X),$._zod.optin="optional",I6($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,W)=>{if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,W)}}),f3=c("$ZodNonOptional",($,X)=>{s$.init($,X),I6($._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((W)=>W!==void 0)):void 0}),$._zod.parse=(Y,W)=>{let J=X.innerType._zod.run(Y,W);if(J instanceof Promise)return J.then((U)=>TC(U,$));return TC(J,$)}});g3=c("$ZodSuccess",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{let J=X.innerType._zod.run(Y,W);if(J instanceof Promise)return J.then((U)=>{return Y.value=U.issues.length===0,Y});return Y.value=J.issues.length===0,Y}}),m3=c("$ZodCatch",($,X)=>{s$.init($,X),$._zod.optin="optional",I6($._zod,"optout",()=>X.innerType._zod.optout),I6($._zod,"values",()=>X.innerType._zod.values),$._zod.parse=(Y,W)=>{let J=X.innerType._zod.run(Y,W);if(J instanceof Promise)return J.then((U)=>{if(Y.value=U.value,U.issues.length)Y.value=X.catchValue({...Y,error:{issues:U.issues.map((H)=>R1(H,W,Q4()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=J.value,J.issues.length)Y.value=X.catchValue({...Y,error:{issues:J.issues.map((U)=>R1(U,W,Q4()))},input:Y.value}),Y.issues=[];return Y}}),u3=c("$ZodNaN",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{if(typeof Y.value!=="number"||!Number.isNaN(Y.value))return Y.issues.push({input:Y.value,inst:$,expected:"nan",code:"invalid_type"}),Y;return Y}}),aY=c("$ZodPipe",($,X)=>{s$.init($,X),I6($._zod,"values",()=>X.in._zod.values),I6($._zod,"optin",()=>X.in._zod.optin),I6($._zod,"optout",()=>X.out._zod.optout),$._zod.parse=(Y,W)=>{let J=X.in._zod.run(Y,W);if(J instanceof Promise)return J.then((U)=>CC(U,X,W));return CC(J,X,W)}});p3=c("$ZodReadonly",($,X)=>{s$.init($,X),I6($._zod,"propValues",()=>X.innerType._zod.propValues),I6($._zod,"values",()=>X.innerType._zod.values),I6($._zod,"optin",()=>X.innerType._zod.optin),I6($._zod,"optout",()=>X.innerType._zod.optout),$._zod.parse=(Y,W)=>{let J=X.innerType._zod.run(Y,W);if(J instanceof Promise)return J.then(SC);return SC(J)}});c3=c("$ZodTemplateLiteral",($,X)=>{s$.init($,X);let Y=[];for(let W of X.parts)if(W instanceof s$){if(!W._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...W._zod.traits].shift()}`);let J=W._zod.pattern instanceof RegExp?W._zod.pattern.source:W._zod.pattern;if(!J)throw Error(`Invalid template literal part: ${W._zod.traits}`);let U=J.startsWith("^")?1:0,H=J.endsWith("$")?J.length-1:J.length;Y.push(J.slice(U,H))}else if(W===null||gQ.has(typeof W))Y.push(w8(`${W}`));else throw Error(`Invalid template literal part: ${W}`);$._zod.pattern=new RegExp(`^${Y.join("")}$`),$._zod.parse=(W,J)=>{if(typeof W.value!=="string")return W.issues.push({input:W.value,inst:$,expected:"template_literal",code:"invalid_type"}),W;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(W.value))return W.issues.push({input:W.value,inst:$,code:"invalid_format",format:"template_literal",pattern:$._zod.pattern.source}),W;return W}}),d3=c("$ZodPromise",($,X)=>{s$.init($,X),$._zod.parse=(Y,W)=>{return Promise.resolve(Y.value).then((J)=>X.innerType._zod.run({value:J,issues:[]},W))}}),l3=c("$ZodLazy",($,X)=>{s$.init($,X),I6($._zod,"innerType",()=>X.getter()),I6($._zod,"pattern",()=>$._zod.innerType._zod.pattern),I6($._zod,"propValues",()=>$._zod.innerType._zod.propValues),I6($._zod,"optin",()=>$._zod.innerType._zod.optin),I6($._zod,"optout",()=>$._zod.innerType._zod.optout),$._zod.parse=(Y,W)=>{return $._zod.innerType._zod.run(Y,W)}}),i3=c("$ZodCustom",($,X)=>{o6.init($,X),s$.init($,X),$._zod.parse=(Y,W)=>{return Y},$._zod.check=(Y)=>{let W=Y.value,J=X.fn(W);if(J instanceof Promise)return J.then((U)=>bC(U,Y,W,$));bC(J,Y,W,$);return}})});function r3(){return{localeError:f6$()}}var f6$=()=>{let $={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return(J)=>{switch(J.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${J.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${L$(J.values[0])}`;return`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${J.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${U} ${J.maximum.toString()} ${H.unit??"\u0639\u0646\u0635\u0631"}`;return`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${J.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${U} ${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${J.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${U} ${J.minimum.toString()} ${H.unit}`;return`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${J.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${U} ${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${J.prefix}"`;if(U.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${U.suffix}"`;if(U.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${U.includes}"`;if(U.format==="regex")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${U.pattern}`;return`${W[U.format]??J.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${J.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${J.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${J.keys.length>1?"\u0629":""}: ${e(J.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${J.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${J.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};var hC=A(()=>{n$()});function n3(){return{localeError:g6$()}}var g6$=()=>{let $={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(J)=>{switch(J.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${J.expected}, daxil olan ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${L$(J.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${J.origin??"d\u0259y\u0259r"} ${U}${J.maximum.toString()} ${H.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${J.origin??"d\u0259y\u0259r"} ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${J.origin} ${U}${J.minimum.toString()} ${H.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${J.origin} ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${U.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(U.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${U.suffix}" il\u0259 bitm\u0259lidir`;if(U.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${U.includes}" daxil olmal\u0131d\u0131r`;if(U.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${U.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${W[U.format]??J.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${J.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${J.keys.length>1?"lar":""}: ${e(J.keys,", ")}`;case"invalid_key":return`${J.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${J.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};var yC=A(()=>{n$()});function fC($,X,Y,W){let J=Math.abs($),U=J%10,H=J%100;if(H>=11&&H<=19)return W;if(U===1)return X;if(U>=2&&U<=4)return Y;return W}function o3(){return{localeError:m6$()}}var m6$=()=>{let $={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(J))return"\u043C\u0430\u0441\u0456\u045E";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return(J)=>{switch(J.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${J.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${L$(J.values[0])}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H){let D=Number(J.maximum),V=fC(D,H.unit.one,H.unit.few,H.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${J.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${H.verb} ${U}${J.maximum.toString()} ${V}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${J.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H){let D=Number(J.minimum),V=fC(D,H.unit.one,H.unit.few,H.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${J.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${H.verb} ${U}${J.minimum.toString()} ${V}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${J.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${U.prefix}"`;if(U.format==="ends_with")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${U.suffix}"`;if(U.format==="includes")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${U.includes}"`;if(U.format==="regex")return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${U.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${W[U.format]??J.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${J.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${J.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${e(J.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${J.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${J.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};var gC=A(()=>{n$()});function a3(){return{localeError:u6$()}}var u6$=()=>{let $={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(J)=>{switch(J.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${J.expected}, s'ha rebut ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Valor inv\xE0lid: s'esperava ${L$(J.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${e(J.values," o ")}`;case"too_big":{let U=J.inclusive?"com a m\xE0xim":"menys de",H=X(J.origin);if(H)return`Massa gran: s'esperava que ${J.origin??"el valor"} contingu\xE9s ${U} ${J.maximum.toString()} ${H.unit??"elements"}`;return`Massa gran: s'esperava que ${J.origin??"el valor"} fos ${U} ${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?"com a m\xEDnim":"m\xE9s de",H=X(J.origin);if(H)return`Massa petit: s'esperava que ${J.origin} contingu\xE9s ${U} ${J.minimum.toString()} ${H.unit}`;return`Massa petit: s'esperava que ${J.origin} fos ${U} ${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${U.prefix}"`;if(U.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${U.suffix}"`;if(U.format==="includes")return`Format inv\xE0lid: ha d'incloure "${U.includes}"`;if(U.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${U.pattern}`;return`Format inv\xE0lid per a ${W[U.format]??J.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${J.divisor}`;case"unrecognized_keys":return`Clau${J.keys.length>1?"s":""} no reconeguda${J.keys.length>1?"s":""}: ${e(J.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${J.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${J.origin}`;default:return"Entrada inv\xE0lida"}}};var mC=A(()=>{n$()});function s3(){return{localeError:p6$()}}var p6$=()=>{let $={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(J))return"pole";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return(J)=>{switch(J.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${J.expected}, obdr\u017Eeno ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${L$(J.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${J.origin??"hodnota"} mus\xED m\xEDt ${U}${J.maximum.toString()} ${H.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${J.origin??"hodnota"} mus\xED b\xFDt ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${J.origin??"hodnota"} mus\xED m\xEDt ${U}${J.minimum.toString()} ${H.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${J.origin??"hodnota"} mus\xED b\xFDt ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${U.prefix}"`;if(U.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${U.suffix}"`;if(U.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${U.includes}"`;if(U.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${U.pattern}`;return`Neplatn\xFD form\xE1t ${W[U.format]??J.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${J.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${e(J.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${J.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${J.origin}`;default:return"Neplatn\xFD vstup"}}};var uC=A(()=>{n$()});function t3(){return{localeError:c6$()}}var c6$=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"Zahl";case"object":{if(Array.isArray(J))return"Array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(J)=>{switch(J.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${J.expected}, erhalten ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${L$(J.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Zu gro\xDF: erwartet, dass ${J.origin??"Wert"} ${U}${J.maximum.toString()} ${H.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${J.origin??"Wert"} ${U}${J.maximum.toString()} ist`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Zu klein: erwartet, dass ${J.origin} ${U}${J.minimum.toString()} ${H.unit} hat`;return`Zu klein: erwartet, dass ${J.origin} ${U}${J.minimum.toString()} ist`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Ung\xFCltiger String: muss mit "${U.prefix}" beginnen`;if(U.format==="ends_with")return`Ung\xFCltiger String: muss mit "${U.suffix}" enden`;if(U.format==="includes")return`Ung\xFCltiger String: muss "${U.includes}" enthalten`;if(U.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${U.pattern} entsprechen`;return`Ung\xFCltig: ${W[U.format]??J.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${J.divisor} sein`;case"unrecognized_keys":return`${J.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${e(J.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${J.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${J.origin}`;default:return"Ung\xFCltige Eingabe"}}};var pC=A(()=>{n$()});function tY(){return{localeError:l6$()}}var d6$=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},l6$=()=>{let $={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function X(W){return $[W]??null}let Y={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(W)=>{switch(W.code){case"invalid_type":return`Invalid input: expected ${W.expected}, received ${d6$(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${L$(W.values[0])}`;return`Invalid option: expected one of ${e(W.values,"|")}`;case"too_big":{let J=W.inclusive?"<=":"<",U=X(W.origin);if(U)return`Too big: expected ${W.origin??"value"} to have ${J}${W.maximum.toString()} ${U.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${J}${W.maximum.toString()}`}case"too_small":{let J=W.inclusive?">=":">",U=X(W.origin);if(U)return`Too small: expected ${W.origin} to have ${J}${W.minimum.toString()} ${U.unit}`;return`Too small: expected ${W.origin} to be ${J}${W.minimum.toString()}`}case"invalid_format":{let J=W;if(J.format==="starts_with")return`Invalid string: must start with "${J.prefix}"`;if(J.format==="ends_with")return`Invalid string: must end with "${J.suffix}"`;if(J.format==="includes")return`Invalid string: must include "${J.includes}"`;if(J.format==="regex")return`Invalid string: must match pattern ${J.pattern}`;return`Invalid ${Y[J.format]??W.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${W.divisor}`;case"unrecognized_keys":return`Unrecognized key${W.keys.length>1?"s":""}: ${e(W.keys,", ")}`;case"invalid_key":return`Invalid key in ${W.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${W.origin}`;default:return"Invalid input"}}};var e3=A(()=>{n$()});function $q(){return{localeError:r6$()}}var i6$=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"nombro";case"object":{if(Array.isArray($))return"tabelo";if($===null)return"senvalora";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},r6$=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function X(W){return $[W]??null}let Y={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(W)=>{switch(W.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${W.expected}, ricevi\u011Dis ${i6$(W.input)}`;case"invalid_value":if(W.values.length===1)return`Nevalida enigo: atendi\u011Dis ${L$(W.values[0])}`;return`Nevalida opcio: atendi\u011Dis unu el ${e(W.values,"|")}`;case"too_big":{let J=W.inclusive?"<=":"<",U=X(W.origin);if(U)return`Tro granda: atendi\u011Dis ke ${W.origin??"valoro"} havu ${J}${W.maximum.toString()} ${U.unit??"elementojn"}`;return`Tro granda: atendi\u011Dis ke ${W.origin??"valoro"} havu ${J}${W.maximum.toString()}`}case"too_small":{let J=W.inclusive?">=":">",U=X(W.origin);if(U)return`Tro malgranda: atendi\u011Dis ke ${W.origin} havu ${J}${W.minimum.toString()} ${U.unit}`;return`Tro malgranda: atendi\u011Dis ke ${W.origin} estu ${J}${W.minimum.toString()}`}case"invalid_format":{let J=W;if(J.format==="starts_with")return`Nevalida karaktraro: devas komenci\u011Di per "${J.prefix}"`;if(J.format==="ends_with")return`Nevalida karaktraro: devas fini\u011Di per "${J.suffix}"`;if(J.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${J.includes}"`;if(J.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${J.pattern}`;return`Nevalida ${Y[J.format]??W.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${W.divisor}`;case"unrecognized_keys":return`Nekonata${W.keys.length>1?"j":""} \u015Dlosilo${W.keys.length>1?"j":""}: ${e(W.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${W.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${W.origin}`;default:return"Nevalida enigo"}}};var cC=A(()=>{n$()});function Xq(){return{localeError:n6$()}}var n6$=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(J))return"arreglo";if(J===null)return"nulo";if(Object.getPrototypeOf(J)!==Object.prototype)return J.constructor.name}}return U},W={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(J)=>{switch(J.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${J.expected}, recibido ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Entrada inv\xE1lida: se esperaba ${L$(J.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Demasiado grande: se esperaba que ${J.origin??"valor"} tuviera ${U}${J.maximum.toString()} ${H.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${J.origin??"valor"} fuera ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Demasiado peque\xF1o: se esperaba que ${J.origin} tuviera ${U}${J.minimum.toString()} ${H.unit}`;return`Demasiado peque\xF1o: se esperaba que ${J.origin} fuera ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${U.prefix}"`;if(U.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${U.suffix}"`;if(U.format==="includes")return`Cadena inv\xE1lida: debe incluir "${U.includes}"`;if(U.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${U.pattern}`;return`Inv\xE1lido ${W[U.format]??J.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${J.divisor}`;case"unrecognized_keys":return`Llave${J.keys.length>1?"s":""} desconocida${J.keys.length>1?"s":""}: ${e(J.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${J.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${J.origin}`;default:return"Entrada inv\xE1lida"}}};var dC=A(()=>{n$()});function Yq(){return{localeError:o6$()}}var o6$=()=>{let $={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(J))return"\u0622\u0631\u0627\u06CC\u0647";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return(J)=>{switch(J.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${J.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${Y(J.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":if(J.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${L$(J.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${e(J.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${J.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${U}${J.maximum.toString()} ${H.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${J.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${U}${J.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${J.origin} \u0628\u0627\u06CC\u062F ${U}${J.minimum.toString()} ${H.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${J.origin} \u0628\u0627\u06CC\u062F ${U}${J.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${U.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(U.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${U.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(U.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${U.includes}" \u0628\u0627\u0634\u062F`;if(U.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${U.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${W[U.format]??J.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${J.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${J.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${e(J.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${J.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${J.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};var lC=A(()=>{n$()});function Jq(){return{localeError:a6$()}}var a6$=()=>{let $={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(J)=>{switch(J.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${J.expected}, oli ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${L$(J.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Liian suuri: ${H.subject} t\xE4ytyy olla ${U}${J.maximum.toString()} ${H.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Liian pieni: ${H.subject} t\xE4ytyy olla ${U}${J.minimum.toString()} ${H.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${U.prefix}"`;if(U.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${U.suffix}"`;if(U.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${U.includes}"`;if(U.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${U.pattern}`;return`Virheellinen ${W[U.format]??J.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${J.divisor} monikerta`;case"unrecognized_keys":return`${J.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${e(J.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};var iC=A(()=>{n$()});function Wq(){return{localeError:s6$()}}var s6$=()=>{let $={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"nombre";case"object":{if(Array.isArray(J))return"tableau";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return(J)=>{switch(J.code){case"invalid_type":return`Entr\xE9e invalide : ${J.expected} attendu, ${Y(J.input)} re\xE7u`;case"invalid_value":if(J.values.length===1)return`Entr\xE9e invalide : ${L$(J.values[0])} attendu`;return`Option invalide : une valeur parmi ${e(J.values,"|")} attendue`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Trop grand : ${J.origin??"valeur"} doit ${H.verb} ${U}${J.maximum.toString()} ${H.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${J.origin??"valeur"} doit \xEAtre ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Trop petit : ${J.origin} doit ${H.verb} ${U}${J.minimum.toString()} ${H.unit}`;return`Trop petit : ${J.origin} doit \xEAtre ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${U.prefix}"`;if(U.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${U.suffix}"`;if(U.format==="includes")return`Cha\xEEne invalide : doit inclure "${U.includes}"`;if(U.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${U.pattern}`;return`${W[U.format]??J.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${J.divisor}`;case"unrecognized_keys":return`Cl\xE9${J.keys.length>1?"s":""} non reconnue${J.keys.length>1?"s":""} : ${e(J.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${J.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${J.origin}`;default:return"Entr\xE9e invalide"}}};var rC=A(()=>{n$()});function Uq(){return{localeError:t6$()}}var t6$=()=>{let $={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return(J)=>{switch(J.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${J.expected}, re\xE7u ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Entr\xE9e invalide : attendu ${L$(J.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"\u2264":"<",H=X(J.origin);if(H)return`Trop grand : attendu que ${J.origin??"la valeur"} ait ${U}${J.maximum.toString()} ${H.unit}`;return`Trop grand : attendu que ${J.origin??"la valeur"} soit ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?"\u2265":">",H=X(J.origin);if(H)return`Trop petit : attendu que ${J.origin} ait ${U}${J.minimum.toString()} ${H.unit}`;return`Trop petit : attendu que ${J.origin} soit ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${U.prefix}"`;if(U.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${U.suffix}"`;if(U.format==="includes")return`Cha\xEEne invalide : doit inclure "${U.includes}"`;if(U.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${U.pattern}`;return`${W[U.format]??J.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${J.divisor}`;case"unrecognized_keys":return`Cl\xE9${J.keys.length>1?"s":""} non reconnue${J.keys.length>1?"s":""} : ${e(J.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${J.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${J.origin}`;default:return"Entr\xE9e invalide"}}};var nC=A(()=>{n$()});function Gq(){return{localeError:e6$()}}var e6$=()=>{let $={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return(J)=>{switch(J.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${J.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${L$(J.values[0])}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${J.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${U}${J.maximum.toString()} ${H.unit??"elements"}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${J.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${J.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${U}${J.minimum.toString()} ${H.unit}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${J.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${U.prefix}"`;if(U.format==="ends_with")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${U.suffix}"`;if(U.format==="includes")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${U.includes}"`;if(U.format==="regex")return`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${U.pattern}`;return`${W[U.format]??J.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${J.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${J.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${J.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${e(J.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${J.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${J.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};var oC=A(()=>{n$()});function Hq(){return{localeError:$4$()}}var $4$=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(J))return"t\xF6mb";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return(J)=>{switch(J.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${J.expected}, a kapott \xE9rt\xE9k ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${L$(J.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`T\xFAl nagy: ${J.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${U}${J.maximum.toString()} ${H.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${J.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${J.origin} m\xE9rete t\xFAl kicsi ${U}${J.minimum.toString()} ${H.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${J.origin} t\xFAl kicsi ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\xC9rv\xE9nytelen string: "${U.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(U.format==="ends_with")return`\xC9rv\xE9nytelen string: "${U.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(U.format==="includes")return`\xC9rv\xE9nytelen string: "${U.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(U.format==="regex")return`\xC9rv\xE9nytelen string: ${U.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${W[U.format]??J.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${J.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${J.keys.length>1?"s":""}: ${e(J.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${J.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${J.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};var aC=A(()=>{n$()});function Dq(){return{localeError:X4$()}}var X4$=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(J)=>{switch(J.code){case"invalid_type":return`Input tidak valid: diharapkan ${J.expected}, diterima ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Input tidak valid: diharapkan ${L$(J.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Terlalu besar: diharapkan ${J.origin??"value"} memiliki ${U}${J.maximum.toString()} ${H.unit??"elemen"}`;return`Terlalu besar: diharapkan ${J.origin??"value"} menjadi ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Terlalu kecil: diharapkan ${J.origin} memiliki ${U}${J.minimum.toString()} ${H.unit}`;return`Terlalu kecil: diharapkan ${J.origin} menjadi ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`String tidak valid: harus dimulai dengan "${U.prefix}"`;if(U.format==="ends_with")return`String tidak valid: harus berakhir dengan "${U.suffix}"`;if(U.format==="includes")return`String tidak valid: harus menyertakan "${U.includes}"`;if(U.format==="regex")return`String tidak valid: harus sesuai pola ${U.pattern}`;return`${W[U.format]??J.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${J.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${J.keys.length>1?"s":""}: ${e(J.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${J.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${J.origin}`;default:return"Input tidak valid"}}};var sC=A(()=>{n$()});function Vq(){return{localeError:Y4$()}}var Y4$=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"numero";case"object":{if(Array.isArray(J))return"vettore";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(J)=>{switch(J.code){case"invalid_type":return`Input non valido: atteso ${J.expected}, ricevuto ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Input non valido: atteso ${L$(J.values[0])}`;return`Opzione non valida: atteso uno tra ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Troppo grande: ${J.origin??"valore"} deve avere ${U}${J.maximum.toString()} ${H.unit??"elementi"}`;return`Troppo grande: ${J.origin??"valore"} deve essere ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Troppo piccolo: ${J.origin} deve avere ${U}${J.minimum.toString()} ${H.unit}`;return`Troppo piccolo: ${J.origin} deve essere ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Stringa non valida: deve iniziare con "${U.prefix}"`;if(U.format==="ends_with")return`Stringa non valida: deve terminare con "${U.suffix}"`;if(U.format==="includes")return`Stringa non valida: deve includere "${U.includes}"`;if(U.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${U.pattern}`;return`Invalid ${W[U.format]??J.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${J.divisor}`;case"unrecognized_keys":return`Chiav${J.keys.length>1?"i":"e"} non riconosciut${J.keys.length>1?"e":"a"}: ${e(J.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${J.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${J.origin}`;default:return"Input non valido"}}};var tC=A(()=>{n$()});function Kq(){return{localeError:J4$()}}var J4$=()=>{let $={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(J))return"\u914D\u5217";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return(J)=>{switch(J.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${J.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${Y(J.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":if(J.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${L$(J.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${e(J.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let U=J.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",H=X(J.origin);if(H)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${J.origin??"\u5024"}\u306F${J.maximum.toString()}${H.unit??"\u8981\u7D20"}${U}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${J.origin??"\u5024"}\u306F${J.maximum.toString()}${U}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let U=J.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",H=X(J.origin);if(H)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${J.origin}\u306F${J.minimum.toString()}${H.unit}${U}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${J.origin}\u306F${J.minimum.toString()}${U}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${U.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(U.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${U.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(U.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${U.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(U.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${U.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${W[U.format]??J.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${J.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${J.keys.length>1?"\u7FA4":""}: ${e(J.keys,"\u3001")}`;case"invalid_key":return`${J.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${J.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};var eC=A(()=>{n$()});function Qq(){return{localeError:W4$()}}var W4$=()=>{let $={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(J))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(J===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return(J)=>{switch(J.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${J.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${L$(J.values[0])}`;return`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${J.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${U} ${J.maximum.toString()} ${H.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${J.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${U} ${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${J.origin} ${U} ${J.minimum.toString()} ${H.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${J.origin} ${U} ${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${U.prefix}"`;if(U.format==="ends_with")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${U.suffix}"`;if(U.format==="includes")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${U.includes}"`;if(U.format==="regex")return`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${U.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${W[U.format]??J.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${J.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${e(J.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${J.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${J.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};var $S=A(()=>{n$()});function Fq(){return{localeError:U4$()}}var U4$=()=>{let $={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return(J)=>{switch(J.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${J.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${Y(J.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":if(J.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${L$(J.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${e(J.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let U=J.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",H=U==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",D=X(J.origin),V=D?.unit??"\uC694\uC18C";if(D)return`${J.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${J.maximum.toString()}${V} ${U}${H}`;return`${J.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${J.maximum.toString()} ${U}${H}`}case"too_small":{let U=J.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",H=U==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",D=X(J.origin),V=D?.unit??"\uC694\uC18C";if(D)return`${J.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${J.minimum.toString()}${V} ${U}${H}`;return`${J.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${J.minimum.toString()} ${U}${H}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${U.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(U.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${U.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(U.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${U.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(U.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${U.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${W[U.format]??J.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${J.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${e(J.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${J.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${J.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};var XS=A(()=>{n$()});function qq(){return{localeError:G4$()}}var G4$=()=>{let $={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(J))return"\u043D\u0438\u0437\u0430";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return(J)=>{switch(J.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${J.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Invalid input: expected ${L$(J.values[0])}`;return`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${J.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${U}${J.maximum.toString()} ${H.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${J.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${J.origin} \u0434\u0430 \u0438\u043C\u0430 ${U}${J.minimum.toString()} ${H.unit}`;return`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${J.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${U.prefix}"`;if(U.format==="ends_with")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${U.suffix}"`;if(U.format==="includes")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${U.includes}"`;if(U.format==="regex")return`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${U.pattern}`;return`Invalid ${W[U.format]??J.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${J.divisor}`;case"unrecognized_keys":return`${J.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${e(J.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${J.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${J.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};var YS=A(()=>{n$()});function wq(){return{localeError:H4$()}}var H4$=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"nombor";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(J)=>{switch(J.code){case"invalid_type":return`Input tidak sah: dijangka ${J.expected}, diterima ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Input tidak sah: dijangka ${L$(J.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Terlalu besar: dijangka ${J.origin??"nilai"} ${H.verb} ${U}${J.maximum.toString()} ${H.unit??"elemen"}`;return`Terlalu besar: dijangka ${J.origin??"nilai"} adalah ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Terlalu kecil: dijangka ${J.origin} ${H.verb} ${U}${J.minimum.toString()} ${H.unit}`;return`Terlalu kecil: dijangka ${J.origin} adalah ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`String tidak sah: mesti bermula dengan "${U.prefix}"`;if(U.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${U.suffix}"`;if(U.format==="includes")return`String tidak sah: mesti mengandungi "${U.includes}"`;if(U.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${U.pattern}`;return`${W[U.format]??J.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${J.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${e(J.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${J.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${J.origin}`;default:return"Input tidak sah"}}};var JS=A(()=>{n$()});function Zq(){return{localeError:D4$()}}var D4$=()=>{let $={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"getal";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(J)=>{switch(J.code){case"invalid_type":return`Ongeldige invoer: verwacht ${J.expected}, ontving ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Ongeldige invoer: verwacht ${L$(J.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Te lang: verwacht dat ${J.origin??"waarde"} ${U}${J.maximum.toString()} ${H.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${J.origin??"waarde"} ${U}${J.maximum.toString()} is`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Te kort: verwacht dat ${J.origin} ${U}${J.minimum.toString()} ${H.unit} bevat`;return`Te kort: verwacht dat ${J.origin} ${U}${J.minimum.toString()} is`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Ongeldige tekst: moet met "${U.prefix}" beginnen`;if(U.format==="ends_with")return`Ongeldige tekst: moet op "${U.suffix}" eindigen`;if(U.format==="includes")return`Ongeldige tekst: moet "${U.includes}" bevatten`;if(U.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${U.pattern}`;return`Ongeldig: ${W[U.format]??J.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${J.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${J.keys.length>1?"s":""}: ${e(J.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${J.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${J.origin}`;default:return"Ongeldige invoer"}}};var WS=A(()=>{n$()});function zq(){return{localeError:V4$()}}var V4$=()=>{let $={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"tall";case"object":{if(Array.isArray(J))return"liste";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(J)=>{switch(J.code){case"invalid_type":return`Ugyldig input: forventet ${J.expected}, fikk ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Ugyldig verdi: forventet ${L$(J.values[0])}`;return`Ugyldig valg: forventet en av ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`For stor(t): forventet ${J.origin??"value"} til \xE5 ha ${U}${J.maximum.toString()} ${H.unit??"elementer"}`;return`For stor(t): forventet ${J.origin??"value"} til \xE5 ha ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`For lite(n): forventet ${J.origin} til \xE5 ha ${U}${J.minimum.toString()} ${H.unit}`;return`For lite(n): forventet ${J.origin} til \xE5 ha ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${U.prefix}"`;if(U.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${U.suffix}"`;if(U.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${U.includes}"`;if(U.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${U.pattern}`;return`Ugyldig ${W[U.format]??J.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${J.divisor}`;case"unrecognized_keys":return`${J.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${e(J.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${J.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${J.origin}`;default:return"Ugyldig input"}}};var US=A(()=>{n$()});function Oq(){return{localeError:K4$()}}var K4$=()=>{let $={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"numara";case"object":{if(Array.isArray(J))return"saf";if(J===null)return"gayb";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return(J)=>{switch(J.code){case"invalid_type":return`F\xE2sit giren: umulan ${J.expected}, al\u0131nan ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`F\xE2sit giren: umulan ${L$(J.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Fazla b\xFCy\xFCk: ${J.origin??"value"}, ${U}${J.maximum.toString()} ${H.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${J.origin??"value"}, ${U}${J.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Fazla k\xFC\xE7\xFCk: ${J.origin}, ${U}${J.minimum.toString()} ${H.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${J.origin}, ${U}${J.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`F\xE2sit metin: "${U.prefix}" ile ba\u015Flamal\u0131.`;if(U.format==="ends_with")return`F\xE2sit metin: "${U.suffix}" ile bitmeli.`;if(U.format==="includes")return`F\xE2sit metin: "${U.includes}" ihtiv\xE2 etmeli.`;if(U.format==="regex")return`F\xE2sit metin: ${U.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${W[U.format]??J.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${J.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${J.keys.length>1?"s":""}: ${e(J.keys,", ")}`;case"invalid_key":return`${J.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${J.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};var GS=A(()=>{n$()});function Nq(){return{localeError:Q4$()}}var Q4$=()=>{let $={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(J))return"\u0627\u0631\u06D0";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return(J)=>{switch(J.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${J.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${Y(J.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":if(J.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${L$(J.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${e(J.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${J.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${U}${J.maximum.toString()} ${H.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${J.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${U}${J.maximum.toString()} \u0648\u064A`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${J.origin} \u0628\u0627\u06CC\u062F ${U}${J.minimum.toString()} ${H.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${J.origin} \u0628\u0627\u06CC\u062F ${U}${J.minimum.toString()} \u0648\u064A`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${U.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(U.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${U.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(U.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${U.includes}" \u0648\u0644\u0631\u064A`;if(U.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${U.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${W[U.format]??J.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${J.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${J.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${e(J.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${J.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${J.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};var HS=A(()=>{n$()});function Aq(){return{localeError:F4$()}}var F4$=()=>{let $={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"liczba";case"object":{if(Array.isArray(J))return"tablica";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return(J)=>{switch(J.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${J.expected}, otrzymano ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${L$(J.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${J.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${U}${J.maximum.toString()} ${H.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${J.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${J.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${U}${J.minimum.toString()} ${H.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${J.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${U.prefix}"`;if(U.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${U.suffix}"`;if(U.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${U.includes}"`;if(U.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${U.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${W[U.format]??J.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${J.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${J.keys.length>1?"s":""}: ${e(J.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${J.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${J.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};var DS=A(()=>{n$()});function Bq(){return{localeError:q4$()}}var q4$=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(J))return"array";if(J===null)return"nulo";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return(J)=>{switch(J.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${J.expected}, recebido ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Entrada inv\xE1lida: esperado ${L$(J.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Muito grande: esperado que ${J.origin??"valor"} tivesse ${U}${J.maximum.toString()} ${H.unit??"elementos"}`;return`Muito grande: esperado que ${J.origin??"valor"} fosse ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Muito pequeno: esperado que ${J.origin} tivesse ${U}${J.minimum.toString()} ${H.unit}`;return`Muito pequeno: esperado que ${J.origin} fosse ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${U.prefix}"`;if(U.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${U.suffix}"`;if(U.format==="includes")return`Texto inv\xE1lido: deve incluir "${U.includes}"`;if(U.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${U.pattern}`;return`${W[U.format]??J.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${J.divisor}`;case"unrecognized_keys":return`Chave${J.keys.length>1?"s":""} desconhecida${J.keys.length>1?"s":""}: ${e(J.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${J.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${J.origin}`;default:return"Campo inv\xE1lido"}}};var VS=A(()=>{n$()});function KS($,X,Y,W){let J=Math.abs($),U=J%10,H=J%100;if(H>=11&&H<=19)return W;if(U===1)return X;if(U>=2&&U<=4)return Y;return W}function Mq(){return{localeError:w4$()}}var w4$=()=>{let $={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(J))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return(J)=>{switch(J.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${J.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${L$(J.values[0])}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H){let D=Number(J.maximum),V=KS(D,H.unit.one,H.unit.few,H.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${J.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${U}${J.maximum.toString()} ${V}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${J.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H){let D=Number(J.minimum),V=KS(D,H.unit.one,H.unit.few,H.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${J.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${U}${J.minimum.toString()} ${V}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${J.origin} \u0431\u0443\u0434\u0435\u0442 ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${U.prefix}"`;if(U.format==="ends_with")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${U.suffix}"`;if(U.format==="includes")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${U.includes}"`;if(U.format==="regex")return`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${U.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${W[U.format]??J.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${J.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${J.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${J.keys.length>1?"\u0438":""}: ${e(J.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${J.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${J.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};var QS=A(()=>{n$()});function jq(){return{localeError:Z4$()}}var Z4$=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(J))return"tabela";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return(J)=>{switch(J.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${J.expected}, prejeto ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${L$(J.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Preveliko: pri\u010Dakovano, da bo ${J.origin??"vrednost"} imelo ${U}${J.maximum.toString()} ${H.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${J.origin??"vrednost"} ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Premajhno: pri\u010Dakovano, da bo ${J.origin} imelo ${U}${J.minimum.toString()} ${H.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${J.origin} ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${U.prefix}"`;if(U.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${U.suffix}"`;if(U.format==="includes")return`Neveljaven niz: mora vsebovati "${U.includes}"`;if(U.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${U.pattern}`;return`Neveljaven ${W[U.format]??J.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${J.divisor}`;case"unrecognized_keys":return`Neprepoznan${J.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${e(J.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${J.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${J.origin}`;default:return"Neveljaven vnos"}}};var FS=A(()=>{n$()});function Rq(){return{localeError:z4$()}}var z4$=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"antal";case"object":{if(Array.isArray(J))return"lista";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(J)=>{switch(J.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${J.expected}, fick ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${L$(J.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${J.origin??"v\xE4rdet"} att ha ${U}${J.maximum.toString()} ${H.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${J.origin??"v\xE4rdet"} att ha ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${J.origin??"v\xE4rdet"} att ha ${U}${J.minimum.toString()} ${H.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${J.origin??"v\xE4rdet"} att ha ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${U.prefix}"`;if(U.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${U.suffix}"`;if(U.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${U.includes}"`;if(U.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${U.pattern}"`;return`Ogiltig(t) ${W[U.format]??J.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${J.divisor}`;case"unrecognized_keys":return`${J.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${e(J.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${J.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${J.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};var qS=A(()=>{n$()});function Lq(){return{localeError:O4$()}}var O4$=()=>{let $={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(J))return"\u0B85\u0BA3\u0BBF";if(J===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return(J)=>{switch(J.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${J.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${L$(J.values[0])}`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${e(J.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${J.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${U}${J.maximum.toString()} ${H.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${J.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${U}${J.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${J.origin} ${U}${J.minimum.toString()} ${H.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${J.origin} ${U}${J.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${U.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(U.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${U.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(U.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${U.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(U.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${U.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${W[U.format]??J.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${J.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${J.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${e(J.keys,", ")}`;case"invalid_key":return`${J.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${J.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};var wS=A(()=>{n$()});function Eq(){return{localeError:N4$()}}var N4$=()=>{let $={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(J))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(J===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return(J)=>{switch(J.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${J.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${L$(J.values[0])}`;return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",H=X(J.origin);if(H)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${J.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${U} ${J.maximum.toString()} ${H.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${J.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${U} ${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",H=X(J.origin);if(H)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${J.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${U} ${J.minimum.toString()} ${H.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${J.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${U} ${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${U.prefix}"`;if(U.format==="ends_with")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${U.suffix}"`;if(U.format==="includes")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${U.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(U.format==="regex")return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${U.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${W[U.format]??J.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${J.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${e(J.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${J.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${J.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};var ZS=A(()=>{n$()});function Pq(){return{localeError:B4$()}}var A4$=($)=>{let X=typeof $;switch(X){case"number":return Number.isNaN($)?"NaN":"number";case"object":{if(Array.isArray($))return"array";if($===null)return"null";if(Object.getPrototypeOf($)!==Object.prototype&&$.constructor)return $.constructor.name}}return X},B4$=()=>{let $={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function X(W){return $[W]??null}let Y={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return(W)=>{switch(W.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${W.expected}, al\u0131nan ${A4$(W.input)}`;case"invalid_value":if(W.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${L$(W.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${e(W.values,"|")}`;case"too_big":{let J=W.inclusive?"<=":"<",U=X(W.origin);if(U)return`\xC7ok b\xFCy\xFCk: beklenen ${W.origin??"de\u011Fer"} ${J}${W.maximum.toString()} ${U.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${W.origin??"de\u011Fer"} ${J}${W.maximum.toString()}`}case"too_small":{let J=W.inclusive?">=":">",U=X(W.origin);if(U)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${W.origin} ${J}${W.minimum.toString()} ${U.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${W.origin} ${J}${W.minimum.toString()}`}case"invalid_format":{let J=W;if(J.format==="starts_with")return`Ge\xE7ersiz metin: "${J.prefix}" ile ba\u015Flamal\u0131`;if(J.format==="ends_with")return`Ge\xE7ersiz metin: "${J.suffix}" ile bitmeli`;if(J.format==="includes")return`Ge\xE7ersiz metin: "${J.includes}" i\xE7ermeli`;if(J.format==="regex")return`Ge\xE7ersiz metin: ${J.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${Y[J.format]??W.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${W.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${W.keys.length>1?"lar":""}: ${e(W.keys,", ")}`;case"invalid_key":return`${W.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${W.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};var zS=A(()=>{n$()});function Iq(){return{localeError:M4$()}}var M4$=()=>{let $={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(J))return"\u043C\u0430\u0441\u0438\u0432";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return(J)=>{switch(J.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${J.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${L$(J.values[0])}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${J.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${H.verb} ${U}${J.maximum.toString()} ${H.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${J.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${J.origin} ${H.verb} ${U}${J.minimum.toString()} ${H.unit}`;return`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${J.origin} \u0431\u0443\u0434\u0435 ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${U.prefix}"`;if(U.format==="ends_with")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${U.suffix}"`;if(U.format==="includes")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${U.includes}"`;if(U.format==="regex")return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${U.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${W[U.format]??J.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${J.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${J.keys.length>1?"\u0456":""}: ${e(J.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${J.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${J.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};var OS=A(()=>{n$()});function _q(){return{localeError:j4$()}}var j4$=()=>{let $={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(J))return"\u0622\u0631\u06D2";if(J===null)return"\u0646\u0644";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return(J)=>{switch(J.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${J.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${Y(J.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":if(J.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${L$(J.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${e(J.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${J.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${U}${J.maximum.toString()} ${H.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${J.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${U}${J.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${J.origin} \u06A9\u06D2 ${U}${J.minimum.toString()} ${H.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${J.origin} \u06A9\u0627 ${U}${J.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${U.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(U.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${U.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(U.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${U.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(U.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${U.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${W[U.format]??J.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${J.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${J.keys.length>1?"\u0632":""}: ${e(J.keys,"\u060C ")}`;case"invalid_key":return`${J.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${J.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};var NS=A(()=>{n$()});function Tq(){return{localeError:R4$()}}var R4$=()=>{let $={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(J))return"m\u1EA3ng";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return(J)=>{switch(J.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${J.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${L$(J.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${J.origin??"gi\xE1 tr\u1ECB"} ${H.verb} ${U}${J.maximum.toString()} ${H.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${J.origin??"gi\xE1 tr\u1ECB"} ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${J.origin} ${H.verb} ${U}${J.minimum.toString()} ${H.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${J.origin} ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${U.prefix}"`;if(U.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${U.suffix}"`;if(U.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${U.includes}"`;if(U.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${U.pattern}`;return`${W[U.format]??J.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${J.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${e(J.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${J.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${J.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};var AS=A(()=>{n$()});function Cq(){return{localeError:L4$()}}var L4$=()=>{let $={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(J))return"\u6570\u7EC4";if(J===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return(J)=>{switch(J.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${J.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${L$(J.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${J.origin??"\u503C"} ${U}${J.maximum.toString()} ${H.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${J.origin??"\u503C"} ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${J.origin} ${U}${J.minimum.toString()} ${H.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${J.origin} ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${U.prefix}" \u5F00\u5934`;if(U.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${U.suffix}" \u7ED3\u5C3E`;if(U.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${U.includes}"`;if(U.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${U.pattern}`;return`\u65E0\u6548${W[U.format]??J.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${J.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${e(J.keys,", ")}`;case"invalid_key":return`${J.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${J.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};var BS=A(()=>{n$()});function Sq(){return{localeError:E4$()}}var E4$=()=>{let $={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function X(J){return $[J]??null}let Y=(J)=>{let U=typeof J;switch(U){case"number":return Number.isNaN(J)?"NaN":"number";case"object":{if(Array.isArray(J))return"array";if(J===null)return"null";if(Object.getPrototypeOf(J)!==Object.prototype&&J.constructor)return J.constructor.name}}return U},W={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return(J)=>{switch(J.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${J.expected}\uFF0C\u4F46\u6536\u5230 ${Y(J.input)}`;case"invalid_value":if(J.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${L$(J.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${e(J.values,"|")}`;case"too_big":{let U=J.inclusive?"<=":"<",H=X(J.origin);if(H)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${J.origin??"\u503C"} \u61C9\u70BA ${U}${J.maximum.toString()} ${H.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${J.origin??"\u503C"} \u61C9\u70BA ${U}${J.maximum.toString()}`}case"too_small":{let U=J.inclusive?">=":">",H=X(J.origin);if(H)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${J.origin} \u61C9\u70BA ${U}${J.minimum.toString()} ${H.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${J.origin} \u61C9\u70BA ${U}${J.minimum.toString()}`}case"invalid_format":{let U=J;if(U.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${U.prefix}" \u958B\u982D`;if(U.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${U.suffix}" \u7D50\u5C3E`;if(U.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${U.includes}"`;if(U.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${U.pattern}`;return`\u7121\u6548\u7684 ${W[U.format]??J.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${J.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${J.keys.length>1?"\u5011":""}\uFF1A${e(J.keys,"\u3001")}`;case"invalid_key":return`${J.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${J.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};var MS=A(()=>{n$()});var eY={};e0(eY,{zhTW:()=>Sq,zhCN:()=>Cq,vi:()=>Tq,ur:()=>_q,ua:()=>Iq,tr:()=>Pq,th:()=>Eq,ta:()=>Lq,sv:()=>Rq,sl:()=>jq,ru:()=>Mq,pt:()=>Bq,ps:()=>Nq,pl:()=>Aq,ota:()=>Oq,no:()=>zq,nl:()=>Zq,ms:()=>wq,mk:()=>qq,ko:()=>Fq,kh:()=>Qq,ja:()=>Kq,it:()=>Vq,id:()=>Dq,hu:()=>Hq,he:()=>Gq,frCA:()=>Uq,fr:()=>Wq,fi:()=>Jq,fa:()=>Yq,es:()=>Xq,eo:()=>$q,en:()=>tY,de:()=>t3,cs:()=>s3,ca:()=>a3,be:()=>o3,az:()=>n3,ar:()=>r3});var bq=A(()=>{hC();yC();gC();mC();uC();pC();e3();cC();dC();lC();iC();rC();nC();oC();aC();sC();tC();eC();$S();XS();YS();JS();WS();US();GS();HS();DS();VS();QS();FS();qS();wS();ZS();zS();OS();NS();AS();BS();MS()});class $J{constructor(){this._map=new Map,this._idmap=new Map}add($,...X){let Y=X[0];if(this._map.set($,Y),Y&&typeof Y==="object"&&"id"in Y){if(this._idmap.has(Y.id))throw Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.id,$)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove($){let X=this._map.get($);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete($),this}get($){let X=$._zod.parent;if(X){let Y={...this.get(X)??{}};return delete Y.id,{...Y,...this._map.get($)}}return this._map.get($)}has($){return this._map.has($)}}function bU(){return new $J}var xq,kq,u0;var vq=A(()=>{xq=Symbol("ZodOutput"),kq=Symbol("ZodInput");u0=bU()});function hq($,X){return new $({type:"string",...Z$(X)})}function yq($,X){return new $({type:"string",coerce:!0,...Z$(X)})}function xU($,X){return new $({type:"string",format:"email",check:"string_format",abort:!1,...Z$(X)})}function XJ($,X){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...Z$(X)})}function kU($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...Z$(X)})}function vU($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z$(X)})}function hU($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z$(X)})}function yU($,X){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z$(X)})}function fU($,X){return new $({type:"string",format:"url",check:"string_format",abort:!1,...Z$(X)})}function gU($,X){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...Z$(X)})}function mU($,X){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z$(X)})}function uU($,X){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...Z$(X)})}function pU($,X){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z$(X)})}function cU($,X){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...Z$(X)})}function dU($,X){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...Z$(X)})}function lU($,X){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z$(X)})}function iU($,X){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z$(X)})}function rU($,X){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z$(X)})}function nU($,X){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z$(X)})}function oU($,X){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z$(X)})}function aU($,X){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...Z$(X)})}function sU($,X){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...Z$(X)})}function tU($,X){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...Z$(X)})}function eU($,X){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...Z$(X)})}function gq($,X){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z$(X)})}function mq($,X){return new $({type:"string",format:"date",check:"string_format",...Z$(X)})}function uq($,X){return new $({type:"string",format:"time",check:"string_format",precision:null,...Z$(X)})}function pq($,X){return new $({type:"string",format:"duration",check:"string_format",...Z$(X)})}function cq($,X){return new $({type:"number",checks:[],...Z$(X)})}function dq($,X){return new $({type:"number",coerce:!0,checks:[],...Z$(X)})}function lq($,X){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...Z$(X)})}function iq($,X){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...Z$(X)})}function rq($,X){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...Z$(X)})}function nq($,X){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...Z$(X)})}function oq($,X){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...Z$(X)})}function aq($,X){return new $({type:"boolean",...Z$(X)})}function sq($,X){return new $({type:"boolean",coerce:!0,...Z$(X)})}function tq($,X){return new $({type:"bigint",...Z$(X)})}function eq($,X){return new $({type:"bigint",coerce:!0,...Z$(X)})}function $w($,X){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Z$(X)})}function Xw($,X){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Z$(X)})}function Yw($,X){return new $({type:"symbol",...Z$(X)})}function Jw($,X){return new $({type:"undefined",...Z$(X)})}function Ww($,X){return new $({type:"null",...Z$(X)})}function Uw($){return new $({type:"any"})}function EX($){return new $({type:"unknown"})}function Gw($,X){return new $({type:"never",...Z$(X)})}function Hw($,X){return new $({type:"void",...Z$(X)})}function Dw($,X){return new $({type:"date",...Z$(X)})}function Vw($,X){return new $({type:"date",coerce:!0,...Z$(X)})}function Kw($,X){return new $({type:"nan",...Z$(X)})}function Z8($,X){return new RU({check:"less_than",...Z$(X),value:$,inclusive:!1})}function u1($,X){return new RU({check:"less_than",...Z$(X),value:$,inclusive:!0})}function z8($,X){return new LU({check:"greater_than",...Z$(X),value:$,inclusive:!1})}function V1($,X){return new LU({check:"greater_than",...Z$(X),value:$,inclusive:!0})}function Qw($){return z8(0,$)}function Fw($){return Z8(0,$)}function qw($){return u1(0,$)}function ww($){return V1(0,$)}function l9($,X){return new LF({check:"multiple_of",...Z$(X),value:$})}function PX($,X){return new IF({check:"max_size",...Z$(X),maximum:$})}function i9($,X){return new _F({check:"min_size",...Z$(X),minimum:$})}function YJ($,X){return new TF({check:"size_equals",...Z$(X),size:$})}function IX($,X){return new CF({check:"max_length",...Z$(X),maximum:$})}function $9($,X){return new SF({check:"min_length",...Z$(X),minimum:$})}function _X($,X){return new bF({check:"length_equals",...Z$(X),length:$})}function JJ($,X){return new xF({check:"string_format",format:"regex",...Z$(X),pattern:$})}function WJ($){return new kF({check:"string_format",format:"lowercase",...Z$($)})}function UJ($){return new vF({check:"string_format",format:"uppercase",...Z$($)})}function GJ($,X){return new hF({check:"string_format",format:"includes",...Z$(X),includes:$})}function HJ($,X){return new yF({check:"string_format",format:"starts_with",...Z$(X),prefix:$})}function DJ($,X){return new fF({check:"string_format",format:"ends_with",...Z$(X),suffix:$})}function Zw($,X,Y){return new gF({check:"property",property:$,schema:X,...Z$(Y)})}function VJ($,X){return new mF({check:"mime_type",mime:$,...Z$(X)})}function O8($){return new uF({check:"overwrite",tx:$})}function KJ($){return O8((X)=>X.normalize($))}function QJ(){return O8(($)=>$.trim())}function FJ(){return O8(($)=>$.toLowerCase())}function qJ(){return O8(($)=>$.toUpperCase())}function wJ($,X,Y){return new $({type:"array",element:X,...Z$(Y)})}function P4$($,X,Y){return new $({type:"union",options:X,...Z$(Y)})}function I4$($,X,Y,W){return new $({type:"union",options:Y,discriminator:X,...Z$(W)})}function _4$($,X,Y){return new $({type:"intersection",left:X,right:Y})}function zw($,X,Y,W){let J=Y instanceof s$;return new $({type:"tuple",items:X,rest:J?Y:null,...Z$(J?W:Y)})}function T4$($,X,Y,W){return new $({type:"record",keyType:X,valueType:Y,...Z$(W)})}function C4$($,X,Y,W){return new $({type:"map",keyType:X,valueType:Y,...Z$(W)})}function S4$($,X,Y){return new $({type:"set",valueType:X,...Z$(Y)})}function b4$($,X,Y){let W=Array.isArray(X)?Object.fromEntries(X.map((J)=>[J,J])):X;return new $({type:"enum",entries:W,...Z$(Y)})}function x4$($,X,Y){return new $({type:"enum",entries:X,...Z$(Y)})}function k4$($,X,Y){return new $({type:"literal",values:Array.isArray(X)?X:[X],...Z$(Y)})}function Ow($,X){return new $({type:"file",...Z$(X)})}function v4$($,X){return new $({type:"transform",transform:X})}function h4$($,X){return new $({type:"optional",innerType:X})}function y4$($,X){return new $({type:"nullable",innerType:X})}function f4$($,X,Y){return new $({type:"default",innerType:X,get defaultValue(){return typeof Y==="function"?Y():Y}})}function g4$($,X,Y){return new $({type:"nonoptional",innerType:X,...Z$(Y)})}function m4$($,X){return new $({type:"success",innerType:X})}function u4$($,X,Y){return new $({type:"catch",innerType:X,catchValue:typeof Y==="function"?Y:()=>Y})}function p4$($,X,Y){return new $({type:"pipe",in:X,out:Y})}function c4$($,X){return new $({type:"readonly",innerType:X})}function d4$($,X,Y){return new $({type:"template_literal",parts:X,...Z$(Y)})}function l4$($,X){return new $({type:"lazy",getter:X})}function i4$($,X){return new $({type:"promise",innerType:X})}function Nw($,X,Y){let W=Z$(Y);return W.abort??(W.abort=!0),new $({type:"custom",check:"custom",fn:X,...W})}function Aw($,X,Y){return new $({type:"custom",check:"custom",fn:X,...Z$(Y)})}function Bw($,X){let Y=Z$(X),W=Y.truthy??["true","1","yes","on","y","enabled"],J=Y.falsy??["false","0","no","off","n","disabled"];if(Y.case!=="sensitive")W=W.map((z)=>typeof z==="string"?z.toLowerCase():z),J=J.map((z)=>typeof z==="string"?z.toLowerCase():z);let U=new Set(W),H=new Set(J),D=$.Pipe??aY,V=$.Boolean??rY,K=$.String??c9,q=new($.Transform??oY)({type:"transform",transform:(z,O)=>{let N=z;if(Y.case!=="sensitive")N=N.toLowerCase();if(U.has(N))return!0;else if(H.has(N))return!1;else return O.issues.push({code:"invalid_value",expected:"stringbool",values:[...U,...H],input:O.value,inst:q}),{}},error:Y.error}),F=new D({type:"pipe",in:new K({type:"string",error:Y.error}),out:q,error:Y.error});return new D({type:"pipe",in:F,out:new V({type:"boolean",error:Y.error}),error:Y.error})}function Mw($,X,Y,W={}){let J=Z$(W),U={...Z$(W),check:"string_format",type:"string",format:X,fn:typeof Y==="function"?Y:(D)=>Y.test(D),...J};if(Y instanceof RegExp)U.pattern=Y;return new $(U)}var fq;var jw=A(()=>{EU();sY();n$();fq={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});class Rw{constructor($){this._def=$,this.def=$}implement($){if(typeof $!=="function")throw Error("implement() must be called with a function");let X=(...Y)=>{let W=this._def.input?ZU(this._def.input,Y,void 0,{callee:X}):Y;if(!Array.isArray(W))throw Error("Invalid arguments schema: not an array or tuple schema.");let J=$(...W);return this._def.output?ZU(this._def.output,J,void 0,{callee:X}):J};return X}implementAsync($){if(typeof $!=="function")throw Error("implement() must be called with a function");let X=async(...Y)=>{let W=this._def.input?await OU(this._def.input,Y,void 0,{callee:X}):Y;if(!Array.isArray(W))throw Error("Invalid arguments schema: not an array or tuple schema.");let J=await $(...W);return this._def.output?OU(this._def.output,J,void 0,{callee:X}):J};return X}input(...$){let X=this.constructor;if(Array.isArray($[0]))return new X({type:"function",input:new d9({type:"tuple",items:$[0],rest:$[1]}),output:this._def.output});return new X({type:"function",input:$[0],output:this._def.output})}output($){return new this.constructor({type:"function",input:this._def.input,output:$})}}function Lw($){return new Rw({type:"function",input:Array.isArray($?.input)?zw(d9,$?.input):$?.input??wJ(nY,EX(LX)),output:$?.output??EX(LX)})}var jS=A(()=>{jw();BU();sY();sY()});class $G{constructor($){this.counter=0,this.metadataRegistry=$?.metadata??u0,this.target=$?.target??"draft-2020-12",this.unrepresentable=$?.unrepresentable??"throw",this.override=$?.override??(()=>{}),this.io=$?.io??"output",this.seen=new Map}process($,X={path:[],schemaPath:[]}){var Y;let W=$._zod.def,J={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},U=this.seen.get($);if(U){if(U.count++,X.schemaPath.includes($))U.cycle=X.path;return U.schema}let H={schema:{},count:1,cycle:void 0,path:X.path};this.seen.set($,H);let D=$._zod.toJSONSchema?.();if(D)H.schema=D;else{let Q={...X,schemaPath:[...X.schemaPath,$],path:X.path},q=$._zod.parent;if(q)H.ref=q,this.process(q,Q),this.seen.get(q).isParent=!0;else{let F=H.schema;switch(W.type){case"string":{let w=F;w.type="string";let{minimum:z,maximum:O,format:N,patterns:L,contentEncoding:P}=$._zod.bag;if(typeof z==="number")w.minLength=z;if(typeof O==="number")w.maxLength=O;if(N){if(w.format=J[N]??N,w.format==="")delete w.format}if(P)w.contentEncoding=P;if(L&&L.size>0){let j=[...L];if(j.length===1)w.pattern=j[0].source;else if(j.length>1)H.schema.allOf=[...j.map((v)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:v.source}))]}break}case"number":{let w=F,{minimum:z,maximum:O,format:N,multipleOf:L,exclusiveMaximum:P,exclusiveMinimum:j}=$._zod.bag;if(typeof N==="string"&&N.includes("int"))w.type="integer";else w.type="number";if(typeof j==="number")w.exclusiveMinimum=j;if(typeof z==="number"){if(w.minimum=z,typeof j==="number")if(j>=z)delete w.minimum;else delete w.exclusiveMinimum}if(typeof P==="number")w.exclusiveMaximum=P;if(typeof O==="number"){if(w.maximum=O,typeof P==="number")if(P<=O)delete w.maximum;else delete w.exclusiveMaximum}if(typeof L==="number")w.multipleOf=L;break}case"boolean":{let w=F;w.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{F.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{F.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let w=F,{minimum:z,maximum:O}=$._zod.bag;if(typeof z==="number")w.minItems=z;if(typeof O==="number")w.maxItems=O;w.type="array",w.items=this.process(W.element,{...Q,path:[...Q.path,"items"]});break}case"object":{let w=F;w.type="object",w.properties={};let z=W.shape;for(let L in z)w.properties[L]=this.process(z[L],{...Q,path:[...Q.path,"properties",L]});let O=new Set(Object.keys(z)),N=new Set([...O].filter((L)=>{let P=W.shape[L]._zod;if(this.io==="input")return P.optin===void 0;else return P.optout===void 0}));if(N.size>0)w.required=Array.from(N);if(W.catchall?._zod.def.type==="never")w.additionalProperties=!1;else if(!W.catchall){if(this.io==="output")w.additionalProperties=!1}else if(W.catchall)w.additionalProperties=this.process(W.catchall,{...Q,path:[...Q.path,"additionalProperties"]});break}case"union":{let w=F;w.anyOf=W.options.map((z,O)=>this.process(z,{...Q,path:[...Q.path,"anyOf",O]}));break}case"intersection":{let w=F,z=this.process(W.left,{...Q,path:[...Q.path,"allOf",0]}),O=this.process(W.right,{...Q,path:[...Q.path,"allOf",1]}),N=(P)=>("allOf"in P)&&Object.keys(P).length===1,L=[...N(z)?z.allOf:[z],...N(O)?O.allOf:[O]];w.allOf=L;break}case"tuple":{let w=F;w.type="array";let z=W.items.map((L,P)=>this.process(L,{...Q,path:[...Q.path,"prefixItems",P]}));if(this.target==="draft-2020-12")w.prefixItems=z;else w.items=z;if(W.rest){let L=this.process(W.rest,{...Q,path:[...Q.path,"items"]});if(this.target==="draft-2020-12")w.items=L;else w.additionalItems=L}if(W.rest)w.items=this.process(W.rest,{...Q,path:[...Q.path,"items"]});let{minimum:O,maximum:N}=$._zod.bag;if(typeof O==="number")w.minItems=O;if(typeof N==="number")w.maxItems=N;break}case"record":{let w=F;w.type="object",w.propertyNames=this.process(W.keyType,{...Q,path:[...Q.path,"propertyNames"]}),w.additionalProperties=this.process(W.valueType,{...Q,path:[...Q.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let w=F,z=fY(W.entries);if(z.every((O)=>typeof O==="number"))w.type="number";if(z.every((O)=>typeof O==="string"))w.type="string";w.enum=z;break}case"literal":{let w=F,z=[];for(let O of W.values)if(O===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof O==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else z.push(Number(O));else z.push(O);if(z.length===0);else if(z.length===1){let O=z[0];w.type=O===null?"null":typeof O,w.const=O}else{if(z.every((O)=>typeof O==="number"))w.type="number";if(z.every((O)=>typeof O==="string"))w.type="string";if(z.every((O)=>typeof O==="boolean"))w.type="string";if(z.every((O)=>O===null))w.type="null";w.enum=z}break}case"file":{let w=F,z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:O,maximum:N,mime:L}=$._zod.bag;if(O!==void 0)z.minLength=O;if(N!==void 0)z.maxLength=N;if(L)if(L.length===1)z.contentMediaType=L[0],Object.assign(w,z);else w.anyOf=L.map((P)=>{return{...z,contentMediaType:P}});else Object.assign(w,z);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let w=this.process(W.innerType,Q);F.anyOf=[w,{type:"null"}];break}case"nonoptional":{this.process(W.innerType,Q),H.ref=W.innerType;break}case"success":{let w=F;w.type="boolean";break}case"default":{this.process(W.innerType,Q),H.ref=W.innerType,F.default=JSON.parse(JSON.stringify(W.defaultValue));break}case"prefault":{if(this.process(W.innerType,Q),H.ref=W.innerType,this.io==="input")F._prefault=JSON.parse(JSON.stringify(W.defaultValue));break}case"catch":{this.process(W.innerType,Q),H.ref=W.innerType;let w;try{w=W.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}F.default=w;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let w=F,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");w.type="string",w.pattern=z.source;break}case"pipe":{let w=this.io==="input"?W.in._zod.def.type==="transform"?W.out:W.in:W.out;this.process(w,Q),H.ref=w;break}case"readonly":{this.process(W.innerType,Q),H.ref=W.innerType,F.readOnly=!0;break}case"promise":{this.process(W.innerType,Q),H.ref=W.innerType;break}case"optional":{this.process(W.innerType,Q),H.ref=W.innerType;break}case"lazy":{let w=$._zod.innerType;this.process(w,Q),H.ref=w;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let V=this.metadataRegistry.get($);if(V)Object.assign(H.schema,V);if(this.io==="input"&&O4($))delete H.schema.examples,delete H.schema.default;if(this.io==="input"&&H.schema._prefault)(Y=H.schema).default??(Y.default=H.schema._prefault);return delete H.schema._prefault,this.seen.get($).schema}emit($,X){let Y={cycles:X?.cycles??"ref",reused:X?.reused??"inline",external:X?.external??void 0},W=this.seen.get($);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let J=(K)=>{let Q=this.target==="draft-2020-12"?"$defs":"definitions";if(Y.external){let z=Y.external.registry.get(K[0])?.id,O=Y.external.uri??((L)=>L);if(z)return{ref:O(z)};let N=K[1].defId??K[1].schema.id??`schema${this.counter++}`;return K[1].defId=N,{defId:N,ref:`${O("__shared")}#/${Q}/${N}`}}if(K[1]===W)return{ref:"#"};let F=`${"#"}/${Q}/`,w=K[1].schema.id??`__schema${this.counter++}`;return{defId:w,ref:F+w}},U=(K)=>{if(K[1].schema.$ref)return;let Q=K[1],{ref:q,defId:F}=J(K);if(Q.def={...Q.schema},F)Q.defId=F;let w=Q.schema;for(let z in w)delete w[z];w.$ref=q};if(Y.cycles==="throw")for(let K of this.seen.entries()){let Q=K[1];if(Q.cycle)throw Error(`Cycle detected: #/${Q.cycle?.join("/")}/<root>
249
-
250
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of this.seen.entries()){let Q=K[1];if($===K[0]){U(K);continue}if(Y.external){let F=Y.external.registry.get(K[0])?.id;if($!==K[0]&&F){U(K);continue}}if(this.metadataRegistry.get(K[0])?.id){U(K);continue}if(Q.cycle){U(K);continue}if(Q.count>1){if(Y.reused==="ref"){U(K);continue}}}let H=(K,Q)=>{let q=this.seen.get(K),F=q.def??q.schema,w={...F};if(q.ref===null)return;let z=q.ref;if(q.ref=null,z){H(z,Q);let O=this.seen.get(z).schema;if(O.$ref&&Q.target==="draft-7")F.allOf=F.allOf??[],F.allOf.push(O);else Object.assign(F,O),Object.assign(F,w)}if(!q.isParent)this.override({zodSchema:K,jsonSchema:F,path:q.path??[]})};for(let K of[...this.seen.entries()].reverse())H(K[0],{target:this.target});let D={};if(this.target==="draft-2020-12")D.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")D.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);if(Y.external?.uri){let K=Y.external.registry.get($)?.id;if(!K)throw Error("Schema is missing an `id` property");D.$id=Y.external.uri(K)}Object.assign(D,W.def);let V=Y.external?.defs??{};for(let K of this.seen.entries()){let Q=K[1];if(Q.def&&Q.defId)V[Q.defId]=Q.def}if(Y.external);else if(Object.keys(V).length>0)if(this.target==="draft-2020-12")D.$defs=V;else D.definitions=V;try{return JSON.parse(JSON.stringify(D))}catch(K){throw Error("Error converting schema to JSON.")}}}function ZJ($,X){if($ instanceof $J){let W=new $G(X),J={};for(let D of $._idmap.entries()){let[V,K]=D;W.process(K)}let U={},H={registry:$,uri:X?.uri,defs:J};for(let D of $._idmap.entries()){let[V,K]=D;U[V]=W.emit(K,{...X,external:H})}if(Object.keys(J).length>0){let D=W.target==="draft-2020-12"?"$defs":"definitions";U.__shared={[D]:J}}return{schemas:U}}let Y=new $G(X);return Y.process($),Y.emit($,X)}function O4($,X){let Y=X??{seen:new Set};if(Y.seen.has($))return!1;Y.seen.add($);let J=$._zod.def;switch(J.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return O4(J.element,Y);case"object":{for(let U in J.shape)if(O4(J.shape[U],Y))return!0;return!1}case"union":{for(let U of J.options)if(O4(U,Y))return!0;return!1}case"intersection":return O4(J.left,Y)||O4(J.right,Y);case"tuple":{for(let U of J.items)if(O4(U,Y))return!0;if(J.rest&&O4(J.rest,Y))return!0;return!1}case"record":return O4(J.keyType,Y)||O4(J.valueType,Y);case"map":return O4(J.keyType,Y)||O4(J.valueType,Y);case"set":return O4(J.valueType,Y);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return O4(J.innerType,Y);case"lazy":return O4(J.getter(),Y);case"default":return O4(J.innerType,Y);case"prefault":return O4(J.innerType,Y);case"custom":return!1;case"transform":return!0;case"pipe":return O4(J.in,Y)||O4(J.out,Y);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${J.type}`)}var RS=A(()=>{vq();n$()});var LS={};var ES=()=>{};var N8={};e0(N8,{version:()=>pF,util:()=>E$,treeifyError:()=>dQ,toJSONSchema:()=>ZJ,toDotPath:()=>zC,safeParseAsync:()=>nQ,safeParse:()=>rQ,registry:()=>bU,regexes:()=>p9,prettifyError:()=>lQ,parseAsync:()=>OU,parse:()=>ZU,locales:()=>eY,isValidJWT:()=>kC,isValidBase64URL:()=>xC,isValidBase64:()=>K3,globalRegistry:()=>u0,globalConfig:()=>hY,function:()=>Lw,formatError:()=>iY,flattenError:()=>lY,config:()=>Q4,clone:()=>j1,_xid:()=>dU,_void:()=>Hw,_uuidv7:()=>yU,_uuidv6:()=>hU,_uuidv4:()=>vU,_uuid:()=>kU,_url:()=>fU,_uppercase:()=>UJ,_unknown:()=>EX,_union:()=>P4$,_undefined:()=>Jw,_ulid:()=>cU,_uint64:()=>Xw,_uint32:()=>oq,_tuple:()=>zw,_trim:()=>QJ,_transform:()=>v4$,_toUpperCase:()=>qJ,_toLowerCase:()=>FJ,_templateLiteral:()=>d4$,_symbol:()=>Yw,_success:()=>m4$,_stringbool:()=>Bw,_stringFormat:()=>Mw,_string:()=>hq,_startsWith:()=>HJ,_size:()=>YJ,_set:()=>S4$,_safeParseAsync:()=>AU,_safeParse:()=>NU,_regex:()=>JJ,_refine:()=>Aw,_record:()=>T4$,_readonly:()=>c4$,_property:()=>Zw,_promise:()=>i4$,_positive:()=>Qw,_pipe:()=>p4$,_parseAsync:()=>zU,_parse:()=>wU,_overwrite:()=>O8,_optional:()=>h4$,_number:()=>cq,_nullable:()=>y4$,_null:()=>Ww,_normalize:()=>KJ,_nonpositive:()=>qw,_nonoptional:()=>g4$,_nonnegative:()=>ww,_never:()=>Gw,_negative:()=>Fw,_nativeEnum:()=>x4$,_nanoid:()=>mU,_nan:()=>Kw,_multipleOf:()=>l9,_minSize:()=>i9,_minLength:()=>$9,_min:()=>V1,_mime:()=>VJ,_maxSize:()=>PX,_maxLength:()=>IX,_max:()=>u1,_map:()=>C4$,_lte:()=>u1,_lt:()=>Z8,_lowercase:()=>WJ,_literal:()=>k4$,_length:()=>_X,_lazy:()=>l4$,_ksuid:()=>lU,_jwt:()=>eU,_isoTime:()=>uq,_isoDuration:()=>pq,_isoDateTime:()=>gq,_isoDate:()=>mq,_ipv6:()=>rU,_ipv4:()=>iU,_intersection:()=>_4$,_int64:()=>$w,_int32:()=>nq,_int:()=>lq,_includes:()=>GJ,_guid:()=>XJ,_gte:()=>V1,_gt:()=>z8,_float64:()=>rq,_float32:()=>iq,_file:()=>Ow,_enum:()=>b4$,_endsWith:()=>DJ,_emoji:()=>gU,_email:()=>xU,_e164:()=>tU,_discriminatedUnion:()=>I4$,_default:()=>f4$,_date:()=>Dw,_custom:()=>Nw,_cuid2:()=>pU,_cuid:()=>uU,_coercedString:()=>yq,_coercedNumber:()=>dq,_coercedDate:()=>Vw,_coercedBoolean:()=>sq,_coercedBigint:()=>eq,_cidrv6:()=>oU,_cidrv4:()=>nU,_catch:()=>u4$,_boolean:()=>aq,_bigint:()=>tq,_base64url:()=>sU,_base64:()=>aU,_array:()=>wJ,_any:()=>Uw,TimePrecision:()=>fq,NEVER:()=>bQ,JSONSchemaGenerator:()=>$G,JSONSchema:()=>LS,Doc:()=>PU,$output:()=>xq,$input:()=>kq,$constructor:()=>c,$brand:()=>xQ,$ZodXID:()=>$3,$ZodVoid:()=>R3,$ZodUnknown:()=>LX,$ZodUnion:()=>SU,$ZodUndefined:()=>A3,$ZodUUID:()=>iF,$ZodURL:()=>nF,$ZodULID:()=>eF,$ZodType:()=>s$,$ZodTuple:()=>d9,$ZodTransform:()=>oY,$ZodTemplateLiteral:()=>c3,$ZodSymbol:()=>N3,$ZodSuccess:()=>g3,$ZodStringFormat:()=>y6,$ZodString:()=>c9,$ZodSet:()=>C3,$ZodRegistry:()=>$J,$ZodRecord:()=>_3,$ZodRealError:()=>jX,$ZodReadonly:()=>p3,$ZodPromise:()=>d3,$ZodPrefault:()=>y3,$ZodPipe:()=>aY,$ZodOptional:()=>k3,$ZodObject:()=>E3,$ZodNumberFormat:()=>z3,$ZodNumber:()=>TU,$ZodNullable:()=>v3,$ZodNull:()=>B3,$ZodNonOptional:()=>f3,$ZodNever:()=>j3,$ZodNanoID:()=>aF,$ZodNaN:()=>u3,$ZodMap:()=>T3,$ZodLiteral:()=>b3,$ZodLazy:()=>l3,$ZodKSUID:()=>X3,$ZodJWT:()=>w3,$ZodIntersection:()=>I3,$ZodISOTime:()=>W3,$ZodISODuration:()=>U3,$ZodISODateTime:()=>Y3,$ZodISODate:()=>J3,$ZodIPv6:()=>H3,$ZodIPv4:()=>G3,$ZodGUID:()=>lF,$ZodFunction:()=>Rw,$ZodFile:()=>x3,$ZodError:()=>dY,$ZodEnum:()=>S3,$ZodEmoji:()=>oF,$ZodEmail:()=>rF,$ZodE164:()=>q3,$ZodDiscriminatedUnion:()=>P3,$ZodDefault:()=>h3,$ZodDate:()=>L3,$ZodCustomStringFormat:()=>Z3,$ZodCustom:()=>i3,$ZodCheckUpperCase:()=>vF,$ZodCheckStringFormat:()=>RX,$ZodCheckStartsWith:()=>yF,$ZodCheckSizeEquals:()=>TF,$ZodCheckRegex:()=>xF,$ZodCheckProperty:()=>gF,$ZodCheckOverwrite:()=>uF,$ZodCheckNumberFormat:()=>EF,$ZodCheckMultipleOf:()=>LF,$ZodCheckMinSize:()=>_F,$ZodCheckMinLength:()=>SF,$ZodCheckMimeType:()=>mF,$ZodCheckMaxSize:()=>IF,$ZodCheckMaxLength:()=>CF,$ZodCheckLowerCase:()=>kF,$ZodCheckLessThan:()=>RU,$ZodCheckLengthEquals:()=>bF,$ZodCheckIncludes:()=>hF,$ZodCheckGreaterThan:()=>LU,$ZodCheckEndsWith:()=>fF,$ZodCheckBigIntFormat:()=>PF,$ZodCheck:()=>o6,$ZodCatch:()=>m3,$ZodCUID2:()=>tF,$ZodCUID:()=>sF,$ZodCIDRv6:()=>V3,$ZodCIDRv4:()=>D3,$ZodBoolean:()=>rY,$ZodBigIntFormat:()=>O3,$ZodBigInt:()=>CU,$ZodBase64URL:()=>F3,$ZodBase64:()=>Q3,$ZodAsyncError:()=>q8,$ZodArray:()=>nY,$ZodAny:()=>M3});var L1=A(()=>{n$();jU();bq();ES();AX();BU();iQ();sY();EU();cF();vq();jS();jw();RS()});var Ew=A(()=>{L1()});var UG={};e0(UG,{time:()=>_w,duration:()=>Tw,datetime:()=>Pw,date:()=>Iw,ZodISOTime:()=>JG,ZodISODuration:()=>WG,ZodISODateTime:()=>XG,ZodISODate:()=>YG});function Pw($){return gq(XG,$)}function Iw($){return mq(YG,$)}function _w($){return uq(JG,$)}function Tw($){return pq(WG,$)}var XG,YG,JG,WG;var GG=A(()=>{L1();HG();XG=c("ZodISODateTime",($,X)=>{Y3.init($,X),m6.init($,X)});YG=c("ZodISODate",($,X)=>{J3.init($,X),m6.init($,X)});JG=c("ZodISOTime",($,X)=>{W3.init($,X),m6.init($,X)});WG=c("ZodISODuration",($,X)=>{U3.init($,X),m6.init($,X)})});var IS=($,X)=>{dY.init($,X),$.name="ZodError",Object.defineProperties($,{format:{value:(Y)=>iY($,Y)},flatten:{value:(Y)=>lY($,Y)},addIssue:{value:(Y)=>$.issues.push(Y)},addIssues:{value:(Y)=>$.issues.push(...Y)},isEmpty:{get(){return $.issues.length===0}}})},n4$,TX;var Cw=A(()=>{L1();L1();n4$=c("ZodError",IS),TX=c("ZodError",IS,{Parent:Error})});var Sw,bw,xw,zJ;var kw=A(()=>{L1();Cw();Sw=wU(TX),bw=zU(TX),xw=NU(TX),zJ=AU(TX)});function vw($){return hq(NJ,$)}function a4$($){return xU(fw,$)}function s4$($){return XJ(DG,$)}function t4$($){return kU(A8,$)}function e4$($){return vU(A8,$)}function $1$($){return hU(A8,$)}function X1$($){return yU(A8,$)}function Y1$($){return fU(gw,$)}function J1$($){return gU(mw,$)}function W1$($){return mU(uw,$)}function U1$($){return uU(pw,$)}function G1$($){return pU(cw,$)}function H1$($){return cU(dw,$)}function D1$($){return dU(lw,$)}function V1$($){return lU(iw,$)}function K1$($){return iU(rw,$)}function Q1$($){return rU(nw,$)}function F1$($){return nU(ow,$)}function q1$($){return oU(aw,$)}function w1$($){return aU(sw,$)}function Z1$($){return sU(tw,$)}function z1$($){return tU(ew,$)}function O1$($){return eU($Z,$)}function N1$($,X,Y={}){return Mw(_S,$,X,Y)}function TS($){return cq(AJ,$)}function hw($){return lq(CX,$)}function A1$($){return iq(CX,$)}function B1$($){return rq(CX,$)}function M1$($){return nq(CX,$)}function j1$($){return oq(CX,$)}function CS($){return aq(BJ,$)}function R1$($){return tq(MJ,$)}function L1$($){return $w(XZ,$)}function E1$($){return Xw(XZ,$)}function P1$($){return Yw(SS,$)}function I1$($){return Jw(bS,$)}function kS($){return Ww(xS,$)}function _1$(){return Uw(vS)}function VG(){return EX(hS)}function qG($){return Gw(yS,$)}function T1$($){return Hw(fS,$)}function C1$($){return Dw(wG,$)}function YZ($,X){return wJ(gS,$,X)}function S1$($){let X=$._zod.def.shape;return oS(Object.keys(X))}function b1$($,X){let Y={type:"object",get shape(){return E$.assignProp(this,"shape",{...$}),this.shape},...E$.normalizeParams(X)};return new ZG(Y)}function x1$($,X){return new ZG({type:"object",get shape(){return E$.assignProp(this,"shape",{...$}),this.shape},catchall:qG(),...E$.normalizeParams(X)})}function k1$($,X){return new ZG({type:"object",get shape(){return E$.assignProp(this,"shape",{...$}),this.shape},catchall:VG(),...E$.normalizeParams(X)})}function zG($,X){return new JZ({type:"union",options:$,...E$.normalizeParams(X)})}function v1$($,X,Y){return new mS({type:"union",options:X,discriminator:$,...E$.normalizeParams(Y)})}function pS($,X){return new uS({type:"intersection",left:$,right:X})}function h1$($,X,Y){let W=X instanceof s$,J=W?Y:X;return new cS({type:"tuple",items:$,rest:W?X:null,...E$.normalizeParams(J)})}function dS($,X,Y){return new WZ({type:"record",keyType:$,valueType:X,...E$.normalizeParams(Y)})}function y1$($,X,Y){return new WZ({type:"record",keyType:zG([$,qG()]),valueType:X,...E$.normalizeParams(Y)})}function f1$($,X,Y){return new lS({type:"map",keyType:$,valueType:X,...E$.normalizeParams(Y)})}function g1$($,X){return new iS({type:"set",valueType:$,...E$.normalizeParams(X)})}function rS($,X){let Y=Array.isArray($)?Object.fromEntries($.map((W)=>[W,W])):$;return new OJ({type:"enum",entries:Y,...E$.normalizeParams(X)})}function m1$($,X){return new OJ({type:"enum",entries:$,...E$.normalizeParams(X)})}function oS($,X){return new nS({type:"literal",values:Array.isArray($)?$:[$],...E$.normalizeParams(X)})}function u1$($){return Ow(aS,$)}function GZ($){return new UZ({type:"transform",transform:$})}function KG($){return new HZ({type:"optional",innerType:$})}function QG($){return new sS({type:"nullable",innerType:$})}function p1$($){return KG(QG($))}function eS($,X){return new tS({type:"default",innerType:$,get defaultValue(){return typeof X==="function"?X():X}})}function Xb($,X){return new $b({type:"prefault",innerType:$,get defaultValue(){return typeof X==="function"?X():X}})}function Yb($,X){return new DZ({type:"nonoptional",innerType:$,...E$.normalizeParams(X)})}function c1$($){return new Jb({type:"success",innerType:$})}function Ub($,X){return new Wb({type:"catch",innerType:$,catchValue:typeof X==="function"?X:()=>X})}function d1$($){return Kw(Gb,$)}function FG($,X){return new VZ({type:"pipe",in:$,out:X})}function Db($){return new Hb({type:"readonly",innerType:$})}function l1$($,X){return new Vb({type:"template_literal",parts:$,...E$.normalizeParams(X)})}function Qb($){return new Kb({type:"lazy",getter:$})}function i1$($){return new Fb({type:"promise",innerType:$})}function qb($){let X=new o6({check:"custom"});return X._zod.check=$,X}function r1$($,X){return Nw(OG,$??(()=>!0),X)}function wb($,X={}){return Aw(OG,$,X)}function Zb($){let X=qb((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(E$.issue(W,Y.value,X._zod.def));else{let J=W;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=Y.value),J.inst??(J.inst=X),J.continue??(J.continue=!X._zod.def.abort),Y.issues.push(E$.issue(J))}},$(Y.value,Y)});return X}function n1$($,X={error:`Input not instance of ${$.name}`}){let Y=new OG({type:"custom",check:"custom",fn:(W)=>W instanceof $,abort:!0,...E$.normalizeParams(X)});return Y._zod.bag.Class=$,Y}function a1$($){let X=Qb(()=>{return zG([vw($),TS(),CS(),kS(),YZ(X),dS(vw(),X)])});return X}function s1$($,X){return FG(GZ($),X)}var D6,yw,NJ,m6,fw,DG,A8,gw,mw,uw,pw,cw,dw,lw,iw,rw,nw,ow,aw,sw,tw,ew,$Z,_S,AJ,CX,BJ,MJ,XZ,SS,bS,xS,vS,hS,yS,fS,wG,gS,ZG,JZ,mS,uS,cS,WZ,lS,iS,OJ,nS,aS,UZ,HZ,sS,tS,$b,DZ,Jb,Wb,Gb,VZ,Hb,Vb,Kb,Fb,OG,o1$=(...$)=>Bw({Pipe:VZ,Boolean:BJ,String:NJ,Transform:UZ},...$);var HG=A(()=>{L1();L1();Ew();GG();kw();D6=c("ZodType",($,X)=>{return s$.init($,X),$.def=X,Object.defineProperty($,"_def",{value:X}),$.check=(...Y)=>{return $.clone({...X,checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]})},$.clone=(Y,W)=>j1($,Y,W),$.brand=()=>$,$.register=(Y,W)=>{return Y.add($,W),$},$.parse=(Y,W)=>Sw($,Y,W,{callee:$.parse}),$.safeParse=(Y,W)=>xw($,Y,W),$.parseAsync=async(Y,W)=>bw($,Y,W,{callee:$.parseAsync}),$.safeParseAsync=async(Y,W)=>zJ($,Y,W),$.spa=$.safeParseAsync,$.refine=(Y,W)=>$.check(wb(Y,W)),$.superRefine=(Y)=>$.check(Zb(Y)),$.overwrite=(Y)=>$.check(O8(Y)),$.optional=()=>KG($),$.nullable=()=>QG($),$.nullish=()=>KG(QG($)),$.nonoptional=(Y)=>Yb($,Y),$.array=()=>YZ($),$.or=(Y)=>zG([$,Y]),$.and=(Y)=>pS($,Y),$.transform=(Y)=>FG($,GZ(Y)),$.default=(Y)=>eS($,Y),$.prefault=(Y)=>Xb($,Y),$.catch=(Y)=>Ub($,Y),$.pipe=(Y)=>FG($,Y),$.readonly=()=>Db($),$.describe=(Y)=>{let W=$.clone();return u0.add(W,{description:Y}),W},Object.defineProperty($,"description",{get(){return u0.get($)?.description},configurable:!0}),$.meta=(...Y)=>{if(Y.length===0)return u0.get($);let W=$.clone();return u0.add(W,Y[0]),W},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$}),yw=c("_ZodString",($,X)=>{c9.init($,X),D6.init($,X);let Y=$._zod.bag;$.format=Y.format??null,$.minLength=Y.minimum??null,$.maxLength=Y.maximum??null,$.regex=(...W)=>$.check(JJ(...W)),$.includes=(...W)=>$.check(GJ(...W)),$.startsWith=(...W)=>$.check(HJ(...W)),$.endsWith=(...W)=>$.check(DJ(...W)),$.min=(...W)=>$.check($9(...W)),$.max=(...W)=>$.check(IX(...W)),$.length=(...W)=>$.check(_X(...W)),$.nonempty=(...W)=>$.check($9(1,...W)),$.lowercase=(W)=>$.check(WJ(W)),$.uppercase=(W)=>$.check(UJ(W)),$.trim=()=>$.check(QJ()),$.normalize=(...W)=>$.check(KJ(...W)),$.toLowerCase=()=>$.check(FJ()),$.toUpperCase=()=>$.check(qJ())}),NJ=c("ZodString",($,X)=>{c9.init($,X),yw.init($,X),$.email=(Y)=>$.check(xU(fw,Y)),$.url=(Y)=>$.check(fU(gw,Y)),$.jwt=(Y)=>$.check(eU($Z,Y)),$.emoji=(Y)=>$.check(gU(mw,Y)),$.guid=(Y)=>$.check(XJ(DG,Y)),$.uuid=(Y)=>$.check(kU(A8,Y)),$.uuidv4=(Y)=>$.check(vU(A8,Y)),$.uuidv6=(Y)=>$.check(hU(A8,Y)),$.uuidv7=(Y)=>$.check(yU(A8,Y)),$.nanoid=(Y)=>$.check(mU(uw,Y)),$.guid=(Y)=>$.check(XJ(DG,Y)),$.cuid=(Y)=>$.check(uU(pw,Y)),$.cuid2=(Y)=>$.check(pU(cw,Y)),$.ulid=(Y)=>$.check(cU(dw,Y)),$.base64=(Y)=>$.check(aU(sw,Y)),$.base64url=(Y)=>$.check(sU(tw,Y)),$.xid=(Y)=>$.check(dU(lw,Y)),$.ksuid=(Y)=>$.check(lU(iw,Y)),$.ipv4=(Y)=>$.check(iU(rw,Y)),$.ipv6=(Y)=>$.check(rU(nw,Y)),$.cidrv4=(Y)=>$.check(nU(ow,Y)),$.cidrv6=(Y)=>$.check(oU(aw,Y)),$.e164=(Y)=>$.check(tU(ew,Y)),$.datetime=(Y)=>$.check(Pw(Y)),$.date=(Y)=>$.check(Iw(Y)),$.time=(Y)=>$.check(_w(Y)),$.duration=(Y)=>$.check(Tw(Y))});m6=c("ZodStringFormat",($,X)=>{y6.init($,X),yw.init($,X)}),fw=c("ZodEmail",($,X)=>{rF.init($,X),m6.init($,X)});DG=c("ZodGUID",($,X)=>{lF.init($,X),m6.init($,X)});A8=c("ZodUUID",($,X)=>{iF.init($,X),m6.init($,X)});gw=c("ZodURL",($,X)=>{nF.init($,X),m6.init($,X)});mw=c("ZodEmoji",($,X)=>{oF.init($,X),m6.init($,X)});uw=c("ZodNanoID",($,X)=>{aF.init($,X),m6.init($,X)});pw=c("ZodCUID",($,X)=>{sF.init($,X),m6.init($,X)});cw=c("ZodCUID2",($,X)=>{tF.init($,X),m6.init($,X)});dw=c("ZodULID",($,X)=>{eF.init($,X),m6.init($,X)});lw=c("ZodXID",($,X)=>{$3.init($,X),m6.init($,X)});iw=c("ZodKSUID",($,X)=>{X3.init($,X),m6.init($,X)});rw=c("ZodIPv4",($,X)=>{G3.init($,X),m6.init($,X)});nw=c("ZodIPv6",($,X)=>{H3.init($,X),m6.init($,X)});ow=c("ZodCIDRv4",($,X)=>{D3.init($,X),m6.init($,X)});aw=c("ZodCIDRv6",($,X)=>{V3.init($,X),m6.init($,X)});sw=c("ZodBase64",($,X)=>{Q3.init($,X),m6.init($,X)});tw=c("ZodBase64URL",($,X)=>{F3.init($,X),m6.init($,X)});ew=c("ZodE164",($,X)=>{q3.init($,X),m6.init($,X)});$Z=c("ZodJWT",($,X)=>{w3.init($,X),m6.init($,X)});_S=c("ZodCustomStringFormat",($,X)=>{Z3.init($,X),m6.init($,X)});AJ=c("ZodNumber",($,X)=>{TU.init($,X),D6.init($,X),$.gt=(W,J)=>$.check(z8(W,J)),$.gte=(W,J)=>$.check(V1(W,J)),$.min=(W,J)=>$.check(V1(W,J)),$.lt=(W,J)=>$.check(Z8(W,J)),$.lte=(W,J)=>$.check(u1(W,J)),$.max=(W,J)=>$.check(u1(W,J)),$.int=(W)=>$.check(hw(W)),$.safe=(W)=>$.check(hw(W)),$.positive=(W)=>$.check(z8(0,W)),$.nonnegative=(W)=>$.check(V1(0,W)),$.negative=(W)=>$.check(Z8(0,W)),$.nonpositive=(W)=>$.check(u1(0,W)),$.multipleOf=(W,J)=>$.check(l9(W,J)),$.step=(W,J)=>$.check(l9(W,J)),$.finite=()=>$;let Y=$._zod.bag;$.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),$.isFinite=!0,$.format=Y.format??null});CX=c("ZodNumberFormat",($,X)=>{z3.init($,X),AJ.init($,X)});BJ=c("ZodBoolean",($,X)=>{rY.init($,X),D6.init($,X)});MJ=c("ZodBigInt",($,X)=>{CU.init($,X),D6.init($,X),$.gte=(W,J)=>$.check(V1(W,J)),$.min=(W,J)=>$.check(V1(W,J)),$.gt=(W,J)=>$.check(z8(W,J)),$.gte=(W,J)=>$.check(V1(W,J)),$.min=(W,J)=>$.check(V1(W,J)),$.lt=(W,J)=>$.check(Z8(W,J)),$.lte=(W,J)=>$.check(u1(W,J)),$.max=(W,J)=>$.check(u1(W,J)),$.positive=(W)=>$.check(z8(BigInt(0),W)),$.negative=(W)=>$.check(Z8(BigInt(0),W)),$.nonpositive=(W)=>$.check(u1(BigInt(0),W)),$.nonnegative=(W)=>$.check(V1(BigInt(0),W)),$.multipleOf=(W,J)=>$.check(l9(W,J));let Y=$._zod.bag;$.minValue=Y.minimum??null,$.maxValue=Y.maximum??null,$.format=Y.format??null});XZ=c("ZodBigIntFormat",($,X)=>{O3.init($,X),MJ.init($,X)});SS=c("ZodSymbol",($,X)=>{N3.init($,X),D6.init($,X)});bS=c("ZodUndefined",($,X)=>{A3.init($,X),D6.init($,X)});xS=c("ZodNull",($,X)=>{B3.init($,X),D6.init($,X)});vS=c("ZodAny",($,X)=>{M3.init($,X),D6.init($,X)});hS=c("ZodUnknown",($,X)=>{LX.init($,X),D6.init($,X)});yS=c("ZodNever",($,X)=>{j3.init($,X),D6.init($,X)});fS=c("ZodVoid",($,X)=>{R3.init($,X),D6.init($,X)});wG=c("ZodDate",($,X)=>{L3.init($,X),D6.init($,X),$.min=(W,J)=>$.check(V1(W,J)),$.max=(W,J)=>$.check(u1(W,J));let Y=$._zod.bag;$.minDate=Y.minimum?new Date(Y.minimum):null,$.maxDate=Y.maximum?new Date(Y.maximum):null});gS=c("ZodArray",($,X)=>{nY.init($,X),D6.init($,X),$.element=X.element,$.min=(Y,W)=>$.check($9(Y,W)),$.nonempty=(Y)=>$.check($9(1,Y)),$.max=(Y,W)=>$.check(IX(Y,W)),$.length=(Y,W)=>$.check(_X(Y,W)),$.unwrap=()=>$.element});ZG=c("ZodObject",($,X)=>{E3.init($,X),D6.init($,X),E$.defineLazy($,"shape",()=>X.shape),$.keyof=()=>rS(Object.keys($._zod.def.shape)),$.catchall=(Y)=>$.clone({...$._zod.def,catchall:Y}),$.passthrough=()=>$.clone({...$._zod.def,catchall:VG()}),$.loose=()=>$.clone({...$._zod.def,catchall:VG()}),$.strict=()=>$.clone({...$._zod.def,catchall:qG()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(Y)=>{return E$.extend($,Y)},$.merge=(Y)=>E$.merge($,Y),$.pick=(Y)=>E$.pick($,Y),$.omit=(Y)=>E$.omit($,Y),$.partial=(...Y)=>E$.partial(HZ,$,Y[0]),$.required=(...Y)=>E$.required(DZ,$,Y[0])});JZ=c("ZodUnion",($,X)=>{SU.init($,X),D6.init($,X),$.options=X.options});mS=c("ZodDiscriminatedUnion",($,X)=>{JZ.init($,X),P3.init($,X)});uS=c("ZodIntersection",($,X)=>{I3.init($,X),D6.init($,X)});cS=c("ZodTuple",($,X)=>{d9.init($,X),D6.init($,X),$.rest=(Y)=>$.clone({...$._zod.def,rest:Y})});WZ=c("ZodRecord",($,X)=>{_3.init($,X),D6.init($,X),$.keyType=X.keyType,$.valueType=X.valueType});lS=c("ZodMap",($,X)=>{T3.init($,X),D6.init($,X),$.keyType=X.keyType,$.valueType=X.valueType});iS=c("ZodSet",($,X)=>{C3.init($,X),D6.init($,X),$.min=(...Y)=>$.check(i9(...Y)),$.nonempty=(Y)=>$.check(i9(1,Y)),$.max=(...Y)=>$.check(PX(...Y)),$.size=(...Y)=>$.check(YJ(...Y))});OJ=c("ZodEnum",($,X)=>{S3.init($,X),D6.init($,X),$.enum=X.entries,$.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));$.extract=(W,J)=>{let U={};for(let H of W)if(Y.has(H))U[H]=X.entries[H];else throw Error(`Key ${H} not found in enum`);return new OJ({...X,checks:[],...E$.normalizeParams(J),entries:U})},$.exclude=(W,J)=>{let U={...X.entries};for(let H of W)if(Y.has(H))delete U[H];else throw Error(`Key ${H} not found in enum`);return new OJ({...X,checks:[],...E$.normalizeParams(J),entries:U})}});nS=c("ZodLiteral",($,X)=>{b3.init($,X),D6.init($,X),$.values=new Set(X.values),Object.defineProperty($,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});aS=c("ZodFile",($,X)=>{x3.init($,X),D6.init($,X),$.min=(Y,W)=>$.check(i9(Y,W)),$.max=(Y,W)=>$.check(PX(Y,W)),$.mime=(Y,W)=>$.check(VJ(Array.isArray(Y)?Y:[Y],W))});UZ=c("ZodTransform",($,X)=>{oY.init($,X),D6.init($,X),$._zod.parse=(Y,W)=>{Y.addIssue=(U)=>{if(typeof U==="string")Y.issues.push(E$.issue(U,Y.value,X));else{let H=U;if(H.fatal)H.continue=!1;H.code??(H.code="custom"),H.input??(H.input=Y.value),H.inst??(H.inst=$),H.continue??(H.continue=!0),Y.issues.push(E$.issue(H))}};let J=X.transform(Y.value,Y);if(J instanceof Promise)return J.then((U)=>{return Y.value=U,Y});return Y.value=J,Y}});HZ=c("ZodOptional",($,X)=>{k3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.innerType});sS=c("ZodNullable",($,X)=>{v3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.innerType});tS=c("ZodDefault",($,X)=>{h3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});$b=c("ZodPrefault",($,X)=>{y3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.innerType});DZ=c("ZodNonOptional",($,X)=>{f3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.innerType});Jb=c("ZodSuccess",($,X)=>{g3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.innerType});Wb=c("ZodCatch",($,X)=>{m3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});Gb=c("ZodNaN",($,X)=>{u3.init($,X),D6.init($,X)});VZ=c("ZodPipe",($,X)=>{aY.init($,X),D6.init($,X),$.in=X.in,$.out=X.out});Hb=c("ZodReadonly",($,X)=>{p3.init($,X),D6.init($,X)});Vb=c("ZodTemplateLiteral",($,X)=>{c3.init($,X),D6.init($,X)});Kb=c("ZodLazy",($,X)=>{l3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.getter()});Fb=c("ZodPromise",($,X)=>{d3.init($,X),D6.init($,X),$.unwrap=()=>$._zod.def.innerType});OG=c("ZodCustom",($,X)=>{i3.init($,X),D6.init($,X)})});function e1$($){Q4({customError:$})}function $0$(){return Q4().customError}var t1$;var zb=A(()=>{L1();t1$={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"}});var KZ={};e0(KZ,{string:()=>X0$,number:()=>Y0$,date:()=>U0$,boolean:()=>J0$,bigint:()=>W0$});function X0$($){return yq(NJ,$)}function Y0$($){return dq(AJ,$)}function J0$($){return sq(BJ,$)}function W0$($){return eq(MJ,$)}function U0$($){return Vw(wG,$)}var Ob=A(()=>{L1();HG()});var G={};e0(G,{xid:()=>D1$,void:()=>T1$,uuidv7:()=>X1$,uuidv6:()=>$1$,uuidv4:()=>e4$,uuid:()=>t4$,url:()=>Y1$,uppercase:()=>UJ,unknown:()=>VG,union:()=>zG,undefined:()=>I1$,ulid:()=>H1$,uint64:()=>E1$,uint32:()=>j1$,tuple:()=>h1$,trim:()=>QJ,treeifyError:()=>dQ,transform:()=>GZ,toUpperCase:()=>qJ,toLowerCase:()=>FJ,toJSONSchema:()=>ZJ,templateLiteral:()=>l1$,symbol:()=>P1$,superRefine:()=>Zb,success:()=>c1$,stringbool:()=>o1$,stringFormat:()=>N1$,string:()=>vw,strictObject:()=>x1$,startsWith:()=>HJ,size:()=>YJ,setErrorMap:()=>e1$,set:()=>g1$,safeParseAsync:()=>zJ,safeParse:()=>xw,registry:()=>bU,regexes:()=>p9,regex:()=>JJ,refine:()=>wb,record:()=>dS,readonly:()=>Db,property:()=>Zw,promise:()=>i1$,prettifyError:()=>lQ,preprocess:()=>s1$,prefault:()=>Xb,positive:()=>Qw,pipe:()=>FG,partialRecord:()=>y1$,parseAsync:()=>bw,parse:()=>Sw,overwrite:()=>O8,optional:()=>KG,object:()=>b1$,number:()=>TS,nullish:()=>p1$,nullable:()=>QG,null:()=>kS,normalize:()=>KJ,nonpositive:()=>qw,nonoptional:()=>Yb,nonnegative:()=>ww,never:()=>qG,negative:()=>Fw,nativeEnum:()=>m1$,nanoid:()=>W1$,nan:()=>d1$,multipleOf:()=>l9,minSize:()=>i9,minLength:()=>$9,mime:()=>VJ,maxSize:()=>PX,maxLength:()=>IX,map:()=>f1$,lte:()=>u1,lt:()=>Z8,lowercase:()=>WJ,looseObject:()=>k1$,locales:()=>eY,literal:()=>oS,length:()=>_X,lazy:()=>Qb,ksuid:()=>V1$,keyof:()=>S1$,jwt:()=>O1$,json:()=>a1$,iso:()=>UG,ipv6:()=>Q1$,ipv4:()=>K1$,intersection:()=>pS,int64:()=>L1$,int32:()=>M1$,int:()=>hw,instanceof:()=>n1$,includes:()=>GJ,guid:()=>s4$,gte:()=>V1,gt:()=>z8,globalRegistry:()=>u0,getErrorMap:()=>$0$,function:()=>Lw,formatError:()=>iY,float64:()=>B1$,float32:()=>A1$,flattenError:()=>lY,file:()=>u1$,enum:()=>rS,endsWith:()=>DJ,emoji:()=>J1$,email:()=>a4$,e164:()=>z1$,discriminatedUnion:()=>v1$,date:()=>C1$,custom:()=>r1$,cuid2:()=>G1$,cuid:()=>U1$,core:()=>N8,config:()=>Q4,coerce:()=>KZ,clone:()=>j1,cidrv6:()=>q1$,cidrv4:()=>F1$,check:()=>qb,catch:()=>Ub,boolean:()=>CS,bigint:()=>R1$,base64url:()=>Z1$,base64:()=>w1$,array:()=>YZ,any:()=>_1$,_default:()=>eS,_ZodString:()=>yw,ZodXID:()=>lw,ZodVoid:()=>fS,ZodUnknown:()=>hS,ZodUnion:()=>JZ,ZodUndefined:()=>bS,ZodUUID:()=>A8,ZodURL:()=>gw,ZodULID:()=>dw,ZodType:()=>D6,ZodTuple:()=>cS,ZodTransform:()=>UZ,ZodTemplateLiteral:()=>Vb,ZodSymbol:()=>SS,ZodSuccess:()=>Jb,ZodStringFormat:()=>m6,ZodString:()=>NJ,ZodSet:()=>iS,ZodRecord:()=>WZ,ZodRealError:()=>TX,ZodReadonly:()=>Hb,ZodPromise:()=>Fb,ZodPrefault:()=>$b,ZodPipe:()=>VZ,ZodOptional:()=>HZ,ZodObject:()=>ZG,ZodNumberFormat:()=>CX,ZodNumber:()=>AJ,ZodNullable:()=>sS,ZodNull:()=>xS,ZodNonOptional:()=>DZ,ZodNever:()=>yS,ZodNanoID:()=>uw,ZodNaN:()=>Gb,ZodMap:()=>lS,ZodLiteral:()=>nS,ZodLazy:()=>Kb,ZodKSUID:()=>iw,ZodJWT:()=>$Z,ZodIssueCode:()=>t1$,ZodIntersection:()=>uS,ZodISOTime:()=>JG,ZodISODuration:()=>WG,ZodISODateTime:()=>XG,ZodISODate:()=>YG,ZodIPv6:()=>nw,ZodIPv4:()=>rw,ZodGUID:()=>DG,ZodFile:()=>aS,ZodError:()=>n4$,ZodEnum:()=>OJ,ZodEmoji:()=>mw,ZodEmail:()=>fw,ZodE164:()=>ew,ZodDiscriminatedUnion:()=>mS,ZodDefault:()=>tS,ZodDate:()=>wG,ZodCustomStringFormat:()=>_S,ZodCustom:()=>OG,ZodCatch:()=>Wb,ZodCUID2:()=>cw,ZodCUID:()=>pw,ZodCIDRv6:()=>aw,ZodCIDRv4:()=>ow,ZodBoolean:()=>BJ,ZodBigIntFormat:()=>XZ,ZodBigInt:()=>MJ,ZodBase64URL:()=>tw,ZodBase64:()=>sw,ZodArray:()=>gS,ZodAny:()=>vS,TimePrecision:()=>fq,NEVER:()=>bQ,$output:()=>xq,$input:()=>kq,$brand:()=>xQ});var QZ=A(()=>{L1();L1();e3();L1();bq();GG();GG();Ob();HG();Ew();Cw();kw();zb();Q4(tY())});var Nb=A(()=>{QZ();QZ()});var I$=A(()=>{Nb()});var NG=A(()=>{Z2()});function FZ($){}function Ab($){if(typeof $=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:X=FZ,onError:Y=FZ,onRetry:W=FZ,onComment:J}=$,U="",H=!0,D,V="",K="";function Q(O){let N=H?O.replace(/^\xEF\xBB\xBF/,""):O,[L,P]=H0$(`${U}${N}`);for(let j of L)q(j);U=P,H=!1}function q(O){if(O===""){w();return}if(O.startsWith(":")){J&&J(O.slice(O.startsWith(": ")?2:1));return}let N=O.indexOf(":");if(N!==-1){let L=O.slice(0,N),P=O[N+1]===" "?2:1,j=O.slice(N+P);F(L,j,O);return}F(O,"",O)}function F(O,N,L){switch(O){case"event":K=N;break;case"data":V=`${V}${N}
251
- `;break;case"id":D=N.includes("\x00")?void 0:N;break;case"retry":/^\d+$/.test(N)?W(parseInt(N,10)):Y(new qZ(`Invalid \`retry\` value: "${N}"`,{type:"invalid-retry",value:N,line:L}));break;default:Y(new qZ(`Unknown field "${O.length>20?`${O.slice(0,20)}\u2026`:O}"`,{type:"unknown-field",field:O,value:N,line:L}));break}}function w(){V.length>0&&X({id:D,event:K||void 0,data:V.endsWith(`
252
- `)?V.slice(0,-1):V}),D=void 0,V="",K=""}function z(O={}){U&&O.consume&&q(U),H=!0,D=void 0,V="",K="",U=""}return{feed:Q,reset:z}}function H0$($){let X=[],Y="",W=0;for(;W<$.length;){let J=$.indexOf("\r",W),U=$.indexOf(`
253
- `,W),H=-1;if(J!==-1&&U!==-1?H=Math.min(J,U):J!==-1?J===$.length-1?H=-1:H=J:U!==-1&&(H=U),H===-1){Y=$.slice(W);break}else{let D=$.slice(W,H);X.push(D),W=H+1,$[W-1]==="\r"&&$[W]===`
254
- `&&W++}}return[X,Y]}var qZ;var Bb=A(()=>{qZ=class qZ extends Error{constructor($,X){super($),this.name="ParseError",this.type=X.type,this.field=X.field,this.value=X.value,this.line=X.line}}});var wZ;var Mb=A(()=>{Bb();wZ=class wZ extends TransformStream{constructor({onError:$,onRetry:X,onComment:Y}={}){let W;super({start(J){W=Ab({onEvent:(U)=>{J.enqueue(U)},onError(U){$==="terminate"?J.error(U):typeof $=="function"&&$(U)},onRetry:X,onComment:Y})},transform(J){W.feed(J)}})}}});function V6(...$){return $.reduce((X,Y)=>({...X,...Y!=null?Y:{}}),{})}function AG({tools:$=[],providerToolNames:X,resolveProviderToolName:Y}){var W;let J={},U={};for(let H of $)if(H.type==="provider"){let D=(W=Y==null?void 0:Y(H))!=null?W:(H.id in X)?X[H.id]:void 0;if(D==null)continue;J[H.name]=D,U[D]=H.name}return{toProviderToolName:(H)=>{var D;return(D=J[H])!=null?D:H},toCustomToolName:(H)=>{var D;return(D=U[H])!=null?D:H}}}async function BG($,X){if($==null)return Promise.resolve();let Y=X==null?void 0:X.abortSignal;return new Promise((W,J)=>{if(Y==null?void 0:Y.aborted){J(jb());return}let U=setTimeout(()=>{H(),W()},$),H=()=>{clearTimeout(U),Y==null||Y.removeEventListener("abort",D)},D=()=>{H(),J(jb())};Y==null||Y.addEventListener("abort",D)})}function jb(){return new DOMException("Delay was aborted","AbortError")}function SX($){return Object.fromEntries([...$.headers])}function p4($){let X=$.replace(/-/g,"+").replace(/_/g,"/"),Y=V0$(X);return Uint8Array.from(Y,(W)=>W.codePointAt(0))}function p1($){let X="";for(let Y=0;Y<$.length;Y++)X+=String.fromCodePoint($[Y]);return D0$(X)}function c4($){return $ instanceof Uint8Array?p1($):$}function _b($,X={}){let{useArrayBrackets:Y=!0}=X,W=new FormData;for(let[J,U]of Object.entries($)){if(U==null)continue;if(Array.isArray(U)){if(U.length===1){W.append(J,U[0]);continue}let H=Y?`${J}[]`:J;for(let D of U)W.append(H,D);continue}W.append(J,U)}return W}async function BZ({response:$,url:X,maxBytes:Y=MG}){let W=$.headers.get("content-length");if(W!=null){let Q=parseInt(W,10);if(!isNaN(Q)&&Q>Y)throw new t4({url:X,message:`Download of ${X} exceeded maximum size of ${Y} bytes (Content-Length: ${Q}).`})}let J=$.body;if(J==null)return new Uint8Array(0);let U=J.getReader(),H=[],D=0;try{while(!0){let{done:Q,value:q}=await U.read();if(Q)break;if(D+=q.length,D>Y)throw new t4({url:X,message:`Download of ${X} exceeded maximum size of ${Y} bytes.`});H.push(q)}}finally{try{await U.cancel()}finally{U.releaseLock()}}let V=new Uint8Array(D),K=0;for(let Q of H)V.set(Q,K),K+=Q.length;return V}function MZ($){let X;try{X=new URL($)}catch(W){throw new t4({url:$,message:`Invalid URL: ${$}`})}if(X.protocol!=="http:"&&X.protocol!=="https:")throw new t4({url:$,message:`URL scheme must be http or https, got ${X.protocol}`});let Y=X.hostname;if(!Y)throw new t4({url:$,message:"URL must have a hostname"});if(Y==="localhost"||Y.endsWith(".local")||Y.endsWith(".localhost"))throw new t4({url:$,message:`URL with hostname ${Y} is not allowed`});if(Y.startsWith("[")&&Y.endsWith("]")){let W=Y.slice(1,-1);if(Q0$(W))throw new t4({url:$,message:`URL with IPv6 address ${Y} is not allowed`});return}if(Sb(Y)){if(OZ(Y))throw new t4({url:$,message:`URL with IP address ${Y} is not allowed`});return}}function Sb($){let X=$.split(".");if(X.length!==4)return!1;return X.every((Y)=>{let W=Number(Y);return Number.isInteger(W)&&W>=0&&W<=255&&String(W)===Y})}function OZ($){let X=$.split(".").map(Number),[Y,W]=X;if(Y===0)return!0;if(Y===10)return!0;if(Y===127)return!0;if(Y===169&&W===254)return!0;if(Y===172&&W>=16&&W<=31)return!0;if(Y===192&&W===168)return!0;return!1}function Q0$($){let X=$.toLowerCase();if(X==="::1")return!0;if(X==="::")return!0;if(X.startsWith("::ffff:")){let Y=X.slice(7);if(Sb(Y))return OZ(Y);let W=Y.split(":");if(W.length===2){let J=parseInt(W[0],16),U=parseInt(W[1],16);if(!isNaN(J)&&!isNaN(U)){let H=J>>8&255,D=J&255,V=U>>8&255,K=U&255;return OZ(`${H}.${D}.${V}.${K}`)}}}if(X.startsWith("fc")||X.startsWith("fd"))return!0;if(X.startsWith("fe80"))return!0;return!1}async function jZ($,X){var Y,W;MZ($);try{let J=await fetch($,{signal:X==null?void 0:X.abortSignal});if(!J.ok)throw new t4({url:$,statusCode:J.status,statusText:J.statusText});let U=await BZ({response:J,url:$,maxBytes:(Y=X==null?void 0:X.maxBytes)!=null?Y:MG}),H=(W=J.headers.get("content-type"))!=null?W:void 0;return new Blob([U],H?{type:H}:void 0)}catch(J){if(t4.isInstance(J))throw J;throw new t4({url:$,cause:J})}}function bX($){if($==null)return"unknown error";if(typeof $==="string")return $;if($ instanceof Error)return $.message;return JSON.stringify($)}function B8($){return($ instanceof Error||$ instanceof DOMException)&&($.name==="AbortError"||$.name==="ResponseAborted"||$.name==="TimeoutError")}function w0$($){if(!($ instanceof Error))return!1;let X=$.code;if(typeof X==="string"&&q0$.includes(X))return!0;return!1}function bb({error:$,url:X,requestBodyValues:Y}){if(B8($))return $;if($ instanceof TypeError&&F0$.includes($.message.toLowerCase())){let W=$.cause;if(W!=null)return new R6({message:`Cannot connect to API: ${W.message}`,cause:W,url:X,requestBodyValues:Y,isRetryable:!0})}if(w0$($))return new R6({message:`Cannot connect to API: ${$.message}`,cause:$,url:X,requestBodyValues:Y,isRetryable:!0});return $}function jG($=globalThis){var X,Y,W;if($.window)return"runtime/browser";if((X=$.navigator)==null?void 0:X.userAgent)return`runtime/${$.navigator.userAgent.toLowerCase()}`;if((W=(Y=$.process)==null?void 0:Y.versions)==null?void 0:W.node)return`runtime/node.js/${$.process.version.substring(0)}`;if($.EdgeRuntime)return"runtime/vercel-edge";return"runtime/unknown"}function Z0$($){if($==null)return{};let X={};if($ instanceof Headers)$.forEach((Y,W)=>{X[W.toLowerCase()]=Y});else{if(!Array.isArray($))$=Object.entries($);for(let[Y,W]of $)if(W!=null)X[Y.toLowerCase()]=W}return X}function $4($,...X){let Y=new Headers(Z0$($)),W=Y.get("user-agent")||"";return Y.set("user-agent",[W,...X].filter(Boolean).join(" ")),Object.fromEntries(Y.entries())}function RJ($){return $!=null}function kb({mediaType:$,url:X,supportedUrls:Y}){return X=X.toLowerCase(),$=$.toLowerCase(),Object.entries(Y).map(([W,J])=>{let U=W.toLowerCase();return U==="*"||U==="*/*"?{mediaTypePrefix:"",regexes:J}:{mediaTypePrefix:U.replace(/\*/,""),regexes:J}}).filter(({mediaTypePrefix:W})=>$.startsWith(W)).flatMap(({regexes:W})=>W).some((W)=>W.test(X))}function xX({apiKey:$,environmentVariableName:X,apiKeyParameterName:Y="apiKey",description:W}){if(typeof $==="string")return $;if($!=null)throw new kY({message:`${W} API key must be a string.`});if(typeof process>"u")throw new kY({message:`${W} API key is missing. Pass it using the '${Y}' parameter. Environment variables is not supported in this environment.`});if($=process.env[X],$==null)throw new kY({message:`${W} API key is missing. Pass it using the '${Y}' parameter or the ${X} environment variable.`});if(typeof $!=="string")throw new kY({message:`${W} API key must be a string. The value of the ${X} environment variable is not a string.`});return $}function c0({settingValue:$,environmentVariableName:X}){if(typeof $==="string")return $;if($!=null||typeof process>"u")return;if($=process.env[X],$==null||typeof $!=="string")return;return $}function vb($){var X;let[Y,W=""]=$.toLowerCase().split("/");return(X={mpeg:"mp3","x-wav":"wav",opus:"ogg",mp4:"m4a","x-m4a":"m4a"}[W])!=null?X:W}function Eb($){let X=JSON.parse($);if(X===null||typeof X!=="object")return X;if(O0$.test($)===!1&&N0$.test($)===!1)return X;return A0$(X)}function A0$($){let X=[$];while(X.length){let Y=X;X=[];for(let W of Y){if(Object.prototype.hasOwnProperty.call(W,"__proto__"))throw SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(W,"constructor")&&W.constructor!==null&&typeof W.constructor==="object"&&Object.prototype.hasOwnProperty.call(W.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let J in W){let U=W[J];if(U&&typeof U==="object")X.push(U)}}}return $}function RZ($){let{stackTraceLimit:X}=Error;try{Error.stackTraceLimit=0}catch(Y){return Eb($)}try{return Eb($)}finally{Error.stackTraceLimit=X}}function LZ($){if($.type==="object"||Array.isArray($.type)&&$.type.includes("object")){$.additionalProperties=!1;let{properties:Y}=$;if(Y!=null)for(let W of Object.keys(Y))Y[W]=r9(Y[W])}if($.items!=null)$.items=Array.isArray($.items)?$.items.map(r9):r9($.items);if($.anyOf!=null)$.anyOf=$.anyOf.map(r9);if($.allOf!=null)$.allOf=$.allOf.map(r9);if($.oneOf!=null)$.oneOf=$.oneOf.map(r9);let{definitions:X}=$;if(X!=null)for(let Y of Object.keys(X))X[Y]=r9(X[Y]);return $}function r9($){if(typeof $==="boolean")return $;return LZ($)}function E1(){return{}}function j0$($,X){var Y,W,J;let U={type:"array"};if(((Y=$.type)==null?void 0:Y._def)&&((J=(W=$.type)==null?void 0:W._def)==null?void 0:J.typeName)!==q$.ZodAny)U.items=b6($.type._def,{...X,currentPath:[...X.currentPath,"items"]});if($.minLength)U.minItems=$.minLength.value;if($.maxLength)U.maxItems=$.maxLength.value;if($.exactLength)U.minItems=$.exactLength.value,U.maxItems=$.exactLength.value;return U}function R0$($){let X={type:"integer",format:"int64"};if(!$.checks)return X;for(let Y of $.checks)switch(Y.kind){case"min":if(Y.inclusive)X.minimum=Y.value;else X.exclusiveMinimum=Y.value;break;case"max":if(Y.inclusive)X.maximum=Y.value;else X.exclusiveMaximum=Y.value;break;case"multipleOf":X.multipleOf=Y.value;break}return X}function L0$(){return{type:"boolean"}}function hb($,X){return b6($.type._def,X)}function yb($,X,Y){let W=Y!=null?Y:X.dateStrategy;if(Array.isArray(W))return{anyOf:W.map((J,U)=>yb($,X,J))};switch(W){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return P0$($)}}function I0$($,X){return{...b6($.innerType._def,X),default:$.defaultValue()}}function _0$($,X){return X.effectStrategy==="input"?b6($.schema._def,X):E1()}function T0$($){return{type:"string",enum:Array.from($.values)}}function S0$($,X){let Y=[b6($.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),b6($.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((J)=>!!J),W=[];return Y.forEach((J)=>{if(C0$(J))W.push(...J.allOf);else{let U=J;if("additionalProperties"in J&&J.additionalProperties===!1){let{additionalProperties:H,...D}=J;U=D}W.push(U)}}),W.length?{allOf:W}:void 0}function b0$($){let X=typeof $.value;if(X!=="bigint"&&X!=="number"&&X!=="boolean"&&X!=="string")return{type:Array.isArray($.value)?"array":"object"};return{type:X==="bigint"?"integer":X,const:$.value}}function fb($,X){let Y={type:"string"};if($.checks)for(let W of $.checks)switch(W.kind){case"min":Y.minLength=typeof Y.minLength==="number"?Math.max(Y.minLength,W.value):W.value;break;case"max":Y.maxLength=typeof Y.maxLength==="number"?Math.min(Y.maxLength,W.value):W.value;break;case"email":switch(X.emailStrategy){case"format:email":w0(Y,"email",W.message,X);break;case"format:idn-email":w0(Y,"idn-email",W.message,X);break;case"pattern:zod":s4(Y,q0.email,W.message,X);break}break;case"url":w0(Y,"uri",W.message,X);break;case"uuid":w0(Y,"uuid",W.message,X);break;case"regex":s4(Y,W.regex,W.message,X);break;case"cuid":s4(Y,q0.cuid,W.message,X);break;case"cuid2":s4(Y,q0.cuid2,W.message,X);break;case"startsWith":s4(Y,RegExp(`^${zZ(W.value,X)}`),W.message,X);break;case"endsWith":s4(Y,RegExp(`${zZ(W.value,X)}$`),W.message,X);break;case"datetime":w0(Y,"date-time",W.message,X);break;case"date":w0(Y,"date",W.message,X);break;case"time":w0(Y,"time",W.message,X);break;case"duration":w0(Y,"duration",W.message,X);break;case"length":Y.minLength=typeof Y.minLength==="number"?Math.max(Y.minLength,W.value):W.value,Y.maxLength=typeof Y.maxLength==="number"?Math.min(Y.maxLength,W.value):W.value;break;case"includes":{s4(Y,RegExp(zZ(W.value,X)),W.message,X);break}case"ip":{if(W.version!=="v6")w0(Y,"ipv4",W.message,X);if(W.version!=="v4")w0(Y,"ipv6",W.message,X);break}case"base64url":s4(Y,q0.base64url,W.message,X);break;case"jwt":s4(Y,q0.jwt,W.message,X);break;case"cidr":{if(W.version!=="v6")s4(Y,q0.ipv4Cidr,W.message,X);if(W.version!=="v4")s4(Y,q0.ipv6Cidr,W.message,X);break}case"emoji":s4(Y,q0.emoji(),W.message,X);break;case"ulid":{s4(Y,q0.ulid,W.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{w0(Y,"binary",W.message,X);break}case"contentEncoding:base64":{Y.contentEncoding="base64";break}case"pattern:zod":{s4(Y,q0.base64,W.message,X);break}}break}case"nanoid":s4(Y,q0.nanoid,W.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return Y}function zZ($,X){return X.patternStrategy==="escape"?k0$($):$}function k0$($){let X="";for(let Y=0;Y<$.length;Y++){if(!x0$.has($[Y]))X+="\\";X+=$[Y]}return X}function w0($,X,Y,W){var J;if($.format||((J=$.anyOf)==null?void 0:J.some((U)=>U.format))){if(!$.anyOf)$.anyOf=[];if($.format)$.anyOf.push({format:$.format}),delete $.format;$.anyOf.push({format:X,...Y&&W.errorMessages&&{errorMessage:{format:Y}}})}else $.format=X}function s4($,X,Y,W){var J;if($.pattern||((J=$.allOf)==null?void 0:J.some((U)=>U.pattern))){if(!$.allOf)$.allOf=[];if($.pattern)$.allOf.push({pattern:$.pattern}),delete $.pattern;$.allOf.push({pattern:Ib(X,W),...Y&&W.errorMessages&&{errorMessage:{pattern:Y}}})}else $.pattern=Ib(X,W)}function Ib($,X){var Y;if(!X.applyRegexFlags||!$.flags)return $.source;let W={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},J=W.i?$.source.toLowerCase():$.source,U="",H=!1,D=!1,V=!1;for(let K=0;K<J.length;K++){if(H){U+=J[K],H=!1;continue}if(W.i){if(D){if(J[K].match(/[a-z]/)){if(V)U+=J[K],U+=`${J[K-2]}-${J[K]}`.toUpperCase(),V=!1;else if(J[K+1]==="-"&&((Y=J[K+2])==null?void 0:Y.match(/[a-z]/)))U+=J[K],V=!0;else U+=`${J[K]}${J[K].toUpperCase()}`;continue}}else if(J[K].match(/[a-z]/)){U+=`[${J[K]}${J[K].toUpperCase()}]`;continue}}if(W.m){if(J[K]==="^"){U+=`(^|(?<=[\r
255
- ]))`;continue}else if(J[K]==="$"){U+=`($|(?=[\r
256
- ]))`;continue}}if(W.s&&J[K]==="."){U+=D?`${J[K]}\r
257
- `:`[${J[K]}\r
258
- ]`;continue}if(U+=J[K],J[K]==="\\")H=!0;else if(D&&J[K]==="]")D=!1;else if(!D&&J[K]==="[")D=!0}try{new RegExp(U)}catch(K){return console.warn(`Could not convert regex pattern at ${X.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),$.source}return U}function gb($,X){var Y,W,J,U,H,D;let V={type:"object",additionalProperties:(Y=b6($.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]}))!=null?Y:X.allowedAdditionalProperties};if(((W=$.keyType)==null?void 0:W._def.typeName)===q$.ZodString&&((J=$.keyType._def.checks)==null?void 0:J.length)){let{type:K,...Q}=fb($.keyType._def,X);return{...V,propertyNames:Q}}else if(((U=$.keyType)==null?void 0:U._def.typeName)===q$.ZodEnum)return{...V,propertyNames:{enum:$.keyType._def.values}};else if(((H=$.keyType)==null?void 0:H._def.typeName)===q$.ZodBranded&&$.keyType._def.type._def.typeName===q$.ZodString&&((D=$.keyType._def.type._def.checks)==null?void 0:D.length)){let{type:K,...Q}=hb($.keyType._def,X);return{...V,propertyNames:Q}}return V}function v0$($,X){if(X.mapStrategy==="record")return gb($,X);let Y=b6($.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||E1(),W=b6($.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||E1();return{type:"array",maxItems:125,items:{type:"array",items:[Y,W],minItems:2,maxItems:2}}}function h0$($){let X=$.values,W=Object.keys($.values).filter((U)=>{return typeof X[X[U]]!=="number"}).map((U)=>X[U]),J=Array.from(new Set(W.map((U)=>typeof U)));return{type:J.length===1?J[0]==="string"?"string":"number":["string","number"],enum:W}}function y0$(){return{not:E1()}}function f0$(){return{type:"null"}}function g0$($,X){let Y=$.options instanceof Map?Array.from($.options.values()):$.options;if(Y.every((W)=>(W._def.typeName in NZ)&&(!W._def.checks||!W._def.checks.length))){let W=Y.reduce((J,U)=>{let H=NZ[U._def.typeName];return H&&!J.includes(H)?[...J,H]:J},[]);return{type:W.length>1?W:W[0]}}else if(Y.every((W)=>W._def.typeName==="ZodLiteral"&&!W.description)){let W=Y.reduce((J,U)=>{let H=typeof U._def.value;switch(H){case"string":case"number":case"boolean":return[...J,H];case"bigint":return[...J,"integer"];case"object":if(U._def.value===null)return[...J,"null"];case"symbol":case"undefined":case"function":default:return J}},[]);if(W.length===Y.length){let J=W.filter((U,H,D)=>D.indexOf(U)===H);return{type:J.length>1?J:J[0],enum:Y.reduce((U,H)=>{return U.includes(H._def.value)?U:[...U,H._def.value]},[])}}}else if(Y.every((W)=>W._def.typeName==="ZodEnum"))return{type:"string",enum:Y.reduce((W,J)=>[...W,...J._def.values.filter((U)=>!W.includes(U))],[])};return m0$($,X)}function u0$($,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length))return{type:[NZ[$.innerType._def.typeName],"null"]};let Y=b6($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return Y&&{anyOf:[Y,{type:"null"}]}}function p0$($){let X={type:"number"};if(!$.checks)return X;for(let Y of $.checks)switch(Y.kind){case"int":X.type="integer";break;case"min":if(Y.inclusive)X.minimum=Y.value;else X.exclusiveMinimum=Y.value;break;case"max":if(Y.inclusive)X.maximum=Y.value;else X.exclusiveMaximum=Y.value;break;case"multipleOf":X.multipleOf=Y.value;break}return X}function c0$($,X){let Y={type:"object",properties:{}},W=[],J=$.shape();for(let H in J){let D=J[H];if(D===void 0||D._def===void 0)continue;let V=l0$(D),K=b6(D._def,{...X,currentPath:[...X.currentPath,"properties",H],propertyPath:[...X.currentPath,"properties",H]});if(K===void 0)continue;if(Y.properties[H]=K,!V)W.push(H)}if(W.length)Y.required=W;let U=d0$($,X);if(U!==void 0)Y.additionalProperties=U;return Y}function d0$($,X){if($.catchall._def.typeName!=="ZodNever")return b6($.catchall._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]});switch($.unknownKeys){case"passthrough":return X.allowedAdditionalProperties;case"strict":return X.rejectedAdditionalProperties;case"strip":return X.removeAdditionalStrategy==="strict"?X.allowedAdditionalProperties:X.rejectedAdditionalProperties}}function l0$($){try{return $.isOptional()}catch(X){return!0}}function n0$($,X){return b6($.type._def,X)}function o0$($,X){let W={type:"array",uniqueItems:!0,items:b6($.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if($.minSize)W.minItems=$.minSize.value;if($.maxSize)W.maxItems=$.maxSize.value;return W}function a0$($,X){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((Y,W)=>b6(Y._def,{...X,currentPath:[...X.currentPath,"items",`${W}`]})).reduce((Y,W)=>W===void 0?Y:[...Y,W],[]),additionalItems:b6($.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((Y,W)=>b6(Y._def,{...X,currentPath:[...X.currentPath,"items",`${W}`]})).reduce((Y,W)=>W===void 0?Y:[...Y,W],[])}}function s0$(){return{not:E1()}}function t0$(){return E1()}function b6($,X,Y=!1){var W;let J=X.seen.get($);if(X.override){let V=(W=X.override)==null?void 0:W.call(X,$,X,J,Y);if(V!==B0$)return V}if(J&&!Y){let V=Y8$(J,X);if(V!==void 0)return V}let U={def:$,path:X.currentPath,jsonSchema:void 0};X.seen.set($,U);let H=$8$($,$.typeName,X),D=typeof H==="function"?b6(H(),X):H;if(D)J8$($,X,D);if(X.postProcess){let V=X.postProcess(D,$,X);return U.jsonSchema=D,V}return U.jsonSchema=D,D}function p($){let X;return()=>{if(X==null)X=$();return X}}function LJ($,{validate:X}={}){return{[AZ]:!0,_type:void 0,get jsonSchema(){if(typeof $==="function")$=$();return $},validate:X}}function G8$($){return typeof $==="object"&&$!==null&&AZ in $&&$[AZ]===!0&&"jsonSchema"in $&&"validate"in $}function P1($){return $==null?LJ({properties:{},additionalProperties:!1}):G8$($)?$:("~standard"in $)?$["~standard"].vendor==="zod"?u($):H8$($):$()}function H8$($){return LJ(()=>LZ($["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async(X)=>{let Y=await $["~standard"].validate(X);return"value"in Y?{success:!0,value:Y.value}:{success:!1,error:new K4({value:X,cause:Y.issues})}}})}function D8$($,X){var Y;let W=(Y=X==null?void 0:X.useReferences)!=null?Y:!1;return LJ(()=>U8$($,{$refStrategy:W?"root":"none"}),{validate:async(J)=>{let U=await $.safeParseAsync(J);return U.success?{success:!0,value:U.data}:{success:!1,error:U.error}}})}function V8$($,X){var Y;let W=(Y=X==null?void 0:X.useReferences)!=null?Y:!1;return LJ(()=>LZ(ZJ($,{target:"draft-7",io:"input",reused:W?"ref":"inline"})),{validate:async(J)=>{let U=await zJ($,J);return U.success?{success:!0,value:U.data}:{success:!1,error:U.error}}})}function K8$($){return"_zod"in $}function u($,X){if(K8$($))return V8$($,X);else return D8$($,X)}async function z6({value:$,schema:X,context:Y}){let W=await F4({value:$,schema:X,context:Y});if(!W.success)throw K4.wrap({value:$,cause:W.error,context:Y});return W.value}async function F4({value:$,schema:X,context:Y}){let W=P1(X);try{if(W.validate==null)return{success:!0,value:$,rawValue:$};let J=await W.validate($);if(J.success)return{success:!0,value:J.value,rawValue:$};return{success:!1,error:K4.wrap({value:$,cause:J.error,context:Y}),rawValue:$}}catch(J){return{success:!1,error:K4.wrap({value:$,cause:J,context:Y}),rawValue:$}}}async function Q8$({text:$,schema:X}){try{let Y=RZ($);if(X==null)return Y;return z6({value:Y,schema:X})}catch(Y){if(f9.isInstance(Y)||K4.isInstance(Y))throw Y;throw new f9({text:$,cause:Y})}}async function d4({text:$,schema:X}){try{let Y=RZ($);if(X==null)return{success:!0,value:Y,rawValue:Y};return await F4({value:Y,schema:X})}catch(Y){return{success:!1,error:f9.isInstance(Y)?Y:new f9({text:$,cause:Y}),rawValue:void 0}}}function EZ($){try{return RZ($),!0}catch(X){return!1}}function RG({stream:$,schema:X}){return $.pipeThrough(new TextDecoderStream).pipeThrough(new wZ).pipeThrough(new TransformStream({async transform({data:Y},W){if(Y==="[DONE]")return;W.enqueue(await d4({text:Y,schema:X}))}}))}async function E6({provider:$,providerOptions:X,schema:Y}){if((X==null?void 0:X[$])==null)return;let W=await F4({value:X[$],schema:Y});if(!W.success)throw new NX({argument:"providerOptions",message:`invalid ${$} provider options`,cause:W.error});return W.value}function PZ($){return $}function IZ($){return{...$,type:"dynamic"}}function A6({id:$,inputSchema:X}){return({execute:Y,outputSchema:W,needsApproval:J,toModelOutput:U,onInputStart:H,onInputDelta:D,onInputAvailable:V,...K})=>PZ({type:"provider",id:$,args:K,inputSchema:X,outputSchema:W,execute:Y,needsApproval:J,toModelOutput:U,onInputStart:H,onInputDelta:D,onInputAvailable:V})}function J6({id:$,inputSchema:X,outputSchema:Y,supportsDeferredResults:W}){return({execute:J,needsApproval:U,toModelOutput:H,onInputStart:D,onInputDelta:V,onInputAvailable:K,...Q})=>PZ({type:"provider",id:$,args:Q,inputSchema:X,outputSchema:Y,execute:J,needsApproval:U,toModelOutput:H,onInputStart:D,onInputDelta:V,onInputAvailable:K,supportsDeferredResults:W})}async function B6($){if(typeof $==="function")$=$();return Promise.resolve($)}function X9($){return $==null?void 0:$.replace(/\/$/,"")}function q8$($){return $!=null&&typeof $[Symbol.asyncIterator]==="function"}async function*pb({execute:$,input:X,options:Y}){let W=$(X,Y);if(q8$(W)){let J;for await(let U of W)J=U,yield{type:"preliminary",output:U};yield{type:"final",output:J}}else yield{type:"final",output:await W}}var n9=class{constructor(){this.status={type:"pending"},this._resolve=void 0,this._reject=void 0}get promise(){if(this._promise)return this._promise;return this._promise=new Promise(($,X)=>{if(this.status.type==="resolved")$(this.status.value);else if(this.status.type==="rejected")X(this.status.error);this._resolve=$,this._reject=X}),this._promise}resolve($){var X;if(this.status={type:"resolved",value:$},this._promise)(X=this._resolve)==null||X.call(this,$)}reject($){var X;if(this.status={type:"rejected",error:$},this._promise)(X=this._reject)==null||X.call(this,$)}isResolved(){return this.status.type==="resolved"}isRejected(){return this.status.type==="rejected"}isPending(){return this.status.type==="pending"}},D0$,V0$,Tb="AI_DownloadError",Cb,K0$,Rb,Lb,t4,MG=2147483648,p0=({prefix:$,size:X=16,alphabet:Y="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:W="-"}={})=>{let J=()=>{let U=Y.length,H=Array(X);for(let D=0;D<X;D++)H[D]=Y[Math.random()*U|0];return H.join("")};if($==null)return J;if(Y.includes(W))throw new NX({argument:"separator",message:`The separator "${W}" must not be part of the alphabet "${Y}".`});return()=>`${$}${W}${J()}`},x6,F0$,q0$,xb="4.0.19",z0$=()=>globalThis.fetch,jJ=async({url:$,headers:X={},successfulResponseHandler:Y,failedResponseHandler:W,abortSignal:J,fetch:U=z0$()})=>{try{let H=await U($,{method:"GET",headers:$4(X,`ai-sdk/provider-utils/${xb}`,jG()),signal:J}),D=SX(H);if(!H.ok){let V;try{V=await W({response:H,url:$,requestBodyValues:{}})}catch(K){if(B8(K)||R6.isInstance(K))throw K;throw new R6({message:"Failed to process error response",cause:K,statusCode:H.status,url:$,responseHeaders:D,requestBodyValues:{}})}throw V.value}try{return await Y({response:H,url:$,requestBodyValues:{}})}catch(V){if(V instanceof Error){if(B8(V)||R6.isInstance(V))throw V}throw new R6({message:"Failed to process successful response",cause:V,statusCode:H.status,url:$,responseHeaders:D,requestBodyValues:{}})}}catch(H){throw bb({error:H,url:$,requestBodyValues:{}})}},O0$,N0$,B0$,Pb,M0$=($)=>typeof $==="string"?{...Pb,name:$}:{...Pb,...$},E0$=($,X)=>{return b6($.innerType._def,X)},P0$=($)=>{let X={type:"integer",format:"unix-time"};for(let Y of $.checks)switch(Y.kind){case"min":X.minimum=Y.value;break;case"max":X.maximum=Y.value;break}return X},C0$=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $},ZZ=void 0,q0,x0$,NZ,m0$=($,X)=>{let Y=($.options instanceof Map?Array.from($.options.values()):$.options).map((W,J)=>b6(W._def,{...X,currentPath:[...X.currentPath,"anyOf",`${J}`]})).filter((W)=>!!W&&(!X.strictUnions||typeof W==="object"&&Object.keys(W).length>0));return Y.length?{anyOf:Y}:void 0},i0$=($,X)=>{var Y;if(X.currentPath.toString()===((Y=X.propertyPath)==null?void 0:Y.toString()))return b6($.innerType._def,X);let W=b6($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return W?{anyOf:[{not:E1()},W]}:E1()},r0$=($,X)=>{if(X.pipeStrategy==="input")return b6($.in._def,X);else if(X.pipeStrategy==="output")return b6($.out._def,X);let Y=b6($.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),W=b6($.out._def,{...X,currentPath:[...X.currentPath,"allOf",Y?"1":"0"]});return{allOf:[Y,W].filter((J)=>J!==void 0)}},e0$=($,X)=>{return b6($.innerType._def,X)},$8$=($,X,Y)=>{switch(X){case q$.ZodString:return fb($,Y);case q$.ZodNumber:return p0$($);case q$.ZodObject:return c0$($,Y);case q$.ZodBigInt:return R0$($);case q$.ZodBoolean:return L0$();case q$.ZodDate:return yb($,Y);case q$.ZodUndefined:return s0$();case q$.ZodNull:return f0$();case q$.ZodArray:return j0$($,Y);case q$.ZodUnion:case q$.ZodDiscriminatedUnion:return g0$($,Y);case q$.ZodIntersection:return S0$($,Y);case q$.ZodTuple:return a0$($,Y);case q$.ZodRecord:return gb($,Y);case q$.ZodLiteral:return b0$($);case q$.ZodEnum:return T0$($);case q$.ZodNativeEnum:return h0$($);case q$.ZodNullable:return u0$($,Y);case q$.ZodOptional:return i0$($,Y);case q$.ZodMap:return v0$($,Y);case q$.ZodSet:return o0$($,Y);case q$.ZodLazy:return()=>$.getter()._def;case q$.ZodPromise:return n0$($,Y);case q$.ZodNaN:case q$.ZodNever:return y0$();case q$.ZodEffects:return _0$($,Y);case q$.ZodAny:return E1();case q$.ZodUnknown:return t0$();case q$.ZodDefault:return I0$($,Y);case q$.ZodBranded:return hb($,Y);case q$.ZodReadonly:return e0$($,Y);case q$.ZodCatch:return E0$($,Y);case q$.ZodPipeline:return r0$($,Y);case q$.ZodFunction:case q$.ZodVoid:case q$.ZodSymbol:return;default:return((W)=>{return})(X)}},X8$=($,X)=>{let Y=0;for(;Y<$.length&&Y<X.length;Y++)if($[Y]!==X[Y])break;return[($.length-Y).toString(),...X.slice(Y)].join("/")},Y8$=($,X)=>{switch(X.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:X8$(X.currentPath,$.path)};case"none":case"seen":{if($.path.length<X.currentPath.length&&$.path.every((Y,W)=>X.currentPath[W]===Y))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),E1();return X.$refStrategy==="seen"?E1():void 0}}},J8$=($,X,Y)=>{if($.description)Y.description=$.description;return Y},W8$=($)=>{let X=M0$($),Y=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,currentPath:Y,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([W,J])=>[J._def,{def:J._def,path:[...X.basePath,X.definitionPath,W],jsonSchema:void 0}]))}},U8$=($,X)=>{var Y;let W=W8$(X),J=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((K,[Q,q])=>{var F;return{...K,[Q]:(F=b6(q._def,{...W,currentPath:[...W.basePath,W.definitionPath,Q]},!0))!=null?F:E1()}},{}):void 0,U=typeof X==="string"?X:(X==null?void 0:X.nameStrategy)==="title"?void 0:X==null?void 0:X.name,H=(Y=b6($._def,U===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,U]},!1))!=null?Y:E1(),D=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(D!==void 0)H.title=D;let V=U===void 0?J?{...H,[W.definitionPath]:J}:H:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,U].join("/"),[W.definitionPath]:{...J,[U]:H}};return V.$schema="http://json-schema.org/draft-07/schema#",V},AZ,F8$=()=>globalThis.fetch,q6=async({url:$,headers:X,body:Y,failedResponseHandler:W,successfulResponseHandler:J,abortSignal:U,fetch:H})=>mb({url:$,headers:{"Content-Type":"application/json",...X},body:{content:JSON.stringify(Y),values:Y},failedResponseHandler:W,successfulResponseHandler:J,abortSignal:U,fetch:H}),LG=async({url:$,headers:X,formData:Y,failedResponseHandler:W,successfulResponseHandler:J,abortSignal:U,fetch:H})=>mb({url:$,headers:X,body:{content:Y,values:Object.fromEntries(Y.entries())},failedResponseHandler:W,successfulResponseHandler:J,abortSignal:U,fetch:H}),mb=async({url:$,headers:X={},body:Y,successfulResponseHandler:W,failedResponseHandler:J,abortSignal:U,fetch:H=F8$()})=>{try{let D=await H($,{method:"POST",headers:$4(X,`ai-sdk/provider-utils/${xb}`,jG()),body:Y.content,signal:U}),V=SX(D);if(!D.ok){let K;try{K=await J({response:D,url:$,requestBodyValues:Y.values})}catch(Q){if(B8(Q)||R6.isInstance(Q))throw Q;throw new R6({message:"Failed to process error response",cause:Q,statusCode:D.status,url:$,responseHeaders:V,requestBodyValues:Y.values})}throw K.value}try{return await W({response:D,url:$,requestBodyValues:Y.values})}catch(K){if(K instanceof Error){if(B8(K)||R6.isInstance(K))throw K}throw new R6({message:"Failed to process successful response",cause:K,statusCode:D.status,url:$,responseHeaders:V,requestBodyValues:Y.values})}}catch(D){throw bb({error:D,url:$,requestBodyValues:Y.values})}},E4=({errorSchema:$,errorToMessage:X,isRetryable:Y})=>async({response:W,url:J,requestBodyValues:U})=>{let H=await W.text(),D=SX(W);if(H.trim()==="")return{responseHeaders:D,value:new R6({message:W.statusText,url:J,requestBodyValues:U,statusCode:W.status,responseHeaders:D,responseBody:H,isRetryable:Y==null?void 0:Y(W)})};try{let V=await Q8$({text:H,schema:$});return{responseHeaders:D,value:new R6({message:X(V),url:J,requestBodyValues:U,statusCode:W.status,responseHeaders:D,responseBody:H,data:V,isRetryable:Y==null?void 0:Y(W,V)})}}catch(V){return{responseHeaders:D,value:new R6({message:W.statusText,url:J,requestBodyValues:U,statusCode:W.status,responseHeaders:D,responseBody:H,isRetryable:Y==null?void 0:Y(W)})}}},c1=($)=>async({response:X})=>{let Y=SX(X);if(X.body==null)throw new lT({});return{responseHeaders:Y,value:RG({stream:X.body,schema:$})}},M6=($)=>async({response:X,url:Y,requestBodyValues:W})=>{let J=await X.text(),U=await d4({text:J,schema:$}),H=SX(X);if(!U.success)throw new R6({message:"Invalid JSON response",cause:U.error,statusCode:X.status,responseHeaders:H,responseBody:J,url:Y,requestBodyValues:W});return{responseHeaders:H,value:U.value,rawValue:U.rawValue}},ub=()=>async({response:$,url:X,requestBodyValues:Y})=>{let W=SX($);if(!$.body)throw new R6({message:"Response body is empty",url:X,requestBodyValues:Y,statusCode:$.status,responseHeaders:W,responseBody:void 0});try{let J=await $.arrayBuffer();return{responseHeaders:W,value:new Uint8Array(J)}}catch(J){throw new R6({message:"Failed to read response as array buffer",url:X,requestBodyValues:Y,statusCode:$.status,responseHeaders:W,responseBody:void 0,cause:J})}};var $$=A(()=>{f$();f$();f$();f$();f$();f$();f$();f$();I$();NG();NG();NG();Mb();f$();f$();f$();({btoa:D0$,atob:V0$}=globalThis);Cb=`vercel.ai.error.${Tb}`,K0$=Symbol.for(Cb),t4=class extends(Lb=A$,Rb=K0$,Lb){constructor({url:$,statusCode:X,statusText:Y,cause:W,message:J=W==null?`Failed to download ${$}: ${X} ${Y}`:`Failed to download ${$}: ${W}`}){super({name:Tb,message:J,cause:W});this[Rb]=!0,this.url=$,this.statusCode=X,this.statusText=Y}static isInstance($){return A$.hasMarker($,Cb)}};x6=p0();F0$=["fetch failed","failed to fetch"],q0$=["ConnectionRefused","ConnectionClosed","FailedToOpenSocket","ECONNRESET","ECONNREFUSED","ETIMEDOUT","EPIPE"];O0$=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,N0$=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;B0$=Symbol("Let zodToJsonSchema decide on which parser to use"),Pb={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};q0={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(ZZ===void 0)ZZ=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return ZZ},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};x0$=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");NZ={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};AZ=Symbol.for("vercel.ai.schema")});var TZ=X$((Hg$,lb)=>{var{defineProperty:_Z,getOwnPropertyDescriptor:w8$,getOwnPropertyNames:Z8$}=Object,z8$=Object.prototype.hasOwnProperty,O8$=($,X)=>{for(var Y in X)_Z($,Y,{get:X[Y],enumerable:!0})},N8$=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of Z8$(X))if(!z8$.call($,J)&&J!==Y)_Z($,J,{get:()=>X[J],enumerable:!(W=w8$(X,J))||W.enumerable})}return $},A8$=($)=>N8$(_Z({},"__esModule",{value:!0}),$),cb={};O8$(cb,{SYMBOL_FOR_REQ_CONTEXT:()=>db,getContext:()=>B8$});lb.exports=A8$(cb);var db=Symbol.for("@vercel/request-context");function B8$(){return globalThis[db]?.get?.()??{}}});var EJ=X$((Dg$,nb)=>{var{defineProperty:CZ,getOwnPropertyDescriptor:M8$,getOwnPropertyNames:j8$}=Object,R8$=Object.prototype.hasOwnProperty,L8$=($,X)=>{for(var Y in X)CZ($,Y,{get:X[Y],enumerable:!0})},E8$=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of j8$(X))if(!R8$.call($,J)&&J!==Y)CZ($,J,{get:()=>X[J],enumerable:!(W=M8$(X,J))||W.enumerable})}return $},P8$=($)=>E8$(CZ({},"__esModule",{value:!0}),$),ib={};L8$(ib,{VercelOidcTokenError:()=>rb});nb.exports=P8$(ib);class rb extends Error{constructor($,X){super($);this.name="VercelOidcTokenError",this.cause=X}toString(){if(this.cause)return`${this.name}: ${this.message}: ${this.cause}`;return`${this.name}: ${this.message}`}}});var tb=X$((Vg$,sb)=>{var{create:I8$,defineProperty:EG,getOwnPropertyDescriptor:_8$,getOwnPropertyNames:T8$,getPrototypeOf:C8$}=Object,S8$=Object.prototype.hasOwnProperty,b8$=($,X)=>{for(var Y in X)EG($,Y,{get:X[Y],enumerable:!0})},ob=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of T8$(X))if(!S8$.call($,J)&&J!==Y)EG($,J,{get:()=>X[J],enumerable:!(W=_8$(X,J))||W.enumerable})}return $},bZ=($,X,Y)=>(Y=$!=null?I8$(C8$($)):{},ob(X||!$||!$.__esModule?EG(Y,"default",{value:$,enumerable:!0}):Y,$)),x8$=($)=>ob(EG({},"__esModule",{value:!0}),$),ab={};b8$(ab,{findRootDir:()=>h8$,getUserDataDir:()=>y8$});sb.exports=x8$(ab);var PJ=bZ(I4("path")),k8$=bZ(I4("fs")),SZ=bZ(I4("os")),v8$=EJ();function h8$(){try{let $=process.cwd();while($!==PJ.default.dirname($)){let X=PJ.default.join($,".vercel");if(k8$.default.existsSync(X))return $;$=PJ.default.dirname($)}}catch($){throw new v8$.VercelOidcTokenError("Token refresh only supported in node server environments")}return null}function y8$(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(SZ.default.platform()){case"darwin":return PJ.default.join(SZ.default.homedir(),"Library/Application Support");case"linux":return PJ.default.join(SZ.default.homedir(),".local/share");case"win32":if(process.env.LOCALAPPDATA)return process.env.LOCALAPPDATA;return null;default:return null}}});var Ux=X$((Kg$,Wx)=>{var{create:f8$,defineProperty:PG,getOwnPropertyDescriptor:g8$,getOwnPropertyNames:m8$,getPrototypeOf:u8$}=Object,p8$=Object.prototype.hasOwnProperty,c8$=($,X)=>{for(var Y in X)PG($,Y,{get:X[Y],enumerable:!0})},eb=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of m8$(X))if(!p8$.call($,J)&&J!==Y)PG($,J,{get:()=>X[J],enumerable:!(W=g8$(X,J))||W.enumerable})}return $},$x=($,X,Y)=>(Y=$!=null?f8$(u8$($)):{},eb(X||!$||!$.__esModule?PG(Y,"default",{value:$,enumerable:!0}):Y,$)),d8$=($)=>eb(PG({},"__esModule",{value:!0}),$),Xx={};c8$(Xx,{isValidAccessToken:()=>n8$,readAuthConfig:()=>i8$,writeAuthConfig:()=>r8$});Wx.exports=d8$(Xx);var IJ=$x(I4("fs")),Yx=$x(I4("path")),l8$=IG();function Jx(){let $=(0,l8$.getVercelDataDir)();if(!$)throw Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);return Yx.join($,"auth.json")}function i8$(){try{let $=Jx();if(!IJ.existsSync($))return null;let X=IJ.readFileSync($,"utf8");if(!X)return null;return JSON.parse(X)}catch($){return null}}function r8$($){let X=Jx(),Y=Yx.dirname(X);if(!IJ.existsSync(Y))IJ.mkdirSync(Y,{mode:504,recursive:!0});IJ.writeFileSync(X,JSON.stringify($,null,2),{mode:384})}function n8$($){if(!$.token)return!1;if(typeof $.expiresAt!=="number")return!0;let X=Math.floor(Date.now()/1000);return $.expiresAt>=X}});var Vx=X$((Qg$,Dx)=>{var{defineProperty:vZ,getOwnPropertyDescriptor:o8$,getOwnPropertyNames:a8$}=Object,s8$=Object.prototype.hasOwnProperty,t8$=($,X)=>{for(var Y in X)vZ($,Y,{get:X[Y],enumerable:!0})},e8$=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of a8$(X))if(!s8$.call($,J)&&J!==Y)vZ($,J,{get:()=>X[J],enumerable:!(W=o8$(X,J))||W.enumerable})}return $},$9$=($)=>e8$(vZ({},"__esModule",{value:!0}),$),Gx={};t8$(Gx,{processTokenResponse:()=>U9$,refreshTokenRequest:()=>W9$});Dx.exports=$9$(Gx);var xZ=I4("os"),X9$="https://vercel.com",Y9$="cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp",Hx=`@vercel/oidc node-${process.version} ${(0,xZ.platform)()} (${(0,xZ.arch)()}) ${(0,xZ.hostname)()}`,kZ=null;async function J9$(){if(kZ)return kZ;let $=`${X9$}/.well-known/openid-configuration`,X=await fetch($,{headers:{"user-agent":Hx}});if(!X.ok)throw Error("Failed to discover OAuth endpoints");let Y=await X.json();if(!Y||typeof Y.token_endpoint!=="string")throw Error("Invalid OAuth discovery response");let W=Y.token_endpoint;return kZ=W,W}async function W9$($){let X=await J9$();return await fetch(X,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":Hx},body:new URLSearchParams({client_id:Y9$,grant_type:"refresh_token",...$})})}async function U9$($){let X=await $.json();if(!$.ok){let Y=typeof X==="object"&&X&&"error"in X?String(X.error):"Token refresh failed";return[Error(Y)]}if(typeof X!=="object"||X===null)return[Error("Invalid token response")];if(typeof X.access_token!=="string")return[Error("Missing access_token in response")];if(X.token_type!=="Bearer")return[Error("Invalid token_type in response")];if(typeof X.expires_in!=="number")return[Error("Missing expires_in in response")];return[null,X]}});var IG=X$((Fg$,wx)=>{var{create:G9$,defineProperty:_G,getOwnPropertyDescriptor:H9$,getOwnPropertyNames:D9$,getPrototypeOf:V9$}=Object,K9$=Object.prototype.hasOwnProperty,Q9$=($,X)=>{for(var Y in X)_G($,Y,{get:X[Y],enumerable:!0})},Qx=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of D9$(X))if(!K9$.call($,J)&&J!==Y)_G($,J,{get:()=>X[J],enumerable:!(W=H9$(X,J))||W.enumerable})}return $},Fx=($,X,Y)=>(Y=$!=null?G9$(V9$($)):{},Qx(X||!$||!$.__esModule?_G(Y,"default",{value:$,enumerable:!0}):Y,$)),F9$=($)=>Qx(_G({},"__esModule",{value:!0}),$),qx={};Q9$(qx,{assertVercelOidcTokenResponse:()=>hZ,findProjectInfo:()=>z9$,getTokenPayload:()=>A9$,getVercelCliToken:()=>w9$,getVercelDataDir:()=>q9$,getVercelOidcToken:()=>Z9$,isExpired:()=>B9$,loadToken:()=>N9$,saveToken:()=>O9$});wx.exports=F9$(qx);var _J=Fx(I4("path")),o9=Fx(I4("fs")),vX=EJ(),TG=tb(),kX=Ux(),Kx=Vx();function q9$(){let X=(0,TG.getUserDataDir)();if(!X)return null;return _J.join(X,"com.vercel.cli")}async function w9$(){let $=(0,kX.readAuthConfig)();if(!$)return null;if((0,kX.isValidAccessToken)($))return $.token||null;if(!$.refreshToken)return(0,kX.writeAuthConfig)({}),null;try{let X=await(0,Kx.refreshTokenRequest)({refresh_token:$.refreshToken}),[Y,W]=await(0,Kx.processTokenResponse)(X);if(Y||!W)return(0,kX.writeAuthConfig)({}),null;let J={token:W.access_token,expiresAt:Math.floor(Date.now()/1000)+W.expires_in};if(W.refresh_token)J.refreshToken=W.refresh_token;return(0,kX.writeAuthConfig)(J),J.token??null}catch(X){return(0,kX.writeAuthConfig)({}),null}}async function Z9$($,X,Y){let W=`https://api.vercel.com/v1/projects/${X}/token?source=vercel-oidc-refresh${Y?`&teamId=${Y}`:""}`,J=await fetch(W,{method:"POST",headers:{Authorization:`Bearer ${$}`}});if(!J.ok)throw new vX.VercelOidcTokenError(`Failed to refresh OIDC token: ${J.statusText}`);let U=await J.json();return hZ(U),U}function hZ($){if(!$||typeof $!=="object")throw TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");if(!("token"in $)||typeof $.token!=="string")throw TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again")}function z9$(){let $=(0,TG.findRootDir)();if(!$)throw new vX.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");let X=_J.join($,".vercel","project.json");if(!o9.existsSync(X))throw new vX.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");let Y=JSON.parse(o9.readFileSync(X,"utf8"));if(typeof Y.projectId!=="string"&&typeof Y.orgId!=="string")throw TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");return{projectId:Y.projectId,teamId:Y.orgId}}function O9$($,X){let Y=(0,TG.getUserDataDir)();if(!Y)throw new vX.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");let W=_J.join(Y,"com.vercel.token",`${X}.json`),J=JSON.stringify($);o9.mkdirSync(_J.dirname(W),{mode:504,recursive:!0}),o9.writeFileSync(W,J),o9.chmodSync(W,432);return}function N9$($){let X=(0,TG.getUserDataDir)();if(!X)throw new vX.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");let Y=_J.join(X,"com.vercel.token",`${$}.json`);if(!o9.existsSync(Y))return null;let W=JSON.parse(o9.readFileSync(Y,"utf8"));return hZ(W),W}function A9$($){let X=$.split(".");if(X.length!==3)throw new vX.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");let Y=X[1].replace(/-/g,"+").replace(/_/g,"/"),W=Y.padEnd(Y.length+(4-Y.length%4)%4,"=");return JSON.parse(Buffer.from(W,"base64").toString("utf8"))}function B9$($){return $.exp*1000<Date.now()}});var Ox=X$((qg$,zx)=>{var{defineProperty:fZ,getOwnPropertyDescriptor:M9$,getOwnPropertyNames:j9$}=Object,R9$=Object.prototype.hasOwnProperty,L9$=($,X)=>{for(var Y in X)fZ($,Y,{get:X[Y],enumerable:!0})},E9$=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of j9$(X))if(!R9$.call($,J)&&J!==Y)fZ($,J,{get:()=>X[J],enumerable:!(W=M9$(X,J))||W.enumerable})}return $},P9$=($)=>E9$(fZ({},"__esModule",{value:!0}),$),Zx={};L9$(Zx,{refreshToken:()=>I9$});zx.exports=P9$(Zx);var yZ=EJ(),a9=IG();async function I9$(){let{projectId:$,teamId:X}=(0,a9.findProjectInfo)(),Y=(0,a9.loadToken)($);if(!Y||(0,a9.isExpired)((0,a9.getTokenPayload)(Y.token))){let W=await(0,a9.getVercelCliToken)();if(!W)throw new yZ.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");if(!$)throw new yZ.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");if(Y=await(0,a9.getVercelOidcToken)(W,$,X),!Y)throw new yZ.VercelOidcTokenError("Failed to refresh OIDC token");(0,a9.saveToken)(Y,$)}process.env.VERCEL_OIDC_TOKEN=Y.token;return}});var Bx=X$((wg$,Ax)=>{var{defineProperty:mZ,getOwnPropertyDescriptor:_9$,getOwnPropertyNames:T9$}=Object,C9$=Object.prototype.hasOwnProperty,S9$=($,X)=>{for(var Y in X)mZ($,Y,{get:X[Y],enumerable:!0})},b9$=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of T9$(X))if(!C9$.call($,J)&&J!==Y)mZ($,J,{get:()=>X[J],enumerable:!(W=_9$(X,J))||W.enumerable})}return $},x9$=($)=>b9$(mZ({},"__esModule",{value:!0}),$),Nx={};S9$(Nx,{getVercelOidcToken:()=>h9$,getVercelOidcTokenSync:()=>gZ});Ax.exports=x9$(Nx);var k9$=TZ(),v9$=EJ();async function h9$(){let $="",X;try{$=gZ()}catch(Y){X=Y}try{let[{getTokenPayload:Y,isExpired:W},{refreshToken:J}]=await Promise.all([await Promise.resolve().then(() => n1(IG())),await Promise.resolve().then(() => n1(Ox()))]);if(!$||W(Y($)))await J(),$=gZ()}catch(Y){let W=X instanceof Error?X.message:"";if(Y instanceof Error)W=`${W}
259
- ${Y.message}`;if(W)throw new v9$.VercelOidcTokenError(W);throw Y}return $}function gZ(){let $=(0,k9$.getContext)().headers?.["x-vercel-oidc-token"]??process.env.VERCEL_OIDC_TOKEN;if(!$)throw Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return $}});var pZ=X$((Zg$,Rx)=>{var{defineProperty:uZ,getOwnPropertyDescriptor:y9$,getOwnPropertyNames:f9$}=Object,g9$=Object.prototype.hasOwnProperty,m9$=($,X)=>{for(var Y in X)uZ($,Y,{get:X[Y],enumerable:!0})},u9$=($,X,Y,W)=>{if(X&&typeof X==="object"||typeof X==="function"){for(let J of f9$(X))if(!g9$.call($,J)&&J!==Y)uZ($,J,{get:()=>X[J],enumerable:!(W=y9$(X,J))||W.enumerable})}return $},p9$=($)=>u9$(uZ({},"__esModule",{value:!0}),$),jx={};m9$(jx,{getContext:()=>c9$.getContext,getVercelOidcToken:()=>Mx.getVercelOidcToken,getVercelOidcTokenSync:()=>Mx.getVercelOidcTokenSync});Rx.exports=p9$(jx);var Mx=Bx(),c9$=TZ()});async function lx({response:$,statusCode:X,defaultMessage:Y="Gateway request failed",cause:W,authMethod:J}){var U;let H=await F4({value:$,schema:Y5$});if(!H.success){let q=typeof $==="object"&&$!==null&&"generationId"in $?$.generationId:void 0;return new X5$({message:`Invalid error response format: ${Y}`,statusCode:X,response:$,validationError:H.error,cause:W,generationId:q})}let D=H.value,V=D.error.type,K=D.error.message,Q=(U=D.generationId)!=null?U:void 0;switch(V){case"authentication_error":return CG.createContextualError({apiKeyProvided:J==="api-key",oidcTokenProvided:J==="oidc",statusCode:X,cause:W,generationId:Q});case"invalid_request_error":return new r9$({message:K,statusCode:X,cause:W,generationId:Q});case"rate_limit_exceeded":return new o9$({message:K,statusCode:X,cause:W,generationId:Q});case"model_not_found":{let q=await F4({value:D.error.param,schema:s9$});return new t9$({message:K,statusCode:X,modelId:q.success?q.value.modelId:void 0,cause:W,generationId:Q})}case"internal_server_error":return new ux({message:K,statusCode:X,cause:W,generationId:Q});default:return new ux({message:K,statusCode:X,cause:W,generationId:Q})}}function ax($){if(!($ instanceof Error))return!1;let X=$.code;if(typeof X==="string")return["UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT"].includes(X);return!1}async function M8($,X){var Y;if(e4.isInstance($))return $;if(ax($))return ox.createTimeoutError({originalMessage:$ instanceof Error?$.message:"Unknown error",cause:$});if(R6.isInstance($)){if($.cause&&ax($.cause))return ox.createTimeoutError({originalMessage:$.message,cause:$});return await lx({response:W5$($),statusCode:(Y=$.statusCode)!=null?Y:500,defaultMessage:"Gateway request failed",cause:$,authMethod:X})}return await lx({response:{},statusCode:500,defaultMessage:$ instanceof Error?`Gateway request failed: ${$.message}`:"Unknown Gateway error",cause:$,authMethod:X})}function W5$($){if($.data!==void 0)return $.data;if($.responseBody!=null)try{return JSON.parse($.responseBody)}catch(X){return $.responseBody}return{}}async function s9($){let X=await F4({value:$[Gk],schema:U5$});return X.success?X.value:void 0}function tx($){if($.type==="file"&&$.data instanceof Uint8Array)return{...$,data:p1($.data)};return $}function O5$($){if($.type==="file"&&$.data instanceof Uint8Array)return{...$,data:p1($.data)};return $}async function S5$(){var $;return($=Hk.getContext().headers)==null?void 0:$["x-vercel-id"]}function k5$($={}){var X,Y;let W=null,J=null,U=(X=$.metadataCacheRefreshMillis)!=null?X:300000,H=0,D=(Y=X9($.baseURL))!=null?Y:"https://ai-gateway.vercel.sh/v3/ai",V=async()=>{try{let O=await v5$($);return $4({Authorization:`Bearer ${O.token}`,"ai-gateway-protocol-version":x5$,[Gk]:O.authMethod,...$.headers},`ai-sdk/gateway/${b5$}`)}catch(O){throw CG.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:O})}},K=()=>{let O=c0({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),N=c0({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),L=c0({settingValue:void 0,environmentVariableName:"VERCEL_REGION"}),P=c0({settingValue:void 0,environmentVariableName:"VERCEL_PROJECT_ID"});return async()=>{let j=await S5$();return{...O&&{"ai-o11y-deployment-id":O},...N&&{"ai-o11y-environment":N},...L&&{"ai-o11y-region":L},...j&&{"ai-o11y-request-id":j},...P&&{"ai-o11y-project-id":P}}}},Q=(O)=>{return new D5$(O,{provider:"gateway",baseURL:D,headers:V,fetch:$.fetch,o11yHeaders:K()})},q=async()=>{var O,N,L;let P=(L=(N=(O=$._internal)==null?void 0:O.currentDate)==null?void 0:N.call(O).getTime())!=null?L:Date.now();if(!W||P-H>U)H=P,W=new sx({baseURL:D,headers:V,fetch:$.fetch}).getAvailableModels().then((j)=>{return J=j,j}).catch(async(j)=>{throw await M8(j,await s9(await V()))});return J?Promise.resolve(J):W},F=async()=>{return new sx({baseURL:D,headers:V,fetch:$.fetch}).getCredits().catch(async(O)=>{throw await M8(O,await s9(await V()))})},w=function(O){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return Q(O)};w.specificationVersion="v3",w.getAvailableModels=q,w.getCredits=F,w.imageModel=(O)=>{return new Q5$(O,{provider:"gateway",baseURL:D,headers:V,fetch:$.fetch,o11yHeaders:K()})},w.languageModel=Q;let z=(O)=>{return new V5$(O,{provider:"gateway",baseURL:D,headers:V,fetch:$.fetch,o11yHeaders:K()})};return w.embeddingModel=z,w.textEmbeddingModel=z,w.videoModel=(O)=>{return new z5$(O,{provider:"gateway",baseURL:D,headers:V,fetch:$.fetch,o11yHeaders:K()})},w.chat=w.languageModel,w.embedding=w.embeddingModel,w.image=w.imageModel,w.video=w.videoModel,w.tools=C5$,w}async function v5$($){let X=c0({settingValue:$.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(X)return{token:X,authMethod:"api-key"};return{token:await Dk.getVercelOidcToken(),authMethod:"oidc"}}var Hk,Dk,d9$="vercel.ai.gateway.error",cZ,Lx,Ex,e4,ex="GatewayAuthenticationError",l9$,Px,Ix,_x,CG,$k="GatewayInvalidRequestError",i9$,Tx,Cx,Sx,r9$,Xk="GatewayRateLimitError",n9$,bx,xx,kx,o9$,Yk="GatewayModelNotFoundError",a9$,vx,s9$,hx,yx,t9$,Jk="GatewayInternalServerError",e9$,fx,gx,mx,ux,Wk="GatewayResponseError",$5$,px,cx,dx,X5$,Y5$,Uk="GatewayTimeoutError",J5$,ix,rx,nx,ox,Gk="ai-gateway-auth-method",U5$,sx=class{constructor($){this.config=$}async getAvailableModels(){try{let{value:$}=await jJ({url:`${this.config.baseURL}/config`,headers:await B6(this.config.headers()),successfulResponseHandler:M6(G5$),failedResponseHandler:E4({errorSchema:G.any(),errorToMessage:(X)=>X}),fetch:this.config.fetch});return $}catch($){throw await M8($)}}async getCredits(){try{let $=new URL(this.config.baseURL),{value:X}=await jJ({url:`${$.origin}/v1/credits`,headers:await B6(this.config.headers()),successfulResponseHandler:M6(H5$),failedResponseHandler:E4({errorSchema:G.any(),errorToMessage:(Y)=>Y}),fetch:this.config.fetch});return X}catch($){throw await M8($)}}},G5$,H5$,D5$=class{constructor($,X){this.modelId=$,this.config=X,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs($){let{abortSignal:X,...Y}=$;return{args:this.maybeEncodeFileParts(Y),warnings:[]}}async doGenerate($){let{args:X,warnings:Y}=await this.getArgs($),{abortSignal:W}=$,J=await B6(this.config.headers());try{let{responseHeaders:U,value:H,rawValue:D}=await q6({url:this.getUrl(),headers:V6(J,$.headers,this.getModelConfigHeaders(this.modelId,!1),await B6(this.config.o11yHeaders)),body:X,successfulResponseHandler:M6(G.any()),failedResponseHandler:E4({errorSchema:G.any(),errorToMessage:(V)=>V}),...W&&{abortSignal:W},fetch:this.config.fetch});return{...H,request:{body:X},response:{headers:U,body:D},warnings:Y}}catch(U){throw await M8(U,await s9(J))}}async doStream($){let{args:X,warnings:Y}=await this.getArgs($),{abortSignal:W}=$,J=await B6(this.config.headers());try{let{value:U,responseHeaders:H}=await q6({url:this.getUrl(),headers:V6(J,$.headers,this.getModelConfigHeaders(this.modelId,!0),await B6(this.config.o11yHeaders)),body:X,successfulResponseHandler:c1(G.any()),failedResponseHandler:E4({errorSchema:G.any(),errorToMessage:(D)=>D}),...W&&{abortSignal:W},fetch:this.config.fetch});return{stream:U.pipeThrough(new TransformStream({start(D){if(Y.length>0)D.enqueue({type:"stream-start",warnings:Y})},transform(D,V){if(D.success){let K=D.value;if(K.type==="raw"&&!$.includeRawChunks)return;if(K.type==="response-metadata"&&K.timestamp&&typeof K.timestamp==="string")K.timestamp=new Date(K.timestamp);V.enqueue(K)}else V.error(D.error)}})),request:{body:X},response:{headers:H}}}catch(U){throw await M8(U,await s9(J))}}isFilePart($){return $&&typeof $==="object"&&"type"in $&&$.type==="file"}maybeEncodeFileParts($){for(let X of $.prompt)for(let Y of X.content)if(this.isFilePart(Y)){let W=Y;if(W.data instanceof Uint8Array){let J=Uint8Array.from(W.data),U=Buffer.from(J).toString("base64");W.data=new URL(`data:${W.mediaType||"application/octet-stream"};base64,${U}`)}}return $}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders($,X){return{"ai-language-model-specification-version":"3","ai-language-model-id":$,"ai-language-model-streaming":String(X)}}},V5$=class{constructor($,X){this.modelId=$,this.config=X,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:$,headers:X,abortSignal:Y,providerOptions:W}){var J;let U=await B6(this.config.headers());try{let{responseHeaders:H,value:D,rawValue:V}=await q6({url:this.getUrl(),headers:V6(U,X!=null?X:{},this.getModelConfigHeaders(),await B6(this.config.o11yHeaders)),body:{values:$,...W?{providerOptions:W}:{}},successfulResponseHandler:M6(K5$),failedResponseHandler:E4({errorSchema:G.any(),errorToMessage:(K)=>K}),...Y&&{abortSignal:Y},fetch:this.config.fetch});return{embeddings:D.embeddings,usage:(J=D.usage)!=null?J:void 0,providerMetadata:D.providerMetadata,response:{headers:H,body:V},warnings:[]}}catch(H){throw await M8(H,await s9(U))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},K5$,Q5$=class{constructor($,X){this.modelId=$,this.config=X,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:$,n:X,size:Y,aspectRatio:W,seed:J,files:U,mask:H,providerOptions:D,headers:V,abortSignal:K}){var Q,q,F,w;let z=await B6(this.config.headers());try{let{responseHeaders:O,value:N,rawValue:L}=await q6({url:this.getUrl(),headers:V6(z,V!=null?V:{},this.getModelConfigHeaders(),await B6(this.config.o11yHeaders)),body:{prompt:$,n:X,...Y&&{size:Y},...W&&{aspectRatio:W},...J&&{seed:J},...D&&{providerOptions:D},...U&&{files:U.map((P)=>tx(P))},...H&&{mask:tx(H)}},successfulResponseHandler:M6(Z5$),failedResponseHandler:E4({errorSchema:G.any(),errorToMessage:(P)=>P}),...K&&{abortSignal:K},fetch:this.config.fetch});return{images:N.images,warnings:(Q=N.warnings)!=null?Q:[],providerMetadata:N.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:O},...N.usage!=null&&{usage:{inputTokens:(q=N.usage.inputTokens)!=null?q:void 0,outputTokens:(F=N.usage.outputTokens)!=null?F:void 0,totalTokens:(w=N.usage.totalTokens)!=null?w:void 0}}}}catch(O){throw await M8(O,await s9(z))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}},F5$,q5$,w5$,Z5$,z5$=class{constructor($,X){this.modelId=$,this.config=X,this.specificationVersion="v3",this.maxVideosPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:$,n:X,aspectRatio:Y,resolution:W,duration:J,fps:U,seed:H,image:D,providerOptions:V,headers:K,abortSignal:Q}){var q;let F=await B6(this.config.headers());try{let{responseHeaders:w,value:z}=await q6({url:this.getUrl(),headers:V6(F,K!=null?K:{},this.getModelConfigHeaders(),await B6(this.config.o11yHeaders),{accept:"text/event-stream"}),body:{prompt:$,n:X,...Y&&{aspectRatio:Y},...W&&{resolution:W},...J&&{duration:J},...U&&{fps:U},...H&&{seed:H},...V&&{providerOptions:V},...D&&{image:O5$(D)}},successfulResponseHandler:async({response:O,url:N,requestBodyValues:L})=>{if(O.body==null)throw new R6({message:"SSE response body is empty",url:N,requestBodyValues:L,statusCode:O.status});let j=RG({stream:O.body,schema:M5$}).getReader(),{done:v,value:y}=await j.read();if(j.releaseLock(),v||!y)throw new R6({message:"SSE stream ended without a data event",url:N,requestBodyValues:L,statusCode:O.status});if(!y.success)throw new R6({message:"Failed to parse video SSE event",cause:y.error,url:N,requestBodyValues:L,statusCode:O.status});let E=y.value;if(E.type==="error")throw new R6({message:E.message,statusCode:E.statusCode,url:N,requestBodyValues:L,responseHeaders:Object.fromEntries([...O.headers]),responseBody:JSON.stringify(E),data:{error:{message:E.message,type:E.errorType,param:E.param}}});return{value:{videos:E.videos,warnings:E.warnings,providerMetadata:E.providerMetadata},responseHeaders:Object.fromEntries([...O.headers])}},failedResponseHandler:E4({errorSchema:G.any(),errorToMessage:(O)=>O}),...Q&&{abortSignal:Q},fetch:this.config.fetch});return{videos:z.videos,warnings:(q=z.warnings)!=null?q:[],providerMetadata:z.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:w}}}catch(w){throw await M8(w,await s9(F))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":"3","ai-model-id":this.modelId}}},N5$,A5$,B5$,M5$,j5$,R5$,L5$,E5$=($={})=>L5$($),P5$,I5$,_5$,T5$=($={})=>_5$($),C5$,b5$="3.0.66",x5$="0.0.1",Vk;var dZ=A(()=>{$$();f$();I$();I$();$$();$$();I$();$$();$$();I$();$$();I$();$$();I$();$$();I$();f$();$$();I$();$$();P5();$$();P5();$$();Hk=n1(pZ(),1),Dk=n1(pZ(),1),cZ=Symbol.for(d9$),e4=class $ extends(Ex=Error,Lx=cZ,Ex){constructor({message:X,statusCode:Y=500,cause:W,generationId:J}){super(J?`${X} [${J}]`:X);this[Lx]=!0,this.statusCode=Y,this.cause=W,this.generationId=J}static isInstance(X){return $.hasMarker(X)}static hasMarker(X){return typeof X==="object"&&X!==null&&cZ in X&&X[cZ]===!0}},l9$=`vercel.ai.gateway.error.${ex}`,Px=Symbol.for(l9$),CG=class $ extends(_x=e4,Ix=Px,_x){constructor({message:X="Authentication failed",statusCode:Y=401,cause:W,generationId:J}={}){super({message:X,statusCode:Y,cause:W,generationId:J});this[Ix]=!0,this.name=ex,this.type="authentication_error"}static isInstance(X){return e4.hasMarker(X)&&Px in X}static createContextualError({apiKeyProvided:X,oidcTokenProvided:Y,message:W="Authentication failed",statusCode:J=401,cause:U,generationId:H}){let D;if(X)D=`AI Gateway authentication failed: Invalid API key.
260
-
261
- Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
262
-
263
- Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`;else if(Y)D=`AI Gateway authentication failed: Invalid OIDC token.
264
-
265
- Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
266
-
267
- Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`;else D=`AI Gateway authentication failed: No authentication provided.
268
-
269
- Option 1 - API key:
270
- Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
271
- Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
272
-
273
- Option 2 - OIDC token:
274
- Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`;return new $({message:D,statusCode:J,cause:U,generationId:H})}},i9$=`vercel.ai.gateway.error.${$k}`,Tx=Symbol.for(i9$),r9$=class extends(Sx=e4,Cx=Tx,Sx){constructor({message:$="Invalid request",statusCode:X=400,cause:Y,generationId:W}={}){super({message:$,statusCode:X,cause:Y,generationId:W});this[Cx]=!0,this.name=$k,this.type="invalid_request_error"}static isInstance($){return e4.hasMarker($)&&Tx in $}},n9$=`vercel.ai.gateway.error.${Xk}`,bx=Symbol.for(n9$),o9$=class extends(kx=e4,xx=bx,kx){constructor({message:$="Rate limit exceeded",statusCode:X=429,cause:Y,generationId:W}={}){super({message:$,statusCode:X,cause:Y,generationId:W});this[xx]=!0,this.name=Xk,this.type="rate_limit_exceeded"}static isInstance($){return e4.hasMarker($)&&bx in $}},a9$=`vercel.ai.gateway.error.${Yk}`,vx=Symbol.for(a9$),s9$=p(()=>u(G.object({modelId:G.string()}))),t9$=class extends(yx=e4,hx=vx,yx){constructor({message:$="Model not found",statusCode:X=404,modelId:Y,cause:W,generationId:J}={}){super({message:$,statusCode:X,cause:W,generationId:J});this[hx]=!0,this.name=Yk,this.type="model_not_found",this.modelId=Y}static isInstance($){return e4.hasMarker($)&&vx in $}},e9$=`vercel.ai.gateway.error.${Jk}`,fx=Symbol.for(e9$),ux=class extends(mx=e4,gx=fx,mx){constructor({message:$="Internal server error",statusCode:X=500,cause:Y,generationId:W}={}){super({message:$,statusCode:X,cause:Y,generationId:W});this[gx]=!0,this.name=Jk,this.type="internal_server_error"}static isInstance($){return e4.hasMarker($)&&fx in $}},$5$=`vercel.ai.gateway.error.${Wk}`,px=Symbol.for($5$),X5$=class extends(dx=e4,cx=px,dx){constructor({message:$="Invalid response from Gateway",statusCode:X=502,response:Y,validationError:W,cause:J,generationId:U}={}){super({message:$,statusCode:X,cause:J,generationId:U});this[cx]=!0,this.name=Wk,this.type="response_error",this.response=Y,this.validationError=W}static isInstance($){return e4.hasMarker($)&&px in $}};Y5$=p(()=>u(G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.unknown().nullish(),code:G.union([G.string(),G.number()]).nullish()}),generationId:G.string().nullish()}))),J5$=`vercel.ai.gateway.error.${Uk}`,ix=Symbol.for(J5$),ox=class $ extends(nx=e4,rx=ix,nx){constructor({message:X="Request timed out",statusCode:Y=408,cause:W,generationId:J}={}){super({message:X,statusCode:Y,cause:W,generationId:J});this[rx]=!0,this.name=Uk,this.type="timeout_error"}static isInstance(X){return e4.hasMarker(X)&&ix in X}static createTimeoutError({originalMessage:X,statusCode:Y=408,cause:W,generationId:J}){let U=`Gateway request timed out: ${X}
275
-
276
- This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`;return new $({message:U,statusCode:Y,cause:W,generationId:J})}};U5$=p(()=>u(G.union([G.literal("api-key"),G.literal("oidc")]))),G5$=p(()=>u(G.object({models:G.array(G.object({id:G.string(),name:G.string(),description:G.string().nullish(),pricing:G.object({input:G.string(),output:G.string(),input_cache_read:G.string().nullish(),input_cache_write:G.string().nullish()}).transform(({input:$,output:X,input_cache_read:Y,input_cache_write:W})=>({input:$,output:X,...Y?{cachedInputTokens:Y}:{},...W?{cacheCreationInputTokens:W}:{}})).nullish(),specification:G.object({specificationVersion:G.literal("v3"),provider:G.string(),modelId:G.string()}),modelType:G.enum(["embedding","image","language","video"]).nullish()}))}))),H5$=p(()=>u(G.object({balance:G.string(),total_used:G.string()}).transform(({balance:$,total_used:X})=>({balance:$,totalUsed:X})))),K5$=p(()=>u(G.object({embeddings:G.array(G.array(G.number())),usage:G.object({tokens:G.number()}).nullish(),providerMetadata:G.record(G.string(),G.record(G.string(),G.unknown())).optional()})));F5$=G.object({images:G.array(G.unknown()).optional()}).catchall(G.unknown()),q5$=G.discriminatedUnion("type",[G.object({type:G.literal("unsupported"),feature:G.string(),details:G.string().optional()}),G.object({type:G.literal("compatibility"),feature:G.string(),details:G.string().optional()}),G.object({type:G.literal("other"),message:G.string()})]),w5$=G.object({inputTokens:G.number().nullish(),outputTokens:G.number().nullish(),totalTokens:G.number().nullish()}),Z5$=G.object({images:G.array(G.string()),warnings:G.array(q5$).optional(),providerMetadata:G.record(G.string(),F5$).optional(),usage:w5$.optional()});N5$=G.object({videos:G.array(G.unknown()).optional()}).catchall(G.unknown()),A5$=G.union([G.object({type:G.literal("url"),url:G.string(),mediaType:G.string()}),G.object({type:G.literal("base64"),data:G.string(),mediaType:G.string()})]),B5$=G.discriminatedUnion("type",[G.object({type:G.literal("unsupported"),feature:G.string(),details:G.string().optional()}),G.object({type:G.literal("compatibility"),feature:G.string(),details:G.string().optional()}),G.object({type:G.literal("other"),message:G.string()})]),M5$=G.discriminatedUnion("type",[G.object({type:G.literal("result"),videos:G.array(A5$),warnings:G.array(B5$).optional(),providerMetadata:G.record(G.string(),N5$).optional()}),G.object({type:G.literal("error"),message:G.string(),errorType:G.string(),statusCode:G.number(),param:G.unknown().nullable()})]),j5$=p(()=>u(Z.object({objective:Z.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),search_queries:Z.array(Z.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),mode:Z.enum(["one-shot","agentic"]).optional().describe('Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'),max_results:Z.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),source_policy:Z.object({include_domains:Z.array(Z.string()).optional().describe("List of domains to include in search results."),exclude_domains:Z.array(Z.string()).optional().describe("List of domains to exclude from search results."),after_date:Z.string().optional().describe("Only include results published after this date (ISO 8601 format).")}).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),excerpts:Z.object({max_chars_per_result:Z.number().optional().describe("Maximum characters per result."),max_chars_total:Z.number().optional().describe("Maximum total characters across all results.")}).optional().describe("Excerpt configuration for controlling result length."),fetch_policy:Z.object({max_age_seconds:Z.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.")}).optional().describe("Fetch policy for controlling content freshness.")}))),R5$=p(()=>u(Z.union([Z.object({searchId:Z.string(),results:Z.array(Z.object({url:Z.string(),title:Z.string(),excerpt:Z.string(),publishDate:Z.string().nullable().optional(),relevanceScore:Z.number().optional()}))}),Z.object({error:Z.enum(["api_error","rate_limit","timeout","invalid_input","configuration_error","unknown"]),statusCode:Z.number().optional(),message:Z.string()})]))),L5$=J6({id:"gateway.parallel_search",inputSchema:j5$,outputSchema:R5$}),P5$=p(()=>u(Z.object({query:Z.union([Z.string(),Z.array(Z.string())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:Z.number().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:Z.number().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:Z.number().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:Z.string().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:Z.array(Z.string()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:Z.array(Z.string()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:Z.string().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:Z.string().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:Z.string().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:Z.string().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:Z.enum(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")}))),I5$=p(()=>u(Z.union([Z.object({results:Z.array(Z.object({title:Z.string(),url:Z.string(),snippet:Z.string(),date:Z.string().optional(),lastUpdated:Z.string().optional()})),id:Z.string()}),Z.object({error:Z.enum(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:Z.number().optional(),message:Z.string()})]))),_5$=J6({id:"gateway.perplexity_search",inputSchema:P5$,outputSchema:I5$}),C5$={parallelSearch:E5$,perplexitySearch:T5$};Vk=k5$()});var Fk=X$((Kk)=>{Object.defineProperty(Kk,"__esModule",{value:!0});Kk._globalThis=void 0;Kk._globalThis=typeof globalThis==="object"?globalThis:global});var qk=X$((t9)=>{var h5$=t9&&t9.__createBinding||(Object.create?function($,X,Y,W){if(W===void 0)W=Y;Object.defineProperty($,W,{enumerable:!0,get:function(){return X[Y]}})}:function($,X,Y,W){if(W===void 0)W=Y;$[W]=X[Y]}),y5$=t9&&t9.__exportStar||function($,X){for(var Y in $)if(Y!=="default"&&!Object.prototype.hasOwnProperty.call(X,Y))h5$(X,$,Y)};Object.defineProperty(t9,"__esModule",{value:!0});y5$(Fk(),t9)});var wk=X$((e9)=>{var f5$=e9&&e9.__createBinding||(Object.create?function($,X,Y,W){if(W===void 0)W=Y;Object.defineProperty($,W,{enumerable:!0,get:function(){return X[Y]}})}:function($,X,Y,W){if(W===void 0)W=Y;$[W]=X[Y]}),g5$=e9&&e9.__exportStar||function($,X){for(var Y in $)if(Y!=="default"&&!Object.prototype.hasOwnProperty.call(X,Y))f5$(X,$,Y)};Object.defineProperty(e9,"__esModule",{value:!0});g5$(qk(),e9)});var lZ=X$((Zk)=>{Object.defineProperty(Zk,"__esModule",{value:!0});Zk.VERSION=void 0;Zk.VERSION="1.9.0"});var Mk=X$((Ak)=>{Object.defineProperty(Ak,"__esModule",{value:!0});Ak.isCompatible=Ak._makeCompatibilityCheck=void 0;var m5$=lZ(),Ok=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Nk($){let X=new Set([$]),Y=new Set,W=$.match(Ok);if(!W)return()=>!1;let J={major:+W[1],minor:+W[2],patch:+W[3],prerelease:W[4]};if(J.prerelease!=null)return function(V){return V===$};function U(D){return Y.add(D),!1}function H(D){return X.add(D),!0}return function(V){if(X.has(V))return!0;if(Y.has(V))return!1;let K=V.match(Ok);if(!K)return U(V);let Q={major:+K[1],minor:+K[2],patch:+K[3],prerelease:K[4]};if(Q.prerelease!=null)return U(V);if(J.major!==Q.major)return U(V);if(J.major===0){if(J.minor===Q.minor&&J.patch<=Q.patch)return H(V);return U(V)}if(J.minor<=Q.minor)return H(V);return U(V)}}Ak._makeCompatibilityCheck=Nk;Ak.isCompatible=Nk(m5$.VERSION)});var $5=X$((jk)=>{Object.defineProperty(jk,"__esModule",{value:!0});jk.unregisterGlobal=jk.getGlobal=jk.registerGlobal=void 0;var p5$=wk(),hX=lZ(),c5$=Mk(),d5$=hX.VERSION.split(".")[0],TJ=Symbol.for(`opentelemetry.js.api.${d5$}`),CJ=p5$._globalThis;function l5$($,X,Y,W=!1){var J;let U=CJ[TJ]=(J=CJ[TJ])!==null&&J!==void 0?J:{version:hX.VERSION};if(!W&&U[$]){let H=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${$}`);return Y.error(H.stack||H.message),!1}if(U.version!==hX.VERSION){let H=Error(`@opentelemetry/api: Registration of version v${U.version} for ${$} does not match previously registered API v${hX.VERSION}`);return Y.error(H.stack||H.message),!1}return U[$]=X,Y.debug(`@opentelemetry/api: Registered a global for ${$} v${hX.VERSION}.`),!0}jk.registerGlobal=l5$;function i5$($){var X,Y;let W=(X=CJ[TJ])===null||X===void 0?void 0:X.version;if(!W||!(0,c5$.isCompatible)(W))return;return(Y=CJ[TJ])===null||Y===void 0?void 0:Y[$]}jk.getGlobal=i5$;function r5$($,X){X.debug(`@opentelemetry/api: Unregistering a global for ${$} v${hX.VERSION}.`);let Y=CJ[TJ];if(Y)delete Y[$]}jk.unregisterGlobal=r5$});var Ik=X$((Ek)=>{Object.defineProperty(Ek,"__esModule",{value:!0});Ek.DiagComponentLogger=void 0;var a5$=$5();class Lk{constructor($){this._namespace=$.namespace||"DiagComponentLogger"}debug(...$){return SJ("debug",this._namespace,$)}error(...$){return SJ("error",this._namespace,$)}info(...$){return SJ("info",this._namespace,$)}warn(...$){return SJ("warn",this._namespace,$)}verbose(...$){return SJ("verbose",this._namespace,$)}}Ek.DiagComponentLogger=Lk;function SJ($,X,Y){let W=(0,a5$.getGlobal)("diag");if(!W)return;return Y.unshift(X),W[$](...Y)}});var SG=X$((_k)=>{Object.defineProperty(_k,"__esModule",{value:!0});_k.DiagLogLevel=void 0;var s5$;(function($){$[$.NONE=0]="NONE",$[$.ERROR=30]="ERROR",$[$.WARN=50]="WARN",$[$.INFO=60]="INFO",$[$.DEBUG=70]="DEBUG",$[$.VERBOSE=80]="VERBOSE",$[$.ALL=9999]="ALL"})(s5$=_k.DiagLogLevel||(_k.DiagLogLevel={}))});var Sk=X$((Tk)=>{Object.defineProperty(Tk,"__esModule",{value:!0});Tk.createLogLevelDiagLogger=void 0;var j8=SG();function t5$($,X){if($<j8.DiagLogLevel.NONE)$=j8.DiagLogLevel.NONE;else if($>j8.DiagLogLevel.ALL)$=j8.DiagLogLevel.ALL;X=X||{};function Y(W,J){let U=X[W];if(typeof U==="function"&&$>=J)return U.bind(X);return function(){}}return{error:Y("error",j8.DiagLogLevel.ERROR),warn:Y("warn",j8.DiagLogLevel.WARN),info:Y("info",j8.DiagLogLevel.INFO),debug:Y("debug",j8.DiagLogLevel.DEBUG),verbose:Y("verbose",j8.DiagLogLevel.VERBOSE)}}Tk.createLogLevelDiagLogger=t5$});var X5=X$((xk)=>{Object.defineProperty(xk,"__esModule",{value:!0});xk.DiagAPI=void 0;var e5$=Ik(),$X$=Sk(),bk=SG(),bG=$5(),XX$="diag";class rZ{constructor(){function $(W){return function(...J){let U=(0,bG.getGlobal)("diag");if(!U)return;return U[W](...J)}}let X=this,Y=(W,J={logLevel:bk.DiagLogLevel.INFO})=>{var U,H,D;if(W===X){let Q=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return X.error((U=Q.stack)!==null&&U!==void 0?U:Q.message),!1}if(typeof J==="number")J={logLevel:J};let V=(0,bG.getGlobal)("diag"),K=(0,$X$.createLogLevelDiagLogger)((H=J.logLevel)!==null&&H!==void 0?H:bk.DiagLogLevel.INFO,W);if(V&&!J.suppressOverrideMessage){let Q=(D=Error().stack)!==null&&D!==void 0?D:"<failed to generate stacktrace>";V.warn(`Current logger will be overwritten from ${Q}`),K.warn(`Current logger will overwrite one already registered from ${Q}`)}return(0,bG.registerGlobal)("diag",K,X,!0)};X.setLogger=Y,X.disable=()=>{(0,bG.unregisterGlobal)(XX$,X)},X.createComponentLogger=(W)=>{return new e5$.DiagComponentLogger(W)},X.verbose=$("verbose"),X.debug=$("debug"),X.info=$("info"),X.warn=$("warn"),X.error=$("error")}static instance(){if(!this._instance)this._instance=new rZ;return this._instance}}xk.DiagAPI=rZ});var yk=X$((vk)=>{Object.defineProperty(vk,"__esModule",{value:!0});vk.BaggageImpl=void 0;class yX{constructor($){this._entries=$?new Map($):new Map}getEntry($){let X=this._entries.get($);if(!X)return;return Object.assign({},X)}getAllEntries(){return Array.from(this._entries.entries()).map(([$,X])=>[$,X])}setEntry($,X){let Y=new yX(this._entries);return Y._entries.set($,X),Y}removeEntry($){let X=new yX(this._entries);return X._entries.delete($),X}removeEntries(...$){let X=new yX(this._entries);for(let Y of $)X._entries.delete(Y);return X}clear(){return new yX}}vk.BaggageImpl=yX});var mk=X$((fk)=>{Object.defineProperty(fk,"__esModule",{value:!0});fk.baggageEntryMetadataSymbol=void 0;fk.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")});var nZ=X$((uk)=>{Object.defineProperty(uk,"__esModule",{value:!0});uk.baggageEntryMetadataFromString=uk.createBaggage=void 0;var YX$=X5(),JX$=yk(),WX$=mk(),UX$=YX$.DiagAPI.instance();function GX$($={}){return new JX$.BaggageImpl(new Map(Object.entries($)))}uk.createBaggage=GX$;function HX$($){if(typeof $!=="string")UX$.error(`Cannot create baggage metadata from unknown type: ${typeof $}`),$="";return{__TYPE__:WX$.baggageEntryMetadataSymbol,toString(){return $}}}uk.baggageEntryMetadataFromString=HX$});var bJ=X$((ck)=>{Object.defineProperty(ck,"__esModule",{value:!0});ck.ROOT_CONTEXT=ck.createContextKey=void 0;function VX$($){return Symbol.for($)}ck.createContextKey=VX$;class xG{constructor($){let X=this;X._currentContext=$?new Map($):new Map,X.getValue=(Y)=>X._currentContext.get(Y),X.setValue=(Y,W)=>{let J=new xG(X._currentContext);return J._currentContext.set(Y,W),J},X.deleteValue=(Y)=>{let W=new xG(X._currentContext);return W._currentContext.delete(Y),W}}}ck.ROOT_CONTEXT=new xG});var nk=X$((ik)=>{Object.defineProperty(ik,"__esModule",{value:!0});ik.DiagConsoleLogger=void 0;var oZ=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class lk{constructor(){function $(X){return function(...Y){if(console){let W=console[X];if(typeof W!=="function")W=console.log;if(typeof W==="function")return W.apply(console,Y)}}}for(let X=0;X<oZ.length;X++)this[oZ[X].n]=$(oZ[X].c)}}ik.DiagConsoleLogger=lk});var Wz=X$((ok)=>{Object.defineProperty(ok,"__esModule",{value:!0});ok.createNoopMeter=ok.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=ok.NOOP_OBSERVABLE_GAUGE_METRIC=ok.NOOP_OBSERVABLE_COUNTER_METRIC=ok.NOOP_UP_DOWN_COUNTER_METRIC=ok.NOOP_HISTOGRAM_METRIC=ok.NOOP_GAUGE_METRIC=ok.NOOP_COUNTER_METRIC=ok.NOOP_METER=ok.NoopObservableUpDownCounterMetric=ok.NoopObservableGaugeMetric=ok.NoopObservableCounterMetric=ok.NoopObservableMetric=ok.NoopHistogramMetric=ok.NoopGaugeMetric=ok.NoopUpDownCounterMetric=ok.NoopCounterMetric=ok.NoopMetric=ok.NoopMeter=void 0;class aZ{constructor(){}createGauge($,X){return ok.NOOP_GAUGE_METRIC}createHistogram($,X){return ok.NOOP_HISTOGRAM_METRIC}createCounter($,X){return ok.NOOP_COUNTER_METRIC}createUpDownCounter($,X){return ok.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge($,X){return ok.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter($,X){return ok.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter($,X){return ok.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback($,X){}removeBatchObservableCallback($){}}ok.NoopMeter=aZ;class fX{}ok.NoopMetric=fX;class sZ extends fX{add($,X){}}ok.NoopCounterMetric=sZ;class tZ extends fX{add($,X){}}ok.NoopUpDownCounterMetric=tZ;class eZ extends fX{record($,X){}}ok.NoopGaugeMetric=eZ;class $z extends fX{record($,X){}}ok.NoopHistogramMetric=$z;class xJ{addCallback($){}removeCallback($){}}ok.NoopObservableMetric=xJ;class Xz extends xJ{}ok.NoopObservableCounterMetric=Xz;class Yz extends xJ{}ok.NoopObservableGaugeMetric=Yz;class Jz extends xJ{}ok.NoopObservableUpDownCounterMetric=Jz;ok.NOOP_METER=new aZ;ok.NOOP_COUNTER_METRIC=new sZ;ok.NOOP_GAUGE_METRIC=new eZ;ok.NOOP_HISTOGRAM_METRIC=new $z;ok.NOOP_UP_DOWN_COUNTER_METRIC=new tZ;ok.NOOP_OBSERVABLE_COUNTER_METRIC=new Xz;ok.NOOP_OBSERVABLE_GAUGE_METRIC=new Yz;ok.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new Jz;function QX$(){return ok.NOOP_METER}ok.createNoopMeter=QX$});var Gv=X$((Uv)=>{Object.defineProperty(Uv,"__esModule",{value:!0});Uv.ValueType=void 0;var jX$;(function($){$[$.INT=0]="INT",$[$.DOUBLE=1]="DOUBLE"})(jX$=Uv.ValueType||(Uv.ValueType={}))});var Gz=X$((Hv)=>{Object.defineProperty(Hv,"__esModule",{value:!0});Hv.defaultTextMapSetter=Hv.defaultTextMapGetter=void 0;Hv.defaultTextMapGetter={get($,X){if($==null)return;return $[X]},keys($){if($==null)return[];return Object.keys($)}};Hv.defaultTextMapSetter={set($,X,Y){if($==null)return;$[X]=Y}}});var Fv=X$((Kv)=>{Object.defineProperty(Kv,"__esModule",{value:!0});Kv.NoopContextManager=void 0;var LX$=bJ();class Vv{active(){return LX$.ROOT_CONTEXT}with($,X,Y,...W){return X.call(Y,...W)}bind($,X){return X}enable(){return this}disable(){return this}}Kv.NoopContextManager=Vv});var kJ=X$((wv)=>{Object.defineProperty(wv,"__esModule",{value:!0});wv.ContextAPI=void 0;var EX$=Fv(),Hz=$5(),qv=X5(),Dz="context",PX$=new EX$.NoopContextManager;class Vz{constructor(){}static getInstance(){if(!this._instance)this._instance=new Vz;return this._instance}setGlobalContextManager($){return(0,Hz.registerGlobal)(Dz,$,qv.DiagAPI.instance())}active(){return this._getContextManager().active()}with($,X,Y,...W){return this._getContextManager().with($,X,Y,...W)}bind($,X){return this._getContextManager().bind($,X)}_getContextManager(){return(0,Hz.getGlobal)(Dz)||PX$}disable(){this._getContextManager().disable(),(0,Hz.unregisterGlobal)(Dz,qv.DiagAPI.instance())}}wv.ContextAPI=Vz});var Qz=X$((zv)=>{Object.defineProperty(zv,"__esModule",{value:!0});zv.TraceFlags=void 0;var IX$;(function($){$[$.NONE=0]="NONE",$[$.SAMPLED=1]="SAMPLED"})(IX$=zv.TraceFlags||(zv.TraceFlags={}))});var kG=X$((Ov)=>{Object.defineProperty(Ov,"__esModule",{value:!0});Ov.INVALID_SPAN_CONTEXT=Ov.INVALID_TRACEID=Ov.INVALID_SPANID=void 0;var _X$=Qz();Ov.INVALID_SPANID="0000000000000000";Ov.INVALID_TRACEID="00000000000000000000000000000000";Ov.INVALID_SPAN_CONTEXT={traceId:Ov.INVALID_TRACEID,spanId:Ov.INVALID_SPANID,traceFlags:_X$.TraceFlags.NONE}});var vG=X$((jv)=>{Object.defineProperty(jv,"__esModule",{value:!0});jv.NonRecordingSpan=void 0;var TX$=kG();class Mv{constructor($=TX$.INVALID_SPAN_CONTEXT){this._spanContext=$}spanContext(){return this._spanContext}setAttribute($,X){return this}setAttributes($){return this}addEvent($,X){return this}addLink($){return this}addLinks($){return this}setStatus($){return this}updateName($){return this}end($){}isRecording(){return!1}recordException($,X){}}jv.NonRecordingSpan=Mv});var wz=X$((Ev)=>{Object.defineProperty(Ev,"__esModule",{value:!0});Ev.getSpanContext=Ev.setSpanContext=Ev.deleteSpan=Ev.setSpan=Ev.getActiveSpan=Ev.getSpan=void 0;var CX$=bJ(),SX$=vG(),bX$=kJ(),Fz=(0,CX$.createContextKey)("OpenTelemetry Context Key SPAN");function qz($){return $.getValue(Fz)||void 0}Ev.getSpan=qz;function xX$(){return qz(bX$.ContextAPI.getInstance().active())}Ev.getActiveSpan=xX$;function Lv($,X){return $.setValue(Fz,X)}Ev.setSpan=Lv;function kX$($){return $.deleteValue(Fz)}Ev.deleteSpan=kX$;function vX$($,X){return Lv($,new SX$.NonRecordingSpan(X))}Ev.setSpanContext=vX$;function hX$($){var X;return(X=qz($))===null||X===void 0?void 0:X.spanContext()}Ev.getSpanContext=hX$});var hG=X$((Cv)=>{Object.defineProperty(Cv,"__esModule",{value:!0});Cv.wrapSpanContext=Cv.isSpanContextValid=Cv.isValidSpanId=Cv.isValidTraceId=void 0;var Iv=kG(),pX$=vG(),cX$=/^([0-9a-f]{32})$/i,dX$=/^[0-9a-f]{16}$/i;function _v($){return cX$.test($)&&$!==Iv.INVALID_TRACEID}Cv.isValidTraceId=_v;function Tv($){return dX$.test($)&&$!==Iv.INVALID_SPANID}Cv.isValidSpanId=Tv;function lX$($){return _v($.traceId)&&Tv($.spanId)}Cv.isSpanContextValid=lX$;function iX$($){return new pX$.NonRecordingSpan($)}Cv.wrapSpanContext=iX$});var Oz=X$((kv)=>{Object.defineProperty(kv,"__esModule",{value:!0});kv.NoopTracer=void 0;var aX$=kJ(),bv=wz(),Zz=vG(),sX$=hG(),zz=aX$.ContextAPI.getInstance();class xv{startSpan($,X,Y=zz.active()){if(Boolean(X===null||X===void 0?void 0:X.root))return new Zz.NonRecordingSpan;let J=Y&&(0,bv.getSpanContext)(Y);if(tX$(J)&&(0,sX$.isSpanContextValid)(J))return new Zz.NonRecordingSpan(J);else return new Zz.NonRecordingSpan}startActiveSpan($,X,Y,W){let J,U,H;if(arguments.length<2)return;else if(arguments.length===2)H=X;else if(arguments.length===3)J=X,H=Y;else J=X,U=Y,H=W;let D=U!==null&&U!==void 0?U:zz.active(),V=this.startSpan($,J,D),K=(0,bv.setSpan)(D,V);return zz.with(K,H,void 0,V)}}kv.NoopTracer=xv;function tX$($){return typeof $==="object"&&typeof $.spanId==="string"&&typeof $.traceId==="string"&&typeof $.traceFlags==="number"}});var Nz=X$((yv)=>{Object.defineProperty(yv,"__esModule",{value:!0});yv.ProxyTracer=void 0;var eX$=Oz(),$7$=new eX$.NoopTracer;class hv{constructor($,X,Y,W){this._provider=$,this.name=X,this.version=Y,this.options=W}startSpan($,X,Y){return this._getTracer().startSpan($,X,Y)}startActiveSpan($,X,Y,W){let J=this._getTracer();return Reflect.apply(J.startActiveSpan,J,arguments)}_getTracer(){if(this._delegate)return this._delegate;let $=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!$)return $7$;return this._delegate=$,this._delegate}}yv.ProxyTracer=hv});var pv=X$((mv)=>{Object.defineProperty(mv,"__esModule",{value:!0});mv.NoopTracerProvider=void 0;var X7$=Oz();class gv{getTracer($,X,Y){return new X7$.NoopTracer}}mv.NoopTracerProvider=gv});var Az=X$((dv)=>{Object.defineProperty(dv,"__esModule",{value:!0});dv.ProxyTracerProvider=void 0;var Y7$=Nz(),J7$=pv(),W7$=new J7$.NoopTracerProvider;class cv{getTracer($,X,Y){var W;return(W=this.getDelegateTracer($,X,Y))!==null&&W!==void 0?W:new Y7$.ProxyTracer(this,$,X,Y)}getDelegate(){var $;return($=this._delegate)!==null&&$!==void 0?$:W7$}setDelegate($){this._delegate=$}getDelegateTracer($,X,Y){var W;return(W=this._delegate)===null||W===void 0?void 0:W.getTracer($,X,Y)}}dv.ProxyTracerProvider=cv});var rv=X$((iv)=>{Object.defineProperty(iv,"__esModule",{value:!0});iv.SamplingDecision=void 0;var U7$;(function($){$[$.NOT_RECORD=0]="NOT_RECORD",$[$.RECORD=1]="RECORD",$[$.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(U7$=iv.SamplingDecision||(iv.SamplingDecision={}))});var ov=X$((nv)=>{Object.defineProperty(nv,"__esModule",{value:!0});nv.SpanKind=void 0;var G7$;(function($){$[$.INTERNAL=0]="INTERNAL",$[$.SERVER=1]="SERVER",$[$.CLIENT=2]="CLIENT",$[$.PRODUCER=3]="PRODUCER",$[$.CONSUMER=4]="CONSUMER"})(G7$=nv.SpanKind||(nv.SpanKind={}))});var sv=X$((av)=>{Object.defineProperty(av,"__esModule",{value:!0});av.SpanStatusCode=void 0;var H7$;(function($){$[$.UNSET=0]="UNSET",$[$.OK=1]="OK",$[$.ERROR=2]="ERROR"})(H7$=av.SpanStatusCode||(av.SpanStatusCode={}))});var $h=X$((tv)=>{Object.defineProperty(tv,"__esModule",{value:!0});tv.validateValue=tv.validateKey=void 0;var Rz="[_0-9a-z-*/]",D7$=`[a-z]${Rz}{0,255}`,V7$=`[a-z0-9]${Rz}{0,240}@[a-z]${Rz}{0,13}`,K7$=new RegExp(`^(?:${D7$}|${V7$})$`),Q7$=/^[ -~]{0,255}[!-~]$/,F7$=/,|=/;function q7$($){return K7$.test($)}tv.validateKey=q7$;function w7$($){return Q7$.test($)&&!F7$.test($)}tv.validateValue=w7$});var Hh=X$((Uh)=>{Object.defineProperty(Uh,"__esModule",{value:!0});Uh.TraceStateImpl=void 0;var Xh=$h(),Yh=32,z7$=512,Jh=",",Wh="=";class Lz{constructor($){if(this._internalState=new Map,$)this._parse($)}set($,X){let Y=this._clone();if(Y._internalState.has($))Y._internalState.delete($);return Y._internalState.set($,X),Y}unset($){let X=this._clone();return X._internalState.delete($),X}get($){return this._internalState.get($)}serialize(){return this._keys().reduce(($,X)=>{return $.push(X+Wh+this.get(X)),$},[]).join(Jh)}_parse($){if($.length>z7$)return;if(this._internalState=$.split(Jh).reverse().reduce((X,Y)=>{let W=Y.trim(),J=W.indexOf(Wh);if(J!==-1){let U=W.slice(0,J),H=W.slice(J+1,Y.length);if((0,Xh.validateKey)(U)&&(0,Xh.validateValue)(H))X.set(U,H)}return X},new Map),this._internalState.size>Yh)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Yh))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let $=new Lz;return $._internalState=new Map(this._internalState),$}}Uh.TraceStateImpl=Lz});var Kh=X$((Dh)=>{Object.defineProperty(Dh,"__esModule",{value:!0});Dh.createTraceState=void 0;var O7$=Hh();function N7$($){return new O7$.TraceStateImpl($)}Dh.createTraceState=N7$});var qh=X$((Qh)=>{Object.defineProperty(Qh,"__esModule",{value:!0});Qh.context=void 0;var A7$=kJ();Qh.context=A7$.ContextAPI.getInstance()});var zh=X$((wh)=>{Object.defineProperty(wh,"__esModule",{value:!0});wh.diag=void 0;var B7$=X5();wh.diag=B7$.DiagAPI.instance()});var Ah=X$((Oh)=>{Object.defineProperty(Oh,"__esModule",{value:!0});Oh.NOOP_METER_PROVIDER=Oh.NoopMeterProvider=void 0;var M7$=Wz();class Ez{getMeter($,X,Y){return M7$.NOOP_METER}}Oh.NoopMeterProvider=Ez;Oh.NOOP_METER_PROVIDER=new Ez});var Rh=X$((Mh)=>{Object.defineProperty(Mh,"__esModule",{value:!0});Mh.MetricsAPI=void 0;var R7$=Ah(),Pz=$5(),Bh=X5(),Iz="metrics";class _z{constructor(){}static getInstance(){if(!this._instance)this._instance=new _z;return this._instance}setGlobalMeterProvider($){return(0,Pz.registerGlobal)(Iz,$,Bh.DiagAPI.instance())}getMeterProvider(){return(0,Pz.getGlobal)(Iz)||R7$.NOOP_METER_PROVIDER}getMeter($,X,Y){return this.getMeterProvider().getMeter($,X,Y)}disable(){(0,Pz.unregisterGlobal)(Iz,Bh.DiagAPI.instance())}}Mh.MetricsAPI=_z});var Ph=X$((Lh)=>{Object.defineProperty(Lh,"__esModule",{value:!0});Lh.metrics=void 0;var L7$=Rh();Lh.metrics=L7$.MetricsAPI.getInstance()});var Ch=X$((_h)=>{Object.defineProperty(_h,"__esModule",{value:!0});_h.NoopTextMapPropagator=void 0;class Ih{inject($,X){}extract($,X){return $}fields(){return[]}}_h.NoopTextMapPropagator=Ih});var kh=X$((bh)=>{Object.defineProperty(bh,"__esModule",{value:!0});bh.deleteBaggage=bh.setBaggage=bh.getActiveBaggage=bh.getBaggage=void 0;var E7$=kJ(),P7$=bJ(),Tz=(0,P7$.createContextKey)("OpenTelemetry Baggage Key");function Sh($){return $.getValue(Tz)||void 0}bh.getBaggage=Sh;function I7$(){return Sh(E7$.ContextAPI.getInstance().active())}bh.getActiveBaggage=I7$;function _7$($,X){return $.setValue(Tz,X)}bh.setBaggage=_7$;function T7$($){return $.deleteValue(Tz)}bh.deleteBaggage=T7$});var gh=X$((yh)=>{Object.defineProperty(yh,"__esModule",{value:!0});yh.PropagationAPI=void 0;var Cz=$5(),x7$=Ch(),vh=Gz(),yG=kh(),k7$=nZ(),hh=X5(),Sz="propagation",v7$=new x7$.NoopTextMapPropagator;class bz{constructor(){this.createBaggage=k7$.createBaggage,this.getBaggage=yG.getBaggage,this.getActiveBaggage=yG.getActiveBaggage,this.setBaggage=yG.setBaggage,this.deleteBaggage=yG.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new bz;return this._instance}setGlobalPropagator($){return(0,Cz.registerGlobal)(Sz,$,hh.DiagAPI.instance())}inject($,X,Y=vh.defaultTextMapSetter){return this._getGlobalPropagator().inject($,X,Y)}extract($,X,Y=vh.defaultTextMapGetter){return this._getGlobalPropagator().extract($,X,Y)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,Cz.unregisterGlobal)(Sz,hh.DiagAPI.instance())}_getGlobalPropagator(){return(0,Cz.getGlobal)(Sz)||v7$}}yh.PropagationAPI=bz});var ph=X$((mh)=>{Object.defineProperty(mh,"__esModule",{value:!0});mh.propagation=void 0;var h7$=gh();mh.propagation=h7$.PropagationAPI.getInstance()});var nh=X$((ih)=>{Object.defineProperty(ih,"__esModule",{value:!0});ih.TraceAPI=void 0;var xz=$5(),ch=Az(),dh=hG(),gX=wz(),lh=X5(),kz="trace";class vz{constructor(){this._proxyTracerProvider=new ch.ProxyTracerProvider,this.wrapSpanContext=dh.wrapSpanContext,this.isSpanContextValid=dh.isSpanContextValid,this.deleteSpan=gX.deleteSpan,this.getSpan=gX.getSpan,this.getActiveSpan=gX.getActiveSpan,this.getSpanContext=gX.getSpanContext,this.setSpan=gX.setSpan,this.setSpanContext=gX.setSpanContext}static getInstance(){if(!this._instance)this._instance=new vz;return this._instance}setGlobalTracerProvider($){let X=(0,xz.registerGlobal)(kz,this._proxyTracerProvider,lh.DiagAPI.instance());if(X)this._proxyTracerProvider.setDelegate($);return X}getTracerProvider(){return(0,xz.getGlobal)(kz)||this._proxyTracerProvider}getTracer($,X){return this.getTracerProvider().getTracer($,X)}disable(){(0,xz.unregisterGlobal)(kz,lh.DiagAPI.instance()),this._proxyTracerProvider=new ch.ProxyTracerProvider}}ih.TraceAPI=vz});var sh=X$((oh)=>{Object.defineProperty(oh,"__esModule",{value:!0});oh.trace=void 0;var y7$=nh();oh.trace=y7$.TraceAPI.getInstance()});var fz=X$((k6)=>{Object.defineProperty(k6,"__esModule",{value:!0});k6.trace=k6.propagation=k6.metrics=k6.diag=k6.context=k6.INVALID_SPAN_CONTEXT=k6.INVALID_TRACEID=k6.INVALID_SPANID=k6.isValidSpanId=k6.isValidTraceId=k6.isSpanContextValid=k6.createTraceState=k6.TraceFlags=k6.SpanStatusCode=k6.SpanKind=k6.SamplingDecision=k6.ProxyTracerProvider=k6.ProxyTracer=k6.defaultTextMapSetter=k6.defaultTextMapGetter=k6.ValueType=k6.createNoopMeter=k6.DiagLogLevel=k6.DiagConsoleLogger=k6.ROOT_CONTEXT=k6.createContextKey=k6.baggageEntryMetadataFromString=void 0;var f7$=nZ();Object.defineProperty(k6,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return f7$.baggageEntryMetadataFromString}});var th=bJ();Object.defineProperty(k6,"createContextKey",{enumerable:!0,get:function(){return th.createContextKey}});Object.defineProperty(k6,"ROOT_CONTEXT",{enumerable:!0,get:function(){return th.ROOT_CONTEXT}});var g7$=nk();Object.defineProperty(k6,"DiagConsoleLogger",{enumerable:!0,get:function(){return g7$.DiagConsoleLogger}});var m7$=SG();Object.defineProperty(k6,"DiagLogLevel",{enumerable:!0,get:function(){return m7$.DiagLogLevel}});var u7$=Wz();Object.defineProperty(k6,"createNoopMeter",{enumerable:!0,get:function(){return u7$.createNoopMeter}});var p7$=Gv();Object.defineProperty(k6,"ValueType",{enumerable:!0,get:function(){return p7$.ValueType}});var eh=Gz();Object.defineProperty(k6,"defaultTextMapGetter",{enumerable:!0,get:function(){return eh.defaultTextMapGetter}});Object.defineProperty(k6,"defaultTextMapSetter",{enumerable:!0,get:function(){return eh.defaultTextMapSetter}});var c7$=Nz();Object.defineProperty(k6,"ProxyTracer",{enumerable:!0,get:function(){return c7$.ProxyTracer}});var d7$=Az();Object.defineProperty(k6,"ProxyTracerProvider",{enumerable:!0,get:function(){return d7$.ProxyTracerProvider}});var l7$=rv();Object.defineProperty(k6,"SamplingDecision",{enumerable:!0,get:function(){return l7$.SamplingDecision}});var i7$=ov();Object.defineProperty(k6,"SpanKind",{enumerable:!0,get:function(){return i7$.SpanKind}});var r7$=sv();Object.defineProperty(k6,"SpanStatusCode",{enumerable:!0,get:function(){return r7$.SpanStatusCode}});var n7$=Qz();Object.defineProperty(k6,"TraceFlags",{enumerable:!0,get:function(){return n7$.TraceFlags}});var o7$=Kh();Object.defineProperty(k6,"createTraceState",{enumerable:!0,get:function(){return o7$.createTraceState}});var hz=hG();Object.defineProperty(k6,"isSpanContextValid",{enumerable:!0,get:function(){return hz.isSpanContextValid}});Object.defineProperty(k6,"isValidTraceId",{enumerable:!0,get:function(){return hz.isValidTraceId}});Object.defineProperty(k6,"isValidSpanId",{enumerable:!0,get:function(){return hz.isValidSpanId}});var yz=kG();Object.defineProperty(k6,"INVALID_SPANID",{enumerable:!0,get:function(){return yz.INVALID_SPANID}});Object.defineProperty(k6,"INVALID_TRACEID",{enumerable:!0,get:function(){return yz.INVALID_TRACEID}});Object.defineProperty(k6,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return yz.INVALID_SPAN_CONTEXT}});var $y=qh();Object.defineProperty(k6,"context",{enumerable:!0,get:function(){return $y.context}});var Xy=zh();Object.defineProperty(k6,"diag",{enumerable:!0,get:function(){return Xy.diag}});var Yy=Ph();Object.defineProperty(k6,"metrics",{enumerable:!0,get:function(){return Yy.metrics}});var Jy=ph();Object.defineProperty(k6,"propagation",{enumerable:!0,get:function(){return Jy.propagation}});var Wy=sh();Object.defineProperty(k6,"trace",{enumerable:!0,get:function(){return Wy.trace}});k6.default={context:$y.context,diag:Xy.diag,metrics:Yy.metrics,propagation:Jy.propagation,trace:Wy.trace}});function Y5($){return $===void 0?[]:Array.isArray($)?$:[$]}async function Z0($){for(let X of Y5($.callbacks)){if(X==null)continue;try{await X($.event)}catch(Y){}}}function fY$({warning:$,provider:X,model:Y}){let W=`AI SDK Warning (${X} / ${Y}):`;switch($.type){case"unsupported":{let J=`${W} The feature "${$.feature}" is not supported.`;if($.details)J+=` ${$.details}`;return J}case"compatibility":{let J=`${W} The feature "${$.feature}" is used in a compatibility mode.`;if($.details)J+=` ${$.details}`;return J}case"other":return`${W} ${$.message}`;default:return`${W} ${JSON.stringify($,null,2)}`}}function nz({provider:$,modelId:X}){Y9({warnings:[{type:"compatibility",feature:"specificationVersion",details:"Using v2 specification compatibility mode. Some features may not be available."}],provider:$,model:X})}function mY$($){if($.specificationVersion==="v3")return $;return nz({provider:$.provider,modelId:$.modelId}),new Proxy($,{get(X,Y){if(Y==="specificationVersion")return"v3";return X[Y]}})}function uY$($){if($.specificationVersion==="v3")return $;return nz({provider:$.provider,modelId:$.modelId}),new Proxy($,{get(X,Y){if(Y==="specificationVersion")return"v3";return X[Y]}})}function pY$($){if($.specificationVersion==="v3")return $;return nz({provider:$.provider,modelId:$.modelId}),new Proxy($,{get(X,Y){switch(Y){case"specificationVersion":return"v3";case"doGenerate":return async(...W)=>{let J=await X.doGenerate(...W);return{...J,finishReason:Kf(J.finishReason),usage:Qf(J.usage)}};case"doStream":return async(...W)=>{let J=await X.doStream(...W);return{...J,stream:cY$(J.stream)}};default:return X[Y]}}})}function cY$($){return $.pipeThrough(new TransformStream({transform(X,Y){switch(X.type){case"finish":Y.enqueue({...X,finishReason:Kf(X.finishReason),usage:Qf(X.usage)});break;default:Y.enqueue(X);break}}}))}function Kf($){return{unified:$==="unknown"?"other":$,raw:void 0}}function Qf($){return{inputTokens:{total:$.inputTokens,noCache:void 0,cacheRead:$.cachedInputTokens,cacheWrite:void 0},outputTokens:{total:$.outputTokens,text:void 0,reasoning:$.reasoningTokens}}}function hJ($){if(typeof $!=="string"){if($.specificationVersion!=="v3"&&$.specificationVersion!=="v2"){let X=$;throw new rz({version:X.specificationVersion,provider:X.provider,modelId:X.modelId})}return pY$($)}return oz().languageModel($)}function Ff($){if(typeof $!=="string"){if($.specificationVersion!=="v3"&&$.specificationVersion!=="v2"){let X=$;throw new rz({version:X.specificationVersion,provider:X.provider,modelId:X.modelId})}return mY$($)}return oz().embeddingModel($)}function dY$($){if(typeof $!=="string"){if($.specificationVersion!=="v3"&&$.specificationVersion!=="v2"){let X=$;throw new rz({version:X.specificationVersion,provider:X.provider,modelId:X.modelId})}return uY$($)}return oz().imageModel($)}function oz(){var $;return($=globalThis.AI_SDK_DEFAULT_PROVIDER)!=null?$:Vk}function az($){if($==null)return;if(typeof $==="number")return $;return $.totalMs}function qf($){if($==null||typeof $==="number")return;return $.stepMs}function lY$($){if($==null||typeof $==="number")return;return $.chunkMs}function rY$($){return typeof $==="string"&&$.startsWith("SUQz")||typeof $!=="string"&&$.length>10&&$[0]===73&&$[1]===68&&$[2]===51?iY$($):$}function uG({data:$,signatures:X}){let Y=rY$($),W=typeof Y==="string"?p4(Y.substring(0,Math.min(Y.length,24))):Y;for(let J of X)if(W.length>=J.bytesPrefix.length&&J.bytesPrefix.every((U,H)=>U===null||W[H]===U))return J.mediaType;return}function Zf($){try{let[X,Y]=$.split(",");return{mediaType:X.split(";")[0].split(":")[1],base64Content:Y}}catch(X){return{mediaType:void 0,base64Content:void 0}}}function Of($){if($ instanceof Uint8Array)return{data:$,mediaType:void 0};if($ instanceof ArrayBuffer)return{data:new Uint8Array($),mediaType:void 0};if(typeof $==="string")try{$=new URL($)}catch(X){}if($ instanceof URL&&$.protocol==="data:"){let{mediaType:X,base64Content:Y}=Zf($.toString());if(X==null||Y==null)throw new A$({name:"InvalidDataContentError",message:`Invalid data URL format in content ${$.toString()}`});return{data:Y,mediaType:X}}return{data:$,mediaType:void 0}}function oY$($){if(typeof $==="string")return $;if($ instanceof ArrayBuffer)return p1(new Uint8Array($));return p1($)}function aY$($){if($ instanceof Uint8Array)return $;if(typeof $==="string")try{return p4($)}catch(X){throw new Gy({message:"Invalid data content. Content string is not a base64-encoded media.",content:$,cause:X})}if($ instanceof ArrayBuffer)return new Uint8Array($);throw new Gy({content:$})}async function sz({prompt:$,supportedUrls:X,download:Y=nY$()}){let W=await tY$($.messages,Y,X),J=new Map;for(let K of $.messages)if(K.role==="assistant"&&Array.isArray(K.content)){for(let Q of K.content)if(Q.type==="tool-approval-request"&&"approvalId"in Q&&"toolCallId"in Q)J.set(Q.approvalId,Q.toolCallId)}let U=new Set;for(let K of $.messages)if(K.role==="tool"){for(let Q of K.content)if(Q.type==="tool-approval-response"){let q=J.get(Q.approvalId);if(q)U.add(q)}}let H=[...$.system!=null?typeof $.system==="string"?[{role:"system",content:$.system}]:Y5($.system).map((K)=>({role:"system",content:K.content,providerOptions:K.providerOptions})):[],...$.messages.map((K)=>sY$({message:K,downloadedAssets:W}))],D=[];for(let K of H){if(K.role!=="tool"){D.push(K);continue}let Q=D.at(-1);if((Q==null?void 0:Q.role)==="tool")Q.content.push(...K.content);else D.push(K)}let V=new Set;for(let K of D)switch(K.role){case"assistant":{for(let Q of K.content)if(Q.type==="tool-call"&&!Q.providerExecuted)V.add(Q.toolCallId);break}case"tool":{for(let Q of K.content)if(Q.type==="tool-result")V.delete(Q.toolCallId);break}case"user":case"system":for(let Q of U)V.delete(Q);if(V.size>0)throw new Uy({toolCallIds:Array.from(V)});break}for(let K of U)V.delete(K);if(V.size>0)throw new Uy({toolCallIds:Array.from(V)});return D.filter((K)=>K.role!=="tool"||K.content.length>0)}function sY$({message:$,downloadedAssets:X}){let Y=$.role;switch(Y){case"system":return{role:"system",content:$.content,providerOptions:$.providerOptions};case"user":{if(typeof $.content==="string")return{role:"user",content:[{type:"text",text:$.content}],providerOptions:$.providerOptions};return{role:"user",content:$.content.map((W)=>eY$(W,X)).filter((W)=>W.type!=="text"||W.text!==""),providerOptions:$.providerOptions}}case"assistant":{if(typeof $.content==="string")return{role:"assistant",content:[{type:"text",text:$.content}],providerOptions:$.providerOptions};return{role:"assistant",content:$.content.filter((W)=>W.type!=="text"||W.text!==""||W.providerOptions!=null).filter((W)=>W.type!=="tool-approval-request").map((W)=>{let J=W.providerOptions;switch(W.type){case"file":{let{data:U,mediaType:H}=Of(W.data);return{type:"file",data:U,filename:W.filename,mediaType:H!=null?H:W.mediaType,providerOptions:J}}case"reasoning":return{type:"reasoning",text:W.text,providerOptions:J};case"text":return{type:"text",text:W.text,providerOptions:J};case"tool-call":return{type:"tool-call",toolCallId:W.toolCallId,toolName:W.toolName,input:W.input,providerExecuted:W.providerExecuted,providerOptions:J};case"tool-result":return{type:"tool-result",toolCallId:W.toolCallId,toolName:W.toolName,output:Vy(W.output),providerOptions:J}}}),providerOptions:$.providerOptions}}case"tool":return{role:"tool",content:$.content.filter((W)=>W.type!=="tool-approval-response"||W.providerExecuted).map((W)=>{switch(W.type){case"tool-result":return{type:"tool-result",toolCallId:W.toolCallId,toolName:W.toolName,output:Vy(W.output),providerOptions:W.providerOptions};case"tool-approval-response":return{type:"tool-approval-response",approvalId:W.approvalId,approved:W.approved,reason:W.reason}}}),providerOptions:$.providerOptions};default:throw new bY$({role:Y})}}async function tY$($,X,Y){let W=$.filter((U)=>U.role==="user").map((U)=>U.content).filter((U)=>Array.isArray(U)).flat().filter((U)=>U.type==="image"||U.type==="file").map((U)=>{var H;let D=(H=U.mediaType)!=null?H:U.type==="image"?"image/*":void 0,V=U.type==="image"?U.image:U.data;if(typeof V==="string")try{V=new URL(V)}catch(K){}return{mediaType:D,data:V}}).filter((U)=>U.data instanceof URL).map((U)=>({url:U.data,isUrlSupportedByModel:U.mediaType!=null&&kb({url:U.data.toString(),mediaType:U.mediaType,supportedUrls:Y})})),J=await X(W);return Object.fromEntries(J.map((U,H)=>U==null?null:[W[H].url.toString(),{data:U.data,mediaType:U.mediaType}]).filter((U)=>U!=null))}function eY$($,X){var Y;if($.type==="text")return{type:"text",text:$.text,providerOptions:$.providerOptions};let W,J=$.type;switch(J){case"image":W=$.image;break;case"file":W=$.data;break;default:throw Error(`Unsupported part type: ${J}`)}let{data:U,mediaType:H}=Of(W),D=H!=null?H:$.mediaType,V=U;if(V instanceof URL){let K=X[V.toString()];if(K)V=K.data,D!=null||(D=K.mediaType)}switch(J){case"image":{if(V instanceof Uint8Array||typeof V==="string")D=(Y=uG({data:V,signatures:mG}))!=null?Y:D;return{type:"file",mediaType:D!=null?D:"image/*",filename:void 0,data:V,providerOptions:$.providerOptions}}case"file":{if(D==null)throw Error("Media type is missing for file part");return{type:"file",mediaType:D,filename:$.filename,data:V,providerOptions:$.providerOptions}}}}function Vy($){if($.type!=="content")return $;return{type:"content",value:$.value.map((X)=>{if(X.type!=="media")return X;if(X.mediaType.startsWith("image/"))return{type:"image-data",data:X.data,mediaType:X.mediaType};return{type:"file-data",data:X.data,mediaType:X.mediaType}})}}async function vJ({toolCallId:$,input:X,output:Y,tool:W,errorMode:J}){if(J==="text")return{type:"error-text",value:F0(Y)};else if(J==="json")return{type:"error-json",value:Ky(Y)};if(W==null?void 0:W.toModelOutput)return await W.toModelOutput({toolCallId:$,input:X,output:Y});return typeof Y==="string"?{type:"text",value:Y}:{type:"json",value:Ky(Y)}}function Ky($){return $===void 0?null:$}function yJ({maxOutputTokens:$,temperature:X,topP:Y,topK:W,presencePenalty:J,frequencyPenalty:U,seed:H,stopSequences:D}){if($!=null){if(!Number.isInteger($))throw new d6({parameter:"maxOutputTokens",value:$,message:"maxOutputTokens must be an integer"});if($<1)throw new d6({parameter:"maxOutputTokens",value:$,message:"maxOutputTokens must be >= 1"})}if(X!=null){if(typeof X!=="number")throw new d6({parameter:"temperature",value:X,message:"temperature must be a number"})}if(Y!=null){if(typeof Y!=="number")throw new d6({parameter:"topP",value:Y,message:"topP must be a number"})}if(W!=null){if(typeof W!=="number")throw new d6({parameter:"topK",value:W,message:"topK must be a number"})}if(J!=null){if(typeof J!=="number")throw new d6({parameter:"presencePenalty",value:J,message:"presencePenalty must be a number"})}if(U!=null){if(typeof U!=="number")throw new d6({parameter:"frequencyPenalty",value:U,message:"frequencyPenalty must be a number"})}if(H!=null){if(!Number.isInteger(H))throw new d6({parameter:"seed",value:H,message:"seed must be an integer"})}return{maxOutputTokens:$,temperature:X,topP:Y,topK:W,presencePenalty:J,frequencyPenalty:U,stopSequences:D,seed:H}}function $J$($){return $!=null&&Object.keys($).length>0}async function Nf({tools:$,toolChoice:X,activeTools:Y}){if(!$J$($))return{tools:void 0,toolChoice:void 0};let W=Y!=null?Object.entries($).filter(([U])=>Y.includes(U)):Object.entries($),J=[];for(let[U,H]of W){let D=H.type;switch(D){case void 0:case"dynamic":case"function":J.push({type:"function",name:U,description:H.description,inputSchema:await P1(H.inputSchema).jsonSchema,...H.inputExamples!=null?{inputExamples:H.inputExamples}:{},providerOptions:H.providerOptions,...H.strict!=null?{strict:H.strict}:{}});break;case"provider":J.push({type:"provider",name:U,id:H.id,args:H.args});break;default:throw Error(`Unsupported tool type: ${D}`)}}return{tools:J,toolChoice:X==null?{type:"auto"}:typeof X==="string"?{type:X}:{type:"tool",toolName:X.toolName}}}async function tz($){if($.prompt==null&&$.messages==null)throw new F8({prompt:$,message:"prompt or messages must be defined"});if($.prompt!=null&&$.messages!=null)throw new F8({prompt:$,message:"prompt and messages cannot be defined at the same time"});if($.system!=null&&typeof $.system!=="string"&&!Y5($.system).every((W)=>typeof W==="object"&&W!==null&&("role"in W)&&W.role==="system"))throw new F8({prompt:$,message:"system must be a string, SystemModelMessage, or array of SystemModelMessage"});let X;if($.prompt!=null&&typeof $.prompt==="string")X=[{role:"user",content:$.prompt}];else if($.prompt!=null&&Array.isArray($.prompt))X=$.prompt;else if($.messages!=null)X=$.messages;else throw new F8({prompt:$,message:"prompt or messages must be defined"});if(X.length===0)throw new F8({prompt:$,message:"messages must not be empty"});let Y=await F4({value:X,schema:G.array(QJ$)});if(!Y.success)throw new F8({prompt:$,message:"The messages do not match the ModelMessage[] schema.",cause:Y.error});return{messages:X,system:$.system}}function ez($){if(!CG.isInstance($))return $;let X=(process==null?void 0:"development")==="production",Y="https://ai-sdk.dev/unauthenticated-ai-gateway";if(X)return new A$({name:"GatewayError",message:`Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${Y}`});return Object.assign(Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m
277
-
278
- To authenticate, set the \x1B[33mAI_GATEWAY_API_KEY\x1B[0m environment variable with your API key.
279
-
280
- Alternatively, you can use a provider module instead of the AI Gateway.
281
-
282
- Learn more: \x1B[34m${Y}\x1B[0m
283
-
284
- `),{name:"GatewayAuthenticationError"})}function d1({operationId:$,telemetry:X}){return{"operation.name":`${$}${(X==null?void 0:X.functionId)!=null?` ${X.functionId}`:""}`,"resource.name":X==null?void 0:X.functionId,"ai.operationId":$,"ai.telemetry.functionId":X==null?void 0:X.functionId}}function gJ({model:$,settings:X,telemetry:Y,headers:W}){var J;return{"ai.model.provider":$.provider,"ai.model.id":$.modelId,...Object.entries(X).reduce((U,[H,D])=>{if(H==="timeout"){let V=az(D);if(V!=null)U[`ai.settings.${H}`]=V}else U[`ai.settings.${H}`]=D;return U},{}),...Object.entries((J=Y==null?void 0:Y.metadata)!=null?J:{}).reduce((U,[H,D])=>{return U[`ai.telemetry.metadata.${H}`]=D,U},{}),...Object.entries(W!=null?W:{}).reduce((U,[H,D])=>{if(D!==void 0)U[`ai.request.headers.${H}`]=D;return U},{})}}function mJ({isEnabled:$=!1,tracer:X}={}){if(!$)return FJ$;if(X)return X;return jf.trace.getTracer("ai")}async function l1({name:$,tracer:X,attributes:Y,fn:W,endWhenDone:J=!0}){return X.startActiveSpan($,{attributes:await Y},async(U)=>{let H=pX.context.active();try{let D=await pX.context.with(H,()=>W(U));if(J)U.end();return D}catch(D){try{Rf(U,D)}finally{U.end()}throw D}})}function Rf($,X){if(X instanceof Error)$.recordException({name:X.name,message:X.message,stack:X.stack}),$.setStatus({code:pX.SpanStatusCode.ERROR,message:X.message});else $.setStatus({code:pX.SpanStatusCode.ERROR})}async function p6({telemetry:$,attributes:X}){if(($==null?void 0:$.isEnabled)!==!0)return{};let Y={};for(let[W,J]of Object.entries(X)){if(J==null)continue;if(typeof J==="object"&&"input"in J&&typeof J.input==="function"){if(($==null?void 0:$.recordInputs)===!1)continue;let U=await J.input();if(U!=null)Y[W]=U;continue}if(typeof J==="object"&&"output"in J&&typeof J.output==="function"){if(($==null?void 0:$.recordOutputs)===!1)continue;let U=await J.output();if(U!=null)Y[W]=U;continue}Y[W]=J}return Y}function $O($){return JSON.stringify($.map((X)=>({...X,content:typeof X.content==="string"?X.content:X.content.map((Y)=>Y.type==="file"?{...Y,data:Y.data instanceof Uint8Array?oY$(Y.data):Y.data}:Y)})))}function wJ$(){var $;return($=globalThis.AI_SDK_TELEMETRY_INTEGRATIONS)!=null?$:[]}function Lf(){let $=wJ$();return(X)=>{let Y=Y5(X),W=[...$,...Y];function J(U){let H=W.map(U).filter(Boolean);return async(D)=>{for(let V of H)try{await V(D)}catch(K){}}}return{onStart:J((U)=>U.onStart),onStepStart:J((U)=>U.onStepStart),onToolCallStart:J((U)=>U.onToolCallStart),onToolCallFinish:J((U)=>U.onToolCallFinish),onStepFinish:J((U)=>U.onStepFinish),onFinish:J((U)=>U.onFinish)}}}function pG($){return{inputTokens:$.inputTokens.total,inputTokenDetails:{noCacheTokens:$.inputTokens.noCache,cacheReadTokens:$.inputTokens.cacheRead,cacheWriteTokens:$.inputTokens.cacheWrite},outputTokens:$.outputTokens.total,outputTokenDetails:{textTokens:$.outputTokens.text,reasoningTokens:$.outputTokens.reasoning},totalTokens:K1($.inputTokens.total,$.outputTokens.total),raw:$.raw,reasoningTokens:$.outputTokens.reasoning,cachedInputTokens:$.inputTokens.cacheRead}}function gz(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function Ef($,X){var Y,W,J,U,H,D,V,K,Q,q;return{inputTokens:K1($.inputTokens,X.inputTokens),inputTokenDetails:{noCacheTokens:K1((Y=$.inputTokenDetails)==null?void 0:Y.noCacheTokens,(W=X.inputTokenDetails)==null?void 0:W.noCacheTokens),cacheReadTokens:K1((J=$.inputTokenDetails)==null?void 0:J.cacheReadTokens,(U=X.inputTokenDetails)==null?void 0:U.cacheReadTokens),cacheWriteTokens:K1((H=$.inputTokenDetails)==null?void 0:H.cacheWriteTokens,(D=X.inputTokenDetails)==null?void 0:D.cacheWriteTokens)},outputTokens:K1($.outputTokens,X.outputTokens),outputTokenDetails:{textTokens:K1((V=$.outputTokenDetails)==null?void 0:V.textTokens,(K=X.outputTokenDetails)==null?void 0:K.textTokens),reasoningTokens:K1((Q=$.outputTokenDetails)==null?void 0:Q.reasoningTokens,(q=X.outputTokenDetails)==null?void 0:q.reasoningTokens)},totalTokens:K1($.totalTokens,X.totalTokens),reasoningTokens:K1($.reasoningTokens,X.reasoningTokens),cachedInputTokens:K1($.cachedInputTokens,X.cachedInputTokens)}}function K1($,X){return $==null&&X==null?void 0:($!=null?$:0)+(X!=null?X:0)}function ZJ$($,X){return{inputTokens:K1($.inputTokens,X.inputTokens),outputTokens:K1($.outputTokens,X.outputTokens),totalTokens:K1($.totalTokens,X.totalTokens)}}function dG($,X){if($===void 0&&X===void 0)return;if($===void 0)return X;if(X===void 0)return $;let Y={...$};for(let W in X)if(Object.prototype.hasOwnProperty.call(X,W)){let J=X[W];if(J===void 0)continue;let U=W in $?$[W]:void 0,H=J!==null&&typeof J==="object"&&!Array.isArray(J)&&!(J instanceof Date)&&!(J instanceof RegExp),D=U!==null&&U!==void 0&&typeof U==="object"&&!Array.isArray(U)&&!(U instanceof Date)&&!(U instanceof RegExp);if(H&&D)Y[W]=dG(U,J);else Y[W]=J}return Y}function zJ$({error:$,exponentialBackoffDelay:X}){let Y=$.responseHeaders;if(!Y)return X;let W,J=Y["retry-after-ms"];if(J){let H=parseFloat(J);if(!Number.isNaN(H))W=H}let U=Y["retry-after"];if(U&&W===void 0){let H=parseFloat(U);if(!Number.isNaN(H))W=H*1000;else W=Date.parse(U)-Date.now()}if(W!=null&&!Number.isNaN(W)&&0<=W&&(W<60000||W<X))return W;return X}async function Pf($,{maxRetries:X,delayInMs:Y,backoffFactor:W,abortSignal:J},U=[]){try{return await $()}catch(H){if(B8(H))throw H;if(X===0)throw H;let D=bX(H),V=[...U,H],K=V.length;if(K>X)throw new Hy({message:`Failed after ${K} attempts. Last error: ${D}`,reason:"maxRetriesExceeded",errors:V});if(H instanceof Error&&R6.isInstance(H)&&H.isRetryable===!0&&K<=X)return await BG(zJ$({error:H,exponentialBackoffDelay:Y}),{abortSignal:J}),Pf($,{maxRetries:X,delayInMs:W*Y,backoffFactor:W,abortSignal:J},V);if(K===1)throw H;throw new Hy({message:`Failed after ${K} attempts with non-retryable error: '${D}'`,reason:"errorNotRetryable",errors:V})}}function dX({maxRetries:$,abortSignal:X}){if($!=null){if(!Number.isInteger($))throw new d6({parameter:"maxRetries",value:$,message:"maxRetries must be an integer"});if($<0)throw new d6({parameter:"maxRetries",value:$,message:"maxRetries must be >= 0"})}let Y=$!=null?$:2;return{maxRetries:Y,retry:OJ$({maxRetries:Y,abortSignal:X})}}function If({messages:$}){let X=$.at(-1);if((X==null?void 0:X.role)!="tool")return{approvedToolApprovals:[],deniedToolApprovals:[]};let Y={};for(let V of $)if(V.role==="assistant"&&typeof V.content!=="string"){let K=V.content;for(let Q of K)if(Q.type==="tool-call")Y[Q.toolCallId]=Q}let W={};for(let V of $)if(V.role==="assistant"&&typeof V.content!=="string"){let K=V.content;for(let Q of K)if(Q.type==="tool-approval-request")W[Q.approvalId]=Q}let J={};for(let V of X.content)if(V.type==="tool-result")J[V.toolCallId]=V;let U=[],H=[],D=X.content.filter((V)=>V.type==="tool-approval-response");for(let V of D){let K=W[V.approvalId];if(K==null)throw new GY$({approvalId:V.approvalId});if(J[K.toolCallId]!=null)continue;let Q=Y[K.toolCallId];if(Q==null)throw new iz({toolCallId:K.toolCallId,approvalId:K.approvalId});let q={approvalRequest:K,approvalResponse:V,toolCall:Q};if(V.approved)U.push(q);else H.push(q)}return{approvedToolApprovals:U,deniedToolApprovals:H}}function gG(){var $,X;return(X=($=globalThis==null?void 0:globalThis.performance)==null?void 0:$.now())!=null?X:Date.now()}async function XO({toolCall:$,tools:X,tracer:Y,telemetry:W,messages:J,abortSignal:U,experimental_context:H,stepNumber:D,model:V,onPreliminaryToolResult:K,onToolCallStart:Q,onToolCallFinish:q}){let{toolName:F,toolCallId:w,input:z}=$,O=X==null?void 0:X[F];if((O==null?void 0:O.execute)==null)return;let N={stepNumber:D,model:V,toolCall:$,messages:J,abortSignal:U,functionId:W==null?void 0:W.functionId,metadata:W==null?void 0:W.metadata,experimental_context:H};return l1({name:"ai.toolCall",attributes:p6({telemetry:W,attributes:{...d1({operationId:"ai.toolCall",telemetry:W}),"ai.toolCall.name":F,"ai.toolCall.id":w,"ai.toolCall.args":{output:()=>JSON.stringify(z)}}}),tracer:Y,fn:async(L)=>{let P;await Z0({event:N,callbacks:Q});let j=gG();try{let y=pb({execute:O.execute.bind(O),input:z,options:{toolCallId:w,messages:J,abortSignal:U,experimental_context:H}});for await(let E of y)if(E.type==="preliminary")K==null||K({...$,type:"tool-result",output:E.output,preliminary:!0});else P=E.output}catch(y){let E=gG()-j;return await Z0({event:{...N,success:!1,error:y,durationMs:E},callbacks:q}),Rf(L,y),{type:"tool-error",toolCallId:w,toolName:F,input:z,error:y,dynamic:O.type==="dynamic",...$.providerMetadata!=null?{providerMetadata:$.providerMetadata}:{}}}let v=gG()-j;await Z0({event:{...N,success:!0,output:P,durationMs:v},callbacks:q});try{L.setAttributes(await p6({telemetry:W,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(P)}}}))}catch(y){}return{type:"tool-result",toolCallId:w,toolName:F,input:z,output:P,dynamic:O.type==="dynamic",...$.providerMetadata!=null?{providerMetadata:$.providerMetadata}:{}}}})}function uz($){let X=$.filter((Y)=>Y.type==="reasoning");return X.length===0?void 0:X.map((Y)=>Y.text).join(`
285
- `)}function pz($){let X=$.filter((Y)=>Y.type==="text");if(X.length===0)return;return X.map((Y)=>Y.text).join("")}async function _f({tool:$,toolCall:X,messages:Y,experimental_context:W}){if($.needsApproval==null)return!1;if(typeof $.needsApproval==="boolean")return $.needsApproval;return await $.needsApproval(X.input,{toolCallId:X.toolCallId,messages:Y,experimental_context:W})}function BJ$($){let X=["ROOT"],Y=-1,W=null;function J(V,K,Q){switch(V){case'"':{Y=K,X.pop(),X.push(Q),X.push("INSIDE_STRING");break}case"f":case"t":case"n":{Y=K,W=K,X.pop(),X.push(Q),X.push("INSIDE_LITERAL");break}case"-":{X.pop(),X.push(Q),X.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{Y=K,X.pop(),X.push(Q),X.push("INSIDE_NUMBER");break}case"{":{Y=K,X.pop(),X.push(Q),X.push("INSIDE_OBJECT_START");break}case"[":{Y=K,X.pop(),X.push(Q),X.push("INSIDE_ARRAY_START");break}}}function U(V,K){switch(V){case",":{X.pop(),X.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{Y=K,X.pop();break}}}function H(V,K){switch(V){case",":{X.pop(),X.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{Y=K,X.pop();break}}}for(let V=0;V<$.length;V++){let K=$[V];switch(X[X.length-1]){case"ROOT":J(K,V,"FINISH");break;case"INSIDE_OBJECT_START":{switch(K){case'"':{X.pop(),X.push("INSIDE_OBJECT_KEY");break}case"}":{Y=V,X.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(K){case'"':{X.pop(),X.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(K){case'"':{X.pop(),X.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(K){case":":{X.pop(),X.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{J(K,V,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{U(K,V);break}case"INSIDE_STRING":{switch(K){case'"':{X.pop(),Y=V;break}case"\\":{X.push("INSIDE_STRING_ESCAPE");break}default:Y=V}break}case"INSIDE_ARRAY_START":{switch(K){case"]":{Y=V,X.pop();break}default:{Y=V,J(K,V,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(K){case",":{X.pop(),X.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{Y=V,X.pop();break}default:{Y=V;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{J(K,V,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{X.pop(),Y=V;break}case"INSIDE_NUMBER":{switch(K){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{Y=V;break}case"e":case"E":case"-":case".":break;case",":{if(X.pop(),X[X.length-1]==="INSIDE_ARRAY_AFTER_VALUE")H(K,V);if(X[X.length-1]==="INSIDE_OBJECT_AFTER_VALUE")U(K,V);break}case"}":{if(X.pop(),X[X.length-1]==="INSIDE_OBJECT_AFTER_VALUE")U(K,V);break}case"]":{if(X.pop(),X[X.length-1]==="INSIDE_ARRAY_AFTER_VALUE")H(K,V);break}default:{X.pop();break}}break}case"INSIDE_LITERAL":{let q=$.substring(W,V+1);if(!"false".startsWith(q)&&!"true".startsWith(q)&&!"null".startsWith(q)){if(X.pop(),X[X.length-1]==="INSIDE_OBJECT_AFTER_VALUE")U(K,V);else if(X[X.length-1]==="INSIDE_ARRAY_AFTER_VALUE")H(K,V)}else Y=V;break}}}let D=$.slice(0,Y+1);for(let V=X.length-1;V>=0;V--)switch(X[V]){case"INSIDE_STRING":{D+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{D+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{D+="]";break}case"INSIDE_LITERAL":{let Q=$.substring(W,$.length);if("true".startsWith(Q))D+="true".slice(Q.length);else if("false".startsWith(Q))D+="false".slice(Q.length);else if("null".startsWith(Q))D+="null".slice(Q.length)}}return D}async function uJ($){if($===void 0)return{value:void 0,state:"undefined-input"};let X=await d4({text:$});if(X.success)return{value:X.value,state:"successful-parse"};if(X=await d4({text:BJ$($)}),X.success)return{value:X.value,state:"repaired-parse"};return{value:void 0,state:"failed-parse"}}async function Tf({toolCall:$,tools:X,repairToolCall:Y,system:W,messages:J}){var U;try{if(X==null){if($.providerExecuted&&$.dynamic)return await Cf($);throw new mz({toolName:$.toolName})}try{return await Qy({toolCall:$,tools:X})}catch(H){if(Y==null||!(mz.isInstance(H)||lz.isInstance(H)))throw H;let D=null;try{D=await Y({toolCall:$,tools:X,inputSchema:async({toolName:V})=>{let{inputSchema:K}=X[V];return await P1(K).jsonSchema},system:W,messages:J,error:H})}catch(V){throw new _Y$({cause:V,originalError:H})}if(D==null)throw H;return await Qy({toolCall:D,tools:X})}}catch(H){let D=await d4({text:$.input}),V=D.success?D.value:$.input;return{type:"tool-call",toolCallId:$.toolCallId,toolName:$.toolName,input:V,dynamic:!0,invalid:!0,error:H,title:(U=X==null?void 0:X[$.toolName])==null?void 0:U.title,providerExecuted:$.providerExecuted,providerMetadata:$.providerMetadata}}}async function Cf($){let X=$.input.trim()===""?{success:!0,value:{}}:await d4({text:$.input});if(X.success===!1)throw new lz({toolName:$.toolName,toolInput:$.input,cause:X.error});return{type:"tool-call",toolCallId:$.toolCallId,toolName:$.toolName,input:X.value,providerExecuted:!0,dynamic:!0,providerMetadata:$.providerMetadata}}async function Qy({toolCall:$,tools:X}){let Y=$.toolName,W=X[Y];if(W==null){if($.providerExecuted&&$.dynamic)return await Cf($);throw new mz({toolName:$.toolName,availableTools:Object.keys(X)})}let J=P1(W.inputSchema),U=$.input.trim()===""?await F4({value:{},schema:J}):await d4({text:$.input,schema:J});if(U.success===!1)throw new lz({toolName:Y,toolInput:$.input,cause:U.error});return W.type==="dynamic"?{type:"tool-call",toolCallId:$.toolCallId,toolName:$.toolName,input:U.value,providerExecuted:$.providerExecuted,providerMetadata:$.providerMetadata,dynamic:!0,title:W.title}:{type:"tool-call",toolCallId:$.toolCallId,toolName:Y,input:U.value,providerExecuted:$.providerExecuted,providerMetadata:$.providerMetadata,title:W.title}}function pJ($){return({steps:X})=>X.length===$}async function bf({stopConditions:$,steps:X}){return(await Promise.all($.map((Y)=>Y({steps:X})))).some((Y)=>Y)}async function cz({content:$,tools:X}){let Y=[],W=[];for(let U of $){if(U.type==="source")continue;if((U.type==="tool-result"||U.type==="tool-error")&&!U.providerExecuted)continue;if(U.type==="text"&&U.text.length===0)continue;switch(U.type){case"text":W.push({type:"text",text:U.text,providerOptions:U.providerMetadata});break;case"reasoning":W.push({type:"reasoning",text:U.text,providerOptions:U.providerMetadata});break;case"file":W.push({type:"file",data:U.file.base64,mediaType:U.file.mediaType,providerOptions:U.providerMetadata});break;case"tool-call":W.push({type:"tool-call",toolCallId:U.toolCallId,toolName:U.toolName,input:U.input,providerExecuted:U.providerExecuted,providerOptions:U.providerMetadata});break;case"tool-result":{let H=await vJ({toolCallId:U.toolCallId,input:U.input,tool:X==null?void 0:X[U.toolName],output:U.output,errorMode:"none"});W.push({type:"tool-result",toolCallId:U.toolCallId,toolName:U.toolName,output:H,providerOptions:U.providerMetadata});break}case"tool-error":{let H=await vJ({toolCallId:U.toolCallId,input:U.input,tool:X==null?void 0:X[U.toolName],output:U.error,errorMode:"json"});W.push({type:"tool-result",toolCallId:U.toolCallId,toolName:U.toolName,output:H,providerOptions:U.providerMetadata});break}case"tool-approval-request":W.push({type:"tool-approval-request",approvalId:U.approvalId,toolCallId:U.toolCall.toolCallId});break}}if(W.length>0)Y.push({role:"assistant",content:W});let J=[];for(let U of $){if(!(U.type==="tool-result"||U.type==="tool-error")||U.providerExecuted)continue;let H=await vJ({toolCallId:U.toolCallId,input:U.input,tool:X==null?void 0:X[U.toolName],output:U.type==="tool-result"?U.output:U.error,errorMode:U.type==="tool-error"?"text":"none"});J.push({type:"tool-result",toolCallId:U.toolCallId,toolName:U.toolName,output:H,...U.providerMetadata!=null?{providerOptions:U.providerMetadata}:{}})}if(J.length>0)Y.push({role:"tool",content:J});return Y}function xf(...$){let X=$.filter((W)=>W!=null);if(X.length===0)return;if(X.length===1)return X[0];let Y=new AbortController;for(let W of X){if(W.aborted)return Y.abort(W.reason),Y.signal;W.addEventListener("abort",()=>{Y.abort(W.reason)},{once:!0})}return Y.signal}async function JO({model:$,tools:X,toolChoice:Y,system:W,prompt:J,messages:U,maxRetries:H,abortSignal:D,timeout:V,headers:K,stopWhen:Q=pJ(1),experimental_output:q,output:F=q,experimental_telemetry:w,providerOptions:z,experimental_activeTools:O,activeTools:N=O,experimental_prepareStep:L,prepareStep:P=L,experimental_repairToolCall:j,experimental_download:v,experimental_context:y,experimental_include:E,_internal:{generateId:b=EJ$}={},experimental_onStart:R,experimental_onStepStart:I,experimental_onToolCallStart:d,experimental_onToolCallFinish:k,onStepFinish:t,onFinish:h,...f}){let l=hJ($),o=Lf(),g=Y5(Q),a=az(V),Y$=qf(V),_=Y$!=null?new AbortController:void 0,V$=xf(D,a!=null?AbortSignal.timeout(a):void 0,_==null?void 0:_.signal),{maxRetries:o$,retry:T}=dX({maxRetries:H,abortSignal:V$}),B$=yJ(f),k$=$4(K!=null?K:{},`ai/${cX}`),m=gJ({model:l,telemetry:w,headers:k$,settings:{...B$,maxRetries:o$}}),T$={provider:l.provider,modelId:l.modelId},H$=await tz({system:W,prompt:J,messages:U}),F$=o(w==null?void 0:w.integrations);await Z0({event:{model:T$,system:W,prompt:J,messages:U,tools:X,toolChoice:Y,activeTools:N,maxOutputTokens:B$.maxOutputTokens,temperature:B$.temperature,topP:B$.topP,topK:B$.topK,presencePenalty:B$.presencePenalty,frequencyPenalty:B$.frequencyPenalty,stopSequences:B$.stopSequences,seed:B$.seed,maxRetries:o$,timeout:V,headers:K,providerOptions:z,stopWhen:Q,output:F,abortSignal:D,include:E,functionId:w==null?void 0:w.functionId,metadata:w==null?void 0:w.metadata,experimental_context:y},callbacks:[R,F$.onStart]});let P$=mJ(w);try{return await l1({name:"ai.generateText",attributes:p6({telemetry:w,attributes:{...d1({operationId:"ai.generateText",telemetry:w}),...m,"ai.model.provider":l.provider,"ai.model.id":l.modelId,"ai.prompt":{input:()=>JSON.stringify({system:W,prompt:J,messages:U})}}}),tracer:P$,fn:async(j$)=>{var U$,n,G$,S$,v$,j6,q4,l4,$1,C,w$,f6,N4;let F1=H$.messages,i=[],{approvedToolApprovals:s,deniedToolApprovals:z$}=If({messages:F1}),i$=s.filter((c6)=>!c6.toolCall.providerExecuted);if(z$.length>0||i$.length>0){let c6=await Fy({toolCalls:i$.map((l$)=>l$.toolCall),tools:X,tracer:P$,telemetry:w,messages:F1,abortSignal:V$,experimental_context:y,stepNumber:0,model:T$,onToolCallStart:[d,F$.onToolCallStart],onToolCallFinish:[k,F$.onToolCallFinish]}),A4=[];for(let l$ of c6){let x4=await vJ({toolCallId:l$.toolCallId,input:l$.input,tool:X==null?void 0:X[l$.toolName],output:l$.type==="tool-result"?l$.output:l$.error,errorMode:l$.type==="tool-error"?"text":"none"});A4.push({type:"tool-result",toolCallId:l$.toolCallId,toolName:l$.toolName,output:x4})}for(let l$ of z$)A4.push({type:"tool-result",toolCallId:l$.toolCall.toolCallId,toolName:l$.toolCall.toolName,output:{type:"execution-denied",reason:l$.approvalResponse.reason,...l$.toolCall.providerExecuted&&{providerOptions:{openai:{approvalId:l$.approvalResponse.approvalId}}}}});i.push({role:"tool",content:A4})}let w6=[...s,...z$].filter((c6)=>c6.toolCall.providerExecuted);if(w6.length>0)i.push({role:"tool",content:w6.map((c6)=>({type:"tool-approval-response",approvalId:c6.approvalResponse.approvalId,approved:c6.approvalResponse.approved,reason:c6.approvalResponse.reason,providerExecuted:!0}))});let Q6=yJ(f),m$,O6=[],u$=[],N6=[],u6=new Map;do{let c6=Y$!=null?setTimeout(()=>_.abort(),Y$):void 0;try{let A4=[...F1,...i],l$=await(P==null?void 0:P({model:l,steps:N6,stepNumber:N6.length,messages:A4,experimental_context:y})),x4=hJ((U$=l$==null?void 0:l$.model)!=null?U$:l),a6={provider:x4.provider,modelId:x4.modelId},B4=await sz({prompt:{system:(n=l$==null?void 0:l$.system)!=null?n:H$.system,messages:(G$=l$==null?void 0:l$.messages)!=null?G$:A4},supportedUrls:await x4.supportedUrls,download:v});y=(S$=l$==null?void 0:l$.experimental_context)!=null?S$:y;let l6=(v$=l$==null?void 0:l$.activeTools)!=null?v$:N,{toolChoice:a0,tools:D5}=await Nf({tools:X,toolChoice:(j6=l$==null?void 0:l$.toolChoice)!=null?j6:Y,activeTools:l6}),X2=(q4=l$==null?void 0:l$.messages)!=null?q4:A4,Y2=(l4=l$==null?void 0:l$.system)!=null?l4:H$.system,H7=dG(z,l$==null?void 0:l$.providerOptions);await Z0({event:{stepNumber:N6.length,model:a6,system:Y2,messages:X2,tools:X,toolChoice:a0,activeTools:l6,steps:[...N6],providerOptions:H7,timeout:V,headers:K,stopWhen:Q,output:F,abortSignal:D,include:E,functionId:w==null?void 0:w.functionId,metadata:w==null?void 0:w.metadata,experimental_context:y},callbacks:[I,F$.onStepStart]}),m$=await T(()=>{var G6;return l1({name:"ai.generateText.doGenerate",attributes:p6({telemetry:w,attributes:{...d1({operationId:"ai.generateText.doGenerate",telemetry:w}),...m,"ai.model.provider":x4.provider,"ai.model.id":x4.modelId,"ai.prompt.messages":{input:()=>$O(B4)},"ai.prompt.tools":{input:()=>D5==null?void 0:D5.map((k4)=>JSON.stringify(k4))},"ai.prompt.toolChoice":{input:()=>a0!=null?JSON.stringify(a0):void 0},"gen_ai.system":x4.provider,"gen_ai.request.model":x4.modelId,"gen_ai.request.frequency_penalty":f.frequencyPenalty,"gen_ai.request.max_tokens":f.maxOutputTokens,"gen_ai.request.presence_penalty":f.presencePenalty,"gen_ai.request.stop_sequences":f.stopSequences,"gen_ai.request.temperature":(G6=f.temperature)!=null?G6:void 0,"gen_ai.request.top_k":f.topK,"gen_ai.request.top_p":f.topP}}),tracer:P$,fn:async(k4)=>{var I8,s0,W2,U2,Q7,G2,F7,V5;let i6=await x4.doGenerate({...Q6,tools:D5,toolChoice:a0,responseFormat:await(F==null?void 0:F.responseFormat),prompt:B4,providerOptions:H7,abortSignal:V$,headers:k$}),t0={id:(s0=(I8=i6.response)==null?void 0:I8.id)!=null?s0:b(),timestamp:(U2=(W2=i6.response)==null?void 0:W2.timestamp)!=null?U2:new Date,modelId:(G2=(Q7=i6.response)==null?void 0:Q7.modelId)!=null?G2:x4.modelId,headers:(F7=i6.response)==null?void 0:F7.headers,body:(V5=i6.response)==null?void 0:V5.body};return k4.setAttributes(await p6({telemetry:w,attributes:{"ai.response.finishReason":i6.finishReason.unified,"ai.response.text":{output:()=>pz(i6.content)},"ai.response.reasoning":{output:()=>uz(i6.content)},"ai.response.toolCalls":{output:()=>{let H2=qy(i6.content);return H2==null?void 0:JSON.stringify(H2)}},"ai.response.id":t0.id,"ai.response.model":t0.modelId,"ai.response.timestamp":t0.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(i6.providerMetadata),"ai.usage.promptTokens":i6.usage.inputTokens.total,"ai.usage.completionTokens":i6.usage.outputTokens.total,"gen_ai.response.finish_reasons":[i6.finishReason.unified],"gen_ai.response.id":t0.id,"gen_ai.response.model":t0.modelId,"gen_ai.usage.input_tokens":i6.usage.inputTokens.total,"gen_ai.usage.output_tokens":i6.usage.outputTokens.total}})),{...i6,response:t0}}})});let T1=await Promise.all(m$.content.filter((G6)=>G6.type==="tool-call").map((G6)=>Tf({toolCall:G6,tools:X,repairToolCall:j,system:W,messages:A4}))),D7={};for(let G6 of T1){if(G6.invalid)continue;let k4=X==null?void 0:X[G6.toolName];if(k4==null)continue;if((k4==null?void 0:k4.onInputAvailable)!=null)await k4.onInputAvailable({input:G6.input,toolCallId:G6.toolCallId,messages:A4,abortSignal:V$,experimental_context:y});if(await _f({tool:k4,toolCall:G6,messages:A4,experimental_context:y}))D7[G6.toolCallId]={type:"tool-approval-request",approvalId:b(),toolCall:G6}}let J2=T1.filter((G6)=>G6.invalid&&G6.dynamic);u$=[];for(let G6 of J2)u$.push({type:"tool-error",toolCallId:G6.toolCallId,toolName:G6.toolName,input:G6.input,error:bX(G6.error),dynamic:!0});if(O6=T1.filter((G6)=>!G6.providerExecuted),X!=null)u$.push(...await Fy({toolCalls:O6.filter((G6)=>!G6.invalid&&D7[G6.toolCallId]==null),tools:X,tracer:P$,telemetry:w,messages:A4,abortSignal:V$,experimental_context:y,stepNumber:N6.length,model:a6,onToolCallStart:[d,F$.onToolCallStart],onToolCallFinish:[k,F$.onToolCallFinish]}));for(let G6 of T1){if(!G6.providerExecuted)continue;let k4=X==null?void 0:X[G6.toolName];if((k4==null?void 0:k4.type)==="provider"&&k4.supportsDeferredResults){if(!m$.content.some((s0)=>s0.type==="tool-result"&&s0.toolCallId===G6.toolCallId))u6.set(G6.toolCallId,{toolName:G6.toolName})}}for(let G6 of m$.content)if(G6.type==="tool-result")u6.delete(G6.toolCallId);let V7=IJ$({content:m$.content,toolCalls:T1,toolOutputs:u$,toolApprovalRequests:Object.values(D7),tools:X});i.push(...await cz({content:V7,tools:X}));let P8=(($1=E==null?void 0:E.requestBody)!=null?$1:!0)?(C=m$.request)!=null?C:{}:{...m$.request,body:void 0},J4={...m$.response,messages:structuredClone(i),body:((w$=E==null?void 0:E.responseBody)!=null?w$:!0)?(f6=m$.response)==null?void 0:f6.body:void 0},A0=N6.length,K7=new Sf({stepNumber:A0,model:a6,functionId:w==null?void 0:w.functionId,metadata:w==null?void 0:w.metadata,experimental_context:y,content:V7,finishReason:m$.finishReason.unified,rawFinishReason:m$.finishReason.raw,usage:pG(m$.usage),warnings:m$.warnings,providerMetadata:m$.providerMetadata,request:P8,response:J4});Y9({warnings:(N4=m$.warnings)!=null?N4:[],provider:a6.provider,model:a6.modelId}),N6.push(K7),await Z0({event:K7,callbacks:[t,F$.onStepFinish]})}finally{if(c6!=null)clearTimeout(c6)}}while((O6.length>0&&u$.length===O6.length||u6.size>0)&&!await bf({stopConditions:g,steps:N6}));j$.setAttributes(await p6({telemetry:w,attributes:{"ai.response.finishReason":m$.finishReason.unified,"ai.response.text":{output:()=>pz(m$.content)},"ai.response.reasoning":{output:()=>uz(m$.content)},"ai.response.toolCalls":{output:()=>{let c6=qy(m$.content);return c6==null?void 0:JSON.stringify(c6)}},"ai.response.providerMetadata":JSON.stringify(m$.providerMetadata),"ai.usage.promptTokens":m$.usage.inputTokens.total,"ai.usage.completionTokens":m$.usage.outputTokens.total}}));let D$=N6[N6.length-1],K6=N6.reduce((c6,A4)=>{return Ef(c6,A4.usage)},{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0,reasoningTokens:void 0,cachedInputTokens:void 0});await Z0({event:{stepNumber:D$.stepNumber,model:D$.model,functionId:D$.functionId,metadata:D$.metadata,experimental_context:D$.experimental_context,finishReason:D$.finishReason,rawFinishReason:D$.rawFinishReason,usage:D$.usage,content:D$.content,text:D$.text,reasoningText:D$.reasoningText,reasoning:D$.reasoning,files:D$.files,sources:D$.sources,toolCalls:D$.toolCalls,staticToolCalls:D$.staticToolCalls,dynamicToolCalls:D$.dynamicToolCalls,toolResults:D$.toolResults,staticToolResults:D$.staticToolResults,dynamicToolResults:D$.dynamicToolResults,request:D$.request,response:D$.response,warnings:D$.warnings,providerMetadata:D$.providerMetadata,steps:N6,totalUsage:K6},callbacks:[h,F$.onFinish]});let i1;if(D$.finishReason==="stop")i1=await(F!=null?F:cG()).parseCompleteOutput({text:D$.text},{response:D$.response,usage:D$.usage,finishReason:D$.finishReason});return new PJ$({steps:N6,totalUsage:K6,output:i1})}})}catch(j$){throw ez(j$)}}async function Fy({toolCalls:$,tools:X,tracer:Y,telemetry:W,messages:J,abortSignal:U,experimental_context:H,stepNumber:D,model:V,onToolCallStart:K,onToolCallFinish:Q}){return(await Promise.all($.map(async(F)=>XO({toolCall:F,tools:X,tracer:Y,telemetry:W,messages:J,abortSignal:U,experimental_context:H,stepNumber:D,model:V,onToolCallStart:K,onToolCallFinish:Q})))).filter((F)=>F!=null)}function qy($){let X=$.filter((Y)=>Y.type==="tool-call");if(X.length===0)return;return X.map((Y)=>({toolCallId:Y.toolCallId,toolName:Y.toolName,input:Y.input}))}function IJ$({content:$,toolCalls:X,toolOutputs:Y,toolApprovalRequests:W,tools:J}){let U=[];for(let H of $)switch(H.type){case"text":case"reasoning":case"source":U.push(H);break;case"file":{U.push({type:"file",file:new YO(H),...H.providerMetadata!=null?{providerMetadata:H.providerMetadata}:{}});break}case"tool-call":{U.push(X.find((D)=>D.toolCallId===H.toolCallId));break}case"tool-result":{let D=X.find((V)=>V.toolCallId===H.toolCallId);if(D==null){let V=J==null?void 0:J[H.toolName];if(!((V==null?void 0:V.type)==="provider"&&V.supportsDeferredResults))throw Error(`Tool call ${H.toolCallId} not found.`);if(H.isError)U.push({type:"tool-error",toolCallId:H.toolCallId,toolName:H.toolName,input:void 0,error:H.result,providerExecuted:!0,dynamic:H.dynamic});else U.push({type:"tool-result",toolCallId:H.toolCallId,toolName:H.toolName,input:void 0,output:H.result,providerExecuted:!0,dynamic:H.dynamic});break}if(H.isError)U.push({type:"tool-error",toolCallId:H.toolCallId,toolName:H.toolName,input:D.input,error:H.result,providerExecuted:!0,dynamic:D.dynamic});else U.push({type:"tool-result",toolCallId:H.toolCallId,toolName:H.toolName,input:D.input,output:H.result,providerExecuted:!0,dynamic:D.dynamic});break}case"tool-approval-request":{let D=X.find((V)=>V.toolCallId===H.toolCallId);if(D==null)throw new iz({toolCallId:H.toolCallId,approvalId:H.approvalId});U.push({type:"tool-approval-request",approvalId:H.approvalId,toolCall:D});break}}return[...U,...Y,...W]}function cJ($,X){let Y=new Headers($!=null?$:{});for(let[W,J]of Object.entries(X))if(!Y.has(W))Y.set(W,J);return Y}function _J$({status:$,statusText:X,headers:Y,textStream:W}){return new Response(W.pipeThrough(new TextEncoderStream),{status:$!=null?$:200,statusText:X,headers:cJ(Y,{"content-type":"text/plain; charset=utf-8"})})}function kf({response:$,status:X,statusText:Y,headers:W,stream:J}){let U=X!=null?X:200;if(Y!==void 0)$.writeHead(U,Y,W);else $.writeHead(U,W);let H=J.getReader();(async()=>{try{while(!0){let{done:V,value:K}=await H.read();if(V)break;if(!$.write(K))await new Promise((q)=>{$.once("drain",q)})}}catch(V){throw V}finally{$.end()}})()}function TJ$({response:$,status:X,statusText:Y,headers:W,textStream:J}){kf({response:$,status:X,statusText:Y,headers:Object.fromEntries(cJ(W,{"content-type":"text/plain; charset=utf-8"}).entries()),stream:J.pipeThrough(new TextEncoderStream)})}function CJ$({status:$,statusText:X,headers:Y,stream:W,consumeSseStream:J}){let U=W.pipeThrough(new vf);if(J){let[H,D]=U.tee();U=H,J({stream:D})}return new Response(U.pipeThrough(new TextEncoderStream),{status:$,statusText:X,headers:cJ(Y,hf)})}function SJ$({originalMessages:$,responseMessageId:X}){if($==null)return;let Y=$[$.length-1];return(Y==null?void 0:Y.role)==="assistant"?Y.id:typeof X==="function"?X():X}function bJ$($){return $.type.startsWith("data-")}function dz($){return $.type.startsWith("tool-")}function xJ$($){return $.type==="dynamic-tool"}function wy($){return dz($)||xJ$($)}function Zy($){return $.type.split("-").slice(1).join("-")}function kJ$({lastMessage:$,messageId:X}){return{message:($==null?void 0:$.role)==="assistant"?$:{id:X,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function vJ$({stream:$,messageMetadataSchema:X,dataPartSchemas:Y,runUpdateMessageJob:W,onError:J,onToolCall:U,onData:H}){return $.pipeThrough(new TransformStream({async transform(D,V){await W(async({state:K,write:Q})=>{var q,F,w,z;function O(j){let y=K.message.parts.filter(wy).find((E)=>E.toolCallId===j);if(y==null)throw new mX({chunkType:"tool-invocation",chunkId:j,message:`No tool invocation found for tool call ID "${j}".`});return y}function N(j){var v;let y=K.message.parts.find((R)=>dz(R)&&R.toolCallId===j.toolCallId),E=j,b=y;if(y!=null){if(y.state=j.state,b.input=E.input,b.output=E.output,b.errorText=E.errorText,b.rawInput=E.rawInput,b.preliminary=E.preliminary,j.title!==void 0)b.title=j.title;if(b.providerExecuted=(v=E.providerExecuted)!=null?v:y.providerExecuted,E.providerMetadata!=null)y.callProviderMetadata=E.providerMetadata}else K.message.parts.push({type:`tool-${j.toolName}`,toolCallId:j.toolCallId,state:j.state,title:j.title,input:E.input,output:E.output,rawInput:E.rawInput,errorText:E.errorText,providerExecuted:E.providerExecuted,preliminary:E.preliminary,...E.providerMetadata!=null?{callProviderMetadata:E.providerMetadata}:{}})}function L(j){var v,y;let E=K.message.parts.find((I)=>I.type==="dynamic-tool"&&I.toolCallId===j.toolCallId),b=j,R=E;if(E!=null){if(E.state=j.state,R.toolName=j.toolName,R.input=b.input,R.output=b.output,R.errorText=b.errorText,R.rawInput=(v=b.rawInput)!=null?v:R.rawInput,R.preliminary=b.preliminary,j.title!==void 0)R.title=j.title;if(R.providerExecuted=(y=b.providerExecuted)!=null?y:E.providerExecuted,b.providerMetadata!=null)E.callProviderMetadata=b.providerMetadata}else K.message.parts.push({type:"dynamic-tool",toolName:j.toolName,toolCallId:j.toolCallId,state:j.state,input:b.input,output:b.output,errorText:b.errorText,preliminary:b.preliminary,providerExecuted:b.providerExecuted,title:j.title,...b.providerMetadata!=null?{callProviderMetadata:b.providerMetadata}:{}})}async function P(j){if(j!=null){let v=K.message.metadata!=null?dG(K.message.metadata,j):j;if(X!=null)await z6({value:v,schema:X,context:{field:"message.metadata",entityId:K.message.id}});K.message.metadata=v}}switch(D.type){case"text-start":{let j={type:"text",text:"",providerMetadata:D.providerMetadata,state:"streaming"};K.activeTextParts[D.id]=j,K.message.parts.push(j),Q();break}case"text-delta":{let j=K.activeTextParts[D.id];if(j==null)throw new mX({chunkType:"text-delta",chunkId:D.id,message:`Received text-delta for missing text part with ID "${D.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});j.text+=D.delta,j.providerMetadata=(q=D.providerMetadata)!=null?q:j.providerMetadata,Q();break}case"text-end":{let j=K.activeTextParts[D.id];if(j==null)throw new mX({chunkType:"text-end",chunkId:D.id,message:`Received text-end for missing text part with ID "${D.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});j.state="done",j.providerMetadata=(F=D.providerMetadata)!=null?F:j.providerMetadata,delete K.activeTextParts[D.id],Q();break}case"reasoning-start":{let j={type:"reasoning",text:"",providerMetadata:D.providerMetadata,state:"streaming"};K.activeReasoningParts[D.id]=j,K.message.parts.push(j),Q();break}case"reasoning-delta":{let j=K.activeReasoningParts[D.id];if(j==null)throw new mX({chunkType:"reasoning-delta",chunkId:D.id,message:`Received reasoning-delta for missing reasoning part with ID "${D.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});j.text+=D.delta,j.providerMetadata=(w=D.providerMetadata)!=null?w:j.providerMetadata,Q();break}case"reasoning-end":{let j=K.activeReasoningParts[D.id];if(j==null)throw new mX({chunkType:"reasoning-end",chunkId:D.id,message:`Received reasoning-end for missing reasoning part with ID "${D.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});j.providerMetadata=(z=D.providerMetadata)!=null?z:j.providerMetadata,j.state="done",delete K.activeReasoningParts[D.id],Q();break}case"file":{K.message.parts.push({type:"file",mediaType:D.mediaType,url:D.url,...D.providerMetadata!=null?{providerMetadata:D.providerMetadata}:{}}),Q();break}case"source-url":{K.message.parts.push({type:"source-url",sourceId:D.sourceId,url:D.url,title:D.title,providerMetadata:D.providerMetadata}),Q();break}case"source-document":{K.message.parts.push({type:"source-document",sourceId:D.sourceId,mediaType:D.mediaType,title:D.title,filename:D.filename,providerMetadata:D.providerMetadata}),Q();break}case"tool-input-start":{let j=K.message.parts.filter(dz);if(K.partialToolCalls[D.toolCallId]={text:"",toolName:D.toolName,index:j.length,dynamic:D.dynamic,title:D.title},D.dynamic)L({toolCallId:D.toolCallId,toolName:D.toolName,state:"input-streaming",input:void 0,providerExecuted:D.providerExecuted,title:D.title,providerMetadata:D.providerMetadata});else N({toolCallId:D.toolCallId,toolName:D.toolName,state:"input-streaming",input:void 0,providerExecuted:D.providerExecuted,title:D.title,providerMetadata:D.providerMetadata});Q();break}case"tool-input-delta":{let j=K.partialToolCalls[D.toolCallId];if(j==null)throw new mX({chunkType:"tool-input-delta",chunkId:D.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${D.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});j.text+=D.inputTextDelta;let{value:v}=await uJ(j.text);if(j.dynamic)L({toolCallId:D.toolCallId,toolName:j.toolName,state:"input-streaming",input:v,title:j.title});else N({toolCallId:D.toolCallId,toolName:j.toolName,state:"input-streaming",input:v,title:j.title});Q();break}case"tool-input-available":{if(D.dynamic)L({toolCallId:D.toolCallId,toolName:D.toolName,state:"input-available",input:D.input,providerExecuted:D.providerExecuted,providerMetadata:D.providerMetadata,title:D.title});else N({toolCallId:D.toolCallId,toolName:D.toolName,state:"input-available",input:D.input,providerExecuted:D.providerExecuted,providerMetadata:D.providerMetadata,title:D.title});if(Q(),U&&!D.providerExecuted)await U({toolCall:D});break}case"tool-input-error":{let j=K.message.parts.filter(wy).find((y)=>y.toolCallId===D.toolCallId);if(j!=null?j.type==="dynamic-tool":!!D.dynamic)L({toolCallId:D.toolCallId,toolName:D.toolName,state:"output-error",input:D.input,errorText:D.errorText,providerExecuted:D.providerExecuted,providerMetadata:D.providerMetadata});else N({toolCallId:D.toolCallId,toolName:D.toolName,state:"output-error",input:void 0,rawInput:D.input,errorText:D.errorText,providerExecuted:D.providerExecuted,providerMetadata:D.providerMetadata});Q();break}case"tool-approval-request":{let j=O(D.toolCallId);j.state="approval-requested",j.approval={id:D.approvalId},Q();break}case"tool-output-denied":{let j=O(D.toolCallId);j.state="output-denied",Q();break}case"tool-output-available":{let j=O(D.toolCallId);if(j.type==="dynamic-tool")L({toolCallId:D.toolCallId,toolName:j.toolName,state:"output-available",input:j.input,output:D.output,preliminary:D.preliminary,providerExecuted:D.providerExecuted,title:j.title});else N({toolCallId:D.toolCallId,toolName:Zy(j),state:"output-available",input:j.input,output:D.output,providerExecuted:D.providerExecuted,preliminary:D.preliminary,title:j.title});Q();break}case"tool-output-error":{let j=O(D.toolCallId);if(j.type==="dynamic-tool")L({toolCallId:D.toolCallId,toolName:j.toolName,state:"output-error",input:j.input,errorText:D.errorText,providerExecuted:D.providerExecuted,title:j.title});else N({toolCallId:D.toolCallId,toolName:Zy(j),state:"output-error",input:j.input,rawInput:j.rawInput,errorText:D.errorText,providerExecuted:D.providerExecuted,title:j.title});Q();break}case"start-step":{K.message.parts.push({type:"step-start"});break}case"finish-step":{K.activeTextParts={},K.activeReasoningParts={};break}case"start":{if(D.messageId!=null)K.message.id=D.messageId;if(await P(D.messageMetadata),D.messageId!=null||D.messageMetadata!=null)Q();break}case"finish":{if(D.finishReason!=null)K.finishReason=D.finishReason;if(await P(D.messageMetadata),D.messageMetadata!=null)Q();break}case"message-metadata":{if(await P(D.messageMetadata),D.messageMetadata!=null)Q();break}case"error":{J==null||J(Error(D.errorText));break}default:if(bJ$(D)){if((Y==null?void 0:Y[D.type])!=null){let y=K.message.parts.findIndex((b)=>("id"in b)&&("data"in b)&&b.id===D.id&&b.type===D.type),E=y>=0?y:K.message.parts.length;await z6({value:D.data,schema:Y[D.type],context:{field:`message.parts[${E}].data`,entityName:D.type,entityId:D.id}})}let j=D;if(j.transient){H==null||H(j);break}let v=j.id!=null?K.message.parts.find((y)=>j.type===y.type&&j.id===y.id):void 0;if(v!=null)v.data=j.data;else K.message.parts.push(j);H==null||H(j),Q()}}V.enqueue(D)})}}))}function hJ$({messageId:$,originalMessages:X=[],onStepFinish:Y,onFinish:W,onError:J,stream:U}){let H=X==null?void 0:X[X.length-1];if((H==null?void 0:H.role)!=="assistant")H=void 0;else $=H.id;let D=!1,V=U.pipeThrough(new TransformStream({transform(z,O){if(z.type==="start"){let N=z;if(N.messageId==null&&$!=null)N.messageId=$}if(z.type==="abort")D=!0;O.enqueue(z)}}));if(W==null&&Y==null)return V;let K=kJ$({lastMessage:H?structuredClone(H):void 0,messageId:$!=null?$:""}),Q=async(z)=>{await z({state:K,write:()=>{}})},q=!1,F=async()=>{if(q||!W)return;q=!0;let z=K.message.id===(H==null?void 0:H.id);await W({isAborted:D,isContinuation:z,responseMessage:K.message,messages:[...z?X.slice(0,-1):X,K.message],finishReason:K.finishReason})},w=async()=>{if(!Y)return;let z=K.message.id===(H==null?void 0:H.id);try{await Y({isContinuation:z,responseMessage:structuredClone(K.message),messages:[...z?X.slice(0,-1):X,structuredClone(K.message)]})}catch(O){J(O)}};return vJ$({stream:V,runUpdateMessageJob:Q,onError:J}).pipeThrough(new TransformStream({async transform(z,O){if(z.type==="finish-step")await w();O.enqueue(z)},async cancel(){await F()},async flush(){await F()}}))}function yJ$({response:$,status:X,statusText:Y,headers:W,stream:J,consumeSseStream:U}){let H=J.pipeThrough(new vf);if(U){let[D,V]=H.tee();H=D,U({stream:V})}kf({response:$,status:X,statusText:Y,headers:Object.fromEntries(cJ(W,hf).entries()),stream:H.pipeThrough(new TextEncoderStream)})}function uX($){let X=$.pipeThrough(new TransformStream);return X[Symbol.asyncIterator]=function(){let Y=this.getReader(),W=!1;async function J(U){var H;if(W)return;W=!0;try{if(U)await((H=Y.cancel)==null?void 0:H.call(Y))}finally{try{Y.releaseLock()}catch(D){}}}return{async next(){if(W)return{done:!0,value:void 0};let{done:U,value:H}=await Y.read();if(U)return await J(!0),{done:!0,value:void 0};return{done:!1,value:H}},async return(){return await J(!0),{done:!0,value:void 0}},async throw(U){throw await J(!0),U}}},X}async function fJ$({stream:$,onError:X}){let Y=$.getReader();try{while(!0){let{done:W}=await Y.read();if(W)break}}catch(W){X==null||X(W)}finally{Y.releaseLock()}}function zy(){let $,X;return{promise:new Promise((W,J)=>{$=W,X=J}),resolve:$,reject:X}}function gJ$(){let $=[],X=null,Y=!1,W=zy(),J=()=>{Y=!0,W.resolve(),$.forEach((H)=>H.cancel()),$=[],X==null||X.close()},U=async()=>{if(Y&&$.length===0){X==null||X.close();return}if($.length===0)return W=zy(),await W.promise,U();try{let{value:H,done:D}=await $[0].read();if(D)if($.shift(),$.length===0&&Y)X==null||X.close();else await U();else X==null||X.enqueue(H)}catch(H){X==null||X.error(H),$.shift(),J()}};return{stream:new ReadableStream({start(H){X=H},pull:U,async cancel(){for(let H of $)await H.cancel();$=[],Y=!0}}),addStream:(H)=>{if(Y)throw Error("Cannot add inner stream: outer stream is closed");$.push(H.getReader()),W.resolve()},close:()=>{if(Y=!0,W.resolve(),$.length===0)X==null||X.close()},terminate:J}}function mJ$({tools:$,generatorStream:X,tracer:Y,telemetry:W,system:J,messages:U,abortSignal:H,repairToolCall:D,experimental_context:V,generateId:K,stepNumber:Q,model:q,onToolCallStart:F,onToolCallFinish:w}){let z=null,O=new ReadableStream({start(b){z=b}}),N=new Set,L=new Map,P=new Map,j=!1,v=void 0;function y(){if(j&&N.size===0){if(v!=null)z.enqueue(v);z.close()}}let E=new TransformStream({async transform(b,R){let I=b.type;switch(I){case"stream-start":case"text-start":case"text-delta":case"text-end":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"tool-input-start":case"tool-input-delta":case"tool-input-end":case"source":case"response-metadata":case"error":case"raw":{R.enqueue(b);break}case"file":{R.enqueue({type:"file",file:new NJ$({data:b.data,mediaType:b.mediaType}),...b.providerMetadata!=null?{providerMetadata:b.providerMetadata}:{}});break}case"finish":{v={type:"finish",finishReason:b.finishReason.unified,rawFinishReason:b.finishReason.raw,usage:pG(b.usage),providerMetadata:b.providerMetadata};break}case"tool-approval-request":{let d=P.get(b.toolCallId);if(d==null){z.enqueue({type:"error",error:new iz({toolCallId:b.toolCallId,approvalId:b.approvalId})});break}R.enqueue({type:"tool-approval-request",approvalId:b.approvalId,toolCall:d});break}case"tool-call":{try{let d=await Tf({toolCall:b,tools:$,repairToolCall:D,system:J,messages:U});if(P.set(d.toolCallId,d),R.enqueue(d),d.invalid){z.enqueue({type:"tool-error",toolCallId:d.toolCallId,toolName:d.toolName,input:d.input,error:bX(d.error),dynamic:!0,title:d.title});break}let k=$==null?void 0:$[d.toolName];if(k==null)break;if(k.onInputAvailable!=null)await k.onInputAvailable({input:d.input,toolCallId:d.toolCallId,messages:U,abortSignal:H,experimental_context:V});if(await _f({tool:k,toolCall:d,messages:U,experimental_context:V})){z.enqueue({type:"tool-approval-request",approvalId:K(),toolCall:d});break}if(L.set(d.toolCallId,d.input),k.execute!=null&&d.providerExecuted!==!0){let t=K();N.add(t),XO({toolCall:d,tools:$,tracer:Y,telemetry:W,messages:U,abortSignal:H,experimental_context:V,stepNumber:Q,model:q,onToolCallStart:F,onToolCallFinish:w,onPreliminaryToolResult:(h)=>{z.enqueue(h)}}).then((h)=>{z.enqueue(h)}).catch((h)=>{z.enqueue({type:"error",error:h})}).finally(()=>{N.delete(t),y()})}}catch(d){z.enqueue({type:"error",error:d})}break}case"tool-result":{let d=b.toolName;if(b.isError)z.enqueue({type:"tool-error",toolCallId:b.toolCallId,toolName:d,input:L.get(b.toolCallId),providerExecuted:!0,error:b.result,dynamic:b.dynamic});else R.enqueue({type:"tool-result",toolCallId:b.toolCallId,toolName:d,input:L.get(b.toolCallId),output:b.result,providerExecuted:!0,dynamic:b.dynamic});break}default:throw Error(`Unhandled chunk type: ${I}`)}},flush(){j=!0,y()}});return new ReadableStream({async start(b){return Promise.all([X.pipeThrough(E).pipeTo(new WritableStream({write(R){b.enqueue(R)},close(){}})),O.pipeTo(new WritableStream({write(R){b.enqueue(R)},close(){b.close()}}))])}})}function pJ$({model:$,tools:X,toolChoice:Y,system:W,prompt:J,messages:U,maxRetries:H,abortSignal:D,timeout:V,headers:K,stopWhen:Q=pJ(1),experimental_output:q,output:F=q,experimental_telemetry:w,prepareStep:z,providerOptions:O,experimental_activeTools:N,activeTools:L=N,experimental_repairToolCall:P,experimental_transform:j,experimental_download:v,includeRawChunks:y=!1,onChunk:E,onError:b=({error:_})=>{console.error(_)},onFinish:R,onAbort:I,onStepFinish:d,experimental_onStart:k,experimental_onStepStart:t,experimental_onToolCallStart:h,experimental_onToolCallFinish:f,experimental_context:l,experimental_include:o,_internal:{now:g=gG,generateId:a=uJ$}={},...Y$}){let _=az(V),V$=qf(V),o$=lY$(V),T=V$!=null?new AbortController:void 0,B$=o$!=null?new AbortController:void 0;return new dJ$({model:hJ($),telemetry:w,headers:K,settings:Y$,maxRetries:H,abortSignal:xf(D,_!=null?AbortSignal.timeout(_):void 0,T==null?void 0:T.signal,B$==null?void 0:B$.signal),stepTimeoutMs:V$,stepAbortController:T,chunkTimeoutMs:o$,chunkAbortController:B$,system:W,prompt:J,messages:U,tools:X,toolChoice:Y,transforms:Y5(j),activeTools:L,repairToolCall:P,stopConditions:Y5(Q),output:F,providerOptions:O,prepareStep:z,includeRawChunks:y,timeout:V,stopWhen:Q,originalAbortSignal:D,onChunk:E,onError:b,onFinish:R,onAbort:I,onStepFinish:d,onStart:k,onStepStart:t,onToolCallStart:h,onToolCallFinish:f,now:g,generateId:a,experimental_context:l,download:v,include:o})}function cJ$($){let X=void 0,Y="",W="",J=void 0,U="";function H({controller:D,partialOutput:V=void 0}){D.enqueue({part:{type:"text-delta",id:X,text:W,providerMetadata:J},partialOutput:V}),W=""}return new TransformStream({async transform(D,V){var K;if(D.type==="finish-step"&&W.length>0)H({controller:V});if(D.type!=="text-delta"&&D.type!=="text-start"&&D.type!=="text-end"){V.enqueue({part:D,partialOutput:void 0});return}if(X==null)X=D.id;else if(D.id!==X){V.enqueue({part:D,partialOutput:void 0});return}if(D.type==="text-start"){V.enqueue({part:D,partialOutput:void 0});return}if(D.type==="text-end"){if(W.length>0)H({controller:V});V.enqueue({part:D,partialOutput:void 0});return}Y+=D.text,W+=D.text,J=(K=D.providerMetadata)!=null?K:J;let Q=await $.parsePartialOutput({text:Y});if(Q!==void 0){let q=JSON.stringify(Q.partial);if(q!==U)H({controller:V,partialOutput:Q.partial}),U=q}}})}async function ff({model:$,value:X,providerOptions:Y,maxRetries:W,abortSignal:J,headers:U,experimental_telemetry:H}){let D=Ff($),{maxRetries:V,retry:K}=dX({maxRetries:W,abortSignal:J}),Q=$4(U!=null?U:{},`ai/${cX}`),q=gJ({model:D,telemetry:H,headers:Q,settings:{maxRetries:V}}),F=mJ(H);return l1({name:"ai.embed",attributes:p6({telemetry:H,attributes:{...d1({operationId:"ai.embed",telemetry:H}),...q,"ai.value":{input:()=>JSON.stringify(X)}}}),tracer:F,fn:async(w)=>{let{embedding:z,usage:O,warnings:N,response:L,providerMetadata:P}=await K(()=>l1({name:"ai.embed.doEmbed",attributes:p6({telemetry:H,attributes:{...d1({operationId:"ai.embed.doEmbed",telemetry:H}),...q,"ai.values":{input:()=>[JSON.stringify(X)]}}}),tracer:F,fn:async(j)=>{var v;let y=await D.doEmbed({values:[X],abortSignal:J,headers:Q,providerOptions:Y}),E=y.embeddings[0],b=(v=y.usage)!=null?v:{tokens:NaN};return j.setAttributes(await p6({telemetry:H,attributes:{"ai.embeddings":{output:()=>y.embeddings.map((R)=>JSON.stringify(R))},"ai.usage.tokens":b.tokens}})),{embedding:E,usage:b,warnings:y.warnings,providerMetadata:y.providerMetadata,response:y.response}}}));return w.setAttributes(await p6({telemetry:H,attributes:{"ai.embedding":{output:()=>JSON.stringify(z)},"ai.usage.tokens":O.tokens}})),Y9({warnings:N,provider:D.provider,model:D.modelId}),new lJ$({value:X,embedding:z,usage:O,warnings:N,providerMetadata:P,response:L})}})}function Oy($,X){if(X<=0)throw Error("chunkSize must be greater than 0");let Y=[];for(let W=0;W<$.length;W+=X)Y.push($.slice(W,W+X));return Y}async function gf({model:$,values:X,maxParallelCalls:Y=1/0,maxRetries:W,abortSignal:J,headers:U,providerOptions:H,experimental_telemetry:D}){let V=Ff($),{maxRetries:K,retry:Q}=dX({maxRetries:W,abortSignal:J}),q=$4(U!=null?U:{},`ai/${cX}`),F=gJ({model:V,telemetry:D,headers:q,settings:{maxRetries:K}}),w=mJ(D);return l1({name:"ai.embedMany",attributes:p6({telemetry:D,attributes:{...d1({operationId:"ai.embedMany",telemetry:D}),...F,"ai.values":{input:()=>X.map((z)=>JSON.stringify(z))}}}),tracer:w,fn:async(z)=>{var O;let[N,L]=await Promise.all([V.maxEmbeddingsPerCall,V.supportsParallelCalls]);if(N==null||N===1/0){let{embeddings:I,usage:d,warnings:k,response:t,providerMetadata:h}=await Q(()=>{return l1({name:"ai.embedMany.doEmbed",attributes:p6({telemetry:D,attributes:{...d1({operationId:"ai.embedMany.doEmbed",telemetry:D}),...F,"ai.values":{input:()=>X.map((f)=>JSON.stringify(f))}}}),tracer:w,fn:async(f)=>{var l;let o=await V.doEmbed({values:X,abortSignal:J,headers:q,providerOptions:H}),g=o.embeddings,a=(l=o.usage)!=null?l:{tokens:NaN};return f.setAttributes(await p6({telemetry:D,attributes:{"ai.embeddings":{output:()=>g.map((Y$)=>JSON.stringify(Y$))},"ai.usage.tokens":a.tokens}})),{embeddings:g,usage:a,warnings:o.warnings,providerMetadata:o.providerMetadata,response:o.response}}})});return z.setAttributes(await p6({telemetry:D,attributes:{"ai.embeddings":{output:()=>I.map((f)=>JSON.stringify(f))},"ai.usage.tokens":d.tokens}})),Y9({warnings:k,provider:V.provider,model:V.modelId}),new Ny({values:X,embeddings:I,usage:d,warnings:k,providerMetadata:h,responses:[t]})}let P=Oy(X,N),j=[],v=[],y=[],E=0,b,R=Oy(P,L?Y:1);for(let I of R){let d=await Promise.all(I.map((k)=>{return Q(()=>{return l1({name:"ai.embedMany.doEmbed",attributes:p6({telemetry:D,attributes:{...d1({operationId:"ai.embedMany.doEmbed",telemetry:D}),...F,"ai.values":{input:()=>k.map((t)=>JSON.stringify(t))}}}),tracer:w,fn:async(t)=>{var h;let f=await V.doEmbed({values:k,abortSignal:J,headers:q,providerOptions:H}),l=f.embeddings,o=(h=f.usage)!=null?h:{tokens:NaN};return t.setAttributes(await p6({telemetry:D,attributes:{"ai.embeddings":{output:()=>l.map((g)=>JSON.stringify(g))},"ai.usage.tokens":o.tokens}})),{embeddings:l,usage:o,warnings:f.warnings,providerMetadata:f.providerMetadata,response:f.response}}})})}));for(let k of d)if(j.push(...k.embeddings),v.push(...k.warnings),y.push(k.response),E+=k.usage.tokens,k.providerMetadata)if(!b)b={...k.providerMetadata};else for(let[t,h]of Object.entries(k.providerMetadata))b[t]={...(O=b[t])!=null?O:{},...h}}return z.setAttributes(await p6({telemetry:D,attributes:{"ai.embeddings":{output:()=>j.map((I)=>JSON.stringify(I))},"ai.usage.tokens":E}})),Y9({warnings:v,provider:V.provider,model:V.modelId}),new Ny({values:X,embeddings:j,usage:{tokens:E},warnings:v,providerMetadata:b,responses:y})}})}async function WO({model:$,prompt:X,n:Y=1,maxImagesPerCall:W,size:J,aspectRatio:U,seed:H,providerOptions:D,maxRetries:V,abortSignal:K,headers:Q}){var q,F;let w=dY$($),z=$4(Q!=null?Q:{},`ai/${cX}`),{retry:O}=dX({maxRetries:V,abortSignal:K}),N=(q=W!=null?W:await rJ$(w))!=null?q:1,L=Math.ceil(Y/N),P=Array.from({length:L},(I,d)=>{if(d<L-1)return N;let k=Y%N;return k===0?N:k}),j=await Promise.all(P.map(async(I)=>O(()=>{let{prompt:d,files:k,mask:t}=nJ$(X);return w.doGenerate({prompt:d,files:k,mask:t,n:I,abortSignal:K,headers:z,size:J,aspectRatio:U,seed:H,providerOptions:D!=null?D:{}})}))),v=[],y=[],E=[],b={},R={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0};for(let I of j){if(v.push(...I.images.map((d)=>{var k;return new YO({data:d,mediaType:(k=uG({data:d,signatures:mG}))!=null?k:"image/png"})})),y.push(...I.warnings),I.usage!=null)R=ZJ$(R,I.usage);if(I.providerMetadata)for(let[d,k]of Object.entries(I.providerMetadata))if(d==="gateway"){let t=b[d];if(t!=null&&typeof t==="object")b[d]={...t,...k};else b[d]=k;let h=b[d].images;if(Array.isArray(h)&&h.length===0)delete b[d].images}else(F=b[d])!=null||(b[d]={images:[]}),b[d].images.push(...I.providerMetadata[d].images);E.push(I.response)}if(Y9({warnings:y,provider:w.provider,model:w.modelId}),!v.length)throw new QY$({responses:E});return new iJ$({images:v,warnings:y,responses:E,providerMetadata:b,usage:R})}async function rJ$($){if(!($.maxImagesPerCall instanceof Function))return $.maxImagesPerCall;return $.maxImagesPerCall({modelId:$.modelId})}function nJ$($){if(typeof $==="string")return{prompt:$,files:void 0,mask:void 0};return{prompt:$.text,files:$.images.map(Ay),mask:$.mask?Ay($.mask):void 0}}function Ay($){if(typeof $==="string"&&$.startsWith("http"))return{type:"url",url:$};if(typeof $==="string"&&$.startsWith("data:")){let{mediaType:Y,base64Content:W}=Zf($);if(W!=null){let J=p4(W);return{type:"file",data:J,mediaType:Y||uG({data:J,signatures:mG})||"image/png"}}}let X=aY$($);return{type:"file",data:X,mediaType:uG({data:X,signatures:mG})||"image/png"}}function eJ$({output:$,schema:X,enumValues:Y}){switch($){case"object":return aJ$(P1(X));case"array":return sJ$(P1(X));case"enum":return tJ$(Y);case"no-schema":return oJ$;default:throw Error(`Unsupported output: ${$}`)}}async function By($,X,Y){let W=await d4({text:$});if(!W.success)throw new I1({message:"No object generated: could not parse the response.",cause:W.error,text:$,response:Y.response,usage:Y.usage,finishReason:Y.finishReason});let J=await X.validateFinalResult(W.value,{text:$,response:Y.response,usage:Y.usage});if(!J.success)throw new I1({message:"No object generated: response did not match schema.",cause:J.error,text:$,response:Y.response,usage:Y.usage,finishReason:Y.finishReason});return J.value}async function $2$($,X,Y,W){try{return await By($,X,W)}catch(J){if(Y!=null&&I1.isInstance(J)&&(f9.isInstance(J.cause)||K4.isInstance(J.cause))){let U=await Y({text:$,error:J.cause});if(U===null)throw J;return await By(U,X,W)}throw J}}function X2$({output:$,schema:X,schemaName:Y,schemaDescription:W,enumValues:J}){if($!=null&&$!=="object"&&$!=="array"&&$!=="enum"&&$!=="no-schema")throw new d6({parameter:"output",value:$,message:"Invalid output type."});if($==="no-schema"){if(X!=null)throw new d6({parameter:"schema",value:X,message:"Schema is not supported for no-schema output."});if(W!=null)throw new d6({parameter:"schemaDescription",value:W,message:"Schema description is not supported for no-schema output."});if(Y!=null)throw new d6({parameter:"schemaName",value:Y,message:"Schema name is not supported for no-schema output."});if(J!=null)throw new d6({parameter:"enumValues",value:J,message:"Enum values are not supported for no-schema output."})}if($==="object"){if(X==null)throw new d6({parameter:"schema",value:X,message:"Schema is required for object output."});if(J!=null)throw new d6({parameter:"enumValues",value:J,message:"Enum values are not supported for object output."})}if($==="array"){if(X==null)throw new d6({parameter:"schema",value:X,message:"Element schema is required for array output."});if(J!=null)throw new d6({parameter:"enumValues",value:J,message:"Enum values are not supported for array output."})}if($==="enum"){if(X!=null)throw new d6({parameter:"schema",value:X,message:"Schema is not supported for enum output."});if(W!=null)throw new d6({parameter:"schemaDescription",value:W,message:"Schema description is not supported for enum output."});if(Y!=null)throw new d6({parameter:"schemaName",value:Y,message:"Schema name is not supported for enum output."});if(J==null)throw new d6({parameter:"enumValues",value:J,message:"Enum values are required for enum output."});for(let U of J)if(typeof U!=="string")throw new d6({parameter:"enumValues",value:U,message:"Enum values must be strings."})}}async function mf($){let{model:X,output:Y="object",system:W,prompt:J,messages:U,maxRetries:H,abortSignal:D,headers:V,experimental_repairText:K,experimental_telemetry:Q,experimental_download:q,providerOptions:F,_internal:{generateId:w=Y2$,currentDate:z=()=>new Date}={},...O}=$,N=hJ(X),L="enum"in $?$.enum:void 0,{schema:P,schemaDescription:j,schemaName:v}="schema"in $?$:{};X2$({output:Y,schema:P,schemaName:v,schemaDescription:j,enumValues:L});let{maxRetries:y,retry:E}=dX({maxRetries:H,abortSignal:D}),b=eJ$({output:Y,schema:P,enumValues:L}),R=yJ(O),I=$4(V!=null?V:{},`ai/${cX}`),d=gJ({model:N,telemetry:Q,headers:I,settings:{...R,maxRetries:y}}),k=mJ(Q),t=await b.jsonSchema();try{return await l1({name:"ai.generateObject",attributes:p6({telemetry:Q,attributes:{...d1({operationId:"ai.generateObject",telemetry:Q}),...d,"ai.prompt":{input:()=>JSON.stringify({system:W,prompt:J,messages:U})},"ai.schema":t!=null?{input:()=>JSON.stringify(t)}:void 0,"ai.schema.name":v,"ai.schema.description":j,"ai.settings.output":b.type}}),tracer:k,fn:async(h)=>{var f;let l,o,g,a,Y$,_,V$,o$,T=await tz({system:W,prompt:J,messages:U}),B$=await sz({prompt:T,supportedUrls:await N.supportedUrls,download:q}),k$=await E(()=>l1({name:"ai.generateObject.doGenerate",attributes:p6({telemetry:Q,attributes:{...d1({operationId:"ai.generateObject.doGenerate",telemetry:Q}),...d,"ai.prompt.messages":{input:()=>$O(B$)},"gen_ai.system":N.provider,"gen_ai.request.model":N.modelId,"gen_ai.request.frequency_penalty":R.frequencyPenalty,"gen_ai.request.max_tokens":R.maxOutputTokens,"gen_ai.request.presence_penalty":R.presencePenalty,"gen_ai.request.temperature":R.temperature,"gen_ai.request.top_k":R.topK,"gen_ai.request.top_p":R.topP}}),tracer:k,fn:async(T$)=>{var H$,F$,P$,j$,U$,n,G$,S$;let v$=await N.doGenerate({responseFormat:{type:"json",schema:t,name:v,description:j},...yJ(O),prompt:B$,providerOptions:F,abortSignal:D,headers:I}),j6={id:(F$=(H$=v$.response)==null?void 0:H$.id)!=null?F$:w(),timestamp:(j$=(P$=v$.response)==null?void 0:P$.timestamp)!=null?j$:z(),modelId:(n=(U$=v$.response)==null?void 0:U$.modelId)!=null?n:N.modelId,headers:(G$=v$.response)==null?void 0:G$.headers,body:(S$=v$.response)==null?void 0:S$.body},q4=pz(v$.content),l4=uz(v$.content);if(q4===void 0)throw new I1({message:"No object generated: the model did not return a response.",response:j6,usage:pG(v$.usage),finishReason:v$.finishReason.unified});return T$.setAttributes(await p6({telemetry:Q,attributes:{"ai.response.finishReason":v$.finishReason.unified,"ai.response.object":{output:()=>q4},"ai.response.id":j6.id,"ai.response.model":j6.modelId,"ai.response.timestamp":j6.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(v$.providerMetadata),"ai.usage.promptTokens":v$.usage.inputTokens.total,"ai.usage.completionTokens":v$.usage.outputTokens.total,"gen_ai.response.finish_reasons":[v$.finishReason.unified],"gen_ai.response.id":j6.id,"gen_ai.response.model":j6.modelId,"gen_ai.usage.input_tokens":v$.usage.inputTokens.total,"gen_ai.usage.output_tokens":v$.usage.outputTokens.total}})),{...v$,objectText:q4,reasoning:l4,responseData:j6}}}));l=k$.objectText,o=k$.finishReason.unified,g=pG(k$.usage),a=k$.warnings,V$=k$.providerMetadata,_=(f=k$.request)!=null?f:{},Y$=k$.responseData,o$=k$.reasoning,Y9({warnings:a,provider:N.provider,model:N.modelId});let m=await $2$(l,b,K,{response:Y$,usage:g,finishReason:o});return h.setAttributes(await p6({telemetry:Q,attributes:{"ai.response.finishReason":o,"ai.response.object":{output:()=>JSON.stringify(m)},"ai.response.providerMetadata":JSON.stringify(V$),"ai.usage.promptTokens":g.inputTokens,"ai.usage.completionTokens":g.outputTokens}})),new J2$({object:m,reasoning:o$,finishReason:o,usage:g,warnings:a,request:_,response:Y$,providerMetadata:V$})}})}catch(h){throw ez(h)}}function uf($){return({url:X,abortSignal:Y})=>wf({url:X,maxBytes:$==null?void 0:$.maxBytes,abortSignal:Y})}var jf,pX,t7$,e7$=($,X)=>{for(var Y in X)t7$($,Y,{get:X[Y],enumerable:!0})},My="AI_InvalidArgumentError",jy,$Y$,Ry,d6,XY$="AI_InvalidStreamPartError",YY$,JY$,WY$,Ly="AI_InvalidToolApprovalError",Ey,UY$,Py,GY$,Iy="AI_InvalidToolInputError",_y,HY$,Ty,lz,Cy="AI_ToolCallNotFoundForApprovalError",Sy,DY$,by,iz,xy="AI_MissingToolResultsError",ky,VY$,vy,Uy,hy="AI_NoImageGeneratedError",yy,KY$,fy,QY$,gy="AI_NoObjectGeneratedError",my,FY$,uy,I1,py="AI_NoOutputGeneratedError",cy,qY$,dy,ly,wY$="AI_NoSpeechGeneratedError",ZY$,zY$,OY$,NY$="AI_NoTranscriptGeneratedError",AY$,BY$,MY$,jY$="AI_NoVideoGeneratedError",RY$,LY$,EY$,iy="AI_NoSuchToolError",ry,PY$,ny,mz,oy="AI_ToolCallRepairError",ay,IY$,sy,_Y$,rz,ty="AI_UIMessageStreamError",ey,TY$,$f,mX,Xf="AI_InvalidDataContentError",Yf,CY$,Jf,Gy,Wf="AI_InvalidMessageRoleError",Uf,SY$,Gf,bY$,xY$="AI_MessageConversionError",kY$,vY$,hY$,Hf="AI_RetryError",Df,yY$,Vf,Hy,gY$="AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.",Dy=!1,Y9=($)=>{if($.warnings.length===0)return;let X=globalThis.AI_SDK_LOG_WARNINGS;if(X===!1)return;if(typeof X==="function"){X($);return}if(!Dy)Dy=!0,console.info(gY$);for(let Y of $.warnings)console.warn(fY$({warning:Y,provider:$.provider,model:$.model}))},mG,iY$=($)=>{let X=typeof $==="string"?p4($):$,Y=(X[6]&127)<<21|(X[7]&127)<<14|(X[8]&127)<<7|X[9]&127;return X.slice(Y+10)},cX="6.0.116",wf=async({url:$,maxBytes:X,abortSignal:Y})=>{var W;let J=$.toString();MZ(J);try{let U=await fetch(J,{headers:$4({},`ai-sdk/${cX}`,jG()),signal:Y});if(!U.ok)throw new t4({url:J,statusCode:U.status,statusText:U.statusText});return{data:await BZ({response:U,url:J,maxBytes:X!=null?X:MG}),mediaType:(W=U.headers.get("content-type"))!=null?W:void 0}}catch(U){if(t4.isInstance(U))throw U;throw new t4({url:J,cause:U})}},nY$=($=wf)=>(X)=>Promise.all(X.map(async(Y)=>Y.isUrlSupportedByModel?null:$(Y))),zf,fJ,g$,Af,XJ$,Bf,YJ$,JJ$,WJ$,Mf,UJ$,GJ$,HJ$,DJ$,VJ$,KJ$,QJ$,FJ$,fG,qJ$,OJ$=({maxRetries:$=2,initialDelayInMs:X=2000,backoffFactor:Y=2,abortSignal:W}={})=>async(J)=>Pf(J,{maxRetries:$,delayInMs:X,backoffFactor:Y,abortSignal:W}),YO=class{constructor({data:$,mediaType:X}){let Y=$ instanceof Uint8Array;this.base64Data=Y?void 0:$,this.uint8ArrayData=Y?$:void 0,this.mediaType=X}get base64(){if(this.base64Data==null)this.base64Data=p1(this.uint8ArrayData);return this.base64Data}get uint8Array(){if(this.uint8ArrayData==null)this.uint8ArrayData=p4(this.base64Data);return this.uint8ArrayData}},NJ$,AJ$,cG=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:$}){return $},async parsePartialOutput({text:$}){return{partial:$}},createElementStreamTransform(){return}}),MJ$=({schema:$,name:X,description:Y})=>{let W=P1($);return{name:"object",responseFormat:B6(W.jsonSchema).then((J)=>({type:"json",schema:J,...X!=null&&{name:X},...Y!=null&&{description:Y}})),async parseCompleteOutput({text:J},U){let H=await d4({text:J});if(!H.success)throw new I1({message:"No object generated: could not parse the response.",cause:H.error,text:J,response:U.response,usage:U.usage,finishReason:U.finishReason});let D=await F4({value:H.value,schema:W});if(!D.success)throw new I1({message:"No object generated: response did not match schema.",cause:D.error,text:J,response:U.response,usage:U.usage,finishReason:U.finishReason});return D.value},async parsePartialOutput({text:J}){let U=await uJ(J);switch(U.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:U.value}}},createElementStreamTransform(){return}}},jJ$=({element:$,name:X,description:Y})=>{let W=P1($);return{name:"array",responseFormat:B6(W.jsonSchema).then((J)=>{let{$schema:U,...H}=J;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:H}},required:["elements"],additionalProperties:!1},...X!=null&&{name:X},...Y!=null&&{description:Y}}}),async parseCompleteOutput({text:J},U){let H=await d4({text:J});if(!H.success)throw new I1({message:"No object generated: could not parse the response.",cause:H.error,text:J,response:U.response,usage:U.usage,finishReason:U.finishReason});let D=H.value;if(D==null||typeof D!=="object"||!("elements"in D)||!Array.isArray(D.elements))throw new I1({message:"No object generated: response did not match schema.",cause:new K4({value:D,cause:"response must be an object with an elements array"}),text:J,response:U.response,usage:U.usage,finishReason:U.finishReason});for(let V of D.elements){let K=await F4({value:V,schema:W});if(!K.success)throw new I1({message:"No object generated: response did not match schema.",cause:K.error,text:J,response:U.response,usage:U.usage,finishReason:U.finishReason})}return D.elements},async parsePartialOutput({text:J}){let U=await uJ(J);switch(U.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let H=U.value;if(H==null||typeof H!=="object"||!("elements"in H)||!Array.isArray(H.elements))return;let D=U.state==="repaired-parse"&&H.elements.length>0?H.elements.slice(0,-1):H.elements,V=[];for(let K of D){let Q=await F4({value:K,schema:W});if(Q.success)V.push(Q.value)}return{partial:V}}}},createElementStreamTransform(){let J=0;return new TransformStream({transform({partialOutput:U},H){if(U!=null)for(;J<U.length;J++)H.enqueue(U[J])}})}}},RJ$=({options:$,name:X,description:Y})=>{return{name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:$}},required:["result"],additionalProperties:!1},...X!=null&&{name:X},...Y!=null&&{description:Y}}),async parseCompleteOutput({text:W},J){let U=await d4({text:W});if(!U.success)throw new I1({message:"No object generated: could not parse the response.",cause:U.error,text:W,response:J.response,usage:J.usage,finishReason:J.finishReason});let H=U.value;if(H==null||typeof H!=="object"||!("result"in H)||typeof H.result!=="string"||!$.includes(H.result))throw new I1({message:"No object generated: response did not match schema.",cause:new K4({value:H,cause:"response must be an object that contains a choice value."}),text:W,response:J.response,usage:J.usage,finishReason:J.finishReason});return H.result},async parsePartialOutput({text:W}){let J=await uJ(W);switch(J.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let U=J.value;if(U==null||typeof U!=="object"||!("result"in U)||typeof U.result!=="string")return;let H=$.filter((D)=>D.startsWith(U.result));if(J.state==="successful-parse")return H.includes(U.result)?{partial:U.result}:void 0;else return H.length===1?{partial:H[0]}:void 0}}},createElementStreamTransform(){return}}},LJ$=({name:$,description:X}={})=>{return{name:"json",responseFormat:Promise.resolve({type:"json",...$!=null&&{name:$},...X!=null&&{description:X}}),async parseCompleteOutput({text:Y},W){let J=await d4({text:Y});if(!J.success)throw new I1({message:"No object generated: could not parse the response.",cause:J.error,text:Y,response:W.response,usage:W.usage,finishReason:W.finishReason});return J.value},async parsePartialOutput({text:Y}){let W=await uJ(Y);switch(W.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return W.value===void 0?void 0:{partial:W.value}}},createElementStreamTransform(){return}}},Sf=class{constructor({stepNumber:$,model:X,functionId:Y,metadata:W,experimental_context:J,content:U,finishReason:H,rawFinishReason:D,usage:V,warnings:K,request:Q,response:q,providerMetadata:F}){this.stepNumber=$,this.model=X,this.functionId=Y,this.metadata=W,this.experimental_context=J,this.content=U,this.finishReason=H,this.rawFinishReason=D,this.usage=V,this.warnings=K,this.request=Q,this.response=q,this.providerMetadata=F}get text(){return this.content.filter(($)=>$.type==="text").map(($)=>$.text).join("")}get reasoning(){return this.content.filter(($)=>$.type==="reasoning")}get reasoningText(){return this.reasoning.length===0?void 0:this.reasoning.map(($)=>$.text).join("")}get files(){return this.content.filter(($)=>$.type==="file").map(($)=>$.file)}get sources(){return this.content.filter(($)=>$.type==="source")}get toolCalls(){return this.content.filter(($)=>$.type==="tool-call")}get staticToolCalls(){return this.toolCalls.filter(($)=>$.dynamic!==!0)}get dynamicToolCalls(){return this.toolCalls.filter(($)=>$.dynamic===!0)}get toolResults(){return this.content.filter(($)=>$.type==="tool-result")}get staticToolResults(){return this.toolResults.filter(($)=>$.dynamic!==!0)}get dynamicToolResults(){return this.toolResults.filter(($)=>$.dynamic===!0)}},EJ$,PJ$=class{constructor($){this.steps=$.steps,this._output=$.output,this.totalUsage=$.totalUsage}get finalStep(){return this.steps[this.steps.length-1]}get content(){return this.finalStep.content}get text(){return this.finalStep.text}get files(){return this.finalStep.files}get reasoningText(){return this.finalStep.reasoningText}get reasoning(){return this.finalStep.reasoning}get toolCalls(){return this.finalStep.toolCalls}get staticToolCalls(){return this.finalStep.staticToolCalls}get dynamicToolCalls(){return this.finalStep.dynamicToolCalls}get toolResults(){return this.finalStep.toolResults}get staticToolResults(){return this.finalStep.staticToolResults}get dynamicToolResults(){return this.finalStep.dynamicToolResults}get sources(){return this.finalStep.sources}get finishReason(){return this.finalStep.finishReason}get rawFinishReason(){return this.finalStep.rawFinishReason}get warnings(){return this.finalStep.warnings}get providerMetadata(){return this.finalStep.providerMetadata}get response(){return this.finalStep.response}get request(){return this.finalStep.request}get usage(){return this.finalStep.usage}get experimental_output(){return this.output}get output(){if(this._output==null)throw new ly;return this._output}},vf,hf,Qp$,uJ$,dJ$=class{constructor({model:$,telemetry:X,headers:Y,settings:W,maxRetries:J,abortSignal:U,stepTimeoutMs:H,stepAbortController:D,chunkTimeoutMs:V,chunkAbortController:K,system:Q,prompt:q,messages:F,tools:w,toolChoice:z,transforms:O,activeTools:N,repairToolCall:L,stopConditions:P,output:j,providerOptions:v,prepareStep:y,includeRawChunks:E,now:b,generateId:R,timeout:I,stopWhen:d,originalAbortSignal:k,onChunk:t,onError:h,onFinish:f,onAbort:l,onStepFinish:o,onStart:g,onStepStart:a,onToolCallStart:Y$,onToolCallFinish:_,experimental_context:V$,download:o$,include:T}){this._totalUsage=new n9,this._finishReason=new n9,this._rawFinishReason=new n9,this._steps=new n9,this.outputSpecification=j,this.includeRawChunks=E,this.tools=w;let k$=Lf()(X==null?void 0:X.integrations),m,T$=[],H$=[],F$=void 0,P$=void 0,j$=void 0,U$={},n=[],G$=[],S$=new Map,v$,j6={},q4={},l4=new TransformStream({async transform(Q6,m$){var O6,u$,N6,u6;m$.enqueue(Q6);let{part:D$}=Q6;if(D$.type==="text-delta"||D$.type==="reasoning-delta"||D$.type==="source"||D$.type==="tool-call"||D$.type==="tool-result"||D$.type==="tool-input-start"||D$.type==="tool-input-delta"||D$.type==="raw")await(t==null?void 0:t({chunk:D$}));if(D$.type==="error")await h({error:ez(D$.error)});if(D$.type==="text-start")j6[D$.id]={type:"text",text:"",providerMetadata:D$.providerMetadata},T$.push(j6[D$.id]);if(D$.type==="text-delta"){let K6=j6[D$.id];if(K6==null){m$.enqueue({part:{type:"error",error:`text part ${D$.id} not found`},partialOutput:void 0});return}K6.text+=D$.text,K6.providerMetadata=(O6=D$.providerMetadata)!=null?O6:K6.providerMetadata}if(D$.type==="text-end"){let K6=j6[D$.id];if(K6==null){m$.enqueue({part:{type:"error",error:`text part ${D$.id} not found`},partialOutput:void 0});return}K6.providerMetadata=(u$=D$.providerMetadata)!=null?u$:K6.providerMetadata,delete j6[D$.id]}if(D$.type==="reasoning-start")q4[D$.id]={type:"reasoning",text:"",providerMetadata:D$.providerMetadata},T$.push(q4[D$.id]);if(D$.type==="reasoning-delta"){let K6=q4[D$.id];if(K6==null){m$.enqueue({part:{type:"error",error:`reasoning part ${D$.id} not found`},partialOutput:void 0});return}K6.text+=D$.text,K6.providerMetadata=(N6=D$.providerMetadata)!=null?N6:K6.providerMetadata}if(D$.type==="reasoning-end"){let K6=q4[D$.id];if(K6==null){m$.enqueue({part:{type:"error",error:`reasoning part ${D$.id} not found`},partialOutput:void 0});return}K6.providerMetadata=(u6=D$.providerMetadata)!=null?u6:K6.providerMetadata,delete q4[D$.id]}if(D$.type==="file")T$.push({type:"file",file:D$.file,...D$.providerMetadata!=null?{providerMetadata:D$.providerMetadata}:{}});if(D$.type==="source")T$.push(D$);if(D$.type==="tool-call")T$.push(D$);if(D$.type==="tool-result"&&!D$.preliminary)T$.push(D$);if(D$.type==="tool-approval-request")T$.push(D$);if(D$.type==="tool-error")T$.push(D$);if(D$.type==="start-step")T$=[],q4={},j6={},U$=D$.request,n=D$.warnings;if(D$.type==="finish-step"){let K6=await cz({content:T$,tools:w}),i1=new Sf({stepNumber:G$.length,model:i$,...w6,experimental_context:V$,content:T$,finishReason:D$.finishReason,rawFinishReason:D$.rawFinishReason,usage:D$.usage,warnings:n,request:U$,response:{...D$.response,messages:[...H$,...K6]},providerMetadata:D$.providerMetadata});await Z0({event:i1,callbacks:[o,k$.onStepFinish]}),Y9({warnings:n,provider:i$.provider,model:i$.modelId}),G$.push(i1),H$.push(...K6),m.resolve()}if(D$.type==="finish")j$=D$.totalUsage,F$=D$.finishReason,P$=D$.rawFinishReason},async flush(Q6){try{if(G$.length===0){let N6=(U==null?void 0:U.aborted)?U.reason:new ly({message:"No output generated. Check the stream for errors."});z$._finishReason.reject(N6),z$._rawFinishReason.reject(N6),z$._totalUsage.reject(N6),z$._steps.reject(N6);return}let m$=F$!=null?F$:"other",O6=j$!=null?j$:gz();z$._finishReason.resolve(m$),z$._rawFinishReason.resolve(P$),z$._totalUsage.resolve(O6),z$._steps.resolve(G$);let u$=G$[G$.length-1];await Z0({event:{stepNumber:u$.stepNumber,model:u$.model,functionId:u$.functionId,metadata:u$.metadata,experimental_context:u$.experimental_context,finishReason:u$.finishReason,rawFinishReason:u$.rawFinishReason,totalUsage:O6,usage:u$.usage,content:u$.content,text:u$.text,reasoningText:u$.reasoningText,reasoning:u$.reasoning,files:u$.files,sources:u$.sources,toolCalls:u$.toolCalls,staticToolCalls:u$.staticToolCalls,dynamicToolCalls:u$.dynamicToolCalls,toolResults:u$.toolResults,staticToolResults:u$.staticToolResults,dynamicToolResults:u$.dynamicToolResults,request:u$.request,response:u$.response,warnings:u$.warnings,providerMetadata:u$.providerMetadata,steps:G$},callbacks:[f,k$.onFinish]}),v$.setAttributes(await p6({telemetry:X,attributes:{"ai.response.finishReason":m$,"ai.response.text":{output:()=>u$.text},"ai.response.reasoning":{output:()=>u$.reasoningText},"ai.response.toolCalls":{output:()=>{var N6;return((N6=u$.toolCalls)==null?void 0:N6.length)?JSON.stringify(u$.toolCalls):void 0}},"ai.response.providerMetadata":JSON.stringify(u$.providerMetadata),"ai.usage.inputTokens":O6.inputTokens,"ai.usage.outputTokens":O6.outputTokens,"ai.usage.totalTokens":O6.totalTokens,"ai.usage.reasoningTokens":O6.reasoningTokens,"ai.usage.cachedInputTokens":O6.cachedInputTokens}}))}catch(m$){Q6.error(m$)}finally{v$.end()}}}),$1=gJ$();this.addStream=$1.addStream,this.closeStream=$1.close;let C=$1.stream.getReader(),w$=new ReadableStream({async start(Q6){Q6.enqueue({type:"start"})},async pull(Q6){function m$(){l==null||l({steps:G$}),Q6.enqueue({type:"abort",...(U==null?void 0:U.reason)!==void 0?{reason:F0(U.reason)}:{}}),Q6.close()}try{let{done:O6,value:u$}=await C.read();if(O6){Q6.close();return}if(U==null?void 0:U.aborted){m$();return}Q6.enqueue(u$)}catch(O6){if(B8(O6)&&(U==null?void 0:U.aborted))m$();else Q6.error(O6)}},cancel(Q6){return $1.stream.cancel(Q6)}});for(let Q6 of O)w$=w$.pipeThrough(Q6({tools:w,stopStream(){$1.terminate()}}));this.baseStream=w$.pipeThrough(cJ$(j!=null?j:cG())).pipeThrough(l4);let{maxRetries:f6,retry:N4}=dX({maxRetries:J,abortSignal:U}),F1=mJ(X),i=yJ(W),s=gJ({model:$,telemetry:X,headers:Y,settings:{...i,maxRetries:f6}}),z$=this,i$={provider:$.provider,modelId:$.modelId},w6={functionId:X==null?void 0:X.functionId,metadata:X==null?void 0:X.metadata};l1({name:"ai.streamText",attributes:p6({telemetry:X,attributes:{...d1({operationId:"ai.streamText",telemetry:X}),...s,"ai.prompt":{input:()=>JSON.stringify({system:Q,prompt:q,messages:F})}}}),tracer:F1,endWhenDone:!1,fn:async(Q6)=>{v$=Q6;let m$=await tz({system:Q,prompt:q,messages:F});await Z0({event:{model:i$,system:Q,prompt:q,messages:F,tools:w,toolChoice:z,activeTools:N,maxOutputTokens:i.maxOutputTokens,temperature:i.temperature,topP:i.topP,topK:i.topK,presencePenalty:i.presencePenalty,frequencyPenalty:i.frequencyPenalty,stopSequences:i.stopSequences,seed:i.seed,maxRetries:f6,timeout:I,headers:Y,providerOptions:v,stopWhen:d,output:j,abortSignal:k,include:T,...w6,experimental_context:V$},callbacks:[g,k$.onStart]});let O6=m$.messages,u$=[],{approvedToolApprovals:N6,deniedToolApprovals:u6}=If({messages:O6});if(u6.length>0||N6.length>0){let K6=[...N6,...u6].filter((a6)=>a6.toolCall.providerExecuted),i1=N6.filter((a6)=>!a6.toolCall.providerExecuted),c6=u6.filter((a6)=>!a6.toolCall.providerExecuted),A4=u6.filter((a6)=>a6.toolCall.providerExecuted),l$,x4=new ReadableStream({start(a6){l$=a6}});z$.addStream(x4);try{for(let B4 of[...c6,...A4])l$==null||l$.enqueue({type:"tool-output-denied",toolCallId:B4.toolCall.toolCallId,toolName:B4.toolCall.toolName});let a6=[];if(await Promise.all(i1.map(async(B4)=>{let l6=await XO({toolCall:B4.toolCall,tools:w,tracer:F1,telemetry:X,messages:O6,abortSignal:U,experimental_context:V$,stepNumber:G$.length,model:i$,onToolCallStart:[Y$,k$.onToolCallStart],onToolCallFinish:[_,k$.onToolCallFinish],onPreliminaryToolResult:(a0)=>{l$==null||l$.enqueue(a0)}});if(l6!=null)l$==null||l$.enqueue(l6),a6.push(l6)})),K6.length>0)u$.push({role:"tool",content:K6.map((B4)=>({type:"tool-approval-response",approvalId:B4.approvalResponse.approvalId,approved:B4.approvalResponse.approved,reason:B4.approvalResponse.reason,providerExecuted:!0}))});if(a6.length>0||c6.length>0){let B4=[];for(let l6 of a6)B4.push({type:"tool-result",toolCallId:l6.toolCallId,toolName:l6.toolName,output:await vJ({toolCallId:l6.toolCallId,input:l6.input,tool:w==null?void 0:w[l6.toolName],output:l6.type==="tool-result"?l6.output:l6.error,errorMode:l6.type==="tool-error"?"text":"none"})});for(let l6 of c6)B4.push({type:"tool-result",toolCallId:l6.toolCall.toolCallId,toolName:l6.toolCall.toolName,output:{type:"execution-denied",reason:l6.approvalResponse.reason}});u$.push({role:"tool",content:B4})}}finally{l$==null||l$.close()}}H$.push(...u$);async function D$({currentStep:K6,responseMessages:i1,usage:c6}){var A4,l$,x4,a6,B4,l6,a0,D5,X2;let Y2=z$.includeRawChunks,H7=H!=null?setTimeout(()=>D.abort(),H):void 0,T1=void 0;function D7(){if(V!=null){if(T1!=null)clearTimeout(T1);T1=setTimeout(()=>K.abort(),V)}}function J2(){if(T1!=null)clearTimeout(T1),T1=void 0}function V7(){if(H7!=null)clearTimeout(H7)}try{m=new n9;let P8=[...O6,...i1],J4=await(y==null?void 0:y({model:$,steps:G$,stepNumber:G$.length,messages:P8,experimental_context:V$})),A0=hJ((A4=J4==null?void 0:J4.model)!=null?A4:$),K7={provider:A0.provider,modelId:A0.modelId},G6=await sz({prompt:{system:(l$=J4==null?void 0:J4.system)!=null?l$:m$.system,messages:(x4=J4==null?void 0:J4.messages)!=null?x4:P8},supportedUrls:await A0.supportedUrls,download:o$}),k4=(a6=J4==null?void 0:J4.activeTools)!=null?a6:N,{toolChoice:I8,tools:s0}=await Nf({tools:w,toolChoice:(B4=J4==null?void 0:J4.toolChoice)!=null?B4:z,activeTools:k4});V$=(l6=J4==null?void 0:J4.experimental_context)!=null?l6:V$;let W2=(a0=J4==null?void 0:J4.messages)!=null?a0:P8,U2=(D5=J4==null?void 0:J4.system)!=null?D5:m$.system,Q7=dG(v,J4==null?void 0:J4.providerOptions);await Z0({event:{stepNumber:G$.length,model:K7,system:U2,messages:W2,tools:w,toolChoice:I8,activeTools:k4,steps:[...G$],providerOptions:Q7,timeout:I,headers:Y,stopWhen:d,output:j,abortSignal:k,include:T,...w6,experimental_context:V$},callbacks:[a,k$.onStepStart]});let{result:{stream:G2,response:F7,request:V5},doStreamSpan:i6,startTimestampMs:t0}=await N4(()=>l1({name:"ai.streamText.doStream",attributes:p6({telemetry:X,attributes:{...d1({operationId:"ai.streamText.doStream",telemetry:X}),...s,"ai.model.provider":A0.provider,"ai.model.id":A0.modelId,"ai.prompt.messages":{input:()=>$O(G6)},"ai.prompt.tools":{input:()=>s0==null?void 0:s0.map((p$)=>JSON.stringify(p$))},"ai.prompt.toolChoice":{input:()=>I8!=null?JSON.stringify(I8):void 0},"gen_ai.system":A0.provider,"gen_ai.request.model":A0.modelId,"gen_ai.request.frequency_penalty":i.frequencyPenalty,"gen_ai.request.max_tokens":i.maxOutputTokens,"gen_ai.request.presence_penalty":i.presencePenalty,"gen_ai.request.stop_sequences":i.stopSequences,"gen_ai.request.temperature":i.temperature,"gen_ai.request.top_k":i.topK,"gen_ai.request.top_p":i.topP}}),tracer:F1,endWhenDone:!1,fn:async(p$)=>({startTimestampMs:b(),doStreamSpan:p$,result:await A0.doStream({...i,tools:s0,toolChoice:I8,responseFormat:await(j==null?void 0:j.responseFormat),prompt:G6,providerOptions:Q7,abortSignal:U,headers:Y,includeRawChunks:Y2})})})),H2=mJ$({tools:w,generatorStream:G2,tracer:F1,telemetry:X,system:Q,messages:P8,repairToolCall:L,abortSignal:U,experimental_context:V$,generateId:R,stepNumber:G$.length,model:K7,onToolCallStart:[Y$,k$.onToolCallStart],onToolCallFinish:[_,k$.onToolCallFinish]}),Wp=((X2=T==null?void 0:T.requestBody)!=null?X2:!0)?V5!=null?V5:{}:{...V5,body:void 0},q7=[],w7=[],VH,KH={},K5="other",QH=void 0,r1=gz(),FH,aO=!0,B0={id:R(),timestamp:new Date,modelId:i$.modelId},sO="";z$.addStream(H2.pipeThrough(new TransformStream({async transform(p$,P4){var Z7,z7,D2,s6,M0;if(D7(),p$.type==="stream-start"){VH=p$.warnings;return}if(aO){let W4=b()-t0;aO=!1,i6.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":W4}),i6.setAttributes({"ai.response.msToFirstChunk":W4}),P4.enqueue({type:"start-step",request:Wp,warnings:VH!=null?VH:[]})}let qH=p$.type;switch(qH){case"tool-approval-request":case"text-start":case"text-end":{P4.enqueue(p$);break}case"text-delta":{if(p$.delta.length>0)P4.enqueue({type:"text-delta",id:p$.id,text:p$.delta,providerMetadata:p$.providerMetadata}),sO+=p$.delta;break}case"reasoning-start":case"reasoning-end":{P4.enqueue(p$);break}case"reasoning-delta":{P4.enqueue({type:"reasoning-delta",id:p$.id,text:p$.delta,providerMetadata:p$.providerMetadata});break}case"tool-call":{P4.enqueue(p$),q7.push(p$);break}case"tool-result":{if(P4.enqueue(p$),!p$.preliminary)w7.push(p$);break}case"tool-error":{P4.enqueue(p$),w7.push(p$);break}case"response-metadata":{B0={id:(Z7=p$.id)!=null?Z7:B0.id,timestamp:(z7=p$.timestamp)!=null?z7:B0.timestamp,modelId:(D2=p$.modelId)!=null?D2:B0.modelId};break}case"finish":{r1=p$.usage,K5=p$.finishReason,QH=p$.rawFinishReason,FH=p$.providerMetadata;let W4=b()-t0;i6.addEvent("ai.stream.finish"),i6.setAttributes({"ai.response.msToFinish":W4,"ai.response.avgOutputTokensPerSecond":1000*((s6=r1.outputTokens)!=null?s6:0)/W4});break}case"file":{P4.enqueue(p$);break}case"source":{P4.enqueue(p$);break}case"tool-input-start":{KH[p$.id]=p$.toolName;let W4=w==null?void 0:w[p$.toolName];if((W4==null?void 0:W4.onInputStart)!=null)await W4.onInputStart({toolCallId:p$.id,messages:P8,abortSignal:U,experimental_context:V$});P4.enqueue({...p$,dynamic:(M0=p$.dynamic)!=null?M0:(W4==null?void 0:W4.type)==="dynamic",title:W4==null?void 0:W4.title});break}case"tool-input-end":{delete KH[p$.id],P4.enqueue(p$);break}case"tool-input-delta":{let W4=KH[p$.id],wH=w==null?void 0:w[W4];if((wH==null?void 0:wH.onInputDelta)!=null)await wH.onInputDelta({inputTextDelta:p$.delta,toolCallId:p$.id,messages:P8,abortSignal:U,experimental_context:V$});P4.enqueue(p$);break}case"error":{P4.enqueue(p$),K5="error";break}case"raw":{if(Y2)P4.enqueue(p$);break}default:throw Error(`Unknown chunk type: ${qH}`)}},async flush(p$){let P4=q7.length>0?JSON.stringify(q7):void 0;try{i6.setAttributes(await p6({telemetry:X,attributes:{"ai.response.finishReason":K5,"ai.response.text":{output:()=>sO},"ai.response.reasoning":{output:()=>{let s6=T$.filter((M0)=>M0.type==="reasoning");return s6.length>0?s6.map((M0)=>M0.text).join(`
286
- `):void 0}},"ai.response.toolCalls":{output:()=>P4},"ai.response.id":B0.id,"ai.response.model":B0.modelId,"ai.response.timestamp":B0.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(FH),"ai.usage.inputTokens":r1.inputTokens,"ai.usage.outputTokens":r1.outputTokens,"ai.usage.totalTokens":r1.totalTokens,"ai.usage.reasoningTokens":r1.reasoningTokens,"ai.usage.cachedInputTokens":r1.cachedInputTokens,"gen_ai.response.finish_reasons":[K5],"gen_ai.response.id":B0.id,"gen_ai.response.model":B0.modelId,"gen_ai.usage.input_tokens":r1.inputTokens,"gen_ai.usage.output_tokens":r1.outputTokens}}))}catch(s6){}finally{i6.end()}p$.enqueue({type:"finish-step",finishReason:K5,rawFinishReason:QH,usage:r1,providerMetadata:FH,response:{...B0,headers:F7==null?void 0:F7.headers}});let Z7=Ef(c6,r1);await m.promise;let z7=q7.filter((s6)=>s6.providerExecuted!==!0),D2=w7.filter((s6)=>s6.providerExecuted!==!0);for(let s6 of q7){if(s6.providerExecuted!==!0)continue;let M0=w==null?void 0:w[s6.toolName];if((M0==null?void 0:M0.type)==="provider"&&M0.supportsDeferredResults){if(!w7.some((W4)=>(W4.type==="tool-result"||W4.type==="tool-error")&&W4.toolCallId===s6.toolCallId))S$.set(s6.toolCallId,{toolName:s6.toolName})}}for(let s6 of w7)if(s6.type==="tool-result"||s6.type==="tool-error")S$.delete(s6.toolCallId);if(V7(),J2(),(z7.length>0&&D2.length===z7.length||S$.size>0)&&!await bf({stopConditions:P,steps:G$})){i1.push(...await cz({content:G$[G$.length-1].content,tools:w}));try{await D$({currentStep:K6+1,responseMessages:i1,usage:Z7})}catch(s6){p$.enqueue({type:"error",error:s6}),z$.closeStream()}}else p$.enqueue({type:"finish",finishReason:K5,rawFinishReason:QH,totalUsage:Z7}),z$.closeStream()}})))}finally{V7(),J2()}}await D$({currentStep:0,responseMessages:u$,usage:gz()})}}).catch((Q6)=>{z$.addStream(new ReadableStream({start(m$){m$.enqueue({type:"error",error:Q6}),m$.close()}})),z$.closeStream()})}get steps(){return this.consumeStream(),this._steps.promise}get finalStep(){return this.steps.then(($)=>$[$.length-1])}get content(){return this.finalStep.then(($)=>$.content)}get warnings(){return this.finalStep.then(($)=>$.warnings)}get providerMetadata(){return this.finalStep.then(($)=>$.providerMetadata)}get text(){return this.finalStep.then(($)=>$.text)}get reasoningText(){return this.finalStep.then(($)=>$.reasoningText)}get reasoning(){return this.finalStep.then(($)=>$.reasoning)}get sources(){return this.finalStep.then(($)=>$.sources)}get files(){return this.finalStep.then(($)=>$.files)}get toolCalls(){return this.finalStep.then(($)=>$.toolCalls)}get staticToolCalls(){return this.finalStep.then(($)=>$.staticToolCalls)}get dynamicToolCalls(){return this.finalStep.then(($)=>$.dynamicToolCalls)}get toolResults(){return this.finalStep.then(($)=>$.toolResults)}get staticToolResults(){return this.finalStep.then(($)=>$.staticToolResults)}get dynamicToolResults(){return this.finalStep.then(($)=>$.dynamicToolResults)}get usage(){return this.finalStep.then(($)=>$.usage)}get request(){return this.finalStep.then(($)=>$.request)}get response(){return this.finalStep.then(($)=>$.response)}get totalUsage(){return this.consumeStream(),this._totalUsage.promise}get finishReason(){return this.consumeStream(),this._finishReason.promise}get rawFinishReason(){return this.consumeStream(),this._rawFinishReason.promise}teeStream(){let[$,X]=this.baseStream.tee();return this.baseStream=X,$}get textStream(){return uX(this.teeStream().pipeThrough(new TransformStream({transform({part:$},X){if($.type==="text-delta")X.enqueue($.text)}})))}get fullStream(){return uX(this.teeStream().pipeThrough(new TransformStream({transform({part:$},X){X.enqueue($)}})))}async consumeStream($){var X;try{await fJ$({stream:this.fullStream,onError:$==null?void 0:$.onError})}catch(Y){(X=$==null?void 0:$.onError)==null||X.call($,Y)}}get experimental_partialOutputStream(){return this.partialOutputStream}get partialOutputStream(){return uX(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:$},X){if($!=null)X.enqueue($)}})))}get elementStream(){var $,X,Y;let W=($=this.outputSpecification)==null?void 0:$.createElementStreamTransform();if(W==null)throw new L6({functionality:`element streams in ${(Y=(X=this.outputSpecification)==null?void 0:X.name)!=null?Y:"text"} mode`});return uX(this.teeStream().pipeThrough(W))}get output(){return this.finalStep.then(($)=>{var X;return((X=this.outputSpecification)!=null?X:cG()).parseCompleteOutput({text:$.text},{response:$.response,usage:$.usage,finishReason:$.finishReason})})}toUIMessageStream({originalMessages:$,generateMessageId:X,onFinish:Y,messageMetadata:W,sendReasoning:J=!0,sendSources:U=!1,sendStart:H=!0,sendFinish:D=!0,onError:V=F0}={}){let K=X!=null?SJ$({originalMessages:$,responseMessageId:X}):void 0,Q=(F)=>{var w;let z=(w=this.tools)==null?void 0:w[F.toolName];if(z==null)return F.dynamic;return(z==null?void 0:z.type)==="dynamic"?!0:void 0},q=this.fullStream.pipeThrough(new TransformStream({transform:async(F,w)=>{let z=W==null?void 0:W({part:F}),O=F.type;switch(O){case"text-start":{w.enqueue({type:"text-start",id:F.id,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});break}case"text-delta":{w.enqueue({type:"text-delta",id:F.id,delta:F.text,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});break}case"text-end":{w.enqueue({type:"text-end",id:F.id,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});break}case"reasoning-start":{w.enqueue({type:"reasoning-start",id:F.id,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});break}case"reasoning-delta":{if(J)w.enqueue({type:"reasoning-delta",id:F.id,delta:F.text,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});break}case"reasoning-end":{w.enqueue({type:"reasoning-end",id:F.id,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});break}case"file":{w.enqueue({type:"file",mediaType:F.file.mediaType,url:`data:${F.file.mediaType};base64,${F.file.base64}`,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});break}case"source":{if(U&&F.sourceType==="url")w.enqueue({type:"source-url",sourceId:F.id,url:F.url,title:F.title,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});if(U&&F.sourceType==="document")w.enqueue({type:"source-document",sourceId:F.id,mediaType:F.mediaType,title:F.title,filename:F.filename,...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{}});break}case"tool-input-start":{let N=Q(F);w.enqueue({type:"tool-input-start",toolCallId:F.id,toolName:F.toolName,...F.providerExecuted!=null?{providerExecuted:F.providerExecuted}:{},...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{},...N!=null?{dynamic:N}:{},...F.title!=null?{title:F.title}:{}});break}case"tool-input-delta":{w.enqueue({type:"tool-input-delta",toolCallId:F.id,inputTextDelta:F.delta});break}case"tool-call":{let N=Q(F);if(F.invalid)w.enqueue({type:"tool-input-error",toolCallId:F.toolCallId,toolName:F.toolName,input:F.input,...F.providerExecuted!=null?{providerExecuted:F.providerExecuted}:{},...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{},...N!=null?{dynamic:N}:{},errorText:V(F.error),...F.title!=null?{title:F.title}:{}});else w.enqueue({type:"tool-input-available",toolCallId:F.toolCallId,toolName:F.toolName,input:F.input,...F.providerExecuted!=null?{providerExecuted:F.providerExecuted}:{},...F.providerMetadata!=null?{providerMetadata:F.providerMetadata}:{},...N!=null?{dynamic:N}:{},...F.title!=null?{title:F.title}:{}});break}case"tool-approval-request":{w.enqueue({type:"tool-approval-request",approvalId:F.approvalId,toolCallId:F.toolCall.toolCallId});break}case"tool-result":{let N=Q(F);w.enqueue({type:"tool-output-available",toolCallId:F.toolCallId,output:F.output,...F.providerExecuted!=null?{providerExecuted:F.providerExecuted}:{},...F.preliminary!=null?{preliminary:F.preliminary}:{},...N!=null?{dynamic:N}:{}});break}case"tool-error":{let N=Q(F);w.enqueue({type:"tool-output-error",toolCallId:F.toolCallId,errorText:V(F.error),...F.providerExecuted!=null?{providerExecuted:F.providerExecuted}:{},...N!=null?{dynamic:N}:{}});break}case"tool-output-denied":{w.enqueue({type:"tool-output-denied",toolCallId:F.toolCallId});break}case"error":{w.enqueue({type:"error",errorText:V(F.error)});break}case"start-step":{w.enqueue({type:"start-step"});break}case"finish-step":{w.enqueue({type:"finish-step"});break}case"start":{if(H)w.enqueue({type:"start",...z!=null?{messageMetadata:z}:{},...K!=null?{messageId:K}:{}});break}case"finish":{if(D)w.enqueue({type:"finish",finishReason:F.finishReason,...z!=null?{messageMetadata:z}:{}});break}case"abort":{w.enqueue(F);break}case"tool-input-end":break;case"raw":break;default:throw Error(`Unknown chunk type: ${O}`)}if(z!=null&&O!=="start"&&O!=="finish")w.enqueue({type:"message-metadata",messageMetadata:z})}}));return uX(hJ$({stream:q,messageId:K!=null?K:X==null?void 0:X(),originalMessages:$,onFinish:Y,onError:V}))}pipeUIMessageStreamToResponse($,{originalMessages:X,generateMessageId:Y,onFinish:W,messageMetadata:J,sendReasoning:U,sendSources:H,sendFinish:D,sendStart:V,onError:K,...Q}={}){yJ$({response:$,stream:this.toUIMessageStream({originalMessages:X,generateMessageId:Y,onFinish:W,messageMetadata:J,sendReasoning:U,sendSources:H,sendFinish:D,sendStart:V,onError:K}),...Q})}pipeTextStreamToResponse($,X){TJ$({response:$,textStream:this.textStream,...X})}toUIMessageStreamResponse({originalMessages:$,generateMessageId:X,onFinish:Y,messageMetadata:W,sendReasoning:J,sendSources:U,sendFinish:H,sendStart:D,onError:V,...K}={}){return CJ$({stream:this.toUIMessageStream({originalMessages:$,generateMessageId:X,onFinish:Y,messageMetadata:W,sendReasoning:J,sendSources:U,sendFinish:H,sendStart:D,onError:V}),...K})}toTextStreamResponse($){return _J$({textStream:this.textStream,...$})}},yf=class{constructor($){this.version="agent-v1",this.settings=$}get id(){return this.settings.id}get tools(){return this.settings.tools}async prepareCall($){var X,Y,W,J;let{experimental_onStart:U,experimental_onStepStart:H,experimental_onToolCallStart:D,experimental_onToolCallFinish:V,onStepFinish:K,onFinish:Q,...q}=this.settings,F={...q,stopWhen:(X=this.settings.stopWhen)!=null?X:pJ(20),...$},w=(J=await((W=(Y=this.settings).prepareCall)==null?void 0:W.call(Y,F)))!=null?J:F,{instructions:z,messages:O,prompt:N,...L}=w;return{...L,...{system:z,messages:O,prompt:N}}}mergeCallbacks($,X){if(X&&$)return async(Y)=>{await $(Y),await X(Y)};return X!=null?X:$}async generate({abortSignal:$,timeout:X,experimental_onStart:Y,experimental_onStepStart:W,experimental_onToolCallStart:J,experimental_onToolCallFinish:U,onStepFinish:H,onFinish:D,...V}){return JO({...await this.prepareCall(V),abortSignal:$,timeout:X,experimental_onStart:this.mergeCallbacks(this.settings.experimental_onStart,Y),experimental_onStepStart:this.mergeCallbacks(this.settings.experimental_onStepStart,W),experimental_onToolCallStart:this.mergeCallbacks(this.settings.experimental_onToolCallStart,J),experimental_onToolCallFinish:this.mergeCallbacks(this.settings.experimental_onToolCallFinish,U),onStepFinish:this.mergeCallbacks(this.settings.onStepFinish,H),onFinish:this.mergeCallbacks(this.settings.onFinish,D)})}async stream({abortSignal:$,timeout:X,experimental_transform:Y,experimental_onStart:W,experimental_onStepStart:J,experimental_onToolCallStart:U,experimental_onToolCallFinish:H,onStepFinish:D,onFinish:V,...K}){return pJ$({...await this.prepareCall(K),abortSignal:$,timeout:X,experimental_transform:Y,experimental_onStart:this.mergeCallbacks(this.settings.experimental_onStart,W),experimental_onStepStart:this.mergeCallbacks(this.settings.experimental_onStepStart,J),experimental_onToolCallStart:this.mergeCallbacks(this.settings.experimental_onToolCallStart,U),experimental_onToolCallFinish:this.mergeCallbacks(this.settings.experimental_onToolCallFinish,H),onStepFinish:this.mergeCallbacks(this.settings.onStepFinish,D),onFinish:this.mergeCallbacks(this.settings.onFinish,V)})}},Zp$,lJ$=class{constructor($){this.value=$.value,this.embedding=$.embedding,this.usage=$.usage,this.warnings=$.warnings,this.providerMetadata=$.providerMetadata,this.response=$.response}},Ny=class{constructor($){this.values=$.values,this.embeddings=$.embeddings,this.usage=$.usage,this.warnings=$.warnings,this.providerMetadata=$.providerMetadata,this.responses=$.responses}},iJ$=class{constructor($){this.images=$.images,this.warnings=$.warnings,this.responses=$.responses,this.providerMetadata=$.providerMetadata,this.usage=$.usage}get image(){return this.images[0]}},oJ$,aJ$=($)=>({type:"object",jsonSchema:async()=>await $.jsonSchema,async validatePartialResult({value:X,textDelta:Y}){return{success:!0,value:{partial:X,textDelta:Y}}},async validateFinalResult(X){return F4({value:X,schema:$})},createElementStream(){throw new L6({functionality:"element streams in object mode"})}}),sJ$=($)=>{return{type:"array",jsonSchema:async()=>{let{$schema:X,...Y}=await $.jsonSchema;return{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:Y}},required:["elements"],additionalProperties:!1}},async validatePartialResult({value:X,latestObject:Y,isFirstDelta:W,isFinalDelta:J}){var U;if(!vY(X)||!SQ(X.elements))return{success:!1,error:new K4({value:X,cause:"value must be an object that contains an array of elements"})};let H=X.elements,D=[];for(let Q=0;Q<H.length;Q++){let q=H[Q],F=await F4({value:q,schema:$});if(Q===H.length-1&&!J)continue;if(!F.success)return F;D.push(F.value)}let V=(U=Y==null?void 0:Y.length)!=null?U:0,K="";if(W)K+="[";if(V>0)K+=",";if(K+=D.slice(V).map((Q)=>JSON.stringify(Q)).join(","),J)K+="]";return{success:!0,value:{partial:D,textDelta:K}}},async validateFinalResult(X){if(!vY(X)||!SQ(X.elements))return{success:!1,error:new K4({value:X,cause:"value must be an object that contains an array of elements"})};let Y=X.elements;for(let W of Y){let J=await F4({value:W,schema:$});if(!J.success)return J}return{success:!0,value:Y}},createElementStream(X){let Y=0;return uX(X.pipeThrough(new TransformStream({transform(W,J){switch(W.type){case"object":{let U=W.object;for(;Y<U.length;Y++)J.enqueue(U[Y]);break}case"text-delta":case"finish":case"error":break;default:throw Error(`Unsupported chunk type: ${W}`)}}})))}}},tJ$=($)=>{return{type:"enum",jsonSchema:async()=>({$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:$}},required:["result"],additionalProperties:!1}),async validateFinalResult(X){if(!vY(X)||typeof X.result!=="string")return{success:!1,error:new K4({value:X,cause:'value must be an object that contains a string in the "result" property.'})};let Y=X.result;return $.includes(Y)?{success:!0,value:Y}:{success:!1,error:new K4({value:X,cause:"value must be a string in the enum"})}},async validatePartialResult({value:X,textDelta:Y}){if(!vY(X)||typeof X.result!=="string")return{success:!1,error:new K4({value:X,cause:'value must be an object that contains a string in the "result" property.'})};let W=X.result,J=$.filter((U)=>U.startsWith(W));if(X.result.length===0||J.length===0)return{success:!1,error:new K4({value:X,cause:"value must be a string in the enum"})};return{success:!0,value:{partial:J.length>1?W:J[0],textDelta:Y}}},createElementStream(){throw new L6({functionality:"element streams in enum mode"})}}},Y2$,J2$=class{constructor($){this.object=$.object,this.finishReason=$.finishReason,this.usage=$.usage,this.warnings=$.warnings,this.providerMetadata=$.providerMetadata,this.response=$.response,this.request=$.request,this.reasoning=$.reasoning}toJsonResponse($){var X;return new Response(JSON.stringify(this.object),{status:(X=$==null?void 0:$.status)!=null?X:200,headers:cJ($==null?void 0:$.headers,{"content-type":"application/json; charset=utf-8"})})}},Ep$,Pp$,W2$="AI_NoSuchProviderError",U2$,G2$,H2$,Ip$;var lG=A(()=>{$$();$$();f$();f$();f$();f$();f$();f$();f$();f$();f$();f$();f$();f$();f$();f$();f$();dZ();$$();$$();$$();$$();f$();$$();I$();f$();$$();f$();$$();I$();I$();I$();I$();I$();dZ();f$();f$();$$();$$();$$();f$();$$();$$();$$();f$();$$();$$();I$();$$();$$();$$();I$();$$();$$();$$();$$();f$();$$();f$();$$();$$();jf=n1(fz(),1),pX=n1(fz(),1),t7$=Object.defineProperty,jy=`vercel.ai.error.${My}`,$Y$=Symbol.for(jy),d6=class extends A${constructor({parameter:$,value:X,message:Y}){super({name:My,message:`Invalid argument for parameter ${$}: ${Y}`});this[Ry]=!0,this.parameter=$,this.value=X}static isInstance($){return A$.hasMarker($,jy)}};Ry=$Y$;YY$=`vercel.ai.error.${XY$}`,JY$=Symbol.for(YY$);WY$=JY$;Ey=`vercel.ai.error.${Ly}`,UY$=Symbol.for(Ey),GY$=class extends A${constructor({approvalId:$}){super({name:Ly,message:`Tool approval response references unknown approvalId: "${$}". No matching tool-approval-request found in message history.`});this[Py]=!0,this.approvalId=$}static isInstance($){return A$.hasMarker($,Ey)}};Py=UY$;_y=`vercel.ai.error.${Iy}`,HY$=Symbol.for(_y),lz=class extends A${constructor({toolInput:$,toolName:X,cause:Y,message:W=`Invalid input for tool ${X}: ${F0(Y)}`}){super({name:Iy,message:W,cause:Y});this[Ty]=!0,this.toolInput=$,this.toolName=X}static isInstance($){return A$.hasMarker($,_y)}};Ty=HY$;Sy=`vercel.ai.error.${Cy}`,DY$=Symbol.for(Sy),iz=class extends A${constructor({toolCallId:$,approvalId:X}){super({name:Cy,message:`Tool call "${$}" not found for approval request "${X}".`});this[by]=!0,this.toolCallId=$,this.approvalId=X}static isInstance($){return A$.hasMarker($,Sy)}};by=DY$;ky=`vercel.ai.error.${xy}`,VY$=Symbol.for(ky),Uy=class extends A${constructor({toolCallIds:$}){super({name:xy,message:`Tool result${$.length>1?"s are":" is"} missing for tool call${$.length>1?"s":""} ${$.join(", ")}.`});this[vy]=!0,this.toolCallIds=$}static isInstance($){return A$.hasMarker($,ky)}};vy=VY$;yy=`vercel.ai.error.${hy}`,KY$=Symbol.for(yy),QY$=class extends A${constructor({message:$="No image generated.",cause:X,responses:Y}){super({name:hy,message:$,cause:X});this[fy]=!0,this.responses=Y}static isInstance($){return A$.hasMarker($,yy)}};fy=KY$;my=`vercel.ai.error.${gy}`,FY$=Symbol.for(my),I1=class extends A${constructor({message:$="No object generated.",cause:X,text:Y,response:W,usage:J,finishReason:U}){super({name:gy,message:$,cause:X});this[uy]=!0,this.text=Y,this.response=W,this.usage=J,this.finishReason=U}static isInstance($){return A$.hasMarker($,my)}};uy=FY$;cy=`vercel.ai.error.${py}`,qY$=Symbol.for(cy),ly=class extends A${constructor({message:$="No output generated.",cause:X}={}){super({name:py,message:$,cause:X});this[dy]=!0}static isInstance($){return A$.hasMarker($,cy)}};dy=qY$;ZY$=`vercel.ai.error.${wY$}`,zY$=Symbol.for(ZY$);OY$=zY$;AY$=`vercel.ai.error.${NY$}`,BY$=Symbol.for(AY$);MY$=BY$;RY$=`vercel.ai.error.${jY$}`,LY$=Symbol.for(RY$);EY$=LY$;ry=`vercel.ai.error.${iy}`,PY$=Symbol.for(ry),mz=class extends A${constructor({toolName:$,availableTools:X=void 0,message:Y=`Model tried to call unavailable tool '${$}'. ${X===void 0?"No tools are available.":`Available tools: ${X.join(", ")}.`}`}){super({name:iy,message:Y});this[ny]=!0,this.toolName=$,this.availableTools=X}static isInstance($){return A$.hasMarker($,ry)}};ny=PY$;ay=`vercel.ai.error.${oy}`,IY$=Symbol.for(ay),_Y$=class extends A${constructor({cause:$,originalError:X,message:Y=`Error repairing tool call: ${F0($)}`}){super({name:oy,message:Y,cause:$});this[sy]=!0,this.originalError=X}static isInstance($){return A$.hasMarker($,ay)}};sy=IY$;rz=class extends A${constructor($){super({name:"AI_UnsupportedModelVersionError",message:`Unsupported model version ${$.version} for provider "${$.provider}" and model "${$.modelId}". AI SDK 5 only supports models that implement specification version "v2".`});this.version=$.version,this.provider=$.provider,this.modelId=$.modelId}},ey=`vercel.ai.error.${ty}`,TY$=Symbol.for(ey),mX=class extends A${constructor({chunkType:$,chunkId:X,message:Y}){super({name:ty,message:Y});this[$f]=!0,this.chunkType=$,this.chunkId=X}static isInstance($){return A$.hasMarker($,ey)}};$f=TY$;Yf=`vercel.ai.error.${Xf}`,CY$=Symbol.for(Yf),Gy=class extends A${constructor({content:$,cause:X,message:Y=`Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof $}.`}){super({name:Xf,message:Y,cause:X});this[Jf]=!0,this.content=$}static isInstance($){return A$.hasMarker($,Yf)}};Jf=CY$;Uf=`vercel.ai.error.${Wf}`,SY$=Symbol.for(Uf),bY$=class extends A${constructor({role:$,message:X=`Invalid message role: '${$}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:Wf,message:X});this[Gf]=!0,this.role=$}static isInstance($){return A$.hasMarker($,Uf)}};Gf=SY$;kY$=`vercel.ai.error.${xY$}`,vY$=Symbol.for(kY$);hY$=vY$;Df=`vercel.ai.error.${Hf}`,yY$=Symbol.for(Df),Hy=class extends A${constructor({message:$,reason:X,errors:Y}){super({name:Hf,message:$});this[Vf]=!0,this.reason=X,this.errors=Y,this.lastError=Y[Y.length-1]}static isInstance($){return A$.hasMarker($,Df)}};Vf=yY$;mG=[{mediaType:"image/gif",bytesPrefix:[71,73,70]},{mediaType:"image/png",bytesPrefix:[137,80,78,71]},{mediaType:"image/jpeg",bytesPrefix:[255,216]},{mediaType:"image/webp",bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:"image/bmp",bytesPrefix:[66,77]},{mediaType:"image/tiff",bytesPrefix:[73,73,42,0]},{mediaType:"image/tiff",bytesPrefix:[77,77,0,42]},{mediaType:"image/avif",bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:"image/heic",bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}];zf=G.union([G.string(),G.instanceof(Uint8Array),G.instanceof(ArrayBuffer),G.custom(($)=>{var X,Y;return(Y=(X=globalThis.Buffer)==null?void 0:X.isBuffer($))!=null?Y:!1},{message:"Must be a Buffer"})]);fJ=G.lazy(()=>G.union([G.null(),G.string(),G.number(),G.boolean(),G.record(G.string(),fJ.optional()),G.array(fJ)])),g$=G.record(G.string(),G.record(G.string(),fJ.optional())),Af=G.object({type:G.literal("text"),text:G.string(),providerOptions:g$.optional()}),XJ$=G.object({type:G.literal("image"),image:G.union([zf,G.instanceof(URL)]),mediaType:G.string().optional(),providerOptions:g$.optional()}),Bf=G.object({type:G.literal("file"),data:G.union([zf,G.instanceof(URL)]),filename:G.string().optional(),mediaType:G.string(),providerOptions:g$.optional()}),YJ$=G.object({type:G.literal("reasoning"),text:G.string(),providerOptions:g$.optional()}),JJ$=G.object({type:G.literal("tool-call"),toolCallId:G.string(),toolName:G.string(),input:G.unknown(),providerOptions:g$.optional(),providerExecuted:G.boolean().optional()}),WJ$=G.discriminatedUnion("type",[G.object({type:G.literal("text"),value:G.string(),providerOptions:g$.optional()}),G.object({type:G.literal("json"),value:fJ,providerOptions:g$.optional()}),G.object({type:G.literal("execution-denied"),reason:G.string().optional(),providerOptions:g$.optional()}),G.object({type:G.literal("error-text"),value:G.string(),providerOptions:g$.optional()}),G.object({type:G.literal("error-json"),value:fJ,providerOptions:g$.optional()}),G.object({type:G.literal("content"),value:G.array(G.union([G.object({type:G.literal("text"),text:G.string(),providerOptions:g$.optional()}),G.object({type:G.literal("media"),data:G.string(),mediaType:G.string()}),G.object({type:G.literal("file-data"),data:G.string(),mediaType:G.string(),filename:G.string().optional(),providerOptions:g$.optional()}),G.object({type:G.literal("file-url"),url:G.string(),providerOptions:g$.optional()}),G.object({type:G.literal("file-id"),fileId:G.union([G.string(),G.record(G.string(),G.string())]),providerOptions:g$.optional()}),G.object({type:G.literal("image-data"),data:G.string(),mediaType:G.string(),providerOptions:g$.optional()}),G.object({type:G.literal("image-url"),url:G.string(),providerOptions:g$.optional()}),G.object({type:G.literal("image-file-id"),fileId:G.union([G.string(),G.record(G.string(),G.string())]),providerOptions:g$.optional()}),G.object({type:G.literal("custom"),providerOptions:g$.optional()})]))})]),Mf=G.object({type:G.literal("tool-result"),toolCallId:G.string(),toolName:G.string(),output:WJ$,providerOptions:g$.optional()}),UJ$=G.object({type:G.literal("tool-approval-request"),approvalId:G.string(),toolCallId:G.string()}),GJ$=G.object({type:G.literal("tool-approval-response"),approvalId:G.string(),approved:G.boolean(),reason:G.string().optional()}),HJ$=G.object({role:G.literal("system"),content:G.string(),providerOptions:g$.optional()}),DJ$=G.object({role:G.literal("user"),content:G.union([G.string(),G.array(G.union([Af,XJ$,Bf]))]),providerOptions:g$.optional()}),VJ$=G.object({role:G.literal("assistant"),content:G.union([G.string(),G.array(G.union([Af,Bf,YJ$,JJ$,Mf,UJ$]))]),providerOptions:g$.optional()}),KJ$=G.object({role:G.literal("tool"),content:G.array(G.union([Mf,GJ$])),providerOptions:g$.optional()}),QJ$=G.union([HJ$,DJ$,VJ$,KJ$]);FJ$={startSpan(){return fG},startActiveSpan($,X,Y,W){if(typeof X==="function")return X(fG);if(typeof Y==="function")return Y(fG);if(typeof W==="function")return W(fG)}},fG={spanContext(){return qJ$},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},addLink(){return this},addLinks(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this}},qJ$={traceId:"",spanId:"",traceFlags:0};NJ$=class extends YO{constructor($){super($);this.type="file"}};AJ$={};e7$(AJ$,{array:()=>jJ$,choice:()=>RJ$,json:()=>LJ$,object:()=>MJ$,text:()=>cG});EJ$=p0({prefix:"aitxt",size:24});vf=class extends TransformStream{constructor(){super({transform($,X){X.enqueue(`data: ${JSON.stringify($)}
287
-
288
- `)},flush($){$.enqueue(`data: [DONE]
289
-
290
- `)}})}},hf={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};Qp$=p(()=>u(G.union([G.strictObject({type:G.literal("text-start"),id:G.string(),providerMetadata:g$.optional()}),G.strictObject({type:G.literal("text-delta"),id:G.string(),delta:G.string(),providerMetadata:g$.optional()}),G.strictObject({type:G.literal("text-end"),id:G.string(),providerMetadata:g$.optional()}),G.strictObject({type:G.literal("error"),errorText:G.string()}),G.strictObject({type:G.literal("tool-input-start"),toolCallId:G.string(),toolName:G.string(),providerExecuted:G.boolean().optional(),providerMetadata:g$.optional(),dynamic:G.boolean().optional(),title:G.string().optional()}),G.strictObject({type:G.literal("tool-input-delta"),toolCallId:G.string(),inputTextDelta:G.string()}),G.strictObject({type:G.literal("tool-input-available"),toolCallId:G.string(),toolName:G.string(),input:G.unknown(),providerExecuted:G.boolean().optional(),providerMetadata:g$.optional(),dynamic:G.boolean().optional(),title:G.string().optional()}),G.strictObject({type:G.literal("tool-input-error"),toolCallId:G.string(),toolName:G.string(),input:G.unknown(),providerExecuted:G.boolean().optional(),providerMetadata:g$.optional(),dynamic:G.boolean().optional(),errorText:G.string(),title:G.string().optional()}),G.strictObject({type:G.literal("tool-approval-request"),approvalId:G.string(),toolCallId:G.string()}),G.strictObject({type:G.literal("tool-output-available"),toolCallId:G.string(),output:G.unknown(),providerExecuted:G.boolean().optional(),dynamic:G.boolean().optional(),preliminary:G.boolean().optional()}),G.strictObject({type:G.literal("tool-output-error"),toolCallId:G.string(),errorText:G.string(),providerExecuted:G.boolean().optional(),dynamic:G.boolean().optional()}),G.strictObject({type:G.literal("tool-output-denied"),toolCallId:G.string()}),G.strictObject({type:G.literal("reasoning-start"),id:G.string(),providerMetadata:g$.optional()}),G.strictObject({type:G.literal("reasoning-delta"),id:G.string(),delta:G.string(),providerMetadata:g$.optional()}),G.strictObject({type:G.literal("reasoning-end"),id:G.string(),providerMetadata:g$.optional()}),G.strictObject({type:G.literal("source-url"),sourceId:G.string(),url:G.string(),title:G.string().optional(),providerMetadata:g$.optional()}),G.strictObject({type:G.literal("source-document"),sourceId:G.string(),mediaType:G.string(),title:G.string(),filename:G.string().optional(),providerMetadata:g$.optional()}),G.strictObject({type:G.literal("file"),url:G.string(),mediaType:G.string(),providerMetadata:g$.optional()}),G.strictObject({type:G.custom(($)=>typeof $==="string"&&$.startsWith("data-"),{message:'Type must start with "data-"'}),id:G.string().optional(),data:G.unknown(),transient:G.boolean().optional()}),G.strictObject({type:G.literal("start-step")}),G.strictObject({type:G.literal("finish-step")}),G.strictObject({type:G.literal("start"),messageId:G.string().optional(),messageMetadata:G.unknown().optional()}),G.strictObject({type:G.literal("finish"),finishReason:G.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:G.unknown().optional()}),G.strictObject({type:G.literal("abort"),reason:G.string().optional()}),G.strictObject({type:G.literal("message-metadata"),messageMetadata:G.unknown()})])));uJ$=p0({prefix:"aitxt",size:24});Zp$=p(()=>u(G.array(G.object({id:G.string(),role:G.enum(["system","user","assistant"]),metadata:G.unknown().optional(),parts:G.array(G.union([G.object({type:G.literal("text"),text:G.string(),state:G.enum(["streaming","done"]).optional(),providerMetadata:g$.optional()}),G.object({type:G.literal("reasoning"),text:G.string(),state:G.enum(["streaming","done"]).optional(),providerMetadata:g$.optional()}),G.object({type:G.literal("source-url"),sourceId:G.string(),url:G.string(),title:G.string().optional(),providerMetadata:g$.optional()}),G.object({type:G.literal("source-document"),sourceId:G.string(),mediaType:G.string(),title:G.string(),filename:G.string().optional(),providerMetadata:g$.optional()}),G.object({type:G.literal("file"),mediaType:G.string(),filename:G.string().optional(),url:G.string(),providerMetadata:g$.optional()}),G.object({type:G.literal("step-start")}),G.object({type:G.string().startsWith("data-"),id:G.string().optional(),data:G.unknown()}),G.object({type:G.literal("dynamic-tool"),toolName:G.string(),toolCallId:G.string(),state:G.literal("input-streaming"),input:G.unknown().optional(),providerExecuted:G.boolean().optional(),callProviderMetadata:g$.optional(),output:G.never().optional(),errorText:G.never().optional(),approval:G.never().optional()}),G.object({type:G.literal("dynamic-tool"),toolName:G.string(),toolCallId:G.string(),state:G.literal("input-available"),input:G.unknown(),providerExecuted:G.boolean().optional(),output:G.never().optional(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),approval:G.never().optional()}),G.object({type:G.literal("dynamic-tool"),toolName:G.string(),toolCallId:G.string(),state:G.literal("approval-requested"),input:G.unknown(),providerExecuted:G.boolean().optional(),output:G.never().optional(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),approval:G.object({id:G.string(),approved:G.never().optional(),reason:G.never().optional()})}),G.object({type:G.literal("dynamic-tool"),toolName:G.string(),toolCallId:G.string(),state:G.literal("approval-responded"),input:G.unknown(),providerExecuted:G.boolean().optional(),output:G.never().optional(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),approval:G.object({id:G.string(),approved:G.boolean(),reason:G.string().optional()})}),G.object({type:G.literal("dynamic-tool"),toolName:G.string(),toolCallId:G.string(),state:G.literal("output-available"),input:G.unknown(),providerExecuted:G.boolean().optional(),output:G.unknown(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),preliminary:G.boolean().optional(),approval:G.object({id:G.string(),approved:G.literal(!0),reason:G.string().optional()}).optional()}),G.object({type:G.literal("dynamic-tool"),toolName:G.string(),toolCallId:G.string(),state:G.literal("output-error"),input:G.unknown(),rawInput:G.unknown().optional(),providerExecuted:G.boolean().optional(),output:G.never().optional(),errorText:G.string(),callProviderMetadata:g$.optional(),approval:G.object({id:G.string(),approved:G.literal(!0),reason:G.string().optional()}).optional()}),G.object({type:G.literal("dynamic-tool"),toolName:G.string(),toolCallId:G.string(),state:G.literal("output-denied"),input:G.unknown(),providerExecuted:G.boolean().optional(),output:G.never().optional(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),approval:G.object({id:G.string(),approved:G.literal(!1),reason:G.string().optional()})}),G.object({type:G.string().startsWith("tool-"),toolCallId:G.string(),state:G.literal("input-streaming"),providerExecuted:G.boolean().optional(),callProviderMetadata:g$.optional(),input:G.unknown().optional(),output:G.never().optional(),errorText:G.never().optional(),approval:G.never().optional()}),G.object({type:G.string().startsWith("tool-"),toolCallId:G.string(),state:G.literal("input-available"),providerExecuted:G.boolean().optional(),input:G.unknown(),output:G.never().optional(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),approval:G.never().optional()}),G.object({type:G.string().startsWith("tool-"),toolCallId:G.string(),state:G.literal("approval-requested"),input:G.unknown(),providerExecuted:G.boolean().optional(),output:G.never().optional(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),approval:G.object({id:G.string(),approved:G.never().optional(),reason:G.never().optional()})}),G.object({type:G.string().startsWith("tool-"),toolCallId:G.string(),state:G.literal("approval-responded"),input:G.unknown(),providerExecuted:G.boolean().optional(),output:G.never().optional(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),approval:G.object({id:G.string(),approved:G.boolean(),reason:G.string().optional()})}),G.object({type:G.string().startsWith("tool-"),toolCallId:G.string(),state:G.literal("output-available"),providerExecuted:G.boolean().optional(),input:G.unknown(),output:G.unknown(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),preliminary:G.boolean().optional(),approval:G.object({id:G.string(),approved:G.literal(!0),reason:G.string().optional()}).optional()}),G.object({type:G.string().startsWith("tool-"),toolCallId:G.string(),state:G.literal("output-error"),providerExecuted:G.boolean().optional(),input:G.unknown(),rawInput:G.unknown().optional(),output:G.never().optional(),errorText:G.string(),callProviderMetadata:g$.optional(),approval:G.object({id:G.string(),approved:G.literal(!0),reason:G.string().optional()}).optional()}),G.object({type:G.string().startsWith("tool-"),toolCallId:G.string(),state:G.literal("output-denied"),providerExecuted:G.boolean().optional(),input:G.unknown(),output:G.never().optional(),errorText:G.never().optional(),callProviderMetadata:g$.optional(),approval:G.object({id:G.string(),approved:G.literal(!1),reason:G.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")));oJ$={type:"no-schema",jsonSchema:async()=>{return},async validatePartialResult({value:$,textDelta:X}){return{success:!0,value:{partial:$,textDelta:X}}},async validateFinalResult($,X){return $===void 0?{success:!1,error:new I1({message:"No object generated: response did not match schema.",text:X.text,response:X.response,usage:X.usage,finishReason:X.finishReason})}:{success:!0,value:$}},createElementStream(){throw new L6({functionality:"element streams in no-schema mode"})}};Y2$=p0({prefix:"aiobj",size:24});Ep$=p0({prefix:"aiobj",size:24}),Pp$=uf(),U2$=`vercel.ai.error.${W2$}`,G2$=Symbol.for(U2$);H2$=G2$;Ip$=uf()});function q2$($){var X;let Y=$==null?void 0:$.anthropic;return(X=Y==null?void 0:Y.cacheControl)!=null?X:Y==null?void 0:Y.cache_control}async function h2$({tools:$,toolChoice:X,disableParallelToolUse:Y,cacheControlValidator:W,supportsStructuredOutput:J}){var U;$=($==null?void 0:$.length)?$:void 0;let H=[],D=new Set,V=W||new DO;if($==null)return{tools:void 0,toolChoice:void 0,toolWarnings:H,betas:D};let K=[];for(let q of $)switch(q.type){case"function":{let F=V.getCacheControl(q.providerOptions,{type:"tool definition",canCache:!0}),w=(U=q.providerOptions)==null?void 0:U.anthropic,z=w==null?void 0:w.eagerInputStreaming,O=w==null?void 0:w.deferLoading,N=w==null?void 0:w.allowedCallers;if(K.push({name:q.name,description:q.description,input_schema:q.inputSchema,cache_control:F,...z?{eager_input_streaming:!0}:{},...J===!0&&q.strict!=null?{strict:q.strict}:{},...O!=null?{defer_loading:O}:{},...N!=null?{allowed_callers:N}:{},...q.inputExamples!=null?{input_examples:q.inputExamples.map((L)=>L.input)}:{}}),J===!0)D.add("structured-outputs-2025-11-13");if(q.inputExamples!=null||N!=null)D.add("advanced-tool-use-2025-11-20");break}case"provider":{switch(q.id){case"anthropic.code_execution_20250522":{D.add("code-execution-2025-05-22"),K.push({type:"code_execution_20250522",name:"code_execution",cache_control:void 0});break}case"anthropic.code_execution_20250825":{D.add("code-execution-2025-08-25"),K.push({type:"code_execution_20250825",name:"code_execution"});break}case"anthropic.code_execution_20260120":{K.push({type:"code_execution_20260120",name:"code_execution"});break}case"anthropic.computer_20250124":{D.add("computer-use-2025-01-24"),K.push({name:"computer",type:"computer_20250124",display_width_px:q.args.displayWidthPx,display_height_px:q.args.displayHeightPx,display_number:q.args.displayNumber,cache_control:void 0});break}case"anthropic.computer_20251124":{D.add("computer-use-2025-11-24"),K.push({name:"computer",type:"computer_20251124",display_width_px:q.args.displayWidthPx,display_height_px:q.args.displayHeightPx,display_number:q.args.displayNumber,enable_zoom:q.args.enableZoom,cache_control:void 0});break}case"anthropic.computer_20241022":{D.add("computer-use-2024-10-22"),K.push({name:"computer",type:"computer_20241022",display_width_px:q.args.displayWidthPx,display_height_px:q.args.displayHeightPx,display_number:q.args.displayNumber,cache_control:void 0});break}case"anthropic.text_editor_20250124":{D.add("computer-use-2025-01-24"),K.push({name:"str_replace_editor",type:"text_editor_20250124",cache_control:void 0});break}case"anthropic.text_editor_20241022":{D.add("computer-use-2024-10-22"),K.push({name:"str_replace_editor",type:"text_editor_20241022",cache_control:void 0});break}case"anthropic.text_editor_20250429":{D.add("computer-use-2025-01-24"),K.push({name:"str_replace_based_edit_tool",type:"text_editor_20250429",cache_control:void 0});break}case"anthropic.text_editor_20250728":{let F=await z6({value:q.args,schema:w2$});K.push({name:"str_replace_based_edit_tool",type:"text_editor_20250728",max_characters:F.maxCharacters,cache_control:void 0});break}case"anthropic.bash_20250124":{D.add("computer-use-2025-01-24"),K.push({name:"bash",type:"bash_20250124",cache_control:void 0});break}case"anthropic.bash_20241022":{D.add("computer-use-2024-10-22"),K.push({name:"bash",type:"bash_20241022",cache_control:void 0});break}case"anthropic.memory_20250818":{D.add("context-management-2025-06-27"),K.push({name:"memory",type:"memory_20250818"});break}case"anthropic.web_fetch_20250910":{D.add("web-fetch-2025-09-10");let F=await z6({value:q.args,schema:b2$});K.push({type:"web_fetch_20250910",name:"web_fetch",max_uses:F.maxUses,allowed_domains:F.allowedDomains,blocked_domains:F.blockedDomains,citations:F.citations,max_content_tokens:F.maxContentTokens,cache_control:void 0});break}case"anthropic.web_fetch_20260209":{D.add("code-execution-web-tools-2026-02-09");let F=await z6({value:q.args,schema:I2$});K.push({type:"web_fetch_20260209",name:"web_fetch",max_uses:F.maxUses,allowed_domains:F.allowedDomains,blocked_domains:F.blockedDomains,citations:F.citations,max_content_tokens:F.maxContentTokens,cache_control:void 0});break}case"anthropic.web_search_20250305":{let F=await z6({value:q.args,schema:R2$});K.push({type:"web_search_20250305",name:"web_search",max_uses:F.maxUses,allowed_domains:F.allowedDomains,blocked_domains:F.blockedDomains,user_location:F.userLocation,cache_control:void 0});break}case"anthropic.web_search_20260209":{D.add("code-execution-web-tools-2026-02-09");let F=await z6({value:q.args,schema:N2$});K.push({type:"web_search_20260209",name:"web_search",max_uses:F.maxUses,allowed_domains:F.allowedDomains,blocked_domains:F.blockedDomains,user_location:F.userLocation,cache_control:void 0});break}case"anthropic.tool_search_regex_20251119":{D.add("advanced-tool-use-2025-11-20"),K.push({type:"tool_search_tool_regex_20251119",name:"tool_search_tool_regex"});break}case"anthropic.tool_search_bm25_20251119":{D.add("advanced-tool-use-2025-11-20"),K.push({type:"tool_search_tool_bm25_20251119",name:"tool_search_tool_bm25"});break}default:{H.push({type:"unsupported",feature:`provider-defined tool ${q.id}`});break}}break}default:{H.push({type:"unsupported",feature:`tool ${q}`});break}}if(X==null)return{tools:K,toolChoice:Y?{type:"auto",disable_parallel_tool_use:Y}:void 0,toolWarnings:H,betas:D};let Q=X.type;switch(Q){case"auto":return{tools:K,toolChoice:{type:"auto",disable_parallel_tool_use:Y},toolWarnings:H,betas:D};case"required":return{tools:K,toolChoice:{type:"any",disable_parallel_tool_use:Y},toolWarnings:H,betas:D};case"none":return{tools:void 0,toolChoice:void 0,toolWarnings:H,betas:D};case"tool":return{tools:K,toolChoice:{type:"tool",name:X.toolName,disable_parallel_tool_use:Y},toolWarnings:H,betas:D};default:throw new L6({functionality:`tool choice type: ${Q}`})}}function rf({usage:$,rawUsage:X}){var Y,W;let J=(Y=$.cache_creation_input_tokens)!=null?Y:0,U=(W=$.cache_read_input_tokens)!=null?W:0,H,D;if($.iterations&&$.iterations.length>0){let V=$.iterations.reduce((K,Q)=>({input:K.input+Q.input_tokens,output:K.output+Q.output_tokens}),{input:0,output:0});H=V.input,D=V.output}else H=$.input_tokens,D=$.output_tokens;return{inputTokens:{total:H+J+U,noCache:H,cacheRead:U,cacheWrite:J},outputTokens:{total:D,text:void 0,reasoning:void 0},raw:X!=null?X:$}}function o2$($){if(typeof $==="string")return new TextDecoder().decode(p4($));if($ instanceof Uint8Array)return new TextDecoder().decode($);if($ instanceof URL)throw new L6({functionality:"URL-based text documents are not supported for citations"});throw new L6({functionality:`unsupported data type for text documents: ${typeof $}`})}function UO($){return $ instanceof URL||a2$($)}function a2$($){return typeof $==="string"&&/^https?:\/\//i.test($)}function GO($){return $ instanceof URL?$.toString():$}async function s2$({prompt:$,sendReasoning:X,warnings:Y,cacheControlValidator:W,toolNameMapping:J}){var U,H,D,V,K,Q,q,F,w,z,O,N,L,P,j,v,y,E,b;let R=new Set,I=t2$($),d=W||new DO,k=void 0,t=[];async function h(l){var o,g;let a=await E6({provider:"anthropic",providerOptions:l,schema:cf});return(g=(o=a==null?void 0:a.citations)==null?void 0:o.enabled)!=null?g:!1}async function f(l){let o=await E6({provider:"anthropic",providerOptions:l,schema:cf});return{title:o==null?void 0:o.title,context:o==null?void 0:o.context}}for(let l=0;l<I.length;l++){let o=I[l],g=l===I.length-1,a=o.type;switch(a){case"system":{if(k!=null)throw new L6({functionality:"Multiple system messages that are separated by user/assistant messages"});k=o.messages.map(({content:Y$,providerOptions:_})=>({type:"text",text:Y$,cache_control:d.getCacheControl(_,{type:"system message",canCache:!0})}));break}case"user":{let Y$=[];for(let _ of o.messages){let{role:V$,content:o$}=_;switch(V$){case"user":{for(let T=0;T<o$.length;T++){let B$=o$[T],k$=T===o$.length-1,m=(U=d.getCacheControl(B$.providerOptions,{type:"user message part",canCache:!0}))!=null?U:k$?d.getCacheControl(_.providerOptions,{type:"user message",canCache:!0}):void 0;switch(B$.type){case"text":{Y$.push({type:"text",text:B$.text,cache_control:m});break}case"file":{if(B$.mediaType.startsWith("image/"))Y$.push({type:"image",source:UO(B$.data)?{type:"url",url:GO(B$.data)}:{type:"base64",media_type:B$.mediaType==="image/*"?"image/jpeg":B$.mediaType,data:c4(B$.data)},cache_control:m});else if(B$.mediaType==="application/pdf"){R.add("pdfs-2024-09-25");let T$=await h(B$.providerOptions),H$=await f(B$.providerOptions);Y$.push({type:"document",source:UO(B$.data)?{type:"url",url:GO(B$.data)}:{type:"base64",media_type:"application/pdf",data:c4(B$.data)},title:(H=H$.title)!=null?H:B$.filename,...H$.context&&{context:H$.context},...T$&&{citations:{enabled:!0}},cache_control:m})}else if(B$.mediaType==="text/plain"){let T$=await h(B$.providerOptions),H$=await f(B$.providerOptions);Y$.push({type:"document",source:UO(B$.data)?{type:"url",url:GO(B$.data)}:{type:"text",media_type:"text/plain",data:o2$(B$.data)},title:(D=H$.title)!=null?D:B$.filename,...H$.context&&{context:H$.context},...T$&&{citations:{enabled:!0}},cache_control:m})}else throw new L6({functionality:`media type: ${B$.mediaType}`});break}}}break}case"tool":{for(let T=0;T<o$.length;T++){let B$=o$[T];if(B$.type==="tool-approval-response")continue;let k$=T===o$.length-1,m=(V=d.getCacheControl(B$.providerOptions,{type:"tool result part",canCache:!0}))!=null?V:k$?d.getCacheControl(_.providerOptions,{type:"tool result message",canCache:!0}):void 0,T$=B$.output,H$;switch(T$.type){case"content":H$=T$.value.map((F$)=>{var P$;switch(F$.type){case"text":return{type:"text",text:F$.text};case"image-data":return{type:"image",source:{type:"base64",media_type:F$.mediaType,data:F$.data}};case"image-url":return{type:"image",source:{type:"url",url:F$.url}};case"file-url":return{type:"document",source:{type:"url",url:F$.url}};case"file-data":{if(F$.mediaType==="application/pdf")return R.add("pdfs-2024-09-25"),{type:"document",source:{type:"base64",media_type:F$.mediaType,data:F$.data}};Y.push({type:"other",message:`unsupported tool content part type: ${F$.type} with media type: ${F$.mediaType}`});return}case"custom":{let j$=(P$=F$.providerOptions)==null?void 0:P$.anthropic;if((j$==null?void 0:j$.type)==="tool-reference")return{type:"tool_reference",tool_name:j$.toolName};Y.push({type:"other",message:"unsupported custom tool content part"});return}default:{Y.push({type:"other",message:`unsupported tool content part type: ${F$.type}`});return}}}).filter(RJ);break;case"text":case"error-text":H$=T$.value;break;case"execution-denied":H$=(K=T$.reason)!=null?K:"Tool execution denied.";break;case"json":case"error-json":default:H$=JSON.stringify(T$.value);break}Y$.push({type:"tool_result",tool_use_id:B$.toolCallId,content:H$,is_error:T$.type==="error-text"||T$.type==="error-json"?!0:void 0,cache_control:m})}break}default:throw Error(`Unsupported role: ${V$}`)}}t.push({role:"user",content:Y$});break}case"assistant":{let Y$=[],_=new Set;for(let V$=0;V$<o.messages.length;V$++){let o$=o.messages[V$],T=V$===o.messages.length-1,{content:B$}=o$;for(let k$=0;k$<B$.length;k$++){let m=B$[k$],T$=k$===B$.length-1,H$=(Q=d.getCacheControl(m.providerOptions,{type:"assistant message part",canCache:!0}))!=null?Q:T$?d.getCacheControl(o$.providerOptions,{type:"assistant message",canCache:!0}):void 0;switch(m.type){case"text":{let F$=(q=m.providerOptions)==null?void 0:q.anthropic;if((F$==null?void 0:F$.type)==="compaction")Y$.push({type:"compaction",content:m.text,cache_control:H$});else Y$.push({type:"text",text:g&&T&&T$?m.text.trim():m.text,cache_control:H$});break}case"reasoning":{if(X){let F$=await E6({provider:"anthropic",providerOptions:m.providerOptions,schema:F2$});if(F$!=null)if(F$.signature!=null)d.getCacheControl(m.providerOptions,{type:"thinking block",canCache:!1}),Y$.push({type:"thinking",thinking:m.text,signature:F$.signature});else if(F$.redactedData!=null)d.getCacheControl(m.providerOptions,{type:"redacted thinking block",canCache:!1}),Y$.push({type:"redacted_thinking",data:F$.redactedData});else Y.push({type:"other",message:"unsupported reasoning metadata"});else Y.push({type:"other",message:"unsupported reasoning metadata"})}else Y.push({type:"other",message:"sending reasoning content is disabled for this model"});break}case"tool-call":{if(m.providerExecuted){let j$=J.toProviderToolName(m.toolName);if(((w=(F=m.providerOptions)==null?void 0:F.anthropic)==null?void 0:w.type)==="mcp-tool-use"){_.add(m.toolCallId);let n=(O=(z=m.providerOptions)==null?void 0:z.anthropic)==null?void 0:O.serverName;if(n==null||typeof n!=="string"){Y.push({type:"other",message:"mcp tool use server name is required and must be a string"});break}Y$.push({type:"mcp_tool_use",id:m.toolCallId,name:m.toolName,input:m.input,server_name:n,cache_control:H$})}else if(j$==="code_execution"&&m.input!=null&&typeof m.input==="object"&&"type"in m.input&&typeof m.input.type==="string"&&(m.input.type==="bash_code_execution"||m.input.type==="text_editor_code_execution"))Y$.push({type:"server_tool_use",id:m.toolCallId,name:m.input.type,input:m.input,cache_control:H$});else if(j$==="code_execution"&&m.input!=null&&typeof m.input==="object"&&"type"in m.input&&m.input.type==="programmatic-tool-call"){let{type:n,...G$}=m.input;Y$.push({type:"server_tool_use",id:m.toolCallId,name:"code_execution",input:G$,cache_control:H$})}else if(j$==="code_execution"||j$==="web_fetch"||j$==="web_search")Y$.push({type:"server_tool_use",id:m.toolCallId,name:j$,input:m.input,cache_control:H$});else if(j$==="tool_search_tool_regex"||j$==="tool_search_tool_bm25")Y$.push({type:"server_tool_use",id:m.toolCallId,name:j$,input:m.input,cache_control:H$});else Y.push({type:"other",message:`provider executed tool call for tool ${m.toolName} is not supported`});break}let F$=(N=m.providerOptions)==null?void 0:N.anthropic,P$=(F$==null?void 0:F$.caller)?(F$.caller.type==="code_execution_20250825"||F$.caller.type==="code_execution_20260120")&&F$.caller.toolId?{type:F$.caller.type,tool_id:F$.caller.toolId}:F$.caller.type==="direct"?{type:"direct"}:void 0:void 0;Y$.push({type:"tool_use",id:m.toolCallId,name:m.toolName,input:m.input,...P$&&{caller:P$},cache_control:H$});break}case"tool-result":{let F$=J.toProviderToolName(m.toolName);if(_.has(m.toolCallId)){let P$=m.output;if(P$.type!=="json"&&P$.type!=="error-json"){Y.push({type:"other",message:`provider executed tool result output type ${P$.type} for tool ${m.toolName} is not supported`});break}Y$.push({type:"mcp_tool_result",tool_use_id:m.toolCallId,is_error:P$.type==="error-json",content:P$.value,cache_control:H$})}else if(F$==="code_execution"){let P$=m.output;if(P$.type==="error-text"||P$.type==="error-json"){let j$={};try{if(typeof P$.value==="string")j$=JSON.parse(P$.value);else if(typeof P$.value==="object"&&P$.value!==null)j$=P$.value}catch(U$){}if(j$.type==="code_execution_tool_result_error")Y$.push({type:"code_execution_tool_result",tool_use_id:m.toolCallId,content:{type:"code_execution_tool_result_error",error_code:(L=j$.errorCode)!=null?L:"unknown"},cache_control:H$});else Y$.push({type:"bash_code_execution_tool_result",tool_use_id:m.toolCallId,cache_control:H$,content:{type:"bash_code_execution_tool_result_error",error_code:(P=j$.errorCode)!=null?P:"unknown"}});break}if(P$.type!=="json"){Y.push({type:"other",message:`provider executed tool result output type ${P$.type} for tool ${m.toolName} is not supported`});break}if(P$.value==null||typeof P$.value!=="object"||!("type"in P$.value)||typeof P$.value.type!=="string"){Y.push({type:"other",message:`provider executed tool result output value is not a valid code execution result for tool ${m.toolName}`});break}if(P$.value.type==="code_execution_result"){let j$=await z6({value:P$.value,schema:ef});Y$.push({type:"code_execution_tool_result",tool_use_id:m.toolCallId,content:{type:j$.type,stdout:j$.stdout,stderr:j$.stderr,return_code:j$.return_code,content:(j=j$.content)!=null?j:[]},cache_control:H$})}else if(P$.value.type==="encrypted_code_execution_result"){let j$=await z6({value:P$.value,schema:Xg});if(j$.type==="encrypted_code_execution_result")Y$.push({type:"code_execution_tool_result",tool_use_id:m.toolCallId,content:{type:j$.type,encrypted_stdout:j$.encrypted_stdout,stderr:j$.stderr,return_code:j$.return_code,content:(v=j$.content)!=null?v:[]},cache_control:H$})}else{let j$=await z6({value:P$.value,schema:$g});if(j$.type==="code_execution_result")Y$.push({type:"code_execution_tool_result",tool_use_id:m.toolCallId,content:{type:j$.type,stdout:j$.stdout,stderr:j$.stderr,return_code:j$.return_code,content:(y=j$.content)!=null?y:[]},cache_control:H$});else if(j$.type==="bash_code_execution_result"||j$.type==="bash_code_execution_tool_result_error")Y$.push({type:"bash_code_execution_tool_result",tool_use_id:m.toolCallId,cache_control:H$,content:j$});else Y$.push({type:"text_editor_code_execution_tool_result",tool_use_id:m.toolCallId,cache_control:H$,content:j$})}break}if(F$==="web_fetch"){let P$=m.output;if(P$.type==="error-json"){let U$={};try{if(typeof P$.value==="string")U$=JSON.parse(P$.value);else if(typeof P$.value==="object"&&P$.value!==null)U$=P$.value}catch(n){let G$=(E=P$.value)==null?void 0:E.errorCode;U$={errorCode:typeof G$==="string"?G$:"unknown"}}Y$.push({type:"web_fetch_tool_result",tool_use_id:m.toolCallId,content:{type:"web_fetch_tool_result_error",error_code:(b=U$.errorCode)!=null?b:"unknown"},cache_control:H$});break}if(P$.type!=="json"){Y.push({type:"other",message:`provider executed tool result output type ${P$.type} for tool ${m.toolName} is not supported`});break}let j$=await z6({value:P$.value,schema:tf});Y$.push({type:"web_fetch_tool_result",tool_use_id:m.toolCallId,content:{type:"web_fetch_result",url:j$.url,retrieved_at:j$.retrievedAt,content:{type:"document",title:j$.content.title,citations:j$.content.citations,source:{type:j$.content.source.type,media_type:j$.content.source.mediaType,data:j$.content.source.data}}},cache_control:H$});break}if(F$==="web_search"){let P$=m.output;if(P$.type!=="json"){Y.push({type:"other",message:`provider executed tool result output type ${P$.type} for tool ${m.toolName} is not supported`});break}let j$=await z6({value:P$.value,schema:sf});Y$.push({type:"web_search_tool_result",tool_use_id:m.toolCallId,content:j$.map((U$)=>({url:U$.url,title:U$.title,page_age:U$.pageAge,encrypted_content:U$.encryptedContent,type:U$.type})),cache_control:H$});break}if(F$==="tool_search_tool_regex"||F$==="tool_search_tool_bm25"){let P$=m.output;if(P$.type!=="json"){Y.push({type:"other",message:`provider executed tool result output type ${P$.type} for tool ${m.toolName} is not supported`});break}let U$=(await z6({value:P$.value,schema:Yg})).map((n)=>({type:"tool_reference",tool_name:n.toolName}));Y$.push({type:"tool_search_tool_result",tool_use_id:m.toolCallId,content:{type:"tool_search_tool_search_result",tool_references:U$},cache_control:H$});break}Y.push({type:"other",message:`provider executed tool result for tool ${m.toolName} is not supported`});break}}}}t.push({role:"assistant",content:Y$});break}default:throw Error(`content type: ${a}`)}}return{prompt:{system:k,messages:t},betas:R}}function t2$($){let X=[],Y=void 0;for(let W of $){let{role:J}=W;switch(J){case"system":{if((Y==null?void 0:Y.type)!=="system")Y={type:"system",messages:[]},X.push(Y);Y.messages.push(W);break}case"assistant":{if((Y==null?void 0:Y.type)!=="assistant")Y={type:"assistant",messages:[]},X.push(Y);Y.messages.push(W);break}case"user":{if((Y==null?void 0:Y.type)!=="user")Y={type:"user",messages:[]},X.push(Y);Y.messages.push(W);break}case"tool":{if((Y==null?void 0:Y.type)!=="user")Y={type:"user",messages:[]},X.push(Y);Y.messages.push(W);break}default:throw Error(`Unsupported role: ${J}`)}}return X}function HO({finishReason:$,isJsonResponseFromTool:X}){switch($){case"pause_turn":case"end_turn":case"stop_sequence":return"stop";case"refusal":return"content-filter";case"tool_use":return X?"stop":"tool-calls";case"max_tokens":case"model_context_window_exceeded":return"length";case"compaction":return"other";default:return"other"}}function nf($,X,Y){var W;if($.type==="web_search_result_location")return{type:"source",sourceType:"url",id:Y(),url:$.url,title:$.title,providerMetadata:{anthropic:{citedText:$.cited_text,encryptedIndex:$.encrypted_index}}};if($.type!=="page_location"&&$.type!=="char_location")return;let J=X[$.document_index];if(!J)return;return{type:"source",sourceType:"document",id:Y(),mediaType:J.mediaType,title:(W=$.document_title)!=null?W:J.title,filename:J.filename,providerMetadata:{anthropic:$.type==="page_location"?{citedText:$.cited_text,startPageNumber:$.start_page_number,endPageNumber:$.end_page_number}:{citedText:$.cited_text,startCharIndex:$.start_char_index,endCharIndex:$.end_char_index}}}}function $W$($){if($.includes("claude-sonnet-4-6")||$.includes("claude-opus-4-6"))return{maxOutputTokens:128000,supportsStructuredOutput:!0,isKnownModel:!0};else if($.includes("claude-sonnet-4-5")||$.includes("claude-opus-4-5")||$.includes("claude-haiku-4-5"))return{maxOutputTokens:64000,supportsStructuredOutput:!0,isKnownModel:!0};else if($.includes("claude-opus-4-1"))return{maxOutputTokens:32000,supportsStructuredOutput:!0,isKnownModel:!0};else if($.includes("claude-sonnet-4-"))return{maxOutputTokens:64000,supportsStructuredOutput:!1,isKnownModel:!0};else if($.includes("claude-opus-4-"))return{maxOutputTokens:32000,supportsStructuredOutput:!1,isKnownModel:!0};else if($.includes("claude-3-haiku"))return{maxOutputTokens:4096,supportsStructuredOutput:!1,isKnownModel:!0};else return{maxOutputTokens:4096,supportsStructuredOutput:!1,isKnownModel:!1}}function of($){if(!$)return!1;let X=!1,Y=!1;for(let W of $){if("type"in W&&(W.type==="web_fetch_20260209"||W.type==="web_search_20260209")){X=!0;continue}if(W.name==="code_execution"){Y=!0;break}}return X&&!Y}function af($){return $?{appliedEdits:$.applied_edits.map((X)=>{switch(X.type){case"clear_tool_uses_20250919":return{type:X.type,clearedToolUses:X.cleared_tool_uses,clearedInputTokens:X.cleared_input_tokens};case"clear_thinking_20251015":return{type:X.type,clearedThinkingTurns:X.cleared_thinking_turns,clearedInputTokens:X.cleared_input_tokens};case"compact_20260112":return{type:X.type}}}).filter((X)=>X!==void 0)}:null}function VO($={}){var X,Y;let W=(X=X9(c0({settingValue:$.baseURL,environmentVariableName:"ANTHROPIC_BASE_URL"})))!=null?X:"https://api.anthropic.com/v1",J=(Y=$.name)!=null?Y:"anthropic.messages";if($.apiKey&&$.authToken)throw new NX({argument:"apiKey/authToken",message:"Both apiKey and authToken were provided. Please use only one authentication method."});let U=()=>{let V=$.authToken?{Authorization:`Bearer ${$.authToken}`}:{"x-api-key":xX({apiKey:$.apiKey,environmentVariableName:"ANTHROPIC_API_KEY",description:"Anthropic"})};return $4({"anthropic-version":"2023-06-01",...V,...$.headers},`ai-sdk/anthropic/${D2$}`)},H=(V)=>{var K;return new e2$(V,{provider:J,baseURL:W,headers:U,fetch:$.fetch,generateId:(K=$.generateId)!=null?K:x6,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})})},D=function(V){if(new.target)throw Error("The Anthropic model function cannot be called with the new keyword.");return H(V)};return D.specificationVersion="v3",D.languageModel=H,D.chat=H,D.messages=H,D.embeddingModel=(V)=>{throw new CQ({modelId:V,modelType:"embeddingModel"})},D.textEmbeddingModel=D.embeddingModel,D.imageModel=(V)=>{throw new CQ({modelId:V,modelType:"imageModel"})},D.tools=RW$,D}var D2$="3.0.58",V2$,pf,K2$,Q2$,F2$,cf,df,lf=4,DO=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl($,X){let Y=q2$($);if(!Y)return;if(!X.canCache){this.warnings.push({type:"unsupported",feature:"cache_control on non-cacheable context",details:`cache_control cannot be set on ${X.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>lf){this.warnings.push({type:"unsupported",feature:"cacheControl breakpoint limit",details:`Maximum ${lf} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return Y}getWarnings(){return this.warnings}},w2$,Z2$,z2$,O2$=($={})=>{return z2$($)},N2$,A2$,B2$,M2$,j2$=($={})=>{return M2$($)},R2$,sf,L2$,E2$,P2$=($={})=>{return E2$($)},I2$,_2$,T2$,C2$,S2$=($={})=>{return C2$($)},b2$,tf,x2$,k2$,v2$=($={})=>{return k2$($)},ef,y2$,f2$,g2$=($={})=>{return f2$($)},$g,m2$,u2$,p2$=($={})=>{return u2$($)},Xg,c2$,d2$,l2$=($={})=>{return d2$($)},Yg,i2$,r2$,n2$=($={})=>{return r2$($)},e2$=class{constructor($,X){this.specificationVersion="v3";var Y;this.modelId=$,this.config=X,this.generateId=(Y=X.generateId)!=null?Y:x6}supportsUrl($){return $.protocol==="https:"}get provider(){return this.config.provider}get providerOptionsName(){let $=this.config.provider,X=$.indexOf(".");return X===-1?$:$.substring(0,X)}get supportedUrls(){var $,X,Y;return(Y=(X=($=this.config).supportedUrls)==null?void 0:X.call($))!=null?Y:{}}async getArgs({userSuppliedBetas:$,prompt:X,maxOutputTokens:Y,temperature:W,topP:J,topK:U,frequencyPenalty:H,presencePenalty:D,stopSequences:V,responseFormat:K,seed:Q,tools:q,toolChoice:F,providerOptions:w,stream:z}){var O,N,L,P,j,v,y;let E=[];if(H!=null)E.push({type:"unsupported",feature:"frequencyPenalty"});if(D!=null)E.push({type:"unsupported",feature:"presencePenalty"});if(Q!=null)E.push({type:"unsupported",feature:"seed"});if(W!=null&&W>1)E.push({type:"unsupported",feature:"temperature",details:`${W} exceeds anthropic maximum of 1.0. clamped to 1.0`}),W=1;else if(W!=null&&W<0)E.push({type:"unsupported",feature:"temperature",details:`${W} is below anthropic minimum of 0. clamped to 0`}),W=0;if((K==null?void 0:K.type)==="json"){if(K.schema==null)E.push({type:"unsupported",feature:"responseFormat",details:"JSON response format requires a schema. The response format is ignored."})}let b=this.providerOptionsName,R=await E6({provider:"anthropic",providerOptions:w,schema:df}),I=b!=="anthropic"?await E6({provider:b,providerOptions:w,schema:df}):null,d=I!=null,k=Object.assign({},R!=null?R:{},I!=null?I:{}),{maxOutputTokens:t,supportsStructuredOutput:h,isKnownModel:f}=$W$(this.modelId),l=((O=this.config.supportsNativeStructuredOutput)!=null?O:!0)&&h,o=(N=k==null?void 0:k.structuredOutputMode)!=null?N:"auto",g=o==="outputFormat"||o==="auto"&&l,a=(K==null?void 0:K.type)==="json"&&K.schema!=null&&!g?{type:"function",name:"json",description:"Respond with a JSON object.",inputSchema:K.schema}:void 0,Y$=k==null?void 0:k.contextManagement,_=new DO,V$=AG({tools:q,providerToolNames:{"anthropic.code_execution_20250522":"code_execution","anthropic.code_execution_20250825":"code_execution","anthropic.code_execution_20260120":"code_execution","anthropic.computer_20241022":"computer","anthropic.computer_20250124":"computer","anthropic.text_editor_20241022":"str_replace_editor","anthropic.text_editor_20250124":"str_replace_editor","anthropic.text_editor_20250429":"str_replace_based_edit_tool","anthropic.text_editor_20250728":"str_replace_based_edit_tool","anthropic.bash_20241022":"bash","anthropic.bash_20250124":"bash","anthropic.memory_20250818":"memory","anthropic.web_search_20250305":"web_search","anthropic.web_search_20260209":"web_search","anthropic.web_fetch_20250910":"web_fetch","anthropic.web_fetch_20260209":"web_fetch","anthropic.tool_search_regex_20251119":"tool_search_tool_regex","anthropic.tool_search_bm25_20251119":"tool_search_tool_bm25"}}),{prompt:o$,betas:T}=await s2$({prompt:X,sendReasoning:(L=k==null?void 0:k.sendReasoning)!=null?L:!0,warnings:E,cacheControlValidator:_,toolNameMapping:V$}),B$=(P=k==null?void 0:k.thinking)==null?void 0:P.type,k$=B$==="enabled"||B$==="adaptive",m=B$==="enabled"?(j=k==null?void 0:k.thinking)==null?void 0:j.budgetTokens:void 0,T$=Y!=null?Y:t,H$={model:this.modelId,max_tokens:T$,temperature:W,top_k:U,top_p:J,stop_sequences:V,...k$&&{thinking:{type:B$,...m!=null&&{budget_tokens:m}}},...((k==null?void 0:k.effort)||g&&(K==null?void 0:K.type)==="json"&&K.schema!=null)&&{output_config:{...(k==null?void 0:k.effort)&&{effort:k.effort},...g&&(K==null?void 0:K.type)==="json"&&K.schema!=null&&{format:{type:"json_schema",schema:K.schema}}}},...(k==null?void 0:k.speed)&&{speed:k.speed},...(k==null?void 0:k.cacheControl)&&{cache_control:k.cacheControl},...(k==null?void 0:k.mcpServers)&&k.mcpServers.length>0&&{mcp_servers:k.mcpServers.map((G$)=>({type:G$.type,name:G$.name,url:G$.url,authorization_token:G$.authorizationToken,tool_configuration:G$.toolConfiguration?{allowed_tools:G$.toolConfiguration.allowedTools,enabled:G$.toolConfiguration.enabled}:void 0}))},...(k==null?void 0:k.container)&&{container:k.container.skills&&k.container.skills.length>0?{id:k.container.id,skills:k.container.skills.map((G$)=>({type:G$.type,skill_id:G$.skillId,version:G$.version}))}:k.container.id},system:o$.system,messages:o$.messages,...Y$&&{context_management:{edits:Y$.edits.map((G$)=>{let S$=G$.type;switch(S$){case"clear_tool_uses_20250919":return{type:G$.type,...G$.trigger!==void 0&&{trigger:G$.trigger},...G$.keep!==void 0&&{keep:G$.keep},...G$.clearAtLeast!==void 0&&{clear_at_least:G$.clearAtLeast},...G$.clearToolInputs!==void 0&&{clear_tool_inputs:G$.clearToolInputs},...G$.excludeTools!==void 0&&{exclude_tools:G$.excludeTools}};case"clear_thinking_20251015":return{type:G$.type,...G$.keep!==void 0&&{keep:G$.keep}};case"compact_20260112":return{type:G$.type,...G$.trigger!==void 0&&{trigger:G$.trigger},...G$.pauseAfterCompaction!==void 0&&{pause_after_compaction:G$.pauseAfterCompaction},...G$.instructions!==void 0&&{instructions:G$.instructions}};default:E.push({type:"other",message:`Unknown context management strategy: ${S$}`});return}}).filter((G$)=>G$!==void 0)}}};if(k$){if(B$==="enabled"&&m==null)E.push({type:"compatibility",feature:"extended thinking",details:"thinking budget is required when thinking is enabled. using default budget of 1024 tokens."}),H$.thinking={type:"enabled",budget_tokens:1024},m=1024;if(H$.temperature!=null)H$.temperature=void 0,E.push({type:"unsupported",feature:"temperature",details:"temperature is not supported when thinking is enabled"});if(U!=null)H$.top_k=void 0,E.push({type:"unsupported",feature:"topK",details:"topK is not supported when thinking is enabled"});if(J!=null)H$.top_p=void 0,E.push({type:"unsupported",feature:"topP",details:"topP is not supported when thinking is enabled"});H$.max_tokens=T$+(m!=null?m:0)}else if(J!=null&&W!=null)E.push({type:"unsupported",feature:"topP",details:"topP is not supported when temperature is set. topP is ignored."}),H$.top_p=void 0;if(f&&H$.max_tokens>t){if(Y!=null)E.push({type:"unsupported",feature:"maxOutputTokens",details:`${H$.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${t} max output tokens. The max output tokens have been limited to ${t}.`});H$.max_tokens=t}if((k==null?void 0:k.mcpServers)&&k.mcpServers.length>0)T.add("mcp-client-2025-04-04");if(Y$){if(T.add("context-management-2025-06-27"),Y$.edits.some((G$)=>G$.type==="compact_20260112"))T.add("compact-2026-01-12")}if((k==null?void 0:k.container)&&k.container.skills&&k.container.skills.length>0){if(T.add("code-execution-2025-08-25"),T.add("skills-2025-10-02"),T.add("files-api-2025-04-14"),!(q==null?void 0:q.some((G$)=>G$.type==="provider"&&(G$.id==="anthropic.code_execution_20250825"||G$.id==="anthropic.code_execution_20260120"))))E.push({type:"other",message:"code execution tool is required when using skills"})}if(k==null?void 0:k.effort)T.add("effort-2025-11-24");if((k==null?void 0:k.speed)==="fast")T.add("fast-mode-2026-02-01");if(z&&((v=k==null?void 0:k.toolStreaming)!=null?v:!0))T.add("fine-grained-tool-streaming-2025-05-14");let{tools:F$,toolChoice:P$,toolWarnings:j$,betas:U$}=await h2$(a!=null?{tools:[...q!=null?q:[],a],toolChoice:{type:"required"},disableParallelToolUse:!0,cacheControlValidator:_,supportsStructuredOutput:!1}:{tools:q!=null?q:[],toolChoice:F,disableParallelToolUse:k==null?void 0:k.disableParallelToolUse,cacheControlValidator:_,supportsStructuredOutput:l}),n=_.getWarnings();return{args:{...H$,tools:F$,tool_choice:P$,stream:z===!0?!0:void 0},warnings:[...E,...j$,...n],betas:new Set([...T,...U$,...$,...(y=k==null?void 0:k.anthropicBeta)!=null?y:[]]),usesJsonResponseTool:a!=null,toolNameMapping:V$,providerOptionsName:b,usedCustomProviderKey:d}}async getHeaders({betas:$,headers:X}){return V6(await B6(this.config.headers),X,$.size>0?{"anthropic-beta":Array.from($).join(",")}:{})}async getBetasFromHeaders($){var X,Y;let J=(X=(await B6(this.config.headers))["anthropic-beta"])!=null?X:"",U=(Y=$==null?void 0:$["anthropic-beta"])!=null?Y:"";return new Set([...J.toLowerCase().split(","),...U.toLowerCase().split(",")].map((H)=>H.trim()).filter((H)=>H!==""))}buildRequestUrl($){var X,Y,W;return(W=(Y=(X=this.config).buildRequestUrl)==null?void 0:Y.call(X,this.config.baseURL,$))!=null?W:`${this.config.baseURL}/messages`}transformRequestBody($,X){var Y,W,J;return(J=(W=(Y=this.config).transformRequestBody)==null?void 0:W.call(Y,$,X))!=null?J:$}extractCitationDocuments($){let X=(Y)=>{var W,J;if(Y.type!=="file")return!1;if(Y.mediaType!=="application/pdf"&&Y.mediaType!=="text/plain")return!1;let U=(W=Y.providerOptions)==null?void 0:W.anthropic,H=U==null?void 0:U.citations;return(J=H==null?void 0:H.enabled)!=null?J:!1};return $.filter((Y)=>Y.role==="user").flatMap((Y)=>Y.content).filter(X).map((Y)=>{var W;let J=Y;return{title:(W=J.filename)!=null?W:"Untitled Document",filename:J.filename,mediaType:J.mediaType}})}async doGenerate($){var X,Y,W,J,U,H,D;let{args:V,warnings:K,betas:Q,usesJsonResponseTool:q,toolNameMapping:F,providerOptionsName:w,usedCustomProviderKey:z}=await this.getArgs({...$,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders($.headers)}),O=[...this.extractCitationDocuments($.prompt)],N=of(V.tools),{responseHeaders:L,value:P,rawValue:j}=await q6({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:Q,headers:$.headers}),body:this.transformRequestBody(V,Q),failedResponseHandler:pf,successfulResponseHandler:M6(K2$),abortSignal:$.abortSignal,fetch:this.config.fetch}),v=[],y={},E={},b=!1;for(let R of P.content)switch(R.type){case"text":{if(!q){if(v.push({type:"text",text:R.text}),R.citations)for(let I of R.citations){let d=nf(I,O,this.generateId);if(d)v.push(d)}}break}case"thinking":{v.push({type:"reasoning",text:R.thinking,providerMetadata:{anthropic:{signature:R.signature}}});break}case"redacted_thinking":{v.push({type:"reasoning",text:"",providerMetadata:{anthropic:{redactedData:R.data}}});break}case"compaction":{v.push({type:"text",text:R.content,providerMetadata:{anthropic:{type:"compaction"}}});break}case"tool_use":{if(q&&R.name==="json")b=!0,v.push({type:"text",text:JSON.stringify(R.input)});else{let d=R.caller,k=d?{type:d.type,toolId:"tool_id"in d?d.tool_id:void 0}:void 0;v.push({type:"tool-call",toolCallId:R.id,toolName:R.name,input:JSON.stringify(R.input),...k&&{providerMetadata:{anthropic:{caller:k}}}})}break}case"server_tool_use":{if(R.name==="text_editor_code_execution"||R.name==="bash_code_execution")v.push({type:"tool-call",toolCallId:R.id,toolName:F.toCustomToolName("code_execution"),input:JSON.stringify({type:R.name,...R.input}),providerExecuted:!0});else if(R.name==="web_search"||R.name==="code_execution"||R.name==="web_fetch"){let I=R.name==="code_execution"&&R.input!=null&&typeof R.input==="object"&&"code"in R.input&&!("type"in R.input)?{type:"programmatic-tool-call",...R.input}:R.input;v.push({type:"tool-call",toolCallId:R.id,toolName:F.toCustomToolName(R.name),input:JSON.stringify(I),providerExecuted:!0,...N&&R.name==="code_execution"?{dynamic:!0}:{}})}else if(R.name==="tool_search_tool_regex"||R.name==="tool_search_tool_bm25")E[R.id]=R.name,v.push({type:"tool-call",toolCallId:R.id,toolName:F.toCustomToolName(R.name),input:JSON.stringify(R.input),providerExecuted:!0});break}case"mcp_tool_use":{y[R.id]={type:"tool-call",toolCallId:R.id,toolName:R.name,input:JSON.stringify(R.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:R.server_name}}},v.push(y[R.id]);break}case"mcp_tool_result":{v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:y[R.tool_use_id].toolName,isError:R.is_error,result:R.content,dynamic:!0,providerMetadata:y[R.tool_use_id].providerMetadata});break}case"web_fetch_tool_result":{if(R.content.type==="web_fetch_result")O.push({title:(X=R.content.content.title)!=null?X:R.content.url,mediaType:R.content.content.source.media_type}),v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:R.content.url,retrievedAt:R.content.retrieved_at,content:{type:R.content.content.type,title:R.content.content.title,citations:R.content.content.citations,source:{type:R.content.content.source.type,mediaType:R.content.content.source.media_type,data:R.content.content.source.data}}}});else if(R.content.type==="web_fetch_tool_result_error")v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:R.content.error_code}});break}case"web_search_tool_result":{if(Array.isArray(R.content)){v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName("web_search"),result:R.content.map((I)=>{var d;return{url:I.url,title:I.title,pageAge:(d=I.page_age)!=null?d:null,encryptedContent:I.encrypted_content,type:I.type}})});for(let I of R.content)v.push({type:"source",sourceType:"url",id:this.generateId(),url:I.url,title:I.title,providerMetadata:{anthropic:{pageAge:(Y=I.page_age)!=null?Y:null}}})}else v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:R.content.error_code}});break}case"code_execution_tool_result":{if(R.content.type==="code_execution_result")v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName("code_execution"),result:{type:R.content.type,stdout:R.content.stdout,stderr:R.content.stderr,return_code:R.content.return_code,content:(W=R.content.content)!=null?W:[]}});else if(R.content.type==="encrypted_code_execution_result")v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName("code_execution"),result:{type:R.content.type,encrypted_stdout:R.content.encrypted_stdout,stderr:R.content.stderr,return_code:R.content.return_code,content:(J=R.content.content)!=null?J:[]}});else if(R.content.type==="code_execution_tool_result_error")v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:R.content.error_code}});break}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName("code_execution"),result:R.content});break}case"tool_search_tool_result":{let I=E[R.tool_use_id];if(I==null){let d=F.toCustomToolName("tool_search_tool_bm25"),k=F.toCustomToolName("tool_search_tool_regex");if(d!=="tool_search_tool_bm25")I="tool_search_tool_bm25";else if(k!=="tool_search_tool_regex")I="tool_search_tool_regex";else I="tool_search_tool_regex"}if(R.content.type==="tool_search_tool_search_result")v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName(I),result:R.content.tool_references.map((d)=>({type:d.type,toolName:d.tool_name}))});else v.push({type:"tool-result",toolCallId:R.tool_use_id,toolName:F.toCustomToolName(I),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:R.content.error_code}});break}}return{content:v,finishReason:{unified:HO({finishReason:P.stop_reason,isJsonResponseFromTool:b}),raw:(U=P.stop_reason)!=null?U:void 0},usage:rf({usage:P.usage}),request:{body:V},response:{id:(H=P.id)!=null?H:void 0,modelId:(D=P.model)!=null?D:void 0,headers:L,body:j},warnings:K,providerMetadata:(()=>{var R,I,d,k,t;let h={usage:P.usage,cacheCreationInputTokens:(R=P.usage.cache_creation_input_tokens)!=null?R:null,stopSequence:(I=P.stop_sequence)!=null?I:null,iterations:P.usage.iterations?P.usage.iterations.map((l)=>({type:l.type,inputTokens:l.input_tokens,outputTokens:l.output_tokens})):null,container:P.container?{expiresAt:P.container.expires_at,id:P.container.id,skills:(k=(d=P.container.skills)==null?void 0:d.map((l)=>({type:l.type,skillId:l.skill_id,version:l.version})))!=null?k:null}:null,contextManagement:(t=af(P.context_management))!=null?t:null},f={anthropic:h};if(z&&w!=="anthropic")f[w]=h;return f})()}}async doStream($){var X,Y;let{args:W,warnings:J,betas:U,usesJsonResponseTool:H,toolNameMapping:D,providerOptionsName:V,usedCustomProviderKey:K}=await this.getArgs({...$,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders($.headers)}),Q=[...this.extractCitationDocuments($.prompt)],q=of(W.tools),F=this.buildRequestUrl(!0),{responseHeaders:w,value:z}=await q6({url:F,headers:await this.getHeaders({betas:U,headers:$.headers}),body:this.transformRequestBody(W,U),failedResponseHandler:pf,successfulResponseHandler:c1(Q2$),abortSignal:$.abortSignal,fetch:this.config.fetch}),O={unified:"other",raw:void 0},N={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},L={},P={},j={},v=null,y=void 0,E=null,b=null,R=null,I=!1,d=void 0,k=this.generateId,t=z.pipeThrough(new TransformStream({start(o){o.enqueue({type:"stream-start",warnings:J})},transform(o,g){var a,Y$,_,V$,o$,T,B$,k$,m,T$,H$,F$,P$,j$;if($.includeRawChunks)g.enqueue({type:"raw",rawValue:o.rawValue});if(!o.success){g.enqueue({type:"error",error:o.error});return}let U$=o.value;switch(U$.type){case"ping":return;case"content_block_start":{let n=U$.content_block,G$=n.type;switch(d=G$,G$){case"text":{if(H)return;L[U$.index]={type:"text"},g.enqueue({type:"text-start",id:String(U$.index)});return}case"thinking":{L[U$.index]={type:"reasoning"},g.enqueue({type:"reasoning-start",id:String(U$.index)});return}case"redacted_thinking":{L[U$.index]={type:"reasoning"},g.enqueue({type:"reasoning-start",id:String(U$.index),providerMetadata:{anthropic:{redactedData:n.data}}});return}case"compaction":{L[U$.index]={type:"text"},g.enqueue({type:"text-start",id:String(U$.index),providerMetadata:{anthropic:{type:"compaction"}}});return}case"tool_use":{if(H&&n.name==="json")I=!0,L[U$.index]={type:"text"},g.enqueue({type:"text-start",id:String(U$.index)});else{let v$=n.caller,j6=v$?{type:v$.type,toolId:"tool_id"in v$?v$.tool_id:void 0}:void 0,l4=n.input&&Object.keys(n.input).length>0?JSON.stringify(n.input):"";L[U$.index]={type:"tool-call",toolCallId:n.id,toolName:n.name,input:l4,firstDelta:l4.length===0,...j6&&{caller:j6}},g.enqueue({type:"tool-input-start",id:n.id,toolName:n.name})}return}case"server_tool_use":{if(["web_fetch","web_search","code_execution","text_editor_code_execution","bash_code_execution"].includes(n.name)){let S$=n.name==="text_editor_code_execution"||n.name==="bash_code_execution"?"code_execution":n.name,v$=D.toCustomToolName(S$),j6=n.input!=null&&typeof n.input==="object"&&Object.keys(n.input).length>0?JSON.stringify(n.input):"";L[U$.index]={type:"tool-call",toolCallId:n.id,toolName:v$,input:j6,providerExecuted:!0,...q&&S$==="code_execution"?{dynamic:!0}:{},firstDelta:!0,providerToolName:n.name},g.enqueue({type:"tool-input-start",id:n.id,toolName:v$,providerExecuted:!0,...q&&S$==="code_execution"?{dynamic:!0}:{}})}else if(n.name==="tool_search_tool_regex"||n.name==="tool_search_tool_bm25"){j[n.id]=n.name;let S$=D.toCustomToolName(n.name);L[U$.index]={type:"tool-call",toolCallId:n.id,toolName:S$,input:"",providerExecuted:!0,firstDelta:!0,providerToolName:n.name},g.enqueue({type:"tool-input-start",id:n.id,toolName:S$,providerExecuted:!0})}return}case"web_fetch_tool_result":{if(n.content.type==="web_fetch_result")Q.push({title:(a=n.content.content.title)!=null?a:n.content.url,mediaType:n.content.content.source.media_type}),g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName("web_fetch"),result:{type:"web_fetch_result",url:n.content.url,retrievedAt:n.content.retrieved_at,content:{type:n.content.content.type,title:n.content.content.title,citations:n.content.content.citations,source:{type:n.content.content.source.type,mediaType:n.content.content.source.media_type,data:n.content.content.source.data}}}});else if(n.content.type==="web_fetch_tool_result_error")g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName("web_fetch"),isError:!0,result:{type:"web_fetch_tool_result_error",errorCode:n.content.error_code}});return}case"web_search_tool_result":{if(Array.isArray(n.content)){g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName("web_search"),result:n.content.map((S$)=>{var v$;return{url:S$.url,title:S$.title,pageAge:(v$=S$.page_age)!=null?v$:null,encryptedContent:S$.encrypted_content,type:S$.type}})});for(let S$ of n.content)g.enqueue({type:"source",sourceType:"url",id:k(),url:S$.url,title:S$.title,providerMetadata:{anthropic:{pageAge:(Y$=S$.page_age)!=null?Y$:null}}})}else g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName("web_search"),isError:!0,result:{type:"web_search_tool_result_error",errorCode:n.content.error_code}});return}case"code_execution_tool_result":{if(n.content.type==="code_execution_result")g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName("code_execution"),result:{type:n.content.type,stdout:n.content.stdout,stderr:n.content.stderr,return_code:n.content.return_code,content:(_=n.content.content)!=null?_:[]}});else if(n.content.type==="encrypted_code_execution_result")g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName("code_execution"),result:{type:n.content.type,encrypted_stdout:n.content.encrypted_stdout,stderr:n.content.stderr,return_code:n.content.return_code,content:(V$=n.content.content)!=null?V$:[]}});else if(n.content.type==="code_execution_tool_result_error")g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName("code_execution"),isError:!0,result:{type:"code_execution_tool_result_error",errorCode:n.content.error_code}});return}case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":{g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName("code_execution"),result:n.content});return}case"tool_search_tool_result":{let S$=j[n.tool_use_id];if(S$==null){let v$=D.toCustomToolName("tool_search_tool_bm25"),j6=D.toCustomToolName("tool_search_tool_regex");if(v$!=="tool_search_tool_bm25")S$="tool_search_tool_bm25";else if(j6!=="tool_search_tool_regex")S$="tool_search_tool_regex";else S$="tool_search_tool_regex"}if(n.content.type==="tool_search_tool_search_result")g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName(S$),result:n.content.tool_references.map((v$)=>({type:v$.type,toolName:v$.tool_name}))});else g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:D.toCustomToolName(S$),isError:!0,result:{type:"tool_search_tool_result_error",errorCode:n.content.error_code}});return}case"mcp_tool_use":{P[n.id]={type:"tool-call",toolCallId:n.id,toolName:n.name,input:JSON.stringify(n.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:"mcp-tool-use",serverName:n.server_name}}},g.enqueue(P[n.id]);return}case"mcp_tool_result":{g.enqueue({type:"tool-result",toolCallId:n.tool_use_id,toolName:P[n.tool_use_id].toolName,isError:n.is_error,result:n.content,dynamic:!0,providerMetadata:P[n.tool_use_id].providerMetadata});return}default:throw Error(`Unsupported content block type: ${G$}`)}}case"content_block_stop":{if(L[U$.index]!=null){let n=L[U$.index];switch(n.type){case"text":{g.enqueue({type:"text-end",id:String(U$.index)});break}case"reasoning":{g.enqueue({type:"reasoning-end",id:String(U$.index)});break}case"tool-call":if(!(H&&n.toolName==="json")){g.enqueue({type:"tool-input-end",id:n.toolCallId});let S$=n.input===""?"{}":n.input;if(n.providerToolName==="code_execution")try{let v$=JSON.parse(S$);if(v$!=null&&typeof v$==="object"&&"code"in v$&&!("type"in v$))S$=JSON.stringify({type:"programmatic-tool-call",...v$})}catch(v$){}g.enqueue({type:"tool-call",toolCallId:n.toolCallId,toolName:n.toolName,input:S$,providerExecuted:n.providerExecuted,...q&&n.providerToolName==="code_execution"?{dynamic:!0}:{},...n.caller&&{providerMetadata:{anthropic:{caller:n.caller}}}})}break}delete L[U$.index]}d=void 0;return}case"content_block_delta":{let n=U$.delta.type;switch(n){case"text_delta":{if(H)return;g.enqueue({type:"text-delta",id:String(U$.index),delta:U$.delta.text});return}case"thinking_delta":{g.enqueue({type:"reasoning-delta",id:String(U$.index),delta:U$.delta.thinking});return}case"signature_delta":{if(d==="thinking")g.enqueue({type:"reasoning-delta",id:String(U$.index),delta:"",providerMetadata:{anthropic:{signature:U$.delta.signature}}});return}case"compaction_delta":{if(U$.delta.content!=null)g.enqueue({type:"text-delta",id:String(U$.index),delta:U$.delta.content});return}case"input_json_delta":{let G$=L[U$.index],S$=U$.delta.partial_json;if(S$.length===0)return;if(I){if((G$==null?void 0:G$.type)!=="text")return;g.enqueue({type:"text-delta",id:String(U$.index),delta:S$})}else{if((G$==null?void 0:G$.type)!=="tool-call")return;if(G$.firstDelta&&(G$.providerToolName==="bash_code_execution"||G$.providerToolName==="text_editor_code_execution"))S$=`{"type": "${G$.providerToolName}",${S$.substring(1)}`;g.enqueue({type:"tool-input-delta",id:G$.toolCallId,delta:S$}),G$.input+=S$,G$.firstDelta=!1}return}case"citations_delta":{let G$=U$.delta.citation,S$=nf(G$,Q,k);if(S$)g.enqueue(S$);return}default:throw Error(`Unsupported delta type: ${n}`)}}case"message_start":{if(N.input_tokens=U$.message.usage.input_tokens,N.cache_read_input_tokens=(o$=U$.message.usage.cache_read_input_tokens)!=null?o$:0,N.cache_creation_input_tokens=(T=U$.message.usage.cache_creation_input_tokens)!=null?T:0,y={...U$.message.usage},E=(B$=U$.message.usage.cache_creation_input_tokens)!=null?B$:null,U$.message.container!=null)R={expiresAt:U$.message.container.expires_at,id:U$.message.container.id,skills:null};if(U$.message.stop_reason!=null)O={unified:HO({finishReason:U$.message.stop_reason,isJsonResponseFromTool:I}),raw:U$.message.stop_reason};if(g.enqueue({type:"response-metadata",id:(k$=U$.message.id)!=null?k$:void 0,modelId:(m=U$.message.model)!=null?m:void 0}),U$.message.content!=null)for(let n=0;n<U$.message.content.length;n++){let G$=U$.message.content[n];if(G$.type==="tool_use"){let S$=G$.caller,v$=S$?{type:S$.type,toolId:"tool_id"in S$?S$.tool_id:void 0}:void 0;g.enqueue({type:"tool-input-start",id:G$.id,toolName:G$.name});let j6=JSON.stringify((T$=G$.input)!=null?T$:{});g.enqueue({type:"tool-input-delta",id:G$.id,delta:j6}),g.enqueue({type:"tool-input-end",id:G$.id}),g.enqueue({type:"tool-call",toolCallId:G$.id,toolName:G$.name,input:j6,...v$&&{providerMetadata:{anthropic:{caller:v$}}}})}}return}case"message_delta":{if(U$.usage.input_tokens!=null&&N.input_tokens!==U$.usage.input_tokens)N.input_tokens=U$.usage.input_tokens;if(N.output_tokens=U$.usage.output_tokens,U$.usage.cache_read_input_tokens!=null)N.cache_read_input_tokens=U$.usage.cache_read_input_tokens;if(U$.usage.cache_creation_input_tokens!=null)N.cache_creation_input_tokens=U$.usage.cache_creation_input_tokens,E=U$.usage.cache_creation_input_tokens;if(U$.usage.iterations!=null)N.iterations=U$.usage.iterations;if(O={unified:HO({finishReason:U$.delta.stop_reason,isJsonResponseFromTool:I}),raw:(H$=U$.delta.stop_reason)!=null?H$:void 0},b=(F$=U$.delta.stop_sequence)!=null?F$:null,R=U$.delta.container!=null?{expiresAt:U$.delta.container.expires_at,id:U$.delta.container.id,skills:(j$=(P$=U$.delta.container.skills)==null?void 0:P$.map((n)=>({type:n.type,skillId:n.skill_id,version:n.version})))!=null?j$:null}:null,U$.context_management)v=af(U$.context_management);y={...y,...U$.usage};return}case"message_stop":{let n={usage:y!=null?y:null,cacheCreationInputTokens:E,stopSequence:b,iterations:N.iterations?N.iterations.map((S$)=>({type:S$.type,inputTokens:S$.input_tokens,outputTokens:S$.output_tokens})):null,container:R,contextManagement:v},G$={anthropic:n};if(K&&V!=="anthropic")G$[V]=n;g.enqueue({type:"finish",finishReason:O,usage:rf({usage:N,rawUsage:y}),providerMetadata:G$});return}case"error":{g.enqueue({type:"error",error:U$.error});return}default:throw Error(`Unsupported chunk type: ${U$}`)}}})),[h,f]=t.tee(),l=h.getReader();try{await l.read();let o=await l.read();if(((X=o.value)==null?void 0:X.type)==="raw")o=await l.read();if(((Y=o.value)==null?void 0:Y.type)==="error"){let g=o.value.error;throw new R6({message:g.message,url:F,requestBodyValues:W,statusCode:g.type==="overloaded_error"?529:500,responseHeaders:w,responseBody:JSON.stringify(g),isRetryable:g.type==="overloaded_error"})}}finally{l.cancel().catch(()=>{}),l.releaseLock()}return{stream:f,request:{body:W},response:{headers:w}}}},XW$,YW$,JW$,WW$,UW$,GW$,HW$,DW$,VW$,KW$,QW$,FW$,qW$,wW$,ZW$,zW$,OW$,NW$,AW$,BW$,MW$,jW$=($={})=>{return MW$($)},RW$,Jg;var Wg=A(()=>{f$();$$();f$();$$();$$();I$();$$();I$();I$();f$();$$();I$();$$();$$();I$();$$();I$();$$();I$();$$();I$();$$();f$();$$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();V2$=p(()=>u(G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}))),pf=E4({errorSchema:V2$,errorToMessage:($)=>$.error.message}),K2$=p(()=>u(G.object({type:G.literal("message"),id:G.string().nullish(),model:G.string().nullish(),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string(),citations:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])).optional()}),G.object({type:G.literal("thinking"),thinking:G.string(),signature:G.string()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])),stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish(),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}))),Q2$=p(()=>u(G.discriminatedUnion("type",[G.object({type:G.literal("message_start"),message:G.object({id:G.string().nullish(),model:G.string().nullish(),role:G.string().nullish(),usage:G.looseObject({input_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish()}),content:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.unknown(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()})])).nullish(),stop_reason:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string()}).nullish()})}),G.object({type:G.literal("content_block_start"),index:G.number(),content_block:G.discriminatedUnion("type",[G.object({type:G.literal("text"),text:G.string()}),G.object({type:G.literal("thinking"),thinking:G.string()}),G.object({type:G.literal("tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).optional(),caller:G.union([G.object({type:G.literal("code_execution_20250825"),tool_id:G.string()}),G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("redacted_thinking"),data:G.string()}),G.object({type:G.literal("compaction"),content:G.string().nullish()}),G.object({type:G.literal("server_tool_use"),id:G.string(),name:G.string(),input:G.record(G.string(),G.unknown()).nullish(),caller:G.union([G.object({type:G.literal("code_execution_20260120"),tool_id:G.string()}),G.object({type:G.literal("direct")})]).optional()}),G.object({type:G.literal("mcp_tool_use"),id:G.string(),name:G.string(),input:G.unknown(),server_name:G.string()}),G.object({type:G.literal("mcp_tool_result"),tool_use_id:G.string(),is_error:G.boolean(),content:G.array(G.union([G.string(),G.object({type:G.literal("text"),text:G.string()})]))}),G.object({type:G.literal("web_fetch_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("web_fetch_result"),url:G.string(),retrieved_at:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),media_type:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),media_type:G.literal("text/plain"),data:G.string()})])})}),G.object({type:G.literal("web_fetch_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("web_search_tool_result"),tool_use_id:G.string(),content:G.union([G.array(G.object({type:G.literal("web_search_result"),url:G.string(),title:G.string(),encrypted_content:G.string(),page_age:G.string().nullish()})),G.object({type:G.literal("web_search_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("code_execution_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("bash_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()})])}),G.object({type:G.literal("text_editor_code_execution_tool_result"),tool_use_id:G.string(),content:G.discriminatedUnion("type",[G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})])}),G.object({type:G.literal("tool_search_tool_result"),tool_use_id:G.string(),content:G.union([G.object({type:G.literal("tool_search_tool_search_result"),tool_references:G.array(G.object({type:G.literal("tool_reference"),tool_name:G.string()}))}),G.object({type:G.literal("tool_search_tool_result_error"),error_code:G.string()})])})])}),G.object({type:G.literal("content_block_delta"),index:G.number(),delta:G.discriminatedUnion("type",[G.object({type:G.literal("input_json_delta"),partial_json:G.string()}),G.object({type:G.literal("text_delta"),text:G.string()}),G.object({type:G.literal("thinking_delta"),thinking:G.string()}),G.object({type:G.literal("signature_delta"),signature:G.string()}),G.object({type:G.literal("compaction_delta"),content:G.string().nullish()}),G.object({type:G.literal("citations_delta"),citation:G.discriminatedUnion("type",[G.object({type:G.literal("web_search_result_location"),cited_text:G.string(),url:G.string(),title:G.string(),encrypted_index:G.string()}),G.object({type:G.literal("page_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_page_number:G.number(),end_page_number:G.number()}),G.object({type:G.literal("char_location"),cited_text:G.string(),document_index:G.number(),document_title:G.string().nullable(),start_char_index:G.number(),end_char_index:G.number()})])})])}),G.object({type:G.literal("content_block_stop"),index:G.number()}),G.object({type:G.literal("error"),error:G.object({type:G.string(),message:G.string()})}),G.object({type:G.literal("message_delta"),delta:G.object({stop_reason:G.string().nullish(),stop_sequence:G.string().nullish(),container:G.object({expires_at:G.string(),id:G.string(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skill_id:G.string(),version:G.string()})).nullish()}).nullish()}),usage:G.looseObject({input_tokens:G.number().nullish(),output_tokens:G.number(),cache_creation_input_tokens:G.number().nullish(),cache_read_input_tokens:G.number().nullish(),iterations:G.array(G.object({type:G.union([G.literal("compaction"),G.literal("message")]),input_tokens:G.number(),output_tokens:G.number()})).nullish()}),context_management:G.object({applied_edits:G.array(G.union([G.object({type:G.literal("clear_tool_uses_20250919"),cleared_tool_uses:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("clear_thinking_20251015"),cleared_thinking_turns:G.number(),cleared_input_tokens:G.number()}),G.object({type:G.literal("compact_20260112")})]))}).nullish()}),G.object({type:G.literal("message_stop")}),G.object({type:G.literal("ping")})]))),F2$=p(()=>u(G.object({signature:G.string().optional(),redactedData:G.string().optional()}))),cf=G.object({citations:G.object({enabled:G.boolean()}).optional(),title:G.string().optional(),context:G.string().optional()}),df=G.object({sendReasoning:G.boolean().optional(),structuredOutputMode:G.enum(["outputFormat","jsonTool","auto"]).optional(),thinking:G.discriminatedUnion("type",[G.object({type:G.literal("adaptive")}),G.object({type:G.literal("enabled"),budgetTokens:G.number().optional()}),G.object({type:G.literal("disabled")})]).optional(),disableParallelToolUse:G.boolean().optional(),cacheControl:G.object({type:G.literal("ephemeral"),ttl:G.union([G.literal("5m"),G.literal("1h")]).optional()}).optional(),mcpServers:G.array(G.object({type:G.literal("url"),name:G.string(),url:G.string(),authorizationToken:G.string().nullish(),toolConfiguration:G.object({enabled:G.boolean().nullish(),allowedTools:G.array(G.string()).nullish()}).nullish()})).optional(),container:G.object({id:G.string().optional(),skills:G.array(G.object({type:G.union([G.literal("anthropic"),G.literal("custom")]),skillId:G.string(),version:G.string().optional()})).optional()}).optional(),toolStreaming:G.boolean().optional(),effort:G.enum(["low","medium","high","max"]).optional(),speed:G.enum(["fast","standard"]).optional(),anthropicBeta:G.array(G.string()).optional(),contextManagement:G.object({edits:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("clear_tool_uses_20250919"),trigger:G.discriminatedUnion("type",[G.object({type:G.literal("input_tokens"),value:G.number()}),G.object({type:G.literal("tool_uses"),value:G.number()})]).optional(),keep:G.object({type:G.literal("tool_uses"),value:G.number()}).optional(),clearAtLeast:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),clearToolInputs:G.boolean().optional(),excludeTools:G.array(G.string()).optional()}),G.object({type:G.literal("clear_thinking_20251015"),keep:G.union([G.literal("all"),G.object({type:G.literal("thinking_turns"),value:G.number()})]).optional()}),G.object({type:G.literal("compact_20260112"),trigger:G.object({type:G.literal("input_tokens"),value:G.number()}).optional(),pauseAfterCompaction:G.boolean().optional(),instructions:G.string().optional()})]))}).optional()});w2$=p(()=>u(G.object({maxCharacters:G.number().optional()}))),Z2$=p(()=>u(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),z2$=A6({id:"anthropic.text_editor_20250728",inputSchema:Z2$}),N2$=p(()=>u(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),A2$=p(()=>u(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),B2$=p(()=>u(G.object({query:G.string()}))),M2$=J6({id:"anthropic.web_search_20260209",inputSchema:B2$,outputSchema:A2$,supportsDeferredResults:!0}),R2$=p(()=>u(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),userLocation:G.object({type:G.literal("approximate"),city:G.string().optional(),region:G.string().optional(),country:G.string().optional(),timezone:G.string().optional()}).optional()}))),sf=p(()=>u(G.array(G.object({url:G.string(),title:G.string().nullable(),pageAge:G.string().nullable(),encryptedContent:G.string(),type:G.literal("web_search_result")})))),L2$=p(()=>u(G.object({query:G.string()}))),E2$=J6({id:"anthropic.web_search_20250305",inputSchema:L2$,outputSchema:sf,supportsDeferredResults:!0}),I2$=p(()=>u(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),_2$=p(()=>u(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),T2$=p(()=>u(G.object({url:G.string()}))),C2$=J6({id:"anthropic.web_fetch_20260209",inputSchema:T2$,outputSchema:_2$,supportsDeferredResults:!0}),b2$=p(()=>u(G.object({maxUses:G.number().optional(),allowedDomains:G.array(G.string()).optional(),blockedDomains:G.array(G.string()).optional(),citations:G.object({enabled:G.boolean()}).optional(),maxContentTokens:G.number().optional()}))),tf=p(()=>u(G.object({type:G.literal("web_fetch_result"),url:G.string(),content:G.object({type:G.literal("document"),title:G.string().nullable(),citations:G.object({enabled:G.boolean()}).optional(),source:G.union([G.object({type:G.literal("base64"),mediaType:G.literal("application/pdf"),data:G.string()}),G.object({type:G.literal("text"),mediaType:G.literal("text/plain"),data:G.string()})])}),retrievedAt:G.string().nullable()}))),x2$=p(()=>u(G.object({url:G.string()}))),k2$=J6({id:"anthropic.web_fetch_20250910",inputSchema:x2$,outputSchema:tf,supportsDeferredResults:!0});ef=p(()=>u(G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}))),y2$=p(()=>u(G.object({code:G.string()}))),f2$=J6({id:"anthropic.code_execution_20250522",inputSchema:y2$,outputSchema:ef}),$g=p(()=>u(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),m2$=p(()=>u(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),u2$=J6({id:"anthropic.code_execution_20250825",inputSchema:m2$,outputSchema:$g,supportsDeferredResults:!0}),Xg=p(()=>u(G.discriminatedUnion("type",[G.object({type:G.literal("code_execution_result"),stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("encrypted_code_execution_result"),encrypted_stdout:G.string(),stderr:G.string(),return_code:G.number(),content:G.array(G.object({type:G.literal("code_execution_output"),file_id:G.string()})).optional().default([])}),G.object({type:G.literal("bash_code_execution_result"),content:G.array(G.object({type:G.literal("bash_code_execution_output"),file_id:G.string()})),stdout:G.string(),stderr:G.string(),return_code:G.number()}),G.object({type:G.literal("bash_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_tool_result_error"),error_code:G.string()}),G.object({type:G.literal("text_editor_code_execution_view_result"),content:G.string(),file_type:G.string(),num_lines:G.number().nullable(),start_line:G.number().nullable(),total_lines:G.number().nullable()}),G.object({type:G.literal("text_editor_code_execution_create_result"),is_file_update:G.boolean()}),G.object({type:G.literal("text_editor_code_execution_str_replace_result"),lines:G.array(G.string()).nullable(),new_lines:G.number().nullable(),new_start:G.number().nullable(),old_lines:G.number().nullable(),old_start:G.number().nullable()})]))),c2$=p(()=>u(G.discriminatedUnion("type",[G.object({type:G.literal("programmatic-tool-call"),code:G.string()}),G.object({type:G.literal("bash_code_execution"),command:G.string()}),G.discriminatedUnion("command",[G.object({type:G.literal("text_editor_code_execution"),command:G.literal("view"),path:G.string()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("create"),path:G.string(),file_text:G.string().nullish()}),G.object({type:G.literal("text_editor_code_execution"),command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()})])]))),d2$=J6({id:"anthropic.code_execution_20260120",inputSchema:c2$,outputSchema:Xg,supportsDeferredResults:!0}),Yg=p(()=>u(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),i2$=p(()=>u(G.object({pattern:G.string(),limit:G.number().optional()}))),r2$=J6({id:"anthropic.tool_search_regex_20251119",inputSchema:i2$,outputSchema:Yg,supportsDeferredResults:!0});XW$=p(()=>u(G.object({command:G.string(),restart:G.boolean().optional()}))),YW$=A6({id:"anthropic.bash_20241022",inputSchema:XW$}),JW$=p(()=>u(G.object({command:G.string(),restart:G.boolean().optional()}))),WW$=A6({id:"anthropic.bash_20250124",inputSchema:JW$}),UW$=p(()=>u(G.object({action:G.enum(["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","screenshot","cursor_position"]),coordinate:G.array(G.number().int()).optional(),text:G.string().optional()}))),GW$=A6({id:"anthropic.computer_20241022",inputSchema:UW$}),HW$=p(()=>u(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),DW$=A6({id:"anthropic.computer_20250124",inputSchema:HW$}),VW$=p(()=>u(G.object({action:G.enum(["key","hold_key","type","cursor_position","mouse_move","left_mouse_down","left_mouse_up","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","wait","screenshot","zoom"]),coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),duration:G.number().optional(),region:G.tuple([G.number().int(),G.number().int(),G.number().int(),G.number().int()]).optional(),scroll_amount:G.number().optional(),scroll_direction:G.enum(["up","down","left","right"]).optional(),start_coordinate:G.tuple([G.number().int(),G.number().int()]).optional(),text:G.string().optional()}))),KW$=A6({id:"anthropic.computer_20251124",inputSchema:VW$}),QW$=p(()=>u(G.discriminatedUnion("command",[G.object({command:G.literal("view"),path:G.string(),view_range:G.tuple([G.number(),G.number()]).optional()}),G.object({command:G.literal("create"),path:G.string(),file_text:G.string()}),G.object({command:G.literal("str_replace"),path:G.string(),old_str:G.string(),new_str:G.string()}),G.object({command:G.literal("insert"),path:G.string(),insert_line:G.number(),insert_text:G.string()}),G.object({command:G.literal("delete"),path:G.string()}),G.object({command:G.literal("rename"),old_path:G.string(),new_path:G.string()})]))),FW$=A6({id:"anthropic.memory_20250818",inputSchema:QW$}),qW$=p(()=>u(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),wW$=A6({id:"anthropic.text_editor_20241022",inputSchema:qW$}),ZW$=p(()=>u(G.object({command:G.enum(["view","create","str_replace","insert","undo_edit"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),zW$=A6({id:"anthropic.text_editor_20250124",inputSchema:ZW$}),OW$=p(()=>u(G.object({command:G.enum(["view","create","str_replace","insert"]),path:G.string(),file_text:G.string().optional(),insert_line:G.number().int().optional(),new_str:G.string().optional(),insert_text:G.string().optional(),old_str:G.string().optional(),view_range:G.array(G.number().int()).optional()}))),NW$=A6({id:"anthropic.text_editor_20250429",inputSchema:OW$}),AW$=p(()=>u(G.array(G.object({type:G.literal("tool_reference"),toolName:G.string()})))),BW$=p(()=>u(G.object({query:G.string(),limit:G.number().optional()}))),MW$=J6({id:"anthropic.tool_search_bm25_20251119",inputSchema:BW$,outputSchema:AW$,supportsDeferredResults:!0}),RW$={bash_20241022:YW$,bash_20250124:WW$,codeExecution_20250522:g2$,codeExecution_20250825:p2$,codeExecution_20260120:l2$,computer_20241022:GW$,computer_20250124:DW$,computer_20251124:KW$,memory_20250818:FW$,textEditor_20241022:wW$,textEditor_20250124:zW$,textEditor_20250429:NW$,textEditor_20250728:O2$,webFetch_20250910:v2$,webFetch_20260209:S2$,webSearch_20250305:P2$,webSearch_20260209:j2$,toolSearchRegex_20251119:n2$,toolSearchBm25_20251119:jW$};Jg=VO()});function Mg($){let X=$.startsWith("o3")||$.startsWith("o4-mini")||$.startsWith("gpt-5")&&!$.startsWith("gpt-5-chat"),Y=$.startsWith("gpt-4")||$.startsWith("gpt-5-mini")||$.startsWith("gpt-5")&&!$.startsWith("gpt-5-nano")&&!$.startsWith("gpt-5-chat")||$.startsWith("o3")||$.startsWith("o4-mini"),W=$.startsWith("o1")||$.startsWith("o3")||$.startsWith("o4-mini")||$.startsWith("gpt-5")&&!$.startsWith("gpt-5-chat"),J=$.startsWith("gpt-5.1")||$.startsWith("gpt-5.2");return{supportsFlexProcessing:X,supportsPriorityProcessing:Y,isReasoningModel:W,systemMessageMode:W?"developer":"system",supportsNonReasoningParameters:J}}function Ug($){var X,Y,W,J,U,H;if($==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let D=(X=$.prompt_tokens)!=null?X:0,V=(Y=$.completion_tokens)!=null?Y:0,K=(J=(W=$.prompt_tokens_details)==null?void 0:W.cached_tokens)!=null?J:0,Q=(H=(U=$.completion_tokens_details)==null?void 0:U.reasoning_tokens)!=null?H:0;return{inputTokens:{total:D,noCache:D-K,cacheRead:K,cacheWrite:void 0},outputTokens:{total:V,text:V-Q,reasoning:Q},raw:$}}function LW$({prompt:$,systemMessageMode:X="system"}){var Y;let W=[],J=[];for(let{role:U,content:H}of $)switch(U){case"system":{switch(X){case"system":{W.push({role:"system",content:H});break}case"developer":{W.push({role:"developer",content:H});break}case"remove":{J.push({type:"other",message:"system messages are removed for this model"});break}default:throw Error(`Unsupported system message mode: ${X}`)}break}case"user":{if(H.length===1&&H[0].type==="text"){W.push({role:"user",content:H[0].text});break}W.push({role:"user",content:H.map((D,V)=>{var K,Q,q;switch(D.type){case"text":return{type:"text",text:D.text};case"file":if(D.mediaType.startsWith("image/")){let F=D.mediaType==="image/*"?"image/jpeg":D.mediaType;return{type:"image_url",image_url:{url:D.data instanceof URL?D.data.toString():`data:${F};base64,${c4(D.data)}`,detail:(Q=(K=D.providerOptions)==null?void 0:K.openai)==null?void 0:Q.imageDetail}}}else if(D.mediaType.startsWith("audio/")){if(D.data instanceof URL)throw new L6({functionality:"audio file parts with URLs"});switch(D.mediaType){case"audio/wav":return{type:"input_audio",input_audio:{data:c4(D.data),format:"wav"}};case"audio/mp3":case"audio/mpeg":return{type:"input_audio",input_audio:{data:c4(D.data),format:"mp3"}};default:throw new L6({functionality:`audio content parts with media type ${D.mediaType}`})}}else if(D.mediaType==="application/pdf"){if(D.data instanceof URL)throw new L6({functionality:"PDF file parts with URLs"});return{type:"file",file:typeof D.data==="string"&&D.data.startsWith("file-")?{file_id:D.data}:{filename:(q=D.filename)!=null?q:`part-${V}.pdf`,file_data:`data:application/pdf;base64,${c4(D.data)}`}}}else throw new L6({functionality:`file part media type ${D.mediaType}`})}})});break}case"assistant":{let D="",V=[];for(let K of H)switch(K.type){case"text":{D+=K.text;break}case"tool-call":{V.push({id:K.toolCallId,type:"function",function:{name:K.toolName,arguments:JSON.stringify(K.input)}});break}}W.push({role:"assistant",content:D,tool_calls:V.length>0?V:void 0});break}case"tool":{for(let D of H){if(D.type==="tool-approval-response")continue;let V=D.output,K;switch(V.type){case"text":case"error-text":K=V.value;break;case"execution-denied":K=(Y=V.reason)!=null?Y:"Tool execution denied.";break;case"content":case"json":case"error-json":K=JSON.stringify(V.value);break}W.push({role:"tool",tool_call_id:D.toolCallId,content:K})}break}default:throw Error(`Unsupported role: ${U}`)}return{messages:W,warnings:J}}function KO({id:$,model:X,created:Y}){return{id:$!=null?$:void 0,modelId:X!=null?X:void 0,timestamp:Y?new Date(Y*1000):void 0}}function Gg($){switch($){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}function _W$({tools:$,toolChoice:X}){$=($==null?void 0:$.length)?$:void 0;let Y=[];if($==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Y};let W=[];for(let U of $)switch(U.type){case"function":W.push({type:"function",function:{name:U.name,description:U.description,parameters:U.inputSchema,...U.strict!=null?{strict:U.strict}:{}}});break;default:Y.push({type:"unsupported",feature:`tool type: ${U.type}`});break}if(X==null)return{tools:W,toolChoice:void 0,toolWarnings:Y};let J=X.type;switch(J){case"auto":case"none":case"required":return{tools:W,toolChoice:J,toolWarnings:Y};case"tool":return{tools:W,toolChoice:{type:"function",function:{name:X.toolName}},toolWarnings:Y};default:throw new L6({functionality:`tool choice type: ${J}`})}}function Hg($){var X,Y,W,J;if($==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let U=(X=$.prompt_tokens)!=null?X:0,H=(Y=$.completion_tokens)!=null?Y:0;return{inputTokens:{total:(W=$.prompt_tokens)!=null?W:void 0,noCache:U,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:(J=$.completion_tokens)!=null?J:void 0,text:H,reasoning:void 0},raw:$}}function CW$({prompt:$,user:X="user",assistant:Y="assistant"}){let W="";if($[0].role==="system")W+=`${$[0].content}
291
-
292
- `,$=$.slice(1);for(let{role:J,content:U}of $)switch(J){case"system":throw new F8({message:"Unexpected system message in prompt: ${content}",prompt:$});case"user":{let H=U.map((D)=>{switch(D.type){case"text":return D.text}}).filter(Boolean).join("");W+=`${X}:
293
- ${H}
294
-
295
- `;break}case"assistant":{let H=U.map((D)=>{switch(D.type){case"text":return D.text;case"tool-call":throw new L6({functionality:"tool-call messages"})}}).join("");W+=`${Y}:
296
- ${H}
297
-
298
- `;break}case"tool":throw new L6({functionality:"tool messages"});default:throw Error(`Unsupported role: ${J}`)}return W+=`${Y}:
299
- `,{prompt:W,stopSequences:[`
300
- ${X}:`]}}function Dg({id:$,model:X,created:Y}){return{id:$!=null?$:void 0,modelId:X!=null?X:void 0,timestamp:Y!=null?new Date(Y*1000):void 0}}function Vg($){switch($){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}function gW$($){return fW$.some((X)=>$.startsWith(X))}function Fg($,X,Y){if($==null)return{};let W={};if($.image_tokens!=null){let J=Math.floor($.image_tokens/Y),U=$.image_tokens-J*(Y-1);W.imageTokens=X===Y-1?U:J}if($.text_tokens!=null){let J=Math.floor($.text_tokens/Y),U=$.text_tokens-J*(Y-1);W.textTokens=X===Y-1?U:J}return W}async function uW$($){if(!$)return;if($.type==="url")return jZ($.url);let X=$.data instanceof Uint8Array?$.data:p4($.data);return new Blob([X],{type:$.mediaType})}function qg($){var X,Y,W,J;if($==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let{input_tokens:U,output_tokens:H}=$,D=(Y=(X=$.input_tokens_details)==null?void 0:X.cached_tokens)!=null?Y:0,V=(J=(W=$.output_tokens_details)==null?void 0:W.reasoning_tokens)!=null?J:0;return{inputTokens:{total:U,noCache:U-D,cacheRead:D,cacheWrite:void 0},outputTokens:{total:H,text:H-V,reasoning:V},raw:$}}function wg($,X){if(!X)return!1;return X.some((Y)=>$.startsWith(Y))}async function PU$({prompt:$,toolNameMapping:X,systemMessageMode:Y,providerOptionsName:W,fileIdPrefixes:J,store:U,hasConversation:H=!1,hasLocalShellTool:D=!1,hasShellTool:V=!1,hasApplyPatchTool:K=!1,customProviderToolNames:Q}){var q,F,w,z,O,N,L,P,j,v,y,E,b;let R=[],I=[],d=new Set;for(let{role:k,content:t}of $)switch(k){case"system":{switch(Y){case"system":{R.push({role:"system",content:t});break}case"developer":{R.push({role:"developer",content:t});break}case"remove":{I.push({type:"other",message:"system messages are removed for this model"});break}default:throw Error(`Unsupported system message mode: ${Y}`)}break}case"user":{R.push({role:"user",content:t.map((h,f)=>{var l,o,g;switch(h.type){case"text":return{type:"input_text",text:h.text};case"file":if(h.mediaType.startsWith("image/")){let a=h.mediaType==="image/*"?"image/jpeg":h.mediaType;return{type:"input_image",...h.data instanceof URL?{image_url:h.data.toString()}:typeof h.data==="string"&&wg(h.data,J)?{file_id:h.data}:{image_url:`data:${a};base64,${c4(h.data)}`},detail:(o=(l=h.providerOptions)==null?void 0:l[W])==null?void 0:o.imageDetail}}else if(h.mediaType==="application/pdf"){if(h.data instanceof URL)return{type:"input_file",file_url:h.data.toString()};return{type:"input_file",...typeof h.data==="string"&&wg(h.data,J)?{file_id:h.data}:{filename:(g=h.filename)!=null?g:`part-${f}.pdf`,file_data:`data:application/pdf;base64,${c4(h.data)}`}}}else throw new L6({functionality:`file part media type ${h.mediaType}`})}})});break}case"assistant":{let h={};for(let f of t)switch(f.type){case"text":{let l=(q=f.providerOptions)==null?void 0:q[W],o=l==null?void 0:l.itemId,g=l==null?void 0:l.phase;if(H&&o!=null)break;if(U&&o!=null){R.push({type:"item_reference",id:o});break}R.push({role:"assistant",content:[{type:"output_text",text:f.text}],id:o,...g!=null&&{phase:g}});break}case"tool-call":{let l=(N=(w=(F=f.providerOptions)==null?void 0:F[W])==null?void 0:w.itemId)!=null?N:(O=(z=f.providerMetadata)==null?void 0:z[W])==null?void 0:O.itemId;if(H&&l!=null)break;if(f.providerExecuted){if(U&&l!=null)R.push({type:"item_reference",id:l});break}if(U&&l!=null){R.push({type:"item_reference",id:l});break}let o=X.toProviderToolName(f.toolName);if(D&&o==="local_shell"){let g=await z6({value:f.input,schema:Pg});R.push({type:"local_shell_call",call_id:f.toolCallId,id:l,action:{type:"exec",command:g.action.command,timeout_ms:g.action.timeoutMs,user:g.action.user,working_directory:g.action.workingDirectory,env:g.action.env}});break}if(V&&o==="shell"){let g=await z6({value:f.input,schema:_g});R.push({type:"shell_call",call_id:f.toolCallId,id:l,status:"completed",action:{commands:g.action.commands,timeout_ms:g.action.timeoutMs,max_output_length:g.action.maxOutputLength}});break}if(K&&o==="apply_patch"){let g=await z6({value:f.input,schema:jg});R.push({type:"apply_patch_call",call_id:g.callId,id:l,status:"completed",operation:g.operation});break}if(Q==null?void 0:Q.has(o)){R.push({type:"custom_tool_call",call_id:f.toolCallId,name:o,input:typeof f.input==="string"?f.input:JSON.stringify(f.input),id:l});break}R.push({type:"function_call",call_id:f.toolCallId,name:o,arguments:JSON.stringify(f.input),id:l});break}case"tool-result":{if(f.output.type==="execution-denied"||f.output.type==="json"&&typeof f.output.value==="object"&&f.output.value!=null&&"type"in f.output.value&&f.output.value.type==="execution-denied")break;if(H)break;let l=X.toProviderToolName(f.toolName);if(V&&l==="shell"){if(f.output.type==="json"){let o=await z6({value:f.output.value,schema:QO});R.push({type:"shell_call_output",call_id:f.toolCallId,output:o.output.map((g)=>({stdout:g.stdout,stderr:g.stderr,outcome:g.outcome.type==="timeout"?{type:"timeout"}:{type:"exit",exit_code:g.outcome.exitCode}}))})}break}if(U){let o=(j=(P=(L=f.providerOptions)==null?void 0:L[W])==null?void 0:P.itemId)!=null?j:f.toolCallId;R.push({type:"item_reference",id:o})}else I.push({type:"other",message:`Results for OpenAI tool ${f.toolName} are not sent to the API when store is false`});break}case"reasoning":{let l=await E6({provider:W,providerOptions:f.providerOptions,schema:IU$}),o=l==null?void 0:l.itemId;if(H&&o!=null)break;if(o!=null){let g=h[o];if(U){if(g===void 0)R.push({type:"item_reference",id:o}),h[o]={type:"reasoning",id:o,summary:[]}}else{let a=[];if(f.text.length>0)a.push({type:"summary_text",text:f.text});else if(g!==void 0)I.push({type:"other",message:`Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(f)}.`});if(g===void 0)h[o]={type:"reasoning",id:o,encrypted_content:l==null?void 0:l.reasoningEncryptedContent,summary:a},R.push(h[o]);else if(g.summary.push(...a),(l==null?void 0:l.reasoningEncryptedContent)!=null)g.encrypted_content=l.reasoningEncryptedContent}}else{let g=l==null?void 0:l.reasoningEncryptedContent;if(g!=null){let a=[];if(f.text.length>0)a.push({type:"summary_text",text:f.text});R.push({type:"reasoning",encrypted_content:g,summary:a})}else I.push({type:"other",message:`Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(f)}.`})}break}}break}case"tool":{for(let h of t){if(h.type==="tool-approval-response"){let g=h;if(d.has(g.approvalId))continue;if(d.add(g.approvalId),U)R.push({type:"item_reference",id:g.approvalId});R.push({type:"mcp_approval_response",approval_request_id:g.approvalId,approve:g.approved});continue}let f=h.output;if(f.type==="execution-denied"){if((y=(v=f.providerOptions)==null?void 0:v.openai)==null?void 0:y.approvalId)continue}let l=X.toProviderToolName(h.toolName);if(D&&l==="local_shell"&&f.type==="json"){let g=await z6({value:f.value,schema:Ig});R.push({type:"local_shell_call_output",call_id:h.toolCallId,output:g.output});continue}if(V&&l==="shell"&&f.type==="json"){let g=await z6({value:f.value,schema:QO});R.push({type:"shell_call_output",call_id:h.toolCallId,output:g.output.map((a)=>({stdout:a.stdout,stderr:a.stderr,outcome:a.outcome.type==="timeout"?{type:"timeout"}:{type:"exit",exit_code:a.outcome.exitCode}}))});continue}if(K&&h.toolName==="apply_patch"&&f.type==="json"){let g=await z6({value:f.value,schema:Rg});R.push({type:"apply_patch_call_output",call_id:h.toolCallId,status:g.status,output:g.output});continue}if(Q==null?void 0:Q.has(l)){let g;switch(f.type){case"text":case"error-text":g=f.value;break;case"execution-denied":g=(E=f.reason)!=null?E:"Tool execution denied.";break;case"json":case"error-json":g=JSON.stringify(f.value);break;case"content":g=f.value.map((a)=>{var Y$;switch(a.type){case"text":return{type:"input_text",text:a.text};case"image-data":return{type:"input_image",image_url:`data:${a.mediaType};base64,${a.data}`};case"image-url":return{type:"input_image",image_url:a.url};case"file-data":return{type:"input_file",filename:(Y$=a.filename)!=null?Y$:"data",file_data:`data:${a.mediaType};base64,${a.data}`};default:I.push({type:"other",message:`unsupported custom tool content part type: ${a.type}`});return}}).filter(RJ);break;default:g=""}R.push({type:"custom_tool_call_output",call_id:h.toolCallId,output:g});continue}let o;switch(f.type){case"text":case"error-text":o=f.value;break;case"execution-denied":o=(b=f.reason)!=null?b:"Tool execution denied.";break;case"json":case"error-json":o=JSON.stringify(f.value);break;case"content":o=f.value.map((g)=>{var a;switch(g.type){case"text":return{type:"input_text",text:g.text};case"image-data":return{type:"input_image",image_url:`data:${g.mediaType};base64,${g.data}`};case"image-url":return{type:"input_image",image_url:g.url};case"file-data":return{type:"input_file",filename:(a=g.filename)!=null?a:"data",file_data:`data:${g.mediaType};base64,${g.data}`};default:{I.push({type:"other",message:`unsupported tool content part type: ${g.type}`});return}}}).filter(RJ);break}R.push({type:"function_call_output",call_id:h.toolCallId,output:o})}break}default:throw Error(`Unsupported role: ${k}`)}return{input:R,warnings:I}}function Zg({finishReason:$,hasFunctionCall:X}){switch($){case void 0:case null:return X?"tool-calls":"stop";case"max_output_tokens":return"length";case"content_filter":return"content-filter";default:return X?"tool-calls":"other"}}async function SU$({tools:$,toolChoice:X,toolNameMapping:Y,customProviderToolNames:W}){var J;$=($==null?void 0:$.length)?$:void 0;let U=[];if($==null)return{tools:void 0,toolChoice:void 0,toolWarnings:U};let H=[],D=W!=null?W:new Set;for(let K of $)switch(K.type){case"function":H.push({type:"function",name:K.name,description:K.description,parameters:K.inputSchema,...K.strict!=null?{strict:K.strict}:{}});break;case"provider":{switch(K.id){case"openai.file_search":{let Q=await z6({value:K.args,schema:eW$});H.push({type:"file_search",vector_store_ids:Q.vectorStoreIds,max_num_results:Q.maxNumResults,ranking_options:Q.ranking?{ranker:Q.ranking.ranker,score_threshold:Q.ranking.scoreThreshold}:void 0,filters:Q.filters});break}case"openai.local_shell":{H.push({type:"local_shell"});break}case"openai.shell":{let Q=await z6({value:K.args,schema:VU$});H.push({type:"shell",...Q.environment&&{environment:bU$(Q.environment)}});break}case"openai.apply_patch":{H.push({type:"apply_patch"});break}case"openai.web_search_preview":{let Q=await z6({value:K.args,schema:zU$});H.push({type:"web_search_preview",search_context_size:Q.searchContextSize,user_location:Q.userLocation});break}case"openai.web_search":{let Q=await z6({value:K.args,schema:QU$});H.push({type:"web_search",filters:Q.filters!=null?{allowed_domains:Q.filters.allowedDomains}:void 0,external_web_access:Q.externalWebAccess,search_context_size:Q.searchContextSize,user_location:Q.userLocation});break}case"openai.code_interpreter":{let Q=await z6({value:K.args,schema:iW$});H.push({type:"code_interpreter",container:Q.container==null?{type:"auto",file_ids:void 0}:typeof Q.container==="string"?Q.container:{type:"auto",file_ids:Q.container.fileIds}});break}case"openai.image_generation":{let Q=await z6({value:K.args,schema:YU$});H.push({type:"image_generation",background:Q.background,input_fidelity:Q.inputFidelity,input_image_mask:Q.inputImageMask?{file_id:Q.inputImageMask.fileId,image_url:Q.inputImageMask.imageUrl}:void 0,model:Q.model,moderation:Q.moderation,partial_images:Q.partialImages,quality:Q.quality,output_compression:Q.outputCompression,output_format:Q.outputFormat,size:Q.size});break}case"openai.mcp":{let Q=await z6({value:K.args,schema:BU$}),q=(z)=>({tool_names:z.toolNames}),F=Q.requireApproval,w=F==null?void 0:typeof F==="string"?F:F.never!=null?{never:q(F.never)}:void 0;H.push({type:"mcp",server_label:Q.serverLabel,allowed_tools:Array.isArray(Q.allowedTools)?Q.allowedTools:Q.allowedTools?{read_only:Q.allowedTools.readOnly,tool_names:Q.allowedTools.toolNames}:void 0,authorization:Q.authorization,connector_id:Q.connectorId,headers:Q.headers,require_approval:w!=null?w:"never",server_description:Q.serverDescription,server_url:Q.serverUrl});break}case"openai.custom":{let Q=await z6({value:K.args,schema:oW$});H.push({type:"custom",name:Q.name,description:Q.description,format:Q.format}),D.add(Q.name);break}}break}default:U.push({type:"unsupported",feature:`function tool ${K}`});break}if(X==null)return{tools:H,toolChoice:void 0,toolWarnings:U};let V=X.type;switch(V){case"auto":case"none":case"required":return{tools:H,toolChoice:V,toolWarnings:U};case"tool":{let K=(J=Y==null?void 0:Y.toProviderToolName(X.toolName))!=null?J:X.toolName;return{tools:H,toolChoice:K==="code_interpreter"||K==="file_search"||K==="image_generation"||K==="web_search_preview"||K==="web_search"||K==="mcp"||K==="apply_patch"?{type:K}:D.has(K)?{type:"custom",name:K}:{type:"function",name:K},toolWarnings:U}}default:throw new L6({functionality:`tool choice type: ${V}`})}}function bU$($){if($.type==="containerReference")return{type:"container_reference",container_id:$.containerId};if($.type==="containerAuto"){let Y=$;return{type:"container_auto",file_ids:Y.fileIds,memory_limit:Y.memoryLimit,network_policy:Y.networkPolicy==null?void 0:Y.networkPolicy.type==="disabled"?{type:"disabled"}:{type:"allowlist",allowed_domains:Y.networkPolicy.allowedDomains,domain_secrets:Y.networkPolicy.domainSecrets},skills:xU$(Y.skills)}}return{type:"local",skills:$.skills}}function xU$($){return $==null?void 0:$.map((X)=>X.type==="skillReference"?{type:"skill_reference",skill_id:X.skillId,version:X.version}:{type:"inline",name:X.name,description:X.description,source:{type:"base64",media_type:X.source.mediaType,data:X.source.data}})}function Og($){var X,Y;let W={};for(let J of $){if(J.role!=="assistant")continue;for(let U of J.content){if(U.type!=="tool-call")continue;let H=(Y=(X=U.providerOptions)==null?void 0:X.openai)==null?void 0:Y.approvalRequestId;if(H!=null)W[H]=U.toolCallId}}return W}function vU$($){return $.type==="response.output_text.delta"}function hU$($){return $.type==="response.output_item.done"}function yU$($){return $.type==="response.completed"||$.type==="response.incomplete"}function fU$($){return $.type==="response.created"}function gU$($){return $.type==="response.function_call_arguments.delta"}function mU$($){return $.type==="response.custom_tool_call_input.delta"}function uU$($){return $.type==="response.image_generation_call.partial_image"}function pU$($){return $.type==="response.code_interpreter_call_code.delta"}function cU$($){return $.type==="response.code_interpreter_call_code.done"}function dU$($){return $.type==="response.apply_patch_call_operation_diff.delta"}function lU$($){return $.type==="response.apply_patch_call_operation_diff.done"}function Ng($){return $.type==="response.output_item.added"}function iU$($){return $.type==="response.output_text.annotation.added"}function rU$($){return $.type==="error"}function Ag($){var X;if($==null)return{};switch($.type){case"search":return{action:{type:"search",query:(X=$.query)!=null?X:void 0},...$.sources!=null&&{sources:$.sources}};case"open_page":return{action:{type:"openPage",url:$.url}};case"find_in_page":return{action:{type:"findInPage",url:$.url,pattern:$.pattern}}}}function J5($){return JSON.stringify($).slice(1,-1)}function lX($={}){var X,Y;let W=(X=X9(c0({settingValue:$.baseURL,environmentVariableName:"OPENAI_BASE_URL"})))!=null?X:"https://api.openai.com/v1",J=(Y=$.name)!=null?Y:"openai",U=()=>$4({Authorization:`Bearer ${xX({apiKey:$.apiKey,environmentVariableName:"OPENAI_API_KEY",description:"OpenAI"})}`,"OpenAI-Organization":$.organization,"OpenAI-Project":$.project,...$.headers},`ai-sdk/openai/${eU$}`),H=(O)=>new TW$(O,{provider:`${J}.chat`,url:({path:N})=>`${W}${N}`,headers:U,fetch:$.fetch}),D=(O)=>new xW$(O,{provider:`${J}.completion`,url:({path:N})=>`${W}${N}`,headers:U,fetch:$.fetch}),V=(O)=>new hW$(O,{provider:`${J}.embedding`,url:({path:N})=>`${W}${N}`,headers:U,fetch:$.fetch}),K=(O)=>new mW$(O,{provider:`${J}.image`,url:({path:N})=>`${W}${N}`,headers:U,fetch:$.fetch}),Q=(O)=>new tU$(O,{provider:`${J}.transcription`,url:({path:N})=>`${W}${N}`,headers:U,fetch:$.fetch}),q=(O)=>new oU$(O,{provider:`${J}.speech`,url:({path:N})=>`${W}${N}`,headers:U,fetch:$.fetch}),F=(O)=>{if(new.target)throw Error("The OpenAI model function cannot be called with the new keyword.");return w(O)},w=(O)=>{return new kU$(O,{provider:`${J}.responses`,url:({path:N})=>`${W}${N}`,headers:U,fetch:$.fetch,fileIdPrefixes:["file-"]})},z=function(O){return F(O)};return z.specificationVersion="v3",z.languageModel=F,z.chat=H,z.completion=D,z.responses=w,z.embedding=V,z.embeddingModel=V,z.textEmbedding=V,z.textEmbeddingModel=V,z.image=K,z.imageModel=K,z.transcription=Q,z.transcriptionModel=Q,z.speech=q,z.speechModel=q,z.tools=EU$,z}var qO,z0,EW$,PW$,IW$,TW$=class{constructor($,X){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=$,this.config=X}get provider(){return this.config.provider}async getArgs({prompt:$,maxOutputTokens:X,temperature:Y,topP:W,topK:J,frequencyPenalty:U,presencePenalty:H,stopSequences:D,responseFormat:V,seed:K,tools:Q,toolChoice:q,providerOptions:F}){var w,z,O,N,L;let P=[],j=(w=await E6({provider:"openai",providerOptions:F,schema:IW$}))!=null?w:{},v=Mg(this.modelId),y=(z=j.forceReasoning)!=null?z:v.isReasoningModel;if(J!=null)P.push({type:"unsupported",feature:"topK"});let{messages:E,warnings:b}=LW$({prompt:$,systemMessageMode:(O=j.systemMessageMode)!=null?O:y?"developer":v.systemMessageMode});P.push(...b);let R=(N=j.strictJsonSchema)!=null?N:!0,I={model:this.modelId,logit_bias:j.logitBias,logprobs:j.logprobs===!0||typeof j.logprobs==="number"?!0:void 0,top_logprobs:typeof j.logprobs==="number"?j.logprobs:typeof j.logprobs==="boolean"?j.logprobs?0:void 0:void 0,user:j.user,parallel_tool_calls:j.parallelToolCalls,max_tokens:X,temperature:Y,top_p:W,frequency_penalty:U,presence_penalty:H,response_format:(V==null?void 0:V.type)==="json"?V.schema!=null?{type:"json_schema",json_schema:{schema:V.schema,strict:R,name:(L=V.name)!=null?L:"response",description:V.description}}:{type:"json_object"}:void 0,stop:D,seed:K,verbosity:j.textVerbosity,max_completion_tokens:j.maxCompletionTokens,store:j.store,metadata:j.metadata,prediction:j.prediction,reasoning_effort:j.reasoningEffort,service_tier:j.serviceTier,prompt_cache_key:j.promptCacheKey,prompt_cache_retention:j.promptCacheRetention,safety_identifier:j.safetyIdentifier,messages:E};if(y){if(j.reasoningEffort!=="none"||!v.supportsNonReasoningParameters){if(I.temperature!=null)I.temperature=void 0,P.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for reasoning models"});if(I.top_p!=null)I.top_p=void 0,P.push({type:"unsupported",feature:"topP",details:"topP is not supported for reasoning models"});if(I.logprobs!=null)I.logprobs=void 0,P.push({type:"other",message:"logprobs is not supported for reasoning models"})}if(I.frequency_penalty!=null)I.frequency_penalty=void 0,P.push({type:"unsupported",feature:"frequencyPenalty",details:"frequencyPenalty is not supported for reasoning models"});if(I.presence_penalty!=null)I.presence_penalty=void 0,P.push({type:"unsupported",feature:"presencePenalty",details:"presencePenalty is not supported for reasoning models"});if(I.logit_bias!=null)I.logit_bias=void 0,P.push({type:"other",message:"logitBias is not supported for reasoning models"});if(I.top_logprobs!=null)I.top_logprobs=void 0,P.push({type:"other",message:"topLogprobs is not supported for reasoning models"});if(I.max_tokens!=null){if(I.max_completion_tokens==null)I.max_completion_tokens=I.max_tokens;I.max_tokens=void 0}}else if(this.modelId.startsWith("gpt-4o-search-preview")||this.modelId.startsWith("gpt-4o-mini-search-preview")){if(I.temperature!=null)I.temperature=void 0,P.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for the search preview models and has been removed."})}if(j.serviceTier==="flex"&&!v.supportsFlexProcessing)P.push({type:"unsupported",feature:"serviceTier",details:"flex processing is only available for o3, o4-mini, and gpt-5 models"}),I.service_tier=void 0;if(j.serviceTier==="priority"&&!v.supportsPriorityProcessing)P.push({type:"unsupported",feature:"serviceTier",details:"priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"}),I.service_tier=void 0;let{tools:d,toolChoice:k,toolWarnings:t}=_W$({tools:Q,toolChoice:q});return{args:{...I,tools:d,tool_choice:k},warnings:[...P,...t]}}async doGenerate($){var X,Y,W,J,U,H,D;let{args:V,warnings:K}=await this.getArgs($),{responseHeaders:Q,value:q,rawValue:F}=await q6({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:V6(this.config.headers(),$.headers),body:V,failedResponseHandler:z0,successfulResponseHandler:M6(EW$),abortSignal:$.abortSignal,fetch:this.config.fetch}),w=q.choices[0],z=[],O=w.message.content;if(O!=null&&O.length>0)z.push({type:"text",text:O});for(let j of(X=w.message.tool_calls)!=null?X:[])z.push({type:"tool-call",toolCallId:(Y=j.id)!=null?Y:x6(),toolName:j.function.name,input:j.function.arguments});for(let j of(W=w.message.annotations)!=null?W:[])z.push({type:"source",sourceType:"url",id:x6(),url:j.url_citation.url,title:j.url_citation.title});let N=(J=q.usage)==null?void 0:J.completion_tokens_details,L=(U=q.usage)==null?void 0:U.prompt_tokens_details,P={openai:{}};if((N==null?void 0:N.accepted_prediction_tokens)!=null)P.openai.acceptedPredictionTokens=N==null?void 0:N.accepted_prediction_tokens;if((N==null?void 0:N.rejected_prediction_tokens)!=null)P.openai.rejectedPredictionTokens=N==null?void 0:N.rejected_prediction_tokens;if(((H=w.logprobs)==null?void 0:H.content)!=null)P.openai.logprobs=w.logprobs.content;return{content:z,finishReason:{unified:Gg(w.finish_reason),raw:(D=w.finish_reason)!=null?D:void 0},usage:Ug(q.usage),request:{body:V},response:{...KO(q),headers:Q,body:F},warnings:K,providerMetadata:P}}async doStream($){let{args:X,warnings:Y}=await this.getArgs($),W={...X,stream:!0,stream_options:{include_usage:!0}},{responseHeaders:J,value:U}=await q6({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:V6(this.config.headers(),$.headers),body:W,failedResponseHandler:z0,successfulResponseHandler:c1(PW$),abortSignal:$.abortSignal,fetch:this.config.fetch}),H=[],D={unified:"other",raw:void 0},V=void 0,K=!1,Q=!1,q={openai:{}};return{stream:U.pipeThrough(new TransformStream({start(F){F.enqueue({type:"stream-start",warnings:Y})},transform(F,w){var z,O,N,L,P,j,v,y,E,b,R,I,d,k,t,h,f;if($.includeRawChunks)w.enqueue({type:"raw",rawValue:F.rawValue});if(!F.success){D={unified:"error",raw:void 0},w.enqueue({type:"error",error:F.error});return}let l=F.value;if("error"in l){D={unified:"error",raw:void 0},w.enqueue({type:"error",error:l.error});return}if(!K){let a=KO(l);if(Object.values(a).some(Boolean))K=!0,w.enqueue({type:"response-metadata",...KO(l)})}if(l.usage!=null){if(V=l.usage,((z=l.usage.completion_tokens_details)==null?void 0:z.accepted_prediction_tokens)!=null)q.openai.acceptedPredictionTokens=(O=l.usage.completion_tokens_details)==null?void 0:O.accepted_prediction_tokens;if(((N=l.usage.completion_tokens_details)==null?void 0:N.rejected_prediction_tokens)!=null)q.openai.rejectedPredictionTokens=(L=l.usage.completion_tokens_details)==null?void 0:L.rejected_prediction_tokens}let o=l.choices[0];if((o==null?void 0:o.finish_reason)!=null)D={unified:Gg(o.finish_reason),raw:o.finish_reason};if(((P=o==null?void 0:o.logprobs)==null?void 0:P.content)!=null)q.openai.logprobs=o.logprobs.content;if((o==null?void 0:o.delta)==null)return;let g=o.delta;if(g.content!=null){if(!Q)w.enqueue({type:"text-start",id:"0"}),Q=!0;w.enqueue({type:"text-delta",id:"0",delta:g.content})}if(g.tool_calls!=null)for(let a of g.tool_calls){let Y$=a.index;if(H[Y$]==null){if(a.type!=null&&a.type!=="function")throw new QU({data:a,message:"Expected 'function' type."});if(a.id==null)throw new QU({data:a,message:"Expected 'id' to be a string."});if(((j=a.function)==null?void 0:j.name)==null)throw new QU({data:a,message:"Expected 'function.name' to be a string."});w.enqueue({type:"tool-input-start",id:a.id,toolName:a.function.name}),H[Y$]={id:a.id,type:"function",function:{name:a.function.name,arguments:(v=a.function.arguments)!=null?v:""},hasFinished:!1};let V$=H[Y$];if(((y=V$.function)==null?void 0:y.name)!=null&&((E=V$.function)==null?void 0:E.arguments)!=null){if(V$.function.arguments.length>0)w.enqueue({type:"tool-input-delta",id:V$.id,delta:V$.function.arguments});if(EZ(V$.function.arguments))w.enqueue({type:"tool-input-end",id:V$.id}),w.enqueue({type:"tool-call",toolCallId:(b=V$.id)!=null?b:x6(),toolName:V$.function.name,input:V$.function.arguments}),V$.hasFinished=!0}continue}let _=H[Y$];if(_.hasFinished)continue;if(((R=a.function)==null?void 0:R.arguments)!=null)_.function.arguments+=(d=(I=a.function)==null?void 0:I.arguments)!=null?d:"";if(w.enqueue({type:"tool-input-delta",id:_.id,delta:(k=a.function.arguments)!=null?k:""}),((t=_.function)==null?void 0:t.name)!=null&&((h=_.function)==null?void 0:h.arguments)!=null&&EZ(_.function.arguments))w.enqueue({type:"tool-input-end",id:_.id}),w.enqueue({type:"tool-call",toolCallId:(f=_.id)!=null?f:x6(),toolName:_.function.name,input:_.function.arguments}),_.hasFinished=!0}if(g.annotations!=null)for(let a of g.annotations)w.enqueue({type:"source",sourceType:"url",id:x6(),url:a.url_citation.url,title:a.url_citation.title})},flush(F){if(Q)F.enqueue({type:"text-end",id:"0"});F.enqueue({type:"finish",finishReason:D,usage:Ug(V),...q!=null?{providerMetadata:q}:{}})}})),request:{body:W},response:{headers:J}}}},SW$,bW$,Kg,xW$=class{constructor($,X){this.specificationVersion="v3",this.supportedUrls={},this.modelId=$,this.config=X}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get provider(){return this.config.provider}async getArgs({prompt:$,maxOutputTokens:X,temperature:Y,topP:W,topK:J,frequencyPenalty:U,presencePenalty:H,stopSequences:D,responseFormat:V,tools:K,toolChoice:Q,seed:q,providerOptions:F}){let w=[],z={...await E6({provider:"openai",providerOptions:F,schema:Kg}),...await E6({provider:this.providerOptionsName,providerOptions:F,schema:Kg})};if(J!=null)w.push({type:"unsupported",feature:"topK"});if(K==null?void 0:K.length)w.push({type:"unsupported",feature:"tools"});if(Q!=null)w.push({type:"unsupported",feature:"toolChoice"});if(V!=null&&V.type!=="text")w.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});let{prompt:O,stopSequences:N}=CW$({prompt:$}),L=[...N!=null?N:[],...D!=null?D:[]];return{args:{model:this.modelId,echo:z.echo,logit_bias:z.logitBias,logprobs:(z==null?void 0:z.logprobs)===!0?0:(z==null?void 0:z.logprobs)===!1?void 0:z==null?void 0:z.logprobs,suffix:z.suffix,user:z.user,max_tokens:X,temperature:Y,top_p:W,frequency_penalty:U,presence_penalty:H,seed:q,prompt:O,stop:L.length>0?L:void 0},warnings:w}}async doGenerate($){var X;let{args:Y,warnings:W}=await this.getArgs($),{responseHeaders:J,value:U,rawValue:H}=await q6({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:V6(this.config.headers(),$.headers),body:Y,failedResponseHandler:z0,successfulResponseHandler:M6(SW$),abortSignal:$.abortSignal,fetch:this.config.fetch}),D=U.choices[0],V={openai:{}};if(D.logprobs!=null)V.openai.logprobs=D.logprobs;return{content:[{type:"text",text:D.text}],usage:Hg(U.usage),finishReason:{unified:Vg(D.finish_reason),raw:(X=D.finish_reason)!=null?X:void 0},request:{body:Y},response:{...Dg(U),headers:J,body:H},providerMetadata:V,warnings:W}}async doStream($){let{args:X,warnings:Y}=await this.getArgs($),W={...X,stream:!0,stream_options:{include_usage:!0}},{responseHeaders:J,value:U}=await q6({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:V6(this.config.headers(),$.headers),body:W,failedResponseHandler:z0,successfulResponseHandler:c1(bW$),abortSignal:$.abortSignal,fetch:this.config.fetch}),H={unified:"other",raw:void 0},D={openai:{}},V=void 0,K=!0;return{stream:U.pipeThrough(new TransformStream({start(Q){Q.enqueue({type:"stream-start",warnings:Y})},transform(Q,q){if($.includeRawChunks)q.enqueue({type:"raw",rawValue:Q.rawValue});if(!Q.success){H={unified:"error",raw:void 0},q.enqueue({type:"error",error:Q.error});return}let F=Q.value;if("error"in F){H={unified:"error",raw:void 0},q.enqueue({type:"error",error:F.error});return}if(K)K=!1,q.enqueue({type:"response-metadata",...Dg(F)}),q.enqueue({type:"text-start",id:"0"});if(F.usage!=null)V=F.usage;let w=F.choices[0];if((w==null?void 0:w.finish_reason)!=null)H={unified:Vg(w.finish_reason),raw:w.finish_reason};if((w==null?void 0:w.logprobs)!=null)D.openai.logprobs=w.logprobs;if((w==null?void 0:w.text)!=null&&w.text.length>0)q.enqueue({type:"text-delta",id:"0",delta:w.text})},flush(Q){if(!K)Q.enqueue({type:"text-end",id:"0"});Q.enqueue({type:"finish",finishReason:H,providerMetadata:D,usage:Hg(V)})}})),request:{body:W},response:{headers:J}}}},kW$,vW$,hW$=class{constructor($,X){this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=$,this.config=X}get provider(){return this.config.provider}async doEmbed({values:$,headers:X,abortSignal:Y,providerOptions:W}){var J;if($.length>this.maxEmbeddingsPerCall)throw new FU({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:$});let U=(J=await E6({provider:"openai",providerOptions:W,schema:kW$}))!=null?J:{},{responseHeaders:H,value:D,rawValue:V}=await q6({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:V6(this.config.headers(),X),body:{model:this.modelId,input:$,encoding_format:"float",dimensions:U.dimensions,user:U.user},failedResponseHandler:z0,successfulResponseHandler:M6(vW$),abortSignal:Y,fetch:this.config.fetch});return{warnings:[],embeddings:D.data.map((K)=>K.embedding),usage:D.usage?{tokens:D.usage.prompt_tokens}:void 0,response:{headers:H,body:V}}}},Qg,yW$,fW$,mW$=class{constructor($,X){this.modelId=$,this.config=X,this.specificationVersion="v3"}get maxImagesPerCall(){var $;return($=yW$[this.modelId])!=null?$:1}get provider(){return this.config.provider}async doGenerate({prompt:$,files:X,mask:Y,n:W,size:J,aspectRatio:U,seed:H,providerOptions:D,headers:V,abortSignal:K}){var Q,q,F,w,z,O,N,L,P,j,v;let y=[];if(U!=null)y.push({type:"unsupported",feature:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."});if(H!=null)y.push({type:"unsupported",feature:"seed"});let E=(F=(q=(Q=this.config._internal)==null?void 0:Q.currentDate)==null?void 0:q.call(Q))!=null?F:new Date;if(X!=null){let{value:I,responseHeaders:d}=await LG({url:this.config.url({path:"/images/edits",modelId:this.modelId}),headers:V6(this.config.headers(),V),formData:_b({model:this.modelId,prompt:$,image:await Promise.all(X.map((k)=>k.type==="file"?new Blob([k.data instanceof Uint8Array?new Blob([k.data],{type:k.mediaType}):new Blob([p4(k.data)],{type:k.mediaType})],{type:k.mediaType}):jZ(k.url))),mask:Y!=null?await uW$(Y):void 0,n:W,size:J,...(w=D.openai)!=null?w:{}}),failedResponseHandler:z0,successfulResponseHandler:M6(Qg),abortSignal:K,fetch:this.config.fetch});return{images:I.data.map((k)=>k.b64_json),warnings:y,usage:I.usage!=null?{inputTokens:(z=I.usage.input_tokens)!=null?z:void 0,outputTokens:(O=I.usage.output_tokens)!=null?O:void 0,totalTokens:(N=I.usage.total_tokens)!=null?N:void 0}:void 0,response:{timestamp:E,modelId:this.modelId,headers:d},providerMetadata:{openai:{images:I.data.map((k,t)=>{var h,f,l,o,g,a;return{...k.revised_prompt?{revisedPrompt:k.revised_prompt}:{},created:(h=I.created)!=null?h:void 0,size:(f=I.size)!=null?f:void 0,quality:(l=I.quality)!=null?l:void 0,background:(o=I.background)!=null?o:void 0,outputFormat:(g=I.output_format)!=null?g:void 0,...Fg((a=I.usage)==null?void 0:a.input_tokens_details,t,I.data.length)}})}}}}let{value:b,responseHeaders:R}=await q6({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:V6(this.config.headers(),V),body:{model:this.modelId,prompt:$,n:W,size:J,...(L=D.openai)!=null?L:{},...!gW$(this.modelId)?{response_format:"b64_json"}:{}},failedResponseHandler:z0,successfulResponseHandler:M6(Qg),abortSignal:K,fetch:this.config.fetch});return{images:b.data.map((I)=>I.b64_json),warnings:y,usage:b.usage!=null?{inputTokens:(P=b.usage.input_tokens)!=null?P:void 0,outputTokens:(j=b.usage.output_tokens)!=null?j:void 0,totalTokens:(v=b.usage.total_tokens)!=null?v:void 0}:void 0,response:{timestamp:E,modelId:this.modelId,headers:R},providerMetadata:{openai:{images:b.data.map((I,d)=>{var k,t,h,f,l,o;return{...I.revised_prompt?{revisedPrompt:I.revised_prompt}:{},created:(k=b.created)!=null?k:void 0,size:(t=b.size)!=null?t:void 0,quality:(h=b.quality)!=null?h:void 0,background:(f=b.background)!=null?f:void 0,outputFormat:(l=b.output_format)!=null?l:void 0,...Fg((o=b.usage)==null?void 0:o.input_tokens_details,d,b.data.length)}})}}}}},jg,Rg,Sd$,pW$,cW$,dW$,lW$,iW$,rW$,nW$=($={})=>{return rW$($)},oW$,aW$,sW$,tW$=($)=>sW$($),Lg,Eg,eW$,$U$,XU$,YU$,JU$,WU$,UU$,GU$=($={})=>{return UU$($)},Pg,Ig,HU$,_g,QO,DU$,VU$,KU$,QU$,FU$,qU$,wU$,ZU$=($={})=>wU$($),zU$,OU$,NU$,AU$,FO,BU$,MU$,jU$,RU$,LU$=($)=>RU$($),EU$,IU$,_U$,TU$,Tg=20,CU$,Ul$,zg,kU$=class{constructor($,X){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]},this.modelId=$,this.config=X}get provider(){return this.config.provider}async getArgs({maxOutputTokens:$,temperature:X,stopSequences:Y,topP:W,topK:J,presencePenalty:U,frequencyPenalty:H,seed:D,prompt:V,providerOptions:K,tools:Q,toolChoice:q,responseFormat:F}){var w,z,O,N,L,P,j,v,y;let E=[],b=Mg(this.modelId);if(J!=null)E.push({type:"unsupported",feature:"topK"});if(D!=null)E.push({type:"unsupported",feature:"seed"});if(U!=null)E.push({type:"unsupported",feature:"presencePenalty"});if(H!=null)E.push({type:"unsupported",feature:"frequencyPenalty"});if(Y!=null)E.push({type:"unsupported",feature:"stopSequences"});let R=this.config.provider.includes("azure")?"azure":"openai",I=await E6({provider:R,providerOptions:K,schema:zg});if(I==null&&R!=="openai")I=await E6({provider:"openai",providerOptions:K,schema:zg});let d=(w=I==null?void 0:I.forceReasoning)!=null?w:b.isReasoningModel;if((I==null?void 0:I.conversation)&&(I==null?void 0:I.previousResponseId))E.push({type:"unsupported",feature:"conversation",details:"conversation and previousResponseId cannot be used together"});let k=AG({tools:Q,providerToolNames:{"openai.code_interpreter":"code_interpreter","openai.file_search":"file_search","openai.image_generation":"image_generation","openai.local_shell":"local_shell","openai.shell":"shell","openai.web_search":"web_search","openai.web_search_preview":"web_search_preview","openai.mcp":"mcp","openai.apply_patch":"apply_patch"},resolveProviderToolName:(H$)=>H$.id==="openai.custom"?H$.args.name:void 0}),t=new Set,{tools:h,toolChoice:f,toolWarnings:l}=await SU$({tools:Q,toolChoice:q,toolNameMapping:k,customProviderToolNames:t}),{input:o,warnings:g}=await PU$({prompt:V,toolNameMapping:k,systemMessageMode:(z=I==null?void 0:I.systemMessageMode)!=null?z:d?"developer":b.systemMessageMode,providerOptionsName:R,fileIdPrefixes:this.config.fileIdPrefixes,store:(O=I==null?void 0:I.store)!=null?O:!0,hasConversation:(I==null?void 0:I.conversation)!=null,hasLocalShellTool:V$("openai.local_shell"),hasShellTool:V$("openai.shell"),hasApplyPatchTool:V$("openai.apply_patch"),customProviderToolNames:t.size>0?t:void 0});E.push(...g);let a=(N=I==null?void 0:I.strictJsonSchema)!=null?N:!0,Y$=I==null?void 0:I.include;function _(H$){if(Y$==null)Y$=[H$];else if(!Y$.includes(H$))Y$=[...Y$,H$]}function V$(H$){return(Q==null?void 0:Q.find((F$)=>F$.type==="provider"&&F$.id===H$))!=null}let o$=typeof(I==null?void 0:I.logprobs)==="number"?I==null?void 0:I.logprobs:(I==null?void 0:I.logprobs)===!0?Tg:void 0;if(o$)_("message.output_text.logprobs");let T=(L=Q==null?void 0:Q.find((H$)=>H$.type==="provider"&&(H$.id==="openai.web_search"||H$.id==="openai.web_search_preview")))==null?void 0:L.name;if(T)_("web_search_call.action.sources");if(V$("openai.code_interpreter"))_("code_interpreter_call.outputs");let B$=I==null?void 0:I.store;if(B$===!1&&d)_("reasoning.encrypted_content");let k$={model:this.modelId,input:o,temperature:X,top_p:W,max_output_tokens:$,...((F==null?void 0:F.type)==="json"||(I==null?void 0:I.textVerbosity))&&{text:{...(F==null?void 0:F.type)==="json"&&{format:F.schema!=null?{type:"json_schema",strict:a,name:(P=F.name)!=null?P:"response",description:F.description,schema:F.schema}:{type:"json_object"}},...(I==null?void 0:I.textVerbosity)&&{verbosity:I.textVerbosity}}},conversation:I==null?void 0:I.conversation,max_tool_calls:I==null?void 0:I.maxToolCalls,metadata:I==null?void 0:I.metadata,parallel_tool_calls:I==null?void 0:I.parallelToolCalls,previous_response_id:I==null?void 0:I.previousResponseId,store:B$,user:I==null?void 0:I.user,instructions:I==null?void 0:I.instructions,service_tier:I==null?void 0:I.serviceTier,include:Y$,prompt_cache_key:I==null?void 0:I.promptCacheKey,prompt_cache_retention:I==null?void 0:I.promptCacheRetention,safety_identifier:I==null?void 0:I.safetyIdentifier,top_logprobs:o$,truncation:I==null?void 0:I.truncation,...d&&((I==null?void 0:I.reasoningEffort)!=null||(I==null?void 0:I.reasoningSummary)!=null)&&{reasoning:{...(I==null?void 0:I.reasoningEffort)!=null&&{effort:I.reasoningEffort},...(I==null?void 0:I.reasoningSummary)!=null&&{summary:I.reasoningSummary}}}};if(d){if(!((I==null?void 0:I.reasoningEffort)==="none"&&b.supportsNonReasoningParameters)){if(k$.temperature!=null)k$.temperature=void 0,E.push({type:"unsupported",feature:"temperature",details:"temperature is not supported for reasoning models"});if(k$.top_p!=null)k$.top_p=void 0,E.push({type:"unsupported",feature:"topP",details:"topP is not supported for reasoning models"})}}else{if((I==null?void 0:I.reasoningEffort)!=null)E.push({type:"unsupported",feature:"reasoningEffort",details:"reasoningEffort is not supported for non-reasoning models"});if((I==null?void 0:I.reasoningSummary)!=null)E.push({type:"unsupported",feature:"reasoningSummary",details:"reasoningSummary is not supported for non-reasoning models"})}if((I==null?void 0:I.serviceTier)==="flex"&&!b.supportsFlexProcessing)E.push({type:"unsupported",feature:"serviceTier",details:"flex processing is only available for o3, o4-mini, and gpt-5 models"}),delete k$.service_tier;if((I==null?void 0:I.serviceTier)==="priority"&&!b.supportsPriorityProcessing)E.push({type:"unsupported",feature:"serviceTier",details:"priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"}),delete k$.service_tier;let m=(y=(v=(j=Q==null?void 0:Q.find((H$)=>H$.type==="provider"&&H$.id==="openai.shell"))==null?void 0:j.args)==null?void 0:v.environment)==null?void 0:y.type,T$=m==="containerAuto"||m==="containerReference";return{webSearchToolName:T,args:{...k$,tools:h,tool_choice:f},warnings:[...E,...l],store:B$,toolNameMapping:k,providerOptionsName:R,isShellProviderExecuted:T$}}async doGenerate($){var X,Y,W,J,U,H,D,V,K,Q,q,F,w,z,O,N,L,P,j,v,y,E,b,R,I;let{args:d,warnings:k,webSearchToolName:t,toolNameMapping:h,providerOptionsName:f,isShellProviderExecuted:l}=await this.getArgs($),o=this.config.url({path:"/responses",modelId:this.modelId}),g=Og($.prompt),{responseHeaders:a,value:Y$,rawValue:_}=await q6({url:o,headers:V6(this.config.headers(),$.headers),body:d,failedResponseHandler:z0,successfulResponseHandler:M6(TU$),abortSignal:$.abortSignal,fetch:this.config.fetch});if(Y$.error)throw new R6({message:Y$.error.message,url:o,requestBodyValues:d,statusCode:400,responseHeaders:a,responseBody:_,isRetryable:!1});let V$=[],o$=[],T=!1;for(let m of Y$.output)switch(m.type){case"reasoning":{if(m.summary.length===0)m.summary.push({type:"summary_text",text:""});for(let T$ of m.summary)V$.push({type:"reasoning",text:T$.text,providerMetadata:{[f]:{itemId:m.id,reasoningEncryptedContent:(X=m.encrypted_content)!=null?X:null}}});break}case"image_generation_call":{V$.push({type:"tool-call",toolCallId:m.id,toolName:h.toCustomToolName("image_generation"),input:"{}",providerExecuted:!0}),V$.push({type:"tool-result",toolCallId:m.id,toolName:h.toCustomToolName("image_generation"),result:{result:m.result}});break}case"local_shell_call":{V$.push({type:"tool-call",toolCallId:m.call_id,toolName:h.toCustomToolName("local_shell"),input:JSON.stringify({action:m.action}),providerMetadata:{[f]:{itemId:m.id}}});break}case"shell_call":{V$.push({type:"tool-call",toolCallId:m.call_id,toolName:h.toCustomToolName("shell"),input:JSON.stringify({action:{commands:m.action.commands}}),...l&&{providerExecuted:!0},providerMetadata:{[f]:{itemId:m.id}}});break}case"shell_call_output":{V$.push({type:"tool-result",toolCallId:m.call_id,toolName:h.toCustomToolName("shell"),result:{output:m.output.map((T$)=>({stdout:T$.stdout,stderr:T$.stderr,outcome:T$.outcome.type==="exit"?{type:"exit",exitCode:T$.outcome.exit_code}:{type:"timeout"}}))}});break}case"message":{for(let T$ of m.content){if(((W=(Y=$.providerOptions)==null?void 0:Y[f])==null?void 0:W.logprobs)&&T$.logprobs)o$.push(T$.logprobs);let H$={itemId:m.id,...m.phase!=null&&{phase:m.phase},...T$.annotations.length>0&&{annotations:T$.annotations}};V$.push({type:"text",text:T$.text,providerMetadata:{[f]:H$}});for(let F$ of T$.annotations)if(F$.type==="url_citation")V$.push({type:"source",sourceType:"url",id:(H=(U=(J=this.config).generateId)==null?void 0:U.call(J))!=null?H:x6(),url:F$.url,title:F$.title});else if(F$.type==="file_citation")V$.push({type:"source",sourceType:"document",id:(K=(V=(D=this.config).generateId)==null?void 0:V.call(D))!=null?K:x6(),mediaType:"text/plain",title:F$.filename,filename:F$.filename,providerMetadata:{[f]:{type:F$.type,fileId:F$.file_id,index:F$.index}}});else if(F$.type==="container_file_citation")V$.push({type:"source",sourceType:"document",id:(F=(q=(Q=this.config).generateId)==null?void 0:q.call(Q))!=null?F:x6(),mediaType:"text/plain",title:F$.filename,filename:F$.filename,providerMetadata:{[f]:{type:F$.type,fileId:F$.file_id,containerId:F$.container_id}}});else if(F$.type==="file_path")V$.push({type:"source",sourceType:"document",id:(O=(z=(w=this.config).generateId)==null?void 0:z.call(w))!=null?O:x6(),mediaType:"application/octet-stream",title:F$.file_id,filename:F$.file_id,providerMetadata:{[f]:{type:F$.type,fileId:F$.file_id,index:F$.index}}})}break}case"function_call":{T=!0,V$.push({type:"tool-call",toolCallId:m.call_id,toolName:m.name,input:m.arguments,providerMetadata:{[f]:{itemId:m.id}}});break}case"custom_tool_call":{T=!0;let T$=h.toCustomToolName(m.name);V$.push({type:"tool-call",toolCallId:m.call_id,toolName:T$,input:JSON.stringify(m.input),providerMetadata:{[f]:{itemId:m.id}}});break}case"web_search_call":{V$.push({type:"tool-call",toolCallId:m.id,toolName:h.toCustomToolName(t!=null?t:"web_search"),input:JSON.stringify({}),providerExecuted:!0}),V$.push({type:"tool-result",toolCallId:m.id,toolName:h.toCustomToolName(t!=null?t:"web_search"),result:Ag(m.action)});break}case"mcp_call":{let T$=m.approval_request_id!=null?(N=g[m.approval_request_id])!=null?N:m.id:m.id,H$=`mcp.${m.name}`;V$.push({type:"tool-call",toolCallId:T$,toolName:H$,input:m.arguments,providerExecuted:!0,dynamic:!0}),V$.push({type:"tool-result",toolCallId:T$,toolName:H$,result:{type:"call",serverLabel:m.server_label,name:m.name,arguments:m.arguments,...m.output!=null?{output:m.output}:{},...m.error!=null?{error:m.error}:{}},providerMetadata:{[f]:{itemId:m.id}}});break}case"mcp_list_tools":break;case"mcp_approval_request":{let T$=(L=m.approval_request_id)!=null?L:m.id,H$=(v=(j=(P=this.config).generateId)==null?void 0:j.call(P))!=null?v:x6(),F$=`mcp.${m.name}`;V$.push({type:"tool-call",toolCallId:H$,toolName:F$,input:m.arguments,providerExecuted:!0,dynamic:!0}),V$.push({type:"tool-approval-request",approvalId:T$,toolCallId:H$});break}case"computer_call":{V$.push({type:"tool-call",toolCallId:m.id,toolName:h.toCustomToolName("computer_use"),input:"",providerExecuted:!0}),V$.push({type:"tool-result",toolCallId:m.id,toolName:h.toCustomToolName("computer_use"),result:{type:"computer_use_tool_result",status:m.status||"completed"}});break}case"file_search_call":{V$.push({type:"tool-call",toolCallId:m.id,toolName:h.toCustomToolName("file_search"),input:"{}",providerExecuted:!0}),V$.push({type:"tool-result",toolCallId:m.id,toolName:h.toCustomToolName("file_search"),result:{queries:m.queries,results:(E=(y=m.results)==null?void 0:y.map((T$)=>({attributes:T$.attributes,fileId:T$.file_id,filename:T$.filename,score:T$.score,text:T$.text})))!=null?E:null}});break}case"code_interpreter_call":{V$.push({type:"tool-call",toolCallId:m.id,toolName:h.toCustomToolName("code_interpreter"),input:JSON.stringify({code:m.code,containerId:m.container_id}),providerExecuted:!0}),V$.push({type:"tool-result",toolCallId:m.id,toolName:h.toCustomToolName("code_interpreter"),result:{outputs:m.outputs}});break}case"apply_patch_call":{V$.push({type:"tool-call",toolCallId:m.call_id,toolName:h.toCustomToolName("apply_patch"),input:JSON.stringify({callId:m.call_id,operation:m.operation}),providerMetadata:{[f]:{itemId:m.id}}});break}}let B$={[f]:{responseId:Y$.id,...o$.length>0?{logprobs:o$}:{},...typeof Y$.service_tier==="string"?{serviceTier:Y$.service_tier}:{}}},k$=Y$.usage;return{content:V$,finishReason:{unified:Zg({finishReason:(b=Y$.incomplete_details)==null?void 0:b.reason,hasFunctionCall:T}),raw:(I=(R=Y$.incomplete_details)==null?void 0:R.reason)!=null?I:void 0},usage:qg(k$),request:{body:d},response:{id:Y$.id,timestamp:new Date(Y$.created_at*1000),modelId:Y$.model,headers:a,body:_},providerMetadata:B$,warnings:k}}async doStream($){let{args:X,warnings:Y,webSearchToolName:W,toolNameMapping:J,store:U,providerOptionsName:H,isShellProviderExecuted:D}=await this.getArgs($),{responseHeaders:V,value:K}=await q6({url:this.config.url({path:"/responses",modelId:this.modelId}),headers:V6(this.config.headers(),$.headers),body:{...X,stream:!0},failedResponseHandler:z0,successfulResponseHandler:c1(_U$),abortSignal:$.abortSignal,fetch:this.config.fetch}),Q=this,q=Og($.prompt),F=new Map,w={unified:"other",raw:void 0},z=void 0,O=[],N=null,L={},P=[],j,v=!1,y={},E;return{stream:K.pipeThrough(new TransformStream({start(b){b.enqueue({type:"stream-start",warnings:Y})},transform(b,R){var I,d,k,t,h,f,l,o,g,a,Y$,_,V$,o$,T,B$,k$,m,T$,H$,F$,P$,j$,U$,n,G$,S$,v$,j6,q4,l4,$1;if($.includeRawChunks)R.enqueue({type:"raw",rawValue:b.rawValue});if(!b.success){w={unified:"error",raw:void 0},R.enqueue({type:"error",error:b.error});return}let C=b.value;if(Ng(C)){if(C.item.type==="function_call")L[C.output_index]={toolName:C.item.name,toolCallId:C.item.call_id},R.enqueue({type:"tool-input-start",id:C.item.call_id,toolName:C.item.name});else if(C.item.type==="custom_tool_call"){let w$=J.toCustomToolName(C.item.name);L[C.output_index]={toolName:w$,toolCallId:C.item.call_id},R.enqueue({type:"tool-input-start",id:C.item.call_id,toolName:w$})}else if(C.item.type==="web_search_call")L[C.output_index]={toolName:J.toCustomToolName(W!=null?W:"web_search"),toolCallId:C.item.id},R.enqueue({type:"tool-input-start",id:C.item.id,toolName:J.toCustomToolName(W!=null?W:"web_search"),providerExecuted:!0}),R.enqueue({type:"tool-input-end",id:C.item.id}),R.enqueue({type:"tool-call",toolCallId:C.item.id,toolName:J.toCustomToolName(W!=null?W:"web_search"),input:JSON.stringify({}),providerExecuted:!0});else if(C.item.type==="computer_call")L[C.output_index]={toolName:J.toCustomToolName("computer_use"),toolCallId:C.item.id},R.enqueue({type:"tool-input-start",id:C.item.id,toolName:J.toCustomToolName("computer_use"),providerExecuted:!0});else if(C.item.type==="code_interpreter_call")L[C.output_index]={toolName:J.toCustomToolName("code_interpreter"),toolCallId:C.item.id,codeInterpreter:{containerId:C.item.container_id}},R.enqueue({type:"tool-input-start",id:C.item.id,toolName:J.toCustomToolName("code_interpreter"),providerExecuted:!0}),R.enqueue({type:"tool-input-delta",id:C.item.id,delta:`{"containerId":"${C.item.container_id}","code":"`});else if(C.item.type==="file_search_call")R.enqueue({type:"tool-call",toolCallId:C.item.id,toolName:J.toCustomToolName("file_search"),input:"{}",providerExecuted:!0});else if(C.item.type==="image_generation_call")R.enqueue({type:"tool-call",toolCallId:C.item.id,toolName:J.toCustomToolName("image_generation"),input:"{}",providerExecuted:!0});else if(C.item.type==="mcp_call"||C.item.type==="mcp_list_tools"||C.item.type==="mcp_approval_request");else if(C.item.type==="apply_patch_call"){let{call_id:w$,operation:f6}=C.item;if(L[C.output_index]={toolName:J.toCustomToolName("apply_patch"),toolCallId:w$,applyPatch:{hasDiff:f6.type==="delete_file",endEmitted:f6.type==="delete_file"}},R.enqueue({type:"tool-input-start",id:w$,toolName:J.toCustomToolName("apply_patch")}),f6.type==="delete_file"){let N4=JSON.stringify({callId:w$,operation:f6});R.enqueue({type:"tool-input-delta",id:w$,delta:N4}),R.enqueue({type:"tool-input-end",id:w$})}else R.enqueue({type:"tool-input-delta",id:w$,delta:`{"callId":"${J5(w$)}","operation":{"type":"${J5(f6.type)}","path":"${J5(f6.path)}","diff":"`})}else if(C.item.type==="shell_call")L[C.output_index]={toolName:J.toCustomToolName("shell"),toolCallId:C.item.call_id};else if(C.item.type==="shell_call_output");else if(C.item.type==="message")P.splice(0,P.length),j=(I=C.item.phase)!=null?I:void 0,R.enqueue({type:"text-start",id:C.item.id,providerMetadata:{[H]:{itemId:C.item.id,...C.item.phase!=null&&{phase:C.item.phase}}}});else if(Ng(C)&&C.item.type==="reasoning")y[C.item.id]={encryptedContent:C.item.encrypted_content,summaryParts:{0:"active"}},R.enqueue({type:"reasoning-start",id:`${C.item.id}:0`,providerMetadata:{[H]:{itemId:C.item.id,reasoningEncryptedContent:(d=C.item.encrypted_content)!=null?d:null}}})}else if(hU$(C)){if(C.item.type==="message"){let w$=(k=C.item.phase)!=null?k:j;j=void 0,R.enqueue({type:"text-end",id:C.item.id,providerMetadata:{[H]:{itemId:C.item.id,...w$!=null&&{phase:w$},...P.length>0&&{annotations:P}}}})}else if(C.item.type==="function_call")L[C.output_index]=void 0,v=!0,R.enqueue({type:"tool-input-end",id:C.item.call_id}),R.enqueue({type:"tool-call",toolCallId:C.item.call_id,toolName:C.item.name,input:C.item.arguments,providerMetadata:{[H]:{itemId:C.item.id}}});else if(C.item.type==="custom_tool_call"){L[C.output_index]=void 0,v=!0;let w$=J.toCustomToolName(C.item.name);R.enqueue({type:"tool-input-end",id:C.item.call_id}),R.enqueue({type:"tool-call",toolCallId:C.item.call_id,toolName:w$,input:JSON.stringify(C.item.input),providerMetadata:{[H]:{itemId:C.item.id}}})}else if(C.item.type==="web_search_call")L[C.output_index]=void 0,R.enqueue({type:"tool-result",toolCallId:C.item.id,toolName:J.toCustomToolName(W!=null?W:"web_search"),result:Ag(C.item.action)});else if(C.item.type==="computer_call")L[C.output_index]=void 0,R.enqueue({type:"tool-input-end",id:C.item.id}),R.enqueue({type:"tool-call",toolCallId:C.item.id,toolName:J.toCustomToolName("computer_use"),input:"",providerExecuted:!0}),R.enqueue({type:"tool-result",toolCallId:C.item.id,toolName:J.toCustomToolName("computer_use"),result:{type:"computer_use_tool_result",status:C.item.status||"completed"}});else if(C.item.type==="file_search_call")L[C.output_index]=void 0,R.enqueue({type:"tool-result",toolCallId:C.item.id,toolName:J.toCustomToolName("file_search"),result:{queries:C.item.queries,results:(h=(t=C.item.results)==null?void 0:t.map((w$)=>({attributes:w$.attributes,fileId:w$.file_id,filename:w$.filename,score:w$.score,text:w$.text})))!=null?h:null}});else if(C.item.type==="code_interpreter_call")L[C.output_index]=void 0,R.enqueue({type:"tool-result",toolCallId:C.item.id,toolName:J.toCustomToolName("code_interpreter"),result:{outputs:C.item.outputs}});else if(C.item.type==="image_generation_call")R.enqueue({type:"tool-result",toolCallId:C.item.id,toolName:J.toCustomToolName("image_generation"),result:{result:C.item.result}});else if(C.item.type==="mcp_call"){L[C.output_index]=void 0;let w$=(f=C.item.approval_request_id)!=null?f:void 0,f6=w$!=null?(o=(l=F.get(w$))!=null?l:q[w$])!=null?o:C.item.id:C.item.id,N4=`mcp.${C.item.name}`;R.enqueue({type:"tool-call",toolCallId:f6,toolName:N4,input:C.item.arguments,providerExecuted:!0,dynamic:!0}),R.enqueue({type:"tool-result",toolCallId:f6,toolName:N4,result:{type:"call",serverLabel:C.item.server_label,name:C.item.name,arguments:C.item.arguments,...C.item.output!=null?{output:C.item.output}:{},...C.item.error!=null?{error:C.item.error}:{}},providerMetadata:{[H]:{itemId:C.item.id}}})}else if(C.item.type==="mcp_list_tools")L[C.output_index]=void 0;else if(C.item.type==="apply_patch_call"){let w$=L[C.output_index];if((w$==null?void 0:w$.applyPatch)&&!w$.applyPatch.endEmitted&&C.item.operation.type!=="delete_file"){if(!w$.applyPatch.hasDiff)R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:J5(C.item.operation.diff)});R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:'"}}'}),R.enqueue({type:"tool-input-end",id:w$.toolCallId}),w$.applyPatch.endEmitted=!0}if(w$&&C.item.status==="completed")R.enqueue({type:"tool-call",toolCallId:w$.toolCallId,toolName:J.toCustomToolName("apply_patch"),input:JSON.stringify({callId:C.item.call_id,operation:C.item.operation}),providerMetadata:{[H]:{itemId:C.item.id}}});L[C.output_index]=void 0}else if(C.item.type==="mcp_approval_request"){L[C.output_index]=void 0;let w$=(Y$=(a=(g=Q.config).generateId)==null?void 0:a.call(g))!=null?Y$:x6(),f6=(_=C.item.approval_request_id)!=null?_:C.item.id;F.set(f6,w$);let N4=`mcp.${C.item.name}`;R.enqueue({type:"tool-call",toolCallId:w$,toolName:N4,input:C.item.arguments,providerExecuted:!0,dynamic:!0}),R.enqueue({type:"tool-approval-request",approvalId:f6,toolCallId:w$})}else if(C.item.type==="local_shell_call")L[C.output_index]=void 0,R.enqueue({type:"tool-call",toolCallId:C.item.call_id,toolName:J.toCustomToolName("local_shell"),input:JSON.stringify({action:{type:"exec",command:C.item.action.command,timeoutMs:C.item.action.timeout_ms,user:C.item.action.user,workingDirectory:C.item.action.working_directory,env:C.item.action.env}}),providerMetadata:{[H]:{itemId:C.item.id}}});else if(C.item.type==="shell_call")L[C.output_index]=void 0,R.enqueue({type:"tool-call",toolCallId:C.item.call_id,toolName:J.toCustomToolName("shell"),input:JSON.stringify({action:{commands:C.item.action.commands}}),...D&&{providerExecuted:!0},providerMetadata:{[H]:{itemId:C.item.id}}});else if(C.item.type==="shell_call_output")R.enqueue({type:"tool-result",toolCallId:C.item.call_id,toolName:J.toCustomToolName("shell"),result:{output:C.item.output.map((w$)=>({stdout:w$.stdout,stderr:w$.stderr,outcome:w$.outcome.type==="exit"?{type:"exit",exitCode:w$.outcome.exit_code}:{type:"timeout"}}))}});else if(C.item.type==="reasoning"){let w$=y[C.item.id],f6=Object.entries(w$.summaryParts).filter(([N4,F1])=>F1==="active"||F1==="can-conclude").map(([N4])=>N4);for(let N4 of f6)R.enqueue({type:"reasoning-end",id:`${C.item.id}:${N4}`,providerMetadata:{[H]:{itemId:C.item.id,reasoningEncryptedContent:(V$=C.item.encrypted_content)!=null?V$:null}}});delete y[C.item.id]}}else if(gU$(C)){let w$=L[C.output_index];if(w$!=null)R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:C.delta})}else if(mU$(C)){let w$=L[C.output_index];if(w$!=null)R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:C.delta})}else if(dU$(C)){let w$=L[C.output_index];if(w$==null?void 0:w$.applyPatch)R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:J5(C.delta)}),w$.applyPatch.hasDiff=!0}else if(lU$(C)){let w$=L[C.output_index];if((w$==null?void 0:w$.applyPatch)&&!w$.applyPatch.endEmitted){if(!w$.applyPatch.hasDiff)R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:J5(C.diff)}),w$.applyPatch.hasDiff=!0;R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:'"}}'}),R.enqueue({type:"tool-input-end",id:w$.toolCallId}),w$.applyPatch.endEmitted=!0}}else if(uU$(C))R.enqueue({type:"tool-result",toolCallId:C.item_id,toolName:J.toCustomToolName("image_generation"),result:{result:C.partial_image_b64},preliminary:!0});else if(pU$(C)){let w$=L[C.output_index];if(w$!=null)R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:J5(C.delta)})}else if(cU$(C)){let w$=L[C.output_index];if(w$!=null)R.enqueue({type:"tool-input-delta",id:w$.toolCallId,delta:'"}'}),R.enqueue({type:"tool-input-end",id:w$.toolCallId}),R.enqueue({type:"tool-call",toolCallId:w$.toolCallId,toolName:J.toCustomToolName("code_interpreter"),input:JSON.stringify({code:C.code,containerId:w$.codeInterpreter.containerId}),providerExecuted:!0})}else if(fU$(C))N=C.response.id,R.enqueue({type:"response-metadata",id:C.response.id,timestamp:new Date(C.response.created_at*1000),modelId:C.response.model});else if(vU$(C)){if(R.enqueue({type:"text-delta",id:C.item_id,delta:C.delta}),((T=(o$=$.providerOptions)==null?void 0:o$[H])==null?void 0:T.logprobs)&&C.logprobs)O.push(C.logprobs)}else if(C.type==="response.reasoning_summary_part.added"){if(C.summary_index>0){let w$=y[C.item_id];w$.summaryParts[C.summary_index]="active";for(let f6 of Object.keys(w$.summaryParts))if(w$.summaryParts[f6]==="can-conclude")R.enqueue({type:"reasoning-end",id:`${C.item_id}:${f6}`,providerMetadata:{[H]:{itemId:C.item_id}}}),w$.summaryParts[f6]="concluded";R.enqueue({type:"reasoning-start",id:`${C.item_id}:${C.summary_index}`,providerMetadata:{[H]:{itemId:C.item_id,reasoningEncryptedContent:(k$=(B$=y[C.item_id])==null?void 0:B$.encryptedContent)!=null?k$:null}}})}}else if(C.type==="response.reasoning_summary_text.delta")R.enqueue({type:"reasoning-delta",id:`${C.item_id}:${C.summary_index}`,delta:C.delta,providerMetadata:{[H]:{itemId:C.item_id}}});else if(C.type==="response.reasoning_summary_part.done")if(U)R.enqueue({type:"reasoning-end",id:`${C.item_id}:${C.summary_index}`,providerMetadata:{[H]:{itemId:C.item_id}}}),y[C.item_id].summaryParts[C.summary_index]="concluded";else y[C.item_id].summaryParts[C.summary_index]="can-conclude";else if(yU$(C)){if(w={unified:Zg({finishReason:(m=C.response.incomplete_details)==null?void 0:m.reason,hasFunctionCall:v}),raw:(H$=(T$=C.response.incomplete_details)==null?void 0:T$.reason)!=null?H$:void 0},z=C.response.usage,typeof C.response.service_tier==="string")E=C.response.service_tier}else if(iU$(C)){if(P.push(C.annotation),C.annotation.type==="url_citation")R.enqueue({type:"source",sourceType:"url",id:(j$=(P$=(F$=Q.config).generateId)==null?void 0:P$.call(F$))!=null?j$:x6(),url:C.annotation.url,title:C.annotation.title});else if(C.annotation.type==="file_citation")R.enqueue({type:"source",sourceType:"document",id:(G$=(n=(U$=Q.config).generateId)==null?void 0:n.call(U$))!=null?G$:x6(),mediaType:"text/plain",title:C.annotation.filename,filename:C.annotation.filename,providerMetadata:{[H]:{type:C.annotation.type,fileId:C.annotation.file_id,index:C.annotation.index}}});else if(C.annotation.type==="container_file_citation")R.enqueue({type:"source",sourceType:"document",id:(j6=(v$=(S$=Q.config).generateId)==null?void 0:v$.call(S$))!=null?j6:x6(),mediaType:"text/plain",title:C.annotation.filename,filename:C.annotation.filename,providerMetadata:{[H]:{type:C.annotation.type,fileId:C.annotation.file_id,containerId:C.annotation.container_id}}});else if(C.annotation.type==="file_path")R.enqueue({type:"source",sourceType:"document",id:($1=(l4=(q4=Q.config).generateId)==null?void 0:l4.call(q4))!=null?$1:x6(),mediaType:"application/octet-stream",title:C.annotation.file_id,filename:C.annotation.file_id,providerMetadata:{[H]:{type:C.annotation.type,fileId:C.annotation.file_id,index:C.annotation.index}}})}else if(rU$(C))R.enqueue({type:"error",error:C})},flush(b){let R={[H]:{responseId:N,...O.length>0?{logprobs:O}:{},...E!==void 0?{serviceTier:E}:{}}};b.enqueue({type:"finish",finishReason:w,usage:qg(z),providerMetadata:R})}})),request:{body:X},response:{headers:V}}}},nU$,oU$=class{constructor($,X){this.modelId=$,this.config=X,this.specificationVersion="v3"}get provider(){return this.config.provider}async getArgs({text:$,voice:X="alloy",outputFormat:Y="mp3",speed:W,instructions:J,language:U,providerOptions:H}){let D=[],V=await E6({provider:"openai",providerOptions:H,schema:nU$}),K={model:this.modelId,input:$,voice:X,response_format:"mp3",speed:W,instructions:J};if(Y)if(["mp3","opus","aac","flac","wav","pcm"].includes(Y))K.response_format=Y;else D.push({type:"unsupported",feature:"outputFormat",details:`Unsupported output format: ${Y}. Using mp3 instead.`});if(V){let Q={};for(let q in Q){let F=Q[q];if(F!==void 0)K[q]=F}}if(U)D.push({type:"unsupported",feature:"language",details:`OpenAI speech models do not support language selection. Language parameter "${U}" was ignored.`});return{requestBody:K,warnings:D}}async doGenerate($){var X,Y,W;let J=(W=(Y=(X=this.config._internal)==null?void 0:X.currentDate)==null?void 0:Y.call(X))!=null?W:new Date,{requestBody:U,warnings:H}=await this.getArgs($),{value:D,responseHeaders:V,rawValue:K}=await q6({url:this.config.url({path:"/audio/speech",modelId:this.modelId}),headers:V6(this.config.headers(),$.headers),body:U,failedResponseHandler:z0,successfulResponseHandler:ub(),abortSignal:$.abortSignal,fetch:this.config.fetch});return{audio:D,warnings:H,request:{body:JSON.stringify(U)},response:{timestamp:J,modelId:this.modelId,headers:V,body:K}}}},aU$,sU$,Bg,tU$=class{constructor($,X){this.modelId=$,this.config=X,this.specificationVersion="v3"}get provider(){return this.config.provider}async getArgs({audio:$,mediaType:X,providerOptions:Y}){let W=[],J=await E6({provider:"openai",providerOptions:Y,schema:sU$}),U=new FormData,H=$ instanceof Uint8Array?new Blob([$]):new Blob([p4($)]);U.append("model",this.modelId);let D=vb(X);if(U.append("file",new File([H],"audio",{type:X}),`audio.${D}`),J){let V={include:J.include,language:J.language,prompt:J.prompt,response_format:["gpt-4o-transcribe","gpt-4o-mini-transcribe"].includes(this.modelId)?"json":"verbose_json",temperature:J.temperature,timestamp_granularities:J.timestampGranularities};for(let[K,Q]of Object.entries(V))if(Q!=null)if(Array.isArray(Q))for(let q of Q)U.append(`${K}[]`,String(q));else U.append(K,String(Q))}return{formData:U,warnings:W}}async doGenerate($){var X,Y,W,J,U,H,D,V;let K=(W=(Y=(X=this.config._internal)==null?void 0:X.currentDate)==null?void 0:Y.call(X))!=null?W:new Date,{formData:Q,warnings:q}=await this.getArgs($),{value:F,responseHeaders:w,rawValue:z}=await LG({url:this.config.url({path:"/audio/transcriptions",modelId:this.modelId}),headers:V6(this.config.headers(),$.headers),formData:Q,failedResponseHandler:z0,successfulResponseHandler:M6(aU$),abortSignal:$.abortSignal,fetch:this.config.fetch}),O=F.language!=null&&F.language in Bg?Bg[F.language]:void 0;return{text:F.text,segments:(D=(H=(J=F.segments)==null?void 0:J.map((N)=>({text:N.text,startSecond:N.start,endSecond:N.end})))!=null?H:(U=F.words)==null?void 0:U.map((N)=>({text:N.word,startSecond:N.start,endSecond:N.end})))!=null?D:[],language:O,durationInSeconds:(V=F.duration)!=null?V:void 0,warnings:q,response:{timestamp:K,modelId:this.modelId,headers:w,body:z}}}},eU$="3.0.41",zl$;var wO=A(()=>{$$();f$();$$();I$();$$();f$();$$();$$();I$();$$();I$();f$();$$();f$();I$();$$();$$();I$();f$();$$();$$();I$();$$();I$();$$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();f$();$$();f$();$$();I$();$$();I$();$$();I$();f$();$$();$$();$$();I$();$$();$$();I$();$$();I$();qO=G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.any().nullish(),code:G.union([G.string(),G.number()]).nullish()})}),z0=E4({errorSchema:qO,errorToMessage:($)=>$.error.message});EW$=p(()=>u(G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant").nullish(),content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string().nullish(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish(),annotations:G.array(G.object({type:G.literal("url_citation"),url_citation:G.object({start_index:G.number(),end_index:G.number(),url:G.string(),title:G.string()})})).nullish()}),index:G.number(),logprobs:G.object({content:G.array(G.object({token:G.string(),logprob:G.number(),top_logprobs:G.array(G.object({token:G.string(),logprob:G.number()}))})).nullish()}).nullish(),finish_reason:G.string().nullish()})),usage:G.object({prompt_tokens:G.number().nullish(),completion_tokens:G.number().nullish(),total_tokens:G.number().nullish(),prompt_tokens_details:G.object({cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}).nullish()}))),PW$=p(()=>u(G.union([G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).nullish(),content:G.string().nullish(),tool_calls:G.array(G.object({index:G.number(),id:G.string().nullish(),type:G.literal("function").nullish(),function:G.object({name:G.string().nullish(),arguments:G.string().nullish()})})).nullish(),annotations:G.array(G.object({type:G.literal("url_citation"),url_citation:G.object({start_index:G.number(),end_index:G.number(),url:G.string(),title:G.string()})})).nullish()}).nullish(),logprobs:G.object({content:G.array(G.object({token:G.string(),logprob:G.number(),top_logprobs:G.array(G.object({token:G.string(),logprob:G.number()}))})).nullish()}).nullish(),finish_reason:G.string().nullish(),index:G.number()})),usage:G.object({prompt_tokens:G.number().nullish(),completion_tokens:G.number().nullish(),total_tokens:G.number().nullish(),prompt_tokens_details:G.object({cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}).nullish()}),qO]))),IW$=p(()=>u(G.object({logitBias:G.record(G.coerce.number(),G.number()).optional(),logprobs:G.union([G.boolean(),G.number()]).optional(),parallelToolCalls:G.boolean().optional(),user:G.string().optional(),reasoningEffort:G.enum(["none","minimal","low","medium","high","xhigh"]).optional(),maxCompletionTokens:G.number().optional(),store:G.boolean().optional(),metadata:G.record(G.string().max(64),G.string().max(512)).optional(),prediction:G.record(G.string(),G.any()).optional(),serviceTier:G.enum(["auto","flex","priority","default"]).optional(),strictJsonSchema:G.boolean().optional(),textVerbosity:G.enum(["low","medium","high"]).optional(),promptCacheKey:G.string().optional(),promptCacheRetention:G.enum(["in_memory","24h"]).optional(),safetyIdentifier:G.string().optional(),systemMessageMode:G.enum(["system","developer","remove"]).optional(),forceReasoning:G.boolean().optional()})));SW$=p(()=>u(G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({text:G.string(),finish_reason:G.string(),logprobs:G.object({tokens:G.array(G.string()),token_logprobs:G.array(G.number()),top_logprobs:G.array(G.record(G.string(),G.number())).nullish()}).nullish()})),usage:G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number()}).nullish()}))),bW$=p(()=>u(G.union([G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({text:G.string(),finish_reason:G.string().nullish(),index:G.number(),logprobs:G.object({tokens:G.array(G.string()),token_logprobs:G.array(G.number()),top_logprobs:G.array(G.record(G.string(),G.number())).nullish()}).nullish()})),usage:G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number()}).nullish()}),qO]))),Kg=p(()=>u(G.object({echo:G.boolean().optional(),logitBias:G.record(G.string(),G.number()).optional(),suffix:G.string().optional(),user:G.string().optional(),logprobs:G.union([G.boolean(),G.number()]).optional()}))),kW$=p(()=>u(G.object({dimensions:G.number().optional(),user:G.string().optional()}))),vW$=p(()=>u(G.object({data:G.array(G.object({embedding:G.array(G.number())})),usage:G.object({prompt_tokens:G.number()}).nullish()}))),Qg=p(()=>u(G.object({created:G.number().nullish(),data:G.array(G.object({b64_json:G.string(),revised_prompt:G.string().nullish()})),background:G.string().nullish(),output_format:G.string().nullish(),size:G.string().nullish(),quality:G.string().nullish(),usage:G.object({input_tokens:G.number().nullish(),output_tokens:G.number().nullish(),total_tokens:G.number().nullish(),input_tokens_details:G.object({image_tokens:G.number().nullish(),text_tokens:G.number().nullish()}).nullish()}).nullish()}))),yW$={"dall-e-3":1,"dall-e-2":10,"gpt-image-1":10,"gpt-image-1-mini":10,"gpt-image-1.5":10,"chatgpt-image-latest":10},fW$=["chatgpt-image-","gpt-image-1-mini","gpt-image-1.5","gpt-image-1"];jg=p(()=>u(G.object({callId:G.string(),operation:G.discriminatedUnion("type",[G.object({type:G.literal("create_file"),path:G.string(),diff:G.string()}),G.object({type:G.literal("delete_file"),path:G.string()}),G.object({type:G.literal("update_file"),path:G.string(),diff:G.string()})])}))),Rg=p(()=>u(G.object({status:G.enum(["completed","failed"]),output:G.string().optional()}))),Sd$=p(()=>u(G.object({}))),pW$=J6({id:"openai.apply_patch",inputSchema:jg,outputSchema:Rg}),cW$=pW$,dW$=p(()=>u(G.object({code:G.string().nullish(),containerId:G.string()}))),lW$=p(()=>u(G.object({outputs:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("logs"),logs:G.string()}),G.object({type:G.literal("image"),url:G.string()})])).nullish()}))),iW$=p(()=>u(G.object({container:G.union([G.string(),G.object({fileIds:G.array(G.string()).optional()})]).optional()}))),rW$=J6({id:"openai.code_interpreter",inputSchema:dW$,outputSchema:lW$}),oW$=p(()=>u(G.object({name:G.string(),description:G.string().optional(),format:G.union([G.object({type:G.literal("grammar"),syntax:G.enum(["regex","lark"]),definition:G.string()}),G.object({type:G.literal("text")})]).optional()}))),aW$=p(()=>u(G.string())),sW$=A6({id:"openai.custom",inputSchema:aW$}),Lg=G.object({key:G.string(),type:G.enum(["eq","ne","gt","gte","lt","lte","in","nin"]),value:G.union([G.string(),G.number(),G.boolean(),G.array(G.string())])}),Eg=G.object({type:G.enum(["and","or"]),filters:G.array(G.union([Lg,G.lazy(()=>Eg)]))}),eW$=p(()=>u(G.object({vectorStoreIds:G.array(G.string()),maxNumResults:G.number().optional(),ranking:G.object({ranker:G.string().optional(),scoreThreshold:G.number().optional()}).optional(),filters:G.union([Lg,Eg]).optional()}))),$U$=p(()=>u(G.object({queries:G.array(G.string()),results:G.array(G.object({attributes:G.record(G.string(),G.unknown()),fileId:G.string(),filename:G.string(),score:G.number(),text:G.string()})).nullable()}))),XU$=J6({id:"openai.file_search",inputSchema:G.object({}),outputSchema:$U$}),YU$=p(()=>u(G.object({background:G.enum(["auto","opaque","transparent"]).optional(),inputFidelity:G.enum(["low","high"]).optional(),inputImageMask:G.object({fileId:G.string().optional(),imageUrl:G.string().optional()}).optional(),model:G.string().optional(),moderation:G.enum(["auto"]).optional(),outputCompression:G.number().int().min(0).max(100).optional(),outputFormat:G.enum(["png","jpeg","webp"]).optional(),partialImages:G.number().int().min(0).max(3).optional(),quality:G.enum(["auto","low","medium","high"]).optional(),size:G.enum(["1024x1024","1024x1536","1536x1024","auto"]).optional()}).strict())),JU$=p(()=>u(G.object({}))),WU$=p(()=>u(G.object({result:G.string()}))),UU$=J6({id:"openai.image_generation",inputSchema:JU$,outputSchema:WU$}),Pg=p(()=>u(G.object({action:G.object({type:G.literal("exec"),command:G.array(G.string()),timeoutMs:G.number().optional(),user:G.string().optional(),workingDirectory:G.string().optional(),env:G.record(G.string(),G.string()).optional()})}))),Ig=p(()=>u(G.object({output:G.string()}))),HU$=J6({id:"openai.local_shell",inputSchema:Pg,outputSchema:Ig}),_g=p(()=>u(G.object({action:G.object({commands:G.array(G.string()),timeoutMs:G.number().optional(),maxOutputLength:G.number().optional()})}))),QO=p(()=>u(G.object({output:G.array(G.object({stdout:G.string(),stderr:G.string(),outcome:G.discriminatedUnion("type",[G.object({type:G.literal("timeout")}),G.object({type:G.literal("exit"),exitCode:G.number()})])}))}))),DU$=G.array(G.discriminatedUnion("type",[G.object({type:G.literal("skillReference"),skillId:G.string(),version:G.string().optional()}),G.object({type:G.literal("inline"),name:G.string(),description:G.string(),source:G.object({type:G.literal("base64"),mediaType:G.literal("application/zip"),data:G.string()})})])).optional(),VU$=p(()=>u(G.object({environment:G.union([G.object({type:G.literal("containerAuto"),fileIds:G.array(G.string()).optional(),memoryLimit:G.enum(["1g","4g","16g","64g"]).optional(),networkPolicy:G.discriminatedUnion("type",[G.object({type:G.literal("disabled")}),G.object({type:G.literal("allowlist"),allowedDomains:G.array(G.string()),domainSecrets:G.array(G.object({domain:G.string(),name:G.string(),value:G.string()})).optional()})]).optional(),skills:DU$}),G.object({type:G.literal("containerReference"),containerId:G.string()}),G.object({type:G.literal("local").optional(),skills:G.array(G.object({name:G.string(),description:G.string(),path:G.string()})).optional()})]).optional()}))),KU$=J6({id:"openai.shell",inputSchema:_g,outputSchema:QO}),QU$=p(()=>u(G.object({externalWebAccess:G.boolean().optional(),filters:G.object({allowedDomains:G.array(G.string()).optional()}).optional(),searchContextSize:G.enum(["low","medium","high"]).optional(),userLocation:G.object({type:G.literal("approximate"),country:G.string().optional(),city:G.string().optional(),region:G.string().optional(),timezone:G.string().optional()}).optional()}))),FU$=p(()=>u(G.object({}))),qU$=p(()=>u(G.object({action:G.discriminatedUnion("type",[G.object({type:G.literal("search"),query:G.string().optional()}),G.object({type:G.literal("openPage"),url:G.string().nullish()}),G.object({type:G.literal("findInPage"),url:G.string().nullish(),pattern:G.string().nullish()})]).optional(),sources:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("url"),url:G.string()}),G.object({type:G.literal("api"),name:G.string()})])).optional()}))),wU$=J6({id:"openai.web_search",inputSchema:FU$,outputSchema:qU$}),zU$=p(()=>u(G.object({searchContextSize:G.enum(["low","medium","high"]).optional(),userLocation:G.object({type:G.literal("approximate"),country:G.string().optional(),city:G.string().optional(),region:G.string().optional(),timezone:G.string().optional()}).optional()}))),OU$=p(()=>u(G.object({}))),NU$=p(()=>u(G.object({action:G.discriminatedUnion("type",[G.object({type:G.literal("search"),query:G.string().optional()}),G.object({type:G.literal("openPage"),url:G.string().nullish()}),G.object({type:G.literal("findInPage"),url:G.string().nullish(),pattern:G.string().nullish()})]).optional()}))),AU$=J6({id:"openai.web_search_preview",inputSchema:OU$,outputSchema:NU$}),FO=G.lazy(()=>G.union([G.string(),G.number(),G.boolean(),G.null(),G.array(FO),G.record(G.string(),FO)])),BU$=p(()=>u(G.object({serverLabel:G.string(),allowedTools:G.union([G.array(G.string()),G.object({readOnly:G.boolean().optional(),toolNames:G.array(G.string()).optional()})]).optional(),authorization:G.string().optional(),connectorId:G.string().optional(),headers:G.record(G.string(),G.string()).optional(),requireApproval:G.union([G.enum(["always","never"]),G.object({never:G.object({toolNames:G.array(G.string()).optional()}).optional()})]).optional(),serverDescription:G.string().optional(),serverUrl:G.string().optional()}).refine(($)=>$.serverUrl!=null||$.connectorId!=null,"One of serverUrl or connectorId must be provided."))),MU$=p(()=>u(G.object({}))),jU$=p(()=>u(G.object({type:G.literal("call"),serverLabel:G.string(),name:G.string(),arguments:G.string(),output:G.string().nullish(),error:G.union([G.string(),FO]).optional()}))),RU$=J6({id:"openai.mcp",inputSchema:MU$,outputSchema:jU$}),EU$={applyPatch:cW$,customTool:tW$,codeInterpreter:nW$,fileSearch:XU$,imageGeneration:GU$,localShell:HU$,shell:KU$,webSearchPreview:AU$,webSearch:ZU$,mcp:LU$};IU$=G.object({itemId:G.string().nullish(),reasoningEncryptedContent:G.string().nullish()});_U$=p(()=>u(G.union([G.object({type:G.literal("response.output_text.delta"),item_id:G.string(),delta:G.string(),logprobs:G.array(G.object({token:G.string(),logprob:G.number(),top_logprobs:G.array(G.object({token:G.string(),logprob:G.number()}))})).nullish()}),G.object({type:G.enum(["response.completed","response.incomplete"]),response:G.object({incomplete_details:G.object({reason:G.string()}).nullish(),usage:G.object({input_tokens:G.number(),input_tokens_details:G.object({cached_tokens:G.number().nullish()}).nullish(),output_tokens:G.number(),output_tokens_details:G.object({reasoning_tokens:G.number().nullish()}).nullish()}),service_tier:G.string().nullish()})}),G.object({type:G.literal("response.created"),response:G.object({id:G.string(),created_at:G.number(),model:G.string(),service_tier:G.string().nullish()})}),G.object({type:G.literal("response.output_item.added"),output_index:G.number(),item:G.discriminatedUnion("type",[G.object({type:G.literal("message"),id:G.string(),phase:G.enum(["commentary","final_answer"]).nullish()}),G.object({type:G.literal("reasoning"),id:G.string(),encrypted_content:G.string().nullish()}),G.object({type:G.literal("function_call"),id:G.string(),call_id:G.string(),name:G.string(),arguments:G.string()}),G.object({type:G.literal("web_search_call"),id:G.string(),status:G.string()}),G.object({type:G.literal("computer_call"),id:G.string(),status:G.string()}),G.object({type:G.literal("file_search_call"),id:G.string()}),G.object({type:G.literal("image_generation_call"),id:G.string()}),G.object({type:G.literal("code_interpreter_call"),id:G.string(),container_id:G.string(),code:G.string().nullable(),outputs:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("logs"),logs:G.string()}),G.object({type:G.literal("image"),url:G.string()})])).nullable(),status:G.string()}),G.object({type:G.literal("mcp_call"),id:G.string(),status:G.string(),approval_request_id:G.string().nullish()}),G.object({type:G.literal("mcp_list_tools"),id:G.string()}),G.object({type:G.literal("mcp_approval_request"),id:G.string()}),G.object({type:G.literal("apply_patch_call"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed"]),operation:G.discriminatedUnion("type",[G.object({type:G.literal("create_file"),path:G.string(),diff:G.string()}),G.object({type:G.literal("delete_file"),path:G.string()}),G.object({type:G.literal("update_file"),path:G.string(),diff:G.string()})])}),G.object({type:G.literal("custom_tool_call"),id:G.string(),call_id:G.string(),name:G.string(),input:G.string()}),G.object({type:G.literal("shell_call"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed","incomplete"]),action:G.object({commands:G.array(G.string())})}),G.object({type:G.literal("shell_call_output"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed","incomplete"]),output:G.array(G.object({stdout:G.string(),stderr:G.string(),outcome:G.discriminatedUnion("type",[G.object({type:G.literal("timeout")}),G.object({type:G.literal("exit"),exit_code:G.number()})])}))})])}),G.object({type:G.literal("response.output_item.done"),output_index:G.number(),item:G.discriminatedUnion("type",[G.object({type:G.literal("message"),id:G.string(),phase:G.enum(["commentary","final_answer"]).nullish()}),G.object({type:G.literal("reasoning"),id:G.string(),encrypted_content:G.string().nullish()}),G.object({type:G.literal("function_call"),id:G.string(),call_id:G.string(),name:G.string(),arguments:G.string(),status:G.literal("completed")}),G.object({type:G.literal("custom_tool_call"),id:G.string(),call_id:G.string(),name:G.string(),input:G.string(),status:G.literal("completed")}),G.object({type:G.literal("code_interpreter_call"),id:G.string(),code:G.string().nullable(),container_id:G.string(),outputs:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("logs"),logs:G.string()}),G.object({type:G.literal("image"),url:G.string()})])).nullable()}),G.object({type:G.literal("image_generation_call"),id:G.string(),result:G.string()}),G.object({type:G.literal("web_search_call"),id:G.string(),status:G.string(),action:G.discriminatedUnion("type",[G.object({type:G.literal("search"),query:G.string().nullish(),sources:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("url"),url:G.string()}),G.object({type:G.literal("api"),name:G.string()})])).nullish()}),G.object({type:G.literal("open_page"),url:G.string().nullish()}),G.object({type:G.literal("find_in_page"),url:G.string().nullish(),pattern:G.string().nullish()})]).nullish()}),G.object({type:G.literal("file_search_call"),id:G.string(),queries:G.array(G.string()),results:G.array(G.object({attributes:G.record(G.string(),G.union([G.string(),G.number(),G.boolean()])),file_id:G.string(),filename:G.string(),score:G.number(),text:G.string()})).nullish()}),G.object({type:G.literal("local_shell_call"),id:G.string(),call_id:G.string(),action:G.object({type:G.literal("exec"),command:G.array(G.string()),timeout_ms:G.number().optional(),user:G.string().optional(),working_directory:G.string().optional(),env:G.record(G.string(),G.string()).optional()})}),G.object({type:G.literal("computer_call"),id:G.string(),status:G.literal("completed")}),G.object({type:G.literal("mcp_call"),id:G.string(),status:G.string(),arguments:G.string(),name:G.string(),server_label:G.string(),output:G.string().nullish(),error:G.union([G.string(),G.object({type:G.string().optional(),code:G.union([G.number(),G.string()]).optional(),message:G.string().optional()}).loose()]).nullish(),approval_request_id:G.string().nullish()}),G.object({type:G.literal("mcp_list_tools"),id:G.string(),server_label:G.string(),tools:G.array(G.object({name:G.string(),description:G.string().optional(),input_schema:G.any(),annotations:G.record(G.string(),G.unknown()).optional()})),error:G.union([G.string(),G.object({type:G.string().optional(),code:G.union([G.number(),G.string()]).optional(),message:G.string().optional()}).loose()]).optional()}),G.object({type:G.literal("mcp_approval_request"),id:G.string(),server_label:G.string(),name:G.string(),arguments:G.string(),approval_request_id:G.string().optional()}),G.object({type:G.literal("apply_patch_call"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed"]),operation:G.discriminatedUnion("type",[G.object({type:G.literal("create_file"),path:G.string(),diff:G.string()}),G.object({type:G.literal("delete_file"),path:G.string()}),G.object({type:G.literal("update_file"),path:G.string(),diff:G.string()})])}),G.object({type:G.literal("shell_call"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed","incomplete"]),action:G.object({commands:G.array(G.string())})}),G.object({type:G.literal("shell_call_output"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed","incomplete"]),output:G.array(G.object({stdout:G.string(),stderr:G.string(),outcome:G.discriminatedUnion("type",[G.object({type:G.literal("timeout")}),G.object({type:G.literal("exit"),exit_code:G.number()})])}))})])}),G.object({type:G.literal("response.function_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.image_generation_call.partial_image"),item_id:G.string(),output_index:G.number(),partial_image_b64:G.string()}),G.object({type:G.literal("response.code_interpreter_call_code.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.code_interpreter_call_code.done"),item_id:G.string(),output_index:G.number(),code:G.string()}),G.object({type:G.literal("response.output_text.annotation.added"),annotation:G.discriminatedUnion("type",[G.object({type:G.literal("url_citation"),start_index:G.number(),end_index:G.number(),url:G.string(),title:G.string()}),G.object({type:G.literal("file_citation"),file_id:G.string(),filename:G.string(),index:G.number()}),G.object({type:G.literal("container_file_citation"),container_id:G.string(),file_id:G.string(),filename:G.string(),start_index:G.number(),end_index:G.number()}),G.object({type:G.literal("file_path"),file_id:G.string(),index:G.number()})])}),G.object({type:G.literal("response.reasoning_summary_part.added"),item_id:G.string(),summary_index:G.number()}),G.object({type:G.literal("response.reasoning_summary_text.delta"),item_id:G.string(),summary_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_summary_part.done"),item_id:G.string(),summary_index:G.number()}),G.object({type:G.literal("response.apply_patch_call_operation_diff.delta"),item_id:G.string(),output_index:G.number(),delta:G.string(),obfuscation:G.string().nullish()}),G.object({type:G.literal("response.apply_patch_call_operation_diff.done"),item_id:G.string(),output_index:G.number(),diff:G.string()}),G.object({type:G.literal("error"),sequence_number:G.number(),error:G.object({type:G.string(),code:G.string(),message:G.string(),param:G.string().nullish()})}),G.object({type:G.string()}).loose().transform(($)=>({type:"unknown_chunk",message:$.type}))]))),TU$=p(()=>u(G.object({id:G.string().optional(),created_at:G.number().optional(),error:G.object({message:G.string(),type:G.string(),param:G.string().nullish(),code:G.string()}).nullish(),model:G.string().optional(),output:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("message"),role:G.literal("assistant"),id:G.string(),phase:G.enum(["commentary","final_answer"]).nullish(),content:G.array(G.object({type:G.literal("output_text"),text:G.string(),logprobs:G.array(G.object({token:G.string(),logprob:G.number(),top_logprobs:G.array(G.object({token:G.string(),logprob:G.number()}))})).nullish(),annotations:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("url_citation"),start_index:G.number(),end_index:G.number(),url:G.string(),title:G.string()}),G.object({type:G.literal("file_citation"),file_id:G.string(),filename:G.string(),index:G.number()}),G.object({type:G.literal("container_file_citation"),container_id:G.string(),file_id:G.string(),filename:G.string(),start_index:G.number(),end_index:G.number()}),G.object({type:G.literal("file_path"),file_id:G.string(),index:G.number()})]))}))}),G.object({type:G.literal("web_search_call"),id:G.string(),status:G.string(),action:G.discriminatedUnion("type",[G.object({type:G.literal("search"),query:G.string().nullish(),sources:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("url"),url:G.string()}),G.object({type:G.literal("api"),name:G.string()})])).nullish()}),G.object({type:G.literal("open_page"),url:G.string().nullish()}),G.object({type:G.literal("find_in_page"),url:G.string().nullish(),pattern:G.string().nullish()})]).nullish()}),G.object({type:G.literal("file_search_call"),id:G.string(),queries:G.array(G.string()),results:G.array(G.object({attributes:G.record(G.string(),G.union([G.string(),G.number(),G.boolean()])),file_id:G.string(),filename:G.string(),score:G.number(),text:G.string()})).nullish()}),G.object({type:G.literal("code_interpreter_call"),id:G.string(),code:G.string().nullable(),container_id:G.string(),outputs:G.array(G.discriminatedUnion("type",[G.object({type:G.literal("logs"),logs:G.string()}),G.object({type:G.literal("image"),url:G.string()})])).nullable()}),G.object({type:G.literal("image_generation_call"),id:G.string(),result:G.string()}),G.object({type:G.literal("local_shell_call"),id:G.string(),call_id:G.string(),action:G.object({type:G.literal("exec"),command:G.array(G.string()),timeout_ms:G.number().optional(),user:G.string().optional(),working_directory:G.string().optional(),env:G.record(G.string(),G.string()).optional()})}),G.object({type:G.literal("function_call"),call_id:G.string(),name:G.string(),arguments:G.string(),id:G.string()}),G.object({type:G.literal("custom_tool_call"),call_id:G.string(),name:G.string(),input:G.string(),id:G.string()}),G.object({type:G.literal("computer_call"),id:G.string(),status:G.string().optional()}),G.object({type:G.literal("reasoning"),id:G.string(),encrypted_content:G.string().nullish(),summary:G.array(G.object({type:G.literal("summary_text"),text:G.string()}))}),G.object({type:G.literal("mcp_call"),id:G.string(),status:G.string(),arguments:G.string(),name:G.string(),server_label:G.string(),output:G.string().nullish(),error:G.union([G.string(),G.object({type:G.string().optional(),code:G.union([G.number(),G.string()]).optional(),message:G.string().optional()}).loose()]).nullish(),approval_request_id:G.string().nullish()}),G.object({type:G.literal("mcp_list_tools"),id:G.string(),server_label:G.string(),tools:G.array(G.object({name:G.string(),description:G.string().optional(),input_schema:G.any(),annotations:G.record(G.string(),G.unknown()).optional()})),error:G.union([G.string(),G.object({type:G.string().optional(),code:G.union([G.number(),G.string()]).optional(),message:G.string().optional()}).loose()]).optional()}),G.object({type:G.literal("mcp_approval_request"),id:G.string(),server_label:G.string(),name:G.string(),arguments:G.string(),approval_request_id:G.string().optional()}),G.object({type:G.literal("apply_patch_call"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed"]),operation:G.discriminatedUnion("type",[G.object({type:G.literal("create_file"),path:G.string(),diff:G.string()}),G.object({type:G.literal("delete_file"),path:G.string()}),G.object({type:G.literal("update_file"),path:G.string(),diff:G.string()})])}),G.object({type:G.literal("shell_call"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed","incomplete"]),action:G.object({commands:G.array(G.string())})}),G.object({type:G.literal("shell_call_output"),id:G.string(),call_id:G.string(),status:G.enum(["in_progress","completed","incomplete"]),output:G.array(G.object({stdout:G.string(),stderr:G.string(),outcome:G.discriminatedUnion("type",[G.object({type:G.literal("timeout")}),G.object({type:G.literal("exit"),exit_code:G.number()})])}))})])).optional(),service_tier:G.string().nullish(),incomplete_details:G.object({reason:G.string()}).nullish(),usage:G.object({input_tokens:G.number(),input_tokens_details:G.object({cached_tokens:G.number().nullish()}).nullish(),output_tokens:G.number(),output_tokens_details:G.object({reasoning_tokens:G.number().nullish()}).nullish()}).optional()}))),CU$=["o1","o1-2024-12-17","o3","o3-2025-04-16","o3-mini","o3-mini-2025-01-31","o4-mini","o4-mini-2025-04-16","gpt-5","gpt-5-2025-08-07","gpt-5-codex","gpt-5-mini","gpt-5-mini-2025-08-07","gpt-5-nano","gpt-5-nano-2025-08-07","gpt-5-pro","gpt-5-pro-2025-10-06","gpt-5.1","gpt-5.1-chat-latest","gpt-5.1-codex-mini","gpt-5.1-codex","gpt-5.1-codex-max","gpt-5.2","gpt-5.2-chat-latest","gpt-5.2-pro","gpt-5.2-codex","gpt-5.3-codex"],Ul$=["gpt-4.1","gpt-4.1-2025-04-14","gpt-4.1-mini","gpt-4.1-mini-2025-04-14","gpt-4.1-nano","gpt-4.1-nano-2025-04-14","gpt-4o","gpt-4o-2024-05-13","gpt-4o-2024-08-06","gpt-4o-2024-11-20","gpt-4o-audio-preview","gpt-4o-audio-preview-2024-12-17","gpt-4o-search-preview","gpt-4o-search-preview-2025-03-11","gpt-4o-mini-search-preview","gpt-4o-mini-search-preview-2025-03-11","gpt-4o-mini","gpt-4o-mini-2024-07-18","gpt-3.5-turbo-0125","gpt-3.5-turbo","gpt-3.5-turbo-1106","gpt-5-chat-latest",...CU$],zg=p(()=>u(G.object({conversation:G.string().nullish(),include:G.array(G.enum(["reasoning.encrypted_content","file_search_call.results","message.output_text.logprobs"])).nullish(),instructions:G.string().nullish(),logprobs:G.union([G.boolean(),G.number().min(1).max(Tg)]).optional(),maxToolCalls:G.number().nullish(),metadata:G.any().nullish(),parallelToolCalls:G.boolean().nullish(),previousResponseId:G.string().nullish(),promptCacheKey:G.string().nullish(),promptCacheRetention:G.enum(["in_memory","24h"]).nullish(),reasoningEffort:G.string().nullish(),reasoningSummary:G.string().nullish(),safetyIdentifier:G.string().nullish(),serviceTier:G.enum(["auto","flex","priority","default"]).nullish(),store:G.boolean().nullish(),strictJsonSchema:G.boolean().nullish(),textVerbosity:G.enum(["low","medium","high"]).nullish(),truncation:G.enum(["auto","disabled"]).nullish(),user:G.string().nullish(),systemMessageMode:G.enum(["system","developer","remove"]).optional(),forceReasoning:G.boolean().optional()})));nU$=p(()=>u(G.object({instructions:G.string().nullish(),speed:G.number().min(0.25).max(4).default(1).nullish()}))),aU$=p(()=>u(G.object({text:G.string(),language:G.string().nullish(),duration:G.number().nullish(),words:G.array(G.object({word:G.string(),start:G.number(),end:G.number()})).nullish(),segments:G.array(G.object({id:G.number(),seek:G.number(),start:G.number(),end:G.number(),text:G.string(),tokens:G.array(G.number()),temperature:G.number(),avg_logprob:G.number(),compression_ratio:G.number(),no_speech_prob:G.number()})).nullish()}))),sU$=p(()=>u(G.object({include:G.array(G.string()).optional(),language:G.string().optional(),prompt:G.string().optional(),temperature:G.number().min(0).max(1).default(0).optional(),timestampGranularities:G.array(G.enum(["word","segment"])).default(["segment"]).optional()}))),Bg={afrikaans:"af",arabic:"ar",armenian:"hy",azerbaijani:"az",belarusian:"be",bosnian:"bs",bulgarian:"bg",catalan:"ca",chinese:"zh",croatian:"hr",czech:"cs",danish:"da",dutch:"nl",english:"en",estonian:"et",finnish:"fi",french:"fr",galician:"gl",german:"de",greek:"el",hebrew:"he",hindi:"hi",hungarian:"hu",icelandic:"is",indonesian:"id",italian:"it",japanese:"ja",kannada:"kn",kazakh:"kk",korean:"ko",latvian:"lv",lithuanian:"lt",macedonian:"mk",malay:"ms",marathi:"mr",maori:"mi",nepali:"ne",norwegian:"no",persian:"fa",polish:"pl",portuguese:"pt",romanian:"ro",russian:"ru",serbian:"sr",slovak:"sk",slovenian:"sl",spanish:"es",swahili:"sw",swedish:"sv",tagalog:"tl",tamil:"ta",thai:"th",turkish:"tr",ukrainian:"uk",urdu:"ur",vietnamese:"vi",welsh:"cy"};zl$=lX()});function Cg($){var X,Y,W,J;if($==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let U=(X=$.promptTokenCount)!=null?X:0,H=(Y=$.candidatesTokenCount)!=null?Y:0,D=(W=$.cachedContentTokenCount)!=null?W:0,V=(J=$.thoughtsTokenCount)!=null?J:0;return{inputTokens:{total:U,noCache:U-D,cacheRead:D,cacheWrite:void 0},outputTokens:{total:H+V,text:H,reasoning:V},raw:$}}function d0($,X=!0){if($==null)return;if(GG$($)){if(X)return;if(typeof $==="object"&&$.description)return{type:"object",description:$.description};return{type:"object"}}if(typeof $==="boolean")return{type:"boolean",properties:{}};let{type:Y,description:W,required:J,properties:U,items:H,allOf:D,anyOf:V,oneOf:K,format:Q,const:q,minLength:F,enum:w}=$,z={};if(W)z.description=W;if(J)z.required=J;if(Q)z.format=Q;if(q!==void 0)z.enum=[q];if(Y)if(Array.isArray(Y)){let O=Y.includes("null"),N=Y.filter((L)=>L!=="null");if(N.length===0)z.type="null";else if(z.anyOf=N.map((L)=>({type:L})),O)z.nullable=!0}else z.type=Y;if(w!==void 0)z.enum=w;if(U!=null)z.properties=Object.entries(U).reduce((O,[N,L])=>{return O[N]=d0(L,!1),O},{});if(H)z.items=Array.isArray(H)?H.map((O)=>d0(O,!1)):d0(H,!1);if(D)z.allOf=D.map((O)=>d0(O,!1));if(V)if(V.some((O)=>typeof O==="object"&&(O==null?void 0:O.type)==="null")){let O=V.filter((N)=>!(typeof N==="object"&&(N==null?void 0:N.type)==="null"));if(O.length===1){let N=d0(O[0],!1);if(typeof N==="object")z.nullable=!0,Object.assign(z,N)}else z.anyOf=O.map((N)=>d0(N,!1)),z.nullable=!0}else z.anyOf=V.map((O)=>d0(O,!1));if(K)z.oneOf=K.map((O)=>d0(O,!1));if(F!==void 0)z.minLength=F;return z}function GG$($){return $!=null&&typeof $==="object"&&$.type==="object"&&($.properties==null||Object.keys($.properties).length===0)&&!$.additionalProperties}function HG$($,X){var Y,W,J;let U=[],H=[],D=!0,V=(Y=X==null?void 0:X.isGemmaModel)!=null?Y:!1,K=(W=X==null?void 0:X.providerOptionsName)!=null?W:"google";for(let{role:Q,content:q}of $)switch(Q){case"system":{if(!D)throw new L6({functionality:"system messages are only supported at the beginning of the conversation"});U.push({text:q});break}case"user":{D=!1;let F=[];for(let w of q)switch(w.type){case"text":{F.push({text:w.text});break}case"file":{let z=w.mediaType==="image/*"?"image/jpeg":w.mediaType;F.push(w.data instanceof URL?{fileData:{mimeType:z,fileUri:w.data.toString()}}:{inlineData:{mimeType:z,data:c4(w.data)}});break}}H.push({role:"user",parts:F});break}case"assistant":{D=!1,H.push({role:"model",parts:q.map((F)=>{var w,z,O,N;let L=(N=(w=F.providerOptions)==null?void 0:w[K])!=null?N:K!=="google"?(z=F.providerOptions)==null?void 0:z.google:(O=F.providerOptions)==null?void 0:O.vertex,P=(L==null?void 0:L.thoughtSignature)!=null?String(L.thoughtSignature):void 0;switch(F.type){case"text":return F.text.length===0?void 0:{text:F.text,thoughtSignature:P};case"reasoning":return F.text.length===0?void 0:{text:F.text,thought:!0,thoughtSignature:P};case"file":{if(F.data instanceof URL)throw new L6({functionality:"File data URLs in assistant messages are not supported"});return{inlineData:{mimeType:F.mediaType,data:c4(F.data)},thoughtSignature:P}}case"tool-call":return{functionCall:{name:F.toolName,args:F.input},thoughtSignature:P}}}).filter((F)=>F!==void 0)});break}case"tool":{D=!1;let F=[];for(let w of q){if(w.type==="tool-approval-response")continue;let z=w.output;if(z.type==="content")for(let O of z.value)switch(O.type){case"text":F.push({functionResponse:{name:w.toolName,response:{name:w.toolName,content:O.text}}});break;case"image-data":F.push({inlineData:{mimeType:O.mediaType,data:O.data}},{text:"Tool executed successfully and returned this image as a response"});break;default:F.push({text:JSON.stringify(O)});break}else F.push({functionResponse:{name:w.toolName,response:{name:w.toolName,content:z.type==="execution-denied"?(J=z.reason)!=null?J:"Tool execution denied.":z.value}}})}H.push({role:"user",parts:F});break}}if(V&&U.length>0&&H.length>0&&H[0].role==="user"){let Q=U.map((q)=>q.text).join(`
301
-
302
- `);H[0].parts.unshift({text:Q+`
303
-
304
- `})}return{systemInstruction:U.length>0&&!V?{parts:U}:void 0,contents:H}}function Sg($){return $.includes("/")?$:`models/${$}`}function DG$({tools:$,toolChoice:X,modelId:Y}){var W;$=($==null?void 0:$.length)?$:void 0;let J=[],U=["gemini-flash-latest","gemini-flash-lite-latest","gemini-pro-latest"].some((F)=>F===Y),H=Y.includes("gemini-2")||Y.includes("gemini-3")||Y.includes("nano-banana")||U,D=Y.includes("gemini-2.5")||Y.includes("gemini-3");if($==null)return{tools:void 0,toolConfig:void 0,toolWarnings:J};let V=$.some((F)=>F.type==="function"),K=$.some((F)=>F.type==="provider");if(V&&K)J.push({type:"unsupported",feature:"combination of function and provider-defined tools"});if(K){let F=[];return $.filter((z)=>z.type==="provider").forEach((z)=>{switch(z.id){case"google.google_search":if(H)F.push({googleSearch:{...z.args}});else J.push({type:"unsupported",feature:`provider-defined tool ${z.id}`,details:"Google Search requires Gemini 2.0 or newer."});break;case"google.enterprise_web_search":if(H)F.push({enterpriseWebSearch:{}});else J.push({type:"unsupported",feature:`provider-defined tool ${z.id}`,details:"Enterprise Web Search requires Gemini 2.0 or newer."});break;case"google.url_context":if(H)F.push({urlContext:{}});else J.push({type:"unsupported",feature:`provider-defined tool ${z.id}`,details:"The URL context tool is not supported with other Gemini models than Gemini 2."});break;case"google.code_execution":if(H)F.push({codeExecution:{}});else J.push({type:"unsupported",feature:`provider-defined tool ${z.id}`,details:"The code execution tools is not supported with other Gemini models than Gemini 2."});break;case"google.file_search":if(D)F.push({fileSearch:{...z.args}});else J.push({type:"unsupported",feature:`provider-defined tool ${z.id}`,details:"The file search tool is only supported with Gemini 2.5 models and Gemini 3 models."});break;case"google.vertex_rag_store":if(H)F.push({retrieval:{vertex_rag_store:{rag_resources:{rag_corpus:z.args.ragCorpus},similarity_top_k:z.args.topK}}});else J.push({type:"unsupported",feature:`provider-defined tool ${z.id}`,details:"The RAG store tool is not supported with other Gemini models than Gemini 2."});break;case"google.google_maps":if(H)F.push({googleMaps:{}});else J.push({type:"unsupported",feature:`provider-defined tool ${z.id}`,details:"The Google Maps grounding tool is not supported with Gemini models other than Gemini 2 or newer."});break;default:J.push({type:"unsupported",feature:`provider-defined tool ${z.id}`});break}}),{tools:F.length>0?F:void 0,toolConfig:void 0,toolWarnings:J}}let Q=[];for(let F of $)switch(F.type){case"function":Q.push({name:F.name,description:(W=F.description)!=null?W:"",parameters:d0(F.inputSchema)});break;default:J.push({type:"unsupported",feature:`function tool ${F.name}`});break}if(X==null)return{tools:[{functionDeclarations:Q}],toolConfig:void 0,toolWarnings:J};let q=X.type;switch(q){case"auto":return{tools:[{functionDeclarations:Q}],toolConfig:{functionCallingConfig:{mode:"AUTO"}},toolWarnings:J};case"none":return{tools:[{functionDeclarations:Q}],toolConfig:{functionCallingConfig:{mode:"NONE"}},toolWarnings:J};case"required":return{tools:[{functionDeclarations:Q}],toolConfig:{functionCallingConfig:{mode:"ANY"}},toolWarnings:J};case"tool":return{tools:[{functionDeclarations:Q}],toolConfig:{functionCallingConfig:{mode:"ANY",allowedFunctionNames:[X.toolName]}},toolWarnings:J};default:throw new L6({functionality:`tool choice type: ${q}`})}}function xg({finishReason:$,hasToolCalls:X}){switch($){case"STOP":return X?"tool-calls":"stop";case"MAX_TOKENS":return"length";case"IMAGE_SAFETY":case"RECITATION":case"SAFETY":case"BLOCKLIST":case"PROHIBITED_CONTENT":case"SPII":return"content-filter";case"MALFORMED_FUNCTION_CALL":return"error";case"FINISH_REASON_UNSPECIFIED":case"OTHER":default:return"other"}}function VG$({parts:$,generateId:X,providerOptionsName:Y}){let W=$==null?void 0:$.filter((J)=>("functionCall"in J));return W==null||W.length===0?void 0:W.map((J)=>({type:"tool-call",toolCallId:X(),toolName:J.functionCall.name,args:JSON.stringify(J.functionCall.args),providerMetadata:J.thoughtSignature?{[Y]:{thoughtSignature:J.thoughtSignature}}:void 0}))}function kg({groundingMetadata:$,generateId:X}){var Y,W,J,U,H,D;if(!($==null?void 0:$.groundingChunks))return;let V=[];for(let K of $.groundingChunks)if(K.web!=null)V.push({type:"source",sourceType:"url",id:X(),url:K.web.uri,title:(Y=K.web.title)!=null?Y:void 0});else if(K.image!=null)V.push({type:"source",sourceType:"url",id:X(),url:K.image.sourceUri,title:(W=K.image.title)!=null?W:void 0});else if(K.retrievedContext!=null){let Q=K.retrievedContext.uri,q=K.retrievedContext.fileSearchStore;if(Q&&(Q.startsWith("http://")||Q.startsWith("https://")))V.push({type:"source",sourceType:"url",id:X(),url:Q,title:(J=K.retrievedContext.title)!=null?J:void 0});else if(Q){let F=(U=K.retrievedContext.title)!=null?U:"Unknown Document",w="application/octet-stream",z=void 0;if(Q.endsWith(".pdf"))w="application/pdf",z=Q.split("/").pop();else if(Q.endsWith(".txt"))w="text/plain",z=Q.split("/").pop();else if(Q.endsWith(".docx"))w="application/vnd.openxmlformats-officedocument.wordprocessingml.document",z=Q.split("/").pop();else if(Q.endsWith(".doc"))w="application/msword",z=Q.split("/").pop();else if(Q.match(/\.(md|markdown)$/))w="text/markdown",z=Q.split("/").pop();else z=Q.split("/").pop();V.push({type:"source",sourceType:"document",id:X(),mediaType:w,title:F,filename:z})}else if(q){let F=(H=K.retrievedContext.title)!=null?H:"Unknown Document";V.push({type:"source",sourceType:"document",id:X(),mediaType:"application/octet-stream",title:F,filename:q.split("/").pop()})}}else if(K.maps!=null){if(K.maps.uri)V.push({type:"source",sourceType:"url",id:X(),url:K.maps.uri,title:(D=K.maps.title)!=null?D:void 0})}return V.length>0?V:void 0}function vg($){return $.startsWith("gemini-")}function rG($={}){var X,Y;let W=(X=X9($.baseURL))!=null?X:"https://generativelanguage.googleapis.com/v1beta",J=(Y=$.name)!=null?Y:"google.generative-ai",U=()=>$4({"x-goog-api-key":xX({apiKey:$.apiKey,environmentVariableName:"GOOGLE_GENERATIVE_AI_API_KEY",description:"Google Generative AI"}),...$.headers},`ai-sdk/google/${$G$}`),H=(q)=>{var F;return new yg(q,{provider:J,baseURL:W,headers:U,generateId:(F=$.generateId)!=null?F:x6,supportedUrls:()=>({"*":[new RegExp(`^${W}/files/.*$`),new RegExp("^https://(?:www\\.)?youtube\\.com/watch\\?v=[\\w-]+(?:&[\\w=&.-]*)?$"),new RegExp("^https://youtu\\.be/[\\w-]+(?:\\?[\\w=&.-]*)?$")]}),fetch:$.fetch})},D=(q)=>new JG$(q,{provider:J,baseURL:W,headers:U,fetch:$.fetch}),V=(q,F={})=>new LG$(q,F,{provider:J,baseURL:W,headers:U,fetch:$.fetch}),K=(q)=>{var F;return new IG$(q,{provider:J,baseURL:W,headers:U,fetch:$.fetch,generateId:(F=$.generateId)!=null?F:x6})},Q=function(q){if(new.target)throw Error("The Google Generative AI model function cannot be called with the new keyword.");return H(q)};return Q.specificationVersion="v3",Q.languageModel=H,Q.chat=H,Q.generativeAI=H,Q.embedding=D,Q.embeddingModel=D,Q.textEmbedding=D,Q.textEmbeddingModel=D,Q.image=V,Q.imageModel=V,Q.video=K,Q.videoModel=K,Q.tools=RG$,Q}var $G$="3.0.43",XG$,W5,YG$,JG$=class{constructor($,X){this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=$,this.config=X}get provider(){return this.config.provider}async doEmbed({values:$,headers:X,abortSignal:Y,providerOptions:W}){let J=await E6({provider:"google",providerOptions:W,schema:YG$});if($.length>this.maxEmbeddingsPerCall)throw new FU({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:$});let U=V6(await B6(this.config.headers),X);if($.length===1){let{responseHeaders:K,value:Q,rawValue:q}=await q6({url:`${this.config.baseURL}/models/${this.modelId}:embedContent`,headers:U,body:{model:`models/${this.modelId}`,content:{parts:[{text:$[0]}]},outputDimensionality:J==null?void 0:J.outputDimensionality,taskType:J==null?void 0:J.taskType},failedResponseHandler:W5,successfulResponseHandler:M6(UG$),abortSignal:Y,fetch:this.config.fetch});return{warnings:[],embeddings:[Q.embedding.values],usage:void 0,response:{headers:K,body:q}}}let{responseHeaders:H,value:D,rawValue:V}=await q6({url:`${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,headers:U,body:{requests:$.map((K)=>({model:`models/${this.modelId}`,content:{role:"user",parts:[{text:K}]},outputDimensionality:J==null?void 0:J.outputDimensionality,taskType:J==null?void 0:J.taskType}))},failedResponseHandler:W5,successfulResponseHandler:M6(WG$),abortSignal:Y,fetch:this.config.fetch});return{warnings:[],embeddings:D.embeddings.map((K)=>K.values),usage:void 0,response:{headers:H,body:V}}}},WG$,UG$,bg,yg=class{constructor($,X){this.specificationVersion="v3";var Y;this.modelId=$,this.config=X,this.generateId=(Y=X.generateId)!=null?Y:x6}get provider(){return this.config.provider}get supportedUrls(){var $,X,Y;return(Y=(X=($=this.config).supportedUrls)==null?void 0:X.call($))!=null?Y:{}}async getArgs({prompt:$,maxOutputTokens:X,temperature:Y,topP:W,topK:J,frequencyPenalty:U,presencePenalty:H,stopSequences:D,responseFormat:V,seed:K,tools:Q,toolChoice:q,providerOptions:F}){var w;let z=[],O=this.config.provider.includes("vertex")?"vertex":"google",N=await E6({provider:O,providerOptions:F,schema:bg});if(N==null&&O!=="google")N=await E6({provider:"google",providerOptions:F,schema:bg});if((Q==null?void 0:Q.some((b)=>b.type==="provider"&&b.id==="google.vertex_rag_store"))&&!this.config.provider.startsWith("google.vertex."))z.push({type:"other",message:`The 'vertex_rag_store' tool is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`});let L=this.modelId.toLowerCase().startsWith("gemma-"),{contents:P,systemInstruction:j}=HG$($,{isGemmaModel:L,providerOptionsName:O}),{tools:v,toolConfig:y,toolWarnings:E}=DG$({tools:Q,toolChoice:q,modelId:this.modelId});return{args:{generationConfig:{maxOutputTokens:X,temperature:Y,topK:J,topP:W,frequencyPenalty:U,presencePenalty:H,stopSequences:D,seed:K,responseMimeType:(V==null?void 0:V.type)==="json"?"application/json":void 0,responseSchema:(V==null?void 0:V.type)==="json"&&V.schema!=null&&((w=N==null?void 0:N.structuredOutputs)!=null?w:!0)?d0(V.schema):void 0,...(N==null?void 0:N.audioTimestamp)&&{audioTimestamp:N.audioTimestamp},responseModalities:N==null?void 0:N.responseModalities,thinkingConfig:N==null?void 0:N.thinkingConfig,...(N==null?void 0:N.mediaResolution)&&{mediaResolution:N.mediaResolution},...(N==null?void 0:N.imageConfig)&&{imageConfig:N.imageConfig}},contents:P,systemInstruction:L?void 0:j,safetySettings:N==null?void 0:N.safetySettings,tools:v,toolConfig:(N==null?void 0:N.retrievalConfig)?{...y,retrievalConfig:N.retrievalConfig}:y,cachedContent:N==null?void 0:N.cachedContent,labels:N==null?void 0:N.labels},warnings:[...z,...E],providerOptionsName:O}}async doGenerate($){var X,Y,W,J,U,H,D,V,K,Q;let{args:q,warnings:F,providerOptionsName:w}=await this.getArgs($),z=V6(await B6(this.config.headers),$.headers),{responseHeaders:O,value:N,rawValue:L}=await q6({url:`${this.config.baseURL}/${Sg(this.modelId)}:generateContent`,headers:z,body:q,failedResponseHandler:W5,successfulResponseHandler:M6(KG$),abortSignal:$.abortSignal,fetch:this.config.fetch}),P=N.candidates[0],j=[],v=(Y=(X=P.content)==null?void 0:X.parts)!=null?Y:[],y=N.usageMetadata,E;for(let R of v)if("executableCode"in R&&((W=R.executableCode)==null?void 0:W.code)){let I=this.config.generateId();E=I,j.push({type:"tool-call",toolCallId:I,toolName:"code_execution",input:JSON.stringify(R.executableCode),providerExecuted:!0})}else if("codeExecutionResult"in R&&R.codeExecutionResult)j.push({type:"tool-result",toolCallId:E,toolName:"code_execution",result:{outcome:R.codeExecutionResult.outcome,output:(J=R.codeExecutionResult.output)!=null?J:""}}),E=void 0;else if("text"in R&&R.text!=null){let I=R.thoughtSignature?{[w]:{thoughtSignature:R.thoughtSignature}}:void 0;if(R.text.length===0){if(I!=null&&j.length>0){let d=j[j.length-1];d.providerMetadata=I}}else j.push({type:R.thought===!0?"reasoning":"text",text:R.text,providerMetadata:I})}else if("functionCall"in R)j.push({type:"tool-call",toolCallId:this.config.generateId(),toolName:R.functionCall.name,input:JSON.stringify(R.functionCall.args),providerMetadata:R.thoughtSignature?{[w]:{thoughtSignature:R.thoughtSignature}}:void 0});else if("inlineData"in R)j.push({type:"file",data:R.inlineData.data,mediaType:R.inlineData.mimeType,providerMetadata:R.thoughtSignature?{[w]:{thoughtSignature:R.thoughtSignature}}:void 0});let b=(U=kg({groundingMetadata:P.groundingMetadata,generateId:this.config.generateId}))!=null?U:[];for(let R of b)j.push(R);return{content:j,finishReason:{unified:xg({finishReason:P.finishReason,hasToolCalls:j.some((R)=>R.type==="tool-call"&&!R.providerExecuted)}),raw:(H=P.finishReason)!=null?H:void 0},usage:Cg(y),warnings:F,providerMetadata:{[w]:{promptFeedback:(D=N.promptFeedback)!=null?D:null,groundingMetadata:(V=P.groundingMetadata)!=null?V:null,urlContextMetadata:(K=P.urlContextMetadata)!=null?K:null,safetyRatings:(Q=P.safetyRatings)!=null?Q:null,usageMetadata:y!=null?y:null}},request:{body:q},response:{headers:O,body:L}}}async doStream($){let{args:X,warnings:Y,providerOptionsName:W}=await this.getArgs($),J=V6(await B6(this.config.headers),$.headers),{responseHeaders:U,value:H}=await q6({url:`${this.config.baseURL}/${Sg(this.modelId)}:streamGenerateContent?alt=sse`,headers:J,body:X,failedResponseHandler:W5,successfulResponseHandler:c1(QG$),abortSignal:$.abortSignal,fetch:this.config.fetch}),D={unified:"other",raw:void 0},V=void 0,K=void 0,Q=this.config.generateId,q=!1,F=null,w=null,z=0,O=new Set,N;return{stream:H.pipeThrough(new TransformStream({start(L){L.enqueue({type:"stream-start",warnings:Y})},transform(L,P){var j,v,y,E,b,R,I,d;if($.includeRawChunks)P.enqueue({type:"raw",rawValue:L.rawValue});if(!L.success){P.enqueue({type:"error",error:L.error});return}let k=L.value,t=k.usageMetadata;if(t!=null)V=t;let h=(j=k.candidates)==null?void 0:j[0];if(h==null)return;let f=h.content,l=kg({groundingMetadata:h.groundingMetadata,generateId:Q});if(l!=null){for(let o of l)if(o.sourceType==="url"&&!O.has(o.url))O.add(o.url),P.enqueue(o)}if(f!=null){let o=(v=f.parts)!=null?v:[];for(let a of o)if("executableCode"in a&&((y=a.executableCode)==null?void 0:y.code)){let Y$=Q();N=Y$,P.enqueue({type:"tool-call",toolCallId:Y$,toolName:"code_execution",input:JSON.stringify(a.executableCode),providerExecuted:!0})}else if("codeExecutionResult"in a&&a.codeExecutionResult){let Y$=N;if(Y$)P.enqueue({type:"tool-result",toolCallId:Y$,toolName:"code_execution",result:{outcome:a.codeExecutionResult.outcome,output:(E=a.codeExecutionResult.output)!=null?E:""}}),N=void 0}else if("text"in a&&a.text!=null){let Y$=a.thoughtSignature?{[W]:{thoughtSignature:a.thoughtSignature}}:void 0;if(a.text.length===0){if(Y$!=null&&F!==null)P.enqueue({type:"text-delta",id:F,delta:"",providerMetadata:Y$})}else if(a.thought===!0){if(F!==null)P.enqueue({type:"text-end",id:F}),F=null;if(w===null)w=String(z++),P.enqueue({type:"reasoning-start",id:w,providerMetadata:Y$});P.enqueue({type:"reasoning-delta",id:w,delta:a.text,providerMetadata:Y$})}else{if(w!==null)P.enqueue({type:"reasoning-end",id:w}),w=null;if(F===null)F=String(z++),P.enqueue({type:"text-start",id:F,providerMetadata:Y$});P.enqueue({type:"text-delta",id:F,delta:a.text,providerMetadata:Y$})}}else if("inlineData"in a){if(F!==null)P.enqueue({type:"text-end",id:F}),F=null;if(w!==null)P.enqueue({type:"reasoning-end",id:w}),w=null;let Y$=a.thoughtSignature?{[W]:{thoughtSignature:a.thoughtSignature}}:void 0;P.enqueue({type:"file",mediaType:a.inlineData.mimeType,data:a.inlineData.data,providerMetadata:Y$})}let g=VG$({parts:f.parts,generateId:Q,providerOptionsName:W});if(g!=null)for(let a of g)P.enqueue({type:"tool-input-start",id:a.toolCallId,toolName:a.toolName,providerMetadata:a.providerMetadata}),P.enqueue({type:"tool-input-delta",id:a.toolCallId,delta:a.args,providerMetadata:a.providerMetadata}),P.enqueue({type:"tool-input-end",id:a.toolCallId,providerMetadata:a.providerMetadata}),P.enqueue({type:"tool-call",toolCallId:a.toolCallId,toolName:a.toolName,input:a.args,providerMetadata:a.providerMetadata}),q=!0}if(h.finishReason!=null){if(D={unified:xg({finishReason:h.finishReason,hasToolCalls:q}),raw:h.finishReason},K={[W]:{promptFeedback:(b=k.promptFeedback)!=null?b:null,groundingMetadata:(R=h.groundingMetadata)!=null?R:null,urlContextMetadata:(I=h.urlContextMetadata)!=null?I:null,safetyRatings:(d=h.safetyRatings)!=null?d:null}},t!=null)K[W].usageMetadata=t}},flush(L){if(F!==null)L.enqueue({type:"text-end",id:F});if(w!==null)L.enqueue({type:"reasoning-end",id:w});L.enqueue({type:"finish",finishReason:D,usage:Cg(V),providerMetadata:K})}})),response:{headers:U},request:{body:X}}}},fg=()=>G.object({webSearchQueries:G.array(G.string()).nullish(),imageSearchQueries:G.array(G.string()).nullish(),retrievalQueries:G.array(G.string()).nullish(),searchEntryPoint:G.object({renderedContent:G.string()}).nullish(),groundingChunks:G.array(G.object({web:G.object({uri:G.string(),title:G.string().nullish()}).nullish(),image:G.object({sourceUri:G.string(),imageUri:G.string(),title:G.string().nullish(),domain:G.string().nullish()}).nullish(),retrievedContext:G.object({uri:G.string().nullish(),title:G.string().nullish(),text:G.string().nullish(),fileSearchStore:G.string().nullish()}).nullish(),maps:G.object({uri:G.string().nullish(),title:G.string().nullish(),text:G.string().nullish(),placeId:G.string().nullish()}).nullish()})).nullish(),groundingSupports:G.array(G.object({segment:G.object({startIndex:G.number().nullish(),endIndex:G.number().nullish(),text:G.string().nullish()}).nullish(),segment_text:G.string().nullish(),groundingChunkIndices:G.array(G.number()).nullish(),supportChunkIndices:G.array(G.number()).nullish(),confidenceScores:G.array(G.number()).nullish(),confidenceScore:G.array(G.number()).nullish()})).nullish(),retrievalMetadata:G.union([G.object({webDynamicRetrievalScore:G.number()}),G.object({})]).nullish()}),gg=()=>G.object({parts:G.array(G.union([G.object({functionCall:G.object({name:G.string(),args:G.unknown()}),thoughtSignature:G.string().nullish()}),G.object({inlineData:G.object({mimeType:G.string(),data:G.string()}),thoughtSignature:G.string().nullish()}),G.object({executableCode:G.object({language:G.string(),code:G.string()}).nullish(),codeExecutionResult:G.object({outcome:G.string(),output:G.string().nullish()}).nullish(),text:G.string().nullish(),thought:G.boolean().nullish(),thoughtSignature:G.string().nullish()})])).nullish()}),iG=()=>G.object({category:G.string().nullish(),probability:G.string().nullish(),probabilityScore:G.number().nullish(),severity:G.string().nullish(),severityScore:G.number().nullish(),blocked:G.boolean().nullish()}),mg,ug=()=>G.object({urlMetadata:G.array(G.object({retrievedUrl:G.string(),urlRetrievalStatus:G.string()})).nullish()}),KG$,QG$,FG$,qG$,wG$,ZG$,zG$,OG$,NG$,AG$,BG$,MG$,jG$,RG$,LG$=class{constructor($,X,Y){this.modelId=$,this.settings=X,this.config=Y,this.specificationVersion="v3"}get maxImagesPerCall(){if(this.settings.maxImagesPerCall!=null)return this.settings.maxImagesPerCall;if(vg(this.modelId))return 10;return 4}get provider(){return this.config.provider}async doGenerate($){if(vg(this.modelId))return this.doGenerateGemini($);return this.doGenerateImagen($)}async doGenerateImagen($){var X,Y,W;let{prompt:J,n:U=1,size:H,aspectRatio:D="1:1",seed:V,providerOptions:K,headers:Q,abortSignal:q,files:F,mask:w}=$,z=[];if(F!=null&&F.length>0)throw Error("Google Generative AI does not support image editing with Imagen models. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities.");if(w!=null)throw Error("Google Generative AI does not support image editing with masks. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities.");if(H!=null)z.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});if(V!=null)z.push({type:"unsupported",feature:"seed",details:"This model does not support the `seed` option through this provider."});let O=await E6({provider:"google",providerOptions:K,schema:PG$}),N=(W=(Y=(X=this.config._internal)==null?void 0:X.currentDate)==null?void 0:Y.call(X))!=null?W:new Date,L={sampleCount:U};if(D!=null)L.aspectRatio=D;if(O)Object.assign(L,O);let P={instances:[{prompt:J}],parameters:L},{responseHeaders:j,value:v}=await q6({url:`${this.config.baseURL}/models/${this.modelId}:predict`,headers:V6(await B6(this.config.headers),Q),body:P,failedResponseHandler:W5,successfulResponseHandler:M6(EG$),abortSignal:q,fetch:this.config.fetch});return{images:v.predictions.map((y)=>y.bytesBase64Encoded),warnings:z,providerMetadata:{google:{images:v.predictions.map(()=>({}))}},response:{timestamp:N,modelId:this.modelId,headers:j}}}async doGenerateGemini($){var X,Y,W,J,U,H,D,V,K;let{prompt:Q,n:q,size:F,aspectRatio:w,seed:z,providerOptions:O,headers:N,abortSignal:L,files:P,mask:j}=$,v=[];if(j!=null)throw Error("Gemini image models do not support mask-based image editing.");if(q!=null&&q>1)throw Error("Gemini image models do not support generating a set number of images per call. Use n=1 or omit the n parameter.");if(F!=null)v.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});let y=[];if(Q!=null)y.push({type:"text",text:Q});if(P!=null&&P.length>0)for(let k of P)if(k.type==="url")y.push({type:"file",data:new URL(k.url),mediaType:"image/*"});else y.push({type:"file",data:typeof k.data==="string"?k.data:new Uint8Array(k.data),mediaType:k.mediaType});let E=[{role:"user",content:y}],R=await new yg(this.modelId,{provider:this.config.provider,baseURL:this.config.baseURL,headers:(X=this.config.headers)!=null?X:{},fetch:this.config.fetch,generateId:(Y=this.config.generateId)!=null?Y:x6}).doGenerate({prompt:E,seed:z,providerOptions:{google:{responseModalities:["IMAGE"],imageConfig:w?{aspectRatio:w}:void 0,...(W=O==null?void 0:O.google)!=null?W:{}}},headers:N,abortSignal:L}),I=(H=(U=(J=this.config._internal)==null?void 0:J.currentDate)==null?void 0:U.call(J))!=null?H:new Date,d=[];for(let k of R.content)if(k.type==="file"&&k.mediaType.startsWith("image/"))d.push(c4(k.data));return{images:d,warnings:v,providerMetadata:{google:{images:d.map(()=>({}))}},response:{timestamp:I,modelId:this.modelId,headers:(D=R.response)==null?void 0:D.headers},usage:R.usage?{inputTokens:R.usage.inputTokens.total,outputTokens:R.usage.outputTokens.total,totalTokens:((V=R.usage.inputTokens.total)!=null?V:0)+((K=R.usage.outputTokens.total)!=null?K:0)}:void 0}}},EG$,PG$,IG$=class{constructor($,X){this.modelId=$,this.config=X,this.specificationVersion="v3"}get provider(){return this.config.provider}get maxVideosPerCall(){return 4}async doGenerate($){var X,Y,W,J,U,H,D,V;let K=(W=(Y=(X=this.config._internal)==null?void 0:X.currentDate)==null?void 0:Y.call(X))!=null?W:new Date,Q=[],q=await E6({provider:"google",providerOptions:$.providerOptions,schema:_G$}),F=[{}],w=F[0];if($.prompt!=null)w.prompt=$.prompt;if($.image!=null)if($.image.type==="url")Q.push({type:"unsupported",feature:"URL-based image input",details:"Google Generative AI video models require base64-encoded images. URL will be ignored."});else{let k=typeof $.image.data==="string"?$.image.data:p1($.image.data);w.image={inlineData:{mimeType:$.image.mediaType||"image/png",data:k}}}if((q==null?void 0:q.referenceImages)!=null)w.referenceImages=q.referenceImages.map((k)=>{if(k.bytesBase64Encoded)return{inlineData:{mimeType:"image/png",data:k.bytesBase64Encoded}};else if(k.gcsUri)return{gcsUri:k.gcsUri};return k});let z={sampleCount:$.n};if($.aspectRatio)z.aspectRatio=$.aspectRatio;if($.resolution){let k={"1280x720":"720p","1920x1080":"1080p","3840x2160":"4k"};z.resolution=k[$.resolution]||$.resolution}if($.duration)z.durationSeconds=$.duration;if($.seed)z.seed=$.seed;if(q!=null){let k=q;if(k.personGeneration!==void 0&&k.personGeneration!==null)z.personGeneration=k.personGeneration;if(k.negativePrompt!==void 0&&k.negativePrompt!==null)z.negativePrompt=k.negativePrompt;for(let[t,h]of Object.entries(k))if(!["pollIntervalMs","pollTimeoutMs","personGeneration","negativePrompt","referenceImages"].includes(t))z[t]=h}let{value:O}=await q6({url:`${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,headers:V6(await B6(this.config.headers),$.headers),body:{instances:F,parameters:z},successfulResponseHandler:M6(hg),failedResponseHandler:W5,abortSignal:$.abortSignal,fetch:this.config.fetch}),N=O.name;if(!N)throw new A$({name:"GOOGLE_VIDEO_GENERATION_ERROR",message:"No operation name returned from API"});let L=(J=q==null?void 0:q.pollIntervalMs)!=null?J:1e4,P=(U=q==null?void 0:q.pollTimeoutMs)!=null?U:600000,j=Date.now(),v=O,y;while(!v.done){if(Date.now()-j>P)throw new A$({name:"GOOGLE_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${P}ms`});if(await BG(L),(H=$.abortSignal)==null?void 0:H.aborted)throw new A$({name:"GOOGLE_VIDEO_GENERATION_ABORTED",message:"Video generation request was aborted"});let{value:k,responseHeaders:t}=await jJ({url:`${this.config.baseURL}/${N}`,headers:V6(await B6(this.config.headers),$.headers),successfulResponseHandler:M6(hg),failedResponseHandler:W5,abortSignal:$.abortSignal,fetch:this.config.fetch});v=k,y=t}if(v.error)throw new A$({name:"GOOGLE_VIDEO_GENERATION_FAILED",message:`Video generation failed: ${v.error.message}`});let E=v.response;if(!((D=E==null?void 0:E.generateVideoResponse)==null?void 0:D.generatedSamples)||E.generateVideoResponse.generatedSamples.length===0)throw new A$({name:"GOOGLE_VIDEO_GENERATION_ERROR",message:`No videos in response. Response: ${JSON.stringify(v)}`});let b=[],R=[],I=await B6(this.config.headers),d=I==null?void 0:I["x-goog-api-key"];for(let k of E.generateVideoResponse.generatedSamples)if((V=k.video)==null?void 0:V.uri){let t=d?`${k.video.uri}${k.video.uri.includes("?")?"&":"?"}key=${d}`:k.video.uri;b.push({type:"url",url:t,mediaType:"video/mp4"}),R.push({uri:k.video.uri})}if(b.length===0)throw new A$({name:"GOOGLE_VIDEO_GENERATION_ERROR",message:"No valid videos in response"});return{videos:b,warnings:Q,response:{timestamp:K,modelId:this.modelId,headers:y},providerMetadata:{google:{videos:R}}}}},hg,_G$,Ui$;var pg=A(()=>{$$();f$();$$();I$();$$();I$();$$();I$();$$();I$();f$();$$();$$();I$();f$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();$$();I$();f$();$$();I$();XG$=p(()=>u(G.object({error:G.object({code:G.number().nullable(),message:G.string(),status:G.string()})}))),W5=E4({errorSchema:XG$,errorToMessage:($)=>$.error.message}),YG$=p(()=>u(G.object({outputDimensionality:G.number().optional(),taskType:G.enum(["SEMANTIC_SIMILARITY","CLASSIFICATION","CLUSTERING","RETRIEVAL_DOCUMENT","RETRIEVAL_QUERY","QUESTION_ANSWERING","FACT_VERIFICATION","CODE_RETRIEVAL_QUERY"]).optional()}))),WG$=p(()=>u(G.object({embeddings:G.array(G.object({values:G.array(G.number())}))}))),UG$=p(()=>u(G.object({embedding:G.object({values:G.array(G.number())})})));bg=p(()=>u(G.object({responseModalities:G.array(G.enum(["TEXT","IMAGE"])).optional(),thinkingConfig:G.object({thinkingBudget:G.number().optional(),includeThoughts:G.boolean().optional(),thinkingLevel:G.enum(["minimal","low","medium","high"]).optional()}).optional(),cachedContent:G.string().optional(),structuredOutputs:G.boolean().optional(),safetySettings:G.array(G.object({category:G.enum(["HARM_CATEGORY_UNSPECIFIED","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_CIVIC_INTEGRITY"]),threshold:G.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"])})).optional(),threshold:G.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"]).optional(),audioTimestamp:G.boolean().optional(),labels:G.record(G.string(),G.string()).optional(),mediaResolution:G.enum(["MEDIA_RESOLUTION_UNSPECIFIED","MEDIA_RESOLUTION_LOW","MEDIA_RESOLUTION_MEDIUM","MEDIA_RESOLUTION_HIGH"]).optional(),imageConfig:G.object({aspectRatio:G.enum(["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9","1:8","8:1","1:4","4:1"]).optional(),imageSize:G.enum(["1K","2K","4K","512"]).optional()}).optional(),retrievalConfig:G.object({latLng:G.object({latitude:G.number(),longitude:G.number()}).optional()}).optional()})));mg=G.object({cachedContentTokenCount:G.number().nullish(),thoughtsTokenCount:G.number().nullish(),promptTokenCount:G.number().nullish(),candidatesTokenCount:G.number().nullish(),totalTokenCount:G.number().nullish(),trafficType:G.string().nullish()}),KG$=p(()=>u(G.object({candidates:G.array(G.object({content:gg().nullish().or(G.object({}).strict()),finishReason:G.string().nullish(),safetyRatings:G.array(iG()).nullish(),groundingMetadata:fg().nullish(),urlContextMetadata:ug().nullish()})),usageMetadata:mg.nullish(),promptFeedback:G.object({blockReason:G.string().nullish(),safetyRatings:G.array(iG()).nullish()}).nullish()}))),QG$=p(()=>u(G.object({candidates:G.array(G.object({content:gg().nullish(),finishReason:G.string().nullish(),safetyRatings:G.array(iG()).nullish(),groundingMetadata:fg().nullish(),urlContextMetadata:ug().nullish()})).nullish(),usageMetadata:mg.nullish(),promptFeedback:G.object({blockReason:G.string().nullish(),safetyRatings:G.array(iG()).nullish()}).nullish()}))),FG$=J6({id:"google.code_execution",inputSchema:G.object({language:G.string().describe("The programming language of the code."),code:G.string().describe("The code to be executed.")}),outputSchema:G.object({outcome:G.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),output:G.string().describe("The output from the code execution.")})}),qG$=A6({id:"google.enterprise_web_search",inputSchema:p(()=>u(G.object({})))}),wG$=G.object({fileSearchStoreNames:G.array(G.string()).describe("The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"),topK:G.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),metadataFilter:G.string().describe("Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression.").optional()}).passthrough(),ZG$=p(()=>u(wG$)),zG$=A6({id:"google.file_search",inputSchema:ZG$}),OG$=A6({id:"google.google_maps",inputSchema:p(()=>u(G.object({})))}),NG$=G.object({searchTypes:G.object({webSearch:G.object({}).optional(),imageSearch:G.object({}).optional()}).optional(),timeRangeFilter:G.object({startTime:G.string(),endTime:G.string()}).optional()}).passthrough(),AG$=p(()=>u(NG$)),BG$=A6({id:"google.google_search",inputSchema:AG$}),MG$=A6({id:"google.url_context",inputSchema:p(()=>u(G.object({})))}),jG$=A6({id:"google.vertex_rag_store",inputSchema:G.object({ragCorpus:G.string(),topK:G.number().optional()})}),RG$={googleSearch:BG$,enterpriseWebSearch:qG$,googleMaps:OG$,urlContext:MG$,fileSearch:zG$,codeExecution:FG$,vertexRagStore:jG$};EG$=p(()=>u(G.object({predictions:G.array(G.object({bytesBase64Encoded:G.string()})).default([])}))),PG$=p(()=>u(G.object({personGeneration:G.enum(["dont_allow","allow_adult","allow_all"]).nullish(),aspectRatio:G.enum(["1:1","3:4","4:3","9:16","16:9"]).nullish()}))),hg=G.object({name:G.string().nullish(),done:G.boolean().nullish(),error:G.object({code:G.number().nullish(),message:G.string(),status:G.string().nullish()}).nullish(),response:G.object({generateVideoResponse:G.object({generatedSamples:G.array(G.object({video:G.object({uri:G.string().nullish()}).nullish()})).nullish()}).nullish()}).nullish()}),_G$=p(()=>u(G.object({pollIntervalMs:G.number().positive().nullish(),pollTimeoutMs:G.number().positive().nullish(),personGeneration:G.enum(["dont_allow","allow_adult","allow_all"]).nullish(),negativePrompt:G.string().nullish(),referenceImages:G.array(G.object({bytesBase64Encoded:G.string().nullish(),gcsUri:G.string().nullish()})).nullish()}).passthrough()));Ui$=rG()});function ZO($){let X=$.indexOf(":");if(X>0)return{provider:$.slice(0,X),modelId:$.slice(X+1)};return null}function U5($){if(!$)return"anthropic";let X=ZO($);if(X)return X.provider;for(let[Y,W]of TG$)if(Y.test($))return W;return"anthropic"}function zO($){if(!$)return{provider:"openai",modelId:SG$};let X=ZO($);if(X)return X;for(let[Y,W]of CG$)if(Y.test($))return{provider:W,modelId:$};return{provider:"openai",modelId:$}}function dJ($){if(!$)return!0;let X=ZO($),Y=X?.provider??U5($),W=X?.modelId??$;if(Y!=="openai")return!0;return!/^(gpt-5|o[1-9])(?:[.-]|$)/.test(W)}var TG$,CG$,SG$="gpt-image-1.5";var nG=A(()=>{TG$=[[/^claude/,"anthropic"],[/^gpt-/,"openai"],[/^o[13]-/,"openai"],[/^gemini/,"google"],[/^llama/,"ollama"],[/^mistral/,"ollama"],[/^phi-/,"ollama"],[/^qwen/,"ollama"]];CG$=[[/^gpt-image/,"openai"],[/^dall-e/,"openai"],[/^gemini/,"google"]]});class l0{static instance=null;config;logger;anthropicProvider;openaiProvider=null;googleProvider=null;static getInstance($,X){return l0.instance??=new l0($,X),l0.instance}static resetInstance(){l0.instance=null}static createFresh($,X){return new l0($,X)}constructor($,X){this.config={...$,temperature:$.temperature??0.7,maxTokens:$.maxTokens??1000,webSearch:$.webSearch??!0},this.logger=X.child("AIService");let Y=this.config.model?U5(this.config.model):void 0,W=$.imageApiKey??$.apiKey;if(this.anthropicProvider=$.apiKey?VO({apiKey:$.apiKey}):Jg,Y==="openai"&&$.apiKey)this.openaiProvider=lX({apiKey:$.apiKey});else if(W)this.openaiProvider=lX({apiKey:W});if(Y==="google"&&$.apiKey)this.googleProvider=rG({apiKey:$.apiKey});else if(W)this.googleProvider=rG({apiKey:W})}getModel(){let $=this.requireTextModel(),X=U5($);if(X==="openai"&&this.openaiProvider)return this.openaiProvider($);if(X==="google"&&this.googleProvider)return this.googleProvider($);return this.anthropicProvider($)}async generateText($,X){this.logger.debug("Generating text response",{model:this.config.model});try{let Y=await JO({model:this.getModel(),system:$,prompt:X,...this.config.temperature!==void 0&&dJ(this.config.model)&&{temperature:this.config.temperature},...this.config.maxTokens!==void 0&&{maxTokens:this.config.maxTokens},...this.config.webSearch&&{webSearch:!0}}),W={promptTokens:Y.usage.inputTokens??0,completionTokens:Y.usage.outputTokens??0,totalTokens:Y.usage.totalTokens??0};return this.logger.info("ai:usage",{operation:"text_generation",provider:U5(this.config.model),model:this.config.model,inputTokens:W.promptTokens,outputTokens:W.completionTokens}),{text:Y.text,usage:W}}catch(Y){throw this.logger.error("Failed to generate text",Y),Error("AI text generation failed")}}async generateObject($,X,Y){this.logger.debug("Generating structured response",{model:this.config.model});try{let W=await mf({model:this.getModel(),system:$,prompt:X,schema:Y,...this.config.temperature!==void 0&&dJ(this.config.model)&&{temperature:this.config.temperature},...this.config.maxTokens!==void 0&&{maxTokens:this.config.maxTokens},...this.config.webSearch&&{webSearch:!0},providerOptions:{anthropic:{structuredOutputMode:"jsonTool"}}}),J={promptTokens:W.usage.inputTokens??0,completionTokens:W.usage.outputTokens??0,totalTokens:W.usage.totalTokens??0};return this.logger.info("ai:usage",{operation:"object_generation",provider:U5(this.config.model),model:this.config.model,inputTokens:J.promptTokens,outputTokens:J.completionTokens}),{object:W.object,usage:J}}catch(W){throw this.logger.error("Failed to generate object",W),Error("AI object generation failed")}}updateConfig($){this.config={...this.config,...$},this.logger.info("AI configuration updated",{model:this.config.model})}getConfig(){return{...this.config}}requireTextModel(){if(!this.config.model)throw Error("AI text model is not configured. Set a model in the brain definition or brain.yaml.");return this.config.model}canGenerateImages(){return this.openaiProvider!==null||this.googleProvider!==null}async generateImage($,X){let{provider:Y,modelId:W}=zO(this.config.imageModel);if(Y==="openai"&&!this.openaiProvider)throw Error("Image generation not available: no OpenAI API key configured");if(Y==="google"&&!this.googleProvider)throw Error("Image generation not available: no Google API key configured");this.logger.debug("Generating image",{prompt:$.slice(0,100),provider:Y,model:W});try{let J=X?.aspectRatio??"16:9",H=(Y==="google"?await this.generateImageWithGoogle($,J,W):await this.generateImageWithOpenAI($,J,W)).image.base64,D=`data:image/png;base64,${H}`;return this.logger.debug("Image generated successfully",{provider:Y,model:W}),{base64:H,dataUrl:D}}catch(J){throw this.logger.error("Failed to generate image",J),Error("Image generation failed")}}async generateImageWithOpenAI($,X,Y){if(!this.openaiProvider)throw Error("OpenAI provider not configured");return WO({model:this.openaiProvider.image(Y),prompt:$,size:bG$[X],providerOptions:{openai:{quality:"medium"}}})}async generateImageWithGoogle($,X,Y){if(!this.googleProvider)throw Error("Google provider not configured");return WO({model:this.googleProvider.image(Y),prompt:$,aspectRatio:X})}}var bG$;var cg=A(()=>{lG();Wg();wO();pg();nG();bG$={"1:1":"1024x1024","16:9":"1536x1024","9:16":"1024x1536","4:3":"1536x1024","3:4":"1024x1536"}});class i0{static instance=null;model;dimensions;openai;logger;static getInstance($){return i0.instance??=new i0($),i0.instance}static resetInstance(){i0.instance=null}static createFresh($){return new i0($)}constructor($){if(!$.apiKey)throw Error("API key is required for online embedding provider");this.model=$.model??xG$,this.dimensions=$.dimensions??kG$,this.logger=$.logger.child("OnlineEmbeddingProvider"),this.openai=lX({apiKey:$.apiKey})}async generateEmbedding($){this.logger.debug(`Generating embedding for text (${$.length} chars)`);let{embedding:X,usage:Y}=await ff({model:this.openai.embedding(this.model),value:$,providerOptions:{openai:{dimensions:this.dimensions}}});return{embedding:new Float32Array(X),usage:{tokens:Y.tokens}}}async generateEmbeddings($){if($.length===0)return{embeddings:[],usage:{tokens:0}};this.logger.debug(`Generating embeddings for ${$.length} texts`);let{embeddings:X,usage:Y}=await gf({model:this.openai.embedding(this.model),values:$,providerOptions:{openai:{dimensions:this.dimensions}}});return{embeddings:X.map((W)=>new Float32Array(W)),usage:{tokens:Y.tokens}}}}var xG$="text-embedding-3-small",kG$=1536;var dg=A(()=>{wO();lG()});var oG=X$((rg)=>{Object.defineProperty(rg,"__esModule",{value:!0});function lg(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function ig(){let $=lg();if($.__xstate__)return $.__xstate__;return}function vG$($){if(typeof window>"u")return;let X=ig();if(X)X.register($)}var hG$=($)=>{if(typeof window>"u")return;let X=ig();if(X)X.register($)};rg.devToolsAdapter=hG$;rg.getGlobal=lg;rg.registerService=vG$});var eX=X$((rH$)=>{var mG$=oG();class NO{constructor($){this._process=$,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){if(this._current)this._current.next=null,this._last=this._current}enqueue($){let X={value:$,next:null};if(this._current){this._last.next=X,this._last=X;return}if(this._current=X,this._last=X,this._active)this.flush()}flush(){while(this._current){let $=this._current;this._process($.value),this._current=$.next}this._last=null}}var eg=".",uG$="",$m="",pG$="#",AO="*",Xm="xstate.init",cG$="xstate.error",aG="xstate.stop";function dG$($,X){return{type:`xstate.after.${$}.${X}`}}function BO($,X){return{type:`xstate.done.state.${$}`,output:X}}function lG$($,X){return{type:`xstate.done.actor.${$}`,output:X,actorId:$}}function Ym($,X){return{type:`xstate.error.actor.${$}`,error:X,actorId:$}}function Jm($){return{type:Xm,input:$}}function r0($){setTimeout(()=>{throw $})}var iG$=(()=>typeof Symbol==="function"&&Symbol.observable||"@@observable")();function LO($,X){let Y=ng($),W=ng(X);if(typeof W==="string"){if(typeof Y==="string")return W===Y;return!1}if(typeof Y==="string")return Y in W;return Object.keys(Y).every((J)=>{if(!(J in W))return!1;return LO(Y[J],W[J])})}function EO($){if(Gm($))return $;let X=[],Y="";for(let W=0;W<$.length;W++){switch($.charCodeAt(W)){case 92:Y+=$[W+1],W++;continue;case 46:X.push(Y),Y="";continue}Y+=$[W]}return X.push(Y),X}function ng($){if(jm($))return $.value;if(typeof $!=="string")return $;let X=EO($);return Wm(X)}function Wm($){if($.length===1)return $[0];let X={},Y=X;for(let W=0;W<$.length-1;W++)if(W===$.length-2)Y[$[W]]=$[W+1];else{let J=Y;Y={},J[$[W]]=Y}return X}function rG$($,X){let Y={},W=Object.keys($);for(let J=0;J<W.length;J++){let U=W[J];Y[U]=X($[U],U,$,J)}return Y}function Um($){if(Gm($))return $;return[$]}function iJ($){if($===void 0)return[];return Um($)}function MO($,X,Y,W){if(typeof $==="function")return $({context:X,event:Y,self:W});if(!!$&&typeof $==="object"&&Object.values($).some((J)=>typeof J==="function"))console.warn(`Dynamically mapping values to individual properties is deprecated. Use a single function that returns the mapped object instead.
305
- Found object containing properties whose values are possibly mapping functions: ${Object.entries($).filter(([,J])=>typeof J==="function").map(([J,U])=>`
306
- - ${J}: ${U.toString().replace(/\n\s*/g,"")}`).join("")}`);return $}function Gm($){return Array.isArray($)}function nG$($){return $.type.startsWith("xstate.error.actor")}function iX($){return Um($).map((X)=>{if(typeof X>"u"||typeof X==="string")return{target:X};return X})}function Hm($){if($===void 0||$===uG$)return;return iJ($)}function sG($,X,Y){let W=typeof $==="object",J=W?$:void 0;return{next:(W?$.next:$)?.bind(J),error:(W?$.error:X)?.bind(J),complete:(W?$.complete:Y)?.bind(J)}}function oG$($,X){return`${X}.${$}`}function Dm($,X){let Y=X.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!Y)return $.implementations.actors[X];let[,W,J]=Y,H=$.getStateNodeById(J).config.invoke;return(Array.isArray(H)?H[W]:H).src}function aG$($){return[...new Set([...$._nodes.flatMap((X)=>X.ownEvents)])]}function Vm($,X){if(X===$)return!0;if(X===AO)return!0;if(!X.endsWith(".*"))return!1;if(/.*\*.+/.test(X))console.warn(`Wildcards can only be the last token of an event descriptor (e.g., "event.*") or the entire event descriptor ("*"). Check the "${X}" event.`);let Y=X.split("."),W=$.split(".");for(let J=0;J<Y.length;J++){let U=Y[J],H=W[J];if(U==="*"){let D=J===Y.length-1;if(!D)console.warn(`Infix wildcards in transition events are not allowed. Check the "${X}" transition.`);return D}if(U!==H)return!1}return!0}function og($,X){return`${$.sessionId}.${X}`}var sG$=0;function tG$($,X){let Y=new Map,W=new Map,J=new WeakMap,U=new Set,H={},{clock:D,logger:V}=X,K={schedule:(F,w,z,O,N=Math.random().toString(36).slice(2))=>{let L={source:F,target:w,event:z,delay:O,id:N,startedAt:Date.now()},P=og(F,N);q._snapshot._scheduledEvents[P]=L;let j=D.setTimeout(()=>{delete H[P],delete q._snapshot._scheduledEvents[P],q._relay(F,w,z)},O);H[P]=j},cancel:(F,w)=>{let z=og(F,w),O=H[z];if(delete H[z],delete q._snapshot._scheduledEvents[z],O!==void 0)D.clearTimeout(O)},cancelAll:(F)=>{for(let w in q._snapshot._scheduledEvents){let z=q._snapshot._scheduledEvents[w];if(z.source===F)K.cancel(F,z.id)}}},Q=(F)=>{if(!U.size)return;let w={...F,rootId:$.sessionId};U.forEach((z)=>z.next?.(w))},q={_snapshot:{_scheduledEvents:(X?.snapshot&&X.snapshot.scheduler)??{}},_bookId:()=>`x:${sG$++}`,_register:(F,w)=>{return Y.set(F,w),F},_unregister:(F)=>{Y.delete(F.sessionId);let w=J.get(F);if(w!==void 0)W.delete(w),J.delete(F)},get:(F)=>{return W.get(F)},getAll:()=>{return Object.fromEntries(W.entries())},_set:(F,w)=>{let z=W.get(F);if(z&&z!==w)throw Error(`Actor with system ID '${F}' already exists.`);W.set(F,w),J.set(w,F)},inspect:(F)=>{let w=sG(F);return U.add(w),{unsubscribe(){U.delete(w)}}},_sendInspectionEvent:Q,_relay:(F,w,z)=>{q._sendInspectionEvent({type:"@xstate.event",sourceRef:F,actorRef:w,event:z}),w._send(z)},scheduler:K,getSnapshot:()=>{return{_scheduledEvents:{...q._snapshot._scheduledEvents}}},start:()=>{let F=q._snapshot._scheduledEvents;q._snapshot._scheduledEvents={};for(let w in F){let{source:z,target:O,event:N,delay:L,id:P}=F[w];K.schedule(z,O,N,L,P)}},_clock:D,_logger:V};return q}rH$.executingCustomAction=!1;var PO=1,Q1=function($){return $[$.NotStarted=0]="NotStarted",$[$.Running=1]="Running",$[$.Stopped=2]="Stopped",$}({}),eG$={clock:{setTimeout:($,X)=>{return setTimeout($,X)},clearTimeout:($)=>{return clearTimeout($)}},logger:console.log.bind(console),devTools:!1};class IO{constructor($,X){this.logic=$,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new NO(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=Q1.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let Y={...eG$,...X},{clock:W,logger:J,parent:U,syncSnapshot:H,id:D,systemId:V,inspect:K}=Y;if(this.system=U?U.system:tG$(this,{clock:W,logger:J}),K&&!U)this.system.inspect(sG(K));if(this.sessionId=this.system._bookId(),this.id=D??this.sessionId,this.logger=X?.logger??this.system._logger,this.clock=X?.clock??this.system._clock,this._parent=U,this._syncSnapshot=H,this.options=Y,this.src=Y.src??$,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:(Q)=>{this._deferred.push(Q)},system:this.system,stopChild:(Q)=>{if(Q._parent!==this)throw Error(`Cannot stop child actor ${Q.id} of ${this.id} because it is not a child`);Q._stop()},emit:(Q)=>{let q=this.eventListeners.get(Q.type),F=this.eventListeners.get("*");if(!q&&!F)return;let w=[...q?q.values():[],...F?F.values():[]];for(let z of w)try{z(Q)}catch(O){r0(O)}},actionExecutor:(Q)=>{let q=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:Q.type,params:Q.params}}),!Q.exec)return;let F=rH$.executingCustomAction;try{rH$.executingCustomAction=!0,Q.exec(Q.info,Q.params)}finally{rH$.executingCustomAction=F}};if(this._processingStatus===Q1.Running)q();else this._deferred.push(q)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),V)this.systemId=V,this.system._set(V,this);if(this._initState(X?.snapshot??X?.state),V&&this._snapshot.status!=="active")this.system._unregister(this)}_initState($){try{this._snapshot=$?this.logic.restoreSnapshot?this.logic.restoreSnapshot($,this._actorScope):$:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(X){this._snapshot={status:"error",output:void 0,error:X}}}update($,X){this._snapshot=$;let Y;while(Y=this._deferred.shift())try{Y()}catch(W){this._deferred.length=0,this._snapshot={...$,status:"error",error:W}}switch(this._snapshot.status){case"active":for(let W of this.observers)try{W.next?.($)}catch(J){r0(J)}break;case"done":for(let W of this.observers)try{W.next?.($)}catch(J){r0(J)}if(this._stopProcedure(),this._complete(),this._doneEvent=lG$(this.id,this._snapshot.output),this._parent)this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:X,snapshot:$})}subscribe($,X,Y){let W=sG($,X,Y);if(this._processingStatus!==Q1.Stopped)this.observers.add(W);else switch(this._snapshot.status){case"done":try{W.complete?.()}catch(J){r0(J)}break;case"error":{let J=this._snapshot.error;if(!W.error)r0(J);else try{W.error(J)}catch(U){r0(U)}break}}return{unsubscribe:()=>{this.observers.delete(W)}}}on($,X){let Y=this.eventListeners.get($);if(!Y)Y=new Set,this.eventListeners.set($,Y);let W=X.bind(void 0);return Y.add(W),{unsubscribe:()=>{Y.delete(W)}}}start(){if(this._processingStatus===Q1.Running)return this;if(this._syncSnapshot)this.subscribe({next:(Y)=>{if(Y.status==="active")this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:Y})},error:()=>{}});if(this.system._register(this.sessionId,this),this.systemId)this.system._set(this.systemId,this);this._processingStatus=Q1.Running;let $=Jm(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:$}),this._snapshot.status){case"done":return this.update(this._snapshot,$),this;case"error":return this._error(this._snapshot.error),this}if(!this._parent)this.system.start();if(this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(Y){return this._snapshot={...this._snapshot,status:"error",error:Y},this._error(Y),this}if(this.update(this._snapshot,$),this.options.devTools)this.attachDevTools();return this.mailbox.start(),this}_process($){let X,Y;try{X=this.logic.transition(this._snapshot,$,this._actorScope)}catch(W){Y={err:W}}if(Y){let{err:W}=Y;this._snapshot={...this._snapshot,status:"error",error:W},this._error(W);return}if(this.update(X,$),$.type===aG)this._stopProcedure(),this._complete()}_stop(){if(this._processingStatus===Q1.Stopped)return this;if(this.mailbox.clear(),this._processingStatus===Q1.NotStarted)return this._processingStatus=Q1.Stopped,this;return this.mailbox.enqueue({type:aG}),this}stop(){if(this._parent)throw Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let $ of this.observers)try{$.complete?.()}catch(X){r0(X)}this.observers.clear(),this.eventListeners.clear()}_reportError($){if(!this.observers.size){if(!this._parent)r0($);this.eventListeners.clear();return}let X=!1;for(let Y of this.observers){let W=Y.error;X||=!W;try{W?.($)}catch(J){r0(J)}}if(this.observers.clear(),this.eventListeners.clear(),X)r0($)}_error($){if(this._stopProcedure(),this._reportError($),this._parent)this.system._relay(this,this._parent,Ym(this.id,$))}_stopProcedure(){if(this._processingStatus!==Q1.Running)return this;return this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new NO(this._process.bind(this)),this._processingStatus=Q1.Stopped,this.system._unregister(this),this}_send($){if(this._processingStatus===Q1.Stopped){{let X=JSON.stringify($);console.warn(`Event "${$.type}" was sent to stopped actor "${this.id} (${this.sessionId})". This actor has already reached its final state, and will not transition.
307
- Event: ${X}`)}return}this.mailbox.enqueue($)}send($){if(typeof $==="string")throw Error(`Only event objects may be sent to actors; use .send({ type: "${$}" }) instead`);this.system._relay(void 0,this,$)}attachDevTools(){let{devTools:$}=this.options;if($)(typeof $==="function"?$:mG$.devToolsAdapter)(this)}toJSON(){return{xstate$$type:PO,id:this.id}}getPersistedSnapshot($){return this.logic.getPersistedSnapshot(this._snapshot,$)}[iG$](){return this}getSnapshot(){if(!this._snapshot)throw Error("Snapshot can't be read while the actor initializes itself");return this._snapshot}}function _O($,...[X]){return new IO($,X)}var $H$=_O;function XH$($,X,Y,W,{sendId:J}){let U=typeof J==="function"?J(Y,W):J;return[X,{sendId:U},void 0]}function YH$($,X){$.defer(()=>{$.system.scheduler.cancel($.self,X.sendId)})}function Km($){function X(Y,W){throw Error("This isn't supposed to be called")}return X.type="xstate.cancel",X.sendId=$,X.resolve=XH$,X.execute=YH$,X}function JH$($,X,Y,W,{id:J,systemId:U,src:H,input:D,syncSnapshot:V}){let K=typeof H==="string"?Dm(X.machine,H):H,Q=typeof J==="function"?J(Y):J,q,F=void 0;if(K)F=typeof D==="function"?D({context:X.context,event:Y.event,self:$.self}):D,q=_O(K,{id:Q,src:H,parent:$.self,syncSnapshot:V,systemId:U,input:F});if(!q)console.warn(`Actor type '${H}' not found in machine '${$.id}'.`);return[H5(X,{children:{...X.children,[Q]:q}}),{id:J,systemId:U,actorRef:q,src:H,input:F},void 0]}function WH$($,{actorRef:X}){if(!X)return;$.defer(()=>{if(X._processingStatus===Q1.Stopped)return;X.start()})}function Qm(...[$,{id:X,systemId:Y,input:W,syncSnapshot:J=!1}={}]){function U(H,D){throw Error("This isn't supposed to be called")}return U.type="xstate.spawnChild",U.id=X,U.systemId=Y,U.src=$,U.input=W,U.syncSnapshot=J,U.resolve=JH$,U.execute=WH$,U}function UH$($,X,Y,W,{actorRef:J}){let U=typeof J==="function"?J(Y,W):J,H=typeof U==="string"?X.children[U]:U,D=X.children;if(H)D={...D},delete D[H.id];return[H5(X,{children:D}),H,void 0]}function Fm($,X){let Y=X.getSnapshot();if(Y&&"children"in Y)for(let W of Object.values(Y.children))Fm($,W);$.system._unregister(X)}function GH$($,X){if(!X)return;if(Fm($,X),X._processingStatus!==Q1.Running){$.stopChild(X);return}$.defer(()=>{$.stopChild(X)})}function eG($){function X(Y,W){throw Error("This isn't supposed to be called")}return X.type="xstate.stopChild",X.actorRef=$,X.resolve=UH$,X.execute=GH$,X}var HH$=eG;function DH$($,X,{stateValue:Y}){if(typeof Y==="string"&&rJ(Y)){let W=$.machine.getStateNodeById(Y);return $._nodes.some((J)=>J===W)}return $.matches(Y)}function VH$($){function X(){throw Error("This isn't supposed to be called")}return X.check=DH$,X.stateValue=$,X}function KH$($,{context:X,event:Y},{guards:W}){return!sX(W[0],X,Y,$)}function QH$($){function X(Y,W){throw Error("This isn't supposed to be called")}return X.check=KH$,X.guards=[$],X}function FH$($,{context:X,event:Y},{guards:W}){return W.every((J)=>sX(J,X,Y,$))}function qH$($){function X(Y,W){throw Error("This isn't supposed to be called")}return X.check=FH$,X.guards=$,X}function wH$($,{context:X,event:Y},{guards:W}){return W.some((J)=>sX(J,X,Y,$))}function ZH$($){function X(Y,W){throw Error("This isn't supposed to be called")}return X.check=wH$,X.guards=$,X}function sX($,X,Y,W){let{machine:J}=W,U=typeof $==="function",H=U?$:J.implementations.guards[typeof $==="string"?$:$.type];if(!U&&!H)throw Error(`Guard '${typeof $==="string"?$:$.type}' is not implemented.'.`);if(typeof H!=="function")return sX(H,X,Y,W);let D={context:X,event:Y},V=U||typeof $==="string"?void 0:("params"in $)?typeof $.params==="function"?$.params({context:X,event:Y}):$.params:void 0;if(!("check"in H))return H(D,V);return H.check(W,D,H)}function $H($){return $.type==="atomic"||$.type==="final"}function nX($){return Object.values($.states).filter((X)=>X.type!=="history")}function tX($,X){let Y=[];if(X===$)return Y;let W=$.parent;while(W&&W!==X)Y.push(W),W=W.parent;return Y}function TO($){let X=new Set($),Y=wm(X);for(let W of X)if(W.type==="compound"&&(!Y.get(W)||!Y.get(W).length))ag(W).forEach((J)=>X.add(J));else if(W.type==="parallel")for(let J of nX(W)){if(J.type==="history")continue;if(!X.has(J)){let U=ag(J);for(let H of U)X.add(H)}}for(let W of X){let J=W.parent;while(J)X.add(J),J=J.parent}return X}function qm($,X){let Y=X.get($);if(!Y)return{};if($.type==="compound"){let J=Y[0];if(J){if($H(J))return J.key}else return{}}let W={};for(let J of Y)W[J.key]=qm(J,X);return W}function wm($){let X=new Map;for(let Y of $){if(!X.has(Y))X.set(Y,[]);if(Y.parent){if(!X.has(Y.parent))X.set(Y.parent,[]);X.get(Y.parent).push(Y)}}return X}function Zm($,X){let Y=TO(X);return qm($,wm(Y))}function CO($,X){if(X.type==="compound")return nX(X).some((Y)=>Y.type==="final"&&$.has(Y));if(X.type==="parallel")return nX(X).every((Y)=>CO($,Y));return X.type==="final"}var rJ=($)=>$[0]===pG$;function zH$($,X){return $.transitions.get(X)||[...$.transitions.keys()].filter((W)=>Vm(X,W)).sort((W,J)=>J.length-W.length).flatMap((W)=>$.transitions.get(W))}function OH$($){let X=$.config.after;if(!X)return[];let Y=(J)=>{let U=dG$(J,$.id),H=U.type;return $.entry.push(Em(U,{id:H,delay:J})),$.exit.push(Km(H)),H};return Object.keys(X).flatMap((J)=>{let U=X[J],H=typeof U==="string"?{target:U}:U,D=Number.isNaN(+J)?J:+J,V=Y(D);return iJ(H).map((K)=>({...K,event:V,delay:D}))}).map((J)=>{let{delay:U}=J;return{...J9($,J.event,J),delay:U}})}function J9($,X,Y){let W=Hm(Y.target),J=Y.reenter??!1,U=MH$($,W);if(Y.cond)throw Error(`State "${$.id}" has declared \`cond\` for one of its transitions. This property has been renamed to \`guard\`. Please update your code.`);let H={...Y,actions:iJ(Y.actions),guard:Y.guard,target:U,source:$,reenter:J,eventType:X,toJSON:()=>({...H,source:`#${$.id}`,target:U?U.map((D)=>`#${D.id}`):void 0})};return H}function NH$($){let X=new Map;if($.config.on)for(let Y of Object.keys($.config.on)){if(Y===$m)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let W=$.config.on[Y];X.set(Y,iX(W).map((J)=>J9($,Y,J)))}if($.config.onDone){let Y=`xstate.done.state.${$.id}`;X.set(Y,iX($.config.onDone).map((W)=>J9($,Y,W)))}for(let Y of $.invoke){if(Y.onDone){let W=`xstate.done.actor.${Y.id}`;X.set(W,iX(Y.onDone).map((J)=>J9($,W,J)))}if(Y.onError){let W=`xstate.error.actor.${Y.id}`;X.set(W,iX(Y.onError).map((J)=>J9($,W,J)))}if(Y.onSnapshot){let W=`xstate.snapshot.${Y.id}`;X.set(W,iX(Y.onSnapshot).map((J)=>J9($,W,J)))}}for(let Y of $.after){let W=X.get(Y.eventType);if(!W)W=[],X.set(Y.eventType,W);W.push(Y)}return X}function AH$($){let X=[],Y=(W)=>{Object.values(W).forEach((J)=>{if(J.config.route&&J.config.id){let U=J.config.id,H=J.config.route.guard,D=(K,Q)=>{if(K.event.to!==`#${U}`)return!1;if(!H)return!0;if(typeof H==="function")return H(K,Q);return!0},V={...J.config.route,guard:D,target:`#${U}`};X.push(J9($,"xstate.route",V))}if(J.states)Y(J.states)})};if(Y($.states),X.length>0)$.transitions.set("xstate.route",X)}function BH$($,X){let Y=typeof X==="string"?$.states[X]:X?$.states[X.target]:void 0;if(!Y&&X)throw Error(`Initial state node "${X}" not found on parent state node #${$.id}`);let W={source:$,actions:!X||typeof X==="string"?[]:iJ(X.actions),eventType:null,reenter:!1,target:Y?[Y]:[],toJSON:()=>({...W,source:`#${$.id}`,target:Y?[`#${Y.id}`]:[]})};return W}function MH$($,X){if(X===void 0)return;return X.map((Y)=>{if(typeof Y!=="string")return Y;if(rJ(Y))return $.machine.getStateNodeById(Y);let W=Y[0]===eg;if(W&&!$.parent)return tG($,Y.slice(1));let J=W?$.key+Y:Y;if($.parent)try{return tG($.parent,J)}catch(U){throw Error(`Invalid transition definition for state node '${$.id}':
308
- ${U.message}`)}else throw Error(`Invalid target: "${Y}" is not a valid target from the root node. Did you mean ".${Y}"?`)})}function zm($){let X=Hm($.config.target);if(!X)return $.parent.initial;return{target:X.map((Y)=>typeof Y==="string"?tG($.parent,Y):Y)}}function G5($){return $.type==="history"}function ag($){let X=Om($);for(let Y of X)for(let W of tX(Y,$))X.add(W);return X}function Om($){let X=new Set;function Y(W){if(X.has(W))return;if(X.add(W),W.type==="compound")Y(W.initial.target[0]);else if(W.type==="parallel")for(let J of nX(W))Y(J)}return Y($),X}function oX($,X){if(rJ(X))return $.machine.getStateNodeById(X);if(!$.states)throw Error(`Unable to retrieve child state '${X}' from '${$.id}'; no child states exist.`);let Y=$.states[X];if(!Y)throw Error(`Child state '${X}' does not exist on '${$.id}'`);return Y}function tG($,X){if(typeof X==="string"&&rJ(X))try{return $.machine.getStateNodeById(X)}catch{}let Y=EO(X).slice(),W=$;while(Y.length){let J=Y.shift();if(!J.length)break;W=oX(W,J)}return W}function SO($,X){if(typeof X==="string"){let J=$.states[X];if(!J)throw Error(`State '${X}' does not exist on '${$.id}'`);return[$,J]}let Y=Object.keys(X),W=Y.map((J)=>oX($,J)).filter(Boolean);return[$.machine.root,$].concat(W,Y.reduce((J,U)=>{let H=oX($,U);if(!H)return J;let D=SO(H,X[U]);return J.concat(D)},[]))}function jH$($,X,Y,W){let U=oX($,X).next(Y,W);if(!U||!U.length)return $.next(Y,W);return U}function RH$($,X,Y,W){let J=Object.keys(X),U=oX($,J[0]),H=bO(U,X[J[0]],Y,W);if(!H||!H.length)return $.next(Y,W);return H}function LH$($,X,Y,W){let J=[];for(let U of Object.keys(X)){let H=X[U];if(!H)continue;let D=oX($,U),V=bO(D,H,Y,W);if(V)J.push(...V)}if(!J.length)return $.next(Y,W);return J}function bO($,X,Y,W){if(typeof X==="string")return jH$($,X,Y,W);if(Object.keys(X).length===1)return RH$($,X,Y,W);return LH$($,X,Y,W)}function EH$($){return Object.keys($.states).map((X)=>$.states[X]).filter((X)=>X.type==="history")}function W9($,X){let Y=$;while(Y.parent&&Y.parent!==X)Y=Y.parent;return Y.parent===X}function PH$($,X){let Y=new Set($),W=new Set(X);for(let J of Y)if(W.has(J))return!0;for(let J of W)if(Y.has(J))return!0;return!1}function Nm($,X,Y){let W=new Set;for(let J of $){let U=!1,H=new Set;for(let D of W)if(PH$(jO([J],X,Y),jO([D],X,Y)))if(W9(J.source,D.source))H.add(D);else{U=!0;break}if(!U){for(let D of H)W.delete(D);W.add(J)}}return Array.from(W)}function IH$($){let[X,...Y]=$;for(let W of tX(X,void 0))if(Y.every((J)=>W9(J,W)))return W}function xO($,X){if(!$.target)return[];let Y=new Set;for(let W of $.target)if(G5(W))if(X[W.id])for(let J of X[W.id])Y.add(J);else for(let J of xO(zm(W),X))Y.add(J);else Y.add(W);return[...Y]}function Am($,X){let Y=xO($,X);if(!Y)return;if(!$.reenter&&Y.every((J)=>J===$.source||W9(J,$.source)))return $.source;let W=IH$(Y.concat($.source));if(W)return W;if($.reenter)return;return $.source.machine.root}function jO($,X,Y){let W=new Set;for(let J of $)if(J.target?.length){let U=Am(J,Y);if(J.reenter&&J.source===U)W.add(U);for(let H of X)if(W9(H,U))W.add(H)}return[...W]}function _H$($,X){if($.length!==X.size)return!1;for(let Y of $)if(!X.has(Y))return!1;return!0}function TH$($,X,Y,W,J){return RO([{target:[...Om($)],source:$,reenter:!0,actions:[],eventType:null,toJSON:null}],X,Y,W,!0,J)}function RO($,X,Y,W,J,U){let H=[];if(!$.length)return[X,H];let D=Y.actionExecutor;Y.actionExecutor=(V)=>{H.push(V),D(V)};try{let V=new Set(X._nodes),K=X.historyValue,Q=Nm($,V,K),q=X;if(!J)[q,K]=xH$(q,W,Y,Q,V,K,U,Y.actionExecutor);q=aX(q,W,Y,Q.flatMap((w)=>w.actions),U,void 0),q=SH$(q,W,Y,Q,V,U,K,J);let F=[...V];if(q.status==="done")q=aX(q,W,Y,F.sort((w,z)=>z.order-w.order).flatMap((w)=>w.exit),U,void 0);try{if(K===X.historyValue&&_H$(X._nodes,V))return[q,H];return[H5(q,{_nodes:F,historyValue:K}),H]}catch(w){throw w}}finally{Y.actionExecutor=D}}function CH$($,X,Y,W,J){if(W.output===void 0)return;let U=BO(J.id,J.output!==void 0&&J.parent?MO(J.output,$.context,X,Y.self):void 0);return MO(W.output,$.context,U,Y.self)}function SH$($,X,Y,W,J,U,H,D){let V=$,K=new Set,Q=new Set;if(bH$(W,H,Q,K),D)Q.add($.machine.root);let q=new Set;for(let F of[...K].sort((w,z)=>w.order-z.order)){J.add(F);let w=[];w.push(...F.entry);for(let z of F.invoke)w.push(Qm(z.src,{...z,syncSnapshot:!!z.onSnapshot}));if(Q.has(F)){let z=F.initial.actions;w.push(...z)}if(V=aX(V,X,Y,w,U,F.invoke.map((z)=>z.id)),F.type==="final"){let z=F.parent,O=z?.type==="parallel"?z:z?.parent,N=O||F;if(z?.type==="compound")U.push(BO(z.id,F.output!==void 0?MO(F.output,V.context,X,Y.self):void 0));while(O?.type==="parallel"&&!q.has(O)&&CO(J,O))q.add(O),U.push(BO(O.id)),N=O,O=O.parent;if(O)continue;V=H5(V,{status:"done",output:CH$(V,X,Y,V.machine.root,N)})}}return V}function bH$($,X,Y,W){for(let J of $){let U=Am(J,X);for(let D of J.target||[]){if(!G5(D)&&(J.source!==D||J.source!==U||J.reenter))W.add(D),Y.add(D);rX(D,X,Y,W)}let H=xO(J,X);for(let D of H){let V=tX(D,U);if(U?.type==="parallel")V.push(U);Bm(W,X,Y,V,!J.source.parent&&J.reenter?void 0:U)}}}function rX($,X,Y,W){if(G5($))if(X[$.id]){let J=X[$.id];for(let U of J)W.add(U),rX(U,X,Y,W);for(let U of J)OO(U,$.parent,W,X,Y)}else{let J=zm($);for(let U of J.target){if(W.add(U),J===$.parent?.initial)Y.add($.parent);rX(U,X,Y,W)}for(let U of J.target)OO(U,$.parent,W,X,Y)}else if($.type==="compound"){let[J]=$.initial.target;if(!G5(J))W.add(J),Y.add(J);rX(J,X,Y,W),OO(J,$,W,X,Y)}else if($.type==="parallel"){for(let J of nX($).filter((U)=>!G5(U)))if(![...W].some((U)=>W9(U,J))){if(!G5(J))W.add(J),Y.add(J);rX(J,X,Y,W)}}}function Bm($,X,Y,W,J){for(let U of W){if(!J||W9(U,J))$.add(U);if(U.type==="parallel"){for(let H of nX(U).filter((D)=>!G5(D)))if(![...$].some((D)=>W9(D,H)))$.add(H),rX(H,X,Y,$)}}}function OO($,X,Y,W,J){Bm(Y,W,J,tX($,X))}function xH$($,X,Y,W,J,U,H,D){let V=$,K=jO(W,J,U);K.sort((q,F)=>F.order-q.order);let Q;for(let q of K)for(let F of EH$(q)){let w;if(F.history==="deep")w=(z)=>$H(z)&&W9(z,q);else w=(z)=>{return z.parent===q};Q??={...U},Q[F.id]=Array.from(J).filter(w)}for(let q of K)V=aX(V,X,Y,[...q.exit,...q.invoke.map((F)=>eG(F.id))],H,void 0),J.delete(q);return[V,Q||U]}function kH$($,X){return $.implementations.actions[X]}function Mm($,X,Y,W,J,U){let{machine:H}=$,D=$;for(let V of W){let K=typeof V==="function",Q=K?V:kH$(H,typeof V==="string"?V:V.type),q={context:D.context,event:X,self:Y.self,system:Y.system},F=K||typeof V==="string"?void 0:("params"in V)?typeof V.params==="function"?V.params({context:D.context,event:X}):V.params:void 0;if(!Q||!("resolve"in Q)){Y.actionExecutor({type:typeof V==="string"?V:typeof V==="object"?V.type:V.name||"(anonymous)",info:q,params:F,exec:Q});continue}let w=Q,[z,O,N]=w.resolve(Y,D,q,F,Q,J);if(D=z,"retryResolve"in w)U?.push([w,O]);if("execute"in w)Y.actionExecutor({type:w.type,info:q,params:O,exec:w.execute.bind(null,Y,O)});if(N)D=Mm(D,X,Y,N,J,U)}return D}function aX($,X,Y,W,J,U){let H=U?[]:void 0,D=Mm($,X,Y,W,{internalQueue:J,deferredActorIds:U},H);return H?.forEach(([V,K])=>{V.retryResolve(Y,D,K)}),D}function vH$($,X,Y,W){if(X.type===AO)throw Error(`An event cannot have the wildcard type ('${AO}')`);let J=$,U=[];function H(K,Q,q){Y.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:Y.self,event:Q,snapshot:K[0],_transitions:q}),U.push(K)}if(X.type===aG)return J=H5(sg(J,X,Y),{status:"stopped"}),H([J,[]],X,[]),{snapshot:J,microsteps:U};let D=X;if(D.type!==Xm){let K=D,Q=nG$(K),q=tg(K,J);if(Q&&!q.length)return J=H5($,{status:"error",error:K.error}),H([J,[]],K,[]),{snapshot:J,microsteps:U};let F=RO(q,$,Y,D,!1,W);J=F[0],H(F,K,q)}let V=!0;while(J.status==="active"){let K=V?hH$(J,D):[],Q=K.length?J:void 0;if(!K.length){if(!W.length)break;D=W.shift(),K=tg(D,J)}let q=RO(K,J,Y,D,!1,W);J=q[0],V=J!==Q,H(q,D,K)}if(J.status!=="active")sg(J,D,Y);return{snapshot:J,microsteps:U}}function sg($,X,Y){return aX($,X,Y,Object.values($.children).map((W)=>eG(W)),[],void 0)}function tg($,X){return X.machine.getTransitionData(X,$)}function hH$($,X){let Y=new Set,W=$._nodes.filter($H);for(let J of W)$:for(let U of[J].concat(tX(J,void 0))){if(!U.always)continue;for(let H of U.always)if(H.guard===void 0||sX(H.guard,$.context,X,$)){Y.add(H);break $}}return Nm(Array.from(Y),new Set($._nodes),$.historyValue)}function yH$($,X){let Y=TO(SO($,X));return Zm($,[...Y])}function jm($){return!!$&&typeof $==="object"&&"machine"in $&&"value"in $}var fH$=function(X){return LO(X,this.value)},gH$=function(X){return this.tags.has(X)},mH$=function(X){if(!this.machine)console.warn("state.can(...) used outside of a machine-created State object; this will always return false.");let Y=this.machine.getTransitionData(this,X);return!!Y?.length&&Y.some((W)=>W.target!==void 0||W.actions.length)},uH$=function(){let{_nodes:X,tags:Y,machine:W,getMeta:J,toJSON:U,can:H,hasTag:D,matches:V,...K}=this;return{...K,tags:Array.from(Y)}},pH$=function(){return this._nodes.reduce((X,Y)=>{if(Y.meta!==void 0)X[Y.id]=Y.meta;return X},{})};function Rm($,X){return{status:$.status,output:$.output,error:$.error,machine:X,context:$.context,_nodes:$._nodes,value:Zm(X.root,$._nodes),tags:new Set($._nodes.flatMap((Y)=>Y.tags)),children:$.children,historyValue:$.historyValue||{},matches:fH$,hasTag:gH$,can:mH$,getMeta:pH$,toJSON:uH$}}function H5($,X={}){return Rm({...$,...X},$.machine)}function cH$($){if(typeof $!=="object"||$===null)return{};let X={};for(let Y in $){let W=$[Y];if(Array.isArray(W))X[Y]=W.map((J)=>({id:J.id}))}return X}function dH$($,X){let{_nodes:Y,tags:W,machine:J,children:U,context:H,can:D,hasTag:V,matches:K,getMeta:Q,toJSON:q,...F}=$,w={};for(let O in U){let N=U[O];if(typeof N.src!=="string"&&(!X||!("__unsafeAllowInlineActors"in X)))throw Error("An inline child actor cannot be persisted.");w[O]={snapshot:N.getPersistedSnapshot(X),src:N.src,systemId:N.systemId,syncSnapshot:N._syncSnapshot}}return{...F,context:Lm(H),children:w,historyValue:cH$(F.historyValue)}}function Lm($){let X;for(let Y in $){let W=$[Y];if(W&&typeof W==="object")if("sessionId"in W&&"send"in W&&"ref"in W)X??=Array.isArray($)?$.slice():{...$},X[Y]={xstate$$type:PO,id:W.id};else{let J=Lm(W);if(J!==W)X??=Array.isArray($)?$.slice():{...$},X[Y]=J}}return X??$}function lH$($,X,Y,W,{event:J,id:U,delay:H},{internalQueue:D}){let V=X.machine.implementations.delays;if(typeof J==="string")throw Error(`Only event objects may be used with raise; use raise({ type: "${J}" }) instead`);let K=typeof J==="function"?J(Y,W):J,Q;if(typeof H==="string"){let q=V&&V[H];Q=typeof q==="function"?q(Y,W):q}else Q=typeof H==="function"?H(Y,W):H;if(typeof Q!=="number")D.push(K);return[X,{event:K,id:U,delay:Q},void 0]}function iH$($,X){let{event:Y,delay:W,id:J}=X;if(typeof W==="number"){$.defer(()=>{let U=$.self;$.system.scheduler.schedule(U,U,Y,W,J)});return}}function Em($,X){if(rH$.executingCustomAction)console.warn("Custom actions should not call `raise()` directly, as it is not imperative. See https://stately.ai/docs/actions#built-in-actions for more details.");function Y(W,J){throw Error("This isn't supposed to be called")}return Y.type="xstate.raise",Y.event=$,Y.id=X?.id,Y.delay=X?.delay,Y.resolve=lH$,Y.execute=iH$,Y}rH$.$$ACTOR_TYPE=PO;rH$.Actor=IO;rH$.NULL_EVENT=$m;rH$.ProcessingStatus=Q1;rH$.STATE_DELIMITER=eg;rH$.XSTATE_ERROR=cG$;rH$.XSTATE_STOP=aG;rH$.and=qH$;rH$.cancel=Km;rH$.cloneMachineSnapshot=H5;rH$.createActor=_O;rH$.createErrorActorEvent=Ym;rH$.createInitEvent=Jm;rH$.createInvokeId=oG$;rH$.createMachineSnapshot=Rm;rH$.evaluateGuard=sX;rH$.formatInitialTransition=BH$;rH$.formatRouteTransitions=AH$;rH$.formatTransition=J9;rH$.formatTransitions=NH$;rH$.getAllOwnEventDescriptors=aG$;rH$.getAllStateNodes=TO;rH$.getCandidates=zH$;rH$.getDelayedTransitions=OH$;rH$.getPersistedSnapshot=dH$;rH$.getProperAncestors=tX;rH$.getStateNodeByPath=tG;rH$.getStateNodes=SO;rH$.initialMicrostep=TH$;rH$.interpret=$H$;rH$.isAtomicStateNode=$H;rH$.isInFinalState=CO;rH$.isMachineSnapshot=jm;rH$.isStateId=rJ;rH$.macrostep=vH$;rH$.mapValues=rG$;rH$.matchesEventDescriptor=Vm;rH$.matchesState=LO;rH$.not=QH$;rH$.or=ZH$;rH$.pathToStateValue=Wm;rH$.raise=Em;rH$.resolveActionsAndContext=aX;rH$.resolveReferencedActor=Dm;rH$.resolveStateValue=yH$;rH$.spawnChild=Qm;rH$.stateIn=VH$;rH$.stop=HH$;rH$.stopChild=eG;rH$.toArray=iJ;rH$.toObserver=sG;rH$.toStatePath=EO;rH$.toTransitionConfigArray=iX;rH$.transitionNode=bO});var Sm=X$((Cm)=>{Object.defineProperty(Cm,"__esModule",{value:!0});var oJ=eX();oG();function Tm($,X){return{config:$,transition:(Y,W,J)=>{return{...Y,context:$(Y.context,W,J)}},getInitialSnapshot:(Y,W)=>{return{status:"active",output:void 0,error:void 0,context:typeof X==="function"?X({input:W}):X}},getPersistedSnapshot:(Y)=>Y,restoreSnapshot:(Y)=>Y}}var kO=new WeakMap;function nD$($){return{config:$,start:(Y,W)=>{let{self:J,system:U,emit:H}=W,D={receivers:void 0,dispose:void 0};kO.set(J,D),D.dispose=$({input:Y.input,system:U,self:J,sendBack:(V)=>{if(J.getSnapshot().status==="stopped")return;if(J._parent)U._relay(J,J._parent,V)},receive:(V)=>{D.receivers??=new Set,D.receivers.add(V)},emit:H})},transition:(Y,W,J)=>{let U=kO.get(J.self);if(W.type===oJ.XSTATE_STOP)return Y={...Y,status:"stopped",error:void 0},kO.delete(J.self),U.receivers?.clear(),U.dispose?.(),Y;return U.receivers?.forEach((H)=>H(W)),Y},getInitialSnapshot:(Y,W)=>{return{status:"active",output:void 0,error:void 0,input:W}},getPersistedSnapshot:(Y)=>Y,restoreSnapshot:(Y)=>Y}}var Pm="xstate.observable.next",XH="xstate.observable.error",YH="xstate.observable.complete";function oD$($){return{config:$,transition:(Y,W)=>{if(Y.status!=="active")return Y;switch(W.type){case Pm:return{...Y,context:W.data};case XH:return{...Y,status:"error",error:W.data,input:void 0,_subscription:void 0};case YH:return{...Y,status:"done",input:void 0,_subscription:void 0};case oJ.XSTATE_STOP:return Y._subscription.unsubscribe(),{...Y,status:"stopped",input:void 0,_subscription:void 0};default:return Y}},getInitialSnapshot:(Y,W)=>{return{status:"active",output:void 0,error:void 0,context:void 0,input:W,_subscription:void 0}},start:(Y,{self:W,system:J,emit:U})=>{if(Y.status==="done")return;Y._subscription=$({input:Y.input,system:J,self:W,emit:U}).subscribe({next:(H)=>{J._relay(W,W,{type:Pm,data:H})},error:(H)=>{J._relay(W,W,{type:XH,data:H})},complete:()=>{J._relay(W,W,{type:YH})}})},getPersistedSnapshot:({_subscription:Y,...W})=>W,restoreSnapshot:(Y)=>({...Y,_subscription:void 0})}}function aD$($){return{config:$,transition:(Y,W)=>{if(Y.status!=="active")return Y;switch(W.type){case XH:return{...Y,status:"error",error:W.data,input:void 0,_subscription:void 0};case YH:return{...Y,status:"done",input:void 0,_subscription:void 0};case oJ.XSTATE_STOP:return Y._subscription.unsubscribe(),{...Y,status:"stopped",input:void 0,_subscription:void 0};default:return Y}},getInitialSnapshot:(Y,W)=>{return{status:"active",output:void 0,error:void 0,context:void 0,input:W,_subscription:void 0}},start:(Y,{self:W,system:J,emit:U})=>{if(Y.status==="done")return;Y._subscription=$({input:Y.input,system:J,self:W,emit:U}).subscribe({next:(H)=>{if(W._parent)J._relay(W,W._parent,H)},error:(H)=>{J._relay(W,W,{type:XH,data:H})},complete:()=>{J._relay(W,W,{type:YH})}})},getPersistedSnapshot:({_subscription:Y,...W})=>W,restoreSnapshot:(Y)=>({...Y,_subscription:void 0})}}var Im="xstate.promise.resolve",_m="xstate.promise.reject",nJ=new WeakMap;function sD$($){return{config:$,transition:(Y,W,J)=>{if(Y.status!=="active")return Y;switch(W.type){case Im:{let U=W.data;return{...Y,status:"done",output:U,input:void 0}}case _m:return{...Y,status:"error",error:W.data,input:void 0};case oJ.XSTATE_STOP:return nJ.get(J.self)?.abort(),nJ.delete(J.self),{...Y,status:"stopped",input:void 0};default:return Y}},start:(Y,{self:W,system:J,emit:U})=>{if(Y.status!=="active")return;let H=new AbortController;nJ.set(W,H),Promise.resolve($({input:Y.input,system:J,self:W,signal:H.signal,emit:U})).then((V)=>{if(W.getSnapshot().status!=="active")return;nJ.delete(W),J._relay(W,W,{type:Im,data:V})},(V)=>{if(W.getSnapshot().status!=="active")return;nJ.delete(W),J._relay(W,W,{type:_m,data:V})})},getInitialSnapshot:(Y,W)=>{return{status:"active",output:void 0,error:void 0,input:W}},getPersistedSnapshot:(Y)=>Y,restoreSnapshot:(Y)=>Y}}var tD$=Tm(($)=>{return},void 0);function eD$(){return oJ.createActor(tD$)}Cm.createEmptyActor=eD$;Cm.fromCallback=nD$;Cm.fromEventObservable=aD$;Cm.fromObservable=oD$;Cm.fromPromise=sD$;Cm.fromTransition=Tm});var JH=X$((VV$)=>{var $7=eX();function GV$($,{machine:X,context:Y},W,J){let U=(H,D)=>{if(typeof H==="string"){let V=$7.resolveReferencedActor(X,H);if(!V)throw Error(`Actor logic '${H}' not implemented in machine '${X.id}'`);let K=$7.createActor(V,{id:D?.id,parent:$.self,syncSnapshot:D?.syncSnapshot,input:typeof D?.input==="function"?D.input({context:Y,event:W,self:$.self}):D?.input,src:H,systemId:D?.systemId});return J[K.id]=K,K}else return $7.createActor(H,{id:D?.id,parent:$.self,syncSnapshot:D?.syncSnapshot,input:D?.input,src:H,systemId:D?.systemId})};return(H,D)=>{let V=U(H,D);return J[V.id]=V,$.defer(()=>{if(V._processingStatus===$7.ProcessingStatus.Stopped)return;V.start()}),V}}function HV$($,X,Y,W,{assignment:J}){if(!X.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let U={},H={context:X.context,event:Y.event,spawn:GV$($,X,Y.event,U),self:$.self,system:$.system},D={};if(typeof J==="function")D=J(H,W);else for(let K of Object.keys(J)){let Q=J[K];D[K]=typeof Q==="function"?Q(H,W):Q}let V=Object.assign({},X.context,D);return[$7.cloneMachineSnapshot(X,{context:V,children:Object.keys(U).length?{...X.children,...U}:X.children}),void 0,void 0]}function DV$($){if($7.executingCustomAction)console.warn("Custom actions should not call `assign()` directly, as it is not imperative. See https://stately.ai/docs/actions#built-in-actions for more details.");function X(Y,W){throw Error("This isn't supposed to be called")}return X.type="xstate.assign",X.assignment=$,X.resolve=HV$,X}VV$.assign=DV$});var xm=X$((wV$)=>{var U6=eX(),QV$=JH(),bm=new WeakMap;function X7($,X,Y){let W=bm.get($);if(!W)W={[X]:Y()},bm.set($,W);else if(!(X in W))W[X]=Y();return W[X]}var FV$={},aJ=($)=>{if(typeof $==="string")return{type:$};if(typeof $==="function"){if("resolve"in $)return{type:$.type};return{type:$.name}}return $};class sJ{constructor($,X){if(this.config=$,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=X._parent,this.key=X._key,this.machine=X._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(U6.STATE_DELIMITER),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?U6.mapValues(this.config.states,(Y,W)=>{return new sJ(Y,{_parent:this,_key:W,_machine:this.machine})}):FV$,this.type==="compound"&&!this.config.initial)throw Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=U6.toArray(this.config.entry).slice(),this.exit=U6.toArray(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=U6.toArray($.tags).slice()}_initialize(){if(this.transitions=U6.formatTransitions(this),this.config.always)this.always=U6.toTransitionConfigArray(this.config.always).map(($)=>U6.formatTransition(this,U6.NULL_EVENT,$));Object.keys(this.states).forEach(($)=>{this.states[$]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(aJ),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(($)=>`#${$.id}`),source:`#${this.id}`,actions:this.initial.actions.map(aJ),eventType:null})}:void 0,history:this.history,states:U6.mapValues(this.states,($)=>{return $.definition}),on:this.on,transitions:[...this.transitions.values()].flat().map(($)=>({...$,actions:$.actions.map(aJ)})),entry:this.entry.map(aJ),exit:this.exit.map(aJ),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return X7(this,"invoke",()=>U6.toArray(this.config.invoke).map(($,X)=>{let{src:Y,systemId:W}=$,J=$.id??U6.createInvokeId(this.id,X),U=typeof Y==="string"?Y:`xstate.invoke.${U6.createInvokeId(this.id,X)}`;return{...$,src:U,id:J,systemId:W,toJSON(){let{onDone:H,onError:D,...V}=$;return{...V,type:"xstate.invoke",src:U,id:J}}}}))}get on(){return X7(this,"on",()=>{return[...this.transitions].flatMap(([X,Y])=>Y.map((W)=>[X,W])).reduce((X,[Y,W])=>{return X[Y]=X[Y]||[],X[Y].push(W),X},{})})}get after(){return X7(this,"delayedTransitions",()=>U6.getDelayedTransitions(this))}get initial(){return X7(this,"initial",()=>U6.formatInitialTransition(this,this.config.initial))}next($,X){let Y=X.type,W=[],J,U=X7(this,`candidates-${Y}`,()=>U6.getCandidates(this,Y));for(let H of U){let{guard:D}=H,V=$.context,K=!1;try{K=!D||U6.evaluateGuard(D,V,X,$)}catch(Q){let q=typeof D==="string"?D:typeof D==="object"?D.type:void 0;throw Error(`Unable to evaluate guard ${q?`'${q}' `:""}in transition for event '${Y}' in state node '${this.id}':
309
- ${Q.message}`)}if(K){W.push(...H.actions),J=H;break}}return J?[J]:void 0}get events(){return X7(this,"events",()=>{let{states:$}=this,X=new Set(this.ownEvents);if($)for(let Y of Object.keys($)){let W=$[Y];if(W.states)for(let J of W.events)X.add(`${J}`)}return Array.from(X)})}get ownEvents(){let $=Object.keys(Object.fromEntries(this.transitions)),X=new Set($.filter((Y)=>{return this.transitions.get(Y).some((W)=>!(!W.target&&!W.actions.length&&!W.reenter))}));return Array.from(X)}}var qV$="#";class vO{constructor($,X){if(this.config=$,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=$.id||"(machine)",this.implementations={actors:X?.actors??{},actions:X?.actions??{},delays:X?.delays??{},guards:X?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new sJ($,{_key:this.id,_machine:this}),this.root._initialize(),U6.formatRouteTransitions(this.root),this.states=this.root.states,this.events=this.root.events,!("output"in this.root)&&Object.values(this.states).some((Y)=>Y.type==="final"&&("output"in Y)))console.warn("Missing `machine.output` declaration (top-level final state with output detected)")}provide($){let{actions:X,guards:Y,actors:W,delays:J}=this.implementations;return new vO(this.config,{actions:{...X,...$.actions},guards:{...Y,...$.guards},actors:{...W,...$.actors},delays:{...J,...$.delays}})}resolveState($){let X=U6.resolveStateValue(this.root,$.value),Y=U6.getAllStateNodes(U6.getStateNodes(this.root,X));return U6.createMachineSnapshot({_nodes:[...Y],context:$.context||{},children:{},status:U6.isInFinalState(Y,this.root)?"done":$.status||"active",output:$.output,error:$.error,historyValue:$.historyValue},this)}transition($,X,Y){return U6.macrostep($,X,Y,[]).snapshot}microstep($,X,Y){return U6.macrostep($,X,Y,[]).microsteps.map(([W])=>W)}getTransitionData($,X){return U6.transitionNode(this.root,$.value,$,X)||[]}_getPreInitialState($,X,Y){let{context:W}=this.config,J=U6.createMachineSnapshot({context:typeof W!=="function"&&W?W:{},_nodes:[this.root],children:{},status:"active"},this);if(typeof W==="function"){let U=({spawn:H,event:D,self:V})=>W({spawn:H,input:D.input,self:V});return U6.resolveActionsAndContext(J,X,$,[QV$.assign(U)],Y,void 0)}return J}getInitialSnapshot($,X){let Y=U6.createInitEvent(X),W=[],J=this._getPreInitialState($,Y,W),[U]=U6.initialMicrostep(this.root,J,$,Y,W),{snapshot:H}=U6.macrostep(U,Y,$,W);return H}start($){Object.values($.children).forEach((X)=>{if(X.getSnapshot().status==="active")X.start()})}getStateNodeById($){let X=U6.toStatePath($),Y=X.slice(1),W=U6.isStateId(X[0])?X[0].slice(qV$.length):X[0],J=this.idMap.get(W);if(!J)throw Error(`Child state node '#${W}' does not exist on machine '${this.id}'`);return U6.getStateNodeByPath(J,Y)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot($,X){return U6.getPersistedSnapshot($,X)}restoreSnapshot($,X){let Y={},W=$.children;Object.keys(W).forEach((Q)=>{let q=W[Q],F=q.snapshot,w=q.src,z=typeof w==="string"?U6.resolveReferencedActor(this,w):w;if(!z)return;let O=U6.createActor(z,{id:Q,parent:X.self,syncSnapshot:q.syncSnapshot,snapshot:F,src:w,systemId:q.systemId});Y[Q]=O});function J(Q,q){if(q instanceof sJ)return q;try{return Q.machine.getStateNodeById(q.id)}catch{console.warn(`Could not resolve StateNode for id: ${q.id}`)}}function U(Q,q){if(!q||typeof q!=="object")return{};let F={};for(let w in q){let z=q[w];for(let O of z){let N=J(Q,O);if(!N)continue;F[w]??=[],F[w].push(N)}}return F}let H=U(this.root,$.historyValue),D=U6.createMachineSnapshot({...$,children:Y,_nodes:Array.from(U6.getAllStateNodes(U6.getStateNodes(this.root,$.value))),historyValue:H},this),V=new Set;function K(Q,q){if(V.has(Q))return;V.add(Q);for(let F in Q){let w=Q[F];if(w&&typeof w==="object"){if("xstate$$type"in w&&w.xstate$$type===U6.$$ACTOR_TYPE){Q[F]=q[w.id];continue}K(w,q)}}}return K(D.context,Y),D}}wV$.StateMachine=vO;wV$.StateNode=sJ});var hm=X$((TV$)=>{var R8=eX(),OV$=JH();function NV$($,X,Y,W,{event:J}){let U=typeof J==="function"?J(Y,W):J;return[X,{event:U},void 0]}function AV$($,{event:X}){$.defer(()=>$.emit(X))}function km($){if(R8.executingCustomAction)console.warn("Custom actions should not call `emit()` directly, as it is not imperative. See https://stately.ai/docs/actions#built-in-actions for more details.");function X(Y,W){throw Error("This isn't supposed to be called")}return X.type="xstate.emit",X.event=$,X.resolve=NV$,X.execute=AV$,X}var WH=function($){return $.Parent="#_parent",$.Internal="#_internal",$}({});function BV$($,X,Y,W,{to:J,event:U,id:H,delay:D},V){let K=X.machine.implementations.delays;if(typeof U==="string")throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${U}" }) instead`);let Q=typeof U==="function"?U(Y,W):U,q;if(typeof D==="string"){let z=K&&K[D];q=typeof z==="function"?z(Y,W):z}else q=typeof D==="function"?D(Y,W):D;let F=typeof J==="function"?J(Y,W):J,w;if(typeof F==="string"){if(F===WH.Parent)w=$.self._parent;else if(F===WH.Internal)w=$.self;else if(F.startsWith("#_"))w=X.children[F.slice(2)];else w=V.deferredActorIds?.includes(F)?F:X.children[F];if(!w)throw Error(`Unable to send event to actor '${F}' from machine '${X.machine.id}'.`)}else w=F||$.self;return[X,{to:w,targetId:typeof F==="string"?F:void 0,event:Q,id:H,delay:q},void 0]}function MV$($,X,Y){if(typeof Y.to==="string")Y.to=X.children[Y.to]}function jV$($,X){$.defer(()=>{let{to:Y,event:W,delay:J,id:U}=X;if(typeof J==="number"){$.system.scheduler.schedule($.self,Y,W,J,U);return}$.system._relay($.self,Y,W.type===R8.XSTATE_ERROR?R8.createErrorActorEvent($.self.id,W.data):W)})}function UH($,X,Y){if(R8.executingCustomAction)console.warn("Custom actions should not call `sendTo()` directly, as it is not imperative. See https://stately.ai/docs/actions#built-in-actions for more details.");function W(J,U){throw Error("This isn't supposed to be called")}return W.type="xstate.sendTo",W.to=$,W.event=X,W.id=Y?.id,W.delay=Y?.delay,W.resolve=BV$,W.retryResolve=MV$,W.execute=jV$,W}function vm($,X){return UH(WH.Parent,$,X)}function RV$($,X){if(!$||typeof $==="function"){let Y=$;$=(...W)=>{let J=typeof Y==="function"?Y(...W):Y;if(!J)throw Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return J}}return UH($,({event:Y})=>Y,X)}function LV$($,X,Y,W,{collect:J}){let U=[],H=function(V){U.push(V)};return H.assign=(...D)=>{U.push(OV$.assign(...D))},H.cancel=(...D)=>{U.push(R8.cancel(...D))},H.raise=(...D)=>{U.push(R8.raise(...D))},H.sendTo=(...D)=>{U.push(UH(...D))},H.sendParent=(...D)=>{U.push(vm(...D))},H.spawnChild=(...D)=>{U.push(R8.spawnChild(...D))},H.stopChild=(...D)=>{U.push(R8.stopChild(...D))},H.emit=(...D)=>{U.push(km(...D))},J({context:Y.context,event:Y.event,enqueue:H,check:(D)=>R8.evaluateGuard(D,X.context,Y.event,X),self:$.self,system:$.system},W),[X,void 0,U]}function EV$($){function X(Y,W){throw Error("This isn't supposed to be called")}return X.type="xstate.enqueueActions",X.collect=$,X.resolve=LV$,X}function PV$($,X,Y,W,{value:J,label:U}){return[X,{value:typeof J==="function"?J(Y,W):J,label:U},void 0]}function IV$({logger:$},{value:X,label:Y}){if(Y)$(Y,X);else $(X)}function _V$($=({context:Y,event:W})=>({context:Y,event:W}),X){function Y(W,J){throw Error("This isn't supposed to be called")}return Y.type="xstate.log",Y.value=$,Y.label=X,Y.resolve=PV$,Y.execute=IV$,Y}TV$.SpecialTargets=WH;TV$.emit=km;TV$.enqueueActions=EV$;TV$.forwardTo=RV$;TV$.log=_V$;TV$.sendParent=vm;TV$.sendTo=UH});var pm=X$((um)=>{Object.defineProperty(um,"__esModule",{value:!0});var Y7=Sm(),_6=eX(),hO=xm(),ym=JH(),O0=hm();oG();function yV$($,X){let Y=_6.toArray(X);if(!Y.some((J)=>_6.matchesEventDescriptor($.type,J))){let J=Y.length===1?`type matching "${Y[0]}"`:`one of types matching "${Y.join('", "')}"`;throw Error(`Expected event ${JSON.stringify($)} to have ${J}`)}}function fm($,X){return new hO.StateMachine($,X)}function J7($){let X=_6.createActor($);return{self:X,defer:()=>{},id:"",logger:()=>{},sessionId:"",stopChild:()=>{},system:X.system,emit:()=>{},actionExecutor:()=>{}}}function fV$($,...[X]){let Y=J7($);return $.getInitialSnapshot(Y,X)}function gV$($,X,Y){let W=J7($);return W.self._snapshot=X,$.transition(X,Y,W)}function gm({schemas:$,actors:X,actions:Y,guards:W,delays:J}){return{assign:ym.assign,sendTo:O0.sendTo,raise:_6.raise,log:O0.log,cancel:_6.cancel,stopChild:_6.stopChild,enqueueActions:O0.enqueueActions,emit:O0.emit,spawnChild:_6.spawnChild,createStateConfig:(U)=>U,createAction:(U)=>U,createMachine:(U)=>fm({...U,schemas:$},{actors:X,actions:Y,guards:W,delays:J}),extend:(U)=>gm({schemas:$,actors:X,actions:{...Y,...U.actions},guards:{...W,...U.guards},delays:{...J,...U.delays}})}}class mm{constructor(){this.timeouts=new Map,this._now=0,this._id=0,this._flushing=!1,this._flushingInvalidated=!1}now(){return this._now}getId(){return this._id++}setTimeout($,X){this._flushingInvalidated=this._flushing;let Y=this.getId();return this.timeouts.set(Y,{start:this.now(),timeout:X,fn:$}),Y}clearTimeout($){this._flushingInvalidated=this._flushing,this.timeouts.delete($)}set($){if(this._now>$)throw Error("Unable to travel back in time");this._now=$,this.flushTimeouts()}flushTimeouts(){if(this._flushing){this._flushingInvalidated=!0;return}this._flushing=!0;let $=[...this.timeouts].sort(([X,Y],[W,J])=>{let U=Y.start+Y.timeout;return J.start+J.timeout>U?-1:1});for(let[X,Y]of $){if(this._flushingInvalidated){this._flushingInvalidated=!1,this._flushing=!1,this.flushTimeouts();return}if(this.now()-Y.start>=Y.timeout)this.timeouts.delete(X),Y.fn.call(null)}this._flushing=!1}increment($){this._now+=$,this.flushTimeouts()}}function mV$($){return new Promise((X,Y)=>{$.subscribe({complete:()=>{X($.getSnapshot().output)},error:Y})})}function uV$($,X,Y){let W=[],J=J7($);return J.actionExecutor=(H)=>{W.push(H)},[$.transition(X,Y,J),W]}function pV$($,...[X]){let Y=[],W=J7($);return W.actionExecutor=(U)=>{Y.push(U)},[$.getInitialSnapshot(W,X),Y]}function cV$($,X,Y){let W=J7($),{microsteps:J}=_6.macrostep(X,Y,W,[]);return J}function dV$($,...[X]){let Y=J7($),W=_6.createInitEvent(X),J=[],U=$._getPreInitialState(Y,W,J),H=_6.initialMicrostep($.root,U,Y,W,J),{microsteps:D}=_6.macrostep(H[0],W,Y,J);return[H,...D]}function lV$($){let X=[],Y=$._nodes.filter(_6.isAtomicStateNode),W=new Set;for(let J of Y)for(let U of[J].concat(_6.getProperAncestors(J,void 0))){if(W.has(U.id))continue;W.add(U.id);for(let[,H]of U.transitions)X.push(...H);if(U.always)X.push(...U.always)}return X}var iV$={timeout:1/0};function rV$($,X,Y){let W={...iV$,...Y};return new Promise((J,U)=>{let{signal:H}=W;if(H?.aborted){U(H.reason);return}let D=!1;if(W.timeout<0)console.error("`timeout` passed to `waitFor` is negative and it will reject its internal promise immediately.");let V=W.timeout===1/0?void 0:setTimeout(()=>{K(),U(Error(`Timeout of ${W.timeout} ms exceeded`))},W.timeout),K=()=>{if(clearTimeout(V),D=!0,F?.unsubscribe(),q)H.removeEventListener("abort",q)};function Q(w){if(X(w))K(),J(w)}let q,F;if(Q($.getSnapshot()),D)return;if(H)q=()=>{K(),U(H.reason)},H.addEventListener("abort",q);if(F=$.subscribe({next:Q,error:(w)=>{K(),U(w)},complete:()=>{K(),U(Error("Actor terminated without satisfying predicate"))}}),D)F.unsubscribe()})}um.createEmptyActor=Y7.createEmptyActor;um.fromCallback=Y7.fromCallback;um.fromEventObservable=Y7.fromEventObservable;um.fromObservable=Y7.fromObservable;um.fromPromise=Y7.fromPromise;um.fromTransition=Y7.fromTransition;um.Actor=_6.Actor;um.__unsafe_getAllOwnEventDescriptors=_6.getAllOwnEventDescriptors;um.and=_6.and;um.cancel=_6.cancel;um.createActor=_6.createActor;um.getStateNodes=_6.getStateNodes;um.interpret=_6.interpret;um.isMachineSnapshot=_6.isMachineSnapshot;um.matchesState=_6.matchesState;um.not=_6.not;um.or=_6.or;um.pathToStateValue=_6.pathToStateValue;um.raise=_6.raise;um.spawnChild=_6.spawnChild;um.stateIn=_6.stateIn;um.stop=_6.stop;um.stopChild=_6.stopChild;um.toObserver=_6.toObserver;um.StateMachine=hO.StateMachine;um.StateNode=hO.StateNode;um.assign=ym.assign;um.SpecialTargets=O0.SpecialTargets;um.emit=O0.emit;um.enqueueActions=O0.enqueueActions;um.forwardTo=O0.forwardTo;um.log=O0.log;um.sendParent=O0.sendParent;um.sendTo=O0.sendTo;um.SimulatedClock=mm;um.assertEvent=yV$;um.createMachine=fm;um.getInitialMicrosteps=dV$;um.getInitialSnapshot=fV$;um.getMicrosteps=cV$;um.getNextSnapshot=gV$;um.getNextTransitions=lV$;um.initialTransition=pV$;um.setup=gm;um.toPromise=mV$;um.transition=uV$;um.waitFor=rV$});var C$;var yO=A(()=>{C$=n1(pm(),1)});function dm($){let X=[],Y=null,W=0;for(let J of $){W+=J.toolCalls.length;let U=new Map;for(let H of J.toolCalls)if(H.toolCallId){let D=uK$.safeParse(H.input);if(D.success)U.set(H.toolCallId,D.data)}for(let H of J.toolResults){if(H.output===null)continue;let D=LW.safeParse(H.output);if(D.success){Y={toolName:D.data.toolName,description:D.data.description,args:D.data.args};continue}let V=JY.safeParse(H.output);if(!V.success){X.push({toolName:H.toolName});continue}let K=H.toolCallId?U.get(H.toolCallId):void 0,Q={toolName:H.toolName};if(K!==void 0)Q.args=K;let q=RW.safeParse(V.data);if(q.success&&q.data.data!=null){Q.data=q.data.data;let F=pK$.safeParse(q.data.data);if(F.success)Q.jobId=F.data.jobId}X.push(Q)}}return{toolResults:X,pendingConfirmation:Y,totalToolCalls:W}}var uK$,pK$,U9,cm;var lm=A(()=>{yO();R$();$X();uK$=Z.record(Z.unknown()),pK$=Z.object({jobId:Z.string()}).passthrough(),U9={promptTokens:0,completionTokens:0,totalTokens:0},cm=C$.setup({types:{context:{},events:{}},actors:{processMessage:C$.fromPromise(async()=>{throw Error("processMessage actor not provided")}),executeConfirmedAction:C$.fromPromise(async()=>{throw Error("executeConfirmedAction actor not provided")})}}).createMachine({id:"agent",initial:"idle",context:{conversationId:"",message:"",interfaceType:"agent",channelId:"",channelName:"",userPermissionLevel:"public",response:null,pendingConfirmation:null,error:null},states:{idle:{on:{RECEIVE_MESSAGE:{target:"processing",actions:C$.assign(({event:$})=>({message:$.message,conversationId:$.conversationId,interfaceType:$.interfaceType,channelId:$.channelId,channelName:$.channelName,userPermissionLevel:$.userPermissionLevel,response:null,pendingConfirmation:null,error:null}))}}},processing:{invoke:{src:"processMessage",input:({context:$})=>({conversationId:$.conversationId,message:$.message,interfaceType:$.interfaceType,channelId:$.channelId,channelName:$.channelName,userPermissionLevel:$.userPermissionLevel}),onDone:[{guard:({event:$})=>!!$.output.pendingConfirmation,target:"awaitingConfirmation",actions:C$.assign(({event:$})=>({response:$.output,pendingConfirmation:$.output.pendingConfirmation??null}))},{target:"idle",actions:C$.assign(({event:$})=>({response:$.output}))}],onError:{target:"idle",actions:C$.assign(({event:$})=>({error:$.error instanceof Error?$.error.message:"Unknown error",response:{text:$.error instanceof Error?`Error: ${$.error.message}`:"An unexpected error occurred.",usage:U9}}))}}},awaitingConfirmation:{on:{CONFIRM:{target:"executing"},CANCEL:{target:"idle",actions:C$.assign(({context:$})=>({response:{text:`Action cancelled: ${$.pendingConfirmation?.description??"unknown action"}`,usage:U9},pendingConfirmation:null}))}}},executing:{invoke:{src:"executeConfirmedAction",input:({context:$})=>{if(!$.pendingConfirmation)throw Error("No pending confirmation in executing state");return{conversationId:$.conversationId,pendingConfirmation:$.pendingConfirmation}},onDone:{target:"idle",actions:C$.assign(({event:$})=>({response:$.output,pendingConfirmation:null}))},onError:{target:"idle",actions:C$.assign(({context:$,event:X})=>({error:X.error instanceof Error?X.error.message:"Unknown error",response:{text:`Error executing ${$.pendingConfirmation?.toolName??"action"}: ${X.error instanceof Error?X.error.message:"Unknown error"}`,usage:U9},pendingConfirmation:null}))}}}}})});class _1{mcpService;conversationService;identityService;profileService;static instance=null;logger;stepLimit;agentFactory;providedMachine=cm.provide({actors:{processMessage:C$.fromPromise(async({input:$})=>this.processMessage($)),executeConfirmedAction:C$.fromPromise(async({input:$})=>this.executeConfirmedAction($))}});conversationActors=new Map;agent=null;static getInstance($,X,Y,W,J,U){return _1.instance??=new _1($,X,Y,W,J,U),_1.instance}static resetInstance(){if(_1.instance){for(let $ of _1.instance.conversationActors.values())$.stop();_1.instance.conversationActors.clear()}_1.instance=null}static createFresh($,X,Y,W,J,U){return new _1($,X,Y,W,J,U)}constructor($,X,Y,W,J,U){this.mcpService=$;this.conversationService=X;this.identityService=Y;this.profileService=W;this.logger=J.child("AgentService"),this.stepLimit=U.stepLimit??cK$,this.agentFactory=U.agentFactory}getAgent(){return this.agent??=this.agentFactory({identity:this.identityService.getCharacter(),profile:this.profileService.getProfile(),tools:this.mcpService.listTools().map(($)=>$.tool),pluginInstructions:this.mcpService.getInstructions(),stepLimit:this.stepLimit,getToolsForPermission:($)=>this.mcpService.listToolsForPermissionLevel($).map((X)=>X.tool)}),this.agent}invalidateAgent(){this.agent=null,this.logger.debug("Agent invalidated, will be recreated on next chat")}getConversationActor($){let X=this.conversationActors.get($);if(!X)X=C$.createActor(this.providedMachine),X.start(),this.conversationActors.set($,X);return X}async chat($,X,Y){let W=Y?.userPermissionLevel??"public",J=Y?.interfaceType??"agent",U=Y?.channelId??X,H=Y?.channelName??U;this.logger.debug("Processing chat message",{conversationId:X,messageLength:$.length,userPermissionLevel:W});let D=this.getConversationActor(X);return D.send({type:"RECEIVE_MESSAGE",message:$,conversationId:X,interfaceType:J,channelId:U,channelName:H,userPermissionLevel:W}),(await C$.waitFor(D,(K)=>K.matches("idle")||K.matches("awaitingConfirmation"))).context.response??{text:"No response generated.",usage:U9}}async confirmPendingAction($,X){let Y=this.conversationActors.get($);if(!Y?.getSnapshot().matches("awaitingConfirmation"))return{text:"No pending action to confirm.",usage:U9};return Y.send({type:X?"CONFIRM":"CANCEL"}),(await C$.waitFor(Y,(J)=>J.matches("idle"))).context.response??{text:"Action completed.",usage:U9}}async processMessage($){let{conversationId:X,message:Y,interfaceType:W,channelId:J,channelName:U,userPermissionLevel:H}=$;await this.conversationService.startConversation(X,W,J,{channelName:U,interfaceType:W,channelId:J});let V=(await this.conversationService.getMessages(X,{limit:50})).map((N)=>{if(N.role==="user")return{role:"user",content:N.content};if(N.role==="assistant")return{role:"assistant",content:[{type:"text",text:N.content}]};return{role:"system",content:N.content}});V.push({role:"user",content:Y});let K=this.mcpService.listToolsForPermissionLevel(H).map((N)=>N.tool.name);this.logger.debug("Available tools for this call",{toolCount:K.length,tools:K}),await this.conversationService.addMessage(X,"user",Y);let Q={userPermissionLevel:H,conversationId:X,channelId:J,channelName:U,interfaceType:W},q=await this.getAgent().generate({messages:V,options:Q});if(q.text.trim())await this.conversationService.addMessage(X,"assistant",q.text);let{toolResults:F,pendingConfirmation:w,totalToolCalls:z}=dm(q.steps);this.logger.debug("Chat completed",{conversationId:X,responseLength:q.text.length,toolCalls:z,stepCount:q.steps.length,usage:q.usage});let O={text:q.text,toolResults:F,usage:{promptTokens:q.usage.inputTokens??0,completionTokens:q.usage.outputTokens??0,totalTokens:q.usage.totalTokens??0}};if(w)O.pendingConfirmation=w;return O}async executeConfirmedAction($){let{conversationId:X,pendingConfirmation:Y}=$,J=this.mcpService.listTools().find((V)=>V.tool.name===Y.toolName);if(!J)return{text:`Error: Tool '${Y.toolName}' not found.`,usage:U9};let U={interfaceType:"agent",userId:"agent-user"},H=await J.tool.handler(Y.args,U),D=`Completed: ${Y.description}
310
-
311
- Result: ${JSON.stringify(H,null,2)}`;return await this.conversationService.addMessage(X,"assistant",D),{text:D,usage:{promptTokens:0,completionTokens:0,totalTokens:0}}}}var cK$=10;var im=A(()=>{lm();yO()});function fO($,X,Y,W){return async(J)=>{if(W){let U={toolName:$,args:J,conversationId:Y.conversationId,interfaceType:Y.interfaceType,...Y.channelId!==void 0&&{channelId:Y.channelId},...Y.channelName!==void 0&&{channelName:Y.channelName}};W.emit("tool:invoking",U)}try{let U=await X(J);if(W){let H={toolName:$,conversationId:Y.conversationId,interfaceType:Y.interfaceType,...Y.channelId!==void 0&&{channelId:Y.channelId},...Y.channelName!==void 0&&{channelName:Y.channelName}};W.emit("tool:completed",H)}return U}catch(U){if(W){let H={toolName:$,error:g6(U),conversationId:Y.conversationId,interfaceType:Y.interfaceType,...Y.channelId!==void 0&&{channelId:Y.channelId},...Y.channelName!==void 0&&{channelName:Y.channelName}};W.emit("tool:failed",H)}throw U}}}function gO($,X="brain-agent"){return{emit:(Y,W)=>{$.send(Y,W,X)}}}var mO=A(()=>{R$()});function rm($,X,Y){let W={};for(let J of $){let U=fO(J.name,async(H)=>{let D={interfaceType:X.interfaceType,userId:"agent-user",channelId:X.channelId??X.conversationId,...X.channelName&&{channelName:X.channelName}};return J.handler(H,D)},X,Y);W[J.name]=IZ({description:J.description,inputSchema:Z.object(J.inputSchema),execute:U})}return W}function lK$($,X,Y,W){let J="";if(X==="anchor")J=`
312
- ## Current User
313
- **You are speaking with your ANCHOR${W?.name?` (${W.name})`:""} (owner).** This is the person who created and manages you.
314
- Address them personally and recognize that they know you well.`;else if(X==="trusted")J=`
315
- ## Current User
316
- You are speaking with a **trusted user** who has elevated access but is not the owner.`;else J=`
317
- ## Current User
318
- You are speaking with a **public user** with limited access.`;let U="";if(W){let H=[W.name&&`**Name:** ${W.name}`,W.email&&`**Email:** ${W.email}`,W.website&&`**Website:** ${W.website}`,W.description&&`**Bio:** ${W.description}`].filter(Boolean);if(H.length>0)U=`
319
- ## Your Anchor
320
- ${H.join(`
321
- `)}`}return`# ${$.name}
322
-
323
- **Role:** ${$.role}
324
- **Purpose:** ${$.purpose}
325
- **Values:** ${$.values.join(", ")}
326
- ${U}
327
- ${J}
328
-
329
- ## Agent Instructions
330
-
331
- You are an AI assistant with access to tools for managing a personal knowledge system.
332
-
333
- ### Identity vs Profile
334
- - **Identity**: This is YOU \u2014 the brain's persona, role, purpose, and values (shown above)
335
- - **Profile**: This is your ANCHOR \u2014 the person who owns and manages this brain (shown above)
336
- - When someone asks "who are you?" \u2192 describe yourself using your identity
337
- - When someone asks "who owns this?" \u2192 describe your anchor using the profile
338
- - When your anchor is talking to you, address them personally (they created you!)
339
-
340
- ### Entity Type Mapping
341
- Users say different things than the internal entity types. Always map:
342
- - "blog post", "post", "essay", "article" \u2192 entityType: \`post\`
343
- - "case study", "portfolio piece", "project" \u2192 entityType: \`project\`
344
- - "presentation", "deck", "slides" \u2192 entityType: \`deck\`
345
- - "bookmark", "link", "saved link" \u2192 entityType: \`link\`
346
- - "note", "notes", "memo", "base" \u2192 entityType: \`base\`
347
- - When the user asks to list/show/browse a mapped entity type, call \`system_list\` with the mapped \`entityType\`. For example, "show me my case studies" means \`system_list({ entityType: "project" })\`, not search.
348
- - If the user's category word does not map to a known entity type (for example "foo items"), do not fan out across every entity type with repeated \`system_list\` calls. Use one broad \`system_search\` with that term, then answer from those results or say you did not find a specific matching category.
349
-
350
- ### Core Tools
351
- - **\`system_create\`** \u2014 creates ANY entity type: notes, blog posts, social posts, newsletters, images, decks, links, and agents. Pass \`entityType\` to specify what to create. Use \`prompt\` for AI generation, \`content\` for direct creation, or \`url\` for URL-first flows like saving a link or adding a remote agent. **ALWAYS use this tool when the user asks to create, generate, write, save, or capture content** \u2014 never just write text in the response. The content must be persisted as an entity.
352
- - If the user provides finalized/exact/approved content, or says \u201Cexactly\u201D, \u201Cas written\u201D, \u201Cdo not rewrite\u201D, \u201Cdo not regenerate\u201D, or similar, call \`system_create\` with \`content\` containing the user-provided text. Do **not** pass that text as \`prompt\`; \`prompt\` is only for requests where the user wants you to generate or transform content.
353
- - For lightweight capture requests like \u201Csave this memo about the launch timeline\u201D, \u201Ccapture this note\u201D, or uploaded text files, treat the user\u2019s words or file text as sufficient source material. Create a \`base\` entity immediately with \`content\` instead of asking for more detail unless the request is truly empty.
354
- - **\`system_get\`** / **\`system_list\`** / **\`system_search\`** \u2014 read entities. Use \`system_search\` for semantic queries, \`system_list\` for browsing by type, \`system_get\` for a specific entity by ID or slug. When the user asks for a content overview or summary, use \`system_list\` to show actual content \u2014 not \`system_insights\` (which only gives aggregate stats). Do not combine \`system_insights\` with \`system_list\` for a general content overview unless the user explicitly asks for analytics.
355
- - **\`system_update\`** \u2014 modify an entity's content or metadata. Use this for title changes, status updates, content edits, or any field modification.
356
- - **\`system_delete\`** \u2014 remove an entity. Always attempt the delete when asked \u2014 the tool handles confirmation.
357
- - **\`system_set-cover\`** \u2014 attach an existing image to an entity as its cover.
358
- - **\`system_extract\`** \u2014 derive entities from existing content (e.g., extract topics from posts).
359
- - **\`system_insights\`** \u2014 get analytics and stats about your content (topic distribution, publishing cadence, etc.).
360
- - **\`directory-sync_sync\`** \u2014 sync the brain with the filesystem and git. Use this when the user asks to sync, refresh from disk, pull the latest changes, or **back up the brain to git**.
361
- - **\`directory-sync_status\`** \u2014 check sync/git state without changing anything.
362
- - **\`directory-sync_history\`** \u2014 get version history for any entity from git. Pass \`entityType\` and \`id\`. Without \`sha\`: returns commit list. With \`sha\`: returns content at that version.
363
-
364
- ### Image & Cover Operations
365
- - To **generate a cover image**, use \`system_create\` with \`entityType: "image"\`, a \`prompt\`, and pass \`targetEntityType\`/\`targetEntityId\` as top-level fields. This generates the image AND sets it as cover in one step.
366
- Example: \`system_create({ entityType: "image", prompt: "...", targetEntityType: "post", targetEntityId: "my-post" })\`
367
- - Requests like **"create a new cover"**, **"replace the cover image"**, **"I don't like this cover, make a new one"**, or **"regenerate the cover"** are all the same operation: generate a new image and attach it to the target entity. These are **fulfillable** requests, not wishlist requests.
368
- - If the user gives a **quoted exact title/slug/id** for a post or page, resolve it with \`system_get\` first.
369
- - If the user refers to an existing post/page/item by a **fuzzy name** rather than an exact ID, resolve it with \`system_search\`, then pass the **canonical entity ID** to \`system_create\`.
370
- - For partial references like "my resilience post", "the drama blog post", or "that urban sensing article", prefer \`system_search\`. **Do not invent or guess slugs/IDs** for cover-image targets.
371
- - If an exact \`system_get\` lookup fails, say that target was **not found**. Do **not** silently substitute a semantically similar post from \`system_search\` unless the user explicitly confirms it is the same one.
372
- - On a follow-up like "is it ready?" after a failed cover-generation request, answer in the form: **"It failed because the target post was not found."** Do **not** say "not yet" or imply the job is still pending.
373
- - Once you have identified the post, **immediately call** \`system_create\` with \`entityType: "image"\`; do not stop at lookup and do not convert the request into a wish.
374
- - **Never create a \`wish\` for cover-image generation or replacement requests.** This capability is available via \`system_create\` with \`entityType: "image"\`.
375
- - To **set an existing image** as cover, use \`system_set-cover\` with the \`imageId\`.
376
- - For direct requests like **"set image X as the cover for post Y"**, call \`system_set-cover\` **immediately** with those identifiers. Do **not** preflight with \`system_get\` or \`system_search\` unless the post or image reference is actually ambiguous.
377
- - Let \`system_set-cover\` validate whether the post or image exists.
378
- - Do NOT look for an \`image_generate\` tool \u2014 it does not exist. All image creation goes through \`system_create\`.
379
-
380
- ### Tool Usage Rules
381
- - **ALWAYS use your available tools** \u2014 you have many tools, USE THEM proactively
382
- - **Never claim you don't have access** \u2014 if a tool exists for something, use it immediately
383
- - **Always attempt tool calls** \u2014 let the tool validate inputs and report errors rather than refusing preemptively. Never skip a tool call because you think an entity might not exist.
384
- - Exception for A2A: do **not** call \`a2a_call\` just to validate a raw URL, a display name, an ambiguous agent reference, or an unsaved agent. Ask the user to add/save or clarify the agent first.
385
- - **Be efficient** \u2014 use the minimum number of tool calls needed
386
- - **Always specify target entities** \u2014 when an operation relates to an existing entity, pass its type and ID
387
- - For explicit update requests (rename, retitle, change status, edit fields/content), still call \`system_update\` even if a prior lookup suggests the entity already has that value. Do not stop at "no change needed" without the update tool call.
388
- - If the user says **backup to git**, **sync to git**, **pull the latest from git**, or **refresh from the filesystem**, treat that as a \`directory-sync_sync\` request, not just a status check
389
- - Use \`directory-sync_status\` only for questions about state like "what's my sync status?"
390
- - If a request is fulfillable with an existing tool, **do not** create a wishlist item instead. Wishlist creation is only for truly unavailable capabilities.
391
- - For agent-contact requests (\`ask\`, \`message\`, \`contact\`, \`reach out to\` an agent), treat the referenced agent as an **agent directory lookup first**, not as a content search query.
392
- - If an agent-contact request uses a display/contact name instead of an exact saved local id/domain (for example \`Brain\` rather than \`yeehaa.io\`), first inspect the saved \`agent\` directory with \`system_list({ entityType: "agent" })\`; if multiple saved agents match, ask the user to choose and name the matching saved ids.
393
- - For those agent-contact requests, the local \`agent\` directory is the allowlist: if the target agent is missing, URL-only, archived, or ambiguous, do **not** create a wish or any other entity.
394
- - If the user gives a full agent URL, do not pass that URL to \`a2a_call\`. Use a saved local agent id only; otherwise tell the user to add/save that agent first.
395
- - If the user explicitly asks you to add or save an agent, use \`system_create\` with \`entityType: "agent"\` and pass the domain or URL in \`url\`.
396
- - If multiple saved agents could match a name-based agent reference, ask a concise clarification question naming the matching saved agent ids, then stop there. Never choose the first match.
397
- - Regenerating or replacing a cover image for an existing post is **fulfillable**: resolve the target post, then call \`system_create\` with \`entityType: "image"\`.
398
- - Summarize tool results concisely rather than showing raw output
399
-
400
- ### CRITICAL: Agent Directory Overrides
401
- - These rules override the general wishlist rule and the general "always attempt tool calls" rule.
402
- - For requests to **ask, message, contact, or reach out to an agent**, handle the target as an **agent directory reference**, not as a content/topic search.
403
- - Only call \`a2a_call\` when you already have **one exact saved local agent id** such as \`yeehaa.io\`.
404
- - **Never** pass a display name like \`Brain\` to \`a2a_call\`.
405
- - **Never** pass a full URL like \`https://yeehaa.io/a2a\` to \`a2a_call\`.
406
- - If the user gives a full URL for an agent and it is not already being referenced by one exact saved local agent id, tell the user to add/save that agent first.
407
- - A raw agent URL is a **save-first prerequisite**, not an unsupported capability. Do not convert URL-based agent-contact requests into a wishlist item.
408
- - The same rule applies to a bare unsaved agent id or domain like \`unknown-agent.io\`: tell the user to add/save it first, and do not convert that request into a wishlist item.
409
- - If the previous turn identified exactly one unsaved agent domain and asked or told the user to add/save it first, treat a short affirmative follow-up like "yes", "yes please", "please do", "go ahead", or "do that" as an explicit request to save that same agent with \`system_create\`.
410
- - Do not repeat the save-first instruction after such an affirmative follow-up. Call \`system_create({ entityType: "agent", url: "that-domain" })\` immediately.
411
- - If the agent reference is ambiguous across multiple saved agents, ask a concise clarification question naming the matching saved ids, then stop there. Never choose one candidate based on list order.
412
- - If the user uses a display/contact name like \`Brain\`, inspect saved agents with \`system_list({ entityType: "agent" })\` before deciding whether it is ambiguous; do not answer with a generic clarification that omits the actual saved ids.
413
- - After asking that clarification question, end the turn immediately. Do **not** call \`a2a_call\` afterward in the same turn.
414
- - If the target agent is missing, URL-only, archived, or ambiguous, do **not** create a \`wish\`, reminder, todo, note, fallback task, or any other entity.
415
- - Specifically: for these agent-contact cases, never call \`system_create\` with \`entityType: "wish"\`.
416
- - For these invalid agent-contact cases, it is correct to reply **without calling any tool at all** unless the user explicitly asks you to add/save/unarchive the agent.
417
- - Example: if the user says "Ask https://unknown-agent.io about X", do **not** call \`a2a_call\` and do **not** call \`system_create\` for a wish. Tell them to add/save that agent first.
418
- - Example: if the user says "Can you message this agent URL for me: https://unknown-agent.io/a2a?", do **not** create a wish. Tell them the agent must be saved first.
419
- - Example: if the user says "Ask Brain about X" and both \`yeehaa.io\` and \`brain-labs.io\` are saved as Brain, ask the user to choose between those two saved ids and do not call \`a2a_call\`.
420
-
421
- ### Multi-Turn Context
422
- - **Remember previous results** \u2014 when the user says "that post", "the first one", "it", refer back to entities from earlier turns
423
- - After listing entities, remember their IDs so you can get details without asking the user to repeat themselves
424
- - If you just created or queued a post/social post in the previous turn and the user says **"that post"** or asks for a follow-up action like **"now generate a cover image for that post"**, treat it as referring to the item you just created \u2014 do **not** search for alternate posts unless the reference is genuinely ambiguous
425
- - If the previous turn created or queued a LinkedIn/social post, preserve that entity type on follow-up actions: use \`targetEntityType: "social-post"\`, not \`post\`.
426
- - For those immediate follow-up cover requests, call \`system_create\` with \`entityType: "image"\` right away. Pass \`targetEntityType\`, and include \`targetEntityId\` if you know it from prior tool results`+(Y&&Y.length>0?`
427
-
428
- ### Plugin-Specific Behavior (MANDATORY)
429
-
430
- ${Y.join(`
431
-
432
- `)}`:"")+`
433
-
434
- ### Proactive Search Behavior
435
- - **ALWAYS search automatically** when the user asks about their content, usage, or knowledge
436
- - Questions like "how do I/we use X?", "what have I said about X?", "where did I mention X?" \u2192 search immediately
437
- - **NEVER ask "would you like me to search?"** - just search. The user asked a question about their knowledge
438
- - If the user references themselves, their name, or "us/we", assume they want you to search their content
439
- - Start with **one broad \`system_search\`** unless the user explicitly asked for a specific entity type
440
- - Do **not** fan out into many per-type searches unless one focused follow-up is truly necessary
441
- - For unknown categories or made-up labels like "foo items", use the broad search result only; do not enumerate every entity type with separate list calls.
442
- - After searching, give the best answer you can from the results you have
443
- - Do **not** end with offers like "I can search more", "I can broaden the search", or "let me know if you'd like me to search" after you've already searched
444
-
445
- ### CRITICAL: Always Invoke Tools for Actions
446
- - **NEVER claim an action is done without invoking a tool first**
447
- - Saying "Done!", "Complete!", "Captured!", "Started!" without a tool call is FABRICATION
448
- - If the user asks you to do something (capture, build, sync, delete, create), you MUST invoke the relevant tool
449
- - **Every action request requires a tool invocation** - even if you did it before
450
- - If the user asks to "build again", "do it again", or repeats a request, you MUST call the tool again
451
- - **NEVER mimic previous responses** - your conversation history shows past outputs, but you must still invoke tools
452
- - Do not mention job IDs, batch IDs, or internal identifiers in your response - just confirm the action was started
453
- - If a tool call fails, report the actual error - do not invent a success response
454
- - If a previous action in the conversation already failed, do **not** describe it as pending, running, or waiting for confirmation. State that it failed and why.
455
- - Only check status for work that was actually queued or started successfully.
456
- - For async operations (capture, build, sync): say "queued" or "started", NOT "Done!" - you don't know the outcome yet
457
- - If a URL or resource might be inaccessible (private repos, auth-required pages), mention this caveat
458
-
459
- ### Destructive Operations
460
- For these operations, ask for confirmation before executing:
461
- - Deleting entities (notes, links, etc.)
462
- - Publishing content
463
- - Modifying system settings
464
- - Archiving agents/contacts via \`system_update\`
465
-
466
- When asking for confirmation, clearly describe what will happen.
467
-
468
- ### Entity-Specific Update Rules
469
- - To approve a discovered contact/agent, use \`system_update\` on \`entityType: "agent"\` with \`id\` set to the saved local agent id and \`fields.status\` set to \`"approved"\`. Do not call \`system_update\` for approval without \`fields\`.
470
- - To archive or remove a contact/agent, use \`system_update\` on \`entityType: "agent"\` and set \`fields.status\` to \`"archived"\`
471
- - To attach an existing image as a cover, use \`system_set-cover\` even if you are not fully sure the image exists yet \u2014 let the tool validate it
472
- - When a user asks to publish a latest social post, check the queue/list state first and describe the latest draft or post clearly
473
-
474
- ### Response Style
475
- - **Match response length to question complexity** - simple questions get short answers
476
- - Don't repeat information - state things once
477
- - For empty results, a brief acknowledgment is enough (e.g., "No items found yet")
478
- - Use markdown sparingly - avoid excessive headers and bullet points for simple responses
479
- - If you don't know something, say so concisely`}function uO($){let{model:X,modelId:Y,webSearch:W,temperature:J,maxTokens:U,messageBus:H}=$,D=gO(H);return function(K){let Q=rm(K.tools,{conversationId:"",interfaceType:"agent"},D);return new yf({model:X,callOptionsSchema:dK$,prepareCall:({options:q,...F})=>{let w=K.getToolsForPermission(q.userPermissionLevel),z=w.map((N)=>N.name),O=rm(w,{conversationId:q.conversationId,channelId:q.channelId,channelName:q.channelName,interfaceType:q.interfaceType},D);return{...F,instructions:lK$(K.identity,q.userPermissionLevel,K.pluginInstructions,K.profile),tools:O,activeTools:z,...J!==void 0&&dJ(Y)&&{temperature:J},...U!==void 0&&{maxTokens:U},...W&&{providerOptions:{anthropic:{webSearch:!0}}}}},tools:Q,stopWhen:pJ(K.stepLimit??10)})}}var dK$;var nm=A(()=>{lG();R$();nG();mO();dK$=Z.object({userPermissionLevel:Z.enum(["anchor","trusted","public"]),conversationId:Z.string(),channelId:Z.string().optional(),channelName:Z.string().optional(),interfaceType:Z.string()})});var GH=A(()=>{cg();nG();dg();im();nm();mO()});class HH{dependencies;constructor($){this.dependencies=$}applyTemplateScoping($,X){if(!X)return $;if($.includes(":"))return $;return`${X}:${$}`}toContentTemplate($){let X={name:$.name,description:$.description,schema:$.schema,requiredPermission:$.requiredPermission};if($.basePrompt)X.basePrompt=$.basePrompt;if($.formatter)X.formatter=$.formatter;if($.dataSourceId)X.dataSourceId=$.dataSourceId;return X}getTemplate($){let X=this.dependencies.templateRegistry.get($);if(!X)return null;return this.toContentTemplate(X)}listTemplates(){return this.dependencies.templateRegistry.list().filter(($)=>$.basePrompt??$.formatter).map(($)=>this.toContentTemplate($))}async resolveContent($,X,Y){let W=this.applyTemplateScoping($,Y),J=this.dependencies.templateRegistry.get(W);if(!J)return this.dependencies.logger.debug(`Template not found: ${W}`),null;if(J.dataSourceId&&r8.canFetch(J)){let U=this.dependencies.dataSourceRegistry.get(J.dataSourceId);if(U)try{if(U.fetch){let H={...X?.publishedOnly!==void 0&&{publishedOnly:X.publishedOnly},entityService:this.createScopedEntityService(X?.publishedOnly)},D=await U.fetch(X?.dataParams,J.schema,H);if(D!==void 0)return this.dependencies.logger.debug(`Resolved content via DataSource fetch for ${W}`),D}}catch(H){this.dependencies.logger.debug(`DataSource operation failed for ${W}`,{error:H})}}if(X?.savedContent)if(!J.formatter)this.dependencies.logger.warn(`Template ${W} has no formatter but saved content was requested. Templates must have a formatter to parse entity-stored content.`);else try{let U=await this.dependencies.entityService.getEntity(X.savedContent.entityType,X.savedContent.entityId);if(U?.content)return this.dependencies.logger.debug(`Resolved content from saved entity for ${W}`),this.parseContent(W,U.content)}catch(U){this.dependencies.logger.debug(`No saved content found for ${W}: ${X.savedContent.entityType}/${X.savedContent.entityId}`,{error:U})}if(X?.fallback!==void 0)try{let U=J.schema.parse(X.fallback);return this.dependencies.logger.debug(`Using fallback content for ${W}`),U}catch(U){this.dependencies.logger.debug(`Fallback content validation failed for ${W}`,{error:U})}return this.dependencies.logger.debug(`No content could be resolved for ${W}`),null}createScopedEntityService($){let X=this.dependencies.entityService;if(!$)return X;return new Proxy(X,{get(Y,W,J){if(W==="listEntities")return(H,D)=>{let V=D?.filter?.metadata?.status!==void 0;return Y.listEntities(H,{...D,...!V&&{publishedOnly:!0}})};if(W==="countEntities")return(H,D)=>{let V=D?.filter?.metadata?.status!==void 0;return Y.countEntities(H,{...D,...!V&&{publishedOnly:!0}})};let U=Reflect.get(Y,W,J);if(typeof U==="function")return U.bind(Y);return U}})}async generateContent($,X={},Y){let W=this.applyTemplateScoping($,Y),J=this.getTemplate(W);if(!J)throw Error(`Template not found: ${W}`);let U=J;if(!U.dataSourceId)throw Error(`Template ${W} doesn't support content generation. Add dataSourceId to enable generation through DataSource pattern.`);let H=this.dependencies.dataSourceRegistry.get(U.dataSourceId);if(!H)throw Error(`DataSource ${U.dataSourceId} not found`);if(!H.generate)throw Error(`Template ${W} uses DataSource ${U.dataSourceId} which doesn't support content generation. This template is for data fetching only.`);let D={templateName:W,...X};return H.generate(D,U.schema)}parseContent($,X,Y){let W=this.applyTemplateScoping($,Y),J=this.getTemplate(W);if(!J)throw Error(`Template not found: ${W}`);let U=J;if(!U.formatter)throw Error(`Template ${W} does not have a formatter for parsing`);return U.formatter.parse(X)}formatContent($,X,Y){let W=this.applyTemplateScoping($,Y?.pluginId),J=this.getTemplate(W);if(!J)throw Error(`Template not found: ${W}`);if(!J.formatter)throw Error(`Template ${W} does not have a formatter`);let U=J.formatter.format(X);if(Y?.truncate&&U.length>Y.truncate)U=U.substring(0,Y.truncate)+"...";return U}}var om=A(()=>{e5()});var iK$;var am=A(()=>{R$();iK$=Z.object({name:Z.string(),description:Z.string(),schema:Z.any(),basePrompt:Z.string().optional(),requiredPermission:Z.enum(["anchor","trusted","public"]),formatter:Z.any().optional(),dataSourceId:Z.string().optional(),layout:Z.object({component:Z.any(),description:Z.string().optional(),packageName:Z.string().optional()}).optional()})});class L8{static instance=null;logger;contentService;entityService;static getInstance($,X){return L8.instance??=new L8($,X),L8.instance}static resetInstance(){L8.instance=null}static createFresh($,X){return new L8($,X)}constructor($,X){this.logger=Z6.getInstance().child("ContentGenerationJobHandler"),this.contentService=$,this.entityService=X}async process($,X,Y){try{this.logger.debug("Processing content generation job",{jobId:X,templateName:$.templateName,hasPrompt:!!$.context.prompt,hasData:!!$.context.data,userId:$.userId}),await Y.report({progress:0,total:3,message:`Generating content with template: ${$.templateName}`});let W={};if($.context.prompt!==void 0)W.prompt=$.context.prompt;if($.context.data!==void 0)W.data=$.context.data;if($.context.conversationHistory!==void 0)W.conversationHistory=$.context.conversationHistory;let J=await this.contentService.generateContent($.templateName,W);await Y.report({progress:1,total:3,message:`Formatting content for template: ${$.templateName}`});let U=this.contentService.formatContent($.templateName,J);if($.entityId&&$.entityType){let H=$.context.data?.routeId,D=$.context.data?.sectionId;if(H&&D){let V={id:$.entityId,entityType:$.entityType,content:U,metadata:{routeId:H,sectionId:D}};await this.entityService.createEntity(V),this.logger.debug("Saved generated content as entity",{jobId:X,entityId:$.entityId,entityType:$.entityType,routeId:H,sectionId:D})}else this.logger.warn("Cannot save entity without routeId and sectionId",{jobId:X,entityId:$.entityId,entityType:$.entityType,hasRouteId:!!H,hasSectionId:!!D})}return await Y.report({progress:3,total:3,message:`Completed content generation for: ${$.templateName}`}),this.logger.debug("Content generation job completed successfully",{jobId:X,templateName:$.templateName,contentLength:U.length}),U}catch(W){return this.logger.error("Content generation job failed",{jobId:X,templateName:$.templateName,userId:$.userId,error:W}),{success:!1,error:W instanceof Error?W.message:"Unknown error"}}}validateAndParse($){try{let X=sm.parse($);return this.logger.debug("Content generation job data validation successful",{templateName:X.templateName,hasPrompt:!!X.context.prompt,hasData:!!X.context.data,userId:X.userId}),X}catch(X){return this.logger.warn("Invalid content generation job data",{data:$,validationError:X instanceof Z.ZodError?X.issues:X}),null}}}var sm;var tm=A(()=>{R$();R$();sm=Z.object({templateName:Z.string().min(1,"Template name is required"),context:Z.object({prompt:Z.string().optional(),data:Z.record(Z.string(),Z.unknown()).optional(),conversationHistory:Z.string().optional()}),userId:Z.string().optional(),entityId:Z.string(),entityType:Z.string()})});var tJ;var em=A(()=>{R$();tJ={name:"shell:knowledge-query",description:"Knowledge-aware query processing with entity search",basePrompt:`You are a personal knowledge assistant with access to the user's entities and data.
480
- Analyze the user's query and provide a helpful response based on available information.
481
-
482
- Instructions:
483
- 1. Use the conversation history if provided to maintain context and continuity
484
- 2. Search through available entities for relevant information
485
- 3. Provide accurate, contextual responses based on the data
486
- 4. If information is missing, clearly state what additional data might be helpful
487
- 5. Structure your response clearly and concisely`,dataSourceId:"shell:ai-content",requiredPermission:"public",useKnowledgeContext:!0,schema:YY,formatter:new MW}});var $u;var Xu=A(()=>{R$();$u=Z.object({answer:Z.string().describe("The answer to the user's query"),sources:Z.array(Z.object({type:Z.string().describe("Type of source (e.g., note, article)"),title:Z.string().describe("Title or identifier of the source"),relevance:Z.number().min(0).max(1).describe("Relevance score")})).optional().describe("Sources used to generate the answer"),confidence:Z.enum(["high","medium","low"]).optional().describe("Confidence level of the answer"),suggestions:Z.array(Z.string()).optional().describe("Related topics or follow-up questions")})});var Yu=A(()=>{em();Xu()});var Ju=A(()=>{om();am();tm();Yu()});class E8{static instance=null;daemons=new Map;logger;static getInstance($=Z6.getInstance()){return E8.instance??=new E8($),E8.instance}static resetInstance(){E8.instance=null}static createFresh($){return new E8($)}constructor($){this.logger=$.child("DaemonRegistry")}register($,X,Y){if(this.daemons.has($))this.logger.warn(`Daemon already registered: ${$}, overwriting`);let W={name:$,daemon:X,pluginId:Y,status:"stopped"};this.daemons.set($,W),this.logger.debug(`Registered daemon: ${$} from plugin: ${Y}`)}has($){return this.daemons.has($)}get($){return this.daemons.get($)}async start($){let X=this.daemons.get($);if(!X)throw Error(`Daemon not registered: ${$}`);if(X.status==="running"){this.logger.warn(`Daemon already running: ${$}`);return}X.status="starting",delete X.error;try{await X.daemon.start(),X.status="running",X.startedAt=new Date,this.logger.debug(`Daemon started successfully: ${$}`)}catch(Y){throw X.status="error",X.error=T0(Y),this.logger.warn(`Daemon ${$} failed to start: ${g6(Y)}`),Y}}async stop($){let X=this.daemons.get($);if(!X)throw Error(`Daemon not registered: ${$}`);if(X.status==="stopped"){this.logger.warn(`Daemon already stopped: ${$}`);return}X.status="stopping";try{await X.daemon.stop(),X.status="stopped",X.stoppedAt=new Date,this.logger.debug(`Daemon stopped successfully: ${$}`)}catch(Y){throw X.status="error",X.error=T0(Y),this.logger.error(`Failed to stop daemon: ${$}`,Y),Y}}async checkHealth($){let X=this.daemons.get($);if(!X)throw Error(`Daemon not registered: ${$}`);if(!X.daemon.healthCheck)return;try{let Y=await X.daemon.healthCheck();return X.health=Y,Y}catch(Y){let W={status:"error",message:g6(Y),lastCheck:new Date};return X.health=W,W}}getByPlugin($){return Array.from(this.daemons.values()).filter((X)=>X.pluginId===$)}getAll(){return Array.from(this.daemons.keys())}getAllInfo(){return Array.from(this.daemons.values())}async getStatuses(){let $=this.getAllInfo();for(let X of $)if(X.daemon.healthCheck)await this.checkHealth(X.name);return $.map((X)=>({name:X.name,pluginId:X.pluginId,status:X.status,health:X.health}))}async unregister($){let X=this.daemons.get($);if(!X){this.logger.warn(`Daemon not registered: ${$}`);return}if(X.status==="running")await this.stop($);this.daemons.delete($),this.logger.debug(`Unregistered daemon: ${$}`)}async startPlugin($){let X=this.getByPlugin($);this.logger.debug(`Starting ${X.length} daemons for plugin: ${$}`);let Y;for(let W of X)try{await this.start(W.name)}catch(J){Y??=T0(J)}if(Y)throw Y}async stopPlugin($){let X=this.getByPlugin($);this.logger.debug(`Stopping ${X.length} daemons for plugin: ${$}`);for(let Y of X)try{await this.stop(Y.name)}catch(W){this.logger.error(`Failed to stop daemon: ${Y.name}`,W)}}async clear(){this.logger.debug("Clearing all daemons");let $=Array.from(this.daemons.values()).filter((X)=>X.status==="running");for(let X of $)try{await this.stop(X.name)}catch(Y){this.logger.error(`Failed to stop daemon during clear: ${X.name}`,Y)}this.daemons.clear(),this.logger.debug("All daemons cleared")}}var Wu=A(()=>{R$()});class n0{static instance=null;handlers=new Map;logger;static getInstance($){return n0.instance??=new n0($),n0.instance}static resetInstance(){n0.instance=null}static createFresh($){return new n0($)}constructor($){this.logger=$}subscribe($,X,Y){let W=async(H)=>{let V=await X(H);if("noop"in V)return{id:`resp-${Date.now()}`,requestId:H.id,timestamp:new Date().toISOString(),success:!0,data:void 0,error:void 0};if("success"in V)return{id:`resp-${Date.now()}`,requestId:H.id,timestamp:new Date().toISOString(),success:V.success,data:V.data,error:V.error?{message:V.error}:void 0};throw Error("Invalid message response format")},J=Y?{handler:W,filter:Y}:{handler:W};if(!this.handlers.has($))this.handlers.set($,new Set);let U=this.handlers.get($);if(U)U.add(J);return this.logger.debug(`Registered handler for message type: ${$}`,{hasFilter:!!Y,filterTarget:Y?.target}),()=>{let H=this.handlers.get($);if(H){if(H.delete(J),H.size===0)this.handlers.delete($)}}}async send($,X,Y,W,J,U){let H={id:`msg-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,type:$,timestamp:new Date().toISOString(),source:Y,target:W,metadata:J,payload:X},D=await this.publish(H,U);if(D?.success)return{success:!0,data:D.data};return{success:!1,error:D?.error?.message??`No handler found for message type: ${$}`}}async publish($,X){if(typeof $!=="object"||!$.type||!$.id)return this.logger.error("Invalid message structure - missing required fields 'id' or 'type'"),null;let{type:Y}=$,W=this.handlers.get(Y)??new Set;if(this.logger.debug(`Publishing message of type: ${Y}`,{source:$.source,target:$.target,hasMetadata:!!$.metadata}),W.size===0)return this.logger.debug(`No handlers found for message type: ${Y}`),null;let J=Array.from(W).filter((H)=>this.matchesFilter($,H.filter));if(J.length===0)return this.logger.debug(`No matching handlers for message type: ${Y}`,{totalHandlers:W.size,target:$.target}),null;if(X===!0){for(let H of J)try{await H.handler($)}catch(D){this.logger.error(`Error in message handler for ${Y}`,D)}return null}else{for(let H of J)try{let D=await H.handler($);if(D)return D}catch(D){this.logger.error(`Error in message handler for ${Y}`,D)}return null}}matchesFilter($,X){if(!X)return!0;if(X.source){if(!this.matchesPattern($.source,X.source))return!1}if(X.target){if(!$.target||!this.matchesPattern($.target,X.target))return!1}if(X.metadata){if(!$.metadata)return!1;for(let[Y,W]of Object.entries(X.metadata))if($.metadata[Y]!==W)return!1}if(X.predicate)return X.predicate($);return!0}matchesPattern($,X){if(!$)return!1;if(X instanceof RegExp)return X.test($);if(X.includes("*")){let Y=X.split("*").map((W)=>W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${Y}$`).test($)}return $===X}validateMessage($,X){try{return{valid:!0,data:X.parse($)}}catch(Y){if(Y instanceof Z.ZodError)return{valid:!1,error:Y.issues[0]?.message??"Validation failed"};return{valid:!1,error:"Unknown validation error"}}}hasHandlers($){let X=this.handlers.get($);return X!==void 0&&X.size>0}unsubscribe($,X){this.clearHandlers($)}clearHandlers($){if(this.handlers.has($))this.handlers.delete($),this.logger.info(`Cleared all handlers for message type: ${$}`)}clearAllHandlers(){this.handlers.clear(),this.logger.info("Cleared all message handlers")}getHandlerCount($){return this.handlers.get($)?.size??0}getTargetedHandlerCount($,X){let Y=this.handlers.get($);if(!Y)return 0;return Array.from(Y).filter((W)=>W.filter?.target===X).length}}var Uu=A(()=>{R$()});var Gu,Hu;var Du=A(()=>{R$();Gu=Z.object({success:Z.boolean(),data:Z.unknown().optional(),error:Z.string().optional()}),Hu=Z.object({id:Z.string().min(1),timestamp:Z.string(),type:Z.string().min(1),source:Z.string().min(1),target:Z.string().optional(),metadata:Z.record(Z.string(),Z.unknown()).optional()})});var oK$;var Vu=A(()=>{R$();Du();oK$=Z.object({id:Z.string().min(1),requestId:Z.string().min(1),success:Z.boolean(),data:Z.unknown().optional(),error:Z.object({message:Z.string(),code:Z.string().optional()}).optional(),timestamp:Z.string().datetime()})});var Ku=A(()=>{Uu();Vu()});function pO($,X,Y,W,J){return["entity:created","entity:updated","entity:deleted"].map((H)=>$.subscribe(H,async(D)=>{if(D.payload.entityType===X&&D.payload.entityId===Y){await W();let V=H.replace("entity:","");J.debug(`${X} entity ${V}, cache refreshed`)}return{success:!0}}))}class N0{static instance=null;logger;config;static getInstance($,X){return N0.instance??=new N0($,X),N0.instance}static resetInstance(){N0.instance=null}static createFresh($,X){return new N0($,X)}constructor($,X){this.logger=$.child("ShellInitializer"),this.config=X}registerShellTemplates($){$.register(tJ.name,tJ),this.logger.debug("Shell system templates registered")}registerBaseEntityDisplayTemplate($){$.register(bY.BASE_ENTITY_DISPLAY,{name:"base-entity-display",description:"Display template for base entities",schema:D0,formatter:new UU,requiredPermission:"public"}),this.logger.debug("Base entity display template registered")}registerFallbackBaseEntity($){$.registerEntityType(m1.BASE,D0,new _Y),this.logger.debug("Fallback base entity adapter registered")}registerBrainCharacterSupport($){let X=new wX;$.registerEntityType(m1.BRAIN_CHARACTER,X.schema,X),this.logger.debug("Brain character entity support registered")}registerAnchorProfileSupport($){let X=new zX;$.registerEntityType(m1.ANCHOR_PROFILE,X.schema,X),this.logger.debug("Anchor profile entity support registered")}async initializePlugins($,X){this.logger.debug(`Found ${this.config.plugins.length} plugins to register`);for(let Y of this.config.plugins)this.logger.debug(`Registering plugin: ${Y.id}`),$.registerPlugin(Y);if(await $.initializePlugins(X?.registrationContext),!X?.registerOnly){for(let{id:Y,error:W}of $.getFailedPlugins())if($.getPlugin(Y)?.requiresDaemonStartup?.())throw W}this.logger.debug("Plugin initialization complete")}initializeServices($){this.logger.debug("Initializing Shell services");let X={debug:2,info:3,warn:4,error:5}[this.config.logging.level],Y=$?.logger??Z6.createFresh({level:X,context:this.config.logging.context,format:this.config.logging.format==="json"?"json":"text",...this.config.logging.file?{logFile:this.config.logging.file}:{}}),W=$?.embeddingService??i0.getInstance({apiKey:this.config.ai.apiKey,logger:Y}),J={apiKey:this.config.ai.apiKey,model:this.config.ai.model,temperature:this.config.ai.temperature,maxTokens:this.config.ai.maxTokens,webSearch:this.config.ai.webSearch,...this.config.ai.imageApiKey?{imageApiKey:this.config.ai.imageApiKey}:{}},U=$?.aiService??l0.getInstance(J,Y),H=y1.getInstance(Y),D=$?.messageBus??n0.getInstance(Y),V=Y0.getInstance(Y),K=m0.getInstance(Y),Q=$?.renderService??C0.getInstance(V),q=$?.daemonRegistry??E8.getInstance(Y),F=$?.pluginManager??Q0.getInstance(Y,q),w=new X0(this.config.permissions),z=$?.mcpService??S0.getInstance(D,Y),O={url:this.config.jobQueueDatabase.url,...this.config.jobQueueDatabase.authToken&&{authToken:this.config.jobQueueDatabase.authToken}},N=v1.getInstance(O,Y),L=f1.getInstance({embeddingService:W,entityRegistry:H,logger:Y,jobQueueService:N,messageBus:D,dbConfig:{url:this.config.database.url,...this.config.database.authToken&&{authToken:this.config.database.authToken}},embeddingDbConfig:{url:this.config.embeddingDatabase.url,...this.config.embeddingDatabase.authToken&&{authToken:this.config.embeddingDatabase.authToken}}}),P=$?.conversationService??M1.getInstance(Y,D,{url:this.config.conversationDatabase.url,...this.config.conversationDatabase.authToken&&{authToken:this.config.conversationDatabase.authToken}}),j=$?.contentService??new HH({logger:Y,entityService:L,aiService:U,templateRegistry:V,dataSourceRegistry:K}),v=V0.getInstance(L,Y,this.config.identity);pO(D,m1.BRAIN_CHARACTER,m1.BRAIN_CHARACTER,()=>v.refreshCache(),Y);let y=g1.getInstance(L,Y,this.config.profile),E=uO({model:U.getModel(),modelId:U.getConfig().model,webSearch:U.getConfig().webSearch,temperature:U.getConfig().temperature,maxTokens:U.getConfig().maxTokens,messageBus:D}),b=_1.getInstance(z,P,v,y,Y,{agentFactory:E});pO(D,m1.ANCHOR_PROFILE,m1.ANCHOR_PROFILE,()=>y.refreshCache(),Y);for(let k of[m1.BRAIN_CHARACTER,m1.ANCHOR_PROFILE])pO(D,k,k,async()=>b.invalidateAgent(),Y);let R=y0.getInstance(N,Y),I=f0.getInstance(N,D,R,Y),d=h0.getInstance(N,I,Y,{pollInterval:100,concurrency:1,autoStart:!1});return{logger:Y,entityRegistry:H,messageBus:D,renderService:Q,daemonRegistry:q,pluginManager:F,templateRegistry:V,dataSourceRegistry:K,mcpService:z,embeddingService:W,entityService:L,aiService:U,conversationService:P,contentService:j,jobQueueService:N,jobQueueWorker:d,batchJobManager:R,jobProgressMonitor:I,permissionService:w,identityService:v,profileService:y,agentService:b}}registerJobHandlers($,X,Y){let W=L8.createFresh(X,Y);$.registerHandler("shell:content-generation",W,"shell")}wireShell($,X){$.pluginManager.setShell(X)}async initializeAll($,X,Y,W){this.logger.debug("Starting Shell initialization");try{if(this.registerShellTemplates($),this.registerBaseEntityDisplayTemplate($),this.registerBrainCharacterSupport(X),this.registerAnchorProfileSupport(X),await this.initializePlugins(Y,W),!X.hasEntityType(m1.BASE))this.registerFallbackBaseEntity(X);this.logger.debug("Shell registration phase complete")}catch(J){throw this.logger.error("Shell initialization failed",J),J}}}function cO(){N0.resetInstance(),f1.resetInstance(),y1.resetInstance(),m0.resetInstance(),i0.resetInstance(),M1.resetInstance(),Q0.resetInstance(),S0.resetInstance(),n0.resetInstance(),Y0.resetInstance(),C0.resetInstance(),E8.resetInstance(),l0.resetInstance(),_1.resetInstance(),V0.resetInstance(),g1.resetInstance(),v1.resetInstance(),y0.resetInstance(),h0.resetInstance(),f0.resetInstance()}var DH=A(()=>{GH();GH();Ju();ZQ();Wu();H1();GH();H1();OX();OX();b9();$X();Ku();h9();e5();R$();xY()});class dO{config;services;hooks;constructor($,X,Y){this.config=$;this.services=X;this.hooks=Y}async boot($){this.services.logger.debug("Starting Shell boot");let X=N0.getInstance(this.services.logger,this.config);if(await this.services.entityService.initialize(),await X.initializeAll(this.services.templateRegistry,this.services.entityRegistry,this.services.pluginManager,{...$?.registerOnly&&{registerOnly:!0},...this.config.entityDisplay!==void 0&&{registrationContext:{entityDisplay:this.config.entityDisplay}}}),X.registerJobHandlers(this.services.jobQueueService,this.services.contentService,this.services.entityService),this.hooks.registerCoreDataSources(),this.hooks.registerSystemCapabilities(),$?.registerOnly){this.services.logger.debug("Shell boot complete (registerOnly mode)");return}await this.startEarlyWebserver(),await this.emitPluginsRegistered(),await this.prepareReadyState(),await this.services.pluginManager.readyPlugins(),await this.startRuntimeServices(),this.services.logger.debug("Shell boot complete")}async startEarlyWebserver(){if(!this.services.daemonRegistry.has("webserver:webserver"))return;await this.services.daemonRegistry.start("webserver:webserver"),this.services.logger.debug("Started webserver before initial sync")}async emitPluginsRegistered(){await this.services.messageBus.send(QQ.pluginsRegistered,{timestamp:new Date().toISOString(),pluginCount:this.services.pluginManager.getAllPluginIds().length},"shell",void 0,void 0,!0),this.services.logger.debug("Emitted plugins registered event")}async prepareReadyState(){await Promise.all([this.services.identityService.initialize(),this.services.profileService.initialize()]),this.services.logger.debug("Identity and profile services initialized");let $=await UQ(this.services.templateRegistry,this.services.entityService);if($>0)this.services.logger.debug(`Materialized ${$} prompt entities`)}async startRuntimeServices(){await this.services.pluginManager.startPluginDaemons(),await this.services.jobQueueWorker.start(),this.services.jobProgressMonitor.start()}}var Qu=A(()=>{h9();DH()});var Fu,qu,wu,Zu,zu,Ou,Nu,Au,Bu,Mu,ju,Ru,Lu,ar$,sr$,tr$;var Eu=A(()=>{R$();Fu=Z.object({query:Z.string().describe("Search term"),entityType:Z.string().optional().describe("Entity type to filter by"),limit:Z.number().optional().describe("Maximum number of results")}),qu=Z.object({entityType:Z.string().describe("Entity type"),id:Z.string().describe("Entity ID, slug, or title")}),wu=Z.object({entityType:Z.string().describe("Entity type to list"),status:Z.string().optional().describe("Filter by status"),limit:Z.number().optional().describe("Maximum number of results (default: 20)")}),Zu=Z.object({entityType:Z.string().describe("Entity type to create"),title:Z.string().optional().describe("Title for the entity"),prompt:Z.string().optional().describe("Prompt for AI generation"),content:Z.string().optional().describe("Direct content to store"),url:Z.string().optional().describe("URL or domain for URL-first create flows such as saving a link or remote agent"),targetEntityType:Z.string().optional().describe("Attach to this entity type after creation (e.g. set as cover image)"),targetEntityId:Z.string().optional().describe("Attach to this entity ID after creation")}),zu=Z.object({entityType:Z.string().describe("Entity type"),id:Z.string().describe("Entity ID"),fields:Z.record(Z.unknown()).optional().describe("Partial frontmatter fields to update. Use this for status, title, and metadata changes such as approving an agent."),content:Z.string().optional().describe("Full markdown content replacement only. Do not use this for status/title/frontmatter updates; use fields instead."),confirmed:Z.literal(!0).optional().describe("Confirm the update"),contentHash:Z.string().optional().describe("Content hash for optimistic concurrency")}),Ou=Z.object({entityType:Z.string().describe("Entity type"),id:Z.string().describe("Entity ID"),confirmed:Z.literal(!0).optional().describe("Confirm the deletion")}),Nu=Z.object({entityType:Z.string().describe("Entity type to extract"),source:Z.string().optional().describe("Source entity ID \u2014 omit for batch"),mode:Z.enum(["derive","rebuild"]).optional().describe("Batch mode: derive incrementally or rebuild from scratch"),confirmed:Z.literal(!0).optional().describe("Confirm destructive rebuild")}),Au=Z.object({entityType:Z.string().describe("Entity type"),entityId:Z.string().describe("Entity ID or slug"),imageId:Z.string().nullable().describe("Image ID to set, or null to remove")}),Bu=Z.object({batchId:Z.string().optional().describe("Specific batch ID to check"),jobTypes:Z.array(Z.string()).optional().describe("Filter by job types")}),Mu=Z.object({conversationId:Z.string().describe("Conversation ID")}),ju=Z.object({searchQuery:Z.string().optional().describe("Optional search query"),limit:Z.number().optional().describe("Maximum results (default: 20)")}),Ru=Z.object({conversationId:Z.string().describe("Conversation ID"),limit:Z.number().optional().describe("Maximum messages (default: 20)")}),Lu=Z.object({type:Z.string().describe("Type of insight to retrieve. Built-in: overview, publishing-cadence, content-health. Plugins may register additional types.")}),ar$=Z.object({entityId:Z.string().optional(),status:Z.enum(["created","generating"]),jobId:Z.string().optional()}),sr$=Z.object({status:Z.literal("extracting"),jobId:Z.string(),entityType:Z.string(),source:Z.string().optional(),mode:Z.enum(["derive","rebuild"]).optional()}),tr$=Z.object({entityType:Z.string(),entityId:Z.string(),imageId:Z.string().nullable()})});function eJ($,X,Y,W,J={}){let{visibility:U="anchor"}=J;return{name:`${aK$}_${$}`,description:X,inputSchema:Y.shape,handler:async(H,D)=>{let V=Y.safeParse(H);if(!V.success)return{success:!1,error:`Invalid input: ${V.error.errors.map((K)=>`${K.path.join(".")}: ${K.message}`).join(", ")}`};try{return await W(V.data,D)}catch(K){return{success:!1,error:g6(K)}}},visibility:U}}function Pu($){if($.entityType==="image"&&$.content.startsWith("data:"))return{...$,content:"[binary image data \u2014 use metadata for image info]"};return $}function W7($){if($===void 0)return;let X=$.trim();return X.length>0?X:void 0}function sK$($){if($.fields)return{fields:$.fields};if(!$.content)return{};try{let X=JSON.parse($.content);if(typeof X==="object"&&X!==null&&!Array.isArray(X)){if("fields"in X&&typeof X.fields==="object"&&X.fields!==null&&!Array.isArray(X.fields))return{fields:X.fields};return{fields:X}}}catch{}return{content:$.content}}function Iu($){return[$.metadata.title,$.metadata.name,$.metadata.subject,$.metadata.slug].find((W)=>typeof W==="string"&&W.trim().length>0)??$.id}function tK$($){return!!$&&Object.keys($.shape).length>0}function _u($){let{entityService:X,conversationService:Y,logger:W,jobs:J,entityRegistry:U}=$;return[S1("system","search","Search entities using semantic search. Optionally filter by entity type.",Fu,async(H)=>({success:!0,data:{results:(await X.search(H.query,{limit:H.limit??$.searchLimit,...H.entityType&&{types:[H.entityType]}})).map((D)=>({...D,entity:Pu(D.entity)}))}}),{visibility:"public",cli:{name:"search"}}),S1("system","get","Retrieve a specific entity by type and identifier (ID, slug, or title).",qu,async(H)=>{if(!X.getEntityTypes().includes(H.entityType))return{success:!1,error:`Unknown entity type: ${H.entityType}. Available: ${X.getEntityTypes().join(", ")}`};let D=await x9(X,H.entityType,H.id,W);return D.ok?{success:!0,data:{entity:Pu(D.entity)}}:{success:!1,error:D.error}},{visibility:"public",cli:{name:"get"}}),S1("system","list","List entities by type. Returns metadata only \u2014 use system_get for full content.",wu,async(H)=>{if(!X.getEntityTypes().includes(H.entityType))return{success:!1,error:`Unknown entity type: ${H.entityType}. Available: ${X.getEntityTypes().join(", ")}`};let D={limit:H.limit??20};if(H.status)D.filter={metadata:{status:H.status}};let K=(await X.listEntities(H.entityType,D)).map(({content:Q,contentHash:q,...F})=>F);return{success:!0,data:{entities:K,count:K.length}}},{visibility:"public",cli:{name:"list"}}),eJ("check-job-status","Check the status of background operations",Bu,async(H)=>{if(H.batchId){let K=await J.getBatchStatus(H.batchId);if(!K)return{success:!1,error:`No batch found with ID: ${H.batchId}`};let Q=K.totalOperations>0?Math.round(K.completedOperations/K.totalOperations*100):0;return{success:!0,data:{batchId:H.batchId,status:K.status,progress:{total:K.totalOperations,completed:K.completedOperations,failed:K.failedOperations,percentComplete:Q},currentOperation:K.currentOperation,errors:K.errors}}}let D=await J.getActiveJobs(H.jobTypes),V=await J.getActiveBatches();return{success:!0,data:{summary:{activeJobs:D.length,activeBatches:V.length},jobs:D.map((K)=>({id:K.id,type:K.type,status:K.status,priority:K.priority,retryCount:K.retryCount,createdAt:new Date(K.createdAt).toISOString(),startedAt:K.startedAt?new Date(K.startedAt).toISOString():null})),batches:V.map((K)=>({batchId:K.batchId,status:K.status.status,totalOperations:K.status.totalOperations,completedOperations:K.status.completedOperations,failedOperations:K.status.failedOperations,currentOperation:K.status.currentOperation,pluginId:K.metadata.metadata.pluginId,errors:K.status.errors}))}}},{visibility:"public"}),S1("system","get-conversation","Get conversation details",Mu,async(H)=>{let D=await Y.getConversation(H.conversationId);if(!D)return{success:!1,error:`Conversation not found: ${H.conversationId}`};return{success:!0,data:{id:D.id,interfaceType:D.interfaceType,channelId:D.channelId,created:D.created,lastActive:D.lastActive}}},{visibility:"public"}),S1("system","list-conversations","List conversations, optionally filtered by search query",ju,async(H)=>{let D=await Y.searchConversations(H.searchQuery??""),V=D.slice(0,H.limit??20);return{success:!0,data:{conversations:V.map((K)=>({id:K.id,interfaceType:K.interfaceType,channelId:K.channelId,created:K.created,lastActive:K.lastActive})),totalFound:D.length,returned:V.length,searchQuery:H.searchQuery}}},{visibility:"public"}),S1("system","get-messages","Get messages from a specific conversation",Ru,async(H)=>{let D=await Y.getMessages(H.conversationId,{limit:H.limit??20});return{success:!0,data:{conversationId:H.conversationId,messages:D.map((V)=>({id:V.id,role:V.role,content:V.content,timestamp:V.timestamp})),messageCount:D.length,requestedLimit:H.limit??20}}},{visibility:"public"}),S1("system","status","Get system status including model, version, interfaces, and tools",Z.object({}),async()=>({success:!0,data:await $.getAppInfo()}),{visibility:"public",cli:{name:"status"}}),eJ("create","Create a new entity. Provide content for direct creation, a prompt for AI generation, or a url for URL-first flows.",Zu,async(H,D)=>{let V=W7(H.prompt),K=W7(H.content),Q=W7(H.title),q=W7(H.url),F=W7(H.targetEntityType),w=W7(H.targetEntityId);if(!!F!==!!w)return{success:!1,error:"Provide both 'targetEntityType' and 'targetEntityId' together, or omit both."};if(!K&&!V&&!q)return{success:!1,error:"Provide 'content' (direct create), 'prompt' (AI generation), or 'url' (URL-first create), or a supported combination."};let z={entityType:H.entityType,...V&&{prompt:V},...Q&&{title:Q},...K&&{content:K},...q&&{url:q},...F&&{targetEntityType:F},...w&&{targetEntityId:w}},O=$.entityRegistry.getCreateInterceptor(z.entityType);if(O){let P={interfaceType:D.interfaceType,userId:D.userId,...D.channelId&&{channelId:D.channelId},...D.channelName&&{channelName:D.channelName}},j=await O(z,P);if(j.kind==="handled")return j.result;z=j.input}if(!z.content&&!z.prompt)return{success:!1,error:"URL-only creation is supported only for entity types that explicitly handle it. Provide 'content' or 'prompt' for this entity type."};if(z.prompt)try{return{success:!0,data:{status:"generating",jobId:await J.enqueue(`${z.entityType}:generation`,{prompt:z.prompt,...z.title&&{title:z.title},...z.content&&{content:z.content},...z.targetEntityType&&{targetEntityType:z.targetEntityType},...z.targetEntityId&&{targetEntityId:z.targetEntityId}},D)}}}catch(P){return{success:!1,error:P instanceof Error?P.message:"Failed to queue generation job"}}let N=_V(z.title??`${z.entityType}-${Date.now()}`),L=U.getEffectiveFrontmatterSchema(z.entityType);try{return{success:!0,data:{entityId:(z.content&&tK$(L)?await X.createEntityFromMarkdown({entityType:z.entityType,id:N,markdown:z.content}):await X.createEntity({id:N,entityType:z.entityType,content:z.content??"",metadata:{title:z.title??N},created:new Date().toISOString(),updated:new Date().toISOString()})).entityId,status:"created"}}}catch(P){return{success:!1,error:P instanceof Error?P.message:"Failed to create entity"}}},{visibility:"trusted"}),eJ("delete","Delete an entity. Requires confirmation.",Ou,async(H)=>{let D=await x9(X,H.entityType,H.id,W);if(!D.ok)return{success:!1,error:D.error};let{entity:V}=D;if(H.confirmed){try{await X.deleteEntity(H.entityType,V.id)}catch(Q){return{success:!1,error:Q instanceof Error?Q.message:"Failed to delete entity"}}return{success:!0,data:{deleted:V.id}}}return{needsConfirmation:!0,toolName:"system_delete",description:`Delete "${Iu(V)}"?
488
-
489
- Preview:
490
- ${V.content.slice(0,200)}`,args:{...H,id:V.id,confirmed:!0}}},{visibility:"trusted"}),eJ("update","Update an entity's fields or content. Requires confirmation.",zu,async(H)=>{let D=await x9(X,H.entityType,H.id,W);if(!D.ok)return{success:!1,error:D.error};let{entity:V}=D,K=sK$({...H.fields!==void 0?{fields:H.fields}:{},...H.content!==void 0?{content:H.content}:{}}),Q=K.content?.trim().length===0&&K.fields===void 0,q=V.metadata.status;if(H.confirmed&&V.entityType==="agent"&&(q==="discovered"||q==="approved")&&(!K.content&&!K.fields||Q))K={fields:{status:"approved"}};if(K.content&&K.fields)return{success:!1,error:"Provide either 'content' or 'fields', not both"};if(!K.content&&!K.fields)return{success:!1,error:"Provide 'content' (full replacement) or 'fields' (partial update)"};if(H.confirmed){if(H.contentHash&&V.contentHash!==H.contentHash)return{success:!1,error:"Entity was modified since you reviewed the changes. Please try again."};if(K.content!==void 0){let O=K.content.trim(),N=U.getEffectiveFrontmatterSchema(V.entityType);if(N){if(!O)return{success:!1,error:"Full content replacement cannot be empty for this entity type. Use 'fields' for partial updates."};try{U.getAdapter(V.entityType).parseFrontMatter(K.content,N)}catch{return{success:!1,error:"Invalid content replacement for this entity type. Provide full markdown with valid frontmatter, or use 'fields' for partial updates."}}}}let z=K.content!==void 0?{...V,content:K.content}:{...V,metadata:{...V.metadata,...K.fields}};try{await X.updateEntity(z)}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to update entity"}}return{success:!0,data:{updated:V.id}}}let F=Iu(V),w;if(K.fields)w=Object.entries(K.fields).map(([z,O])=>`${z}: ${String(V.metadata[z]??"(empty)")} \u2192 ${String(O)}`).join(`
491
- `);else{let z=V.content.split(`
492
- `),O=(K.content??"").split(`
493
- `),N=[];for(let L=0;L<Math.max(z.length,O.length);L++)if((z[L]??"")!==(O[L]??"")){if(z[L])N.push(`- ${z[L]}`);if(O[L])N.push(`+ ${O[L]}`)}w=N.join(`
494
- `)}return{needsConfirmation:!0,toolName:"system_update",description:`Update "${F}"?
495
-
496
- Changes:
497
- ${w}`,args:{...H,...K,id:V.id,confirmed:!0,contentHash:V.contentHash}}},{visibility:"trusted"}),eJ("extract",'Extract derived entities from source content. Provide source for single, omit for batch. `mode: "rebuild"` is currently only supported for `entityType: "topic"` and requires confirmation; other entity types fall back to normal derive mode.',Nu,async(H,D)=>{let{entityType:V,source:K}=H,q=(H.mode??"derive")==="rebuild",F=V==="topic"&&!K,w=q&&F?"rebuild":"derive";if(!X.getEntityTypes().includes(V))return{success:!1,error:`Unknown entity type: ${V}. Available types: ${X.getEntityTypes().join(", ")}`};if(q&&F&&!H.confirmed)return{needsConfirmation:!0,toolName:"system_extract",description:`Rebuild all derived topic entities from current source content?
498
-
499
- This will delete existing topics and regenerate them from scratch.`,args:{...H,confirmed:!0}};try{let z={};if(K){for(let N of X.getEntityTypes()){let L=await X.getEntity(N,K);if(L){z.sourceId=L.id,z.sourceType=L.entityType;break}}if(!z.sourceId)return{success:!1,error:`Source entity not found: ${K}`}}if(w==="rebuild")z.mode="rebuild";return{success:!0,data:{status:"extracting",jobId:await J.enqueue(`${V}:extract`,z,D),entityType:V,mode:w,...K&&{source:K}},...q&&!F?{message:K||V!=="topic"?`Rebuild is currently only supported for batch topic extraction. Ran normal derive mode for ${V} instead.`:void 0}:{}}}catch(z){return{success:!1,error:z instanceof Error?z.message:"Failed to queue extraction job"}}},{visibility:"trusted"}),S1("system","set-cover","Set or remove cover image on an entity.",Au,async(H)=>{try{let D=await x9(X,H.entityType,H.entityId,W);if(!D.ok)return{success:!1,error:D.error};let{entity:V}=D;if(!$.entityRegistry.getAdapter(H.entityType).supportsCoverImage)return{success:!1,error:`Entity type '${H.entityType}' doesn't support cover images`};if(H.imageId){let q=await x9(X,"image",H.imageId,W,"Image");if(!q.ok)return{success:!1,error:q.error}}let Q=KV(V,H.imageId);return await X.updateEntity(Q),{success:!0,data:{entityType:H.entityType,entityId:H.entityId,imageId:H.imageId},message:H.imageId?`Cover image set to '${H.imageId}' on ${H.entityType}/${H.entityId}`:`Cover image removed from ${H.entityType}/${H.entityId}`}}catch(D){return{success:!1,error:D instanceof Error?D.message:"Failed to set cover image"}}},{visibility:"trusted"}),S1("system","insights",`Get aggregate content insights and analytics only. For a general overview of actual content, use system_list instead. Available types: ${$.insights.getTypes().join(", ")}.`,Lu,async(H)=>{return{success:!0,data:await $.insights.get(H.type,X)}},{visibility:"public"})]}var aK$="system";var Tu=A(()=>{$X();H1();R$();Eu()});function Cu($){return[{uri:"entity://types",name:"Entity Types",description:"List of registered entity types",mimeType:"text/plain",handler:async()=>({contents:[{uri:"entity://types",mimeType:"text/plain",text:$.entityService.getEntityTypes().join(`
500
- `)}]})},{uri:"brain://identity",name:"Brain Identity",description:"Brain character \u2014 name, role, purpose, values",mimeType:"application/json",handler:async()=>({contents:[{uri:"brain://identity",mimeType:"application/json",text:JSON.stringify($.getIdentity(),null,2)}]})},{uri:"brain://profile",name:"Anchor Profile",description:"Brain owner profile \u2014 name, bio, expertise",mimeType:"application/json",handler:async()=>({contents:[{uri:"brain://profile",mimeType:"application/json",text:JSON.stringify($.getProfile(),null,2)}]})},{uri:"brain://status",name:"Brain Status",description:"System status \u2014 version, model, interfaces, tools",mimeType:"application/json",handler:async()=>({contents:[{uri:"brain://status",mimeType:"application/json",text:JSON.stringify(await $.getAppInfo(),null,2)}]})}]}function Su($){let{entityService:X}=$;return[{name:"entity-list",uriTemplate:"entity://{type}",description:"List entities of a given type",mimeType:"application/json",list:async()=>{return X.getEntityTypes().map((W)=>({uri:`entity://${W}`,name:`${W} entities`}))},complete:{type:async()=>X.getEntityTypes()},handler:async({type:Y})=>{let W=X.getEntityTypes();if(!W.includes(Y))throw Error(`Unknown entity type: ${Y}. Available: ${W.join(", ")}`);let U=(await X.listEntities(Y)).map((H)=>({id:H.id,entityType:H.entityType,...H.metadata,updated:H.updated}));return{contents:[{uri:`entity://${Y}`,mimeType:"application/json",text:JSON.stringify(U,null,2)}]}}},{name:"entity-detail",uriTemplate:"entity://{type}/{id}",description:"Read a single entity by type and ID",mimeType:"text/markdown",list:async()=>{let Y=X.getEntityTypes();return(await Promise.all(Y.map(async(J)=>{return(await X.listEntities(J)).map((H)=>({uri:`entity://${J}/${H.id}`,name:`${J}/${H.id}`}))}))).flat()},complete:{type:async(Y)=>{let W=X.getEntityTypes();return Y?W.filter((J)=>J.startsWith(Y)):W},id:async()=>[]},handler:async({type:Y,id:W})=>{let J=await X.getEntity(Y,W);if(!J)throw Error(`Entity not found: ${Y}/${W}`);return{contents:[{uri:`entity://${Y}/${W}`,mimeType:"text/markdown",text:J.content}]}}}]}function bu($){return[{name:"create",description:"Create new content of any type",args:{type:{description:"Entity type (e.g. post, deck, note)",required:!0},topic:{description:"Topic or title for the content"}},handler:async({topic:Y,type:W})=>({messages:[{role:"user",content:{type:"text",text:Y?`Create a new ${W} about: ${Y}`:`Create a new ${W}. Ask me what it should be about.`}}]})},{name:"generate",description:"AI-generate content with a prompt",args:{type:{description:`Entity type (${(()=>$.entityService.getEntityTypes().join(", "))()})`,required:!0},topic:{description:"What to generate",required:!0}},handler:async({type:Y,topic:W})=>({messages:[{role:"user",content:{type:"text",text:`Generate a ${Y} about: ${W}`}}]})},{name:"review",description:"Review and improve existing content",args:{type:{description:"Entity type",required:!0},id:{description:"Entity ID or slug",required:!0}},handler:async({type:Y,id:W})=>({messages:[{role:"user",content:{type:"text",text:`Review my ${Y} "${W}". Read it first, then give me specific feedback on structure, clarity, and impact. Suggest concrete improvements.`}}]})},{name:"publish",description:"Publish content \u2014 preview, confirm, and publish",args:{type:{description:"Entity type",required:!0},id:{description:"Entity ID or slug",required:!0}},handler:async({type:Y,id:W})=>({messages:[{role:"user",content:{type:"text",text:`I want to publish my ${Y} "${W}". Show me a preview first, then publish it.`}}]})},{name:"brainstorm",description:"Brainstorm ideas using brain context and expertise",args:{topic:{description:"Topic to brainstorm about",required:!0}},handler:async({topic:Y})=>({messages:[{role:"user",content:{type:"text",text:`Let's brainstorm about: ${Y}. Use my existing content and expertise as context. Give me fresh angles and concrete ideas.`}}]})}]}function xu($){return["## Entity CRUD","","Use these system tools for ALL entity operations:","",`- **system_create**: Create or generate any entity. Pass \`content\` for direct creation, \`prompt\` for AI generation, or \`url\` for URL-first flows like saving links or remote agents. Available entity types: ${$.entityService.getEntityTypes().join(", ")}.`,"- **system_update**: Modify an entity's fields or content. Requires confirmation before applying changes.","- **system_delete**: Remove an entity. Requires confirmation before deleting.","- **system_get**: Retrieve a specific entity by type and ID/slug/title.","- **system_list**: List entities by type with optional filters.","- **system_search**: Semantic search across all entities.","","When a user asks to create content, determine the entity type from context:",'- "Write a blog post" \u2192 entityType: "post"','- "Create a presentation/deck" \u2192 entityType: "deck"','- "Save this as a note" \u2192 entityType: "base"','- "Draft a LinkedIn post" \u2192 entityType: "social-post"','- "Create a newsletter" \u2192 entityType: "newsletter"','- "Add a project" \u2192 entityType: "project"','- "List my contacts/agents" \u2192 entityType: "agent"',"","Never use old tool names like blog_generate, note_create, or deck_generate."].join(`
501
- `)}function ku($,X,Y,W){let J=_u($);for(let K of J)try{X.registerTool(U7,K)}catch{W.debug(`System tool ${K.name} already registered, skipping`)}Y.subscribe(`plugin:${U7}:tool:execute`,async(K)=>{let{toolName:Q,args:q,interfaceType:F,userId:w,channelId:z}=K.payload,O=J.find((P)=>P.name===Q);if(!O)return{success:!1,error:`System tool not found: ${Q}`};let N={interfaceType:F??"system",userId:w??"system"};if(z)N.channelId=z;return{success:!0,data:await O.handler(q,N)}}),W.debug(`Registered ${J.length} system tools`);let U=Cu($);for(let K of U)try{X.registerResource(U7,K)}catch{W.debug(`System resource ${K.uri} already registered, skipping`)}W.debug(`Registered ${U.length} system resources`);let H=Su($);for(let K of H)try{X.registerResourceTemplate(U7,K)}catch{W.debug(`System resource template ${K.uriTemplate} already registered, skipping`)}W.debug(`Registered ${H.length} system resource templates`);let D=bu($);for(let K of D)try{X.registerPrompt(U7,K)}catch{W.debug(`System prompt ${K.name} already registered, skipping`)}W.debug(`Registered ${D.length} system prompts`);let V=xu($);try{X.registerInstructions(U7,V)}catch{W.debug("System instructions already registered, skipping")}W.debug("Registered system instructions")}var U7="system";var vu=A(()=>{Tu()});class hu{handlers=new Map;register($,X){this.handlers.set($,X)}getTypes(){return Array.from(this.handlers.keys())}async get($,X){let Y=this.handlers.get($);if(!Y)throw Error(`Unknown insight type: ${$}. Available: ${this.getTypes().join(", ")}`);return Y(X)}}function yu(){let $=new hu;return $.register("overview",eK$),$.register("publishing-cadence",$Q$),$.register("content-health",XQ$),$}async function eK$($){let X=await $.getEntityCounts(),Y={},W=0;for(let{entityType:F,count:w}of X)Y[F]=w,W+=w;let J=await lO($),U=Date.now(),H=U-604800000,D=U-2592000000,V=0,K=0;for(let F of J){let w=new Date(F.created).getTime();if(w>=H)V++;if(w>=D)K++}let Q=fu(J),q=J.filter((F)=>F.metadata.status==="published");return{entityCounts:Y,totalEntities:W,recentActivity:{last7days:V,last30days:K},contentHealth:{drafts:Q.length,published:q.length}}}async function $Q$($){let X=await lO($),Y=new Map;for(let J of X){let U=new Date(J.created);if(isNaN(U.getTime()))continue;let H=`${U.getUTCFullYear()}-${String(U.getUTCMonth()+1).padStart(2,"0")}`,D=Y.get(H);if(!D)D={},Y.set(H,D);D[J.entityType]=(D[J.entityType]??0)+1}return{months:Array.from(Y.entries()).sort((J,U)=>U[0].localeCompare(J[0])).map(([J,U])=>{let H=0;for(let D of Object.values(U))H+=D;return{month:J,counts:U,total:H}})}}async function XQ$($){let X=await lO($),Y=fu(X).map((H)=>({id:H.id,entityType:H.entityType,title:typeof H.metadata.title==="string"?H.metadata.title:H.id,created:H.created})),W=Date.now(),J=W-7776000000,U=X.filter((H)=>{if(H.entityType==="image")return!1;let D=new Date(H.updated).getTime();return!isNaN(D)&&D<J}).map((H)=>({id:H.id,entityType:H.entityType,title:typeof H.metadata.title==="string"?H.metadata.title:H.id,updated:H.updated,daysSinceUpdate:Math.floor((W-new Date(H.updated).getTime())/86400000)}));return{drafts:Y,stale:U}}function fu($){return $.filter((X)=>X.metadata.status==="draft")}async function lO($){let X=$.getEntityTypes(),Y=[];for(let W of X){let J=await $.listEntities(W,{limit:1000});Y.push(...J)}return Y}class o0{config;static instance=null;services;bootloader;initialized=!1;insightsRegistry;bootTime=Date.now();endpoints=[];jobs;static getInstance($){return o0.instance??=new o0(SY($??{})),o0.instance}static async resetInstance(){if(o0.instance)await o0.instance.shutdown(),o0.instance=null}static createFresh($,X){cO();let Y=SY($);return new o0(Y,X)}constructor($,X){this.config=$;let Y=N0.getInstance(X?.logger??Z6.getInstance(),this.config);this.services=Y.initializeServices(X),this.jobs={enqueueBatch:this.services.batchJobManager.enqueueBatch.bind(this.services.batchJobManager),getActiveBatches:this.services.batchJobManager.getActiveBatches.bind(this.services.batchJobManager),getBatchStatus:this.services.batchJobManager.getBatchStatus.bind(this.services.batchJobManager),getActiveJobs:this.services.jobQueueService.getActiveJobs.bind(this.services.jobQueueService),getStatus:this.services.jobQueueService.getStatus.bind(this.services.jobQueueService)},this.insightsRegistry=yu(),this.bootloader=new dO(this.config,this.services,{registerCoreDataSources:()=>this.registerCoreDataSources(),registerSystemCapabilities:()=>this.registerSystemCapabilities()}),Y.wireShell(this.services,this)}getInsightsRegistry(){return this.insightsRegistry}async initialize($){if(this.services.logger.debug("Shell.initialize() called"),this.initialized){this.services.logger.warn("Shell already initialized");return}try{await this.bootloader.boot($),this.initialized=!0}catch(X){throw this.services.logger.error("Failed to initialize Shell",X),X}}registerTemplates($,X){this.services.logger.debug("Registering templates",{pluginId:X,count:Object.keys($).length});for(let[Y,W]of Object.entries($))this.registerTemplate(Y,W,X)}async shutdown(){this.services.logger.debug("Shutting down Shell"),this.services.jobProgressMonitor.stop(),await this.services.jobQueueWorker.stop();for(let[$]of this.services.pluginManager.getAllPlugins())await this.services.pluginManager.disablePlugin($);this.services.entityService.close(),this.services.jobQueueService.close(),this.services.conversationService.close(),this.initialized=!1,this.services.logger.debug("Shell shutdown complete")}async generateContent($){this.requireInitialized("Shell content generation");let X=this.services.contentService.getTemplate($.templateName);if(!X)throw Error(`Template not found: ${$.templateName}`);let Y=$.interfacePermissionGrant??"public";if(!this.services.permissionService.hasPermission(Y,X.requiredPermission))throw Error(`Insufficient permissions: ${X.requiredPermission} required, but interface granted ${Y} for template: ${$.templateName}`);let W={prompt:$.prompt,...$.conversationHistory&&{conversationHistory:$.conversationHistory},...$.data&&{data:$.data}};return this.services.contentService.generateContent($.templateName,W)}async query($,X){this.requireInitialized("Shell query");let Y=await this.getAppInfo(),W={...X,appInfo:Y,timestamp:new Date().toISOString()},{conversationHistory:J,...U}=W;return this.generateContent({prompt:$,templateName:bY.KNOWLEDGE_QUERY,...J&&{conversationHistory:J},data:U,interfacePermissionGrant:"public"})}registerPlugin($){this.requireInitialized("Plugin registration"),this.services.pluginManager.registerPlugin($)}isInitialized(){return this.initialized}requireInitialized($){if(!this.initialized)throw Error(`${$} attempted before initialization`)}getEntityService(){return this.services.entityService}getConversationService(){return this.services.conversationService}getEntityRegistry(){return this.services.entityRegistry}async generateObject($,X){this.requireInitialized("Shell generateObject");let{object:Y}=await this.services.aiService.generateObject("You are a helpful assistant. Respond with the requested structured data.",$,X);return{object:Y}}getAIService(){return this.services.aiService}generateImage($,X){return this.services.aiService.generateImage($,X)}canGenerateImages(){return this.services.aiService.canGenerateImages()}getPluginManager(){return this.services.pluginManager}getContentService(){return this.services.contentService}getRenderService(){return this.services.renderService}getMessageBus(){return this.services.messageBus}getLogger(){return this.services.logger}getJobQueueService(){return this.services.jobQueueService}getMCPService(){return this.services.mcpService}listToolsForPermissionLevel($){return this.services.mcpService.listToolsForPermissionLevel($).map(({pluginId:X,tool:Y})=>({name:Y.name,description:Y.description,pluginId:X}))}getPermissionService(){return this.services.permissionService}getAgentService(){return this.services.agentService}registerTools($,X){for(let Y of X)try{this.services.mcpService.registerTool($,Y)}catch(W){this.services.logger.error(`Failed to register tool ${Y.name} from ${$}:`,W)}}registerResources($,X){for(let Y of X)try{this.services.mcpService.registerResource($,Y)}catch(W){this.services.logger.error(`Failed to register resource ${Y.name} from ${$}:`,W)}}registerResourceTemplate($,X){this.services.mcpService.registerResourceTemplate($,X)}registerPrompt($,X){this.services.mcpService.registerPrompt($,X)}registerInstructions($,X){if(this.services.mcpService.registerInstructions($,X),this.initialized)this.services.agentService.invalidateAgent()}getPluginPackageName($){return this.services.pluginManager.getPluginPackageName($)}hasPlugin($){return this.services.pluginManager.hasPlugin($)}getPluginApiRoutes(){let $=[];for(let[X,Y]of this.services.pluginManager.getAllPlugins()){let{plugin:W}=Y;if("getApiRoutes"in W&&typeof W.getApiRoutes==="function")for(let J of W.getApiRoutes())$.push({pluginId:X,fullPath:`/api/${X}${J.path}`,definition:J})}return $}getPluginWebRoutes(){let $=[];for(let[X,Y]of this.services.pluginManager.getAllPlugins()){let{plugin:W}=Y;if("getWebRoutes"in W&&typeof W.getWebRoutes==="function")for(let J of W.getWebRoutes())$.push({pluginId:X,fullPath:J.path,definition:J})}return $}registerDaemon($,X,Y){this.services.daemonRegistry.register($,X,Y)}registerEndpoint($){let X=EW.parse($);this.endpoints.push(X)}listEndpoints(){return[...this.endpoints].sort(($,X)=>$.priority-X.priority||$.label.localeCompare(X.label))}getPublicContext(){return{entityService:this.services.entityService,generateContent:($)=>this.generateContent($),getBatchStatus:($)=>this.services.batchJobManager.getBatchStatus($)}}registerTemplate($,X,Y){let W=Y?`${Y}:${$}`:`shell:${$}`;this.services.templateRegistry.register(W,X),this.services.logger.debug(`Registered template: ${W}`)}getTemplate($){return this.services.templateRegistry.get($)}getDataSourceRegistry(){return this.services.dataSourceRegistry}getIdentity(){return this.services.identityService.getCharacter()}getProfile(){return this.services.profileService.getProfile()}getDomain(){return this.config.siteBaseUrl}getDataDir(){return this.config.dataDir}registerEvalHandler($,X,Y){this.config.evalHandlerRegistry?.register($,X,Y)}async getAppInfo(){let X=(await this.services.entityService.getEntityCounts()).reduce((J,U)=>J+U.count,0),Y=await this.services.entityService.countEmbeddings(),W=await this.services.daemonRegistry.getStatuses();return{model:this.config.name||"brain-app",version:this.config.version||"1.0.0",uptime:Math.floor((Date.now()-this.bootTime)/1000),entities:X,embeddings:Y,ai:{model:this.config.ai.model,embeddingModel:"text-embedding-3-small"},daemons:W,endpoints:this.listEndpoints()}}registerCoreDataSources(){this.services.dataSourceRegistry.register(new DU(this.services.aiService,this.services.entityService,this.services.templateRegistry,()=>this.services.identityService.getCharacterContent(),()=>this.services.profileService.getProfileContent(),this.config.siteBaseUrl)),this.services.dataSourceRegistry.register(new VU(this.services.entityService)),this.services.logger.debug("Core DataSources registered")}registerSystemCapabilities(){let $=this.services.jobQueueService;ku({entityService:this.services.entityService,entityRegistry:this.services.entityRegistry,jobs:{...this.jobs,enqueue:eW($,"system",!1),enqueueBatch:$U(this.jobs,"system"),registerHandler:XU($,"system")},conversationService:this.services.conversationService,logger:this.services.logger.child("system"),query:(X,Y)=>this.query(X,Y),getIdentity:()=>this.services.identityService.getCharacter(),getProfile:()=>this.services.profileService.getProfile(),getAppInfo:()=>this.getAppInfo(),searchLimit:10,insights:this.insightsRegistry},this.services.mcpService,this.services.messageBus,this.services.logger.child("system"))}}var gu=A(()=>{h9();R$();_Q();xY();QT();DH();Qu();vu();b9()});var iO=A(()=>{gu();_Q();xY();DH()});var $2,mu,uu;var G7=A(()=>{R$();h9();OX();$2=Z.enum(["debug","info","warn","error"]),mu=Z.object({provider:Z.enum(["hetzner","docker"]).default("hetzner"),serverSize:Z.string().default("cx33"),location:Z.string().default("fsn1"),domain:Z.string().optional(),docker:Z.object({enabled:Z.boolean().default(!0),image:Z.string().optional()}).default({}),ports:Z.object({default:Z.number().default(3333),preview:Z.number().default(4321),production:Z.number().default(8080)}).default({}),cdn:Z.object({enabled:Z.boolean().default(!1),provider:Z.enum(["bunny","none"]).default("none")}).default({}),dns:Z.object({enabled:Z.boolean().default(!1),provider:Z.enum(["bunny","none"]).default("none")}).default({}),paths:Z.object({install:Z.string().optional(),data:Z.string().optional()}).default({})}),uu=Z.object({name:Z.string().default("brain-app"),version:Z.string().default("1.0.0"),database:Z.string().optional(),aiApiKey:Z.string().optional(),aiImageKey:Z.string().optional(),aiModel:Z.string().optional(),logLevel:$2.optional(),logFile:Z.string().optional(),plugins:Z.array(WY).default([]),identity:qX.optional(),deployment:mu.default({})})});var pu=A(()=>{uK();R$()});var cu=A(()=>{vK();R$()});var du=A(()=>{wQ();R$()});var rO=A(()=>{iO();pu();cu();du()});var lu=A(()=>{iO();R$();G7();rO()});lu();G7();rO();G7();R$();var nO=Z.enum(["core","default","full"]),Ko$=nO.options,iu=Z.enum(["eval"]);function ru($){return $}R$();R$();G7();var JQ$=Z.record(Z.unknown()),nu=Z.object({package:Z.string().min(1),config:Z.record(Z.unknown()).optional()}).strict(),ou=JQ$.superRefine(($,X)=>{if(typeof $.package!=="string")return;if(!nu.safeParse($).success)X.addIssue({code:Z.ZodIssueCode.custom,message:'external plugin declarations may only contain "package" and optional nested "config"'})}),Bo$=Z.object({brain:Z.string().optional(),site:Z.object({package:Z.string().optional(),variant:Z.string().optional(),theme:Z.string().optional(),themeOverride:Z.string().optional()}).optional(),name:Z.string().optional(),logLevel:$2.optional(),logFile:Z.string().optional(),port:Z.number().optional(),domain:Z.string().optional(),database:Z.string().optional(),model:Z.string().optional(),preset:nO.optional(),mode:iu.optional(),add:Z.array(Z.string()).optional(),remove:Z.array(Z.string()).optional(),anchors:Z.array(Z.string()).optional(),trusted:Z.array(Z.string()).optional(),plugins:Z.record(ou).optional(),permissions:Z.object({anchors:Z.array(Z.string()).optional(),trusted:Z.array(Z.string()).optional(),rules:Z.array(Z.object({pattern:Z.string(),level:Z.enum(["anchor","trusted","public"])})).optional()}).optional()});R$();var au=Z.string(),WQ$=Z.object({id:Z.string().min(1)}).passthrough(),UQ$=Z.object({label:Z.string().min(1)}).passthrough(),GQ$=Z.object({layouts:Z.record(Z.unknown()),plugin:Z.function(),routes:Z.array(WQ$),entityDisplay:Z.record(UQ$),staticAssets:Z.record(Z.string()).optional()}).passthrough(),su=Z.custom(($)=>GQ$.safeParse($).success);G7();var VQ$=Z.object({id:Z.string().min(1)}).passthrough(),KQ$=Z.object({label:Z.string().min(1)}).passthrough(),uo$=Z.object({layouts:Z.record(Z.unknown()).optional(),plugin:Z.function().optional(),pluginConfig:Z.record(Z.unknown()).optional(),routes:Z.array(VQ$).optional(),entityDisplay:Z.record(KQ$).optional(),staticAssets:Z.record(Z.string()).optional()}).passthrough();var Jp={name:"@rizom/brain",version:"0.2.0-alpha.47",description:"Brain runtime + CLI \u2014 scaffold, run, and manage AI brain instances",type:"module",bin:{brain:"./dist/brain.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./cli":"./dist/brain.js","./plugins":{types:"./dist/plugins.d.ts",import:"./dist/plugins.js"},"./entities":{types:"./dist/entities.d.ts",import:"./dist/entities.js"},"./services":{types:"./dist/services.d.ts",import:"./dist/services.js"},"./interfaces":{types:"./dist/interfaces.d.ts",import:"./dist/interfaces.js"},"./templates":{types:"./dist/templates.d.ts",import:"./dist/templates.js"},"./site":{types:"./dist/site.d.ts",import:"./dist/site.js"},"./themes":{types:"./dist/themes.d.ts",import:"./dist/themes.js"},"./deploy":{types:"./dist/deploy.d.ts",import:"./dist/deploy.js"},"./tsconfig.instance.json":"./tsconfig.instance.json"},files:["dist","templates","tsconfig.instance.json"],scripts:{build:"bun scripts/build.ts",prepublishOnly:"bun scripts/build.ts","dev:start":"bun dist/brain.js start",typecheck:"tsc --noEmit",test:"bun test",lint:"eslint . --ext .ts"},dependencies:{"@clack/prompts":"^0.11.0","@modelcontextprotocol/sdk":"^1.24.0","@tailwindcss/postcss":"^4.1.13","@tailwindcss/typography":"^0.5.19",postcss:"^8.5.6",preact:"^10.27.2","preact-render-to-string":"^6.3.1",tailwindcss:"^4.1.11"},optionalDependencies:{"@libsql/client":"^0.15.7","@tailwindcss/oxide":"^4.1.4","better-sqlite3":"^11.8.1",lightningcss:"^1.29.2","react-devtools-core":"^6.1.1",sharp:"^0.34.5"},devDependencies:{"@brains/app":"workspace:*","@brains/deploy-templates":"workspace:*","@brains/eslint-config":"workspace:*","@brains/mcp-service":"workspace:*","@brains/plugins":"workspace:*","@brains/ranger":"workspace:*","@brains/relay":"workspace:*","@brains/rover":"workspace:*","@brains/site-composition":"workspace:*","@brains/site-default":"workspace:*","@brains/site-personal":"workspace:*","@brains/site-professional":"workspace:*","@brains/theme-default":"workspace:*","@brains/theme-rizom":"workspace:*","@brains/typescript-config":"workspace:*","@brains/utils":"workspace:*","@types/bun":"latest",typescript:"^5.3.3"},publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/rizom-ai/brains.git",directory:"packages/brain-cli"},license:"Apache-2.0",author:"Yeehaa <yeehaa@rizom.ai> (https://rizom.ai)",homepage:"https://github.com/rizom-ai/brains/tree/main/packages/brain-cli#readme",bugs:"https://github.com/rizom-ai/brains/issues",engines:{bun:">=1.3.3"},keywords:["brain","ai","cli","mcp","agent","personal-ai","knowledge-management"]};var ZQ$=Jp.version;export{ru as defineBrain,ZQ$ as PLUGIN_API_VERSION};
502
-
503
- //# debugId=A06996477C9EA42064756E2164756E21
4
+ //# debugId=82F6276303B3D72E64756E2164756E21
504
5
  //# sourceMappingURL=index.js.map